@model PantheonRA.WebApi.Contracts.DailyWageDetails
@using PantheonRA.BackOffice.Models

@{
    string ActionMethod = "Create";
    if (!string.IsNullOrEmpty(Model.DailyAllow))
    {
        ActionMethod = "Edit";
    }
    var hideOnCreate = string.IsNullOrEmpty(Model.DailyAllow) ? "hidden" : string.Empty;
    var dailyWageCreateRowId = "createDailyWage";
    var disableChangeDailyAllow = string.IsNullOrEmpty(Model.DailyAllow) ? string.Empty : "disabled";
    var saveDailyWageId = "saveDailyWageBtn";
    var createdParam = Request.Params["created"];
    var createdDailyWage = !string.IsNullOrEmpty(createdParam) && createdParam.Equals("true") ? true : false;
}

@Html.Partial("_HelperValues")

<div class="wrapper wrapper-content">
    <div class="tabs-container">
        @Html.Partial("~/Views/Products/_CodeListTabNavigation.cshtml")

        <div class="row buttons-tabbed">
            @Html.Partial("_FormButtons", new FormButtonsViewModel
       {
           BackUrl =  createdDailyWage ? Url.Action("Index", "DailyWages", new { id = Model.DailyAllow }) : Url.Action("Index", "DailyWages")
       })

            <button id="@saveDailyWageId" title="@Loc.Save" type="button" onclick="addDailyWage('@dailyWageCreateRowId', '@ActionMethod', '@saveDailyWageId')"
                    class="btn btn-success pull-right">
                <i class="fa fa-save"></i>
                <span class="visible-lg-inline visible-md-inline">@Loc.Save</span>
            </button>

            <button title="@Loc.Delete" type="button" onclick="deleteDailyWage('@Model.DailyAllow')"
                    class="btn btn-primary btn-outline pull-right pull-right @hideOnCreate">
                <i class="far fa-trash-alt"></i>
                <span class="visible-lg-inline visible-md-inline">@Loc.Delete</span>
            </button>

        </div>

        <div class="divided-content">
            <div class="divided-content-main divided-content-full">
                <div class="row">
                    <div class="col-md-6 column-full-height-border-right">
                        <div class="form-horizontal">
                            <div class="row">
                                <div class="col-md-12">
                                    <h3 class="m-b-md m-t-md">@Loc.DailyWageBasicInfo</h3>
                                    <div class="form-group">
                                        <div class="col-md-4">
                                            <label class="control-label m-t-xs custom-label">@Loc.DailyWageCode</label>
                                        </div>
                                        <div class="col-md-8">
                                            <input id="DailyAllow" type="text" class="form-control" maxlength="4" placeholder="@Loc.DailyWageCode" value="@Model.DailyAllow" @disableChangeDailyAllow />
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="col-md-4">
                                            <label class="control-label m-t-xs custom-label">@Loc.Name</label>
                                        </div>
                                        <div class="col-md-8">
                                            <input id="Name" type="text" class="form-control" placeholder="@Loc.Name" value="@Model.Name" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        @Html.Partial("_DailyWageValues", Model)
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@section pageScripts{
    @Scripts.Render("~/bundles/dailyWages")
    <script>
        $(document).ready(function () {
            $('#DailyAllow').focus();
        });
    </script>
}
