<vn-auto-search
    model="model">
</vn-auto-search>
<vn-data-viewer
    model="model"
    class="vn-w-lg">
    <vn-card>
    <vn-table model="model">
        <vn-thead>
            <vn-tr>
                <vn-th field="id">ID</vn-th>
                <vn-th field="supplierFk">Supplier</vn-th>
                <vn-th field="supplierRef">Supplier ref.</vn-th>
                <vn-th field="serialNumber">Serial number</vn-th>
                <vn-th field="serial">Serial</vn-th>
                <vn-th field="account">Account</vn-th>
                <vn-th field="issued" expand>Issued</vn-th>
                <vn-th field="isBooked" center>Is booked</vn-th>
                <vn-th field="awbCode" vn-tooltip="Air Waybill">AWB</vn-th>
                <vn-th field="amount" filter-enabled="false">Amount</vn-th>
                <vn-th></vn-th>
            </vn-tr>
        </vn-thead>
        <vn-tbody>
            <a
                ng-repeat="invoiceIn in model.data"
                class="clickable vn-tr search-result"
                ui-sref="invoiceIn.card.summary({id: {{::invoiceIn.id}}})">
                <vn-td>{{::invoiceIn.id}}</vn-td>
                <vn-td>
                    <span
                        class="link"
                        vn-click-stop="supplierDescriptor.show($event, invoiceIn.supplierFk)">
                        {{::invoiceIn.supplierName}}
                    </span>
                </vn-td>
                <vn-td>{{::invoiceIn.supplierRef | dashIfEmpty}}</vn-td>
                <vn-td>{{::invoiceIn.serialNumber}}</vn-td>
                <vn-td>{{::invoiceIn.serial}}</vn-td>
                <vn-td>{{::invoiceIn.account}}</vn-td>
                <vn-td expand>{{::invoiceIn.issued | date:'dd/MM/yyyy' | dashIfEmpty}}</vn-td>
                <vn-td center>
                    <vn-check disabled="true"
                        ng-model="invoiceIn.isBooked">
                    </vn-check>
                </vn-td>
                <vn-td>{{::invoiceIn.awbCode}}</vn-td> 
                <vn-td>{{::invoiceIn.amount | currency:'EUR'}}</vn-td> 
                <vn-td shrink>
                    <vn-icon-button
                        vn-click-stop="$ctrl.preview(invoiceIn)"
                        vn-tooltip="Preview"
                        icon="preview">
                    </vn-icon-button>
                </vn-td>
                <vn-td shrink>
   <!--                  <vn-icon-button
                        ng-show="invoiceIn.dmsFk"
                        vn-click-stop="$ctrl.openPdf(invoiceIn.dmsFk)"
                        icon="cloud_download"
                        title="Download PDF"
                        vn-tooltip="Download PDF">
                    </vn-icon-button> -->
                </vn-td>
            </a>
        </vn-tbody>
    </vn-table>
    </vn-card>
</vn-data-viewer>
<vn-supplier-descriptor-popover 
    vn-id="supplierDescriptor">
</vn-supplier-descriptor-popover>
<vn-popup vn-id="summary">
    <vn-invoice-in-summary
        invoice-in="$ctrl.selectedInvoiceIn">
    </vn-invoice-in-summary>
</vn-popup>