@{
    Layout = "../shared/_LayoutCreatePackage.cshtml";
    ViewBag.Title = "Brightstar Device Protection: Summary";
}
@using WebSite.Areas.TradeIn.Types
@model WebSite.Areas.TradeIn.Models.AddTradeInTempData

@using (Html.BeginForm("Summary", "Create", FormMethod.Post))
{
    <div class="WizardContainer">

        @foreach (var item in SessionContext.TradeInOrderDetails)
        {
            <div class="k-block k-info-colored msgBox" style="text-align: left">
                <div style="width: 100%; overflow: hidden">
                    <div class="summarycolumn">
                        @Resources.BuyBack.TradeInlabelManufacturer
                    </div>
                    <div class="summarycolumn">
                        <b> @item.SelectedManufacturer.Text</b>
                    </div>
                </div>
                <div style="width: 100%; overflow: hidden">
                    <div class="summarycolumn">
                        @Resources.BuyBack.TradeInlabelModel
                    </div>
                    <div class="summarycolumn">
                        <b> @item.SelectedModel.Text</b>
                    </div>
                </div>
                <div style="width: 100%; overflow: hidden">
                    <div class="summarycolumn">
                        @Resources.BuyBack.TradeInlabelCondition
                    </div>
                    <div class="summarycolumn">
                        <b> @item.SelectedDeviceCondition.Text</b>
                    </div>
                </div>
                <div style="width: 100%; overflow: hidden">
                    <div class="summarycolumn">
                        @Resources.BuyBack.TradeInlabelCarrier
                    </div>
                    <div class="summarycolumn">
                        <b> @item.SelectedCarrier.Text</b>
                    </div>
                </div>
                <div style="width: 100%; overflow: hidden">
                    <div class="summarycolumn">
                        @Resources.BuyBack.TradeInlabelESN
                    </div>
                    <div class="summarycolumn">
                        <b> @item.ESN</b>
                    </div>
                </div>

                <div style="width: 100%; overflow: hidden">
                    <div class="summarycolumn">
                       @Resources.BuyBack.TradeInlabelPurchaseDate
                    </div>
                    <div class="summarycolumn">
                        <b> @item.PurchaseDate</b>
                    </div>
                </div>
                <div style="width: 100%; overflow: hidden">
                    <div class="summarycolumn">
                        @Resources.BuyBack.TradeInlabelPrice
                    </div>
                    <div class="summarycolumn">
                        <b> @item.PriceInCurrencyFormat</b>
                    </div>
                </div>
            </div>
        }

        <div class="k-block k-info-colored msgBox" style="text-align: left">
            <div style="width: 100%; overflow: hidden">
                <div class="summarycolumn">
                    @Resources.BuyBack.TradeInlabelContactPerson
                </div>
                <div class="summarycolumn">
                    <b> @Html.DisplayFor(m => m.ContactPerson)</b>
                </div>
            </div>
            <div style="width: 100%; overflow: hidden">
                <div class="summarycolumn">
                    @Resources.BuyBack.TradeInlabelContactEmail
                </div>
                <div class="summarycolumn">
                    <b> @Html.DisplayFor(m => m.ContactEmail)</b>
                </div>
            </div>
            <div style="width: 100%; overflow: hidden">
                <div class="summarycolumn">
                    @Resources.BuyBack.TradeInlabelContactPhone
                </div>
                <div class="summarycolumn">
                    <b> @Html.DisplayFor(m => m.ContactPhone)</b>
                </div>
            </div>
            <div style="width: 100%; overflow: hidden">
                <div class="summarycolumn">
                    @Resources.BuyBack.TradeInlabelTotalPrice
                </div>
                <div class="summarycolumn">
                    <b> @SessionContext.TradeInOrderDetails.Sum(t => t.Price).ToString("C")</b>
                </div>
            </div>
        </div>

        @{ SessionContext.TradeInOrderDetails.Clear(); }

        <div class="stepContainer">
            <div style="height: 50px">
                <div style="position: absolute; bottom: 20px; left: 45%; margin-left: -200px;">
                    <input type="button" class="action-button" value="@Resources.BuyBack.TradeInPrintReceiptButtonText" onclick="DisplayView(this);" data-viewname="TradeInOrderReceipt" data-orderid=@Model.OrderID />
                    <input type="button" class="action-button" value="@Resources.BuyBack.TradeInTradeInPrintWrapperButtonText" onclick="DisplayView(this);" data-viewname="TradeInWrapper" data-orderid=@Model.OrderID /> 
                    <input type="submit" class="action-button" name="btnNext" id="btnNext" value="@Resources.BuyBack.TradeInTradeInDoneButtonText">
                    
                </div>
            </div>
        </div>

    </div>
}
<script>
    function DisplayView(e) {
        var viewname = $(e).data('viewname');
        var orderID = $(e).data('orderid');
        window.open('/eSecuritel/HITS/WebSite/TradeIn/Create/' + viewname + '?tradeInOrderId=' + orderID);
    }
</script>