<vn-auto-search
    model="model">
</vn-auto-search>
<vn-data-viewer
    model="model"
    class="vn-w-md vn-mb-xl">
    <vn-card>
    <vn-table model="model">
        <vn-thead>
            <vn-tr>
                <vn-th field="id" number>Id</vn-th>
                <vn-th field="name" expand>Name</vn-th>
                <vn-th field="agencyModeFk">Agency</vn-th>
                <vn-th field="hour" shrink>Closing</vn-th>
                <vn-th field="price" number>Price</vn-th>
                <vn-th shrink></vn-th>
            </vn-tr>
        </vn-thead>
        <vn-tbody>
            <a
                ng-repeat="zone in model.data"
                ui-sref="zone.card.summary({id: zone.id})"
                class="clickable vn-tr search-result">
                <vn-td number>{{::zone.id}}</vn-td>
                <vn-td expand>{{::zone.name}}</vn-td>
                <vn-td expand>{{::zone.agencyMode.name}}</vn-td>
                <vn-td shrink>{{::zone.hour | date: 'HH:mm'}}</vn-td>
                <vn-td number>{{::zone.price | currency: 'EUR':2}}</vn-td>
                <vn-td shrink>
                    <vn-horizontal class="buttons">
                        <vn-icon-button
                            vn-click-stop="clone.show(zone)"
                            vn-tooltip="Clone"
                            icon="icon-clone"
                            vn-acl="deliveryAssistant"
                            vn-acl-action="remove">
                        </vn-icon-button>
                        <vn-icon-button
                            vn-click-stop="$ctrl.preview(zone)"
                            vn-tooltip="Preview"
                            icon="preview">
                        </vn-icon-button>
                    </vn-horizontal>
                </vn-td>
            </a>
        </vn-tbody>
    </vn-table>
    </vn-card>
</vn-data-viewer>
<vn-popup vn-id="summary">
    <vn-zone-summary zone="$ctrl.selectedZone"></vn-zone-summary>
</vn-popup>
<vn-confirm
    vn-id="clone"
    on-accept="$ctrl.onCloneAccept($data)"
    question="Do you want to clone this zone?"
    message="All it's properties will be copied">
</vn-confirm>
<a ui-sref="zone.create"
    vn-tooltip="New zone"
    vn-bind="+"
    fixed-bottom-right>
    <vn-float-button
        icon="add"
        vn-acl="deliveryAssistant"
        vn-acl-action="remove">
    </vn-float-button>
</a>