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

View File

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