@using PantheonRA.BackOffice.Enums
@using PAW.Contracts.Enums;
@model string

<div class="form-group">
    <label class="control-label">@Loc.MasterData</label>
    <select id="productCodelist" class="form-control custom-select" onchange="onChangeProductCodelist()">
        <option @(Model == ProductCodelistType.Idents ? "selected" : string.Empty) data-url="@Url.Action("Index", "Products")">@Loc.Items</option>
        <option @(Model == ProductCodelistType.Classifications ? "selected" : string.Empty) data-url="@Url.Action("Index", "ProductClassif")">@Loc.Classifications</option>
        <option @(Model == ProductCodelistType.AccountingTypes ? "selected" : string.Empty) data-url="@Url.Action("Index", "ProductTypes")">@Loc.AccountingTypes</option>
        <option @(Model == ProductCodelistType.MainMeasurementUnits ? "selected" : string.Empty) data-url="@Url.Action("Index", "MeasurementUnits")">@Loc.MainMeasurementUnits</option>
        @if (PantheonRA.BackOffice.CurrentUser.Localization == Localization.Code.HR)
        {
            <option @(Model == ProductCodelistType.CustomsTariffs ? "selected" : string.Empty) data-url="@Url.Action("Index", "CustTariff")">@Loc.CustomsTariffs</option>
            <option @(Model == ProductCodelistType.DutyCodeList ? "selected" : string.Empty) data-url="@Url.Action("Index", "Duty")">@Loc.DutyCodeList</option>
        }
    </select>
</div>


<script>
    function onChangeProductCodelist() {
        window.location = $("#productCodelist option:selected").attr("data-url");
    }
</script>
