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

<div class="form-group">
    <label class="control-label">@Loc.TypeOfView</label>
    <select id="issuedBillsTabTypes" class="form-control custom-select" onchange="onChangeIssuedBillType()">
        @if (Model.Author == AuthorType.ReceivedBills)
        {
            <option @(Model.Type == IssuedBillsTabType.Summary ? "selected" : string.Empty) data-url="@Url.Action("Index", "ReceivedBills")">@Loc.SummaryOverview</option>
            <option @(Model.Type == IssuedBillsTabType.Detailed ? "selected" : string.Empty) data-url="@Url.Action("ReceivedBillsBilling", "ReceivedBills")">@Loc.DetailOverview</option>
        }
        @if (Model.Author == AuthorType.Wholesale)
        {
            <option @(Model.Type == IssuedBillsTabType.Summary ? "selected" : string.Empty) data-url="@Url.Action("Index", "Wholesale")">@Loc.SummaryOverview</option>
            <option @(Model.Type == IssuedBillsTabType.Detailed ? "selected" : string.Empty) data-url="@Url.Action("IssuedBillsBilling", "Wholesale")">@Loc.DetailOverview</option>
        }
        @if (Model.Author == AuthorType.POS)
        {
            <option @(Model.Type == IssuedBillsTabType.Summary ? "selected" : string.Empty) data-url="@Url.Action("IssuedBillsSum", "CashRegister")">@Loc.SummaryOverview</option>
            <option @(Model.Type == IssuedBillsTabType.Detailed ? "selected" : string.Empty) data-url="@Url.Action("IssuedBills", "CashRegister")">@Loc.DetailOverview</option>
        }
    </select>
</div>


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