Bug #377 Eliminar lineas no ofrece un dialog de confirmacion

This commit is contained in:
gerard 2018-07-02 14:14:16 +02:00
parent a9b095a3bd
commit fb31004c08
3 changed files with 29 additions and 21 deletions

View File

@ -26,7 +26,7 @@
</vn-icon-menu>
<vn-button
disabled="!$ctrl.isChecked || !$ctrl.isEditable"
ng-click="$ctrl.onRemoveLinesClick()"
ng-click="$ctrl.showRemoveLinesDialog()"
vn-tooltip="Remove lines"
tooltip-position="up"
icon="delete">
@ -59,9 +59,11 @@
</thead>
<tbody>
<tr ng-repeat="sale in index.model.instances track by sale.id">
<td><vn-icon ng-show="sale.disponible" icon="icon-reserved"></vn-icon></td>
<td><vn-icon ng-show="sale.visible" icon="icon-reserved"></vn-icon></td>
<td><vn-icon ng-show="sale.reserved" icon="icon-reserved"></vn-icon></td>
<td ng-show="sale.disponible" ><vn-icon icon="icon-reserved"></vn-icon></td>
<!-- <td>
<vn-icon icon="warning"></vn-icon>
<vn-icon icon="icon-reserved"></vn-icon>
</td> -->
<td number>
<vn-check
field="sale.checked"
@ -78,7 +80,6 @@
<td ng-if="!$ctrl.isEditable" number>{{sale.quantity}}</td>
<td ng-if="$ctrl.isEditable" number>
<vn-textfield
model="sale.quantity"
on-change="$ctrl.updateQuantity(sale.id,sale.quantity)"
unclearable="true">
@ -125,7 +126,6 @@
</table>
</vn-vertical>
</vn-card>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
<vn-item-descriptor-popover vn-id="descriptor">
</vn-item-descriptor-popover>
@ -288,3 +288,9 @@
question="You are going to delete this ticket"
message="Continue anyway?">
</vn-confirm>
<vn-confirm
vn-id="delete-lines"
question="You are going to delete lines of the ticket"
message="Continue anyway?"
on-response="$ctrl.onRemoveLinesClick(response)">
</vn-confirm>

View File

@ -76,7 +76,7 @@ class Controller extends FilterTicketList {
for (let i = 0; i < data.length; i++)
if (data[i].checked)
lines.push({id: data[i].id, instance: i});
console.log(this.$.index.model.instances);
return lines;
}
@ -131,13 +131,15 @@ class Controller extends FilterTicketList {
}
// Remove Lines
onRemoveLinesClick() {
let sales = this.getCheckedLines();
let params = {sales: sales, actualTicketFk: this.ticket.id};
let query = `/ticket/api/Sales/removes`;
this.$http.post(query, params).then(() => {
this.removeInstances(sales);
});
onRemoveLinesClick(response) {
if (response === 'ACCEPT') {
let sales = this.getCheckedLines();
let params = {sales: sales, actualTicketFk: this.ticket.id};
let query = `/ticket/api/Sales/removes`;
this.$http.post(query, params).then(() => {
this.removeInstances(sales);
});
}
}
removeInstances(instances) {
@ -146,6 +148,10 @@ class Controller extends FilterTicketList {
}
}
showRemoveLinesDialog() {
this.$.deleteLines.show();
}
// Move Lines
showTransferPopover(event) {
let filter = {clientFk: this.ticket.clientFk, ticketFk: this.ticket.id};
@ -284,12 +290,6 @@ class Controller extends FilterTicketList {
this.$.edit.hide();
}*/
onMoreClick() {
this.removeOptionByName('Mark as reserved');
this.removeOptionByName('Unmark as reserved');
this.removeOptionByName('Update discount');
}
/**
* Remove options from 'More' menu
* @param {String} name - Option name

View File

@ -8,4 +8,6 @@ There is no changes to save: No hay cambios que guardar
Edit discount: Editar descuento
Move to ticket: Mover a ticket
New ticket: Nuevo ticket
Edit price: Editar precio
Edit price: Editar precio
You are going to delete lines of the ticket: Vas a borrar lineas del ticket
Continue anyway?: ¿Estás seguro?