@using PantheonRA.BackOffice.Enums
@using PantheonRA.BackOffice.Models
@using PAW.Contracts.Enums
@model IdentsTableViewModel

<div class="table-responsive document-table m-b-md">
    <div class="dt-bootstrap" style="position:relative">
        <table id="invoice" data-grid-id="@Model.TableGridName" data-dynamic-table="true" class="table table-bordered showhidecolumns" role="grid">
            <thead>
                <tr role="row">
                    <th data-column-id="Position" style="width:4%" data-sortable="false">@Loc.PositionShort</th>
                    <th data-column-id="Ident" style="width:@(Model.IsVATObligee ? "10%" : "13%")">@Loc.Ident</th>
                    <th data-column-id="Name" style="width:@(Model.IsVATObligee ? "10%" : "20%")">@Loc.Name</th>
                    <th data-column-id="Quantity" class="text-right" style="width:7%">@Loc.Quantity</th>
                    <th data-column-id="MeasUnit" style="width:7%">@Loc.MeasUnit</th>
                    <th data-column-id="Price/MeasUnit" style="width:8%">@Loc.Price/@Loc.MeasUnit</th>
                    <th data-column-id="Discount" style="width:7%">@Loc.Discount %</th>
                    @if (Model.IsVATObligee)
                    {
                        <th data-column-id="VAT" class="text-right" style="width:6%">@Loc.VAT</th>
                    }
                    @if (Model.Author != AuthorType.Transfer)
                    {
                        <th data-column-id="WarehousePriceOrValue" class="text-right">@((Model.Author == AuthorType.Wholesale || Model.Author == AuthorType.ReceivedBills || Model.Author == AuthorType.ExcessOrMissing) ? Loc.WarehousePrice : Loc.Value)</th>
                        <th data-column-id="WithoutTax" class="text-right">@Loc.WithoutTax</th>
                        if (Model.IsVATObligee)
                        {
                            <th data-column-id="TaxAmountValue" class="text-right">@Loc.TaxAmountValue</th>
                        }
                        <th data-column-id="Total" class="text-right">@Loc.Total</th>
                    }
                    else
                    {
                        <th data-column-id="Value" class="text-right">@Loc.Value</th>
                        <th data-column-id="PriceForValue" class="text-right">@Loc.PriceForValue</th>
                        <th data-column-id="WarehouseValue" class="text-right">@Loc.WarehouseValue</th>
                    }
                    @if (Model.Author == AuthorType.Wholesale || Model.Author == AuthorType.ReceivedBills || Model.Author == AuthorType.Transfer)
                    {
                        <th data-column-id="CostCarrier" style="width:7%">@Loc.CostCarrier</th>
                    }
                    @if (Model.Author == AuthorType.Wholesale && PantheonRA.BackOffice.CurrentUser.Localization == Localization.Code.ME)
                    {
                        <th data-column-id="ExemptFromVATSType" data-default-hidden="true" style="width:7%">@Loc.ExemptFromVAT</th>
                    }
                    @if (Model.Author == AuthorType.Wholesale)
                    {
                        <th data-column-id="RetailPrice" data-default-hidden="true" style="width:7%">@Loc.RetailPrice</th>
                        <th data-column-id="PriceRebate" data-default-hidden="true" style="width:7%">@Loc.PriceWithRebate</th>
                    }
                    <th data-column-id="Department" data-default-hidden="true" class="text-right">@Loc.Department</th>
                    @if (Model.Author == AuthorType.ExcessOrMissing)
                    {
                        <th data-column-id="AuthorExcess" style="min-width:50px; width:50px;"></th>
                    }
                    else
                    {
                        <th data-column-id="CommentDelete" style="min-width:92px; width:92px;" data-sortable="false"></th>
                    }
                </tr>
            </thead>
            <tbody id="identRows"></tbody>
        </table>
    </div>
</div>