@using PantheonRA.BackOffice.Enums
@model PantheonRA.BackOffice.Models.OrderReportViewModel

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row m-b-sm">
        @Html.HiddenFor(model => model.AcKey)
        @Html.HiddenFor(model => model.OrderType)
        <div class="col-xs-12 m-b-sm">
            <a href="@(Model.OrderType == PantheonRA.WebApi.Contracts.Enums.OrderType.Buyer ?
               Url.Action("BuyerOrdersReport", "Order") : Url.Action("SupplierOrdersReport", "Order"))" 
               class="btn btn-success pull-right m-l-xs">@Loc.Back</a>

            <a href="@Url.Action("OrderPdf", "Order", new { id = Model.AcKey, orderType = Model.OrderType, paperSize = PaperSizeType.A4 })" class="btn btn-primary pull-right printDropdown">
                <i class="far fa-print print-loader-icon m-r-sm"></i><span class="visible-lg-inline visible-md-inline">
                    @Loc.Print
                </span>
            </a>
        </div>
        <div class="col-xs-12">
            <div class="ibox-content">
                <div class="row">
                    <div id="orderPreview"></div>
                </div>
            </div>
        </div>
    </div>
</div>

<div id="PrintPreview" data-url="@Url.Action("OrderPdf", "Order", new { id = Model.AcKey, orderType = Model.OrderType, paperSize = PaperSizeType.A4 })" style="display:none"></div>

@section pageScripts{
    <script type="text/javascript">
        $(document).ready(function () {
            $("#orderPreview").mediaViewer({ dataUrl: $('#PrintPreview').data('url'), dataType: "pdf" });
        });
    </script>
}