merge with master
gitea/salix/test This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-09-19 11:48:41 +02:00
commit 7daf2e4328
26 changed files with 186 additions and 319 deletions

View File

@ -19,7 +19,7 @@ ext install dbaeumer.vscode-eslint
You will need to install globally the following items. You will need to install globally the following items.
``` ```
# npm install -g karma-cli gulp-cli nodemon # npm install -g jest gulp-cli nodemon
``` ```
## Linux Only Prerequisites ## Linux Only Prerequisites

View File

@ -25,24 +25,24 @@ module.exports = Self => {
} }
}); });
Self.send = async(ctx, data, transaction) => { Self.send = async(ctx, data, options) => {
const accessToken = ctx.options && ctx.options.accessToken || ctx.req && ctx.req.accessToken; const accessToken = ctx.options && ctx.options.accessToken || ctx.req && ctx.req.accessToken;
const userId = accessToken.userId; const userId = accessToken.userId;
const models = Self.app.models; const models = Self.app.models;
const sender = await models.Account.findById(userId, transaction); const sender = await models.Account.findById(userId, options);
const recipient = await models.Account.findById(data.recipientFk, transaction); const recipient = await models.Account.findById(data.recipientFk, options);
await Self.create({ await Self.create({
sender: sender.name, sender: sender.name,
recipient: recipient.name, recipient: recipient.name,
message: data.message message: data.message
}, transaction); }, options);
return await models.MessageInbox.create({ return await models.MessageInbox.create({
sender: sender.name, sender: sender.name,
recipient: recipient.name, recipient: recipient.name,
finalRecipient: recipient.name, finalRecipient: recipient.name,
message: data.message message: data.message
}, transaction); }, options);
}; };
}; };

View File

@ -576,7 +576,8 @@ INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`, `icon`)
(4, 'Handmade', 1, NULL, 'icon-handmade'), (4, 'Handmade', 1, NULL, 'icon-handmade'),
(5, 'Artificial', 1, NULL, 'icon-artificial'), (5, 'Artificial', 1, NULL, 'icon-artificial'),
(6, 'Green', 1, NULL, 'icon-greenery'), (6, 'Green', 1, NULL, 'icon-greenery'),
(7, 'Accessories', 1, NULL, 'icon-accessory'); (7, 'Accessories', 1, NULL, 'icon-accessory'),
(8, 'Fruit', 1, NULL, 'icon-fruit');
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk`, `isPackaging`) INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk`, `isPackaging`)
VALUES VALUES

View File

@ -33,8 +33,8 @@ export default {
taxNumber: `${components.vnTextfield}[name="fi"]`, taxNumber: `${components.vnTextfield}[name="fi"]`,
socialName: `${components.vnTextfield}[name="socialName"]`, socialName: `${components.vnTextfield}[name="socialName"]`,
street: `${components.vnTextfield}[name="street"]`, street: `${components.vnTextfield}[name="street"]`,
postcode: `vn-autocomplete[field="$ctrl.client.postcode"]`, postcode: `${components.vnTextfield}[name="postcode"]`,
city: `vn-autocomplete[field="$ctrl.client.city"]`, city: `${components.vnTextfield}[name="city"]`,
province: `vn-autocomplete[field="$ctrl.client.provinceFk"]`, province: `vn-autocomplete[field="$ctrl.client.provinceFk"]`,
country: `vn-autocomplete[field="$ctrl.client.countryFk"]`, country: `vn-autocomplete[field="$ctrl.client.countryFk"]`,
userName: `${components.vnTextfield}[name="userName"]`, userName: `${components.vnTextfield}[name="userName"]`,
@ -65,8 +65,8 @@ export default {
equalizationTaxCheckbox: 'vn-check[label="Is equalizated"] md-checkbox', equalizationTaxCheckbox: 'vn-check[label="Is equalizated"] md-checkbox',
acceptPropagationButton: 'vn-client-fiscal-data > vn-confirm button[response=ACCEPT]', acceptPropagationButton: 'vn-client-fiscal-data > vn-confirm button[response=ACCEPT]',
addressInput: `${components.vnTextfield}[name="street"]`, addressInput: `${components.vnTextfield}[name="street"]`,
postcodeAutocomplete: `vn-autocomplete[field="$ctrl.client.postcode"]`, postcodeInput: `${components.vnTextfield}[name="postcode"]`,
cityAutocomplete: `vn-autocomplete[field="$ctrl.client.city"]`, cityInput: `${components.vnTextfield}[name="city"]`,
provinceAutocomplete: 'vn-autocomplete[field="$ctrl.client.provinceFk"]', provinceAutocomplete: 'vn-autocomplete[field="$ctrl.client.provinceFk"]',
countryAutocomplete: 'vn-autocomplete[field="$ctrl.client.countryFk"]', countryAutocomplete: 'vn-autocomplete[field="$ctrl.client.countryFk"]',
activeCheckbox: 'vn-check[label="Active"] md-checkbox', activeCheckbox: 'vn-check[label="Active"] md-checkbox',
@ -100,8 +100,8 @@ export default {
defaultCheckboxInput: 'vn-check[label="Default"] md-checkbox', defaultCheckboxInput: 'vn-check[label="Default"] md-checkbox',
consigneeInput: `${components.vnTextfield}[name="nickname"]`, consigneeInput: `${components.vnTextfield}[name="nickname"]`,
streetAddressInput: `${components.vnTextfield}[name="street"]`, streetAddressInput: `${components.vnTextfield}[name="street"]`,
postcodeAutocomplete: `vn-autocomplete[field="$ctrl.address.postalCode"]`, postcodeInput: `${components.vnTextfield}[name="postalCode"]`,
cityAutocomplete: `vn-autocomplete[field="$ctrl.address.city"]`, cityInput: `${components.vnTextfield}[name="city"]`,
provinceAutocomplete: 'vn-autocomplete[field="$ctrl.address.provinceFk"]', provinceAutocomplete: 'vn-autocomplete[field="$ctrl.address.provinceFk"]',
agencyAutocomplete: 'vn-autocomplete[field="$ctrl.address.agencyModeFk"]', agencyAutocomplete: 'vn-autocomplete[field="$ctrl.address.agencyModeFk"]',
phoneInput: `${components.vnTextfield}[name="phone"]`, phoneInput: `${components.vnTextfield}[name="phone"]`,

View File

@ -53,7 +53,10 @@ describe('Client create path', () => {
.write(selectors.createClientView.name, 'Carol Danvers') .write(selectors.createClientView.name, 'Carol Danvers')
.write(selectors.createClientView.socialName, 'AVG tax') .write(selectors.createClientView.socialName, 'AVG tax')
.write(selectors.createClientView.street, 'Many places') .write(selectors.createClientView.street, 'Many places')
.autocompleteSearch(selectors.createClientView.postcode, '46000') .autocompleteSearch(selectors.createClientView.country, 'España')
.autocompleteSearch(selectors.createClientView.province, 'Province one')
.write(selectors.createClientView.city, 'Valencia')
.write(selectors.createClientView.postcode, '46000')
.clearInput(selectors.createClientView.email) .clearInput(selectors.createClientView.email)
.write(selectors.createClientView.email, 'incorrect email format') .write(selectors.createClientView.email, 'incorrect email format')
.waitToClick(selectors.createClientView.createButton) .waitToClick(selectors.createClientView.createButton)
@ -64,7 +67,7 @@ describe('Client create path', () => {
it(`should check for autocompleted city, province and country`, async() => { it(`should check for autocompleted city, province and country`, async() => {
const clientCity = await nightmare const clientCity = await nightmare
.waitToGetProperty(`${selectors.createClientView.city} input`, 'value'); .waitToGetProperty(`${selectors.createClientView.city}`, 'value');
const clientProvince = await nightmare const clientProvince = await nightmare
.waitToGetProperty(`${selectors.createClientView.province} input`, 'value'); .waitToGetProperty(`${selectors.createClientView.province} input`, 'value');

View File

@ -67,8 +67,12 @@ describe('Client Edit fiscalData path', () => {
.write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!') .write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!')
.clearInput(selectors.clientFiscalData.addressInput) .clearInput(selectors.clientFiscalData.addressInput)
.write(selectors.clientFiscalData.addressInput, 'Somewhere edited') .write(selectors.clientFiscalData.addressInput, 'Somewhere edited')
.autocompleteSearch(selectors.clientFiscalData.cityAutocomplete, 'Valencia') .autocompleteSearch(selectors.clientFiscalData.countryAutocomplete, 'España')
.autocompleteSearch(selectors.clientFiscalData.postcodeAutocomplete, '46000') .autocompleteSearch(selectors.clientFiscalData.provinceAutocomplete, 'Province one')
.clearInput(selectors.clientFiscalData.cityInput)
.write(selectors.clientFiscalData.cityInput, 'Valencia')
.clearInput(selectors.clientFiscalData.postcodeInput)
.write(selectors.clientFiscalData.postcodeInput, '46000')
.waitToClick(selectors.clientFiscalData.activeCheckbox) .waitToClick(selectors.clientFiscalData.activeCheckbox)
.waitToClick(selectors.clientFiscalData.frozenCheckbox) .waitToClick(selectors.clientFiscalData.frozenCheckbox)
.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox) .waitToClick(selectors.clientFiscalData.hasToInvoiceCheckbox)
@ -194,14 +198,14 @@ describe('Client Edit fiscalData path', () => {
it('should confirm the postcode have been edited', async() => { it('should confirm the postcode have been edited', async() => {
const result = await nightmare const result = await nightmare
.waitToGetProperty(`${selectors.clientFiscalData.postcodeAutocomplete} input`, 'value'); .waitToGetProperty(`${selectors.clientFiscalData.postcodeInput}`, 'value');
expect(result).toContain('46000'); expect(result).toContain('46000');
}); });
it('should confirm the city have been autocompleted', async() => { it('should confirm the city have been autocompleted', async() => {
const result = await nightmare const result = await nightmare
.waitToGetProperty(`${selectors.clientFiscalData.cityAutocomplete} input`, 'value'); .waitToGetProperty(`${selectors.clientFiscalData.cityInput}`, 'value');
expect(result).toEqual('Valencia'); expect(result).toEqual('Valencia');
}); });

View File

@ -24,7 +24,11 @@ describe('Client Add address path', () => {
const result = await nightmare const result = await nightmare
.waitToClick(selectors.clientAddresses.defaultCheckboxInput) .waitToClick(selectors.clientAddresses.defaultCheckboxInput)
.clearInput(selectors.clientAddresses.streetAddressInput) .clearInput(selectors.clientAddresses.streetAddressInput)
.autocompleteSearch(selectors.clientAddresses.postcodeAutocomplete, '46000') .autocompleteSearch(selectors.clientAddresses.provinceAutocomplete, 'Province one')
.clearInput(selectors.clientAddresses.cityInput)
.write(selectors.clientAddresses.cityInput, 'Valencia')
.clearInput(selectors.clientAddresses.postcodeInput)
.write(selectors.clientAddresses.postcodeInput, '46000')
.autocompleteSearch(selectors.clientAddresses.agencyAutocomplete, 'Entanglement') .autocompleteSearch(selectors.clientAddresses.agencyAutocomplete, 'Entanglement')
.write(selectors.clientAddresses.phoneInput, '999887744') .write(selectors.clientAddresses.phoneInput, '999887744')
.write(selectors.clientAddresses.mobileInput, '999887744') .write(selectors.clientAddresses.mobileInput, '999887744')
@ -36,14 +40,14 @@ describe('Client Add address path', () => {
it('should confirm the postcode have been edited', async() => { it('should confirm the postcode have been edited', async() => {
const result = await nightmare const result = await nightmare
.waitToGetProperty(`${selectors.clientAddresses.postcodeAutocomplete} input`, 'value'); .waitToGetProperty(`${selectors.clientAddresses.postcodeInput}`, 'value');
expect(result).toContain('46000'); expect(result).toContain('46000');
}); });
it('should confirm the city have been autocompleted', async() => { it('should confirm the city have been autocompleted', async() => {
const result = await nightmare const result = await nightmare
.waitToGetProperty(`${selectors.clientAddresses.cityAutocomplete} input`, 'value'); .waitToGetProperty(`${selectors.clientAddresses.cityInput}`, 'value');
expect(result).toEqual('Valencia'); expect(result).toEqual('Valencia');
}); });

View File

@ -23,263 +23,8 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-basketadd:before { .icon-fruit:before {
content: "\e955"; content: "\e957";
}
.icon-catalog:before {
content: "\e952";
}
.icon-agency:before {
content: "\e910";
}
.icon-delivery:before {
content: "\e94a";
}
.icon-wand:before {
content: "\e954";
}
.icon-unavailable:before {
content: "\e953";
}
.icon-buscaman:before {
content: "\e951";
}
.icon-pbx:before {
content: "\e950";
}
.icon-calendar:before {
content: "\e94f";
}
.icon-linesplit:before {
content: "\e945";
}
.icon-invoices:before {
content: "\e91c";
}
.icon-pets:before {
content: "\e94e";
}
.icon-100:before {
content: "\e940";
}
.icon-accessory:before {
content: "\e90a";
}
.icon-actions:before {
content: "\e900";
}
.icon-addperson:before {
content: "\e901";
}
.icon-albaran:before {
content: "\e902";
}
.icon-apps:before {
content: "\e948";
}
.icon-artificial:before {
content: "\e903";
}
.icon-barcode:before {
content: "\e904";
}
.icon-basket:before {
content: "\e942";
}
.icon-bin:before {
content: "\e905";
}
.icon-botanical:before {
content: "\e906";
}
.icon-bucket:before {
content: "\e907";
}
.icon-claims:before {
content: "\e908";
}
.icon-clone:before {
content: "\e909";
}
.icon-columnadd:before {
content: "\e944";
}
.icon-columndelete:before {
content: "\e90f";
}
.icon-components:before {
content: "\e90b";
}
.icon-consignatarios:before {
content: "\e90d";
}
.icon-control:before {
content: "\e93f";
}
.icon-credit:before {
content: "\e90e";
}
.icon-details:before {
content: "\e911";
}
.icon-disabled:before {
content: "\e91b";
}
.icon-doc:before {
content: "\e913";
}
.icon-entry:before {
content: "\e914";
}
.icon-exit:before {
content: "\e947";
}
.icon-eye:before {
content: "\e915";
}
.icon-fiscal:before {
content: "\e912";
}
.icon-flower:before {
content: "\e916";
}
.icon-frozen:before {
content: "\e917";
}
.icon-greenery:before {
content: "\e93c";
}
.icon-greuge:before {
content: "\e918";
}
.icon-grid:before {
content: "\e919";
}
.icon-handmade:before {
content: "\e90c";
}
.icon-history:before {
content: "\e91a";
}
.icon-info:before {
content: "\e949";
}
.icon-item:before {
content: "\e941";
}
.icon-languaje:before {
content: "\e91d";
}
.icon-linedelete:before {
content: "\e946";
}
.icon-lines:before {
content: "\e91e";
}
.icon-linesprepaired:before {
content: "\e94b";
}
.icon-logout:before {
content: "\e91f";
}
.icon-mana:before {
content: "\e920";
}
.icon-mandatory:before {
content: "\e921";
}
.icon-niche:before {
content: "\e922";
}
.icon-no036:before {
content: "\e923";
}
.icon-notes:before {
content: "\e924";
}
.icon-noweb:before {
content: "\e925";
}
.icon-onlinepayment:before {
content: "\e926";
}
.icon-package:before {
content: "\e927";
}
.icon-payment:before {
content: "\e928";
}
.icon-person:before {
content: "\e929";
}
.icon-photo:before {
content: "\e92a";
}
.icon-plant:before {
content: "\e92b";
}
.icon-recovery:before {
content: "\e92d";
}
.icon-regentry:before {
content: "\e92e";
}
.icon-reserve:before {
content: "\e92f";
}
.icon-revision:before {
content: "\e94c";
}
.icon-risk:before {
content: "\e930";
}
.icon-services:before {
content: "\e94d";
}
.icon-settings:before {
content: "\e931";
}
.icon-sms:before {
content: "\e932";
}
.icon-solclaim:before {
content: "\e933";
}
.icon-solunion:before {
content: "\e934";
}
.icon-splur:before {
content: "\e935";
}
.icon-stowaway:before {
content: "\e92c";
}
.icon-supplier:before {
content: "\e936";
}
.icon-tags:before {
content: "\e937";
}
.icon-tax:before {
content: "\e938";
}
.icon-ticket:before {
content: "\e939";
}
.icon-traceability:before {
content: "\e93a";
}
.icon-transaction:before {
content: "\e93b";
}
.icon-volume:before {
content: "\e93d";
}
.icon-web:before {
content: "\e93e";
}
.icon-worker:before {
content: "\e943";
} }
.icon-deliveryprices:before { .icon-deliveryprices:before {
content: "\e956"; content: "\e956";

View File

@ -94,4 +94,5 @@
<glyph unicode="&#xe954;" glyph-name="wand" d="M829.649 565.029l-18.808-50.155-50.155-18.808 50.155-18.808 18.808-50.155 18.808 50.155 50.155 18.808-50.155 18.808-18.808 50.155zM624.849 870.139l-35.527 89.861-33.437-89.861-89.861-35.527 89.861-33.437 33.437-89.861 33.437 89.861 91.951 33.437-89.861 35.527zM969.665 819.984l-20.898 54.335-20.898-54.335-52.245-20.898 52.245-20.898 20.898-52.245 20.898 52.245 54.335 20.898-54.335 20.898zM783.673 648.62l-71.053 71.053c-4.18 4.18-8.359 4.18-12.539 4.18s-8.359-2.090-12.539-4.18l-681.273-681.273c0 0 0 0 0 0v0c-6.269-6.269-6.269-18.808 0-25.078l71.053-71.053c6.269-6.269 16.718-6.269 22.988 0v0c0 0 0 0 0 0l683.363 683.363c6.269 6.269 6.269 16.718 0 22.988zM626.939 506.514l-56.424 56.424 129.567 129.567 56.424-56.424-129.567-129.567z" /> <glyph unicode="&#xe954;" glyph-name="wand" d="M829.649 565.029l-18.808-50.155-50.155-18.808 50.155-18.808 18.808-50.155 18.808 50.155 50.155 18.808-50.155 18.808-18.808 50.155zM624.849 870.139l-35.527 89.861-33.437-89.861-89.861-35.527 89.861-33.437 33.437-89.861 33.437 89.861 91.951 33.437-89.861 35.527zM969.665 819.984l-20.898 54.335-20.898-54.335-52.245-20.898 52.245-20.898 20.898-52.245 20.898 52.245 54.335 20.898-54.335 20.898zM783.673 648.62l-71.053 71.053c-4.18 4.18-8.359 4.18-12.539 4.18s-8.359-2.090-12.539-4.18l-681.273-681.273c0 0 0 0 0 0v0c-6.269-6.269-6.269-18.808 0-25.078l71.053-71.053c6.269-6.269 16.718-6.269 22.988 0v0c0 0 0 0 0 0l683.363 683.363c6.269 6.269 6.269 16.718 0 22.988zM626.939 506.514l-56.424 56.424 129.567 129.567 56.424-56.424-129.567-129.567z" />
<glyph unicode="&#xe955;" glyph-name="basketadd" d="M515.2 512c-16 0-28.8-12.8-28.8-28.8v-83.2c16 22.4 35.2 41.6 57.6 60.8v22.4c0 16-12.8 28.8-28.8 28.8zM416 185.6h-259.2l-44.8 348.8h566.4c32 9.6 64 16 99.2 16 16 0 32 0 48-3.2 3.2 3.2 6.4 9.6 6.4 16v64c0 16-12.8 28.8-32 32h-140.8l-115.2 227.2c6.4 6.4 6.4 19.2 6.4 28.8-6.4 32-35.2 54.4-64 48-32-6.4-54.4-32-48-64s35.2-54.4 64-48l89.6-198.4h-355.2l89.6 198.4c32-6.4 60.8 19.2 64 48s-19.2 57.6-48 64c-32 6.4-60.8-19.2-64-48 0-9.6 3.2-19.2 6.4-28.8l-115.2-233.6h-140.8c-16 0-28.8-12.8-28.8-28.8v-64c0-16 12.8-28.8 28.8-28.8h22.4l51.2-377.6c3.2-12.8 16-22.4 28.8-22.4h288c-3.2 16-3.2 35.2-3.2 54.4zM416 512c-16 0-28.8-12.8-28.8-28.8v-259.2c0-16 12.8-28.8 28.8-28.8 0 0 0 0 0 0 0 44.8 9.6 89.6 28.8 131.2v160c0 12.8-12.8 25.6-28.8 25.6zM198.4 508.8c-16-3.2-25.6-16-25.6-32l16-262.4c0-12.8 12.8-25.6 25.6-22.4h3.2c16 3.2 25.6 16 25.6 32l-12.8 259.2c-3.2 12.8-19.2 25.6-32 25.6zM284.8 483.2v-262.4c0-19.2 12.8-28.8 28.8-28.8s28.8 12.8 28.8 28.8v262.4c0 16-12.8 28.8-28.8 28.8s-28.8-12.8-28.8-28.8zM1024 243.2v-121.6h-185.6v-185.6h-121.6v185.6h-185.6v121.6h185.6v185.6h121.6v-185.6z" /> <glyph unicode="&#xe955;" glyph-name="basketadd" d="M515.2 512c-16 0-28.8-12.8-28.8-28.8v-83.2c16 22.4 35.2 41.6 57.6 60.8v22.4c0 16-12.8 28.8-28.8 28.8zM416 185.6h-259.2l-44.8 348.8h566.4c32 9.6 64 16 99.2 16 16 0 32 0 48-3.2 3.2 3.2 6.4 9.6 6.4 16v64c0 16-12.8 28.8-32 32h-140.8l-115.2 227.2c6.4 6.4 6.4 19.2 6.4 28.8-6.4 32-35.2 54.4-64 48-32-6.4-54.4-32-48-64s35.2-54.4 64-48l89.6-198.4h-355.2l89.6 198.4c32-6.4 60.8 19.2 64 48s-19.2 57.6-48 64c-32 6.4-60.8-19.2-64-48 0-9.6 3.2-19.2 6.4-28.8l-115.2-233.6h-140.8c-16 0-28.8-12.8-28.8-28.8v-64c0-16 12.8-28.8 28.8-28.8h22.4l51.2-377.6c3.2-12.8 16-22.4 28.8-22.4h288c-3.2 16-3.2 35.2-3.2 54.4zM416 512c-16 0-28.8-12.8-28.8-28.8v-259.2c0-16 12.8-28.8 28.8-28.8 0 0 0 0 0 0 0 44.8 9.6 89.6 28.8 131.2v160c0 12.8-12.8 25.6-28.8 25.6zM198.4 508.8c-16-3.2-25.6-16-25.6-32l16-262.4c0-12.8 12.8-25.6 25.6-22.4h3.2c16 3.2 25.6 16 25.6 32l-12.8 259.2c-3.2 12.8-19.2 25.6-32 25.6zM284.8 483.2v-262.4c0-19.2 12.8-28.8 28.8-28.8s28.8 12.8 28.8 28.8v262.4c0 16-12.8 28.8-28.8 28.8s-28.8-12.8-28.8-28.8zM1024 243.2v-121.6h-185.6v-185.6h-121.6v185.6h-185.6v121.6h185.6v185.6h121.6v-185.6z" />
<glyph unicode="&#xe956;" glyph-name="deliveryprices" d="M789.333 264.533c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4 102.4 46.933 102.4 102.4c0 59.733-46.933 102.4-102.4 102.4zM789.333 110.933c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2 51.2-21.333 51.2-51.2c0-25.6-25.6-51.2-51.2-51.2zM251.733 264.533c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4 102.4 46.933 102.4 102.4c0 59.733-46.933 102.4-102.4 102.4zM251.733 110.933c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2 51.2-21.333 51.2-51.2c0-25.6-25.6-51.2-51.2-51.2zM1006.933 537.6l-196.267 192c-12.8 12.8-29.867 17.067-46.933 17.067h-98.133v38.4c0 25.6-21.333 51.2-51.2 51.2h-563.2c-29.867 0-51.2-21.333-51.2-51.2v-554.667c0-29.867 25.6-51.2 51.2-51.2h68.267c8.533 64 64 115.2 132.267 115.2 64 0 123.733-51.2 132.267-115.2h268.8c8.533 64 64 115.2 132.267 115.2s128-51.2 136.533-115.2h51.2c29.867 0 51.2 25.6 51.2 51.2v260.267c0 17.067-8.533 34.133-17.067 46.933zM392.533 605.867v-38.4h-170.667c0-8.533 0-12.8 0-17.067s0-12.8 0-17.067h170.667v-42.667h-157.867c12.8-25.6 25.6-42.667 51.2-59.733 21.333-12.8 46.933-21.333 76.8-21.333 42.667 0 76.8 17.067 102.4 46.933l46.933-42.667c-17.067-21.333-38.4-38.4-68.267-46.933-25.6-12.8-55.467-17.067-89.6-17.067s-64 4.267-89.6 17.067c-25.6 12.8-51.2 29.867-68.267 51.2s-29.867 42.667-38.4 72.533h-64v38.4h55.467c0 4.267 0 8.533 0 17.067s0 12.8 0 17.067h-55.467v42.667h64c8.533 29.867 21.333 51.2 38.4 76.8s42.667 38.4 68.267 51.2c29.867 8.533 59.733 12.8 93.867 12.8 29.867 0 59.733-4.267 89.6-17.067 25.6-8.533 46.933-25.6 64-46.933l-46.933-42.667c-29.867 29.867-64 46.933-102.4 46.933-29.867 0-55.467-8.533-76.8-21.333-25.6-17.067-42.667-34.133-51.2-59.733h157.867zM921.6 529.067h-187.733c-8.533 0-8.533 4.267-8.533 8.533v145.067c0 4.267 4.267 8.533 8.533 8.533h34.133c0 0 4.267 0 4.267-4.267l153.6-145.067c4.267 0 0-12.8-4.267-12.8z" /> <glyph unicode="&#xe956;" glyph-name="deliveryprices" d="M789.333 264.533c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4 102.4 46.933 102.4 102.4c0 59.733-46.933 102.4-102.4 102.4zM789.333 110.933c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2 51.2-21.333 51.2-51.2c0-25.6-25.6-51.2-51.2-51.2zM251.733 264.533c-55.467 0-102.4-46.933-102.4-102.4s46.933-102.4 102.4-102.4 102.4 46.933 102.4 102.4c0 59.733-46.933 102.4-102.4 102.4zM251.733 110.933c-29.867 0-51.2 21.333-51.2 51.2s21.333 51.2 51.2 51.2 51.2-21.333 51.2-51.2c0-25.6-25.6-51.2-51.2-51.2zM1006.933 537.6l-196.267 192c-12.8 12.8-29.867 17.067-46.933 17.067h-98.133v38.4c0 25.6-21.333 51.2-51.2 51.2h-563.2c-29.867 0-51.2-21.333-51.2-51.2v-554.667c0-29.867 25.6-51.2 51.2-51.2h68.267c8.533 64 64 115.2 132.267 115.2 64 0 123.733-51.2 132.267-115.2h268.8c8.533 64 64 115.2 132.267 115.2s128-51.2 136.533-115.2h51.2c29.867 0 51.2 25.6 51.2 51.2v260.267c0 17.067-8.533 34.133-17.067 46.933zM392.533 605.867v-38.4h-170.667c0-8.533 0-12.8 0-17.067s0-12.8 0-17.067h170.667v-42.667h-157.867c12.8-25.6 25.6-42.667 51.2-59.733 21.333-12.8 46.933-21.333 76.8-21.333 42.667 0 76.8 17.067 102.4 46.933l46.933-42.667c-17.067-21.333-38.4-38.4-68.267-46.933-25.6-12.8-55.467-17.067-89.6-17.067s-64 4.267-89.6 17.067c-25.6 12.8-51.2 29.867-68.267 51.2s-29.867 42.667-38.4 72.533h-64v38.4h55.467c0 4.267 0 8.533 0 17.067s0 12.8 0 17.067h-55.467v42.667h64c8.533 29.867 21.333 51.2 38.4 76.8s42.667 38.4 68.267 51.2c29.867 8.533 59.733 12.8 93.867 12.8 29.867 0 59.733-4.267 89.6-17.067 25.6-8.533 46.933-25.6 64-46.933l-46.933-42.667c-29.867 29.867-64 46.933-102.4 46.933-29.867 0-55.467-8.533-76.8-21.333-25.6-17.067-42.667-34.133-51.2-59.733h157.867zM921.6 529.067h-187.733c-8.533 0-8.533 4.267-8.533 8.533v145.067c0 4.267 4.267 8.533 8.533 8.533h34.133c0 0 4.267 0 4.267-4.267l153.6-145.067c4.267 0 0-12.8-4.267-12.8z" />
<glyph unicode="&#xe957;" glyph-name="fruit" d="M870.4 814.933c-204.8 196.267-529.067 192-725.333-8.533-196.267-204.8-192-529.067 8.533-725.333s524.8-192 725.333 12.8c196.267 200.533 192 524.8-8.533 721.067zM840.533 128c-174.933-179.2-465.067-183.467-644.267-8.533s-179.2 465.067-4.267 644.267 465.067 183.467 644.267 8.533c179.2-174.933 179.2-460.8 4.267-644.267zM145.067 366.933c-38.4 51.2-4.267 149.333 8.533 162.133 29.867 17.067 157.867-25.6 183.467-38.4s98.133-29.867 98.133-55.467c0-29.867-64-46.933-119.467-55.467-59.733-12.8-153.6-38.4-170.667-12.8zM256 170.667c-59.733 17.067-89.6 102.4-85.333 119.467 12.8 29.867 136.533 68.267 162.133 76.8 25.6 4.267 93.867 34.133 106.667 12.8 17.067-25.6-29.867-64-64-106.667-38.4-46.933-89.6-115.2-119.467-102.4zM405.333 622.933c-25.6 51.2-72.533 128-51.2 153.6 38.4 51.2 132.267 51.2 145.067 38.4 25.6-21.333 17.067-157.867 12.8-183.467s0-102.4-25.6-106.667c-29.867-8.533-55.467 46.933-81.067 98.133zM537.6 648.533c8.533 59.733 8.533 149.333 42.667 162.133 59.733 21.333 140.8-29.867 149.333-51.2 8.533-34.133-72.533-145.067-93.867-166.4s-59.733-85.333-85.333-76.8c-29.867 12.8-17.067 76.8-12.8 132.267zM494.933 217.6c-8.533-51.2-12.8-128-38.4-136.533-51.2-17.067-119.467 25.6-123.733 42.667-8.533 29.867 68.267 123.733 85.333 140.8s51.2 72.533 72.533 64c21.333-4.267 8.533-59.733 4.267-110.933zM320 516.267c-55.467 25.6-136.533 51.2-136.533 85.333 0 64 68.267 123.733 85.333 123.733 34.133 0 110.933-110.933 128-132.267 12.8-25.6 64-76.8 46.933-98.133-17.067-29.867-72.533 0-123.733 21.333zM887.467 482.133c38.4-51.2 8.533-149.333-17.067-162.133-29.867-17.067-145.067 38.4-170.667 46.933-25.6 12.8-98.133 29.867-98.133 55.467 0 29.867 64 38.4 123.733 51.2 55.467 8.533 140.8 34.133 162.133 8.533zM785.067 686.933c55.467-17.067 89.6-98.133 85.333-115.2-8.533-29.867-132.267-64-157.867-72.533-25.6-4.267-89.6-29.867-102.4-12.8-17.067 25.6 25.6 64 64 102.4 29.867 42.667 76.8 106.667 110.933 98.133zM725.333 328.533c51.2-17.067 102.4-46.933 102.4-76.8-4.267-51.2-64-115.2-98.133-115.2-29.867 0-89.6 106.667-102.4 132.267-12.8 21.333-51.2 76.8-34.133 98.133s76.8-17.067 132.267-38.4zM610.133 238.933c21.333-46.933 59.733-110.933 38.4-132.267-34.133-42.667-115.2-42.667-128-29.867-21.333 17.067-8.533 136.533-4.267 157.867 4.267 25.6 4.267 89.6 25.6 93.867 29.867 4.267 46.933-46.933 68.267-89.6z" />
</font></defs></svg> </font></defs></svg>

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Binary file not shown.

View File

@ -16,7 +16,7 @@ server {
listen [::]:80 default_server; listen [::]:80 default_server;
server_name _; server_name _;
autoindex off; autoindex off;
client_max_body_size 50M; client_max_body_size 250M;
root /salix/dist; root /salix/dist;
error_page 404 = @notfound; error_page 404 = @notfound;

View File

@ -53,5 +53,7 @@
"Ticket id cannot be blank": "Ticket id cannot be blank", "Ticket id cannot be blank": "Ticket id cannot be blank",
"Weekday cannot be blank": "Weekday cannot be blank", "Weekday cannot be blank": "Weekday cannot be blank",
"This ticket can not be modified": "This ticket can not be modified", "This ticket can not be modified": "This ticket can not be modified",
"You can't delete a confirmed order": "You can't delete a confirmed order" "You can't delete a confirmed order": "You can't delete a confirmed order",
"Value has an invalid format": "Value has an invalid format",
"The postcode doesn't exists. Ensure you put the correct format": "The postcode doesn't exists. Ensure you put the correct format"
} }

View File

@ -101,5 +101,11 @@
"This ticket is already on weekly tickets": "Este ticket ya está en tickets programados", "This ticket is already on weekly tickets": "Este ticket ya está en tickets programados",
"Ticket id cannot be blank": "El id de ticket no puede quedar en blanco", "Ticket id cannot be blank": "El id de ticket no puede quedar en blanco",
"Weekday cannot be blank": "El día de la semana no puede quedar en blanco", "Weekday cannot be blank": "El día de la semana no puede quedar en blanco",
"You can't delete a confirmed order": "No puedes borrar un pedido confirmado" "You can't delete a confirmed order": "No puedes borrar un pedido confirmado",
"Can't create stowaway for this ticket": "No se puede crear un polizon para este ticket",
"The socialName has an invalid format": "El nombre fiscal tiene un formato incorrecto",
"Invalid quantity": "Cantidad invalida",
"This postal code is not valid": "This postal code is not valid",
"is invalid": "is invalid",
"The postcode doesn't exists. Ensure you put the correct format": "El código postal no existe. Asegúrate de ponerlo con el formato correcto"
} }

View File

@ -20,7 +20,7 @@
"connector": "loopback-component-storage", "connector": "loopback-component-storage",
"provider": "filesystem", "provider": "filesystem",
"root": "./e2e/dms", "root": "./e2e/dms",
"maxFileSize": "52428800", "maxFileSize": "262144000",
"allowedContentTypes": [ "allowedContentTypes": [
"application/x-7z-compressed", "application/x-7z-compressed",
"application/x-zip-compressed", "application/x-zip-compressed",

View File

@ -22,17 +22,17 @@ module.exports = Self => {
const models = Self.app.models; const models = Self.app.models;
const resolvedState = 3; const resolvedState = 3;
let tx = await Self.beginTransaction({});
try {
let options = {transaction: tx};
const claimEnds = await models.ClaimEnd.find({ const claimEnds = await models.ClaimEnd.find({
include: { include: {
relation: 'claimDestination', relation: 'claimDestination',
fields: ['addressFk'] fields: ['addressFk']
}, },
where: {claimFk: params.claimFk} where: {claimFk: params.claimFk}
}); }, options);
let tx = await Self.beginTransaction({});
try {
let options = {transaction: tx};
for (let i = 0; i < claimEnds.length; i++) { for (let i = 0; i < claimEnds.length; i++) {
const claimEnd = claimEnds[i]; const claimEnd = claimEnds[i];
@ -42,7 +42,7 @@ module.exports = Self => {
if (!addressFk) if (!addressFk)
continue; continue;
let sale = await getSale(claimEnd.saleFk); let sale = await getSale(claimEnd.saleFk, options);
let ticketFk = await getTicketId({ let ticketFk = await getTicketId({
addressFk: addressFk, addressFk: addressFk,
companyFk: sale.ticket().companyFk, companyFk: sale.ticket().companyFk,
@ -51,7 +51,7 @@ module.exports = Self => {
let address = await models.Address.findOne({ let address = await models.Address.findOne({
where: {id: addressFk} where: {id: addressFk}
}); }, options);
if (!ticketFk) { if (!ticketFk) {
ticketFk = await createTicket(ctx, { ticketFk = await createTicket(ctx, {
@ -84,7 +84,7 @@ module.exports = Self => {
} }
} }
let claim = await Self.findById(params.claimFk); let claim = await Self.findById(params.claimFk, null, options);
claim = await claim.updateAttributes({ claim = await claim.updateAttributes({
claimStateFk: resolvedState claimStateFk: resolvedState
}, options); }, options);
@ -98,7 +98,7 @@ module.exports = Self => {
} }
}; };
async function getSale(saleFk) { async function getSale(saleFk, options) {
return await Self.app.models.Sale.findOne({ return await Self.app.models.Sale.findOne({
include: [ include: [
{ {
@ -116,7 +116,7 @@ module.exports = Self => {
} }
}], }],
where: {id: saleFk} where: {id: saleFk}
}); }, options);
} }
async function getTicketId(params, options) { async function getTicketId(params, options) {

View File

@ -30,10 +30,11 @@ module.exports = Self => {
JOIN vn.ticketState ts ON t.id = ts.ticketFk JOIN vn.ticketState ts ON t.id = ts.ticketFk
JOIN vn.agencyMode a ON t.agencyModeFk = a.id JOIN vn.agencyMode a ON t.agencyModeFk = a.id
JOIN vn.warehouse w ON t.warehouseFk = w.id JOIN vn.warehouse w ON t.warehouseFk = w.id
WHERE t.shipped >= CURDATE() AND t.clientFk = ? AND ts.alertLevel = 0 AND t.id <> ? WHERE t.shipped >= CURDATE() AND t.clientFk = ?
AND ts.alertLevel = 0 AND t.id <> ?
ORDER BY t.shipped ORDER BY t.shipped
LIMIT 3`; LIMIT 5`;
let tickets = await Self.rawSql(query, [params.clientFk, params.ticketFk]);
return Self.rawSql(query, [id, ticketId]); return tickets;
}; };
}; };

View File

@ -42,6 +42,21 @@ module.exports = Self => {
next(); next();
}); });
Self.validateAsync('postalCode', hasValidPostcode, {
message: `The postcode doesn't exists. Ensure you put the correct format`
});
async function hasValidPostcode(err, done) {
if (!this.postalCode)
return done();
const models = Self.app.models;
const postcode = await models.Postcode.findById(this.postalCode);
if (!postcode) err();
done();
}
// Helpers // Helpers
Self.observe('before save', async function(ctx) { Self.observe('before save', async function(ctx) {

View File

@ -108,6 +108,8 @@ module.exports = Self => {
}); });
function cannotHaveET(err) { function cannotHaveET(err) {
if (!this.fi) return;
let tin = this.fi.toUpperCase(); let tin = this.fi.toUpperCase();
let cannotHaveET = /^[A-B]/.test(tin); let cannotHaveET = /^[A-B]/.test(tin);
@ -150,6 +152,31 @@ module.exports = Self => {
done(); done();
} }
Self.validateBinded('socialName', isAlpha, {
message: 'The socialName has an invalid format'
});
function isAlpha(value) {
const regexp = new RegExp(/^[a-zA-Z\s]*$/);
return regexp.test(value);
}
Self.validateAsync('postCode', hasValidPostcode, {
message: `The postcode doesn't exists. Ensure you put the correct format`
});
async function hasValidPostcode(err, done) {
if (!this.postcode)
return done();
const models = Self.app.models;
const postcode = await models.Postcode.findById(this.postcode);
if (!postcode) err();
done();
}
Self.observe('before save', async function(ctx) { Self.observe('before save', async function(ctx) {
let changes = ctx.data || ctx.instance; let changes = ctx.data || ctx.instance;
let orgData = ctx.currentInstance; let orgData = ctx.currentInstance;
@ -199,9 +226,9 @@ module.exports = Self => {
if (payMethodChanged || ibanChanged || dueDayChanged) { if (payMethodChanged || ibanChanged || dueDayChanged) {
const message = `La forma de pago del cliente con id ${instance.id} ha cambiado`; const message = `La forma de pago del cliente con id ${instance.id} ha cambiado`;
const salesPersonFk = instance.salesPersonFk; const salesPersonFk = instance.salesPersonFk;
const salesPerson = await Self.app.models.Worker.findById(salesPersonFk);
if (salesPerson) { if (salesPersonFk) {
const salesPerson = await Self.app.models.Worker.findById(salesPersonFk);
await Self.app.models.Message.send(ctx, { await Self.app.models.Message.send(ctx, {
recipientFk: salesPerson.userFk, recipientFk: salesPerson.userFk,
message: message message: message

View File

@ -31,7 +31,11 @@
value-field="id" value-field="id"
label="Province"> label="Province">
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete vn-id="town" vn-one <vn-textfield vn-one
label="City"
field="$ctrl.address.city">
</vn-textfield>
<!-- <vn-autocomplete vn-id="town" vn-one
label="City" label="City"
url="/api/Towns" url="/api/Towns"
fields="['id', 'name']" fields="['id', 'name']"
@ -55,12 +59,16 @@
{{code}}, {{town.name}} - {{town.province.name}} {{code}}, {{town.name}} - {{town.province.name}}
({{town.province.country.country}}) ({{town.province.country.country}})
</tpl-item> </tpl-item>
</vn-autocomplete> </vn-autocomplete> -->
<vn-icon-button vn-auto margin-medium-v <vn-textfield vn-one
label="Postcode"
field="$ctrl.address.postalCode">
</vn-textfield>
<!-- <vn-icon-button vn-auto margin-medium-v
icon="add_circle" icon="add_circle"
vn-tooltip="New postcode" vn-tooltip="New postcode"
ng-click="postcode.open()"> ng-click="postcode.open()">
</vn-icon-button> </vn-icon-button> -->
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete <vn-autocomplete

View File

@ -47,7 +47,11 @@
value-field="id" value-field="id"
label="Province"> label="Province">
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete vn-id="town" vn-one <vn-textfield vn-one
label="City"
field="$ctrl.address.city">
</vn-textfield>
<!-- <vn-autocomplete vn-id="town" vn-one
label="City" label="City"
url="/api/Towns" url="/api/Towns"
fields="['id', 'name']" fields="['id', 'name']"
@ -66,12 +70,16 @@
show-field="code" show-field="code"
value-field="code" value-field="code"
label="Postcode"> label="Postcode">
</vn-autocomplete> </vn-autocomplete> -->
<vn-icon-button vn-auto margin-medium-v <vn-textfield vn-one
label="Postcode"
field="$ctrl.address.postalCode">
</vn-textfield>
<!-- <vn-icon-button vn-auto margin-medium-v
icon="add_circle" icon="add_circle"
vn-tooltip="New postcode" vn-tooltip="New postcode"
ng-click="postcode.open()"> ng-click="postcode.open()">
</vn-icon-button> </vn-icon-button> -->
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete vn-one <vn-autocomplete vn-one

View File

@ -28,7 +28,7 @@
ng-if="$ctrl.isDefaultAddress(address)"> ng-if="$ctrl.isDefaultAddress(address)">
</vn-icon-button> </vn-icon-button>
<vn-icon-button <vn-icon-button
ng-if="!address.isActive" ng-if="!address.isActive && !$ctrl.isDefaultAddress(address)"
icon="star_border" icon="star_border"
vn-tooltip="Active first to set as default"> vn-tooltip="Active first to set as default">
</vn-icon-button> </vn-icon-button>

View File

@ -50,7 +50,11 @@
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete vn-id="town" vn-one <vn-textfield vn-one
label="City"
field="$ctrl.client.city">
</vn-textfield>
<!-- <vn-autocomplete vn-id="town" vn-one
label="City" label="City"
url="/api/Towns" url="/api/Towns"
fields="['id', 'name']" fields="['id', 'name']"
@ -58,13 +62,17 @@
show-field="name" show-field="name"
value-field="name" value-field="name"
field="$ctrl.client.city"> field="$ctrl.client.city">
</vn-autocomplete> </vn-autocomplete> -->
<vn-icon-button vn-auto margin-medium-v <!-- <vn-icon-button vn-auto margin-medium-v
icon="add_circle" icon="add_circle"
vn-tooltip="New postcode" vn-tooltip="New postcode"
ng-click="postcode.open()"> ng-click="postcode.open()">
</vn-icon-button> </vn-icon-button> -->
<vn-autocomplete vn-one <vn-textfield vn-one
label="Postcode"
field="$ctrl.client.postcode">
</vn-textfield>
<!-- <vn-autocomplete vn-one
url="/api/Postcodes/location" url="/api/Postcodes/location"
fields="['code', 'townFk']" fields="['code', 'townFk']"
field="$ctrl.client.postcode" field="$ctrl.client.postcode"
@ -79,7 +87,7 @@
{{code}}, {{town.name}} - {{town.province.name}} {{code}}, {{town.name}} - {{town.province.name}}
({{town.province.country.country}}) ({{town.province.country.country}})
</tpl-item> </tpl-item>
</vn-autocomplete> </vn-autocomplete> -->
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield

View File

@ -45,7 +45,15 @@
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete vn-id="town" vn-one <vn-textfield vn-one
label="City"
field="$ctrl.client.city">
</vn-textfield>
<vn-textfield vn-one
label="Postcode"
field="$ctrl.client.postcode">
</vn-textfield>
<!-- <vn-autocomplete vn-id="town" vn-one
label="City" label="City"
url="/api/Towns" url="/api/Towns"
fields="['id', 'name']" fields="['id', 'name']"
@ -64,7 +72,7 @@
show-field="code" show-field="code"
value-field="code" value-field="code"
label="Postcode"> label="Postcode">
</vn-autocomplete> </vn-autocomplete> -->
</vn-horizontal> </vn-horizontal>
<vn-horizontal pad-small-v> <vn-horizontal pad-small-v>
<vn-check <vn-check

View File

@ -8,6 +8,7 @@ Enter a new search: Introduce una nueva búsqueda
Plant: Planta Plant: Planta
Flower: Flor Flower: Flor
Handmade: Confección Handmade: Confección
Fruit: Fruta
Green: Verde Green: Verde
Lines: Lineas Lines: Lineas
Accessories: Complemento Accessories: Complemento

View File

@ -243,6 +243,31 @@ class Controller {
}); });
} }
/*
* Gets a zone from an agency
*/
onChangeWarehouse(warehouseId) {
let params = {
landed: this.ticket.landed,
addressFk: this.ticket.addressFk,
agencyModeFk: this.ticket.agencyModeFk,
warehouseFk: warehouseId
};
this.ticket.zoneFk = null;
let query = `/api/Agencies/getShipped`;
this.$http.get(query, {params}).then(res => {
if (res.data)
this.ticket.zoneFk = res.data.id;
if (!res.data) {
this.vnApp.showMessage(
this.$translate.instant('No delivery zone available for this parameters')
);
}
});
}
async onStepChange() { async onStepChange() {
if (this.isFormInvalid()) { if (this.isFormInvalid()) {
return this.vnApp.showError( return this.vnApp.showError(