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-icon-menu>
<vn-button <vn-button
disabled="!$ctrl.isChecked || !$ctrl.isEditable" disabled="!$ctrl.isChecked || !$ctrl.isEditable"
ng-click="$ctrl.onRemoveLinesClick()" ng-click="$ctrl.showRemoveLinesDialog()"
vn-tooltip="Remove lines" vn-tooltip="Remove lines"
tooltip-position="up" tooltip-position="up"
icon="delete"> icon="delete">
@ -59,9 +59,11 @@
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="sale in index.model.instances track by sale.id"> <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 ng-show="sale.disponible" ><vn-icon icon="icon-reserved"></vn-icon></td>
<td><vn-icon ng-show="sale.visible" icon="icon-reserved"></vn-icon></td> <!-- <td>
<td><vn-icon ng-show="sale.reserved" icon="icon-reserved"></vn-icon></td> <vn-icon icon="warning"></vn-icon>
<vn-icon icon="icon-reserved"></vn-icon>
</td> -->
<td number> <td number>
<vn-check <vn-check
field="sale.checked" field="sale.checked"
@ -78,7 +80,6 @@
<td ng-if="!$ctrl.isEditable" number>{{sale.quantity}}</td> <td ng-if="!$ctrl.isEditable" number>{{sale.quantity}}</td>
<td ng-if="$ctrl.isEditable" number> <td ng-if="$ctrl.isEditable" number>
<vn-textfield <vn-textfield
model="sale.quantity" model="sale.quantity"
on-change="$ctrl.updateQuantity(sale.id,sale.quantity)" on-change="$ctrl.updateQuantity(sale.id,sale.quantity)"
unclearable="true"> unclearable="true">
@ -125,7 +126,6 @@
</table> </table>
</vn-vertical> </vn-vertical>
</vn-card> </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 vn-id="descriptor">
</vn-item-descriptor-popover> </vn-item-descriptor-popover>
@ -288,3 +288,9 @@
question="You are going to delete this ticket" question="You are going to delete this ticket"
message="Continue anyway?"> message="Continue anyway?">
</vn-confirm> </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++) for (let i = 0; i < data.length; i++)
if (data[i].checked) if (data[i].checked)
lines.push({id: data[i].id, instance: i}); lines.push({id: data[i].id, instance: i});
console.log(this.$.index.model.instances);
return lines; return lines;
} }
@ -131,7 +131,8 @@ class Controller extends FilterTicketList {
} }
// Remove Lines // Remove Lines
onRemoveLinesClick() { onRemoveLinesClick(response) {
if (response === 'ACCEPT') {
let sales = this.getCheckedLines(); let sales = this.getCheckedLines();
let params = {sales: sales, actualTicketFk: this.ticket.id}; let params = {sales: sales, actualTicketFk: this.ticket.id};
let query = `/ticket/api/Sales/removes`; let query = `/ticket/api/Sales/removes`;
@ -139,6 +140,7 @@ class Controller extends FilterTicketList {
this.removeInstances(sales); this.removeInstances(sales);
}); });
} }
}
removeInstances(instances) { removeInstances(instances) {
for (let i = instances.length - 1; i >= 0; i--) { for (let i = instances.length - 1; i >= 0; i--) {
@ -146,6 +148,10 @@ class Controller extends FilterTicketList {
} }
} }
showRemoveLinesDialog() {
this.$.deleteLines.show();
}
// Move Lines // Move Lines
showTransferPopover(event) { showTransferPopover(event) {
let filter = {clientFk: this.ticket.clientFk, ticketFk: this.ticket.id}; let filter = {clientFk: this.ticket.clientFk, ticketFk: this.ticket.id};
@ -284,12 +290,6 @@ class Controller extends FilterTicketList {
this.$.edit.hide(); this.$.edit.hide();
}*/ }*/
onMoreClick() {
this.removeOptionByName('Mark as reserved');
this.removeOptionByName('Unmark as reserved');
this.removeOptionByName('Update discount');
}
/** /**
* Remove options from 'More' menu * Remove options from 'More' menu
* @param {String} name - Option name * @param {String} name - Option name

View File

@ -9,3 +9,5 @@ Edit discount: Editar descuento
Move to ticket: Mover a ticket Move to ticket: Mover a ticket
New ticket: Nuevo 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?