<vn-crud-model
    vn-id="model"
    url="TicketTrackings"
    filter="::$ctrl.filter"
    link="{ticketFk: $ctrl.$params.id}"
    limit="20"
    data="trackings"
    order="created DESC"
    auto-load="true">
</vn-crud-model>
<vn-data-viewer model="model">
    <vn-card class="vn-w-md">
    <vn-table model="model">
        <vn-thead>
            <vn-tr>
                <vn-th field="state">State</vn-th>
                <vn-th field="worker">Worker</vn-th>
                <vn-th field="created">Created</vn-th>
            </vn-tr>
        </vn-thead>
        <vn-tbody>
            <vn-tr ng-repeat="tracking in trackings">
                <vn-td>{{::tracking.state.name}}</vn-td>
                <vn-td expand>
                     <span 
                        ng-class="{'link': tracking.user.worker}"
                        ng-click="tracking.user.worker && workerDescriptor.show($event, tracking.user.worker.id)">
                        {{::tracking.user.name || 'System' | translate}}
                    </span>
                </vn-td>
                <vn-td shrink-datetime>{{::tracking.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
            </vn-tr>
        </vn-tbody>
    </vn-table>
    </vn-card>
</vn-data-viewer>
<a ui-sref="ticket.card.tracking.edit" vn-bind="+" fixed-bottom-right>
    <vn-float-button icon="add"></vn-float-button>
</a>
<vn-worker-descriptor-popover 
    vn-id="workerDescriptor">
</vn-worker-descriptor-popover>