<vn-crud-model
    vn-id="model"
    url="ClientCredits"
    filter="::$ctrl.filter"
    link="{clientFk: $ctrl.$params.id}"
    limit="20"
    data="credits"
    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">Since</vn-th>
                <vn-th field="workerFk">Employee</vn-th>
                <vn-th field="amount" number>Credit</vn-th>
            </vn-tr>
        </vn-thead>
        <vn-tbody>
            <vn-tr ng-repeat="credit in credits track by credit.id">
                <vn-td shrink-datetime>{{::credit.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
                <vn-td>
                    <span
                        ng-click="workerDescriptor.show($event, credit.worker.id)"
                        class="link">
                        {{::credit.worker.user.name}}
                    </span>
                </vn-td>
                <vn-td number>{{::credit.amount | currency:'EUR':2}}</vn-td>
            </vn-tr>
        </vn-tbody>
    </vn-table>
    </vn-card>
</vn-data-viewer>
<vn-float-button
    icon="add"
    ui-sref="client.card.credit.create"
    vn-acl="teamBoss"
    vn-acl-action="remove"
    vn-tooltip="New credit"
    vn-bind="+"
    fixed-bottom-right>
</vn-float-button>
<vn-worker-descriptor-popover
    vn-id="workerDescriptor">
</vn-worker-descriptor-popover>