3888-ticket.expedition_moveExpedition #1097
|
@ -138,12 +138,28 @@
|
||||||
<vn-menu vn-id="moreOptions">
|
<vn-menu vn-id="moreOptions">
|
||||||
<vn-item translate
|
<vn-item translate
|
||||||
name="sms"
|
name="sms"
|
||||||
ng-click="$ctrl.showSMSDialog()">
|
ng-click="$ctrl.createTicket()">
|
||||||
New ticket without route
|
New ticket without route
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item translate
|
<vn-item translate
|
||||||
name="calculatePrice"
|
name="calculatePrice"
|
||||||
ng-click="$ctrl.calculateSalePrice()">
|
ng-click="selectRoute.show()">
|
||||||
New ticket with route
|
New ticket with route
|
||||||
</vn-item>
|
</vn-item>
|
||||||
</vn-menu>
|
</vn-menu>
|
||||||
|
|
||||||
|
<vn-dialog
|
||||||
|
vn-id="selectRoute"
|
||||||
|
on-accept="$ctrl.createTicket($ctrl.ticket.newRoute)">
|
||||||
|
<tpl-body>
|
||||||
|
<vn-textfield
|
||||||
|
vn-one
|
||||||
|
label="Id route"
|
||||||
|
ng-model="$ctrl.ticket.newRoute">
|
||||||
|
</vn-textfield>
|
||||||
|
</tpl-body>
|
||||||
|
<tpl-buttons>
|
||||||
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
|
<button response="accept" translate>Accept</button>
|
||||||
|
</tpl-buttons>
|
||||||
|
</vn-dialog>
|
|
@ -26,6 +26,23 @@ class Controller extends Section {
|
||||||
get totalChecked() {
|
get totalChecked() {
|
||||||
return this.checked.length;
|
return this.checked.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createTicket(routeFk) {
|
||||||
|
const tomorrow = new Date();
|
||||||
|
const params = {
|
||||||
|
clientId: this.ticket.clientFk,
|
||||||
|
landed: tomorrow.getDay() + 1,
|
||||||
|
addressId: this.ticket.addressFk,
|
||||||
|
agencyModeId: this.ticket.agencyModeFk,
|
||||||
|
warehouseId: this.ticket.warehouseFk
|
||||||
|
};
|
||||||
|
const query = `Tickets/new`;
|
||||||
|
this.$http.post(query, params).then(res => {
|
||||||
|
if (routeFk) this.$http.patch(`Tickets/${res.data.id}`, {routeFk: routeFk});
|
||||||
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||||
|
this.$state.go('ticket.card.summary', {id: res.data.id});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.vnComponent('vnTicketExpedition', {
|
ngModule.vnComponent('vnTicketExpedition', {
|
||||||
|
|
Loading…
Reference in New Issue