From 735544aed6fb3ebd43228d1c62cd7a15043c4185 Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 21 Mar 2018 12:56:18 +0100 Subject: [PATCH] Mostrar modelo ticketTracking --- README.md | 4 +-- client/ticket/routes.json | 16 +++++++--- client/ticket/src/review/locale/es.yml | 4 --- client/ticket/src/review/review.html | 23 -------------- client/ticket/src/review/review.js | 18 ----------- client/ticket/src/ticket.js | 2 +- client/ticket/src/tracking/locale/es.yml | 5 +++ client/ticket/src/tracking/tracking.html | 31 +++++++++++++++++++ client/ticket/src/tracking/tracking.js | 7 +++++ .../common/methods/ticketTracking/filter.js | 28 +++++++++++++++++ .../ticket/common/models/ticketTracking.js | 3 ++ 11 files changed, 89 insertions(+), 52 deletions(-) delete mode 100644 client/ticket/src/review/locale/es.yml delete mode 100644 client/ticket/src/review/review.html delete mode 100644 client/ticket/src/review/review.js create mode 100644 client/ticket/src/tracking/locale/es.yml create mode 100644 client/ticket/src/tracking/tracking.html create mode 100644 client/ticket/src/tracking/tracking.js create mode 100644 services/ticket/common/methods/ticketTracking/filter.js create mode 100644 services/ticket/common/models/ticketTracking.js diff --git a/README.md b/README.md index 9de69811c..9911d47b4 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ Required applications. * Docker In Visual Studio Code we use the ESLint extension. Open Visual Studio Code, press Ctrl+P and paste the following command -´´´ +``` ext install dbaeumer.vscode-eslint -´´´ +``` You will need to install globally the following items. ``` diff --git a/client/ticket/routes.json b/client/ticket/routes.json index 18c8632ae..22ffc2a94 100644 --- a/client/ticket/routes.json +++ b/client/ticket/routes.json @@ -77,17 +77,25 @@ } }, { - "url" : "/review", - "state": "ticket.card.review", - "component": "vn-ticket-review", + "url" : "/tracking", + "state": "ticket.card.tracking", + "component": "vn-ticket-tracking", "params": { "ticket": "$ctrl.ticket" }, "menu": { - "description": "Review", + "description": "Tracking", "icon": "remove_red_eye" } }, + { + "url": "/create", + "state": "ticket.card.tracking.create", + "component": "vn-ticket-tracking-create", + "params": { + "client": "$ctrl.client" + } + }, { "url" : "/sale", "state": "ticket.card.sale", diff --git a/client/ticket/src/review/locale/es.yml b/client/ticket/src/review/locale/es.yml deleted file mode 100644 index ae3a7e678..000000000 --- a/client/ticket/src/review/locale/es.yml +++ /dev/null @@ -1,4 +0,0 @@ -date : Fecha -Employee : Empleado -State: Estado -Review: Revision \ No newline at end of file diff --git a/client/ticket/src/review/review.html b/client/ticket/src/review/review.html deleted file mode 100644 index d38b231e5..000000000 --- a/client/ticket/src/review/review.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - Review - - - - - - - - - - No results - - - - - - - - \ No newline at end of file diff --git a/client/ticket/src/review/review.js b/client/ticket/src/review/review.js deleted file mode 100644 index 7b4cc5678..000000000 --- a/client/ticket/src/review/review.js +++ /dev/null @@ -1,18 +0,0 @@ -import ngModule from '../module'; - -class ticketReview { - construct($http, $scope) { - this.$http = $http; - this.$ = $scope; - } -} - -ticketReview.$inject = ['$http', '$scope']; - -ngModule.component('vnTicketReview', { - template: require('./review.html'), - controller: ticketReview, - bindings: { - ticket: '<' - } -}); diff --git a/client/ticket/src/ticket.js b/client/ticket/src/ticket.js index d02656ba2..a1c8fd9d2 100644 --- a/client/ticket/src/ticket.js +++ b/client/ticket/src/ticket.js @@ -8,4 +8,4 @@ import './data/ticket-data'; import './notes/ticket-observations'; import './package/list/package-list'; import './sale/sale'; -import './review/review'; +import './tracking/tracking'; diff --git a/client/ticket/src/tracking/locale/es.yml b/client/ticket/src/tracking/locale/es.yml new file mode 100644 index 000000000..e61e1dd24 --- /dev/null +++ b/client/ticket/src/tracking/locale/es.yml @@ -0,0 +1,5 @@ +Date : Fecha +Employee : Empleado +State: Estado +Tracking: Revisión +Created : Añadido \ No newline at end of file diff --git a/client/ticket/src/tracking/tracking.html b/client/ticket/src/tracking/tracking.html new file mode 100644 index 000000000..ec827fac3 --- /dev/null +++ b/client/ticket/src/tracking/tracking.html @@ -0,0 +1,31 @@ + + + + + Tracking + + + + + + + + + {{::ticket.state.name}} + {{::ticket.worker.firstName}} {{::ticket.worker.name}} + {{::ticket.created | date:'dd/MM/yyyy HH:mm' }} + + + + No results + + + + + + + + \ No newline at end of file diff --git a/client/ticket/src/tracking/tracking.js b/client/ticket/src/tracking/tracking.js new file mode 100644 index 000000000..be147ed91 --- /dev/null +++ b/client/ticket/src/tracking/tracking.js @@ -0,0 +1,7 @@ +import ngModule from '../module'; +import FilterTicketList from '../filter-ticket-list'; + +ngModule.component('vnTicketTracking', { + template: require('./tracking.html'), + controller: FilterTicketList +}); diff --git a/services/ticket/common/methods/ticketTracking/filter.js b/services/ticket/common/methods/ticketTracking/filter.js new file mode 100644 index 000000000..90e8ca607 --- /dev/null +++ b/services/ticket/common/methods/ticketTracking/filter.js @@ -0,0 +1,28 @@ +module.exports = Self => { + Self.installMethod('filter', filterParams); + + function filterParams(params) { + return { + where: { + ticketFk: params.ticketFk + }, + skip: (params.page - 1) * params.size, + limit: params.size, + order: params.order || 'created DESC', + include: [ + { + relation: "worker", + scope: { + fields: ["firstName", "name"] + } + }, + { + relation: "state", + scope: { + fields: ["name"] + } + } + ] + }; + } +}; diff --git a/services/ticket/common/models/ticketTracking.js b/services/ticket/common/models/ticketTracking.js new file mode 100644 index 000000000..ab8a13f1e --- /dev/null +++ b/services/ticket/common/models/ticketTracking.js @@ -0,0 +1,3 @@ +module.exports = function(Self) { + require('../methods/ticketTracking/filter')(Self); +};