3888-ticket.expedition_moveExpedition #1097

Merged
vicent merged 26 commits from 3888-ticket.expedition_moveExpedition into dev 2022-11-02 13:54:11 +00:00
2 changed files with 36 additions and 3 deletions
Showing only changes of commit 11484edd10 - Show all commits

View File

@ -138,12 +138,28 @@
<vn-menu vn-id="moreOptions">
<vn-item translate
name="sms"
ng-click="$ctrl.showSMSDialog()">
ng-click="$ctrl.createTicket()">
New ticket without route
</vn-item>
<vn-item translate
name="calculatePrice"
ng-click="$ctrl.calculateSalePrice()">
ng-click="selectRoute.show()">
New ticket with route
</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>

View File

@ -26,6 +26,23 @@ class Controller extends Section {
get totalChecked() {
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', {