#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-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="saleClaimed in $ctrl.salesClaimed" vn-repeat-last on-last="$ctrl.focusLastInput()"> <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-td>
<vn-autocomplete <vn-autocomplete
vn-one vn-one
@ -169,3 +175,6 @@
</vn-table> </vn-table>
</div> </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: [ include: [
{relation: 'sale', {relation: 'sale',
scope: { scope: {
fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount'], fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount', 'itemFk'],
include: { include: {
relation: 'ticket' relation: 'ticket'
} }
@ -35,9 +35,8 @@ class Controller {
let query = `/claim/api/ClaimBeginnings/${json}`; let query = `/claim/api/ClaimBeginnings/${json}`;
this.$http.get(query).then(res => { this.$http.get(query).then(res => {
if (res.data) { if (res.data)
this.claimedSales = res.data; this.claimedSales = res.data;
}
}); });
} }
@ -69,8 +68,8 @@ class Controller {
} }
focusLastInput() { focusLastInput() {
let inputs = document.querySelectorAll("#claimDestinationFk"); let inputs = document.querySelectorAll('#claimDestinationFk');
inputs[inputs.length - 1].querySelector("input").focus(); inputs[inputs.length - 1].querySelector('input').focus();
this.calculateTotals(); this.calculateTotals();
} }
@ -129,6 +128,22 @@ class Controller {
this.vnApp.showSuccess(this.$translate.instant('Data saved!')); 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']; Controller.$inject = ['$stateParams', '$scope', '$http', '$translate', 'vnApp'];

View File

@ -33,7 +33,13 @@
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="saleClaimed in $ctrl.salesClaimed" vn-repeat-last on-last="$ctrl.calculateTotals()"> <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.ticket.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{saleClaimed.sale.quantity}}</vn-td> <vn-td number>{{saleClaimed.sale.quantity}}</vn-td>
<vn-td number> <vn-td number>
@ -112,3 +118,6 @@
</vn-table> </vn-table>
</tpl-body> </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: [ include: [
{relation: 'sale', {relation: 'sale',
scope: { scope: {
fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount'], fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount', 'itemFk'],
include: { include: {
relation: 'ticket' relation: 'ticket'
} }
@ -33,9 +33,8 @@ class Controller {
let query = `/api/Sales/getClaimableFromTicket?ticketFk=${json}`; let query = `/api/Sales/getClaimableFromTicket?ticketFk=${json}`;
this.$http.get(query).then(res => { this.$http.get(query).then(res => {
if (res.data) { if (res.data)
this.salesToClaim = 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); 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']; Controller.$inject = ['$state', '$scope', '$http', '$translate', 'vnApp'];

View File

@ -59,7 +59,13 @@
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="saleClaimed in $ctrl.summary.salesClaimed"> <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.ticket.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td number>{{saleClaimed.sale.quantity}}</vn-td> <vn-td number>{{saleClaimed.sale.quantity}}</vn-td>
<vn-td number>{{saleClaimed.quantity}}</vn-td> <vn-td number>{{saleClaimed.quantity}}</vn-td>
@ -126,6 +132,13 @@
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="action in $ctrl.summary.actions"> <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.sale.id}}</vn-td>
<vn-td number>{{action.claimBeggining.description}}</vn-td> <vn-td number>{{action.claimBeggining.description}}</vn-td>
<vn-td number>{{action.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}}</vn-td> <vn-td number>{{action.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
@ -150,3 +163,6 @@
</vn-vertical> </vn-vertical>
</vn-card> </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'; import ngModule from '../module';
class Controller { class Controller {
constructor($http) { constructor($http, $scope) {
this.$http = $http; this.$http = $http;
this.$ = $scope;
} }
getSummary() { getSummary() {
@ -15,9 +16,25 @@ class Controller {
if (this.claim && this.claim.id) if (this.claim && this.claim.id)
this.getSummary(); 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', { ngModule.component('vnClaimSummary', {
template: require('./index.html'), template: require('./index.html'),

View File

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