@using Tiobon.Core
@using Tiobon.Core.Model.ViewModels.Extend
@{
    Layout = "~/Views/Shared/_Layout.cshtml";

    string frontUrl = AppSettings.app(["Startup", "FrontUrl"]);
    List<ResumeFormColumn> Columns = ViewBag.Columns;
    Ghrh_ResumeDto entity = ViewBag.entity;
    ViewData["Title"] = entity.StaffName;
    Dictionary<string, object> BaseDic = ViewBag.BaseDic;
    List<Dictionary<string, object>> FamilyDic = ViewBag.FamilyDic;
    List<Dictionary<string, object>> EducationDic = ViewBag.EducationDic;
    List<Dictionary<string, object>> WorkExpDic = ViewBag.WorkExpDic;
    List<Dictionary<string, object>> LicenceDic = ViewBag.LicenceDic;
    List<Dictionary<string, object>> TrainingDic = ViewBag.TrainingDic;
    Dictionary<string, bool?> StatementDic = ViewBag.StatementDic;
    bool displaySignatureArea = ViewBag.DisplaySignatureArea;
}
<link rel="stylesheet" href="@ViewBag.CssUrl">
<style>
    body {
        color: #000000d9;
        font-size: 14px;
        font-family: Noto Sans SC, PingFang SC, tahoma, arial, Hiragino Sans GB, Hiragino Sans GB W3, Microsoft Yahei, STHeitiSC-Light, Helvetica-Light, sans-serif !important;
        page-break-before: always;
    }

    .ghr-preview-staff-info .pageContainer {
        background-color: #fff;
        overflow-y: auto;
        overflow: hidden;
        padding: 10px;
    }
     
    .pageContainer .a4page.displayMode {
        margin: 20px auto;
        display: flex;
        flex-wrap: wrap;
    }



    .ghr-preview-staff-resume-title {
        height: 26px;
        line-height: 26px;
        font-size: 18px;
        color: #242424;
        margin: 10px 0;
        border-left: 2px solid #ff9300;
        padding-left: 15px;
        width: 100%
    }


    .page-break-inside {
        page-break-inside: avoid;
    }
    .grid-container {
        display: -webkit-box;
        -webkit-box-orient: horizontal;
        -webkit-box-align: center;
        -webkit-box-pack: center;
        margin: 5px 0;
        min-height: 25px;
        line-height: 25px;
    }

    .grid-item {
        -webkit-box-flex: 1;
        flex: 1;
        width: 50%;
    }

        .grid-item .label {
            vertical-align: top;
            width: 150px;
            /* -webkit-box-flex: 1; */
            text-align: right;
            display: inline-block;
        }

        .grid-item .value {
            /* -webkit-box-flex: 1;  */
            display: inline-block;
        }

    .staffPhoto {
        width: 100px;
        height: 100px;
        display: inline-block;
        vertical-align: top;
        position: relative;
        padding: 10px;
    }

        .staffPhoto img {
            width: 100%;
            height: 100%;
            -o-object-fit: contain;
            object-fit: contain;
        }

    .staffBaseInfo {
        height: 100px;
        display: inline-block;
        vertical-align: top;
        padding-left: 25px;
    }

    .staffName {
        font-size: 20px;
        margin-top: 10px;
    }

    .staffEName {
        font-size: 16px;
        color: #5d5d5d;
    }

    .staffHumanResourcesMsg {
        font-size: 16px;
        color: #5d5d5d;
        margin-top: 15px;
    }
</style>
<div class="ghr-preview-staff-info">
    <div class="pageContainer">

        @if (Columns != null && Columns.Count > 0)
        {
            foreach (var item in Columns)
            {
                if (item.tabKey == "Photo")
                {
                    <div class="grid-container">
                        <div class="grid-item staffPhoto">
                            @if (!string.IsNullOrEmpty(entity.PhotoUrl))
                            {
                                <img src="@frontUrl@entity.PhotoUrl" alt="">
                            }
                        </div>
                        <div class="grid-item">
                            <div class="staffName">@(entity.StaffName)&nbsp;</div>
                            <div class="staffEName">@(entity.ApplyStatusLabel)&nbsp;</div>
                            <div class="staffHumanResourcesMsg">经验：@(entity.WorkYears)年工作经验&nbsp; <span><span> | </span><span>年龄：@(entity.Age)</span> &nbsp; </span><span><span> | </span><span>学历: @(entity.EduDegreeLabel)</span> &nbsp; </span></div>
                        </div>
                    </div>
                }
                else if (item.tabKey == "Base")
                {
                    <div>
                        <div class="ghr-preview-staff-resume-title" id="@item.tabKey">
                            @item.tabName
                        </div>
                        @if (item.children != null && item.children.Any())
                        {
                            for (int i = 0; i < item.children.Count; i = i + 2)
                            {
                                if (item.children[i].field == "RemarkSz" || ((i + 1) < item.children.Count && item.children[i + 1].field == "RemarkSz"))
                                {
                                    <div class="grid-container page-break-inside">
                                        <div class="grid-item ">
                                            <div class="label">@(item.children[i].label)：</div>
                                            @if (item.children[i].field == "Birthday" || item.children[i].field == "GraduateDate" || item.children[i].field == "Indate")
                                            {
                                                <div class="value">
                                                    @DateTimeHelper.ConvertToDayString(BaseDic[item.children[i].field])
                                                </div>
                                            }
                                            else
                                            {
                                                <div class="value">@Html.Raw(BaseDic[item.children[i].field])</div>
                                            }

                                        </div>
                                    </div>
                                    <div class="grid-container page-break-inside">
                                        @if ((i + 1) < item.children.Count)
                                        {
                                            <div class="grid-item">
                                                <div class="label">@(item.children[i + 1].label)：</div>
                                                @if (item.children[i + 1].field == "Birthday" || item.children[i + 1].field == "GraduateDate" || item.children[i + 1].field == "Indate")
                                                {
                                                    <div class="value">
                                                        @DateTimeHelper.ConvertToDayString(BaseDic[item.children[i + 1].field])
                                                    </div>
                                                }
                                                else
                                                {
                                                    <div class="value">@Html.Raw(BaseDic[item.children[i + 1].field])</div>
                                                }
                                            </div>
                                        }
                                    </div>
                                }
                                else
                                {
                                    <div class="grid-container page-break-inside">
                                        <div class="grid-item ">
                                            <div class="label">@(item.children[i].label)：</div>
                                            @if (item.children[i].field == "Birthday" || item.children[i].field == "GraduateDate" || item.children[i].field == "Indate")
                                            {
                                                <div class="value">
                                                    @DateTimeHelper.ConvertToDayString(BaseDic[item.children[i].field])
                                                </div>
                                            }
                                            else
                                            {
                                                <div class="value">@BaseDic[item.children[i].field]</div>
                                            }
                                        </div>
                                        @if ((i + 1) < item.children.Count)
                                        {
                                            <div class="grid-item">
                                                <div class="label">@(item.children[i + 1].label)：</div>
                                                @if (item.children[i + 1].field == "Birthday" || item.children[i + 1].field == "GraduateDate" || item.children[i + 1].field == "Indate")
                                                {
                                                    <div class="value">
                                                        @DateTimeHelper.ConvertToDayString(BaseDic[item.children[i + 1].field])
                                                    </div>
                                                }
                                                else
                                                {
                                                    <div class="value">@BaseDic[item.children[i + 1].field]</div>
                                                }
                                            </div>
                                        }
                                    </div>
                                }
                            }
                        }

                    </div>
                }
                else if (item.tabKey == "Family")
                {
                    @if (FamilyDic.Count > 0)
                    {
                        <div>
                            <div class="ghr-preview-staff-resume-title" id="@item.tabKey">
                                @item.tabName
                            </div>
                            @for (var j = 0; j < FamilyDic.Count; j++)
                            {
                                @if (j > 0)
                                {
                                    <div style="margin-top:20px"></div>
                                }
                                @if (item.children != null && item.children.Any())
                                {
                                    for (int i = 0; i < item.children.Count; i = i + 2)
                                    {
                                        if (item.children[i].label == "备注" || ((i + 1) < item.children.Count && item.children[i + 1].label == "备注"))
                                        {
                                            <div class="grid-container page-break-inside">
                                                <div class="grid-item ">
                                                    <div class="label">@(item.children[i].label)：</div>
                                                    @if (item.children[i].field == "Birth")
                                                    {
                                                        <div class="value">
                                                            @DateTimeHelper.ConvertToDayString(FamilyDic[j][item.children[i].field])
                                                        </div>
                                                    }
                                                    else
                                                    {
                                                        <div class="value">@FamilyDic[j][item.children[i].field]</div>
                                                    }

                                                </div>
                                            </div>
                                            <div class="grid-container page-break-inside">
                                                @if ((i + 1) < item.children.Count)
                                                {
                                                    <div class="grid-item">
                                                        <div class="label">@(item.children[i + 1].label)：</div>
                                                        @if (item.children[i + 1].field == "Birth")
                                                        {
                                                            <div class="value">
                                                                @DateTimeHelper.ConvertToDayString(FamilyDic[j][item.children[i + 1].field])
                                                            </div>
                                                        }
                                                        else
                                                        {
                                                            <div class="value">@FamilyDic[j][item.children[i + 1].field]</div>
                                                        }
                                                    </div>
                                                }
                                            </div>
                                        }
                                        else
                                        {
                                            <div class="grid-container page-break-inside">
                                                <div class="grid-item ">
                                                    <div class="label">@(item.children[i].label)：</div>
                                                    @if (item.children[i].field == "Birth")
                                                    {
                                                        <div class="value">
                                                            @DateTimeHelper.ConvertToDayString(FamilyDic[j][item.children[i].field])
                                                        </div>
                                                    }
                                                    else
                                                    {
                                                        <div class="value">@FamilyDic[j][item.children[i].field]</div>
                                                    }
                                                </div>
                                                @if ((i + 1) < item.children.Count)
                                                {
                                                    <div class="grid-item">
                                                        <div class="label">@(item.children[i + 1].label)：</div>
                                                        @if (item.children[i + 1].field == "Birth")
                                                        {
                                                            <div class="value">
                                                                @DateTimeHelper.ConvertToDayString(FamilyDic[j][item.children[i + 1].field])
                                                            </div>
                                                        }
                                                        else
                                                        {
                                                            <div class="value">@FamilyDic[j][item.children[i + 1].field]</div>
                                                        }
                                                    </div>
                                                }
                                            </div>
                                        }
                                    }
                                }
                            }
                        </div>
                    }
                }
                else if (item.tabKey == "Education")
                {
                    @if (EducationDic.Count > 0)
                    {
                        <div>

                            <div class="ghr-preview-staff-resume-title" id="@item.tabKey">
                                @item.tabName
                            </div>
                            @for (var j = 0; j < EducationDic.Count; j++)
                            {
                                @if (j > 0)
                                {
                                    <div style="margin-top:20px"></div>
                                }
                                @if (item.children != null && item.children.Any())
                                {
                                    for (int i = 0; i < item.children.Count; i = i + 2)
                                    {
                                        if (item.children[i].label == "备注" || ((i + 1) < item.children.Count && item.children[i + 1].label == "备注"))
                                        {
                                            <div class="grid-container page-break-inside">
                                                <div class="grid-item ">
                                                    <div class="label">@(item.children[i].label)：</div>
                                                    @if (item.children[i].field == "Birth")
                                                    {
                                                        <div class="value">
                                                            @DateTimeHelper.ConvertToDayString(EducationDic[j][item.children[i].field])
                                                        </div>
                                                    }
                                                    else
                                                    {
                                                        <div class="value">@EducationDic[j][item.children[i].field]</div>
                                                    }

                                                </div>
                                            </div>
                                            <div class="grid-container page-break-inside">
                                                @if ((i + 1) < item.children.Count)
                                                {
                                                    <div class="grid-item">
                                                        <div class="label">@(item.children[i + 1].label)：</div>
                                                        @if (item.children[i + 1].field == "Birth")
                                                        {
                                                            <div class="value">
                                                                @DateTimeHelper.ConvertToDayString(EducationDic[j][item.children[i + 1].field])
                                                            </div>
                                                        }
                                                        else
                                                        {
                                                            <div class="value">@EducationDic[j][item.children[i + 1].field]</div>
                                                        }
                                                    </div>
                                                }
                                            </div>
                                        }
                                        else
                                        {
                                            <div class="grid-container page-break-inside">
                                                <div class="grid-item ">
                                                    <div class="label">@(item.children[i].label)：</div>
                                                    @if (item.children[i].field == "Birth")
                                                    {
                                                        <div class="value">
                                                            @DateTimeHelper.ConvertToDayString(EducationDic[j][item.children[i].field])
                                                        </div>
                                                    }
                                                    else
                                                    {
                                                        <div class="value">@EducationDic[j][item.children[i].field]</div>
                                                    }
                                                </div>
                                                @if ((i + 1) < item.children.Count)
                                                {
                                                    <div class="grid-item">
                                                        <div class="label">@(item.children[i + 1].label)：</div>
                                                        @if (item.children[i + 1].field == "Birth")
                                                        {
                                                            <div class="value">
                                                                @DateTimeHelper.ConvertToDayString(EducationDic[j][item.children[i + 1].field])
                                                            </div>
                                                        }
                                                        else
                                                        {
                                                            <div class="value">@EducationDic[j][item.children[i + 1].field]</div>
                                                        }
                                                    </div>
                                                }
                                            </div>
                                        }
                                    }
                                }
                            }
                        </div>
                    }
                }
                else if (item.tabKey == "WorkExp")
                {
                    @if (WorkExpDic.Count > 0)
                    {
                        <div>
                            <div class="ghr-preview-staff-resume-title" id="@item.tabKey">
                                @item.tabName
                            </div>
                            @for (var j = 0; j < WorkExpDic.Count; j++)
                            {
                                @if (j > 0)
                                {
                                    <div style="margin-top:20px"></div>
                                }
                                @if (item.children != null && item.children.Any())
                                {
                                    for (int i = 0; i < item.children.Count; i = i + 2)
                                    {
                                        if (item.children[i].label == "备注" || ((i + 1) < item.children.Count && item.children[i + 1].label == "备注"))
                                        {
                                            <div class="grid-container page-break-inside">
                                                <div class="grid-item ">
                                                    <div class="label">@(item.children[i].label)：</div>
                                                    <div class="value">@WorkExpDic[j][item.children[i].field]</div>
                                                </div>
                                            </div>
                                            @if ((i + 1) < item.children.Count)
                                            {
                                                <div class="grid-container page-break-inside">
                                                    <div class="grid-item">
                                                        <div class="label">@(item.children[i + 1].label)：</div>
                                                        <div class="value">@WorkExpDic[j][item.children[i + 1].field]</div>
                                                    </div>
                                                </div>
                                            }
                                        }
                                        else
                                        {
                                            <div class="grid-container page-break-inside">
                                                <div class="grid-item ">
                                                    <div class="label">@(item.children[i].label)：</div>
                                                    <div class="value">@WorkExpDic[j][item.children[i].field]</div>
                                                </div>
                                                @if ((i + 1) < item.children.Count)
                                                {
                                                    <div class="grid-item">
                                                        <div class="label">@(item.children[i + 1].label)：</div>
                                                        <div class="value">@WorkExpDic[j][item.children[i + 1].field]</div>
                                                    </div>
                                                }
                                            </div>
                                        }
                                    }
                                }
                            }
                        </div>
                    }
                }
                else if (item.tabKey == "Licence")
                {
                    @if (LicenceDic.Count > 0)
                    {
                        <div>
                            <div class="ghr-preview-staff-resume-title" id="@item.tabKey">
                                @item.tabName
                            </div>
                            @for (var j = 0; j < LicenceDic.Count; j++)
                            {
                                @if (j > 0)
                                {
                                    <div style="margin-top:20px"></div>
                                }
                                @if (item.children != null && item.children.Any())
                                {
                                    for (int i = 0; i < item.children.Count; i = i + 2)
                                    {
                                        if (item.children[i].label == "备注" || ((i + 1) < item.children.Count && item.children[i + 1].label == "备注"))
                                        {
                                            <div class="grid-container page-break-inside">
                                                <div class="grid-item ">
                                                    <div class="label">@(item.children[i].label)：</div>
                                                    <div class="value">@LicenceDic[j][item.children[i].field]</div>
                                                </div>
                                            </div>
                                            @if ((i + 1) < item.children.Count)
                                            {
                                                <div class="grid-container page-break-inside">
                                                    <div class="grid-item">
                                                        <div class="label">@(item.children[i + 1].label)：</div>
                                                        <div class="value">@LicenceDic[j][item.children[i + 1].field]</div>
                                                    </div>
                                                </div>
                                            }
                                        }
                                        else
                                        {
                                            <div class="grid-container  page-break-inside">
                                                <div class="grid-item ">
                                                    <div class="label">@(item.children[i].label)：</div>
                                                    <div class="value">@LicenceDic[j][item.children[i].field]</div>
                                                </div>
                                                @if ((i + 1) < item.children.Count)
                                                {
                                                    <div class="grid-item">
                                                        <div class="label">@(item.children[i + 1].label)：</div>
                                                        <div class="value">@LicenceDic[j][item.children[i + 1].field]</div>
                                                    </div>
                                                }
                                            </div>
                                        }
                                    }
                                }
                            }
                        </div>
                    }
                }
                else if (item.tabKey == "Training")
                {
                    @if (TrainingDic.Count > 0)
                    {
                        <div>
                            <div class="ghr-preview-staff-resume-title" id="@item.tabKey">
                                @item.tabName
                            </div>
                            @for (var j = 0; j < TrainingDic.Count; j++)
                            {
                                @if (j > 0)
                                {
                                    <div style="margin-top:20px"></div>
                                }
                                @if (item.children != null && item.children.Any())
                                {
                                    for (int i = 0; i < item.children.Count; i = i + 2)
                                    {
                                        if (item.children[i].label == "培训说明" || ((i + 1) < item.children.Count && item.children[i + 1].label == "培训说明"))
                                        {
                                            <div class="grid-container page-break-inside">
                                                <div class="grid-item ">
                                                    <div class="label">@(item.children[i].label)：</div>
                                                    <div class="value">@TrainingDic[j][item.children[i].field]</div>
                                                </div>
                                            </div>
                                            <div class="grid-container page-break-inside">
                                                @if ((i + 1) < item.children.Count)
                                                {
                                                    <div class="grid-item">
                                                        <div class="label">@(item.children[i + 1].label)：</div>
                                                        <div class="value">@TrainingDic[j][item.children[i + 1].field]</div>
                                                    </div>
                                                }
                                            </div>
                                        }
                                        else
                                        {
                                            <div class="grid-container page-break-inside">
                                                <div class="grid-item ">
                                                    <div class="label">@(item.children[i].label)：</div>
                                                    <div class="value">@TrainingDic[j][item.children[i].field]</div>
                                                </div>
                                                @if ((i + 1) < item.children.Count)
                                                {
                                                    <div class="grid-item">
                                                        <div class="label">@(item.children[i + 1].label)：</div>
                                                        <div class="value">@TrainingDic[j][item.children[i + 1].field]</div>
                                                    </div>
                                                }
                                            </div>
                                        }
                                    }
                                }
                            }
                        </div>
                    }
                }
                else if (item.tabKey == "Statement")
                {

                    <div>
                        @{
                            var ii = 0;
                            if (item.children != null && item.children.Any())
                            {
                                <div class="ghr-preview-staff-resume-title" id="@item.tabKey">
                                    @item.tabName
                                </div>
                            }

                            if (item.children != null && item.children.Any())
                                foreach (var children in item.children)
                                {
                                    <div class="grid-container page-break-inside">
                                        <div class="grid-item ">
                                            <p style="margin: 0;padding: 5px;">
                                                @(ii + 1).&nbsp;@(children.placeholder)： @{
                                                    ii++;
                                                    if (StatementDic.ContainsKey("Statement" + ii))
                                                    {
                                                        if (StatementDic["Statement" + ii] != null)
                                                            if (StatementDic["Statement" + ii] == true)
                                                                @("是")
                                                            else
                                                                @("否")
                                                    }
                                                }
                                            </p>
                                        </div>
                                    </div>
                                }
                            <div class=" page-break-inside">
                                <p>
                                    @Html.Raw(ViewBag.StatementRemark)
                                </p>
                                @if (displaySignatureArea)
                                {
                                    <p>申请人签名：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;日期：</p>
                                }
                            </div>
                        }

                    </div>
                }
            }
        }
        <div style="height:50px"></div>
    </div>
</div>