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

@Html.Partial("_HelperValues")

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

        <div class="row buttons-tabbed">
            <button type="button" class="btn btn-primary btn-outline collapsable-form-button" onclick="openImportDailyWagesModal()">
                <i class="fa fa-paper-plane" title="@Loc.ImportDailyWages"></i><span class="hidden-xs hidden-sm m-l-xs">@Loc.ImportDailyWages</span>
            </button>
            <a href="@Url.Action("Create", "DailyWages")" class="btn btn-primary btn-outline" title="@Loc.NewDailyWage">
                <i class="fa fa-plus"></i><span class="bold hidden-xs m-l-xs">@Loc.NewDailyWage</span>
            </a>
        </div>

        <div class="row document-head">
            <div class="col-md-2 col-xs-4">
                @Html.Partial("~/Views/Jobs/_EmployeesTabNavigation.cshtml", EmployeeCodelistType.DailyAllows)
            </div>
            <div class="col-md-3 col-xs-4">
                <div class="form-group">
                    <label class="control-label">@Loc.SearchFilter</label>
                    @Html.TextBoxFor(model => model.Keywords, new { @id = "Keywords", @class = "form-control search-input", @placeholder = Loc.Search, autocomplete = "off" })
                </div>
            </div>
        </div>
        <div class="flex-wrapper">
            <div class="flex-daily-wages">
                <h3>@Loc.DailyAllows</h3>
                <div>
                    <table id="mainGrid" data-grid-id="daily-wages" data-url="@Url.Action("DailyWagesList", "DailyWages")" class="list-table">
                        <thead>
                            <tr>
                                <th width="20%" data-url="@Url.Action("Edit","DailyWages")?dailyWageCode=">@Loc.DailyAllows</th>
                                <th width="30%">@Loc.Name</th>
                                <th width="10%">@Loc.Value</th>
                                <th width="10%">@Loc.FieldSupplement</th>
                                <th width="10%">@Loc.Currency</th>
                                <th width="20%">@Loc.EffectiveDateFrom</th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="flex-mileage">
                <h3>@Loc.DailyWagesMileage</h3>
                @Html.Partial("_Mileage", Model)
            </div>

        </div>
    </div>
</div>

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

        function openImportDailyWagesModal() {
            let tableTitles = ['@Loc.DailyWage', '@Loc.Name', '@Loc.Value', '@Loc.Currency'];
                let tableDataNames = ["DailyWage", "Name", "Value", "Currency"];
            let localization = {
                importType: "@Loc.ImportType",
                forCountry: "@Loc.ForCountry",
                dowloadFromServer: "@Loc.DownloadFromServer",
                importIntoCodebook: "@Loc.ImportIntoCodebook",
                importTypeAdding: "@Loc.ImportTypeAdding",
                importTypeAddEdit: "@Loc.ImportTypeAddEdit",
                yesNo: "@Loc.Yes/@Loc.No"
            };

            openImportCodebookModal("@Loc.ImportDailyWages", tableTitles, tableDataNames,
                '@Url.Action("GetImportDailyWages", "DailyWages")',
                '@Url.Action("ImportDailyWages", "DailyWages")',
                '@SiteHelpAttributeHelper.GetHelpUrl(PantheonRA.BackOffice.Enums.HelpIds.ImportDailyWages)',
                localization,
                '@PantheonRA.BackOffice.CurrentUser.Localization',
                function () {
                    $.fn.dataTable.reload($('#mainGrid'));
                })
        }
    </script>
}