refs #2952 feat: add chips
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2023-01-03 13:06:30 +01:00
parent 25dad4b358
commit 415fa04e3b
2 changed files with 39 additions and 27 deletions

View File

@ -4,7 +4,7 @@
filter="::$ctrl.filter"
link="{ticketFk: $ctrl.$params.id}"
limit="20"
data="sales"
data="$ctrl.sales"
order="concept ASC"
auto-load="true">
</vn-crud-model>
@ -21,13 +21,13 @@
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="sale in sales">
<vn-tr ng-repeat="sale in $ctrl.sales">
<vn-td center>
<span class="chip {{::$ctrl.chipHasSaleGroupDetail(sale.id)}} vn-mx-xs chip2" vn-tooltip="has saleGroupDetail"></span>
<span class="chip {{::$ctrl.chipIsPreviousSelected()}} vn-ml-xs" vn-tooltip="is previousSelected"></span>
<span class="chip {{::$ctrl.chipIsPrevious()}} vn-mr-xs" vn-tooltip="is previous"></span>
<span class="chip {{::$ctrl.chipIsPrepared()}} vn-mx-xs" vn-tooltip="is prepared"></span>
<span class="chip {{::$ctrl.chipIsControled()}} vn-mx-xs" vn-tooltip="is controled"></span>
<span class="chip {{$ctrl.chipHasSaleGroupDetail(sale.preparingList.hasSaleGroupDetail)}} vn-mx-xs chip2" vn-tooltip="has saleGroupDetail"></span>
<span class="chip {{$ctrl.chipIsPreviousSelected(sale.preparingList.isPreviousSelected)}} vn-ml-xs" vn-tooltip="is previousSelected"></span>
<span class="chip {{$ctrl.chipIsPrevious(sale.preparingList.isPrevious)}} vn-mr-xs" vn-tooltip="is previous"></span>
<span class="chip {{$ctrl.chipIsPrepared(sale.preparingList.isPrepared)}} vn-mx-xs" vn-tooltip="is prepared"></span>
<span class="chip {{$ctrl.chipIsControled(sale.preparingList.isControled)}} vn-mx-xs" vn-tooltip="is controled"></span>
</vn-td>
<vn-td number>
<span
@ -79,7 +79,7 @@
url="SaleTrackings/listSaleTracking"
link="{saleFk: $ctrl.saleId}"
limit="20"
data="sales"
data="saleTrackings"
order="itemFk DESC"
auto-load="true">
</vn-crud-model>
@ -96,7 +96,7 @@
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="sale in sales">
<vn-tr ng-repeat="sale in saleTrackings">
<vn-td number>{{::sale.quantity}}</vn-td>
<vn-td number>{{::sale.originalQuantity}}</vn-td>
<vn-td expand>

View File

@ -10,7 +10,7 @@ class Controller extends Section {
{
relation: 'item'
}, {
relation: 'isChecked',
relation: 'saleTracking',
scope: {
fields: ['isChecked']
}
@ -19,12 +19,25 @@ class Controller extends Section {
};
}
$onInit() {
const query = `Sales/${this.$params.id}/salePreparingList`;
this.$http.get(query)
.then(res => {
this.salePreparingList = res.data;
});
get sales() {
return this._sales;
}
set sales(value) {
this._sales = value;
if (value) {
const query = `Sales/${this.$params.id}/salePreparingList`;
this.$http.get(query)
.then(res => {
this.salePreparingList = res.data;
for (const salePreparing of this.salePreparingList) {
for (const sale of this.sales) {
if (salePreparing.saleFk == sale.id)
sale.preparingList = salePreparing;
}
}
});
}
}
showItemDescriptor(event, sale) {
@ -42,29 +55,28 @@ class Controller extends Section {
this.$.itemDescriptor.show(event.target, sale.itemFk);
}
chipHasSaleGroupDetail(saleId) {
this.salePreparing = this.salePreparingList.find(element => element.saleFk == saleId);
if (this.salePreparing.hasSaleGroupDetail) return 'pink';
chipHasSaleGroupDetail(hasSaleGroupDetail) {
if (hasSaleGroupDetail) return 'pink';
else return 'message';
}
chipIsPreviousSelected() {
if (this.salePreparing.isPreviousSelected) return 'notice';
chipIsPreviousSelected(isPreviousSelected) {
if (isPreviousSelected) return 'notice';
else return 'message';
}
chipIsPrevious() {
if (this.salePreparing.isPrevious) return 'dark-notice';
chipIsPrevious(isPrevious) {
if (isPrevious) return 'dark-notice';
else return 'message';
}
chipIsPrepared() {
if (this.salePreparing.isPrepared) return 'warning';
chipIsPrepared(isPrepared) {
if (isPrepared) return 'warning';
else return 'message';
}
chipIsControled() {
if (this.salePreparing.isControled) return 'yellow';
chipIsControled(isControled) {
if (isControled) return 'yellow';
else return 'message';
}