Order index #418

This commit is contained in:
Joan Sanchez 2018-07-18 14:38:43 +02:00
parent 51e96d0bbf
commit b4ecb82ce3
6 changed files with 136 additions and 1 deletions

View File

@ -11,11 +11,25 @@
"component": "ui-view",
"acl": ["developer"]
},
{
"url": "/index?q",
"state": "order.index",
"component": "vn-order-index"
},
{
"url": "/:id",
"state": "order.card",
"abstract": true,
"component": "vn-order-card"
},
{
"url": "/summary",
"state": "order.card.summary",
"component": "vn-order-summary",
"params": {
"order": "$ctrl.order"
}
},
{
"url": "/create",
"state": "order.create",

View File

@ -1,5 +1,6 @@
export * from './module';
import './descriptor';
import './index';
import './index/';
import './card';
import './summary';

View File

@ -0,0 +1,46 @@
<vn-crud-model
vn-id="model"
url="/order/api/Orders"
filter="::$ctrl.filter"
limit="20"
data="orders">
</vn-crud-model>
<div margin-medium>
<vn-card margin-medium-v pad-medium>
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th field="id">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-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="order in orders" class="clickable"
ui-sref="order.card.summary({id: {{::order.id}}})">
<vn-td>{{::order.id}}</vn-td>
<vn-td>{{::order.clientFk}}</vn-td>
<vn-td>{{::order.companyFk}}</vn-td>
<vn-td>{{::order.created}}</vn-td>
</vn-tr>
</vn-tbody>
<vn-empty-rows ng-if="model.data.length === 0" translate>
No results
</vn-empty-rows>
</vn-table>
</vn-card>
<vn-pagination
model="model"
scroll-selector="ui-view">
</vn-pagination>
</div>
<!-- <a ui-sref="ticket.create" vn-bind="+" 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> -->

View File

@ -0,0 +1,48 @@
import ngModule from '../module';
export default class Controller {
constructor($scope) {
this.$ = $scope;
this.ticketSelected = null;
this.filter = {
include: [
],
order: 'shipped DESC'
};
}
/* exprBuilder(param, value) {
switch (param) {
case 'search':
return /^\d+$/.test(value)
? {id: value}
: {nickname: {regexp: value}};
case 'from':
return {shipped: {gte: value}};
case 'to':
return {shipped: {lte: value}};
case 'nickname':
return {[param]: {regexp: value}};
case 'id':
case 'clientFk':
case 'agencyModeFk':
case 'warehouseFk':
return {[param]: value};
}
} */
preview(event, ticket) {
event.preventDefault();
event.stopImmediatePropagation();
this.$.dialogSummaryTicket.show();
this.ticketSelected = ticket;
}
}
Controller.$inject = ['$scope'];
ngModule.component('vnOrderIndex', {
template: require('./index.html'),
controller: Controller
});

View File

@ -0,0 +1,9 @@
<vn-vertical vn-one>
<vn-card class="summary" pad-medium>
<vn-vertical margin-medium>
<vn-auto>
<h5 text-center pad-small-v class="title">Order</h5>
</vn-auto>
</vn-vertical>
</vn-card>
</vn-vertical>

View File

@ -0,0 +1,17 @@
import ngModule from '../module';
class Controller {
constructor($http) {
this.$http = $http;
}
}
Controller.$inject = ['$http'];
ngModule.component('vnOrderSummary', {
template: require('./index.html'),
controller: Controller,
bindings: {
order: '<'
}
});