salix/modules/item/front/summary/index.js

62 lines
1.5 KiB
JavaScript
Raw Normal View History

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 {
getSummary() {
this.$http.get(`Items/${this.item.id}/getSummary`).then(response => {
this.summary = response.data;
2018-02-20 11:33:17 +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);
});
}
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() {
if (this.item && this.item.id)
this.getSummary();
2018-02-20 11:33:17 +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
}
ngModule.vnComponent('vnItemSummary', {
template: require('./index.html'),
controller: Controller,
2018-02-20 11:33:17 +00:00
bindings: {
item: '<',
},
require: {
card: '?^vnItemCard'
}
2018-02-20 11:33:17 +00:00
});