order client descriptor #609

This commit is contained in:
Joan Sanchez 2018-09-06 12:47:25 +02:00
parent 660310693f
commit cee940f4fa
4 changed files with 46 additions and 17 deletions

View File

@ -21,7 +21,6 @@
<vn-thead>
<vn-tr>
<vn-th field="id" number>Id</vn-th>
<vn-th field="clientFk" number>Client Id</vn-th>
<vn-th field="clientFk">Client</vn-th>
<vn-th field="created">Created</vn-th>
<vn-th field="workerFk">Worker</vn-th>
@ -32,8 +31,11 @@
<vn-tbody>
<vn-tr ng-repeat="claim in claims" ui-sref="claim.card.summary({id: claim.id})" class=clickable>
<vn-td number>{{::claim.id}}</vn-td>
<vn-td number><span class="link" ng-click="$ctrl.showDescriptor($event, claim.client.id)">{{::claim.client.id}}</span></vn-td>
<vn-td>{{::claim.client.name}}</vn-td>
<vn-td>
<span class="link" ng-click="$ctrl.showDescriptor($event, claim.client.id)">
{{::claim.client.name}}
</span>
</vn-td>
<vn-td>{{::claim.created | date:'dd/MM/yyyy'}}</vn-td>
<vn-td>{{::claim.worker.firstName}} {{::claim.worker.name}}</vn-td>
<vn-td>{{::claim.claimState.description}}</vn-td>

View File

@ -1,7 +1,7 @@
<vn-crud-model
vn-id="model"
url="/order/api/Orders"
filter="{}"
filter="::$ctrl.filter"
limit="20"
data="orders">
</vn-crud-model>
@ -10,18 +10,22 @@
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th field="id">Id</vn-th>
<vn-th field="id" default-order="DESC">Id</vn-th>
<vn-th field="clientFk">Client</vn-th>
<vn-th field="companyFk">Company</vn-th>
<vn-th field="created" default-order="DESC">Created</vn-th>
<vn-th field="created">Created</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="order in orders" class="clickable"
ui-sref="order.card.catalog({id: {{::order.id}}})">
<vn-td>{{::order.id}}</vn-td>
<vn-td>{{::order.clientFk}}</vn-td>
<vn-td>{{::order.companyFk}}</vn-td>
<vn-td>
<span class="link" ng-click="$ctrl.showDescriptor($event, order.clientFk)">
{{::order.client.name}}
</span>
</vn-td>
<vn-td>{{::order.company.code}}</vn-td>
<vn-td>{{::order.created | date:'dd/MM/yyyy'}}</vn-td>
</vn-tr>
</vn-tbody>
@ -38,10 +42,4 @@
<a ui-sref="order.create" vn-bind="+" vn-tooltip="New order" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>
</a>
<!--
<vn-dialog class="dialog-summary"
vn-id="dialog-summary-ticket">
<tpl-body>
<vn-ticket-summary ticket="$ctrl.ticketSelected"></vn-ticket-summary>
</tpl-body>
</vn-dialog> -->
<vn-client-descriptor-popover vn-id="descriptor"></vn-client-descriptor-popover>

View File

@ -2,8 +2,20 @@ import ngModule from '../module';
export default class Controller {
constructor($scope) {
this.$ = $scope;
this.$scope = $scope;
this.ticketSelected = null;
this.filter = {
include: [
{
relation: 'client',
fields: ['name']
},
{
relation: 'company',
fields: ['code']
}
]
};
}
/* exprBuilder(param, value) {
@ -26,10 +38,22 @@ export default class Controller {
}
} */
showDescriptor(event, clientFk) {
this.$scope.descriptor.clientFk = clientFk;
this.$scope.descriptor.parent = event.target;
this.$scope.descriptor.show();
event.preventDefault();
event.stopImmediatePropagation();
}
onDescriptorLoad() {
this.$scope.popover.relocate();
}
preview(event, ticket) {
event.preventDefault();
event.stopImmediatePropagation();
this.$.dialogSummaryTicket.show();
this.$scope.dialogSummaryTicket.show();
this.ticketSelected = ticket;
}
}

View File

@ -90,6 +90,11 @@
"type": "hasMany",
"model": "OrderRow",
"foreignKey": "orderFk"
},
"company": {
"type": "belongsTo",
"model": "Company",
"foreignKey": "company_id"
}
}
}