2018-02-20 11:33:17 +00:00
|
|
|
import ngModule from '../module';
|
2020-11-23 12:41:51 +00:00
|
|
|
import Summary from 'salix/components/summary';
|
2018-07-24 10:53:26 +00:00
|
|
|
import './style.scss';
|
2018-02-20 11:33:17 +00:00
|
|
|
|
2020-11-23 12:41:51 +00:00
|
|
|
class Controller extends Summary {
|
2018-07-23 07:58:07 +00:00
|
|
|
getSummary() {
|
2019-10-24 22:53:53 +00:00
|
|
|
this.$http.get(`Items/${this.item.id}/getSummary`).then(response => {
|
2018-07-23 07:58:07 +00:00
|
|
|
this.summary = response.data;
|
2018-02-20 11:33:17 +00:00
|
|
|
});
|
2023-02-07 12:40:39 +00:00
|
|
|
|
|
|
|
this.$http.get('ItemConfigs/findOne')
|
|
|
|
.then(res => {
|
2023-02-16 08:44:20 +00:00
|
|
|
if (this.card) this.card.warehouseFk = res.data.warehouseFk;
|
|
|
|
this.getWarehouseName(res.data.warehouseFk);
|
2023-02-07 12:40:39 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
getWarehouseName(warehouseFk) {
|
|
|
|
const filter = {
|
|
|
|
where: {id: warehouseFk}
|
|
|
|
};
|
|
|
|
this.$http.get('Warehouses/findOne', {filter})
|
|
|
|
.then(res => {
|
|
|
|
this.warehouseText = this.$t('WarehouseFk', {
|
|
|
|
warehouseName: res.data.name
|
|
|
|
});
|
|
|
|
});
|
2018-02-20 11:33:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$onChanges() {
|
2019-01-31 13:14:39 +00:00
|
|
|
if (this.item && this.item.id)
|
2018-07-23 07:58:07 +00:00
|
|
|
this.getSummary();
|
2018-02-20 11:33:17 +00:00
|
|
|
}
|
2021-01-12 06:39:12 +00:00
|
|
|
|
|
|
|
get isBuyer() {
|
|
|
|
return this.aclService.hasAny(['buyer']);
|
|
|
|
}
|
|
|
|
|
|
|
|
get isReplenisher() {
|
|
|
|
return this.aclService.hasAny(['replenisher']);
|
|
|
|
}
|
|
|
|
|
|
|
|
get isAdministrative() {
|
|
|
|
return this.aclService.hasAny(['administrative']);
|
|
|
|
}
|
|
|
|
|
|
|
|
get isEmployee() {
|
|
|
|
return this.aclService.hasAny(['employee']);
|
|
|
|
}
|
2018-02-20 11:33:17 +00:00
|
|
|
}
|
2018-05-25 08:03:45 +00:00
|
|
|
|
2020-07-24 12:22:30 +00:00
|
|
|
ngModule.vnComponent('vnItemSummary', {
|
2018-05-25 08:03:45 +00:00
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
2018-02-20 11:33:17 +00:00
|
|
|
bindings: {
|
2018-10-25 11:45:29 +00:00
|
|
|
item: '<',
|
|
|
|
},
|
2023-02-07 12:40:39 +00:00
|
|
|
require: {
|
|
|
|
card: '?^vnItemCard'
|
|
|
|
}
|
2018-02-20 11:33:17 +00:00
|
|
|
});
|