feat: add fields
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-06-08 15:17:45 +02:00
parent c867b4e8bb
commit 409e935cc7
5 changed files with 43 additions and 17 deletions

View File

@ -20,6 +20,8 @@
<vn-th th-id="created" shrink-date>Date</vn-th>
<vn-th th-id="m3" number></vn-th>
<vn-th th-id="description">Description</vn-th>
<vn-th th-id="started">Started</vn-th>
<vn-th th-id="finished">Finished</vn-th>
<vn-th shrink></vn-th>
</vn-tr>
</vn-thead>
@ -47,6 +49,8 @@
<vn-td shrink-date>{{::route.created | dashIfEmpty | date:'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{::route.m3 | dashIfEmpty}}</vn-td>
<vn-td>{{::route.description | dashIfEmpty}}</vn-td>
<vn-td>{{::route.started | dashIfEmpty | date:'dd/MM/yyyy HH:mm'}}</vn-td>
<vn-td>{{::route.finished | dashIfEmpty | date:'dd/MM/yyyy HH:mm'}}</vn-td>
<vn-td>
<vn-icon-button
vn-click-stop="$ctrl.showTicketPopup(route)"

View File

@ -2,4 +2,5 @@ Vehicle: Vehículo
Download selected routes as PDF: Descargar rutas seleccionadas como PDF
Clone selected routes: Clonar rutas seleccionadas
The date can't be empty: La fecha no puede estar vacía
Starting date: Fecha de inicio
Starting date: Fecha de inicio
Finished: Fin

View File

@ -2,7 +2,7 @@
vn-id="model"
url="Routes/filter"
limit="20"
order="created DESC">
order="id, created DESC">
</vn-crud-model>
<vn-portal slot="topbar">
<vn-searchbar

View File

@ -7,7 +7,8 @@
auto-load="true">
</vn-crud-model>
<vn-data-viewer
model="model">
model="model"
class="travel-list">
<form
class="vn-w-xl"
name="form">
@ -27,7 +28,7 @@
</vn-tool-bar>
</vn-card>
<vn-card class="vn-mt-lg">
<vn-table model="model" auto-load="false" vn-droppable="$ctrl.onDrop($event)">
<vn-table model="model" auto-load="false">
<vn-thead>
<vn-tr>
<vn-th shrink>
@ -48,7 +49,7 @@
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="ticket in $ctrl.tickets">
<vn-tr ng-repeat="ticket in $ctrl.tickets" ng-attr-id="{{::ticket.id}}" vn-droppable="$ctrl.onDrop($event)">
<vn-td shrink>
<vn-check
ng-model="ticket.checked">
@ -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">
</vn-input-number>
</vn-td>
<vn-td expand title="{{::ticket.street}}">{{::ticket.street}}</vn-td>

View File

@ -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) {