<vn-crud-model auto-load="false"
    vn-id="model"
    url="sales"
    filter="::$ctrl.filter"
    link="{ticketFk: $ctrl.$stateParams.id}"
    data="$ctrl.sales"
    limit="20">
</vn-crud-model>
<vn-crud-model auto-load="true"
    url="tickets/{{$ctrl.$stateParams.id}}/getVolume"
    data="$ctrl.volumes">
</vn-crud-model>
<mg-ajax path="tickets/{{$ctrl.$stateParams.id}}/getTotalVolume" options="mgEdit"></mg-ajax>
<vn-vertical>
    <vn-card class="vn-pa-lg">
        <vn-horizontal>
            <div class="totalBox">
                    <vn-label-value label="Total" 
                        value="{{::edit.model.totalVolume}}">
                    </vn-label-value>
                    <vn-label-value label="Cajas" 
                        value="{{::edit.model.totalBoxes}}">
                    </vn-label-value>
                </div>
        </vn-horizontal>
        <vn-vertical>
            <vn-table model="model">
                <vn-thead>
                    <vn-tr>
                        <vn-th field="itemFk" number>Item</vn-th>
                        <vn-th field="concept" default-order="ASC">Description</vn-th>
                        <vn-th field="quantity" number>Quantity</vn-th>
                        <vn-th number>m³ per quantity</vn-th>
                    </vn-tr>
                </vn-thead>
                <vn-tbody>
                    <vn-tr ng-repeat="sale in $ctrl.sales">
                        <vn-td number>
                            <span
                                ng-click="$ctrl.showDescriptor($event, sale.itemFk)"
                                class="link">
                                {{sale.itemFk | zeroFill:6}}
                            </span>
                        </vn-td>
                        <vn-td expand>
                            <vn-fetched-tags 
                                max-length="6" 
                                item="::sale.item"
                                name="::sale.concept"
                                sub-name="::sale.item.subName"/>
                        </vn-td>
                        <vn-td number>{{::sale.quantity}}</vn-td>
                        <vn-td number>{{::sale.volume.m3 | number:3}}</vn-td>
                    </vn-tr>
                </vn-tbody>
            </vn-table>
        </vn-vertical>
        <vn-pagination model="model"></vn-pagination>
    </vn-card>
</vn-vertical>
<vn-item-descriptor-popover vn-id="descriptor"
    quicklinks="$ctrl.quicklinks">
</vn-item-descriptor-popover>