Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
abaab3e34a
|
@ -4,18 +4,19 @@ import './style.scss';
|
|||
|
||||
export default class InputTime extends Textfield {
|
||||
|
||||
constructor($element, $scope, $attrs, vnTemplate, $transclude, $filter) {
|
||||
super($element, $scope, $attrs, vnTemplate, $transclude);
|
||||
|
||||
this.$filter = $filter;
|
||||
}
|
||||
|
||||
get value() {
|
||||
return this._value;
|
||||
}
|
||||
|
||||
set value(value) {
|
||||
this._value = value;
|
||||
if (!value) return;
|
||||
|
||||
let newDate = new Date(value);
|
||||
newDate.setSeconds(0);
|
||||
newDate.setMilliseconds(0);
|
||||
|
||||
this._value = newDate;
|
||||
|
||||
this.hasValue = this._value !== null;
|
||||
|
||||
if (this.hasValue) this.element.classList.add('not-empty');
|
||||
|
@ -24,7 +25,7 @@ export default class InputTime extends Textfield {
|
|||
}
|
||||
|
||||
get step() {
|
||||
return parseFloat(this.input.step);
|
||||
return parseInt(this.input.step);
|
||||
}
|
||||
|
||||
set step(value) {
|
||||
|
@ -32,7 +33,7 @@ export default class InputTime extends Textfield {
|
|||
}
|
||||
}
|
||||
|
||||
InputTime.$inject = ['$element', '$scope', '$attrs', 'vnTemplate', '$transclude', '$filter'];
|
||||
InputTime.$inject = ['$element', '$scope', '$attrs', 'vnTemplate', '$transclude'];
|
||||
|
||||
ngModule.component('vnInputTime', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
<form ng-submit="$ctrl.onSubmit()">
|
||||
<vn-horizontal>
|
||||
<vn-icon-button
|
||||
<vn-textfield vn-one label="Search" model="$ctrl.searchString">
|
||||
<t-left-icons>
|
||||
<vn-icon
|
||||
icon="search"
|
||||
ng-click="$ctrl.clearFilter(); $ctrl.onSubmit()"
|
||||
style="cursor: pointer; padding-top: 23px">
|
||||
</vn-icon-button>
|
||||
<vn-textfield vn-one label="Search" model="$ctrl.searchString"></vn-textfield>
|
||||
pointer>
|
||||
</vn-icon>
|
||||
</t-left-icons>
|
||||
<t-right-icons>
|
||||
<vn-icon
|
||||
pad-medium-top
|
||||
ng-if="$ctrl.panel"
|
||||
ng-click="$ctrl.openPanel($event)"
|
||||
icon="keyboard_arrow_down"
|
||||
style="cursor: pointer; color: #aaa">
|
||||
pointer>
|
||||
</vn-icon>
|
||||
</t-right-icons>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
</form>
|
||||
<vn-popover
|
||||
|
|
|
@ -17,6 +17,7 @@ vn-textfield {
|
|||
padding-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.leftIcons, .rightIcons, .suffix {
|
||||
display: flex;
|
||||
color: $secondary-font-color;
|
||||
|
@ -25,7 +26,17 @@ vn-textfield {
|
|||
font-size: 20px !important
|
||||
}
|
||||
}
|
||||
|
||||
t-left-icons {
|
||||
padding-right: 0.5em
|
||||
}
|
||||
|
||||
t-right-icons {
|
||||
padding-left: 0.5em
|
||||
}
|
||||
|
||||
.infix {
|
||||
position: relative;
|
||||
display: block;
|
||||
flex: auto;
|
||||
width: 100%;
|
||||
|
|
|
@ -223,13 +223,15 @@ export default class Watcher extends Component {
|
|||
let newCopy = {};
|
||||
if (data && typeof data === 'object') {
|
||||
Object.keys(data).forEach(
|
||||
val => {
|
||||
if (!isFullEmpty(data[val])) {
|
||||
if (typeof data[val] === 'object') {
|
||||
newCopy[val] = this.copyInNewObject(data[val]);
|
||||
} else {
|
||||
newCopy[val] = data[val];
|
||||
}
|
||||
key => {
|
||||
let value = data[key];
|
||||
if (value instanceof Date)
|
||||
newCopy[key] = new Date(value.getTime());
|
||||
else if (!isFullEmpty(value)) {
|
||||
if (typeof value === 'object')
|
||||
newCopy[key] = this.copyInNewObject(value);
|
||||
else
|
||||
newCopy[key] = value;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -2,15 +2,17 @@ import isEqual from './equals';
|
|||
|
||||
export default function getModifiedData(object, objectOld) {
|
||||
var newObject = {};
|
||||
if (objectOld === null) {
|
||||
if (objectOld === null)
|
||||
return object;
|
||||
}
|
||||
|
||||
for (var k in object) {
|
||||
var val = object[k];
|
||||
var valOld = objectOld[k] === undefined ? null : objectOld[k];
|
||||
|
||||
if (!isEqual(val, valOld)) {
|
||||
if (val instanceof Object) {
|
||||
if (val instanceof Date) {
|
||||
newObject[k] = new Date(val.getTime());
|
||||
} else if (val instanceof Object) {
|
||||
newObject[k] = getModifiedData(val, valOld);
|
||||
} else {
|
||||
newObject[k] = val;
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
"component": "vn-zone-basic-data",
|
||||
"description": "Basic data",
|
||||
"params": {
|
||||
"client": "$ctrl.client"
|
||||
"zone": "$ctrl.zone"
|
||||
},
|
||||
"menu": {
|
||||
"icon": "settings"
|
||||
|
|
|
@ -6,3 +6,5 @@ import './zone/descriptor';
|
|||
import './zone/search-panel';
|
||||
import './zone/index';
|
||||
import './zone/create';
|
||||
import './zone/basic-data';
|
||||
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
<mg-ajax path="/route/api/Zones/{{patch.params.id}}" options="vnPatch"></mg-ajax>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.zone"
|
||||
form="form"
|
||||
save="patch">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="$ctrl.onSubmit()">
|
||||
<vn-card pad-large>
|
||||
<vn-title>Basic data</vn-title>
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-two vn-focus
|
||||
label="Name"
|
||||
field="$ctrl.zone.name">
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
field="$ctrl.zone.warehouseFk"
|
||||
url="/route/api/Warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Warehouse">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
field="$ctrl.zone.agencyModeFk"
|
||||
url="/route/api/AgencyModes"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Agency">
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-input-number
|
||||
vn-two
|
||||
min="0"
|
||||
step="1"
|
||||
label="Traveling days"
|
||||
field="$ctrl.zone.travelingDays">
|
||||
</vn-input-number>
|
||||
<vn-input-time
|
||||
vn-two
|
||||
label="Estimated hour (ETD)"
|
||||
field="$ctrl.zone.hour">
|
||||
</vn-input-time>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-input-number vn-one
|
||||
label="Price"
|
||||
field="$ctrl.zone.price"
|
||||
min="0.00"
|
||||
step="0.50">
|
||||
</vn-input-number>
|
||||
<vn-input-number vn-one
|
||||
label="Bonus"
|
||||
field="$ctrl.zone.bonus"
|
||||
min="0.00"
|
||||
step="0.50">
|
||||
</vn-input-number>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
</vn-button-bar>
|
||||
</form>
|
|
@ -0,0 +1,27 @@
|
|||
import ngModule from '../../module';
|
||||
|
||||
class Controller {
|
||||
|
||||
constructor($scope) {
|
||||
this.$scope = $scope;
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$scope.watcher.submit().then(() => {
|
||||
this.card.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope'];
|
||||
|
||||
ngModule.component('vnZoneBasicData', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
zone: '<'
|
||||
},
|
||||
require: {
|
||||
card: '^vnZoneCard'
|
||||
}
|
||||
});
|
|
@ -1,7 +1,7 @@
|
|||
<vn-main-block>
|
||||
<vn-horizontal>
|
||||
<vn-auto class="left-block">
|
||||
<vn-zone-descriptor order="$ctrl.zone"></vn-zone-descriptor>
|
||||
<vn-zone-descriptor zone="$ctrl.zone"></vn-zone-descriptor>
|
||||
<vn-left-menu></vn-left-menu>
|
||||
</vn-auto>
|
||||
<vn-one>
|
||||
|
|
|
@ -1,58 +1,36 @@
|
|||
import ngModule from '../../module';
|
||||
|
||||
class Controller {
|
||||
constructor($http, $state) {
|
||||
constructor($http, $stateParams) {
|
||||
this.$http = $http;
|
||||
this.$state = $state;
|
||||
this.order = {};
|
||||
this.filter = {
|
||||
this.$stateParams = $stateParams;
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
this.getCard();
|
||||
}
|
||||
|
||||
getCard() {
|
||||
let filter = {
|
||||
include: [
|
||||
{relation: 'agencyMode', scope: {fields: ['name']}},
|
||||
{relation: 'address', scope: {fields: ['nickname']}},
|
||||
{relation: 'rows', scope: {fields: ['id']}},
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'],
|
||||
include: {
|
||||
relation: 'salesPerson',
|
||||
fields: ['firstName', 'name']
|
||||
}
|
||||
}
|
||||
}
|
||||
{relation: 'warehouse', fields: ['name']},
|
||||
{relation: 'agencyMode', fields: ['name']}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/* getOrder() {
|
||||
let json = encodeURIComponent(JSON.stringify(this.filter));
|
||||
let query = `/order/api/Orders/${this.$state.params.id}?filter=${json}`;
|
||||
let json = encodeURIComponent(JSON.stringify(filter));
|
||||
let query = `/route/api/Zones/${this.$stateParams.id}?filter=${json}`;
|
||||
this.$http.get(query).then(res => {
|
||||
if (res.data) {
|
||||
this.order = res.data;
|
||||
this.getTotal();
|
||||
}
|
||||
if (res.data)
|
||||
this.zone = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
getTotal() {
|
||||
let query = `/order/api/Orders/${this.$state.params.id}/getTotal`;
|
||||
this.$http.get(query).then(res => {
|
||||
if (res.data) {
|
||||
this.order.total = res.data.total;
|
||||
}
|
||||
});
|
||||
}
|
||||
$onInit() {
|
||||
this.getOrder();
|
||||
}
|
||||
|
||||
reload() {
|
||||
this.getOrder();
|
||||
} */
|
||||
this.getCard();
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$http', '$state'];
|
||||
Controller.$inject = ['$http', '$stateParams'];
|
||||
|
||||
ngModule.component('vnZoneCard', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import './index.js';
|
||||
|
||||
describe('Order', () => {
|
||||
describe('Component vnOrderCard', () => {
|
||||
describe('Route', () => {
|
||||
describe('Component vnZoneCard', () => {
|
||||
let $componentController;
|
||||
let $scope;
|
||||
let controller;
|
||||
let $httpBackend;
|
||||
let $state;
|
||||
let $stateParams;
|
||||
|
||||
beforeEach(() => {
|
||||
angular.mock.module('order');
|
||||
angular.mock.module('route');
|
||||
});
|
||||
|
||||
beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_) => {
|
||||
|
@ -17,50 +17,24 @@ describe('Order', () => {
|
|||
$httpBackend = _$httpBackend_;
|
||||
$httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
|
||||
$scope = $rootScope.$new();
|
||||
$scope.card = {createOrder: () => {}};
|
||||
$state = {params: {id: 1}};
|
||||
controller = $componentController('vnOrderCard', {$scope: $scope, $state: $state});
|
||||
$stateParams = {id: 1};
|
||||
controller = $componentController('vnZoneCard', {$scope: $scope, $stateParams});
|
||||
}));
|
||||
|
||||
describe('getOrder()', () => {
|
||||
it(`should make a query, save the data in order and call get order if the response has data`, () => {
|
||||
spyOn(controller, 'getTotal');
|
||||
let json = encodeURIComponent(JSON.stringify(controller.filter));
|
||||
$httpBackend.expectGET(`/order/api/Orders/${controller.$state.params.id}?filter=${json}`).respond({id: 1});
|
||||
controller.getOrder();
|
||||
describe('getCard()', () => {
|
||||
it(`should make a query and define zone property`, () => {
|
||||
let filter = {
|
||||
include: [
|
||||
{relation: 'warehouse', fields: ['name']},
|
||||
{relation: 'agencyMode', fields: ['name']}
|
||||
]
|
||||
};
|
||||
let json = encodeURIComponent(JSON.stringify(filter));
|
||||
$httpBackend.expectGET(`/route/api/Zones/1?filter=${json}`).respond({id: 1});
|
||||
controller.getCard();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.order).toEqual({id: 1});
|
||||
expect(controller.getTotal).toHaveBeenCalledWith();
|
||||
});
|
||||
|
||||
it(`should make a query and not call getTotal if the response is not defined`, () => {
|
||||
spyOn(controller, 'getTotal');
|
||||
let json = encodeURIComponent(JSON.stringify(controller.filter));
|
||||
$httpBackend.expectGET(`/order/api/Orders/${controller.$state.params.id}?filter=${json}`).respond(undefined);
|
||||
controller.getOrder();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.order).toEqual({});
|
||||
expect(controller.getTotal).not.toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('getTotal()', () => {
|
||||
it(`should make a query and save the data in order.total`, () => {
|
||||
$httpBackend.expectGET(`/order/api/Orders/${controller.$state.params.id}/getTotal`).respond({total: '20M'});
|
||||
controller.getTotal();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.order.total).toEqual('20M');
|
||||
});
|
||||
|
||||
it(`should make a query and not save the respones if is not defined`, () => {
|
||||
$httpBackend.expectGET(`/order/api/Orders/${controller.$state.params.id}/getTotal`).respond();
|
||||
controller.getTotal();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.order.total).toEqual(undefined);
|
||||
expect(controller.zone).toEqual({id: 1});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,11 +9,26 @@
|
|||
</a>
|
||||
</vn-horizontal>
|
||||
<div pad-medium>
|
||||
<vn-label-value label="ID"
|
||||
<vn-label-value label="Id"
|
||||
value="{{$ctrl.zone.id}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Client"
|
||||
value="{{$ctrl.order.client.name}}">
|
||||
<vn-label-value label="Name"
|
||||
value="{{$ctrl.zone.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Warehouse"
|
||||
value="{{$ctrl.zone.warehouse.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Agency"
|
||||
value="{{$ctrl.zone.agencyMode.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Estimated hour (ETD)"
|
||||
value="{{$ctrl.zone.hour | date: 'HH:mm'}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Price"
|
||||
value="{{$ctrl.zone.price | currency: '€': 2}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Bonus"
|
||||
value="{{$ctrl.zone.price | currency: '€': 2}}">
|
||||
</vn-label-value>
|
||||
</div>
|
||||
</vn-card>
|
||||
|
|
|
@ -1,18 +1,8 @@
|
|||
import ngModule from '../../module';
|
||||
import './style.scss';
|
||||
|
||||
class Controller {
|
||||
constructor($translate) {
|
||||
this.translate = $translate;
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$translate'];
|
||||
|
||||
ngModule.component('vnZoneDescriptor', {
|
||||
template: require('./index.html'),
|
||||
bindings: {
|
||||
order: '<'
|
||||
},
|
||||
controller: Controller
|
||||
zone: '<'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
Client: Cliente
|
||||
Confirmed: Confirmado
|
||||
Not confirmed: Sin confirmar
|
||||
State: Estado
|
||||
Landed: F. entrega
|
||||
Items: Articulos
|
||||
Agency: Agencia
|
||||
Sales person: Comercial
|
|
@ -1,5 +0,0 @@
|
|||
vn-label-value[label=Total]{
|
||||
padding-top: 10px;
|
||||
display: block;
|
||||
font-size: 1.2em;
|
||||
}
|
|
@ -18,7 +18,7 @@ export default {
|
|||
},
|
||||
clientsIndex: {
|
||||
searchClientInput: `${components.vnTextfield}`,
|
||||
searchButton: `vn-searchbar vn-icon-button[icon="search"]`,
|
||||
searchButton: `vn-searchbar vn-icon[icon="search"]`,
|
||||
searchResult: `vn-item-client a`,
|
||||
createClientButton: `${components.vnFloatButton}`
|
||||
},
|
||||
|
@ -161,7 +161,7 @@ export default {
|
|||
searchResultCloneButton: `vn-item-product .buttons > [icon="icon-clone"]`,
|
||||
acceptClonationAlertButton: `vn-item-index [vn-id="clone"] [response="ACCEPT"]`,
|
||||
searchItemInput: `${components.vnTextfield}`,
|
||||
searchButton: `vn-searchbar vn-icon-button[icon="search"]`,
|
||||
searchButton: `vn-searchbar vn-icon[icon="search"]`,
|
||||
closeItemSummaryPreview: 'vn-item-index [vn-id="preview"] button.close'
|
||||
},
|
||||
itemCreateView: {
|
||||
|
@ -278,7 +278,7 @@ export default {
|
|||
searchResultDate: `vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)`,
|
||||
searchResultAddress: `vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)`,
|
||||
searchTicketInput: `vn-ticket-index ${components.vnTextfield}`,
|
||||
searchButton: `vn-ticket-index vn-searchbar vn-icon-button[icon="search"]`
|
||||
searchButton: `vn-ticket-index vn-searchbar vn-icon[icon="search"]`
|
||||
},
|
||||
ticketNotes: {
|
||||
notesButton: `vn-menu-item a[ui-sref="ticket.card.observation"]`,
|
||||
|
@ -367,7 +367,7 @@ export default {
|
|||
addressSelect: `vn-autocomplete[field="$ctrl.ticket.addressFk"] input`,
|
||||
addressSelectSecondOption: `vn-autocomplete[field="$ctrl.ticket.addressFk"] vn-drop-down ul > li:nth-child(2)`,
|
||||
agencySelect: `vn-autocomplete[field="$ctrl.ticket.agencyModeFk"] input`,
|
||||
agencySelectFifthOption: `vn-autocomplete[field="$ctrl.ticket.agencyModeFk"] vn-drop-down ul > li:nth-child(5)`,
|
||||
agencySelectOptionSix: `vn-autocomplete[field="$ctrl.ticket.agencyModeFk"] vn-drop-down ul > li:nth-child(6)`,
|
||||
nextStepButton: `vn-step-control > section > section.buttons > section:nth-child(2) > vn-button`,
|
||||
finalizeButton: `vn-step-control > section > section.buttons > section:nth-child(2) > vn-submit`,
|
||||
stepTwoTotalPriceDif: `vn-ticket-data-step-two > form > vn-card > div > vn-horizontal > table > tfoot > tr > td:nth-child(4)`,
|
||||
|
@ -384,7 +384,7 @@ export default {
|
|||
claimsIndex: {
|
||||
searchClaimInput: `vn-claim-index ${components.vnTextfield}`,
|
||||
searchResult: `vn-claim-index vn-card > div > vn-table > div > vn-tbody > vn-tr`,
|
||||
searchButton: `vn-claim-index vn-searchbar > form > vn-horizontal > vn-icon-button > vn-icon`
|
||||
searchButton: `vn-claim-index vn-searchbar vn-icon[icon="search"]`
|
||||
},
|
||||
claimBasicData: {
|
||||
basicDataButton: `vn-menu-item a[ui-sref="claim.card.basicData"]`,
|
||||
|
|
|
@ -68,7 +68,7 @@ describe('Ticket List sale path', () => {
|
|||
.wait(selectors.ticketSales.firstSaleText)
|
||||
.getInnerText(selectors.ticketSales.firstSalePrice)
|
||||
.then(value => {
|
||||
expect(value).toContain('€11.42');
|
||||
expect(value).toContain('€9.10');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -86,7 +86,7 @@ describe('Ticket List sale path', () => {
|
|||
.wait(selectors.ticketSales.firstSaleText)
|
||||
.getInnerText(selectors.ticketSales.firstSaleImport)
|
||||
.then(value => {
|
||||
expect(value).toContain('57.10');
|
||||
expect(value).toContain('45.50');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -104,7 +104,7 @@ describe('Ticket List sale path', () => {
|
|||
.wait(selectors.ticketSales.secondSaleText)
|
||||
.getInnerText(selectors.ticketSales.secondSalePrice)
|
||||
.then(value => {
|
||||
expect(value).toContain('€1.30');
|
||||
expect(value).toContain('€1.07');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -122,7 +122,7 @@ describe('Ticket List sale path', () => {
|
|||
.wait(selectors.ticketSales.secondSaleText)
|
||||
.getInnerText(selectors.ticketSales.secondSaleImport)
|
||||
.then(value => {
|
||||
expect(value).toContain('13.00');
|
||||
expect(value).toContain('10.70');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -106,7 +106,7 @@ describe('Ticket', () => {
|
|||
it(`should edit the ticket agency then click next`, () => {
|
||||
return nightmare
|
||||
.waitToClick(selectors.ticketBasicData.agencySelect)
|
||||
.waitToClick(selectors.ticketBasicData.agencySelectFifthOption)
|
||||
.waitToClick(selectors.ticketBasicData.agencySelectOptionSix)
|
||||
.waitForTextInInput(selectors.ticketBasicData.agencySelect, 'Expensive')
|
||||
.click(selectors.ticketBasicData.nextStepButton)
|
||||
.waitForURL('data/step-two')
|
||||
|
|
|
@ -60,7 +60,7 @@ describe('Ticket Edit sale path', () => {
|
|||
.wait(selectors.ticketSales.firstSaleText)
|
||||
.getInnerText(selectors.ticketSales.firstSalePrice)
|
||||
.then(value => {
|
||||
expect(value).toEqual('€11.42');
|
||||
expect(value).toEqual('€9.10');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -78,7 +78,7 @@ describe('Ticket Edit sale path', () => {
|
|||
.wait(selectors.ticketSales.firstSaleText)
|
||||
.getInnerText(selectors.ticketSales.firstSaleImport)
|
||||
.then(value => {
|
||||
expect(value).toEqual('€57.10');
|
||||
expect(value).toEqual('€45.50');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -364,7 +364,7 @@ describe('Ticket Edit sale path', () => {
|
|||
.waitToClick(selectors.ticketSales.moveToTicketButton)
|
||||
.waitForLastSnackbar()
|
||||
.then(result => {
|
||||
expect(result).toEqual(`The sales of that ticket can't be modified`);
|
||||
expect(result).toEqual(`The sales of this ticket can't be modified`);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -2,19 +2,20 @@ const app = require('../../../server/server');
|
|||
const routes = require('../routes');
|
||||
const restoreFixtures = require('../../../../../services/db/testing_fixtures');
|
||||
|
||||
describe('Auth routes', () => {
|
||||
let sqlStatements = {deletes: `
|
||||
DELETE FROM salix.user WHERE id = 102;
|
||||
`, inserts: ``, updates: ``};
|
||||
xdescribe('Auth routes', () => {
|
||||
let route;
|
||||
|
||||
beforeEach(() => {
|
||||
restoreFixtures(sqlStatements);
|
||||
beforeAll(async() => {
|
||||
route = await app.models.Route.findOne({where: {id: 102}});
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
restoreFixtures(sqlStatements);
|
||||
beforeEach(async() => {
|
||||
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
|
||||
});
|
||||
let User = app.models.User;
|
||||
let loginFunction;
|
||||
let logoutFunction;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
CREATE TABLE `vn`.`localLog` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`ticketFk` VARCHAR(45) NULL,
|
||||
PRIMARY KEY (`id`));
|
|
@ -0,0 +1,21 @@
|
|||
DROP TRIGGER IF EXISTS `vn2008`.`TicketsAfterUpdate`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn2008`$$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`TicketsAfterUpdate`
|
||||
AFTER UPDATE ON `Tickets` FOR EACH ROW
|
||||
BEGIN
|
||||
IF NEW.Id_Ruta IS NULL AND OLD.Id_Ruta IS NOT NULL THEN
|
||||
INSERT INTO vn.routeLog(originFk, userFk, `action`, description)
|
||||
VALUES (OLD.Id_Ruta, account.userGetId(), 'update', CONCAT('Saca el ticket ', OLD.Id_Ticket, ' de la ruta'));
|
||||
ELSEIF NOT (NEW.Id_Ruta <=> OLD.Id_Ruta) THEN
|
||||
INSERT INTO vn.routeLog(originFk, userFk, `action`, description)
|
||||
VALUES (NEW.Id_Ruta, account.userGetId(), 'update', CONCAT('Añade el ticket ', OLD.Id_Ticket, ' a la ruta'));
|
||||
END IF;
|
||||
|
||||
CALL stock.queueAdd ('ticket', NEW.Id_Ticket, OLD.Id_Ticket);
|
||||
|
||||
INSERT INTO vn.localLog(ticketFk)
|
||||
VALUES(NEW.Id_Ticket);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -4,10 +4,10 @@ DROP procedure IF EXISTS `orderAddItem`;
|
|||
DELIMITER $$
|
||||
USE `hedera`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `orderAddItem`(
|
||||
vOrder INT,
|
||||
vWarehouse INT,
|
||||
vItem INT,
|
||||
vAmount INT,
|
||||
vOrder INT)
|
||||
vAmount INT)
|
||||
BEGIN
|
||||
DECLARE vRow INT;
|
||||
DECLARE vAdd INT;
|
||||
|
@ -17,7 +17,9 @@ BEGIN
|
|||
DECLARE vRate INT;
|
||||
DECLARE vShipment DATE;
|
||||
DECLARE vPrice DECIMAL(10,2);
|
||||
|
||||
DECLARE vDate DATE;
|
||||
DECLARE vAddress INT;
|
||||
DECLARE vAgencyMode INT;
|
||||
DECLARE cur CURSOR FOR
|
||||
SELECT grouping, price, rate
|
||||
FROM tmp.bionic_price
|
||||
|
@ -34,7 +36,12 @@ BEGIN
|
|||
RESIGNAL;
|
||||
END;
|
||||
|
||||
CALL bionic_from_item (vItem);
|
||||
SELECT date_send, address_id, agency_id
|
||||
INTO vDate, vAddress, vAgencyMode
|
||||
FROM `order`
|
||||
WHERE id = vOrder;
|
||||
|
||||
CALL vn2008.bionic_from_item(vDate, vAddress, vAgencyMode, vItem);
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
|
|
|
@ -12,9 +12,7 @@ BEGIN
|
|||
|
||||
SET vOrder = myBasketGetId();
|
||||
|
||||
CALL bionic_from_item (vItem);
|
||||
|
||||
CALL addItem(vWarehouse, vItem, vAmount, vOrder);
|
||||
CALL orderAddItem(vOrder,vWarehouse, vItem, vAmount);
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
USE `hedera`;
|
||||
DROP procedure IF EXISTS `addItem`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `hedera`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `addItem`(
|
||||
vWarehouse INT,
|
||||
vItem INT,
|
||||
vAmount INT,
|
||||
vOrder INT)
|
||||
BEGIN
|
||||
DECLARE vRow INT;
|
||||
DECLARE vAdd INT;
|
||||
DECLARE vAvailable INT;
|
||||
DECLARE vDone BOOL;
|
||||
DECLARE vGrouping INT;
|
||||
DECLARE vRate INT;
|
||||
DECLARE vShipment DATE;
|
||||
DECLARE vPrice DECIMAL(10,2);
|
||||
DECLARE cur CURSOR FOR
|
||||
SELECT grouping, price, rate
|
||||
FROM tmp.bionic_price
|
||||
WHERE warehouse_id = vWarehouse
|
||||
AND item_id = vItem
|
||||
ORDER BY grouping DESC;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
||||
SET vDone = TRUE;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
ROLLBACK;
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
SELECT shipped INTO vShipment
|
||||
FROM tmp.travel_tree
|
||||
WHERE warehouseFk = vWarehouse;
|
||||
|
||||
SELECT available INTO vAvailable
|
||||
FROM tmp.bionic_lot
|
||||
WHERE warehouse_id = vWarehouse
|
||||
AND item_id = vItem;
|
||||
|
||||
IF vAmount > vAvailable
|
||||
THEN
|
||||
CALL util.throw ('ORDER_ROW_UNAVAILABLE');
|
||||
END IF;
|
||||
|
||||
OPEN cur;
|
||||
|
||||
l: LOOP
|
||||
SET vDone = FALSE;
|
||||
|
||||
FETCH cur INTO vGrouping, vPrice, vRate;
|
||||
|
||||
IF vDone THEN
|
||||
LEAVE l;
|
||||
END IF;
|
||||
|
||||
SET vAdd = vAmount - MOD(vAmount, vGrouping);
|
||||
SET vAmount = vAmount - vAdd;
|
||||
|
||||
IF vAdd = 0 THEN
|
||||
ITERATE l;
|
||||
END IF;
|
||||
|
||||
INSERT INTO order_row SET
|
||||
order_id = vOrder,
|
||||
item_id = vItem,
|
||||
warehouse_id = vWarehouse,
|
||||
shipment = vShipment,
|
||||
rate = vRate,
|
||||
amount = vAdd,
|
||||
price = vPrice;
|
||||
|
||||
SET vRow = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO order_component (order_row_id, component_id, price)
|
||||
SELECT vRow, c.component_id, c.cost
|
||||
FROM tmp.bionic_component c
|
||||
JOIN bi.tarifa_componentes t
|
||||
ON t.Id_Componente = c.component_id
|
||||
AND (t.tarifa_class IS NULL OR t.tarifa_class = vRate)
|
||||
WHERE c.warehouse_id = vWarehouse
|
||||
AND c.item_id = vItem;
|
||||
END LOOP;
|
||||
|
||||
CLOSE cur;
|
||||
COMMIT;
|
||||
|
||||
CALL vn2008.bionic_free ();
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `vn2008`.`agency`
|
||||
ADD COLUMN `code` VARCHAR(45) NULL DEFAULT NULL AFTER `zone_label`;
|
|
@ -1,27 +0,0 @@
|
|||
USE `hedera`;
|
||||
DROP procedure IF EXISTS `orderAddItem`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `hedera`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `orderAddItem`(
|
||||
vWarehouse INT,
|
||||
vItem INT,
|
||||
vAmount INT,
|
||||
vOrder INT)
|
||||
BEGIN
|
||||
DECLARE vDate DATE;
|
||||
DECLARE vAddress INT;
|
||||
DECLARE vAgencyMode INT;
|
||||
|
||||
SELECT date_send, address_id, agency_id
|
||||
INTO vDate, vAddress, vAgencyMode
|
||||
FROM `order`
|
||||
WHERE id = vOrder;
|
||||
|
||||
CALL vn2008.bionic_from_item(vDate, vAddress, vAgencyMode, vItem);
|
||||
|
||||
CALL addItem(vWarehouse, vItem, vAmount, vOrder);
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
USE `vn`;
|
||||
CREATE
|
||||
OR REPLACE ALGORITHM = UNDEFINED
|
||||
DEFINER = `root`@`%`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `agency` AS
|
||||
SELECT
|
||||
`a`.`agency_id` AS `id`,
|
||||
`a`.`name` AS `name`,
|
||||
`a`.`warehouse_id` AS `warehouseFk`,
|
||||
`a`.`por_volumen` AS `isVolumetric`,
|
||||
`a`.`Id_Banco` AS `bankFk`,
|
||||
`a`.`warehouse_alias_id` AS `warehouseAliasFk`,
|
||||
`a`.`propios` AS `own`,
|
||||
`a`.`zone_label` AS `labelZone`,
|
||||
`a`.`code` AS `code`
|
||||
FROM
|
||||
`vn2008`.`agency` `a`;
|
|
@ -0,0 +1,154 @@
|
|||
USE `vn`;
|
||||
DROP procedure IF EXISTS `ticketComponentUpdateSale`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticketComponentUpdateSale`(vOption INT)
|
||||
BEGIN
|
||||
/**
|
||||
* A partir de la tabla tmp.sale, crea los Movimientos_componentes
|
||||
* y modifica el campo Preu de la tabla Movimientos
|
||||
*
|
||||
* @param i_option integer tipo de actualizacion
|
||||
* @param table tmp.sale tabla memory con el campo Id_Movimiento, warehouse_id
|
||||
**/
|
||||
DECLARE vComponentFk INT;
|
||||
DECLARE vRenewComponents BOOLEAN;
|
||||
DECLARE vKeepPrices BOOLEAN;
|
||||
|
||||
CASE vOption
|
||||
WHEN 1 THEN
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = FALSE;
|
||||
WHEN 2 THEN
|
||||
SET vComponentFk = 17;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 3 THEN
|
||||
SET vComponentFk = 37;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 4 THEN
|
||||
SET vComponentFk = 34;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 5 THEN
|
||||
SET vComponentFk = 35;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 6 THEN
|
||||
SET vComponentFk = 36;
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
WHEN 7 THEN
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.8, 3)
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
AND sc.componentFk NOT IN (28, 29)
|
||||
GROUP BY s.id;
|
||||
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 29, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.2, 3)
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
AND sc.componentFk NOT IN (28, 29)
|
||||
GROUP BY s.id;
|
||||
|
||||
SET vRenewComponents = FALSE;
|
||||
SET vKeepPrices = FALSE;
|
||||
WHEN 8 THEN
|
||||
DELETE sc.*
|
||||
FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk;
|
||||
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100)), 3)
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id;
|
||||
|
||||
SET vRenewComponents = FALSE;
|
||||
SET vKeepPrices = FALSE;
|
||||
WHEN 9 THEN
|
||||
SET vRenewComponents = TRUE;
|
||||
SET vKeepPrices = TRUE;
|
||||
END CASE;
|
||||
|
||||
IF vRenewComponents THEN
|
||||
DELETE sc.*
|
||||
FROM tmp.sale tmps
|
||||
JOIN saleComponent sc ON sc.saleFk = tmps.saleFk
|
||||
JOIN componentRate cr ON cr.id = sc.componentFk
|
||||
WHERE cr.isRenewable;
|
||||
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, tc.componentFk, ROUND(tc.cost,3)
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
AND sc.componentFk = tc.componentFk
|
||||
LEFT JOIN componentRate cr ON cr.id = tc.componentFk
|
||||
WHERE IF(sc.componentFk IS NULL AND NOT cr.isRenewable, FALSE, TRUE);
|
||||
END IF;
|
||||
|
||||
IF vKeepPrices THEN
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, vComponentFk, ROUND((s.price * (100 - s.discount) / 100) - SUM(sc.value), 3) dif
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
WHERE sc.saleFk <> vComponentFk
|
||||
GROUP BY s.id
|
||||
HAVING dif <> 0;
|
||||
ELSE
|
||||
UPDATE sale s
|
||||
JOIN item i on i.id = s.itemFk
|
||||
JOIN itemType it on it.id = i.typeFk
|
||||
JOIN (SELECT SUM(sc.value) sumValue, sc.saleFk
|
||||
FROM saleComponent sc
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
|
||||
GROUP BY sc.saleFk) sc ON sc.saleFk = s.id
|
||||
SET s.price = sumValue
|
||||
WHERE it.code != 'PRT';
|
||||
|
||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 21, ROUND((s.price * (100 - s.discount) / 100) - sum(value),3) saleValue
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
WHERE sc.componentFk != 21
|
||||
GROUP BY s.id
|
||||
HAVING ROUND(saleValue, 4) <> 0;
|
||||
END IF;
|
||||
|
||||
UPDATE sale s
|
||||
JOIN (
|
||||
SELECT SUM(sc.value) sumValue, sc.saleFk
|
||||
FROM saleComponent sc
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
|
||||
JOIN componentRate cr ON cr.id = sc.componentFk
|
||||
JOIN componentTypeRate ctr on ctr.id = cr.componentTypeRate AND ctr.base
|
||||
GROUP BY sc.saleFk) sc ON sc.saleFk = s.id
|
||||
SET s.priceFixed = sumValue, s.isPriceFixed = 1;
|
||||
|
||||
DELETE sc.*
|
||||
FROM saleComponent sc
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
|
||||
JOIN sale s on s.id = sc.saleFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
WHERE it.code = 'PRT';
|
||||
|
||||
INSERT INTO saleComponent(saleFk, componentFk, value)
|
||||
SELECT s.id, 15, ROUND(s.price,3)
|
||||
FROM sale s
|
||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
||||
JOIN item i ON i.id = s.itemFK
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
WHERE it.code = 'PRT' AND s.price > 0;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -5,4 +5,21 @@ ALTER TABLE `vn`.`zoneNest`
|
|||
RENAME TO `vn`.`zoneGeo` ;
|
||||
|
||||
ALTER TABLE `vn`.`zone`
|
||||
CHANGE COLUMN `agencyFk` `agencyModeFk` INT(11) NOT NULL ;
|
||||
CHANGE COLUMN `agencyFk` `agencyModeFk` INT(11) NOT NULL,
|
||||
CHANGE COLUMN `hour` `hour` DATETIME NOT NULL,
|
||||
CHANGE COLUMN `warehouseFk` `warehouseFk` SMALLINT(6) UNSIGNED NOT NULL ;
|
||||
|
||||
ALTER TABLE `vn`.`zone`
|
||||
ADD INDEX `fk_zone_1_idx` (`warehouseFk` ASC),
|
||||
ADD INDEX `fk_zone_2_idx` (`agencyModeFk` ASC);
|
||||
ALTER TABLE `vn`.`zone`
|
||||
ADD CONSTRAINT `fk_zone_1`
|
||||
FOREIGN KEY (`warehouseFk`)
|
||||
REFERENCES `vn2008`.`warehouse` (`id`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `fk_zone_2`
|
||||
FOREIGN KEY (`agencyModeFk`)
|
||||
REFERENCES `vn2008`.`Agencias` (`Id_Agencia`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION;
|
||||
|
|
|
@ -68,16 +68,17 @@ INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`)
|
|||
VALUES
|
||||
(8, 'Pay on receipt', '0000000000', 4, 0, 1);
|
||||
|
||||
INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `isVolumetric`, `bankFk`, `warehouseAliasFk`)
|
||||
INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `isVolumetric`, `bankFk`, `warehouseAliasFk`, `code`)
|
||||
VALUES
|
||||
(1, 'inhouse pickup' , 1, 0, 8, 1),
|
||||
(2, 'Super-Man delivery' , 1, 0, 8, 1),
|
||||
(3, 'Teleportation device' , 1, 0, 8, 1),
|
||||
(4, 'Entanglement' , 1, 0, 8, 1),
|
||||
(5, 'Quantum break device' , 1, 0, 8, 1),
|
||||
(6, 'Walking' , 1, 0, 8, 1),
|
||||
(7, 'Silla247' , 1, 0, 8, 1),
|
||||
(8, 'Silla247Expensive' , 1, 0, 8, 1);
|
||||
(1, 'inhouse pickup' , 1, 0, 8, 1, NULL),
|
||||
(2, 'Super-Man delivery' , 1, 0, 8, 1, NULL),
|
||||
(3, 'Teleportation device' , 1, 0, 8, 1, NULL),
|
||||
(4, 'Entanglement' , 1, 0, 8, 1, NULL),
|
||||
(5, 'Quantum break device' , 1, 0, 8, 1, NULL),
|
||||
(6, 'Walking' , 1, 0, 8, 1, NULL),
|
||||
(7, 'Silla247' , 1, 0, 8, 1, NULL),
|
||||
(8, 'Silla247Expensive' , 1, 0, 8, 1, NULL),
|
||||
(9, 'Abono' , 1, 0, 8, 1, 'refund');
|
||||
|
||||
UPDATE `vn`.`agencyMode` SET `id` = 1 WHERE `name` = 'inhouse pickup';
|
||||
UPDATE `vn`.`agencyMode` SET `id` = 2 WHERE `name` = 'Super-Man delivery';
|
||||
|
@ -87,6 +88,7 @@ UPDATE `vn`.`agencyMode` SET `id` = 5 WHERE `name` = 'Quantum break device';
|
|||
UPDATE `vn`.`agencyMode` SET `id` = 6 WHERE `name` = 'Walking';
|
||||
UPDATE `vn`.`agencyMode` SET `id` = 7 WHERE `name` = 'Silla247';
|
||||
UPDATE `vn`.`agencyMode` SET `id` = 8 WHERE `name` = 'Silla247Expensive';
|
||||
UPDATE `vn`.`agencyMode` SET `id` = 23 WHERE `name` = 'Abono';
|
||||
|
||||
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 1;
|
||||
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 2;
|
||||
|
@ -96,6 +98,7 @@ UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 5;
|
|||
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 2 WHERE `id` = 6;
|
||||
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 7;
|
||||
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 8;
|
||||
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 4 WHERE `id` = 23;
|
||||
|
||||
UPDATE `vn`.`agencyMode` SET `web` = 1 WHERE `id` = 1;
|
||||
|
||||
|
@ -269,7 +272,8 @@ INSERT INTO `vn`.`observationType`(`id`,`description`)
|
|||
VALUES
|
||||
(1,'observation one'),
|
||||
(2,'observation two'),
|
||||
(3,'observation three');
|
||||
(3,'observation three'),
|
||||
(4,'comercial');
|
||||
|
||||
INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`)
|
||||
VALUES
|
||||
|
@ -329,29 +333,29 @@ INSERT INTO `vn`.`invoiceOut`(`id`, `ref`, `serial`, `amount`, `issued`,`clientF
|
|||
( 4, 'E4444444' , 'E', 290.30 , DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1),
|
||||
( 5, 'E5555555' , 'E', 190.30 , DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1);
|
||||
|
||||
INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`)
|
||||
INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `created`)
|
||||
VALUES
|
||||
(1 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , 101, 'address 21', 121, NULL, 0),
|
||||
(2 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , 101, 'address 21', 121, NULL, 0),
|
||||
(3 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , 102, 'address 22', 122, NULL, 0),
|
||||
(4 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , 102, 'address 22', 122, NULL, 0),
|
||||
(5 , 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , 103, 'address 23', 123, NULL, 0),
|
||||
(6 , 3, 3, 4, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , 103, 'address 23', 123, NULL, 0),
|
||||
(7 , 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , 104, 'address 24', 124, NULL, 0),
|
||||
(8 , 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 104, 'address 24', 124, NULL, 0),
|
||||
(9 , 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 'address 25', 125, NULL, 0),
|
||||
(10, 6, 5, 5, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 'address 25', 125, NULL, 0),
|
||||
(11, 7, 1, 1, CURDATE() , CURDATE() , 101, 'address 21', 121, NULL, 0),
|
||||
(12, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 'address 21', 121, NULL, 0),
|
||||
(13, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 'address 21', 121, NULL, 0),
|
||||
(14, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 'address 21', 121, NULL, 0),
|
||||
(15, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 'address 21', 121, NULL, 0),
|
||||
(16, 1, 1, 1, CURDATE() , CURDATE() , 101, 'address 21', 121, NULL, 0),
|
||||
(17, 4, 4, 4, CURDATE() , CURDATE() , 106, 'address 26', 126, NULL, 0),
|
||||
(18, 4, 4, 4, CURDATE() , CURDATE() , 107, 'address 27', 127, NULL, 0),
|
||||
(19, 5, 5, 4, CURDATE() , CURDATE() , 108, 'address 28', 128, NULL, 0),
|
||||
(20, 5, 5, 4, CURDATE() , CURDATE() , 109, 'address 19', 119, NULL, 0),
|
||||
(21, 5, 5, 4, CURDATE() , CURDATE() , 110, 'address 29', 129, NULL, 1);
|
||||
(1 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY) ),
|
||||
(2 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY) ),
|
||||
(3 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , 102, 'address 22', 122, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY) ),
|
||||
(4 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , 102, 'address 22', 122, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -4 DAY) ),
|
||||
(5 , 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , 103, 'address 23', 123, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -3 DAY) ),
|
||||
(6 , 3, 3, 4, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , 103, 'address 23', 123, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -2 DAY) ),
|
||||
(7 , 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , 104, 'address 24', 124, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -1 DAY) ),
|
||||
(8 , 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 104, 'address 24', 124, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
(9 , 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 'address 25', 125, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
||||
(10, 6, 5, 5, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 'address 25', 125, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
|
||||
(11, 7, 1, 1, CURDATE() , CURDATE() , 101, 'address 21', 121, NULL, 0, CURDATE() ),
|
||||
(12, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
||||
(13, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +2 MONTH)),
|
||||
(14, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +3 MONTH)),
|
||||
(15, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +4 MONTH)),
|
||||
(16, 1, 1, 1, CURDATE() , CURDATE() , 101, 'address 21', 121, NULL, 0, CURDATE() ),
|
||||
(17, 4, 4, 4, CURDATE() , CURDATE() , 106, 'address 26', 126, NULL, 0, CURDATE() ),
|
||||
(18, 4, 4, 4, CURDATE() , CURDATE() , 107, 'address 27', 127, NULL, 0, CURDATE() ),
|
||||
(19, 5, 5, 4, CURDATE() , CURDATE() , 108, 'address 28', 128, NULL, 0, CURDATE() ),
|
||||
(20, 5, 5, 4, CURDATE() , CURDATE() , 109, 'address 19', 119, NULL, 0, CURDATE() ),
|
||||
(21, 5, 5, 4, CURDATE() , CURDATE() , 110, 'address 29', 129, NULL, 1, CURDATE() );
|
||||
|
||||
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
|
||||
VALUES
|
||||
|
@ -361,16 +365,16 @@ INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `des
|
|||
|
||||
INSERT INTO `vn`.`ticketTracking`(`id`, `ticketFk`, `stateFk`, `workerFk`, `created`)
|
||||
VALUES
|
||||
(1 , 1 , 3 , 5 , CURDATE()),
|
||||
(2 , 2 , 15, 5 , CURDATE()),
|
||||
(3 , 3 , 16, 5 , CURDATE()),
|
||||
(4 , 4 , 13, 5 , CURDATE()),
|
||||
(5 , 5 , 15, 18, CURDATE()),
|
||||
(6 , 6 , 16, 18, CURDATE()),
|
||||
(7 , 7 , 13, 18, CURDATE()),
|
||||
(8 , 8 , 15, 19, CURDATE()),
|
||||
(9 , 9 , 16, 19, CURDATE()),
|
||||
(10, 10, 13, 19, CURDATE()),
|
||||
(1 , 1 , 16, 5 , DATE_ADD(CURDATE(), INTERVAL -15 DAY) ),
|
||||
(2 , 2 , 16, 5 , DATE_ADD(CURDATE(), INTERVAL -10 DAY) ),
|
||||
(3 , 3 , 16, 5 , DATE_ADD(CURDATE(), INTERVAL -5 DAY) ),
|
||||
(4 , 4 , 16, 5 , DATE_ADD(CURDATE(), INTERVAL -4 DAY) ),
|
||||
(5 , 5 , 16, 18, DATE_ADD(CURDATE(), INTERVAL -3 DAY) ),
|
||||
(6 , 6 , 16, 18, DATE_ADD(CURDATE(), INTERVAL -2 DAY) ),
|
||||
(7 , 7 , 16, 18, DATE_ADD(CURDATE(), INTERVAL -1 DAY) ),
|
||||
(8 , 8 , 16, 19, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
(9 , 9 , 16, 19, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
||||
(10, 10, 16, 19, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
|
||||
(11, 11, 3 , 19, CURDATE()),
|
||||
(12, 12, 3 , 19, CURDATE()),
|
||||
(13, 13, 3 , 19, CURDATE()),
|
||||
|
@ -519,18 +523,18 @@ INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`,
|
|||
|
||||
INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `price`, `discount`, `reserved`, `isPicked`, `created`)
|
||||
VALUES
|
||||
( 1, 1, 1 , 'Gem of Time', 5 , 11.42, 0, 0, 0, CURDATE()),
|
||||
( 2, 2, 1 , 'Gem of Mind', 10 , 1.30, 0, 0, 0, CURDATE()),
|
||||
( 3, 1, 1 , 'Gem of Time', 2 , 11.42, 0, 0, 0, CURDATE()),
|
||||
( 4, 4, 1 , 'Mark I' , 20 , 3.26, 0, 0, 0, CURDATE()),
|
||||
( 5, 1, 2 , 'Gem of Time', 10 , 11.42, 0, 0, 0, CURDATE()),
|
||||
( 6, 1, 3 , 'Gem of Time', 15 , 11.42, 0, 0, 0, CURDATE()),
|
||||
( 1, 1, 1 , 'Gem of Time', 5, 9.10, 0, 0, 0, CURDATE()),
|
||||
( 2, 2, 1 , 'Gem of Mind', 10, 1.07, 0, 0, 0, CURDATE()),
|
||||
( 3, 1, 1 , 'Gem of Time', 2, 9.10, 0, 0, 0, CURDATE()),
|
||||
( 4, 4, 1 , 'Mark I' , 20, 3.06, 0, 0, 0, CURDATE()),
|
||||
( 5, 1, 2 , 'Gem of Time', 10, 9.10, 0, 0, 0, CURDATE()),
|
||||
( 6, 1, 3 , 'Gem of Time', 15, 6.50, 0, 0, 0, CURDATE()),
|
||||
( 7, 2, 11, 'Gem of Mind', 15, 1.30, 0, 0, 0, CURDATE()),
|
||||
( 8, 4, 11, 'Mark I' , 10, 3.26, 0, 0, 0, CURDATE()),
|
||||
( 9, 1, 16, 'Gem of Time', 5 , 11.42, 0, 0, 0, CURDATE()),
|
||||
( 10, 2, 16, 'Gem of Mind', 10 , 1.30, 0, 0, 0, CURDATE()),
|
||||
( 11, 1, 16, 'Gem of Time', 2 , 11.42, 0, 0, 0, CURDATE()),
|
||||
( 12, 4, 16, 'Mark I' , 20 , 3.26, 0, 0, 0, CURDATE());
|
||||
( 9, 1, 16, 'Gem of Time', 5, 9.10, 0, 0, 0, CURDATE()),
|
||||
( 10, 2, 16, 'Gem of Mind', 10, 1.07, 0, 0, 0, CURDATE()),
|
||||
( 11, 1, 16, 'Gem of Time', 2, 9.10, 0, 0, 0, CURDATE()),
|
||||
( 12, 4, 16, 'Mark I' , 20, 3.06, 0, 0, 0, CURDATE());
|
||||
|
||||
INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
|
||||
VALUES
|
||||
|
@ -539,68 +543,64 @@ INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
|
|||
|
||||
INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
|
||||
VALUES
|
||||
( 1, 10, 1),
|
||||
( 1, 14, 2.5),
|
||||
( 1, 15, 3),
|
||||
( 1, 17, 4.5),
|
||||
( 1, 21, 5),
|
||||
( 1, 15, 0.58),
|
||||
( 1, 23, 6.5),
|
||||
( 1, 28, 1),
|
||||
( 2, 28, 1),
|
||||
( 3, 10, 1),
|
||||
( 3, 14, 2.5),
|
||||
( 3, 15, 3),
|
||||
( 3, 17, 4.5),
|
||||
( 3, 21, 5),
|
||||
( 1, 28, 20.72),
|
||||
( 1, 29, -18.72),
|
||||
( 1, 39, 0.02),
|
||||
( 2, 15, 0.058),
|
||||
( 2, 21, 0.002),
|
||||
( 2, 28, 5.6),
|
||||
( 2, 29, -4.6),
|
||||
( 2, 39, 0.01),
|
||||
( 3, 15, 0.58),
|
||||
( 3, 23, 6.5),
|
||||
( 3, 28, 1),
|
||||
( 4, 28, 1),
|
||||
( 4, 10, 1),
|
||||
( 2, 17, 3.5),
|
||||
( 4, 39, 5),
|
||||
( 3, 28, 20.72),
|
||||
( 3, 29, -18.72),
|
||||
( 3, 39, 0.02),
|
||||
( 4, 15, 0.051),
|
||||
( 4, 21, -0.001),
|
||||
( 4, 28, 20.72),
|
||||
( 4, 29, -19.72),
|
||||
( 4, 37, 2),
|
||||
( 5, 10, 1),
|
||||
( 5, 14, 2.5),
|
||||
( 5, 15, 3),
|
||||
( 5, 17, 4.5),
|
||||
( 5, 21, 5),
|
||||
( 4, 39, 0.01),
|
||||
( 5, 15, 0.58),
|
||||
( 5, 23, 6.5),
|
||||
( 5, 28, 1),
|
||||
( 6, 10, 1),
|
||||
( 6, 14, 2.5),
|
||||
( 6, 15, 3),
|
||||
( 6, 17, 4.5),
|
||||
( 6, 21, 5),
|
||||
( 5, 28, 20.72),
|
||||
( 5, 29, -18.72),
|
||||
( 5, 39, 0.02),
|
||||
( 6, 23, 6.5),
|
||||
( 6, 28, 1),
|
||||
( 7, 28, 1),
|
||||
( 7, 17, 3.5),
|
||||
( 7, 15, 3),
|
||||
( 8, 28, 1),
|
||||
( 8, 10, 1),
|
||||
( 8, 39, 5),
|
||||
( 8, 15, 5),
|
||||
( 7, 15, 0.29),
|
||||
( 7, 28, 5.6),
|
||||
( 7, 29, -4.6),
|
||||
( 7, 39, 0.01),
|
||||
( 8, 15, 0.254),
|
||||
( 8, 21, -0.004),
|
||||
( 8, 28, 20.72),
|
||||
( 8, 29, -19.72),
|
||||
( 8, 37, 2),
|
||||
( 9, 10, 1),
|
||||
( 9, 14, 2.5),
|
||||
( 9, 15, 3),
|
||||
( 9, 17, 4.5),
|
||||
( 9, 21, 5),
|
||||
( 8, 39, 0.01),
|
||||
( 9, 15, 0.58),
|
||||
( 9, 23, 6.5),
|
||||
( 9, 28, 1),
|
||||
( 10, 28, 1),
|
||||
( 11, 10, 1),
|
||||
( 11, 14, 2.5),
|
||||
( 11, 15, 3),
|
||||
( 11, 17, 4.5),
|
||||
( 11, 21, 5),
|
||||
( 9, 28, 20.72),
|
||||
( 9, 29, -18.72),
|
||||
( 9, 39, 0.02),
|
||||
( 10, 15, 0.058),
|
||||
( 10, 21, 0.002),
|
||||
( 10, 28, 5.6),
|
||||
( 10, 29, -4.6),
|
||||
( 10, 39, 0.01),
|
||||
( 11, 15, 0.58),
|
||||
( 11, 23, 6.5),
|
||||
( 11, 28, 1),
|
||||
( 12, 28, 1),
|
||||
( 12, 10, 1),
|
||||
( 10, 17, 3.5),
|
||||
( 12, 39, 5),
|
||||
( 12, 37, 2);
|
||||
( 11, 28, 20.72),
|
||||
( 11, 29, -18.72),
|
||||
( 11, 39, 0.02),
|
||||
( 12, 15, 0.051),
|
||||
( 12, 22, -0.001),
|
||||
( 12, 28, 20.72),
|
||||
( 12, 29, -19.72),
|
||||
( 12, 37, 2),
|
||||
( 12, 39, 0.01);
|
||||
|
||||
INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`)
|
||||
VALUES
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
"Sample type cannot be blank": "Sample type cannot be blank",
|
||||
"The package cannot be blank": "The package cannot be blank",
|
||||
"The warehouse can't be repeated": "The warehouse can't be repeated",
|
||||
"The sales of that ticket can't be modified": "The sales of that ticket can't be modified",
|
||||
"The new quantity should be smaller than the old one": "The new quantity should be smaller than the old one"
|
||||
"The new quantity should be smaller than the old one": "The new quantity should be smaller than the old one",
|
||||
"Package cannot be blank": "Package cannot be blank",
|
||||
"The sales of this ticket can't be modified": "The sales of this ticket can't be modified",
|
||||
"You don't have enough privileges to do that": "You don't have enough privileges to do that"
|
||||
}
|
|
@ -1,17 +1,14 @@
|
|||
const app = require(`${servicesDir}/client/server/server`);
|
||||
const restoreFixtures = require(`${servicesDir}/db/testing_fixtures`);
|
||||
|
||||
describe('Client addressesPropagateRe', () => {
|
||||
let sqlStatements = {deletes: ``, inserts: ``, updates:
|
||||
`UPDATE vn.address SET isEqualizated = FALSE WHERE clientFk = 101;
|
||||
UPDATE vn.client SET hasToInvoiceByAddress = TRUE WHERE id = 101;`
|
||||
};
|
||||
beforeEach(() => {
|
||||
restoreFixtures(sqlStatements);
|
||||
beforeEach(async() => {
|
||||
await app.models.Address.update({clientFk: 101}, {isEqualizated: false});
|
||||
await app.models.Client.update({id: 101}, {hasToInvoiceByAddress: true});
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
restoreFixtures(sqlStatements);
|
||||
afterAll(async() => {
|
||||
await app.models.Address.update({clientFk: 101}, {isEqualizated: false});
|
||||
await app.models.Client.update({id: 101}, {hasToInvoiceByAddress: true});
|
||||
});
|
||||
|
||||
it('should propagate the isEqualizated on both addresses of Mr Wayne and set hasToInvoiceByAddress to false', async() => {
|
||||
|
|
|
@ -7,6 +7,6 @@ describe('Client card', () => {
|
|||
|
||||
expect(result.id).toEqual(101);
|
||||
expect(result.name).toEqual('Bruce Wayne');
|
||||
expect(result.debt).toEqual(1048.76);
|
||||
expect(result.debt).toEqual(972.78);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ describe('client getDebt()', () => {
|
|||
it('should return the client debt', async() => {
|
||||
let result = await app.models.Client.getDebt(101);
|
||||
|
||||
expect(result.debt).toEqual(1048.76);
|
||||
expect(result.debt).toEqual(972.78);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ describe('client getMana()', () => {
|
|||
it('should call the getMana method', async() => {
|
||||
let result = await app.models.Client.getMana(101);
|
||||
|
||||
expect(result.mana).toEqual(400);
|
||||
expect(result.mana).toEqual(151.33);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@ describe('client summary()', () => {
|
|||
it('should return a summary object containing mana', async() => {
|
||||
let result = await app.models.Client.summary(101);
|
||||
|
||||
expect(result.mana.mana).toEqual(400);
|
||||
expect(result.mana.mana).toEqual(151.33);
|
||||
});
|
||||
|
||||
it('should return a summary object containing debt', async() => {
|
||||
let result = await app.models.Client.summary(101);
|
||||
|
||||
expect(result.debt.debt).toEqual(1048.76);
|
||||
expect(result.debt.debt).toEqual(972.78);
|
||||
});
|
||||
|
||||
it('should return a summary object containing averageInvoiced', async() => {
|
||||
|
|
|
@ -28,7 +28,7 @@ module.exports = Self => {
|
|||
|
||||
let newTicketIsEditable = await Self.app.models.Ticket.isEditable(params.newTicketFk);
|
||||
if (!newTicketIsEditable)
|
||||
throw new UserError(`The sales of that ticket can't be modified`);
|
||||
throw new UserError(`The sales of this ticket can't be modified`);
|
||||
|
||||
for (let i = 0; i < params.sales.length; i++) {
|
||||
await Self.app.models.Sale.update({id: params.sales[i].id}, {ticketFk: params.newTicketFk});
|
||||
|
|
|
@ -9,7 +9,7 @@ module.exports = Self => {
|
|||
arg: 'params',
|
||||
type: 'object',
|
||||
required: true,
|
||||
description: '[sales IDs], actualTicketFk, reserved',
|
||||
description: '[sales IDs], ticketFk, reserved',
|
||||
http: {source: 'body'}
|
||||
}],
|
||||
returns: {
|
||||
|
@ -23,7 +23,7 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.reserve = async params => {
|
||||
let thisTicketIsEditable = await Self.app.models.Ticket.isEditable(params.actualTicketFk);
|
||||
let thisTicketIsEditable = await Self.app.models.Ticket.isEditable(params.ticketFk);
|
||||
if (!thisTicketIsEditable)
|
||||
throw new UserError(`The sales of this ticket can't be modified`);
|
||||
|
||||
|
|
|
@ -22,62 +22,58 @@ describe('sale moveToTicket()', () => {
|
|||
|
||||
await app.models.Sale.moveToTicket(params)
|
||||
.catch(response => {
|
||||
expect(response.message).toEqual(`The sales of that ticket can't be modified`);
|
||||
expect(response.message).toEqual(`The sales of this ticket can't be modified`);
|
||||
error = response;
|
||||
});
|
||||
|
||||
expect(error).toBeDefined();
|
||||
});
|
||||
|
||||
it('should transfer the sales from ticket 1 to ticket 13', async() => {
|
||||
let senderTicketSales = await app.models.Ticket.getSales(1);
|
||||
it('should transfer the sales from one ticket to another', async() => {
|
||||
let senderTicketSales = await app.models.Ticket.getSales(11);
|
||||
let receiverTicketSales = await app.models.Ticket.getSales(13);
|
||||
|
||||
expect(senderTicketSales.length).toEqual(4);
|
||||
expect(senderTicketSales.length).toEqual(2);
|
||||
expect(receiverTicketSales.length).toEqual(0);
|
||||
|
||||
let params = {
|
||||
actualTicketFk: 1,
|
||||
actualTicketFk: 11,
|
||||
newTicketFk: 13,
|
||||
sales: [
|
||||
{id: 1},
|
||||
{id: 2},
|
||||
{id: 3},
|
||||
{id: 4}]
|
||||
{id: 7},
|
||||
{id: 8}]
|
||||
};
|
||||
|
||||
await app.models.Sale.moveToTicket(params);
|
||||
|
||||
senderTicketSales = await app.models.Ticket.getSales(1);
|
||||
senderTicketSales = await app.models.Ticket.getSales(11);
|
||||
receiverTicketSales = await app.models.Ticket.getSales(13);
|
||||
|
||||
expect(senderTicketSales.length).toEqual(0);
|
||||
expect(receiverTicketSales.length).toEqual(4);
|
||||
expect(receiverTicketSales.length).toEqual(2);
|
||||
});
|
||||
|
||||
it('should transfer the sales back from ticket 13 to ticket 1', async() => {
|
||||
it('should transfers back the sales', async() => {
|
||||
let senderTicketSales = await app.models.Ticket.getSales(13);
|
||||
let receiverTicketSales = await app.models.Ticket.getSales(1);
|
||||
let receiverTicketSales = await app.models.Ticket.getSales(11);
|
||||
|
||||
expect(senderTicketSales.length).toEqual(4);
|
||||
expect(senderTicketSales.length).toEqual(2);
|
||||
expect(receiverTicketSales.length).toEqual(0);
|
||||
|
||||
let params = {
|
||||
actualTicketFk: 13,
|
||||
newTicketFk: 1,
|
||||
newTicketFk: 11,
|
||||
sales: [
|
||||
{id: 1},
|
||||
{id: 2},
|
||||
{id: 3},
|
||||
{id: 4}]
|
||||
{id: 7},
|
||||
{id: 8}]
|
||||
};
|
||||
|
||||
await app.models.Sale.moveToTicket(params);
|
||||
|
||||
senderTicketSales = await app.models.Ticket.getSales(13);
|
||||
receiverTicketSales = await app.models.Ticket.getSales(1);
|
||||
receiverTicketSales = await app.models.Ticket.getSales(11);
|
||||
|
||||
expect(senderTicketSales.length).toEqual(0);
|
||||
expect(receiverTicketSales.length).toEqual(4);
|
||||
expect(receiverTicketSales.length).toEqual(2);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,8 +10,8 @@ describe('sale priceDifference()', () => {
|
|||
};
|
||||
let result = await app.models.Sale.priceDifference(1, data);
|
||||
|
||||
expect(result.totalUnitPrice).toEqual(27.4);
|
||||
expect(result.totalUnitPrice).toEqual(22.33);
|
||||
expect(result.totalNewPrice).toEqual(22.33);
|
||||
expect(result.totalDifference).toEqual(22.54);
|
||||
expect(result.totalDifference).toEqual(0);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,11 +4,9 @@ describe('sale reserve()', () => {
|
|||
afterAll(async() => {
|
||||
let params = {
|
||||
sales: [
|
||||
{id: 1},
|
||||
{id: 2},
|
||||
{id: 3},
|
||||
{id: 4}],
|
||||
ticketFk: 1,
|
||||
{id: 7},
|
||||
{id: 8}],
|
||||
ticketFk: 11,
|
||||
reserved: false
|
||||
};
|
||||
|
||||
|
@ -17,7 +15,9 @@ describe('sale reserve()', () => {
|
|||
|
||||
it('should throw an error if the ticket can not be modified', async() => {
|
||||
let error;
|
||||
let params = {actualTicketFk: 10, sales: [{id: 4, instance: 3}]};
|
||||
let params = {ticketFk: 2,
|
||||
sales: [{id: 5}],
|
||||
reserved: false};
|
||||
|
||||
await app.models.Sale.reserve(params)
|
||||
.catch(response => {
|
||||
|
@ -28,31 +28,25 @@ describe('sale reserve()', () => {
|
|||
expect(error).toBeDefined();
|
||||
});
|
||||
|
||||
it('should update the given sales of a ticket as reserved', async() => {
|
||||
originalTicketSales = await app.models.Ticket.getSales(1);
|
||||
it('should update the given sales of a ticket to reserved', async() => {
|
||||
originalTicketSales = await app.models.Ticket.getSales(11);
|
||||
|
||||
expect(originalTicketSales[0].reserved).toEqual(0);
|
||||
expect(originalTicketSales[1].reserved).toEqual(0);
|
||||
expect(originalTicketSales[2].reserved).toEqual(0);
|
||||
expect(originalTicketSales[3].reserved).toEqual(0);
|
||||
|
||||
let params = {
|
||||
sales: [
|
||||
{id: 1},
|
||||
{id: 2},
|
||||
{id: 3},
|
||||
{id: 4}],
|
||||
ticketFk: 1,
|
||||
{id: 7},
|
||||
{id: 8}],
|
||||
ticketFk: 11,
|
||||
reserved: true
|
||||
};
|
||||
|
||||
await app.models.Sale.reserve(params);
|
||||
|
||||
let reservedTicketSales = await app.models.Ticket.getSales(1);
|
||||
let reservedTicketSales = await app.models.Ticket.getSales(11);
|
||||
|
||||
expect(reservedTicketSales[0].reserved).toEqual(1);
|
||||
expect(reservedTicketSales[1].reserved).toEqual(1);
|
||||
expect(reservedTicketSales[2].reserved).toEqual(1);
|
||||
expect(reservedTicketSales[3].reserved).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,21 +1,76 @@
|
|||
const app = require(`${servicesDir}/ticket/server/server`);
|
||||
|
||||
xdescribe('ticket componentUpdate()', () => {
|
||||
it('should call the componentUpdate method and receive an error', async() => {
|
||||
describe('ticket componentUpdate()', () => {
|
||||
let firstvalueBeforeChange;
|
||||
let secondvalueBeforeChange;
|
||||
let componentOfSaleSeven = `SELECT value FROM vn.saleComponent
|
||||
WHERE saleFk = 7 AND componentFk = 15`;
|
||||
|
||||
let componentOfSaleEight = `SELECT value FROM vn.saleComponent
|
||||
WHERE saleFk = 8 AND componentFk = 15`;
|
||||
const toDay = new Date();
|
||||
|
||||
beforeAll(async() => {
|
||||
[componentValue] = await app.models.SaleComponent.rawSql(componentOfSaleSeven);
|
||||
firstvalueBeforeChange = componentValue.value;
|
||||
|
||||
[componentValue] = await app.models.SaleComponent.rawSql(componentOfSaleEight);
|
||||
secondvalueBeforeChange = componentValue.value;
|
||||
});
|
||||
|
||||
it('should change the agencyMode to modify the sale components value', async() => {
|
||||
let firstvalueAfterChange;
|
||||
let secondvalueAfterChange;
|
||||
let data = {
|
||||
clientFk: 101,
|
||||
agencyModeFk: 1,
|
||||
agencyModeFk: 8,
|
||||
addressFk: 121,
|
||||
warehouseFk: 1,
|
||||
shipped: new Date(),
|
||||
landed: new Date(),
|
||||
shipped: toDay,
|
||||
landed: toDay,
|
||||
isDeleted: false,
|
||||
hasToBeUnrouted: false,
|
||||
option: 1
|
||||
};
|
||||
let ctx = {req: {accessToken: {userId: 101}}};
|
||||
let result = await app.models.Ticket.componentUpdate(1, data, ctx);
|
||||
|
||||
expect(result.constructor.name).toEqual('OkPacket');
|
||||
let ctx = {req: {accessToken: {userId: 101}}};
|
||||
await app.models.Ticket.componentUpdate(11, data, ctx);
|
||||
|
||||
[componentValue] = await app.models.SaleComponent.rawSql(componentOfSaleSeven);
|
||||
firstvalueAfterChange = componentValue.value;
|
||||
|
||||
[componentValue] = await app.models.SaleComponent.rawSql(componentOfSaleEight);
|
||||
secondvalueAfterChange = componentValue.value;
|
||||
|
||||
expect(firstvalueBeforeChange).not.toEqual(firstvalueAfterChange);
|
||||
expect(secondvalueBeforeChange).not.toEqual(secondvalueAfterChange);
|
||||
});
|
||||
|
||||
it('should change the agencyMode to go back to the originals sale components value', async() => {
|
||||
let firstvalueAfterChange;
|
||||
let secondvalueAfterChange;
|
||||
let data = {
|
||||
clientFk: 101,
|
||||
agencyModeFk: 7,
|
||||
addressFk: 121,
|
||||
warehouseFk: 1,
|
||||
shipped: toDay,
|
||||
landed: toDay,
|
||||
isDeleted: false,
|
||||
hasToBeUnrouted: false,
|
||||
option: 1
|
||||
};
|
||||
|
||||
let ctx = {req: {accessToken: {userId: 101}}};
|
||||
await app.models.Ticket.componentUpdate(11, data, ctx);
|
||||
|
||||
[componentValue] = await app.models.SaleComponent.rawSql(componentOfSaleSeven);
|
||||
firstvalueAfterChange = componentValue.value;
|
||||
|
||||
[componentValue] = await app.models.SaleComponent.rawSql(componentOfSaleEight);
|
||||
secondvalueAfterChange = componentValue.value;
|
||||
|
||||
expect(firstvalueBeforeChange).toEqual(firstvalueAfterChange);
|
||||
expect(secondvalueBeforeChange).toEqual(secondvalueAfterChange);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ describe('ticket getSalesPersonMana()', () => {
|
|||
it('should get the mana of a salesperson of a given ticket', async() => {
|
||||
let mana = await app.models.Ticket.getSalesPersonMana(1);
|
||||
|
||||
expect(mana).toEqual(470);
|
||||
expect(mana).toEqual(221);
|
||||
});
|
||||
|
||||
it('should return 0 if the given ticket does not exists', async() => {
|
||||
|
|
|
@ -4,6 +4,6 @@ describe('ticket getTaxes()', () => {
|
|||
it('should return the tax of a given ticket', async() => {
|
||||
let result = await app.models.Ticket.getTaxes(1);
|
||||
|
||||
expect(result[0].tax).toEqual(9.29);
|
||||
expect(result[0].tax).toEqual(7.44);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ describe('ticket getTotal()', () => {
|
|||
it('should return the total of a ticket', async() => {
|
||||
let result = await app.models.Ticket.getTotal(1);
|
||||
|
||||
expect(result).toEqual(181.12);
|
||||
expect(result).toEqual(155.89);
|
||||
});
|
||||
|
||||
it(`should return zero if the ticket doesn't have lines`, async() => {
|
||||
|
|
|
@ -4,7 +4,7 @@ describe('ticket getVAT()', () => {
|
|||
it('should call the getVAT method and return the response', async() => {
|
||||
await app.models.Ticket.getVAT(1)
|
||||
.then(response => {
|
||||
expect(response).toEqual(22.98);
|
||||
expect(response).toEqual(20.29);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@ describe('ticket summary()', () => {
|
|||
it('should return a summary object containing subTotal for 1 ticket', async() => {
|
||||
let result = await app.models.Ticket.summary(1);
|
||||
|
||||
expect(result.subTotal).toEqual(158.14);
|
||||
expect(Math.round(result.subTotal * 100) / 100).toEqual(135.60);
|
||||
});
|
||||
|
||||
it('should return a summary object containing VAT for 1 ticket', async() => {
|
||||
let result = await app.models.Ticket.summary(1);
|
||||
|
||||
expect(Math.round(result.VAT * 100) / 100).toEqual(22.98);
|
||||
expect(Math.round(result.VAT * 100) / 100).toEqual(20.29);
|
||||
});
|
||||
|
||||
it('should return a summary object containing total for 1 ticket', async() => {
|
||||
|
|
|
@ -4,7 +4,7 @@ describe('workerMana getCurrentWorkerMana()', () => {
|
|||
it('should get the mana of the logged worker', async() => {
|
||||
let mana = await app.models.WorkerMana.getCurrentWorkerMana({req: {accessToken: {userId: 18}}});
|
||||
|
||||
expect(mana).toEqual(470);
|
||||
expect(mana).toEqual(221);
|
||||
});
|
||||
|
||||
it('should return 0 if the user doesnt uses mana', async() => {
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
"name": {
|
||||
"type": "String",
|
||||
"required": false
|
||||
},
|
||||
"code": {
|
||||
"type": "String",
|
||||
"required": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"dear": "Estimado cliente,",
|
||||
"bodyDescription": "Siga las intrucciones especificadas en este correo para llevar a cabo la instalación de la impresora.",
|
||||
"followGuide": "Puede utilizar como guía, el video del montaje del ribon y la cinta <a href=\"https:\//www.youtube.com/watch?v=qhb0kgQF3o8\" title=\"Youtube\" target=\"_blank\" style=\"color:#8dba25\">https://www.youtube.com/watch?v=qhb0kgQF3o8</a>. También necesitará el QLabel, el programa para imprimir las cintas.",
|
||||
"downloadFrom": "Puede descargarlo desde este enlace <a href=\"http://www.godexintl.com/en/product/type/Download/2967\" title=\"Descargar QLabel\" target=\"_blank\" style=\"color:#8dba25\">http://www.godexintl.com/en/product/type/Download/2967</a>",
|
||||
"downloadFrom": "Puede descargarlo desde este enlace <a href=\"http://ww.godexintl.com/es1/download/downloads/Download/2996\" title=\"Descargar QLabel\" target=\"_blank\" style=\"color:#8dba25\">http://ww.godexintl.com/es1/download/downloads/Download/2996</a>",
|
||||
"sectionQLabelTitle": "Utilización de QLabel",
|
||||
"sectionQLabelDescription": "Para utilizar el programa de impresión de cintas siga estos pasos:",
|
||||
"sectionQLabelStep1": "Abra el programa QLabel.",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const app = require(`${servicesDir}/order/server/server`);
|
||||
|
||||
xdescribe('order getTaxes()', () => {
|
||||
describe('order getTaxes()', () => {
|
||||
it('should call the getTaxes method and return undefined if its called with a string', async() => {
|
||||
let result = await app.models.Order.getTaxes('pepinillos');
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const app = require(`${servicesDir}/order/server/server`);
|
||||
|
||||
xdescribe('order getTotal()', () => {
|
||||
describe('order getTotal()', () => {
|
||||
it('should return the total', async() => {
|
||||
let result = await app.models.Order.getTotal(1);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"required": true
|
||||
},
|
||||
"hour": {
|
||||
"type": "Date",
|
||||
"type": "date",
|
||||
"required": true
|
||||
},
|
||||
"travelingDays": {
|
||||
|
|
Loading…
Reference in New Issue