@model PantheonRA.Contracts.DataContracts.DocumentCreateData

@{
    ViewBag.Title = Loc.EditScannedDocument;
    Layout = null;
}

<div>
    <div class="row">
        <div class="col-sm-12">
            @using (Html.BeginForm())
            {
                @Html.HiddenFor(model => model.Id)
                @*@Html.HiddenFor(model => model.Creation)
                @Html.HiddenFor(model => model.CreationTime)*@
                @Html.HiddenFor(model => model.DocumentReference)
                for (var i = 0; i < Model.Streams.Count; i++)
                {
                    @Html.HiddenFor(x => x.Streams[i].Id)
                    @Html.HiddenFor(x => x.Streams[i].Name)
                    @Html.HiddenFor(x => x.Streams[i].Type)
                }

                <div class="ibox">
                    <div class="ibox-title">
                        <h5>@ViewBag.Title</h5>
                        <button type="submit" class="btn btn-primary pull-right"><i class="fa fa-save"></i>&nbsp;&nbsp;@Loc.Save</button>
                        <a href="@Url.Action("ReceivedDocuments", "Reports")" class="btn btn-success pull-right">@Loc.Back</a>
                    </div>
                    <div class="ibox-content">
                        <div class="flat well">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="overflow-parent">
                                        <span class="m-r-lg text-single-line"><b class="m-r-sm text-md">@Model.DocumentReference</b> <small>@Model.Date</small></span>
                                        @if (Model.LinkedDocumentDate != null)
                                        {
                                            <span class="m-r-lg text-single-line"><b class="m-r-sm">@Loc.DocumentDate</b> <small>@Model.LinkedDocumentDate</small></span>
                                        }
                                        @if (!string.IsNullOrEmpty(Model.PartnerName))
                                        {
                                            <span class="m-r-lg text-single-line"><b class="m-r-sm">@Loc.Partner</b> <small>@Model.PartnerName</small></span>
                                        }
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row m-b-sm m-t-sm">
                            <div class="col-md-4">
                                @Html.Partial("CreateFormPartial")
                            </div>
                            <div class="col-md-8">
                                <div class="row row-md">
                                    @foreach (var stream in Model.Streams)
                                    {
                                        <div class="col-lg-4 col-md-6 col-sm-6 col-xs-6 m-b">
                                            <div class="m-b-xs">
                                                <a href="@Url.Action("ShowImage", "Documents", new { id = stream.Id })" target="_blank">
                                                    <img src='@Url.Action("ShowImage", "Documents", new { id = stream.Id })' class="img-responsive img-placeholder" />
                                                </a>
                                            </div>
                                            <div class="text-right">
                                                <a class="text-default" title="@Loc.Print" onclick="openForPrint(&quot;@Url.Action("ShowImage", "Documents", new { id = stream.Id })&quot;)">
                                                    <i class="far fa-print fa-lg"></i>
                                                </a>
                                                <a class="text-default m-l-xs" title="@Loc.Save" onclick="downloadFile(@stream.Id)">
                                                    <i class="fa fa-save fa-lg"></i>
                                                </a>
                                            </div>
                                        </div>
                                    }
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            }
        </div>
    </div>
</div>