3888-ticket.expedition_moveExpedition #1097
|
@ -138,25 +138,29 @@
|
||||||
|
|
||||||
<vn-menu vn-id="moreOptions">
|
<vn-menu vn-id="moreOptions">
|
||||||
<vn-item translate
|
<vn-item translate
|
||||||
name="sms"
|
name="withoutRoute"
|
||||||
ng-click="$ctrl.createTicket()">
|
ng-click="selectLanded.show('withoutRoute')">
|
||||||
New ticket without route
|
New ticket without route
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item translate
|
<vn-item translate
|
||||||
name="calculatePrice"
|
name="withRoute"
|
||||||
ng-click="selectRoute.show()">
|
ng-click="selectLanded.show('withRoute')">
|
||||||
New ticket with route
|
New ticket with route
|
||||||
</vn-item>
|
</vn-item>
|
||||||
</vn-menu>
|
</vn-menu>
|
||||||
|
|
||||||
<vn-dialog
|
<vn-dialog
|
||||||
vn-id="selectRoute"
|
vn-id="selectLanded"
|
||||||
on-accept="$ctrl.createTicket($ctrl.ticket.newRoute)">
|
on-accept="$ctrl.createTicket($ctrl.landed, $ctrl.newRoute)">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
|
<vn-date-picker
|
||||||
|
label="Landed"
|
||||||
|
ng-model="$ctrl.landed">
|
||||||
|
</vn-date-picker>
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
vn-one
|
ng-show="selectLanded.data == 'withRoute'"
|
||||||
label="Id route"
|
label="Id route"
|
||||||
ng-model="$ctrl.ticket.newRoute">
|
ng-model="$ctrl.newRoute">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
|
|
|
@ -2,6 +2,12 @@ import ngModule from '../module';
|
||||||
import Section from 'salix/components/section';
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller extends Section {
|
class Controller extends Section {
|
||||||
|
constructor($element, $scope) {
|
||||||
|
super($element, $scope);
|
||||||
|
this.landed = new Date();
|
||||||
|
this.newRoute = null;
|
||||||
|
}
|
||||||
|
|
||||||
get checked() {
|
get checked() {
|
||||||
const rows = this.$.model.data || [];
|
const rows = this.$.model.data || [];
|
||||||
const checkedRows = [];
|
const checkedRows = [];
|
||||||
|
@ -28,7 +34,7 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
onRemove() {
|
onRemove() {
|
||||||
const params = {expeditionsIds: this.checked};
|
const params = {expeditionIds: this.checked};
|
||||||
const query = `Expeditions/deleteExpeditions`;
|
const query = `Expeditions/deleteExpeditions`;
|
||||||
this.$http.post(query, params)
|
this.$http.post(query, params)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -37,11 +43,10 @@ class Controller extends Section {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
createTicket(routeFk) {
|
createTicket(landed, routeFk) {
|
||||||
const date = new Date(); // esta fecha hay que preguntarla a Fran Monsalvez
|
|
||||||
const ticketParams = {
|
const ticketParams = {
|
||||||
clientId: this.ticket.clientFk,
|
clientId: this.ticket.clientFk,
|
||||||
landed: date,
|
landed: landed,
|
||||||
addressId: this.ticket.addressFk,
|
addressId: this.ticket.addressFk,
|
||||||
agencyModeId: this.ticket.agencyModeFk,
|
agencyModeId: this.ticket.agencyModeFk,
|
||||||
warehouseId: this.ticket.warehouseFk
|
warehouseId: this.ticket.warehouseFk
|
||||||
|
@ -50,7 +55,7 @@ class Controller extends Section {
|
||||||
this.$http.post(query, ticketParams).then(res => {
|
this.$http.post(query, ticketParams).then(res => {
|
||||||
if (routeFk) this.$http.patch(`Tickets/${res.data.id}`, {routeFk: routeFk});
|
if (routeFk) this.$http.patch(`Tickets/${res.data.id}`, {routeFk: routeFk});
|
||||||
const params = {
|
const params = {
|
||||||
expeditionsIds: this.checked,
|
expeditionIds: this.checked,
|
||||||
ticketId: res.data.id
|
ticketId: res.data.id
|
||||||
};
|
};
|
||||||
const query = `Expeditions/moveExpeditions`;
|
const query = `Expeditions/moveExpeditions`;
|
||||||
|
|
Loading…
Reference in New Issue