back-end refactor & item search fix. #260
This commit is contained in:
parent
c838d98010
commit
681731e886
|
@ -3,6 +3,7 @@ import './product';
|
|||
import './style.scss';
|
||||
|
||||
class ItemList {
|
||||
|
||||
constructor($http, $state, $scope) {
|
||||
this.$http = $http;
|
||||
this.$state = $state;
|
||||
|
@ -11,15 +12,19 @@ class ItemList {
|
|||
this.itemSelected = null;
|
||||
this.items = [];
|
||||
}
|
||||
|
||||
search(index) {
|
||||
this.items = [];
|
||||
index.accept().then(res => {
|
||||
this.items = res.instances;
|
||||
});
|
||||
}
|
||||
|
||||
cloneItem(item) {
|
||||
this.itemSelected = item;
|
||||
this.$scope.clone.show();
|
||||
}
|
||||
|
||||
onCloneAccept(response) {
|
||||
if (response == 'ACCEPT' && this.itemSelected) {
|
||||
this.$http.post(`/item/api/Items/${this.itemSelected.id}/clone`).then(res => {
|
||||
|
@ -30,6 +35,7 @@ class ItemList {
|
|||
}
|
||||
this.itemSelected = null;
|
||||
}
|
||||
|
||||
showItemPreview(item) {
|
||||
this.itemSelected = item;
|
||||
this.$scope.preview.show();
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
step-count="10"
|
||||
steps="[
|
||||
{name: 'Basic data', state: 'ticket.card.data.stepOne'},
|
||||
{name: 'Price gap', state: 'ticket.card.data.stepTwo'},
|
||||
{name: 'Step 3', state: 'ticket.card.data.stepThree'}]"
|
||||
{name: 'Price difference', state: 'ticket.card.data.stepTwo'},
|
||||
{name: 'Charge', state: 'ticket.card.data.stepThree'}]"
|
||||
on-step-change="$ctrl.onStepChange(state)"
|
||||
on-step-end="$ctrl.onSubmit()">
|
||||
</vn-step-control>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<form name="form">
|
||||
<vn-card pad-large>
|
||||
<vn-title>Price gap</vn-title>
|
||||
<vn-title>Ticket configuration - Price difference</vn-title>
|
||||
<vn-horizontal>
|
||||
<table class="vn-grid">
|
||||
<thead>
|
||||
|
|
|
@ -9,7 +9,7 @@ class Controller {
|
|||
$onChanges(data) {
|
||||
if (!this.ticket || !this.ticket.id) return;
|
||||
|
||||
let query = `/ticket/api/sales/${this.ticket.id}/priceGap`;
|
||||
let query = `/ticket/api/sales/${this.ticket.id}/priceDifference`;
|
||||
this.$http.get(query).then(res => {
|
||||
if (res.data)
|
||||
this.ticket.sales = res.data;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function(Self) {
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('createWithInsurance', {
|
||||
description: 'Creates both classification and one insurance',
|
||||
accepts: [{
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/address/crudAddressObservations.js')(Self);
|
||||
require('../methods/address/crudAddressObservations')(Self);
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function(Self) {
|
||||
module.exports = Self => {
|
||||
Self.installMethod('filter', filterParams);
|
||||
|
||||
function filterParams(params) {
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/creditClassification/createWithInsurance')(Self);
|
||||
require('../methods/credit-classification/createWithInsurance')(Self);
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/creditInsurance/filter.js')(Self);
|
||||
require('../methods/credit-insurance/filter')(Self);
|
||||
|
||||
Self.validateCredit = function(credit) {
|
||||
return credit >= 0;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/greuge/filter.js')(Self);
|
||||
require('../methods/greuge/sumAmount.js')(Self);
|
||||
require('../methods/greuge/filter')(Self);
|
||||
require('../methods/greuge/sumAmount')(Self);
|
||||
|
||||
Self.validatesLengthOf('description', {
|
||||
max: 45,
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/invoiceOut/filter.js')(Self);
|
||||
require('../methods/invoice-out/filter')(Self);
|
||||
};
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/mandate/filter.js')(Self);
|
||||
require('../methods/mandate/filter')(Self);
|
||||
};
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/recovery/filter.js')(Self);
|
||||
require('../methods/recovery/filter')(Self);
|
||||
};
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/item-barcode/crudItemBarcodes.js')(Self);
|
||||
module.exports = Self => {
|
||||
require('../methods/item-barcode/crudItemBarcodes')(Self);
|
||||
};
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/item-log/getLog.js')(Self);
|
||||
module.exports = Self => {
|
||||
require('../methods/item-log/getLog')(Self);
|
||||
};
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/item-niche/crudItemNiches.js')(Self);
|
||||
module.exports = Self => {
|
||||
require('../methods/item-niche/crudItemNiches')(Self);
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('priceGap', {
|
||||
description: 'Returns a sale price gap',
|
||||
Self.remoteMethod('priceDifference', {
|
||||
description: 'Returns a sale price difference',
|
||||
accessType: 'READ',
|
||||
accepts: [{
|
||||
arg: 'ticketFk',
|
||||
|
@ -14,12 +14,12 @@ module.exports = Self => {
|
|||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/:ticketFk/priceGap`,
|
||||
path: `/:ticketFk/priceDifference`,
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.priceGap = async ticketFk => {
|
||||
Self.priceDifference = async ticketFk => {
|
||||
let filter = {
|
||||
where: {
|
||||
ticketFk: ticketFk
|
|
@ -1,6 +1,6 @@
|
|||
const md5 = require('md5');
|
||||
|
||||
module.exports = function(Self) {
|
||||
module.exports = Self => {
|
||||
// Validations
|
||||
|
||||
Self.validatesUniquenessOf('name', {
|
||||
|
|
|
@ -2,7 +2,7 @@ var UserError = require('../helpers').UserError;
|
|||
var getFinalState = require('../helpers').getFinalState;
|
||||
var isMultiple = require('../helpers').isMultiple;
|
||||
|
||||
module.exports = function(Self) {
|
||||
module.exports = Self => {
|
||||
Self.validate('isDefaultAddress', isActive,
|
||||
{message: 'Unable to default a disabled consignee'}
|
||||
);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = function(Self) {
|
||||
module.exports = Self => {
|
||||
Self.defineScope({where: {isManaged: {neq: 0}}});
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@ var UserError = require('../helpers').UserError;
|
|||
var getFinalState = require('../helpers').getFinalState;
|
||||
var isMultiple = require('../helpers').isMultiple;
|
||||
|
||||
module.exports = function(Self) {
|
||||
module.exports = Self => {
|
||||
// Methods
|
||||
|
||||
require('../methods/client/activate')(Self);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/item-tag/crudItemTags.js')(Self);
|
||||
require('../methods/item-tag/filterItemTags.js')(Self);
|
||||
module.exports = Self => {
|
||||
require('../methods/item-tag/crudItemTags')(Self);
|
||||
require('../methods/item-tag/filterItemTags')(Self);
|
||||
};
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
let UserError = require('../helpers').UserError;
|
||||
|
||||
module.exports = function(Self) {
|
||||
require('../methods/item/filter.js')(Self);
|
||||
require('../methods/item/clone.js')(Self);
|
||||
require('../methods/item/updateTaxes.js')(Self);
|
||||
module.exports = Self => {
|
||||
require('../methods/item/filter')(Self);
|
||||
require('../methods/item/clone')(Self);
|
||||
require('../methods/item/updateTaxes')(Self);
|
||||
|
||||
Self.validatesPresenceOf('name', {message: 'Cannot be blank'});
|
||||
Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'});
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/message/send.js')(Self);
|
||||
require('../methods/message/send')(Self);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = function(Self) {
|
||||
module.exports = Self => {
|
||||
require('../methods/sale/filter')(Self);
|
||||
require('../methods/sale/saleComponentFilter.js')(Self);
|
||||
require('../methods/sale/price-gap')(Self);
|
||||
require('../methods/sale/saleComponentFilter')(Self);
|
||||
require('../methods/sale/priceDifference')(Self);
|
||||
};
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
module.exports = function(Self) {
|
||||
require('../methods/state/list.js')(Self);
|
||||
module.exports = Self => {
|
||||
require('../methods/state/list')(Self);
|
||||
};
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
module.exports = function(Self) {
|
||||
require('../methods/ticket-state/change-state.js')(Self);
|
||||
module.exports = Self => {
|
||||
require('../methods/ticket-state/changeState')(Self);
|
||||
};
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/ticket/change-time')(Self);
|
||||
require('../methods/ticket/change-worker')(Self);
|
||||
module.exports = Self => {
|
||||
require('../methods/ticket/changeTime')(Self);
|
||||
require('../methods/ticket/changeWorker')(Self);
|
||||
require('../methods/ticket/filter')(Self);
|
||||
require('../methods/ticket/get-volume')(Self);
|
||||
require('../methods/ticket/getVolume')(Self);
|
||||
require('../methods/ticket/summary')(Self);
|
||||
require('../methods/ticket/get-total')(Self);
|
||||
require('../methods/ticket/get-taxes')(Self);
|
||||
require('../methods/ticket/getTotal')(Self);
|
||||
require('../methods/ticket/getTaxes')(Self);
|
||||
};
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
module.exports = function(Self) {
|
||||
module.exports = Self => {
|
||||
Self.defineScope({where: {isManaged: {neq: 0}}});
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/ticketTracking/filter')(Self);
|
||||
require('../methods/ticket-tracking/filter')(Self);
|
||||
|
||||
Self.validatesPresenceOf('stateFk', {message: 'State cannot be blank'});
|
||||
|
Loading…
Reference in New Issue