63 lines
1.5 KiB
JavaScript
63 lines
1.5 KiB
JavaScript
import ngModule from '../module';
|
|
import './style.scss';
|
|
|
|
class Controller {
|
|
constructor($scope, $http, $state) {
|
|
this.$scope = $scope;
|
|
this.$http = $http;
|
|
this.$state = $state;
|
|
this.order = {};
|
|
}
|
|
|
|
setSummary() {
|
|
this.$http.get(`/order/api/Orders/${this.order.id}/summary`).then(res => {
|
|
if (res && res.data) {
|
|
this.summary = res.data;
|
|
}
|
|
});
|
|
}
|
|
|
|
get formattedAddress() {
|
|
if (!this.summary) return;
|
|
|
|
let address = this.summary.address;
|
|
let province = address.province ? `(${address.province.name})` : '';
|
|
|
|
return `${address.street} - ${address.city} ${province}`;
|
|
}
|
|
|
|
$onChanges() {
|
|
if (this.order && this.order.id)
|
|
this.setSummary();
|
|
}
|
|
|
|
showDescriptor(event, item) {
|
|
this.quicklinks = {
|
|
btnThree: {
|
|
icon: 'icon-transaction',
|
|
state: `item.card.diary({
|
|
id: ${item.id},
|
|
})`,
|
|
tooltip: 'Item diary'
|
|
}
|
|
};
|
|
this.$scope.descriptor.itemFk = item.id;
|
|
this.$scope.descriptor.parent = event.target;
|
|
this.$scope.descriptor.show();
|
|
}
|
|
|
|
onDescriptorLoad() {
|
|
this.$scope.popover.relocate();
|
|
}
|
|
}
|
|
|
|
Controller.$inject = ['$scope', '$http', '$state'];
|
|
|
|
ngModule.component('vnOrderSummary', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
order: '<'
|
|
}
|
|
});
|