<vn-crud-model
    vn-id="model"
    url="ClientSamples"
    filter="::$ctrl.filter"
    link="{clientFk: $ctrl.$params.id}"
    limit="20"
    data="samples"
    order="created DESC"
    auto-load="true">
</vn-crud-model>
<vn-data-viewer
    model="model"
    class="vn-w-md">
    <vn-card>
        <vn-table model="model">
            <vn-thead>
                <vn-tr>
                    <vn-th field="created">Sent</vn-th>
                    <vn-th>Description</vn-th>
                    <vn-th field="workerFk">Worker</vn-th>
                    <vn-th field="companyFk">Company</vn-th>
                </vn-tr>
            </vn-thead>
            <vn-tbody>
                <vn-tr ng-repeat="sample in samples">
                    <vn-td shrink-datetime>{{::sample.created | date:'dd/MM/yyyy HH:mm' }}</vn-td>
                    <vn-td expand
                        title="{{::sample.type.description}}">
                        {{::sample.type.description}}
                    </vn-td>
                    <vn-td>                       
                        <span 
                            ng-click="workerDescriptor.show($event, sample.worker.id)"
                            class="link">
                            {{::sample.worker.user.name}}
                        </span>
                    </vn-td>
                    <vn-td>{{::sample.company.code}}</vn-td>
                </vn-tr>
            </vn-tbody>
        </vn-table>
    </vn-card>
</vn-data-viewer>
<vn-worker-descriptor-popover 
    vn-id="workerDescriptor">
</vn-worker-descriptor-popover>
<a
    ui-sref="client.card.sample.create"
    vn-tooltip="Send sample" 
    vn-bind="+"
    fixed-bottom-right>
    <vn-float-button icon="add"></vn-float-button>
</a>