diff --git a/modules/route/front/index/index.html b/modules/route/front/index/index.html index 6d4bb202d0..361f7a6962 100644 --- a/modules/route/front/index/index.html +++ b/modules/route/front/index/index.html @@ -20,6 +20,8 @@ Date Description + Started + Finished @@ -47,6 +49,8 @@ {{::route.created | dashIfEmpty | date:'dd/MM/yyyy'}} {{::route.m3 | dashIfEmpty}} {{::route.description | dashIfEmpty}} + {{::route.started | dashIfEmpty | date:'dd/MM/yyyy HH:mm'}} + {{::route.finished | dashIfEmpty | date:'dd/MM/yyyy HH:mm'}} + order="id, created DESC"> + model="model" + class="travel-list">
@@ -27,7 +28,7 @@ - + @@ -48,7 +49,7 @@ - + @@ -59,8 +60,7 @@ on-change="$ctrl.setPriority(ticket.id, ticket.priority)" ng-model="ticket.priority" rule="Ticket" - class="dense" - display-controls=true> + class="dense"> {{::ticket.street}} diff --git a/modules/route/front/tickets/index.js b/modules/route/front/tickets/index.js index b14b28ed6c..f99c832a22 100644 --- a/modules/route/front/tickets/index.js +++ b/modules/route/front/tickets/index.js @@ -96,21 +96,42 @@ class Controller extends Section { }); } + findDroppable($event) { + const target = $event.target; + const droppable = target.closest(this.droppableElement); + + return droppable; + } + onDrop($event) { - const ticketId = $event.dataTransfer.getData('Text'); + const model = this.$.model; + const droppable = this.findDroppable($event); + const travelId = parseInt(droppable.id); + console.log(travelId); + const currentDroppable = this.entry.closest(this.droppableElement); - if (isNaN(ticketId)) { - const regexp = new RegExp(/\/ticket\/([0-9]+)\//i); - const matches = ticketId.match(regexp); + if (currentDroppable == droppable) return; - if (matches && matches.length) - this.insert(matches[1]); - else - this.vnApp.showError(this.$t('Ticket not found')); + if (this.entryId && travelId) { + const path = `Entries/${this.entryId}`; + this.$http.patch(path, {travelFk: travelId}) + .then(() => model.refresh()) + .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); } + // const ticketId = $event.dataTransfer.getData('Text'); - if (!isNaN(ticketId)) - this.insert(ticketId); + // if (isNaN(ticketId)) { + // const regexp = new RegExp(/\/ticket\/([0-9]+)\//i); + // const matches = ticketId.match(regexp); + + // if (matches && matches.length) + // this.insert(matches[1]); + // else + // this.vnApp.showError(this.$t('Ticket not found')); + // } + + // if (!isNaN(ticketId)) + // this.insert(ticketId); } insert(ticketId) {