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 22 additions and 13 deletions
Showing only changes of commit 423454d19e - Show all commits

View File

@ -138,25 +138,29 @@
<vn-menu vn-id="moreOptions">
<vn-item translate
name="sms"
ng-click="$ctrl.createTicket()">
name="withoutRoute"
ng-click="selectLanded.show('withoutRoute')">
New ticket without route
</vn-item>
<vn-item translate
name="calculatePrice"
ng-click="selectRoute.show()">
name="withRoute"
ng-click="selectLanded.show('withRoute')">
New ticket with route
</vn-item>
</vn-menu>
<vn-dialog
vn-id="selectRoute"
on-accept="$ctrl.createTicket($ctrl.ticket.newRoute)">
vn-id="selectLanded"
on-accept="$ctrl.createTicket($ctrl.landed, $ctrl.newRoute)">
<tpl-body>
<vn-date-picker
label="Landed"
ng-model="$ctrl.landed">
</vn-date-picker>
<vn-textfield
vn-one
ng-show="selectLanded.data == 'withRoute'"
label="Id route"
ng-model="$ctrl.ticket.newRoute">
ng-model="$ctrl.newRoute">
</vn-textfield>
</tpl-body>
<tpl-buttons>

View File

@ -2,6 +2,12 @@ import ngModule from '../module';
import Section from 'salix/components/section';
class Controller extends Section {
constructor($element, $scope) {
super($element, $scope);
this.landed = new Date();
this.newRoute = null;
}
get checked() {
const rows = this.$.model.data || [];
const checkedRows = [];
@ -28,7 +34,7 @@ class Controller extends Section {
}
onRemove() {
const params = {expeditionsIds: this.checked};
const params = {expeditionIds: this.checked};
const query = `Expeditions/deleteExpeditions`;
this.$http.post(query, params)
.then(() => {
@ -37,11 +43,10 @@ class Controller extends Section {
});
}
createTicket(routeFk) {
const date = new Date(); // esta fecha hay que preguntarla a Fran Monsalvez
createTicket(landed, routeFk) {
const ticketParams = {
clientId: this.ticket.clientFk,
landed: date,
landed: landed,
addressId: this.ticket.addressFk,
agencyModeId: this.ticket.agencyModeFk,
warehouseId: this.ticket.warehouseFk
@ -50,7 +55,7 @@ class Controller extends Section {
this.$http.post(query, ticketParams).then(res => {
if (routeFk) this.$http.patch(`Tickets/${res.data.id}`, {routeFk: routeFk});
const params = {
expeditionsIds: this.checked,
expeditionIds: this.checked,
ticketId: res.data.id
};
const query = `Expeditions/moveExpeditions`;