feat: create new ticket
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
c4649352a9
commit
11484edd10
|
@ -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-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() {
|
||||
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', {
|
||||
|
|
Loading…
Reference in New Issue