This commit is contained in:
Bernat 2019-01-15 12:38:07 +01:00
commit b4b630118a
23 changed files with 241 additions and 70 deletions

View File

@ -10,6 +10,7 @@ services:
- ${PORT}:80
links:
- api
- mailer
api:
image: registry.verdnatura.es/salix-api:${TAG}
restart: unless-stopped
@ -19,3 +20,12 @@ services:
volumes:
- /containers/salix:/etc/salix
- /mnt/storage/pdfs:/var/lib/salix/pdfs
mailer:
image: registry.verdnatura.es/salix-mailer:${TAG}
restart: unless-stopped
build:
context: services/mailer
environment:
- NODE_ENV
volumes:
- /containers/vn-mailer:/etc/vn-mailer

View File

@ -445,6 +445,22 @@ export default {
detailsButton: `vn-left-menu a[ui-sref="claim.card.detail"]`,
addItemButton: `vn-claim-detail a vn-float-button`
},
claimDevelopment: {
developmentButton: 'vn-left-menu a[ui-sref="claim.card.development"]',
addDevelopmentButton: 'vn-claim-development > vn-vertical > vn-card > div > vn-vertical > vn-one > vn-icon-button > button > vn-icon',
firstDeleteDevelopmentButton: 'vn-claim-development > vn-vertical > vn-card > div > vn-vertical > form > vn-horizontal:nth-child(2) > vn-icon-button > button > vn-icon',
firstClaimReasonAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.claimReasonFk"]',
firstClaimResultAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.claimResultFk"]',
firstClaimResponsibleAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.claimResponsibleFk"]',
firstClaimWorkerAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.workerFk"]',
firstClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[field="claimDevelopment.claimRedeliveryFk"]',
secondClaimReasonAutocomplete: 'vn-claim-development vn-horizontal:nth-child(3) vn-autocomplete[field="claimDevelopment.claimReasonFk"]',
secondClaimResultAutocomplete: 'vn-claim-development vn-horizontal:nth-child(3) vn-autocomplete[field="claimDevelopment.claimResultFk"]',
secondClaimResponsibleAutocomplete: 'vn-claim-development vn-horizontal:nth-child(3) vn-autocomplete[field="claimDevelopment.claimResponsibleFk"]',
secondClaimWorkerAutocomplete: 'vn-claim-development vn-horizontal:nth-child(3) vn-autocomplete[field="claimDevelopment.workerFk"]',
secondClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(3) vn-autocomplete[field="claimDevelopment.claimRedeliveryFk"]',
saveDevelopmentButton: `${components.vnSubmit}`
},
ordersIndex: {
searchResult: `vn-order-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr`,
searchResultDate: `vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)`,

View File

@ -0,0 +1,123 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Claim development', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('salesAssistant', 'claim')
.accessToSearchResult('1')
.accessToSection('claim.card.development');
});
it('should delete a development and create a new one', async() => {
const result = await nightmare
.waitToClick(selectors.claimDevelopment.firstDeleteDevelopmentButton)
.waitToClick(selectors.claimDevelopment.addDevelopmentButton)
.autocompleteSearch(selectors.claimDevelopment.secondClaimReasonAutocomplete, 'Baja calidad')
.autocompleteSearch(selectors.claimDevelopment.secondClaimResultAutocomplete, 'Deshidratacion')
.autocompleteSearch(selectors.claimDevelopment.secondClaimResponsibleAutocomplete, 'Calidad general')
.autocompleteSearch(selectors.claimDevelopment.secondClaimWorkerAutocomplete, 'delivery')
.autocompleteSearch(selectors.claimDevelopment.secondClaimRedeliveryAutocomplete, 'Reparto')
.waitToClick(selectors.claimDevelopment.saveDevelopmentButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should edit a development', async() => {
const result = await nightmare
.autocompleteSearch(selectors.claimDevelopment.firstClaimReasonAutocomplete, 'Calor')
.autocompleteSearch(selectors.claimDevelopment.firstClaimResultAutocomplete, 'Cocido')
.autocompleteSearch(selectors.claimDevelopment.firstClaimResponsibleAutocomplete, 'Calidad general')
.autocompleteSearch(selectors.claimDevelopment.firstClaimWorkerAutocomplete, 'adminAssistant')
.autocompleteSearch(selectors.claimDevelopment.firstClaimRedeliveryAutocomplete, 'Cliente')
.waitToClick(selectors.claimDevelopment.saveDevelopmentButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the first development is the expected one', async() => {
const reason = await nightmare
.waitToClick(selectors.claimBasicData.basicDataButton)
.wait(selectors.claimBasicData.claimStateAutocomplete)
.click(selectors.claimDevelopment.developmentButton)
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimReasonAutocomplete} input`, 'value');
const result = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimResultAutocomplete} input`, 'value');
const responsible = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimResponsibleAutocomplete} input`, 'value');
const worker = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimWorkerAutocomplete} input`, 'value');
const redelivery = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.firstClaimRedeliveryAutocomplete} input`, 'value');
expect(reason).toEqual('Calor');
expect(result).toEqual('Cocido');
expect(responsible).toEqual('Calidad general');
expect(worker).toEqual('adminAssistant adminAssistant');
expect(redelivery).toEqual('Cliente');
});
it('should confirm the second development is the expected one', async() => {
const reason = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimReasonAutocomplete} input`, 'value');
const result = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimResultAutocomplete} input`, 'value');
const responsible = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimResponsibleAutocomplete} input`, 'value');
const worker = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimWorkerAutocomplete} input`, 'value');
const redelivery = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimRedeliveryAutocomplete} input`, 'value');
expect(reason).toEqual('Baja calidad');
expect(result).toEqual('Deshidratacion');
expect(responsible).toEqual('Calidad general');
expect(worker).toEqual('delivery delivery');
expect(redelivery).toEqual('Reparto');
});
it('should delete the first development, add an empty one and save it', async() => {
const result = await nightmare
.waitToClick(selectors.claimDevelopment.firstDeleteDevelopmentButton)
.waitToClick(selectors.claimDevelopment.addDevelopmentButton)
.waitToClick(selectors.claimDevelopment.saveDevelopmentButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the second development was auto filled', async() => {
const reason = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimReasonAutocomplete} input`, 'value');
const result = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimResultAutocomplete} input`, 'value');
const responsible = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimResponsibleAutocomplete} input`, 'value');
const worker = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimWorkerAutocomplete} input`, 'value');
const redelivery = await nightmare
.waitToGetProperty(`${selectors.claimDevelopment.secondClaimRedeliveryAutocomplete} input`, 'value');
expect(reason).toEqual('Prisas');
expect(result).toEqual('Otros daños');
expect(responsible).toEqual('Compradores');
expect(worker).toEqual('manager manager');
expect(redelivery).toEqual('Cliente');
});
});

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Order Edit basicData path', () => {
describe('Order edit basic data path', () => {
const nightmare = createNightmare();
describe('when confirmed order', () => {
beforeAll(() => {

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Ticket services path', () => {
xdescribe('Ticket services path', () => {
const nightmare = createNightmare();
beforeAll(() => {

View File

@ -11,7 +11,7 @@ export default class inputRange extends Input {
this._value = this.input.value;
this.$.$applyAsync();
if (this._value && this.onChange)
this.onChange();
this.emit('change', {value: this._value});
});
}

View File

@ -25,5 +25,6 @@
"NO_AGENCY_AVAILABLE": "NO_AGENCY_AVAILABLE",
"Warehouse cannot be blank": "Warehouse cannot be blank",
"Agency cannot be blank": "Agency cannot be blank",
"The IBAN does not have the correct format": "The IBAN does not have the correct format"
"The IBAN does not have the correct format": "The IBAN does not have the correct format",
"You can't make changes on the basic data of an confirmed order or with rows": "You can't make changes on the basic data of an confirmed order or with rows"
}

View File

@ -35,7 +35,7 @@
min="1"
step="1"
vn-acl="salesAssistant"
on-change="$ctrl.saveResponsibility()">
on-change="$ctrl.saveResponsibility(value)">
</vn-input-range>
</vn-tool-bar>
</vn-horizontal>

View File

@ -146,10 +146,10 @@ class Controller {
this.$.descriptor.show();
}
saveResponsibility() {
saveResponsibility(value) {
let query = `/claim/api/Claims/updateClaim`;
this.$http.post(query, {responsibility: this.claim.responsibility}).then(res => {
this.$http.post(query, {responsibility: value}).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
});
}

View File

@ -46,7 +46,6 @@
vn-one
vn-focus
label="Reason"
id="claimReason"
field="claimDevelopment.claimReasonFk"
data="claimReasons"
fields="['id', 'description']"
@ -56,7 +55,6 @@
<vn-autocomplete
vn-one
label="Result"
id="claimResult"
field="claimDevelopment.claimResultFk"
data="claimResults"
fields="['id', 'description']"
@ -66,7 +64,6 @@
<vn-autocomplete
vn-one
label="Responsible"
id="Responsible"
field="claimDevelopment.claimResponsibleFk"
data="claimResponsibles"
fields="['id', 'description']"
@ -88,7 +85,6 @@
<vn-autocomplete
vn-one
label="Redelivery"
id="redelivery"
field="claimDevelopment.claimRedeliveryFk"
data="claimRedeliveries"
fields="['id', 'description']"

View File

@ -30,6 +30,7 @@
<vn-one>
<vn-input-range
vn-one
disabled="true"
label="Responsability"
value="$ctrl.summary.claim.responsibility"
max="5"

View File

@ -54,6 +54,6 @@ module.exports = Self => {
await fs.access(file.path);
let stream = fs.createReadStream(file.path);
return [stream, file.contentType, `attachment; filename="${file.name}"`];
return [stream, file.contentType, `filename="${file.name}"`];
};
};

View File

@ -42,7 +42,8 @@ module.exports = Self => {
r.bankFk,
firstName,
name,
r.clientFk
r.clientFk,
FALSE pdf
FROM vn.receipt r
LEFT JOIN vn.worker w ON w.id = r.workerFk
JOIN vn.company c ON c.id = r.companyFk
@ -60,7 +61,8 @@ module.exports = Self => {
NULL,
NULL,
NULL,
i.clientFk
i.clientFk,
i.pdf
FROM vn.invoiceOut i
JOIN vn.company c ON c.id = i.companyFk
WHERE i.clientFk = ? AND i.companyFk = ?

View File

@ -2,15 +2,15 @@
"name": "Receipt",
"base": "VnModel",
"options": {
"mysql": {
"table": "receipt"
}
"mysql": {
"table": "receipt"
}
},
"properties": {
"id": {
"id": true,
"type": "Number",
"description": "Identifier"
"id": {
"id": true,
"type": "Number",
"description": "Identifier"
},
"amountPaid": {
"type": "Number"
@ -48,11 +48,11 @@
"type": "belongsTo",
"model": "Bank",
"foreignKey": "bankFk"
},
},
"invoice": {
"type": "belongsTo",
"model": "InvoiceOut",
"foreignKey": "invoiceFk"
}
}
}
}

View File

@ -6,7 +6,6 @@
data="addresses"
auto-load="true">
</vn-crud-model>
<vn-vertical>
<vn-card pad-large compact>
<vn-title vn-one>Addresses</vn-title>

View File

@ -12,7 +12,7 @@ export default class Controller {
case 'search':
return /^\d+$/.test(value)
? {id: value}
: {name: {regexp: value}};
: {name: {like: `%${value}%`}};
case 'phone':
return {
or: [
@ -23,7 +23,7 @@ export default class Controller {
case 'name':
case 'socialName':
case 'city':
return {[param]: {regexp: value}};
return {[param]: {regexp: `%${value}%`}};
case 'id':
case 'fi':
case 'postcode':

View File

@ -30,7 +30,7 @@
</vn-one>
<vn-one>
<div class="totalBox" ng-if="riskTotal.length">
<h6> Total por empresa</h6>
<h6 translate>Total by company</h6>
<vn-auto ng-repeat="riskByCompany in riskTotal">
<vn-label-value
label="{{riskByCompany.company.code}}"
@ -48,11 +48,11 @@
<vn-th>Creation date</vn-th>
<vn-th>Employee</vn-th>
<vn-th>Reference</vn-th>
<vn-th>Bank</vn-th>
<vn-th>Debit</vn-th>
<vn-th>Havings</vn-th>
<vn-th>Balance</vn-th>
<vn-th>Conciliated</vn-th>
<vn-th number>Bank</vn-th>
<vn-th number>Debit</vn-th>
<vn-th number>Havings</vn-th>
<vn-th number>Balance</vn-th>
<vn-th center>Conciliated</vn-th>
<vn-th></vn-th>
</vn-tr>
</vn-thead>
@ -61,24 +61,27 @@
<vn-td>{{::risk.payed | dateTime:'dd/MM/yyyy'}}</vn-td>
<vn-td>{{::risk.created | dateTime:'dd/MM/yyyy HH:mm'}}</vn-td>
<vn-td>{{::risk.firstName}} {{::risk.name}}</vn-td>
<vn-td>{{::risk.ref ? 'N/FRA ' + risk.ref : ''}}</vn-td>
<vn-td>{{::risk.bankFk}}</vn-td>
<vn-td>{{::risk.debit | currency:'€':2}}</vn-td>
<vn-td>{{::risk.credit | currency:'€':2}}</vn-td>
<vn-td>{{risk.balance | currency:'€':2}}</vn-td>
<vn-td style="text-align: center">
<vn-td>
<span ng-show="risk.ref" translate>BILL</span> {{::risk.ref}}
</vn-td>
<vn-td number>{{::risk.bankFk}}</vn-td>
<vn-td number>{{::risk.debit | currency:'€':2}}</vn-td>
<vn-td number>{{::risk.credit | currency:'€':2}}</vn-td>
<vn-td number>{{risk.balance | currency:'€':2}}</vn-td>
<vn-td center>
<vn-check
field="risk.isConciliate"
disabled="true">
</vn-check>
</vn-td>
<vn-td style="text-align: center">
<a ng-show="risk.ref"
href="api/InvoiceOuts/{{::risk.ref}}/download?access_token={{::$ctrl.accessToken}}">
<vn-icon
<vn-td center>
<a ng-show="risk.pdf"
target="_blank"
href="api/InvoiceOuts/{{::risk.id}}/download?access_token={{::$ctrl.accessToken}}">
<vn-icon-button
icon="cloud_download"
title="Download PDF">
</vn-icon>
</vn-icon-button>
</a>
</vn-td>
</vn-tr>
@ -94,8 +97,13 @@
</vn-pagination>
</vn-card>
</vn-vertical>
<a ui-sref="client.card.risk.create" vn-tooltip="New payment"
vn-bind="+" fixed-bottom-right>
<vn-float-button vn-acl="administrative" vn-acl-action="remove" icon="add"></vn-float-button>
<a ui-sref="client.card.risk.create"
vn-tooltip="New payment"
vn-bind="+"
fixed-bottom-right>
<vn-float-button
vn-acl="administrative"
vn-acl-action="remove"
icon="add">
</vn-float-button>
</a>

View File

@ -4,4 +4,8 @@ Bank: Caja
Debit: Debe
Conciliated: Conciliado
New payment: Añadir pago
Havings: Haber
Havings: Haber
Balance: Balance
Total by company: Total por empresa
Download PDF: Descargar PDF
BILL: N/FRA

View File

@ -232,7 +232,6 @@
{"state": "ticket.card.volume", "icon": "icon-volume"},
{"state": "ticket.card.expedition", "icon": "icon-package"},
{"state": "ticket.card.package.index", "icon": "icon-bucket"},
{"state": "ticket.card.service", "icon": "icon-services"},
{"state": "ticket.card.tracking.index", "icon": "remove_red_eye"},
{"state": "ticket.card.saleChecked", "icon": "assignment"},
{"state": "ticket.card.components", "icon": "icon-components"},

View File

@ -1,5 +1,6 @@
FROM vn-loopback:latest
FROM node:lts-slim
COPY mailer /app
RUN npm -g install pm2
COPY . /app
WORKDIR /app
CMD ["pm2-docker", "./server/server.js"]

View File

@ -1,30 +1,34 @@
require('require-yaml');
const fs = require('fs-extra');
const package = require('../package.json');
let configPath = `/config/${package.name}`;
let nginxConfigPath = '/config/nginx';
const packageJson = require('../package.json');
let configPath = `/etc/${packageJson.name}`;
let env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development';
if (env === 'development') {
configPath = `${__dirname}/config`;
nginxConfigPath = '../../nginx';
let config = require('./config/datasources.json');
let configFiles = [
`${configPath}/datasources.json`,
`${configPath}/datasources.${env}.json`
];
for (let configFile of configFiles) {
if (fs.existsSync(configFile))
Object.assign(config, require(configFile));
}
let config = require(`${configPath}/datasources.json`);
let configEnvFile = `${configPath}/datasources.${env}.json`;
let proxyConf = {};
let proxyFiles = [
'../../nginx/config.yml',
`${configPath}/config.yml`,
`${configPath}/config.${env}.yml`
];
if (fs.existsSync(configEnvFile))
Object.assign(config, require(configEnvFile));
let proxyConf = require(`${nginxConfigPath}/config.yml`);
let proxyEnvFile = `${nginxConfigPath}/config.${env}.yml`;
if (fs.existsSync(proxyEnvFile))
Object.assign(proxyConf, require(proxyEnvFile));
for (let proxyFile of proxyFiles) {
if (fs.existsSync(proxyFile))
Object.assign(proxyConf, require(proxyFile));
}
config.proxy = proxyConf;
config.package = package;
config.package = packageJson;
config.env = env;
module.exports = config;
module.exports = config;

View File

@ -31,6 +31,9 @@ http {
}
{{/services}}
location ~ ^/mailer(?:/(.*)?)$ {
proxy_pass http://127.0.0.1:{{defaultPort}}/$1$is_args$args;
}
location ~ ^/static(?:/(.*)?)$ {
proxy_pass http://127.0.0.1:{{devServerPort}}/$1$is_args$args;
}

View File

@ -14,6 +14,10 @@ server {
}
{{/services}}
location ~ ^/mailer(?:/(.*))?$ {
resolver 127.0.0.11;
proxy_pass http://mailer:{{defaultPort}}/$1$is_args$args;
}
location ~ ^/static(?:/(.*))?$ {
alias /salix/dist/$1;
autoindex on;