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-volume:before { content: '\e801'; } /* '' */
|
||||||
.icon-barcode:before { content: '\e802'; } /* '' */
|
.icon-barcode:before { content: '\e802'; } /* '' */
|
||||||
.icon-bucket:before { content: '\e803'; } /* '' */
|
.icon-bucket:before { content: '\e803'; } /* '' */
|
||||||
.icon-reserva:before { content: '\e804'; } /* '' */
|
.icon-reserved:before { content: '\e804'; } /* '' */
|
||||||
.icon-frozen:before { content: '\e808'; } /* '' */
|
.icon-frozen:before { content: '\e808'; } /* '' */
|
||||||
.icon-disabled:before { content: '\e80b'; } /* '' */
|
.icon-disabled:before { content: '\e80b'; } /* '' */
|
||||||
.icon-invoices:before { content: '\e80c'; } /* '' */
|
.icon-invoices:before { content: '\e80c'; } /* '' */
|
||||||
|
|
|
@ -24,6 +24,8 @@ Landing: Llegada
|
||||||
Landed: F. entrega
|
Landed: F. entrega
|
||||||
Margin: Margen
|
Margin: Margen
|
||||||
More: Más
|
More: Más
|
||||||
|
Mark as reserved: Marcar como reservado
|
||||||
|
Unmark as reserved: Desmarcar como reservado
|
||||||
m³ per unit: m³ por unidad
|
m³ per unit: m³ por unidad
|
||||||
m³ per quantity: m³ por cantidad
|
m³ per quantity: m³ por cantidad
|
||||||
Name: Nombre
|
Name: Nombre
|
||||||
|
|
|
@ -19,9 +19,10 @@
|
||||||
label="More"
|
label="More"
|
||||||
show-filter="false"
|
show-filter="false"
|
||||||
value-field="callback"
|
value-field="callback"
|
||||||
data="::$ctrl.moreOptions"
|
data="$ctrl.moreOptions"
|
||||||
translate-fields="['name']"
|
translate-fields="['name']"
|
||||||
on-change="$ctrl.onMoreChange(value)">
|
on-change="$ctrl.onMoreChange(value)"
|
||||||
|
ng-click="$ctrl.onMoreClick()">
|
||||||
</vn-icon-menu>
|
</vn-icon-menu>
|
||||||
<vn-button
|
<vn-button
|
||||||
disabled="!$ctrl.isChecked || !$ctrl.isEditable"
|
disabled="!$ctrl.isChecked || !$ctrl.isEditable"
|
||||||
|
@ -41,6 +42,7 @@
|
||||||
<table class="vn-grid">
|
<table class="vn-grid">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th></th>
|
||||||
<th number>
|
<th number>
|
||||||
<vn-multi-check
|
<vn-multi-check
|
||||||
data="index.model.instances"
|
data="index.model.instances"
|
||||||
|
@ -48,7 +50,7 @@
|
||||||
</vn-multi-check>
|
</vn-multi-check>
|
||||||
</th>
|
</th>
|
||||||
<th number translate>Item</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>Quantity</th>
|
||||||
<th number translate>Price</th>
|
<th number translate>Price</th>
|
||||||
<th number translate>Discount</th>
|
<th number translate>Discount</th>
|
||||||
|
@ -57,6 +59,7 @@
|
||||||
</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.reserved" icon="icon-reserved"></vn-icon></td>
|
||||||
<td number>
|
<td number>
|
||||||
<vn-check
|
<vn-check
|
||||||
field="sale.checked"
|
field="sale.checked"
|
||||||
|
@ -93,7 +96,7 @@
|
||||||
</td>-->
|
</td>-->
|
||||||
</tr>
|
</tr>
|
||||||
<tr ng-if="index.model.count === 0" class="list list-element">
|
<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>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -206,6 +206,69 @@ class Controller extends FilterTicketList {
|
||||||
}
|
}
|
||||||
this.$.edit.hide();
|
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'];
|
Controller.$inject = ['$scope', '$timeout', '$state', '$http', 'vnApp'];
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
class="material-icons"
|
class="material-icons"
|
||||||
vn-tooltip="delete expedition"
|
vn-tooltip="delete expedition"
|
||||||
ng-click="$ctrl.deleteExpedition(expedition)">warning</i> -->
|
ng-click="$ctrl.deleteExpedition(expedition)">warning</i> -->
|
||||||
|
<vn-icon ng-show="sale.reserved" icon="icon-reserved"></vn-icon>
|
||||||
</td>
|
</td>
|
||||||
<td number pointer
|
<td number pointer
|
||||||
ng-click="$ctrl.showDescriptor($event, sale.itemFk)">
|
ng-click="$ctrl.showDescriptor($event, sale.itemFk)">
|
||||||
|
|
Loading…
Reference in New Issue