62 lines
1.5 KiB
JavaScript
62 lines
1.5 KiB
JavaScript
import ngModule from '../module';
|
|
import Summary from 'salix/components/summary';
|
|
import './style.scss';
|
|
|
|
class Controller extends Summary {
|
|
getSummary() {
|
|
this.$http.get(`Items/${this.item.id}/getSummary`).then(response => {
|
|
this.summary = response.data;
|
|
});
|
|
|
|
this.$http.get('ItemConfigs/findOne')
|
|
.then(res => {
|
|
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
|
|
});
|
|
});
|
|
}
|
|
|
|
$onChanges() {
|
|
if (this.item && this.item.id)
|
|
this.getSummary();
|
|
}
|
|
|
|
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']);
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnItemSummary', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
item: '<',
|
|
},
|
|
require: {
|
|
card: '?^vnItemCard'
|
|
}
|
|
});
|