refactorizacion de production, menos watchers
This commit is contained in:
parent
93c915ec26
commit
5c54550283
|
@ -31,7 +31,7 @@
|
|||
</vn-horizontal>
|
||||
<vn-horizontal vn-one margin-large-bottom>
|
||||
<vn-one>
|
||||
<vn-production-actions tickets="$ctrl.tickets" states="$ctrl.sharedData.states" hour-items="$ctrl.sharedData.hourItems"></vn-production-actions>
|
||||
<vn-production-actions></vn-production-actions>
|
||||
</vn-one>
|
||||
<vn-two></vn-two>
|
||||
</vn-horizontal>
|
||||
|
|
|
@ -22,5 +22,9 @@
|
|||
"Province" : "Provincia",
|
||||
"Filter" : "Filtrar",
|
||||
"Cancel" : "Cancelar",
|
||||
"Worker" : "Trabajador",
|
||||
"Town" : "Población",
|
||||
"Client ID" : "ID Cliente",
|
||||
|
||||
"Ticket with incidence" : "Ticket con incidencia"
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<vn-horizontal class="actionPanel">
|
||||
<vn-button vn-none margin-medium-right label="Printed" ng-click="$ctrl.doAction('markPrinted')"></vn-button>
|
||||
<vn-none margin-medium-right>
|
||||
<vn-icon-menu icon="assignment" items="$ctrl.states" selected="$ctrl.actionState"></vn-icon-menu>
|
||||
<vn-icon-menu icon="assignment" items="$ctrl.parent.sharedData.states" selected="$ctrl.actionState"></vn-icon-menu>
|
||||
</vn-none>
|
||||
<vn-none margin-medium-right>
|
||||
<vn-icon-button icon="textsms" ng-click="$ctrl.doAction('addComment')"></vn-icon-button>
|
||||
|
@ -10,6 +10,6 @@
|
|||
<vn-icon-menu icon="person" url="/client/api/Clients/employeeList" selected="$ctrl.actionWorker"></vn-icon-menu>
|
||||
</vn-none>
|
||||
<vn-none margin-medium-right>
|
||||
<vn-icon-menu icon="query_builder" items="$ctrl.hourItems" selected="$ctrl.actionHours"></vn-icon-menu>
|
||||
<vn-icon-menu icon="query_builder" items="$ctrl.parent.sharedData.hourItems" selected="$ctrl.actionHours"></vn-icon-menu>
|
||||
</vn-none>
|
||||
</vn-horizontal>
|
|
@ -35,45 +35,35 @@ export default class ProductionActions {
|
|||
return this._actionWorker;
|
||||
}
|
||||
|
||||
_changeState(ids, sateteId, stateName, index) {
|
||||
this.$http.put(`/production/api/TicketStates/${sateteId}/changeState`, {tickets: ids}).then(
|
||||
_changeState(ids, sateteId) {
|
||||
this.$http.put(`/production/api/TicketStates/${sateteId}/changeState`, {tickets: ids})
|
||||
.then(
|
||||
() => {
|
||||
index.forEach(
|
||||
i => {
|
||||
this.tickets[i].state = stateName;
|
||||
this.tickets[i].stateFk = sateteId;
|
||||
}
|
||||
);
|
||||
this.parent.searchTickets();
|
||||
}
|
||||
);
|
||||
}
|
||||
_sendMessage(tickets) {
|
||||
this.$http.post(`/production/api/FakeProductions/messageSend`, {tickets: tickets}).then(
|
||||
this.$http.post(`/production/api/FakeProductions/messageSend`, {tickets: tickets})
|
||||
.then(
|
||||
() => {
|
||||
this.vnApp.showMessage(this.$translate.instant('Success: message send!'));
|
||||
}
|
||||
);
|
||||
}
|
||||
_changeTime(ids, time, index) {
|
||||
this.$http.put(`/production/api/Tickets/${time}/changeTime`, {tickets: ids}).then(
|
||||
this.$http.put(`/production/api/Tickets/${time}/changeTime`, {tickets: ids})
|
||||
.then(
|
||||
() => {
|
||||
index.forEach(
|
||||
i => {
|
||||
this.tickets[i].hour = time;
|
||||
}
|
||||
);
|
||||
this.parent.searchTickets();
|
||||
}
|
||||
);
|
||||
}
|
||||
_changeWorker(ids, workerFk, index) {
|
||||
this.$http.put(`/production/api/Tickets/${workerFk}/changeWorker`, {tickets: ids}).then(
|
||||
this.$http.put(`/production/api/Tickets/${workerFk}/changeWorker`, {tickets: ids})
|
||||
.then(
|
||||
() => {
|
||||
index.forEach(
|
||||
i => {
|
||||
this.tickets[i].workerFk = this.actionWorker.id;
|
||||
this.tickets[i].worker = this.actionWorker.name;
|
||||
}
|
||||
);
|
||||
this.parent.searchTickets();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -82,7 +72,7 @@ export default class ProductionActions {
|
|||
let ids = [];
|
||||
let index = [];
|
||||
let tickets = [];
|
||||
this.tickets.forEach(
|
||||
this.parent.tickets.forEach(
|
||||
(val, i) => {
|
||||
if (val.checked) {
|
||||
ids.push(val.ticketFk);
|
||||
|
@ -94,13 +84,13 @@ export default class ProductionActions {
|
|||
if (tickets.length) {
|
||||
switch (actionName) {
|
||||
case 'changeState' :
|
||||
this._changeState(ids, this.actionState.id, this.actionState.name, index);
|
||||
this._changeState(ids, this.actionState.id);
|
||||
break;
|
||||
case 'addComment':
|
||||
this._sendMessage(tickets);
|
||||
break;
|
||||
case 'markPrinted':
|
||||
this._changeState(ids, 4, 'Impreso', index);
|
||||
this._changeState(ids, 4);
|
||||
break;
|
||||
case 'changeTime':
|
||||
this._changeTime(ids, this.actionHours.name, index);
|
||||
|
@ -121,10 +111,8 @@ ProductionActions.$inject = ['$http', '$translate', 'vnApp'];
|
|||
|
||||
ngModule.component('vnProductionActions', {
|
||||
template: require('./production-actions.html'),
|
||||
bindings: {
|
||||
tickets: '<',
|
||||
states: '<',
|
||||
hourItems: '<'
|
||||
},
|
||||
controller: ProductionActions
|
||||
controller: ProductionActions,
|
||||
require: {
|
||||
parent: '^^vnProductionIndex'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<vn-column-header vn-two pad-medium-h field="agency" text="Agency"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="routeFk" text="Route ID"></vn-column-header>
|
||||
<vn-column-header vn-two pad-medium-h field="salesPerson" text="Commercial"></vn-column-header>
|
||||
<vn-column-header vn-two pad-medium-h field="worker" text="Worker"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="hour" text="Hour"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="state" text="State"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="lines" text="Lines"></vn-column-header>
|
||||
|
@ -16,7 +17,7 @@
|
|||
<vn-none min-none></vn-none>
|
||||
</vn-grid-header>
|
||||
<vn-one class="list list-content">
|
||||
<vn-horizontal vn-one class="list list-element text-center" ng-repeat="ticket in $ctrl.pageTable.model track by ticket.id" ng-class="{warning: ticket.problem==='RIESGO'}">
|
||||
<vn-horizontal vn-one class="list list-element text-center" ng-repeat="ticket in $ctrl.pageTable.model" ng-class="{warning: ticket.problem==='RIESGO'}">
|
||||
<vn-none>
|
||||
<vn-icon margin-small-left icon="report_problem" ng-if="ticket.problem" vn-tooltip="{{ticket.problem}}" tooltip-position="right"></vn-icon>
|
||||
</vn-none>
|
||||
|
@ -27,8 +28,9 @@
|
|||
<vn-two pad-medium-h>{{::ticket.agency}}</vn-two>
|
||||
<vn-one pad-medium-h>{{::ticket.routeFk}}</vn-one>
|
||||
<vn-two pad-medium-h>{{::ticket.salesPerson | ucwords}}</vn-two>
|
||||
<vn-one pad-medium-h>{{ticket.hour}}</vn-one>
|
||||
<vn-one pad-medium-h>{{ticket.state}}</vn-one>
|
||||
<vn-two pad-medium-h>{{::ticket.worker | ucwords}}</vn-two>
|
||||
<vn-one pad-medium-h>{{::ticket.hour}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::ticket.state}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::ticket.lines}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::ticket.m3}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::ticket.boxes}}</vn-one>
|
||||
|
@ -44,10 +46,15 @@
|
|||
<span translate="Resultados"></span>:
|
||||
<span>{{$ctrl.footer.total}}</span>
|
||||
</vn-one>
|
||||
<vn-seven pad-medium-h></vn-seven>
|
||||
<vn-two pad-medium-h></vn-two>
|
||||
<vn-one pad-medium-h></vn-one>
|
||||
<vn-two pad-medium-h></vn-two>
|
||||
<vn-two pad-medium-h></vn-two>
|
||||
<vn-one pad-medium-h></vn-one>
|
||||
<vn-one pad-medium-h></vn-one>
|
||||
<vn-one pad-medium-h text-center>{{$ctrl.footer.lines}}</vn-one>
|
||||
<vn-one pad-medium-h text-center>{{$ctrl.footer.meters}}</vn-one>
|
||||
<vn-one></vn-one>
|
||||
<vn-one pad-medium-h></vn-one>
|
||||
<vn-none></vn-none>
|
||||
</vn-horizontal>
|
||||
<vn-one>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<vn-vertical>
|
||||
<vn-horizontal class="list list-header">
|
||||
<vn-one margin-medium-right>Población</vn-one>
|
||||
<vn-one margin-medium-right>Provincia</vn-one>
|
||||
<vn-two margin-medium-right>ID_Cliente</vn-two>
|
||||
<vn-two>Trabajador</vn-two>
|
||||
<vn-one margin-medium-right translate>Town</vn-one>
|
||||
<vn-one margin-medium-right translate>Province</vn-one>
|
||||
<vn-two margin-medium-right translate>Client ID</vn-two>
|
||||
<vn-two translate>Worker</vn-two>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="list list-element">
|
||||
<vn-one margin-medium-right>{{::ticket.city | ucwords}}</vn-one>
|
||||
|
|
Loading…
Reference in New Issue