feat: drag and drop
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
409e935cc7
commit
afd95872c8
|
@ -49,10 +49,17 @@
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-thead>
|
</vn-thead>
|
||||||
<vn-tbody>
|
<vn-tbody>
|
||||||
<vn-tr ng-repeat="ticket in $ctrl.tickets" ng-attr-id="{{::ticket.id}}" vn-droppable="$ctrl.onDrop($event)">
|
<a ng-repeat="ticket in $ctrl.tickets"
|
||||||
|
class="clickable vn-tr search-result"
|
||||||
|
href="#"
|
||||||
|
ng-attr-id="{{::ticket.id}}"
|
||||||
|
ng-attr-priority="{{::ticket.priority}}"
|
||||||
|
vn-droppable="$ctrl.onDrop($event)"
|
||||||
|
>
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<vn-check
|
<vn-check
|
||||||
ng-model="ticket.checked">
|
ng-model="ticket.checked"
|
||||||
|
vn-click-stop>
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
|
@ -60,7 +67,8 @@
|
||||||
on-change="$ctrl.setPriority(ticket.id, ticket.priority)"
|
on-change="$ctrl.setPriority(ticket.id, ticket.priority)"
|
||||||
ng-model="ticket.priority"
|
ng-model="ticket.priority"
|
||||||
rule="Ticket"
|
rule="Ticket"
|
||||||
class="dense">
|
class="dense"
|
||||||
|
vn-click-stop>
|
||||||
</vn-input-number>
|
</vn-input-number>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td expand title="{{::ticket.street}}">{{::ticket.street}}</vn-td>
|
<vn-td expand title="{{::ticket.street}}">{{::ticket.street}}</vn-td>
|
||||||
|
@ -69,7 +77,8 @@
|
||||||
<vn-td expand>
|
<vn-td expand>
|
||||||
<span
|
<span
|
||||||
ng-click="clientDescriptor.show($event, ticket.clientFk)"
|
ng-click="clientDescriptor.show($event, ticket.clientFk)"
|
||||||
class="link">
|
class="link"
|
||||||
|
vn-click-stop>
|
||||||
{{::ticket.nickname}}
|
{{::ticket.nickname}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
@ -78,7 +87,8 @@
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span
|
<span
|
||||||
ng-click="ticketDescriptor.show($event, ticket.id)"
|
ng-click="ticketDescriptor.show($event, ticket.id)"
|
||||||
class="link">
|
class="link"
|
||||||
|
vn-click-stop>
|
||||||
{{::ticket.id}}
|
{{::ticket.id}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
@ -87,7 +97,8 @@
|
||||||
ng-if="::ticket.notes.length"
|
ng-if="::ticket.notes.length"
|
||||||
title="{{::ticket.notes[0].description}}"
|
title="{{::ticket.notes[0].description}}"
|
||||||
icon="insert_drive_file"
|
icon="insert_drive_file"
|
||||||
class="bright">
|
class="bright"
|
||||||
|
vn-click-stop>
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
|
@ -95,10 +106,11 @@
|
||||||
translate-attr="{title: 'Remove ticket'}"
|
translate-attr="{title: 'Remove ticket'}"
|
||||||
icon="delete"
|
icon="delete"
|
||||||
ng-click="$ctrl.showDeleteConfirm(ticket.id)"
|
ng-click="$ctrl.showDeleteConfirm(ticket.id)"
|
||||||
tabindex="-1">
|
tabindex="-1"
|
||||||
|
vn-click-stop>
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
</vn-tr>
|
</a>
|
||||||
</vn-tbody>
|
</vn-tbody>
|
||||||
</vn-table>
|
</vn-table>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
|
|
@ -4,6 +4,10 @@ import './style.scss';
|
||||||
import UserError from 'core/lib/user-error';
|
import UserError from 'core/lib/user-error';
|
||||||
|
|
||||||
class Controller extends Section {
|
class Controller extends Section {
|
||||||
|
constructor($element, $, vnReport) {
|
||||||
|
super($element, $);
|
||||||
|
this.droppableElement = 'a.vn-tr';
|
||||||
|
}
|
||||||
get isChecked() {
|
get isChecked() {
|
||||||
if (this.tickets) {
|
if (this.tickets) {
|
||||||
for (let instance of this.tickets)
|
for (let instance of this.tickets)
|
||||||
|
@ -58,7 +62,9 @@ class Controller extends Section {
|
||||||
|
|
||||||
let url = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr=';
|
let url = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr=';
|
||||||
lines.forEach(line => {
|
lines.forEach(line => {
|
||||||
addresses = addresses + '+to:' + line.postalCode + ' ' + line.city + ' ' + line.street;
|
if lineOld.street <> line.street
|
||||||
|
addresses = addresses + '+to:' + line.postalCode + ' ' + line.city + ' ' + line.street;
|
||||||
|
lineOld = line
|
||||||
});
|
});
|
||||||
|
|
||||||
window.open(url + addresses, '_blank');
|
window.open(url + addresses, '_blank');
|
||||||
|
@ -96,42 +102,11 @@ class Controller extends Section {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
findDroppable($event) {
|
onDrop($event) {
|
||||||
const target = $event.target;
|
const target = $event.target;
|
||||||
const droppable = target.closest(this.droppableElement);
|
const droppable = target.closest(this.droppableElement);
|
||||||
|
const ticketId = droppable.id;
|
||||||
return droppable;
|
console.log($event, target, droppable, ticketId);
|
||||||
}
|
|
||||||
|
|
||||||
onDrop($event) {
|
|
||||||
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 (currentDroppable == droppable) return;
|
|
||||||
|
|
||||||
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)) {
|
|
||||||
// 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) {
|
insert(ticketId) {
|
||||||
|
|
Loading…
Reference in New Issue