Mark/Unmark sale as reserved #349
This commit is contained in:
parent
8448d76ebe
commit
db5457420d
|
@ -3,7 +3,7 @@
|
|||
.icon-volume:before { content: '\e801'; } /* '' */
|
||||
.icon-barcode:before { content: '\e802'; } /* '' */
|
||||
.icon-bucket:before { content: '\e803'; } /* '' */
|
||||
.icon-reserva:before { content: '\e804'; } /* '' */
|
||||
.icon-reserved:before { content: '\e804'; } /* '' */
|
||||
.icon-frozen:before { content: '\e808'; } /* '' */
|
||||
.icon-disabled:before { content: '\e80b'; } /* '' */
|
||||
.icon-invoices:before { content: '\e80c'; } /* '' */
|
||||
|
|
|
@ -24,6 +24,8 @@ Landing: Llegada
|
|||
Landed: F. entrega
|
||||
Margin: Margen
|
||||
More: Más
|
||||
Mark as reserved: Marcar como reservado
|
||||
Unmark as reserved: Desmarcar como reservado
|
||||
m³ per unit: m³ por unidad
|
||||
m³ per quantity: m³ por cantidad
|
||||
Name: Nombre
|
||||
|
|
|
@ -19,9 +19,10 @@
|
|||
label="More"
|
||||
show-filter="false"
|
||||
value-field="callback"
|
||||
data="::$ctrl.moreOptions"
|
||||
data="$ctrl.moreOptions"
|
||||
translate-fields="['name']"
|
||||
on-change="$ctrl.onMoreChange(value)">
|
||||
on-change="$ctrl.onMoreChange(value)"
|
||||
ng-click="$ctrl.onMoreClick()">
|
||||
</vn-icon-menu>
|
||||
<vn-button
|
||||
disabled="!$ctrl.isChecked || !$ctrl.isEditable"
|
||||
|
@ -41,6 +42,7 @@
|
|||
<table class="vn-grid">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th number>
|
||||
<vn-multi-check
|
||||
data="index.model.instances"
|
||||
|
@ -48,7 +50,7 @@
|
|||
</vn-multi-check>
|
||||
</th>
|
||||
<th number translate>Item</th>
|
||||
<th translate style="text-align:center">Description</th>
|
||||
<th translate>Description</th>
|
||||
<th number translate>Quantity</th>
|
||||
<th number translate>Price</th>
|
||||
<th number translate>Discount</th>
|
||||
|
@ -57,6 +59,7 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="sale in index.model.instances track by sale.id">
|
||||
<td><vn-icon ng-show="sale.reserved" icon="icon-reserved"></vn-icon></td>
|
||||
<td number>
|
||||
<vn-check
|
||||
field="sale.checked"
|
||||
|
@ -93,7 +96,7 @@
|
|||
</td>-->
|
||||
</tr>
|
||||
<tr ng-if="index.model.count === 0" class="list list-element">
|
||||
<td colspan="6" style="text-align: center" translate>No results</td>
|
||||
<td colspan="8" style="text-align: center" translate>No results</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -206,6 +206,69 @@ class Controller extends FilterTicketList {
|
|||
}
|
||||
this.$.edit.hide();
|
||||
}
|
||||
|
||||
onMoreClick() {
|
||||
this.removeOptionByName('Mark as reserved');
|
||||
this.removeOptionByName('Unmark as reserved');
|
||||
|
||||
if (!this.isChecked) return;
|
||||
|
||||
this.moreOptions.push({
|
||||
callback: this.markAsReserved,
|
||||
name: 'Mark as reserved'}
|
||||
);
|
||||
|
||||
this.moreOptions.push({
|
||||
callback: this.unmarkAsReserved,
|
||||
name: 'Unmark as reserved'}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove options from 'More' menu
|
||||
* @param {String} name - Option name
|
||||
*/
|
||||
removeOptionByName(name) {
|
||||
let options = this.moreOptions;
|
||||
for (let i = 0; i < this.moreOptions.length; i++) {
|
||||
if (options[i].name === name)
|
||||
this.moreOptions.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark sale as reserved
|
||||
*/
|
||||
markAsReserved() {
|
||||
this.setReserved(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unmark sale as reserved
|
||||
*/
|
||||
unmarkAsReserved() {
|
||||
this.setReserved(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark/Unmark sale as reserved from selected lines
|
||||
* @param {Boolean} reserved reserved
|
||||
*/
|
||||
setReserved(reserved) {
|
||||
let data = {
|
||||
delete: [],
|
||||
create: [],
|
||||
update: this.getCheckedLines()
|
||||
};
|
||||
|
||||
data.update.forEach(line => {
|
||||
line.reserved = reserved;
|
||||
});
|
||||
|
||||
this.$http.post(`/ticket/api/Sales/crudSale`, data).then(() => {
|
||||
this.$.index.accept();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope', '$timeout', '$state', '$http', 'vnApp'];
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
class="material-icons"
|
||||
vn-tooltip="delete expedition"
|
||||
ng-click="$ctrl.deleteExpedition(expedition)">warning</i> -->
|
||||
<vn-icon ng-show="sale.reserved" icon="icon-reserved"></vn-icon>
|
||||
</td>
|
||||
<td number pointer
|
||||
ng-click="$ctrl.showDescriptor($event, sale.itemFk)">
|
||||
|
|
Loading…
Reference in New Issue