@model PantheonRA.BackOffice.Models.SubjectCreateViewModel
@using PantheonRA.BackOffice.Models
@using PantheonRA.BackOffice.Enums
@using PantheonRA.BackOffice;

@{
    ViewBag.Title = string.IsNullOrEmpty(Model.SubjectEditData.Id) ? Loc.CreateNewSubject : Loc.EditSubject;
    var CanViewData = PantheonRA.BackOffice.CurrentUser.IsGDPR || !string.IsNullOrEmpty(Model.SubjectEditData.VAT) || string.IsNullOrEmpty(Model.SubjectEditData.Id);
}

<div class="wrapper wrapper-content">
    <div class="tabs-container">
        @Html.Partial("~/Views/Products/_CodeListTabNavigation.cshtml")
        <div class="tab-content">
            @Html.HiddenFor(model => model.ShowError)
            @Html.HiddenFor(model => model.ErrorType)
            @Html.HiddenFor(model => model.Type)
            @Html.HiddenFor(model => model.SubjectId)
            <div class="row buttons-tabbed" id="subject-buttons">
                @Html.Partial("_FormButtons", new FormButtonsViewModel
                {
                    BackUrl = Url.Action("Index", "Subjects"),
                    SaveButtonGroup = new FormButtonGroup
                    {
                        Buttons = new List<FormButton>
                             {
                                 new FormButton { Text = Loc.Save, Icon = "fa fa-save fa-lg", IsSubmit = true, OnClick="submitSaveSubject()" }
                             }
                    },
                    PrintType = ReportFormName.Subjects,
                    PrintMenuButtonGroup = ReportsHelper.FormatReportTree(
                        Model.ReportTree,
                        "print('{0}')",
                        "print('{0}')"
                    ),
                })

                <button id="invoiceDelete" type="button" onclick="removeSubject()" title="@Loc.Delete"
                        class="btn btn-danger btn-outline pull-right collapsable-form-button @(Model.IsEdit ? string.Empty : " hidden")">
                    <i class="far fa-trash-alt m-r-xs"></i>
                    <span class="visible-lg-inline visible-md-inline">@Loc.Delete</span>
                </button>
            </div>


            <div class="divided-content">
                <div class="divided-content-main">
                    @if (Model.Type == SubjectsMenuType.BasicInfo)
                    {
                        Html.RenderPartial("~/Views/Subjects/_CreateSubjectFormPartial.cshtml", Model);
                    }
                    else if (Model.Type == SubjectsMenuType.Approvals)
                    {
                        Html.RenderPartial("~/Views/Subjects/_SubjectApprovalsPartial.cshtml", Model);
                    }
                    else if (Model.Type == SubjectsMenuType.EPayments)
                    {
                        Html.RenderPartial("~/Views/Subjects/_SubjectEPaymentsPartial.cshtml", Model);
                    }
                    else if (Model.Type == SubjectsMenuType.Documents)
                    {
                        Html.RenderPartial("~/Views/Subjects/_SubjectDocumentsPartial.cshtml", Model);
                    }

                </div>
                <div class="divided-content-side" style="min-height: 88vh">
                    @{Html.RenderAction("SideMenu", "Subjects", new { activeTitle = Model.Title, id = Model.SubjectId, description = Model.SubjectEditData != null ? Model.SubjectEditData.Name : string.Empty });}
                </div>
            </div>
        </div>
    </div>
</div>
@{Html.RenderPartial("~/Views/Shared/Components/_DeleteModal.cshtml");}

<input type="hidden" id="AjpesUrl" value="@Url.Action("AjpesSearch", "Subjects")" />
<input type="hidden" id="DeleteSubjectUrl" value="@Url.Action("Remove", "Subjects")" />
<input type="hidden" id="subjectsIndex" value="@Url.Action("Index", "Subjects")" />
<input type="hidden" id="createSubjectUrl" value="@Url.Action("Create", "Subjects")" />
<input type="hidden" id="editSubjectUrl" value="@Url.Action("Edit", "Subjects")" />
<input type="hidden" id="printSubjectUrl" value="@Url.Action("SubjectsPrint", "Subjects")" />
<input type="hidden" id="YesLoc" value="@Loc.Yes" />
<input type="hidden" id="NoLoc" value="@Loc.No" />
<input type="hidden" id="DeleteSubjectErrorLoc" value="@Loc.DeleteWasNotSuccessful" />
<input type="hidden" id="ConfirmDeleteLoc" value="@Loc.ConfirmDeleteMessage" />
<input type="hidden" id="GeneralErrorLoc" value="@Loc.GeneralError" />
<input type="hidden" id="PrintingErrorLoc" value="@Loc.PrintingError" />
<input type="hidden" id="WayOfSaleFinalBuyer" value="@WayOfSale.FinalBuyer" />
<input type="hidden" id="WayOfSaleIsTaxComitted" value="@WayOfSale.IsTaxComitted" />
<input type="hidden" id="WayOfSaleDomesticTaxpayers" value="@WayOfSale.DomesticTaxpayers" />
<input type="hidden" id="SubjectsMenuTypeBasicInfo" value="@SubjectsMenuType.BasicInfo" />

@section pageScripts{
    @Scripts.Render("~/bundles/product")

    <script>
        $(document).ready(function () {
            initializeSubjectsCreate(true);
        });
    </script>
}

<style>
    .divided-content-toggle {
        top: 30px !important;
    }
</style>