From 74d72fddfb5f8228755c9c90cd89f1dce0ea3df0 Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 30 Oct 2018 14:57:22 +0100 Subject: [PATCH] #760 ticket.ticketWeekly --- client/ticket/routes.json | 18 ++++ client/ticket/src/ticket.js | 2 + client/ticket/src/weekly/index.html | 84 +++++++++++++++++++ client/ticket/src/weekly/index.js | 83 ++++++++++++++++++ client/ticket/src/weekly/locale/es.yml | 2 + client/ticket/src/weekly/style.scss | 17 ++++ .../ticket/common/models/ticket-weekly.json | 22 ++--- 7 files changed, 217 insertions(+), 11 deletions(-) create mode 100644 client/ticket/src/weekly/index.html create mode 100644 client/ticket/src/weekly/index.js create mode 100644 client/ticket/src/weekly/locale/es.yml create mode 100644 client/ticket/src/weekly/style.scss diff --git a/client/ticket/routes.json b/client/ticket/routes.json index 02a8703a4..ace589266 100644 --- a/client/ticket/routes.json +++ b/client/ticket/routes.json @@ -212,6 +212,24 @@ "menu": { "icon": "image" } + }, + { + "url" : "/log", + "state": "ticket.card.log", + "component": "vn-ticket-log", + "description": "Log", + "menu": { + "icon": "history" + } + }, + { + "url" : "/weekly", + "state": "ticket.weekly", + "component": "vn-ticket-weekly", + "description": "Weekly", + "menu": { + "icon": "history" + } } ] } \ No newline at end of file diff --git a/client/ticket/src/ticket.js b/client/ticket/src/ticket.js index 0f211dc94..a64ae0159 100644 --- a/client/ticket/src/ticket.js +++ b/client/ticket/src/ticket.js @@ -20,3 +20,5 @@ import './sale-checked'; import './component'; import './sale-tracking'; import './picture'; +// import './log'; +import './weekly'; diff --git a/client/ticket/src/weekly/index.html b/client/ticket/src/weekly/index.html new file mode 100644 index 000000000..2af8f9ec4 --- /dev/null +++ b/client/ticket/src/weekly/index.html @@ -0,0 +1,84 @@ + + + + +
+
+ + + + + Ticket ID + Client + Turn + Warehouse + Salesperson + + + + + + + {{weekly.ticketFk}} + + + + + {{::weekly.ticket.client.name}} + + + + + + + {{::weekly.ticket.warehouse.name}} + {{::weekly.ticket.client.salesPerson.firstName}} {{::weekly.ticket.client.salesPerson.name}} + + + + + + + + No results + + + + + +
+
+ + + + + \ No newline at end of file diff --git a/client/ticket/src/weekly/index.js b/client/ticket/src/weekly/index.js new file mode 100644 index 000000000..07f5dd66b --- /dev/null +++ b/client/ticket/src/weekly/index.js @@ -0,0 +1,83 @@ +import ngModule from '../module'; +import './style.scss'; + +export default class Controller { + constructor($scope) { + this.$scope = $scope; + this.ticketSelected = null; + this.filter = { + include: [ + {relation: 'ticket', + scope: { + fields: ['id', 'clientFk', 'companyFk', 'warehouseFk'], + include: [ + {relation: 'client', + scope: { + fields: ['salesPersonFk', 'name'], + include: { + relation: 'salesPerson', + fields: ['firstName', 'name'] + } + } + }, + {relation: 'warehouse'} + ] + } + } + ] + }; + this.weekdays = [ + {id: 0, name: 'Monday'}, + {id: 1, name: 'Tuesday'}, + {id: 2, name: 'Wednesday'}, + {id: 3, name: 'Thursday'}, + {id: 4, name: 'Friday'}, + {id: 5, name: 'Saturday'}, + {id: 6, name: 'Sunday'} + ]; + } + + onSave() { + this.$scope.watcher.notifySaved(); + } + + showClientDescriptor(event, clientFk) { + this.$scope.clientDescriptor.clientFk = clientFk; + this.$scope.clientDescriptor.parent = event.target; + this.$scope.clientDescriptor.show(); + event.preventDefault(); + event.stopImmediatePropagation(); + } + + showTicketDescriptor(event, ticketFk) { + this.$scope.ticketDescriptor.ticketFk = ticketFk; + this.$scope.ticketDescriptor.parent = event.target; + this.$scope.ticketDescriptor.show(); + event.preventDefault(); + event.stopImmediatePropagation(); + } + + onDescriptorLoad() { + this.$scope.popover.relocate(); + } + + deleteWeekly(expedition) { + this.expeditionId = expedition.id; + this.$scope.deleteWeekly.show(); + } + + onSubmit() { + this.$scope.watcher.check(); + this.$scope.model.save().then(() => { + this.$scope.watcher.notifySaved(); + this.$scope.model.refresh(); + }); + } +} + +Controller.$inject = ['$scope']; + +ngModule.component('vnTicketWeekly', { + template: require('./index.html'), + controller: Controller +}); diff --git a/client/ticket/src/weekly/locale/es.yml b/client/ticket/src/weekly/locale/es.yml new file mode 100644 index 000000000..949e2bcb8 --- /dev/null +++ b/client/ticket/src/weekly/locale/es.yml @@ -0,0 +1,2 @@ +Turn: Turno +Ticket ID: ID Ticket diff --git a/client/ticket/src/weekly/style.scss b/client/ticket/src/weekly/style.scss new file mode 100644 index 000000000..b7d1a2b80 --- /dev/null +++ b/client/ticket/src/weekly/style.scss @@ -0,0 +1,17 @@ +vn-ticket-weekly { + vn-card { + margin: auto; + max-width: 880px; + } + vn-autocomplete { + div.mdl-textfield { + padding: 0px !important; + } + label.mdl-textfield__label:after { + bottom: 0; + } + div.icons { + display: none !important; + } + } +} \ No newline at end of file diff --git a/services/ticket/common/models/ticket-weekly.json b/services/ticket/common/models/ticket-weekly.json index 51c635e92..daec2c21a 100644 --- a/services/ticket/common/models/ticket-weekly.json +++ b/services/ticket/common/models/ticket-weekly.json @@ -2,24 +2,24 @@ "name": "TicketWeekly", "base": "VnModel", "options": { - "mysql": { - "table": "ticketWeekly" - } + "mysql": { + "table": "ticketWeekly" + } }, "properties": { - "weekDay": { - "type": "Number" - }, "ticketFk": { - "id": true, - "type": "Number" + "id": true, + "type": "Number" + }, + "weekDay": { + "type": "Number" } }, "relations": { "ticket": { - "type": "belongsTo", - "model": "Ticket", - "foreignKey": "ticketFk" + "type": "belongsTo", + "model": "Ticket", + "foreignKey": "ticketFk" } } }