This commit is contained in:
Vicente Falco 2017-11-09 07:34:17 +01:00
commit 14820fbb3e
21 changed files with 121 additions and 93 deletions

5
Jenkinsfile vendored
View File

@ -34,6 +34,11 @@ node
stage ("docker")
{
stage ("install modules loopback service")
{
sh "cd ./services/loopback && npm install"
}
stage ("Stopping/Removing Docker")
{
sh "docker-compose down --rmi all"

View File

@ -11,10 +11,10 @@
<vn-title>Fiscal data</vn-title>
<vn-horizontal>
<vn-one>
<vn-check label="Facturar" field="$ctrl.client.hasToInvoice"></vn-check>
<vn-check label="Has to invoice" field="$ctrl.client.hasToInvoice"></vn-check>
</vn-one>
<vn-one>
<vn-check label="Factura impresa" field="$ctrl.client.invoiceByEmail"></vn-check>
<vn-check label="Invoice by mail" field="$ctrl.client.invoiceByEmail"></vn-check>
</vn-one>
</vn-horizontal>
<vn-horizontal>
@ -37,7 +37,7 @@
url="/client/api/Countries"
show-field="name"
value-field="id"
label="País">
label="CountryFk">
</vn-autocomplete>
</vn-horizontal>
</vn-vertical>

View File

@ -1,5 +1,8 @@
{
"Client": "Cliente",
"Clients": "Clientes",
"Fiscal data": "Datos Fiscales"
"Fiscal data": "Datos Fiscales",
"Has to invoice": "Factura",
"Invoice by mail": "Factura impresa",
"CountryFk": "País"
}

View File

@ -1,6 +1,7 @@
<paging
page="$ctrl.currentPage"
page-size="$ctrl.numPerPage"
ng-if="$ctrl.numPages>1"
total="$ctrl.numItems"
show-prev-next="true"
show-first-last="false"

View File

@ -138,7 +138,6 @@ export default class ProductionIndex {
this.hourItems.push({id: i, name: hour});
}
this.filter.warehouseFk = this.$.displayValue = this.userProfile.warehouseId;
// this.searchTickets(this.filter);
}
}

View File

@ -4,7 +4,7 @@ export class ProductionTable {
constructor($filter) {
this.$filter = $filter;
this._tickets = [];
this.itemsDisplayedInList = 14;
this.itemsDisplayedInList = 16;
this._checkAll = 0;
this.pageTable = {
filter: {

View File

@ -87,6 +87,8 @@ services:
- "80"
ports:
- "80:80"
depends_on:
- route
links:
- "${BRANCH_NAME}-auth:auth"
- "${BRANCH_NAME}-salix:salix"

View File

@ -13,5 +13,6 @@ export default {
vnItemClient: 'vn-item-client',
vnFloatButton: 'vn-float-button > button',
vnMenuItem: 'vn-menu-item > li > a',
vnAutocomplete: 'vn-autocomplete'
vnAutocomplete: 'vn-autocomplete',
vnCheck: 'vn-check'
};

View File

@ -27,7 +27,7 @@ Nightmare.action('getInnerText', function(selector, done) {
Nightmare.action('getInputValue', function(selector, done) {
this.wait(selector)
.evaluate_now(function(elementToSelect) {
return document.querySelectorAll(elementToSelect)[0].value;
return document.querySelector(elementToSelect).value;
}, done, selector);
});

View File

@ -1,16 +1,6 @@
// eslint max-len: ["error", 500]
// eslint key-spacing: ["error", 500]
import components from './selector_variables.js';
function checkElement(selector, attributeValue) {
let aux = selector.split(' ');
if (aux[0] === 'vn-autocomplete') {
return selector.replace(aux[0], `${aux[0]}[field="${attributeValue}"]`);
}
if (aux[0] === 'vn-textfield') {
return selector.replace(aux[4], `${aux[4]}[name="${attributeValue}"]`);
}
}
import components from './components_selectors.js';
export default {
login: {
@ -35,34 +25,34 @@ export default {
createClientButton: `${components.vnFloatButton}`
},
createClientView: {
name: `${checkElement(components.vnTextfield, 'name')}`,
taxNumber: `${checkElement(components.vnTextfield, 'fi')}`,
socialName: `${checkElement(components.vnTextfield, 'socialName')}`,
userName: `${checkElement(components.vnTextfield, 'userName')}`,
email: `${checkElement(components.vnTextfield, 'email')}`,
name: `${components.vnTextfield}[name="name"]`,
taxNumber: `${components.vnTextfield}[name="fi"]`,
socialName: `${components.vnTextfield}[name="socialName"]`,
userName: `${components.vnTextfield}[name="userName"]`,
email: `${components.vnTextfield}[name="email"]`,
createButton: `${components.vnSubmit}`
},
basicData: {
basicDataButton: `${components.vnMenuItem}`,
nameInput: `${checkElement(components.vnTextfield, 'name')}`,
taxNumberInput: `${checkElement(components.vnTextfield, 'fi')}`,
socialNameInput: `${checkElement(components.vnTextfield, 'socialName')}`,
phoneInput: `${checkElement(components.vnTextfield, 'phone')}`,
mobileInput: `${checkElement(components.vnTextfield, 'mobile')}`,
faxInput: `${checkElement(components.vnTextfield, 'fax')}`,
emailInput: `${checkElement(components.vnTextfield, 'email')}`,
salesPersonInput: `${checkElement(components.vnAutocomplete, '$ctrl.client.salesPersonFk')}`,
channelInput: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-basic-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(4) > vn-autocomplete:nth-child(3) > vn-vertical > vn-textfield > div > input',
channelMetropolisOption: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-basic-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(4) > vn-autocomplete:nth-child(3) > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(2) > ul > li:nth-child(3)',
saveButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-basic-data > form > vn-button-bar > vn-submit > input'
basicDataButton: `${components.vnMenuItem}[ui-sref="clientCard.basicData"]`,
nameInput: `${components.vnTextfield}[name="name"]`,
taxNumberInput: `${components.vnTextfield}[name="fi"]`,
socialNameInput: `${components.vnTextfield}[name="socialName"]`,
phoneInput: `${components.vnTextfield}[name="phone"]`,
mobileInput: `${components.vnTextfield}[name="mobile"]`,
faxInput: `${components.vnTextfield}[name="fax"]`,
emailInput: `${components.vnTextfield}[name="email"]`,
salesPersonInput: `${components.vnAutocomplete}[field="$ctrl.client.salesPersonFk"]`,
channelInput: `${components.vnAutocomplete}[field="$ctrl.client.contactChannelFk"] > vn-vertical > ${components.vnTextfield}`,
channelMetropolisOption: `${components.vnAutocomplete}[field="$ctrl.client.contactChannelFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(2) > ul > li:nth-child(3)`,
saveButton: `${components.vnSubmit}`
},
fiscalData: {
fiscalDataButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-empty > vn-left-menu > vn-card > div > vn-vertical > vn-actions > vn-horizontal > ul > vn-menu-item:nth-child(2) > li > a',
addressInput: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(3) > vn-textfield:nth-child(1) > div > input',
hasToInvoiceCheckboxLabel: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-one:nth-child(1) > vn-check > label',
hasToInvoiceCheckboxInput: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-one:nth-child(1) > vn-check > label > input',
// printToInvoiceCheckboxLabel: '',
// printInvoiceCheckboxInput: '',
fiscalDataButton: `${components.vnMenuItem}[ui-sref="clientCard.fiscalData"]`,
hasToInvoiceCheckboxLabel: `${components.vnCheck}[label='Has to invoice'] > label`,
hasToInvoiceCheckboxInput: `${components.vnCheck}[label='Has to invoice'] > label > label > input`,
invoiceByMailCheckboxLabel: `${components.vnCheck}[label='Invoice by mail'] > label`,
invoiceByMailCheckboxInput: `${components.vnCheck}[label='Invoice by mail'] > label > label > input`,
addressInput: `${components.vnTextfield}[name="street"]`,
saveButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-button-bar > vn-submit > input'
}
};

View File

@ -25,7 +25,7 @@ describe('create client path', () => {
.waitForURL(moduleAccessViewHashURL)
.url()
.then(url => {
expect(url).toBe(config.url + moduleAccessViewHashURL);
expect(url).toEqual(config.url + moduleAccessViewHashURL);
done();
})
.catch(catchErrors(done));
@ -37,7 +37,7 @@ describe('create client path', () => {
.wait(selectors.clientsIndex.createClientButton)
.url()
.then(url => {
expect(url).toBe(config.url + '#!/clients');
expect(url).toEqual(config.url + '#!/clients');
done();
})
.catch(catchErrors(done));
@ -51,7 +51,7 @@ describe('create client path', () => {
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0)
.countSearchResults(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toBe(0);
expect(result).toEqual(0);
done();
})
.catch(catchErrors(done));
@ -63,7 +63,7 @@ describe('create client path', () => {
.wait(selectors.createClientView.createButton)
.url()
.then(url => {
expect(url).toBe(config.url + '#!/create');
expect(url).toEqual(config.url + '#!/create');
done();
})
.catch(catchErrors(done));
@ -75,7 +75,7 @@ describe('create client path', () => {
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toBe('No hay cambios que guardar');
expect(result).toEqual('No hay cambios que guardar');
done();
})
.catch(catchErrors(done));
@ -149,7 +149,7 @@ describe('create client path', () => {
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toBe(`Algunos campos no son válidos`);
expect(result).toEqual(`Algunos campos no son válidos`);
done();
})
.catch(catchErrors(done));
@ -198,7 +198,7 @@ describe('create client path', () => {
.wait(selectors.clientsIndex.createClientButton)
.url()
.then(url => {
expect(url).toBe(config.url + '#!/clients');
expect(url).toEqual(config.url + '#!/clients');
done();
})
.catch(catchErrors(done));
@ -212,7 +212,7 @@ describe('create client path', () => {
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countSearchResults(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toBe(1);
expect(result).toEqual(1);
done();
})
.catch(catchErrors(done));

View File

@ -25,7 +25,7 @@ describe('Edit basicData path', () => {
.waitForURL(moduleAccessViewHashURL)
.url()
.then(url => {
expect(url).toBe(config.url + moduleAccessViewHashURL);
expect(url).toEqual(config.url + moduleAccessViewHashURL);
done();
})
.catch(catchErrors(done));
@ -39,7 +39,7 @@ describe('Edit basicData path', () => {
.wait(selectors.clientsIndex.createClientButton)
.url()
.then(url => {
expect(url).toBe(config.url + '#!/clients');
expect(url).toEqual(config.url + '#!/clients');
done();
})
.catch(catchErrors(done));
@ -53,7 +53,7 @@ describe('Edit basicData path', () => {
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countSearchResults(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toBe(1);
expect(result).toEqual(1);
done();
})
.catch(catchErrors(done));
@ -81,7 +81,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toBe(`¡Datos guardados!`);
expect(result).toEqual(`¡Datos guardados!`);
done();
})
.catch(catchErrors(done));
@ -96,7 +96,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.nameInput)
.getInputValue(selectors.basicData.nameInput)
.then(result => {
expect(result).toBe(`Carol Danvers Edited`);
expect(result).toEqual(`Carol Danvers Edited`);
done();
})
.catch(catchErrors(done));
@ -111,7 +111,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toBe(`¡Datos guardados!`);
expect(result).toEqual(`¡Datos guardados!`);
done();
})
.catch(catchErrors(done));
@ -126,7 +126,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.taxNumberInput)
.getInputValue(selectors.basicData.taxNumberInput)
.then(result => {
expect(result).toBe(`AVG tax Edited`);
expect(result).toEqual(`AVG tax Edited`);
done();
})
.catch(catchErrors(done));
@ -141,7 +141,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toBe(`¡Datos guardados!`);
expect(result).toEqual(`¡Datos guardados!`);
done();
})
.catch(catchErrors(done));
@ -156,7 +156,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.socialNameInput)
.getInputValue(selectors.basicData.socialNameInput)
.then(result => {
expect(result).toBe(`Avengers Team Edited`);
expect(result).toEqual(`Avengers Team Edited`);
done();
})
.catch(catchErrors(done));
@ -171,7 +171,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toBe(`¡Datos guardados!`);
expect(result).toEqual(`¡Datos guardados!`);
done();
})
.catch(catchErrors(done));
@ -186,7 +186,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.phoneInput)
.getInputValue(selectors.basicData.phoneInput)
.then(result => {
expect(result).toBe('123456789');
expect(result).toEqual('123456789');
done();
})
.catch(catchErrors(done));
@ -201,7 +201,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toBe(`¡Datos guardados!`);
expect(result).toEqual(`¡Datos guardados!`);
done();
})
.catch(catchErrors(done));
@ -216,7 +216,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.mobileInput)
.getInputValue(selectors.basicData.mobileInput)
.then(result => {
expect(result).toBe('987654321');
expect(result).toEqual('987654321');
done();
})
.catch(catchErrors(done));
@ -231,7 +231,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toBe(`¡Datos guardados!`);
expect(result).toEqual(`¡Datos guardados!`);
done();
})
.catch(catchErrors(done));
@ -246,7 +246,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.faxInput)
.getInputValue(selectors.basicData.faxInput)
.then(result => {
expect(result).toBe('432198765');
expect(result).toEqual('432198765');
done();
})
.catch(catchErrors(done));
@ -261,7 +261,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toBe(`¡Datos guardados!`);
expect(result).toEqual(`¡Datos guardados!`);
done();
})
.catch(catchErrors(done));
@ -276,7 +276,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.emailInput)
.getInputValue(selectors.basicData.emailInput)
.then(result => {
expect(result).toBe('CarolDanversEdited@verdnatura.es');
expect(result).toEqual('CarolDanversEdited@verdnatura.es');
done();
})
.catch(catchErrors(done));
@ -290,7 +290,7 @@ describe('Edit basicData path', () => {
// .wait(selectors.globalItems.snackbarIsActive)
// .getInnerText(selectors.globalItems.snackbarIsActive)
// .then(result => {
// expect(result).toBe(`¡Datos guardados!`);
// expect(result).toEqual(`¡Datos guardados!`);
// done();
// })
// .catch(catchErrors(done));
@ -305,7 +305,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toBe(`¡Datos guardados!`);
expect(result).toEqual(`¡Datos guardados!`);
done();
})
.catch(catchErrors(done));
@ -320,7 +320,7 @@ describe('Edit basicData path', () => {
.wait(100)
.getInputValue(selectors.basicData.channelInput)
.then(result => {
expect(result).toBe('Metropolis newspaper');
expect(result).toEqual('Metropolis newspaper');
done();
})
.catch(catchErrors(done));

View File

@ -25,7 +25,7 @@ describe('Edit fiscalData path', () => {
.waitForURL(moduleAccessViewHashURL)
.url()
.then(url => {
expect(url).toBe(config.url + moduleAccessViewHashURL);
expect(url).toEqual(config.url + moduleAccessViewHashURL);
done();
})
.catch(catchErrors(done));
@ -39,7 +39,7 @@ describe('Edit fiscalData path', () => {
.wait(selectors.clientsIndex.createClientButton)
.url()
.then(url => {
expect(url).toBe(config.url + '#!/clients');
expect(url).toEqual(config.url + '#!/clients');
done();
})
.catch(catchErrors(done));
@ -53,7 +53,7 @@ describe('Edit fiscalData path', () => {
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countSearchResults(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toBe(1);
expect(result).toEqual(1);
done();
})
.catch(catchErrors(done));
@ -80,7 +80,7 @@ describe('Edit fiscalData path', () => {
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toBe('¡Datos guardados!');
expect(result).toEqual('¡Datos guardados!');
done();
})
.catch(catchErrors(done));
@ -95,7 +95,37 @@ describe('Edit fiscalData path', () => {
.wait(selectors.fiscalData.hasToInvoiceCheckboxLabel)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.fiscalData.hasToInvoiceCheckboxInput)
}, selectors.fiscalData.hasToInvoiceCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
done();
})
.catch(catchErrors(done));
});
it(`should uncheck the invoiceByMail checkbox`, done => {
nightmare
.waitToClick(selectors.fiscalData.invoiceByMailCheckboxLabel)
.waitToClick(selectors.fiscalData.saveButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toEqual('¡Datos guardados!');
done();
})
.catch(catchErrors(done));
});
it(`should confirm invoiceByMail checkbox is unchecked`, done => {
nightmare
.waitForSnackbarReset()
.waitToClick(selectors.basicData.basicDataButton)
.wait(selectors.basicData.nameInput)
.waitToClick(selectors.fiscalData.fiscalDataButton)
.wait(selectors.fiscalData.invoiceByMailCheckboxLabel)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.fiscalData.invoiceByMailCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
done();

View File

@ -4,8 +4,6 @@ COPY auth /app
COPY loopback /loopback
RUN npm install loopback
WORKDIR /app
RUN npm install

View File

@ -4,8 +4,6 @@ COPY client /app
COPY loopback /loopback
RUN npm install loopback
WORKDIR /app
RUN npm install

View File

@ -13,6 +13,7 @@
"url": "https://git.verdnatura.es/salix"
},
"dependencies": {
"loopback-context": "^3.3.0"
"loopback-context": "^3.3.0",
"request": "^2.83.0"
}
}

View File

@ -4,8 +4,6 @@ COPY production /app
COPY loopback /loopback
RUN npm install loopback
WORKDIR /app
RUN npm install

View File

@ -28,6 +28,13 @@ module.exports = function(Self) {
onFinish(err);
}
reBuildFilter();
let where = Self.dataSource.connector.buildWhere(Self.modelName, filter.where);
let query = `SELECT * FROM tmp.production ${where.sql} GROUP BY RouteFk ORDER BY routeFk`;
conn.query(query, where.params, onFinish);
}
function reBuildFilter() {
if (filter.where && filter.where.q) {
let regexQ = new RegExp(filter.where.q);
delete filter.where.q;
@ -53,14 +60,10 @@ module.exports = function(Self) {
}
filter.where = newFilter;
}
let where = Self.dataSource.connector.buildWhere(Self.modelName, filter.where);
let query = `SELECT * FROM FakeProduction_tmp ${where.sql} GROUP BY RouteFk ORDER BY routeFk`;
conn.query(query, where.params, onFinish);
}
function onFinish(err, results) {
conn.query('DROP TEMPORARY TABLE IF EXISTS FakeProduction_tmp');
conn.query('DROP TEMPORARY TABLE IF EXISTS tmp.production');
conn.release();
if (err)
callback(err);

View File

@ -12,5 +12,8 @@
"url": "https://git.verdnatura.es/salix"
},
"license": "GPL-3.0",
"description": "vn-production"
"description": "vn-production",
"dependencies": {
"uuid": "^3.1.0"
}
}

View File

@ -4,8 +4,6 @@ COPY route /app
COPY loopback /loopback
RUN npm install loopback
WORKDIR /app
RUN npm install

View File

@ -4,8 +4,6 @@ COPY salix /app
COPY loopback /loopback
RUN npm install loopback
WORKDIR /app
RUN npm install