#844 Claim add item descriptors

This commit is contained in:
Gerard 2018-11-21 13:29:46 +01:00
parent 30a6d71578
commit c0a3a66e6f
7 changed files with 98 additions and 17 deletions

View File

@ -44,7 +44,13 @@
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="saleClaimed in $ctrl.salesClaimed" vn-repeat-last on-last="$ctrl.focusLastInput()">
<vn-td number>{{saleClaimed.sale.id}}</vn-td>
<vn-td number>
<span
ng-click="$ctrl.showDescriptor($event, saleClaimed.sale.itemFk)"
pointer class="link">
{{("000000"+saleClaimed.sale.itemFk).slice(-6)}}
</span>
</vn-td>
<vn-td>
<vn-autocomplete
vn-one
@ -168,4 +174,7 @@
</vn-tbody>
</vn-table>
</div>
</vn-popover>
</vn-popover>
<vn-item-descriptor-popover vn-id="descriptor"
quicklinks="$ctrl.quicklinks">
</vn-item-descriptor-popover>

View File

@ -13,7 +13,7 @@ class Controller {
include: [
{relation: 'sale',
scope: {
fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount'],
fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount', 'itemFk'],
include: {
relation: 'ticket'
}
@ -35,9 +35,8 @@ class Controller {
let query = `/claim/api/ClaimBeginnings/${json}`;
this.$http.get(query).then(res => {
if (res.data) {
if (res.data)
this.claimedSales = res.data;
}
});
}
@ -69,8 +68,8 @@ class Controller {
}
focusLastInput() {
let inputs = document.querySelectorAll("#claimDestinationFk");
inputs[inputs.length - 1].querySelector("input").focus();
let inputs = document.querySelectorAll('#claimDestinationFk');
inputs[inputs.length - 1].querySelector('input').focus();
this.calculateTotals();
}
@ -129,6 +128,22 @@ class Controller {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
});
}
// Item Descriptor
showDescriptor(event, itemFk) {
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${itemFk}
})`,
tooltip: 'Item diary'
}
};
this.$.descriptor.itemFk = itemFk;
this.$.descriptor.parent = event.target;
this.$.descriptor.show();
}
}
Controller.$inject = ['$stateParams', '$scope', '$http', '$translate', 'vnApp'];

View File

@ -33,7 +33,13 @@
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="saleClaimed in $ctrl.salesClaimed" vn-repeat-last on-last="$ctrl.calculateTotals()">
<vn-td number>{{saleClaimed.sale.id}}</vn-td>
<vn-td number>
<span
ng-click="$ctrl.showDescriptor($event, saleClaimed.sale.itemFk)"
pointer class="link">
{{("000000"+saleClaimed.sale.itemFk).slice(-6)}}
</span>
</vn-td>
<vn-td number>{{saleClaimed.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{saleClaimed.sale.quantity}}</vn-td>
<vn-td number>
@ -111,4 +117,7 @@
</vn-empty-rows>
</vn-table>
</tpl-body>
</vn-dialog>
</vn-dialog>
<vn-item-descriptor-popover vn-id="descriptor"
quicklinks="$ctrl.quicklinks">
</vn-item-descriptor-popover>

View File

@ -13,7 +13,7 @@ class Controller {
include: [
{relation: 'sale',
scope: {
fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount'],
fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount', 'itemFk'],
include: {
relation: 'ticket'
}
@ -33,9 +33,8 @@ class Controller {
let query = `/api/Sales/getClaimableFromTicket?ticketFk=${json}`;
this.$http.get(query).then(res => {
if (res.data) {
if (res.data)
this.salesToClaim = res.data;
}
});
}
@ -77,6 +76,22 @@ class Controller {
this.claimedTotal += (sale.quantity * sale.sale.price) - ((sale.sale.discount * (sale.quantity * sale.sale.price)) / 100);
});
}
// Item Descriptor
showDescriptor(event, itemFk) {
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${itemFk}
})`,
tooltip: 'Item diary'
}
};
this.$.descriptor.itemFk = itemFk;
this.$.descriptor.parent = event.target;
this.$.descriptor.show();
}
}
Controller.$inject = ['$state', '$scope', '$http', '$translate', 'vnApp'];

View File

@ -59,7 +59,13 @@
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="saleClaimed in $ctrl.summary.salesClaimed">
<vn-td number>{{saleClaimed.sale.id}}</vn-td>
<vn-td number>
<span
ng-click="$ctrl.showDescriptor($event, saleClaimed.sale.itemFk)"
pointer class="link">
{{("000000"+saleClaimed.sale.itemFk).slice(-6)}}
</span>
</vn-td>
<vn-td number>{{saleClaimed.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{saleClaimed.sale.quantity}}</vn-td>
<vn-td number>{{saleClaimed.quantity}}</vn-td>
@ -126,6 +132,13 @@
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="action in $ctrl.summary.actions">
<vn-td number>
<span
ng-click="$ctrl.showDescriptor($event, action.sale.itemFk)"
pointer class="link">
{{("000000"+action.sale.itemFk).slice(-6)}}
</span>
</vn-td>
<vn-td number>{{action.sale.id}}</vn-td>
<vn-td number>{{action.claimBeggining.description}}</vn-td>
<vn-td number>{{action.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
@ -149,4 +162,7 @@
</vn-horizontal>
</vn-vertical>
</vn-card>
</vn-vertical>
</vn-vertical>
<vn-item-descriptor-popover vn-id="descriptor"
quicklinks="$ctrl.quicklinks">
</vn-item-descriptor-popover>

View File

@ -1,8 +1,9 @@
import ngModule from '../module';
class Controller {
constructor($http) {
constructor($http, $scope) {
this.$http = $http;
this.$ = $scope;
}
getSummary() {
@ -15,9 +16,25 @@ class Controller {
if (this.claim && this.claim.id)
this.getSummary();
}
// Item Descriptor
showDescriptor(event, itemFk) {
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${itemFk}
})`,
tooltip: 'Item diary'
}
};
this.$.descriptor.itemFk = itemFk;
this.$.descriptor.parent = event.target;
this.$.descriptor.show();
}
}
Controller.$inject = ['$http'];
Controller.$inject = ['$http', '$scope'];
ngModule.component('vnClaimSummary', {
template: require('./index.html'),

View File

@ -51,7 +51,7 @@ module.exports = Self => {
include: [
{relation: 'sale',
scope: {
fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount'],
fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount', 'itemFk'],
include: {
relation: 'ticket'
}