salix/client/order/src/summary/index.js

61 lines
1.6 KiB
JavaScript
Raw Normal View History

2018-07-18 12:38:43 +00:00
import ngModule from '../module';
2018-10-10 10:55:04 +00:00
import './style.scss';
2018-07-18 12:38:43 +00:00
class Controller {
2018-10-10 10:55:04 +00:00
constructor($scope, $http, $state) {
this.$scope = $scope;
2018-07-18 12:38:43 +00:00
this.$http = $http;
2018-10-10 10:55:04 +00:00
this.$state = $state;
this.setSummary();
2018-07-18 12:38:43 +00:00
}
2018-10-10 10:55:04 +00:00
setSummary() {
this.$http.get(`/order/api/Orders/${this.$state.params.id}/summary`).then(res => {
if (res && res.data) {
this.summary = res.data;
console.log(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}`;
}
/* showDescriptor(event, itemFk) {
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${itemFk},
warehouseFk: ${this.ticket.warehouseFk},
ticketFk: ${this.ticket.id}
})`,
tooltip: 'Item diary'
}
};
this.$scope.descriptor.itemFk = itemFk;
this.$scope.descriptor.parent = event.target;
this.$scope.descriptor.show();
}
onDescriptorLoad() {
this.$scope.popover.relocate();
} */
2018-07-18 12:38:43 +00:00
}
2018-10-10 10:55:04 +00:00
Controller.$inject = ['$scope', '$http', '$state'];
2018-07-18 12:38:43 +00:00
ngModule.component('vnOrderSummary', {
template: require('./index.html'),
controller: Controller,
bindings: {
order: '<'
}
});