From 602d0a74bd04e5c78943618298ef5fac156bd7ff Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 9 Nov 2017 14:47:09 +0100 Subject: [PATCH 01/10] e2e test --- e2e/helpers/selectors.js | 4 +- e2e/paths/edit_basic_data.spec.js | 1 - e2e/paths/edit_fiscal_data.spec.js | 87 ++++++++++++++++++++---------- 3 files changed, 61 insertions(+), 31 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 0e47740ef..e5c84ecb7 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -56,7 +56,9 @@ export default { cityInput: `${components.vnTextfield}[name="city"]`, postcodeInput: `${components.vnTextfield}[name="postcode"]`, provinceInput: `${components.vnAutocomplete}[field="$ctrl.client.provinceFk"] > vn-vertical > ${components.vnTextfield}`, - provinceFifthOption: `${components.vnAutocomplete}[field="$ctrl.client.provinceFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(2) > ul > li:nth-child(5)`, + provinceFifthOption: `${components.vnAutocomplete}[field="$ctrl.client.provinceFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(1) > ul > li:nth-child(5)`, + countryInput: `${components.vnAutocomplete}[field="$ctrl.client.countryFk"] > vn-vertical > ${components.vnTextfield}`, + countryThirdOption: `${components.vnAutocomplete}[field="$ctrl.client.countryFk"] > 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-fiscal-data > form > vn-button-bar > vn-submit > input' } }; diff --git a/e2e/paths/edit_basic_data.spec.js b/e2e/paths/edit_basic_data.spec.js index 6ebaeeaf1..eb46f18dd 100644 --- a/e2e/paths/edit_basic_data.spec.js +++ b/e2e/paths/edit_basic_data.spec.js @@ -299,7 +299,6 @@ describe('Edit basicData path', () => { it('should select the channel', done => { nightmare .waitToClick(selectors.basicData.channelInput) - .waitToClick(selectors.basicData.channelInput) .waitToClick(selectors.basicData.channelMetropolisOption) .waitToClick(selectors.basicData.saveButton) .wait(selectors.globalItems.snackbarIsActive) diff --git a/e2e/paths/edit_fiscal_data.spec.js b/e2e/paths/edit_fiscal_data.spec.js index c835f60ff..d9561f975 100644 --- a/e2e/paths/edit_fiscal_data.spec.js +++ b/e2e/paths/edit_fiscal_data.spec.js @@ -5,7 +5,7 @@ import {catchErrors} from '../../services/utils/jasmineHelpers'; const nightmare = createNightmare(); const moduleAccessViewHashURL = '#!/'; -describe('Edit fiscalData path', () => { +fdescribe('Edit fiscalData path', () => { describe('warm up', () => { it('should warm up login and fixtures', done => { nightmare @@ -223,33 +223,62 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); - // it(`should edit the province`, done => { - // nightmare - // .waitToClick(selectors.fiscalData.provinceInput) - // .waitToClick(selectors.fiscalData.provinceInput) - // .waitToClick(selectors.fiscalData.provinceMetropolisOption) - // .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 edit the province`, done => { + nightmare + .waitToClick(selectors.fiscalData.provinceInput) + .waitToClick(selectors.fiscalData.provinceFifthOption) + .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 the province have been selected`, done => { - // nightmare - // .waitForSnackbarReset() - // .click(selectors.fiscalData.fiscalDataButton) - // .wait(selectors.fiscalData.addressInput) - // .click(selectors.fiscalData.basicDataButton) - // .wait(100) - // .getInputValue(selectors.fiscalData.provinceInput) - // .then(result => { - // expect(result).toEqual('Province two'); - // done(); - // }) - // .catch(catchErrors(done)); - // }); + it(`should confirm the province have been selected`, done => { + nightmare + .waitForSnackbarReset() + .waitToClick(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .waitToClick(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.addressInput) + .wait(100) + .getInputValue(selectors.fiscalData.provinceInput) + .then(result => { + expect(result).toEqual('Province two'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should edit the country`, done => { + nightmare + .waitToClick(selectors.fiscalData.countryInput) + .waitToClick(selectors.fiscalData.countryThirdOption) + .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 the country have been selected`, done => { + nightmare + .waitForSnackbarReset() + .click(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.addressInput) + .click(selectors.fiscalData.basicDataButton) + .wait(100) + .getInputValue(selectors.fiscalData.countryInput) + .then(result => { + expect(result).toEqual('Holanda'); + done(); + }) + .catch(catchErrors(done)); + }); }); From c800034cc7cb36a43ddb1761c86b2f33898ddc2f Mon Sep 17 00:00:00 2001 From: Carlos Date: Mon, 13 Nov 2017 08:36:15 +0100 Subject: [PATCH 02/10] e2e testing fiscal data path up to country select --- e2e/helpers/selectors.js | 6 +++--- e2e/paths/edit_basic_data.spec.js | 2 +- e2e/paths/edit_fiscal_data.spec.js | 7 +++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index e5c84ecb7..fb968e2d7 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -56,9 +56,9 @@ export default { cityInput: `${components.vnTextfield}[name="city"]`, postcodeInput: `${components.vnTextfield}[name="postcode"]`, provinceInput: `${components.vnAutocomplete}[field="$ctrl.client.provinceFk"] > vn-vertical > ${components.vnTextfield}`, - provinceFifthOption: `${components.vnAutocomplete}[field="$ctrl.client.provinceFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(1) > ul > li:nth-child(5)`, + provinceFifthOption: `${components.vnAutocomplete}[field="$ctrl.client.provinceFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(2) > ul > li:nth-child(5)`, countryInput: `${components.vnAutocomplete}[field="$ctrl.client.countryFk"] > vn-vertical > ${components.vnTextfield}`, - countryThirdOption: `${components.vnAutocomplete}[field="$ctrl.client.countryFk"] > 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-fiscal-data > form > vn-button-bar > vn-submit > input' + countryThirdOption: `${components.vnAutocomplete}[field="$ctrl.client.countryFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(3) > ul > li:nth-child(3)`, + saveButton: `${components.vnSubmit}` } }; diff --git a/e2e/paths/edit_basic_data.spec.js b/e2e/paths/edit_basic_data.spec.js index eb46f18dd..8fcd7dca1 100644 --- a/e2e/paths/edit_basic_data.spec.js +++ b/e2e/paths/edit_basic_data.spec.js @@ -316,7 +316,7 @@ describe('Edit basicData path', () => { .click(selectors.fiscalData.fiscalDataButton) .wait(selectors.fiscalData.addressInput) .click(selectors.basicData.basicDataButton) - .wait(100) + .wait(selectors.basicData.basicDataButton) .getInputValue(selectors.basicData.channelInput) .then(result => { expect(result).toEqual('Metropolis newspaper'); diff --git a/e2e/paths/edit_fiscal_data.spec.js b/e2e/paths/edit_fiscal_data.spec.js index d9561f975..b7cefa28c 100644 --- a/e2e/paths/edit_fiscal_data.spec.js +++ b/e2e/paths/edit_fiscal_data.spec.js @@ -5,7 +5,7 @@ import {catchErrors} from '../../services/utils/jasmineHelpers'; const nightmare = createNightmare(); const moduleAccessViewHashURL = '#!/'; -fdescribe('Edit fiscalData path', () => { +describe('Edit fiscalData path', () => { describe('warm up', () => { it('should warm up login and fixtures', done => { nightmare @@ -240,10 +240,9 @@ fdescribe('Edit fiscalData path', () => { it(`should confirm the province have been selected`, done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) + .click(selectors.basicData.basicDataButton) .wait(selectors.basicData.nameInput) - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.addressInput) + .click(selectors.fiscalData.fiscalDataButton) .wait(100) .getInputValue(selectors.fiscalData.provinceInput) .then(result => { From 154c06e7f4caedb023f8a9aaf02cedce3321f931 Mon Sep 17 00:00:00 2001 From: Carlos Date: Mon, 13 Nov 2017 11:47:41 +0100 Subject: [PATCH 03/10] added hasToInvoiceByAddress checkbox to client > billingData --- client/client/src/billing-data/billing-data.html | 7 +++++-- client/client/src/billing-data/billing-data.js | 15 ++++++++++----- client/client/src/billing-data/locale/es.json | 4 +++- services/client/common/models/client.json | 4 ++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/client/client/src/billing-data/billing-data.html b/client/client/src/billing-data/billing-data.html index 09590dee6..ad4641da2 100644 --- a/client/client/src/billing-data/billing-data.html +++ b/client/client/src/billing-data/billing-data.html @@ -28,11 +28,14 @@ - + + + + @@ -72,7 +75,7 @@ + on-response="$ctrl.returnDialogEt(response)"> You changes the equivalent tax diff --git a/client/client/src/billing-data/billing-data.js b/client/client/src/billing-data/billing-data.js index a28aea963..b06f20cd7 100644 --- a/client/client/src/billing-data/billing-data.js +++ b/client/client/src/billing-data/billing-data.js @@ -9,9 +9,11 @@ export default class Controller { this.billData = {}; this.copyData(); } + $onChanges() { this.copyData(); } + copyData() { if (this.client) { this.billData.payMethodFk = this.client.payMethodFk; @@ -23,10 +25,12 @@ export default class Controller { this.equalizationTax = this.client.equalizationTax; } } + submit() { return this.$.watcher.submit().then( () => this.checkPaymentChanges()); } + checkPaymentChanges() { let equals = true; Object.keys(this.billData).forEach( @@ -39,25 +43,26 @@ export default class Controller { ); if (equals) { - this.checkREChanges(); + this.checkEtChanges(); } else { this.$.sendMail.show(); } } + returnDialog(response) { if (response === 'ACCEPT') { this.$http.post(`/mailer/manuscript/payment-update/${this.client.id}`).then( () => { this.vnApp.showMessage(this.translate.instant('Notification sent!')); - this.checkREChanges(); + this.checkEtChanges(); } ); } else { - this.checkREChanges(); + this.checkEtChanges(); } } - checkREChanges() { + checkEtChanges() { let equals = this.equalizationTax == this.client.equalizationTax; this.equalizationTax = this.client.equalizationTax; @@ -65,7 +70,7 @@ export default class Controller { this.$.propagateEqualizationTax.show(); } - returnDialogRE(response) { + returnDialogEt(response) { if (response === 'ACCEPT') { this.$http.patch(`/client/api/Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.equalizationTax}).then( res => { diff --git a/client/client/src/billing-data/locale/es.json b/client/client/src/billing-data/locale/es.json index 5706db30e..1d643a934 100644 --- a/client/client/src/billing-data/locale/es.json +++ b/client/client/src/billing-data/locale/es.json @@ -8,5 +8,7 @@ "You changes the equivalent tax": "Has cambiado el recargo de equivalencia", "Do you want to spread the change to their consignees?" : "¿Deseas propagar el cambio a sus consignatarios?", "Yes, propagate": "Si, propagar", - "Equivalent tax spreaded": "Recargo de equivalencia propagado" + "Equivalent tax spreaded": "Recargo de equivalencia propagado", + "Invoice by address": "Facturar por consignatario", + "Equalization tax": "Recargo de equivalencia" } \ No newline at end of file diff --git a/services/client/common/models/client.json b/services/client/common/models/client.json index ddb59bbd7..3ef9b48f2 100644 --- a/services/client/common/models/client.json +++ b/services/client/common/models/client.json @@ -64,6 +64,10 @@ "type": "boolean", "description": "The client has equalization tax" }, + "hasToInvoiceByAddress": { + "type": "boolean", + "description": "The client has to be invoiced by address" + }, "hasToInvoice": { "type": "boolean", "description": "Global invoicing enabled for the client" From ed64c3b50a945e4b4fffff2dc930bb496fe0ff71 Mon Sep 17 00:00:00 2001 From: Carlos Date: Mon, 13 Nov 2017 14:17:09 +0100 Subject: [PATCH 04/10] vn icon css changes for main menu --- client/core/src/icon/style.css | 2 +- client/salix/src/components/main-menu/main-menu.html | 8 ++++++-- client/salix/src/components/main-menu/style.scss | 9 +++++++++ client/salix/src/styles/display.css | 8 +++++++- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/client/core/src/icon/style.css b/client/core/src/icon/style.css index 064195cd9..881f6d304 100644 --- a/client/core/src/icon/style.css +++ b/client/core/src/icon/style.css @@ -5,4 +5,4 @@ vn-icon { vn-icon > i { display: block; font-size: inherit !important; -} \ No newline at end of file +} diff --git a/client/salix/src/components/main-menu/main-menu.html b/client/salix/src/components/main-menu/main-menu.html index 25b375fd3..5d96d9b19 100644 --- a/client/salix/src/components/main-menu/main-menu.html +++ b/client/salix/src/components/main-menu/main-menu.html @@ -1,9 +1,13 @@
- - +
  • diff --git a/client/salix/src/components/main-menu/style.scss b/client/salix/src/components/main-menu/style.scss index ea454ebf3..5e1781446 100644 --- a/client/salix/src/components/main-menu/style.scss +++ b/client/salix/src/components/main-menu/style.scss @@ -1,4 +1,13 @@ vn-main-menu { + & > div > vn-icon { + font-size: 2.5em; + cursor: pointer; + + &:hover { + color: #FF9300; + } + } + li.mdl-menu__item{ background-color: #FF9300; margin-bottom: 8px; diff --git a/client/salix/src/styles/display.css b/client/salix/src/styles/display.css index 0a512c090..982432252 100644 --- a/client/salix/src/styles/display.css +++ b/client/salix/src/styles/display.css @@ -1,6 +1,7 @@ .display-block { display: block; } + .well { min-height: 20px; padding: 19px; @@ -10,6 +11,7 @@ border-radius: 4px; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); } + .form-group { margin-bottom: 15px; } @@ -20,6 +22,7 @@ height: auto; min-width: auto; } + .popover-label { font-weight: bold; color: black; @@ -32,12 +35,15 @@ height: 46px; line-height: 0px; } + input:disabled, button:disabled { cursor: not-allowed !important; } + input[type="submit"]:disabled, button:disabled { opacity: 0.7; } + .descriptor-icon{ font-size:60px; -} \ No newline at end of file +} From 29149b1b58c07aedaf8f96e8dce8e7601bca28b2 Mon Sep 17 00:00:00 2001 From: Carlos Date: Mon, 13 Nov 2017 22:15:44 +0100 Subject: [PATCH 05/10] corrected some eslint errors and small refactor --- client/auth/src/login/login.html | 24 +++++------ client/auth/src/login/style.scss | 4 ++ client/client/src/card/style.css | 2 +- client/client/src/index/style.css | 2 +- client/client/src/notes/notes.js | 3 ++ client/client/src/notes/style.css | 2 +- .../client/src/search-panel/search-panel.js | 3 ++ .../src/search-panel/search-panel.spec.js | 4 +- client/client/src/web-access/web-access.js | 1 + client/core/src/autocomplete/autocomplete.js | 8 +++- services/loopback/server/middleware.json | 4 +- services/salix/client/index.ejs | 40 +++++++++---------- 12 files changed, 57 insertions(+), 40 deletions(-) diff --git a/client/auth/src/login/login.html b/client/auth/src/login/login.html index 7ca073e72..161ffa732 100644 --- a/client/auth/src/login/login.html +++ b/client/auth/src/login/login.html @@ -1,18 +1,18 @@
    -
    - -
    - - -
    diff --git a/client/auth/src/login/style.scss b/client/auth/src/login/style.scss index fddd2d14e..8f1df6705 100644 --- a/client/auth/src/login/style.scss +++ b/client/auth/src/login/style.scss @@ -16,6 +16,7 @@ vn-login > div { margin: auto; height: inherit; } + .box { box-sizing: border-box; position: absolute; @@ -27,15 +28,18 @@ vn-login > div { box-shadow: 0 0 1em 0 rgba(1,1,1,.6); border-radius: .5em; } + img { width: 100%; padding-bottom: 1em; } + .footer { margin-top: 1em; text-align: center; position: relative; } + .spinner-wrapper { position: absolute; width: 0; diff --git a/client/client/src/card/style.css b/client/client/src/card/style.css index f788e35c6..195879409 100644 --- a/client/client/src/card/style.css +++ b/client/client/src/card/style.css @@ -1,3 +1,3 @@ -vn-descriptor{ +vn-descriptor { font-family: raleway-bold; } \ No newline at end of file diff --git a/client/client/src/index/style.css b/client/client/src/index/style.css index ba7f75844..b30351f09 100644 --- a/client/client/src/index/style.css +++ b/client/client/src/index/style.css @@ -11,6 +11,6 @@ vn-item-client a:hover { background-color: #424242; } -.vn-item-client-name{ +.vn-item-client-name { font-family: raleway-bold; } diff --git a/client/client/src/notes/notes.js b/client/client/src/notes/notes.js index bd214cf49..7e0ec424a 100644 --- a/client/client/src/notes/notes.js +++ b/client/client/src/notes/notes.js @@ -6,11 +6,13 @@ export default class Controller { this.$http = $http; this.$state = $state; } + $onChanges() { if (this.client) { this.getObservation(this.client.id); } } + getObservation(clientId) { let json = JSON.stringify({where: {clientFk: this.client.id}, order: 'created DESC'}); this.$http.get(`/client/api/clientObservations?filter=${json}`).then( @@ -19,6 +21,7 @@ export default class Controller { } ); } + newObservation() { this.$state.go("clientCard.notes.create", {id: this.client.id}); } diff --git a/client/client/src/notes/style.css b/client/client/src/notes/style.css index b5e17c7a7..4d0f8eba7 100644 --- a/client/client/src/notes/style.css +++ b/client/client/src/notes/style.css @@ -1,3 +1,3 @@ -.notes-date{ +.notes-date { font-family: raleway-bold; } \ No newline at end of file diff --git a/client/client/src/search-panel/search-panel.js b/client/client/src/search-panel/search-panel.js index 87f6308ce..88aa89af3 100644 --- a/client/client/src/search-panel/search-panel.js +++ b/client/client/src/search-panel/search-panel.js @@ -6,15 +6,18 @@ export default class Controller { // onSubmit() is defined by @vnSearchbar this.onSubmit = () => {}; } + onSearch() { this.setStorageValue(); this.onSubmit(this.filter); } + $onChanges() { var value = JSON.parse(this.$window.sessionStorage.getItem('filter')); if (value !== undefined) this.filter = value; } + setStorageValue() { this.$window.sessionStorage.setItem('filter', JSON.stringify(this.filter)); } diff --git a/client/client/src/search-panel/search-panel.spec.js b/client/client/src/search-panel/search-panel.spec.js index 9f7695924..2c3137ff0 100644 --- a/client/client/src/search-panel/search-panel.spec.js +++ b/client/client/src/search-panel/search-panel.spec.js @@ -17,7 +17,7 @@ describe('Client', () => { })); describe('onSearch()', () => { - it(`should call setStorageValue() and onSubmit()`, () => { + it('should call setStorageValue() and onSubmit()', () => { spyOn(controller, 'setStorageValue'); spyOn(controller, 'onSubmit'); controller.setStorageValue(); @@ -29,7 +29,7 @@ describe('Client', () => { }); describe('$onChanges()', () => { - it(`should set filter properties using the search values`, () => { + it('should set filter properties using the search values', () => { expect(controller.filter).not.toBeDefined(); spyOn(JSON, 'parse').and.returnValue({data: 'data'}); controller.$onChanges(); diff --git a/client/client/src/web-access/web-access.js b/client/client/src/web-access/web-access.js index dc61eac82..696d8a0ad 100644 --- a/client/client/src/web-access/web-access.js +++ b/client/client/src/web-access/web-access.js @@ -29,6 +29,7 @@ export default class Controller { this.repeatPassword = ''; this.$.$apply(); } + onPassChange(response) { if (response == 'ACCEPT' && this.canChangePassword) try { diff --git a/client/core/src/autocomplete/autocomplete.js b/client/core/src/autocomplete/autocomplete.js index 0366cece7..8623eccb7 100644 --- a/client/core/src/autocomplete/autocomplete.js +++ b/client/core/src/autocomplete/autocomplete.js @@ -32,6 +32,7 @@ class Autocomplete extends Component { get showDropDown() { return this._showDropDown; } + set showDropDown(value) { if (value && this.url && !this._preLoad) { this._preLoad = true; @@ -77,6 +78,7 @@ class Autocomplete extends Component { get field() { return this.multiple ? this._multiField : this._field; } + set field(value) { if (!angular.equals(value, this.field)) { this.finding = true; @@ -103,7 +105,7 @@ class Autocomplete extends Component { if (value && value.hasOwnProperty(this.valueField)) { this._field = value[this.valueField]; if (this.multiple) { - this._multiField = [value[this.valueField]] + this._multiField = [value[this.valueField]]; } if (value.hasOwnProperty(this.showField)) { this.displayValue = value[this.showField]; @@ -164,6 +166,7 @@ class Autocomplete extends Component { json => this.onItemRequest(null) ); } + onItemRequest(data) { if (data && data.length > 0) this.showItem(data[0]); @@ -222,6 +225,7 @@ class Autocomplete extends Component { this.getItems(); } } + getItems() { if (this.url === undefined) { this.items = copyObject(this.data); @@ -273,6 +277,7 @@ class Autocomplete extends Component { } } } + $onInit() { this.findMore = this.url && this.maxRow; this.mouseFocus = false; @@ -321,7 +326,6 @@ class Autocomplete extends Component { } } - Autocomplete.$inject = ['$element', '$scope', '$http', '$timeout', '$filter']; module.component('vnAutocomplete', { diff --git a/services/loopback/server/middleware.json b/services/loopback/server/middleware.json index 8412781d5..151b6a0e0 100644 --- a/services/loopback/server/middleware.json +++ b/services/loopback/server/middleware.json @@ -1,6 +1,8 @@ { "initial:before": { - "loopback#favicon": {} + "loopback#favicon": { + "params": "$!../favicon.ico" + } }, "initial": { "compression": {}, diff --git a/services/salix/client/index.ejs b/services/salix/client/index.ejs index 9ed38a508..ed1bd1cd8 100644 --- a/services/salix/client/index.ejs +++ b/services/salix/client/index.ejs @@ -1,24 +1,24 @@ - - - Salix - - - - - - - - - + + + Salix + + + + + + + + + From 77ccc0e8afb487dbaa24dcd877c5fa109b38a3a8 Mon Sep 17 00:00:00 2001 From: Carlos Date: Tue, 14 Nov 2017 08:24:01 +0100 Subject: [PATCH 06/10] temp favicon.ico (to update once we have the right one) --- services/loopback/favicon.ico | Bin 0 -> 9972 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 services/loopback/favicon.ico diff --git a/services/loopback/favicon.ico b/services/loopback/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..affd413f83bfdbc2777e2268a98e89711e087f04 GIT binary patch literal 9972 zcmb7qbzGgl^5((ai@O!4$idyMKo73P-QA_QyHniZ;I1w16!#(rcem2Q((k={e|LBP z+T^cE@=5Ye^3KfjWL}qFw*Z*((sI%OC@25`>a7A^*8m{^BzOcIY;0T{Y#iLTLhx4q zr{Lq^;^N^GkkV5S5Ydw2;!?6x(lRiyva;fnbMkVs@X)icGC?6DBcr3C6Juf$v(S>$ zviyIS*Y5xOM{K@FTqecQMug_jbN zs>zLbv_Q4sw~2_~6!Esqf7bXr)8BdF5#Bn1Z~K9Uf`)~Ghlhaz!2BKb)`d8}$oOV} zJS$;IcXcc?8u9T$UYm4{`bSrJPO?wyomu(OQG6PbZ$e~3j-1dQ4|AdvOXALF>5#ZS zP@mlJ zbG~uqxY*K(a0{b-7FlmlQ6FaVDDwHt*Ze)+xRr27f!&LPxzbHoyELy$pEm~czm@nO z0jh>FLJG!X&(p;F@eZm&C^ET$O*^@li{FPeoyCT^Xh*<*$9;~+)%$|*KJ4;ByX6Z0 zmqw3;Oz{@h=YTorvL4nj5_hO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-mXUjqaME?%$SZ4YErn3BlZT}1GLG{l9xB%`c|JC%LWGhUB*OmVT&P{0f literal 0 HcmV?d00001 From a84fc8c1b61c4d969dcf7857e8735fc154c74a7c Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Tue, 14 Nov 2017 08:45:56 +0100 Subject: [PATCH 07/10] new autoComplete option to custom filter --- client/client/src/basic-data/basic-data.html | 4 +++- client/core/src/autocomplete/autocomplete.js | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/client/client/src/basic-data/basic-data.html b/client/client/src/basic-data/basic-data.html index 07c60750e..00fca8fd0 100644 --- a/client/client/src/basic-data/basic-data.html +++ b/client/client/src/basic-data/basic-data.html @@ -28,7 +28,9 @@ show-field="name" value-field="id" select-fields="surname" - label="Salesperson"> + label="Salesperson" + filter-search="{where: {or: [{name: {regexp: 'search'}}, {surname: {regexp: 'search'}}]}}" + > Date: Tue, 14 Nov 2017 11:05:40 +0100 Subject: [PATCH 08/10] unit test for autocomplete - tested filterSearch functionality --- .../src/autocomplete/autocomplete.spec.js | 38 +++++++++++++------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/client/core/src/autocomplete/autocomplete.spec.js b/client/core/src/autocomplete/autocomplete.spec.js index 8401cd1a5..7f8acb427 100644 --- a/client/core/src/autocomplete/autocomplete.spec.js +++ b/client/core/src/autocomplete/autocomplete.spec.js @@ -120,8 +120,8 @@ describe('Component vnAutocomplete', () => { it(`should perform a query if the item id isn't present in the controller.items property`, () => { controller.url = 'test.com'; - $httpBackend.whenGET('test.com?filter={"fields":{"id":true,"name":true},"where":{"id":3}}').respond(); - $httpBackend.expectGET('test.com?filter={"fields":{"id":true,"name":true},"where":{"id":3}}'); + $httpBackend.whenGET(`${controller.url}?filter={"fields":{"id":true,"name":true},"where":{"id":3}}`).respond(); + $httpBackend.expectGET(`${controller.url}?filter={"fields":{"id":true,"name":true},"where":{"id":3}}`); controller.items = [{id: 1, name: 'test1'}, {id: 2, name: 'Bruce Wayne'}]; controller.field = 3; $httpBackend.flush(); @@ -136,8 +136,8 @@ describe('Component vnAutocomplete', () => { it(`should set field performing a query as the item id isn't present in the controller.items property`, () => { controller.url = 'test.com'; - $httpBackend.whenGET('test.com?filter={"fields":{"id":true,"name":true},"where":{"id":3}}').respond(); - $httpBackend.expectGET('test.com?filter={"fields":{"id":true,"name":true},"where":{"id":3}}'); + $httpBackend.whenGET(`${controller.url}?filter={"fields":{"id":true,"name":true},"where":{"id":3}}`).respond(); + $httpBackend.expectGET(`${controller.url}?filter={"fields":{"id":true,"name":true},"where":{"id":3}}`); controller.items = [{id: 1, name: 'test1'}, {id: 2, name: 'Bruce Wayne'}]; controller.field = 3; $httpBackend.flush(); @@ -150,9 +150,23 @@ describe('Component vnAutocomplete', () => { let controller = $componentController('vnAutocomplete', {$scope, $element, $httpBackend, $timeout}); controller.url = 'test.com'; let search = 'The Joker'; - let json = JSON.stringify({where: {name: {regexp: search}}}); - $httpBackend.whenGET(`test.com?filter=${json}`).respond([{id: 3, name: 'The Joker'}]); - $httpBackend.expectGET(`test.com?filter=${json}`); + let json = JSON.stringify({where: {name: {regexp: search}}, order: controller.order}); + $httpBackend.whenGET(`${controller.url}?filter=${json}`).respond([{id: 3, name: 'The Joker'}]); + $httpBackend.expectGET(`${controller.url}?filter=${json}`); + controller.findItems(search); + $httpBackend.flush(); + + expect(controller.items[0]).toEqual({id: 3, name: 'The Joker'}); + }); + + it(`should perform a search and store the result in controller items with filterSearch`, () => { + let controller = $componentController('vnAutocomplete', {$scope, $element, $httpBackend, $timeout}); + controller.url = 'test.com'; + let search = 'The Joker'; + controller.filterSearch = "{where: {surname: {regexp: 'search'}}}"; + let json = JSON.stringify({where: {surname: {regexp: search}}, order: controller.order}); + $httpBackend.whenGET(`${controller.url}?filter=${json}`).respond([{id: 3, name: 'The Joker'}]); + $httpBackend.expectGET(`${controller.url}?filter=${json}`); controller.findItems(search); $httpBackend.flush(); @@ -163,9 +177,9 @@ describe('Component vnAutocomplete', () => { controller.url = 'test.com'; let search = 'Joker'; controller.multiple = true; - let json = JSON.stringify({where: {name: {regexp: search}}}); - $httpBackend.whenGET(`test.com?filter=${json}`).respond([{id: 3, name: 'The Joker'}, {id: 4, name: 'Joker'}]); - $httpBackend.expectGET(`test.com?filter=${json}`); + let json = JSON.stringify({where: {name: {regexp: search}}, order: controller.order}); + $httpBackend.whenGET(`${controller.url}?filter=${json}`).respond([{id: 3, name: 'The Joker'}, {id: 4, name: 'Joker'}]); + $httpBackend.expectGET(`${controller.url}?filter=${json}`); controller.findItems(search); $httpBackend.flush(); @@ -184,8 +198,8 @@ describe('Component vnAutocomplete', () => { describe('getItems()', () => { it(`should perfom a query to fill the items without filter`, () => { controller.url = 'test.com'; - $httpBackend.whenGET(`test.com?filter={"skip":0,"limit":10,"order":"name ASC"}`).respond([{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce Wayne'}]); - $httpBackend.expectGET(`test.com?filter={"skip":0,"limit":10,"order":"name ASC"}`); + $httpBackend.whenGET(`${controller.url}?filter={"skip":0,"limit":10,"order":"name ASC"}`).respond([{id: 1, name: 'Batman'}, {id: 2, name: 'Bruce Wayne'}]); + $httpBackend.expectGET(`${controller.url}?filter={"skip":0,"limit":10,"order":"name ASC"}`); controller.getItems(); $httpBackend.flush(); From d19ebe0c8c7d259cc44268b9f01ec87104cb406b Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Tue, 14 Nov 2017 11:20:12 +0100 Subject: [PATCH 09/10] bug fixed list producction --- .../common/methods/fake-production/list.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/services/production/common/methods/fake-production/list.js b/services/production/common/methods/fake-production/list.js index 0ad582160..a52f29f96 100644 --- a/services/production/common/methods/fake-production/list.js +++ b/services/production/common/methods/fake-production/list.js @@ -68,16 +68,17 @@ module.exports = function(Self) { } function sum(tickets) { - var obj = {lines: 0, m3: 0}; - tickets.forEach(function(t, i) { - obj.lines += t.lines; - obj.m3 += t.m3; - if (tickets[i].problem) - tickets[i].problem = tickets[i].problem.trim(); - }, this); + let obj = {lines: 0, m3: 0}; + if (tickets && tickets.length) + tickets.forEach(function(t, i) { + obj.lines += t.lines; + obj.m3 += t.m3; + if (tickets[i].problem) + tickets[i].problem = tickets[i].problem.trim(); + }, this); obj.m3 = obj.m3.toFixed(2); - obj.total = tickets.length; - obj.tickets = tickets; + obj.total = tickets ? tickets.length : 0; + obj.tickets = tickets || []; return obj; } }; From dce3ae752002a57a1779fc98f36668918a106931 Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Wed, 15 Nov 2017 07:12:52 +0100 Subject: [PATCH 10/10] created storage services --- client/core/src/lib/index.js | 1 + client/core/src/lib/storageServices.js | 66 +++++++++++++++++++ .../src/production-table/production-table.js | 5 +- 3 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 client/core/src/lib/storageServices.js diff --git a/client/core/src/lib/index.js b/client/core/src/lib/index.js index 966f25e2f..a081b5f87 100644 --- a/client/core/src/lib/index.js +++ b/client/core/src/lib/index.js @@ -5,6 +5,7 @@ import './getTemplate'; import './app'; import './interceptor'; import './aclService'; +import './storageServices'; export * from './util'; export {default as splitingRegister} from './splitingRegister'; diff --git a/client/core/src/lib/storageServices.js b/client/core/src/lib/storageServices.js new file mode 100644 index 000000000..ee64b6f0c --- /dev/null +++ b/client/core/src/lib/storageServices.js @@ -0,0 +1,66 @@ +import {module} from '../module'; + +class VnStorage { + constructor() { + this._type = ''; + this.prefix = 'vn'; + } + set type(value) { + this._type = value; + this.checkSupport(); + } + get type() { + return this._type; + } + get webStorage() { + return window[this.type]; + } + checkSupport() { + try { + let supported = (this.type in window && window[this.type] !== null); + if (supported) { + let key = '__' + Math.round(Math.random() * 1e7); + let webStorage = window[this.type]; + webStorage.setItem(key, ''); + webStorage.removeItem(key); + } + } catch (e) { + console.error('VnStorage.notification.error', e.message); + return false; + } + } + get(param) { + let toRead = this.webStorage.getItem(`${this.prefix}.${param}`); + if (toRead && toRead.startsWith('jsonObject:')) { + toRead = JSON.parse(toRead.replace('jsonObject:', '')); + } + return toRead; + } + set(param, data) { + let toStorage = typeof data === 'object' ? `jsonObject:${JSON.stringify(data)}` : data; + this.webStorage.setItem(`${this.prefix}.${param}`, toStorage); + } + remove(param) { + this.webStorage.removeItem(`${this.prefix}.${param}`); + } + clear() { + this.webStorage.clear(); + } +} + +class SessionStorage extends VnStorage { + constructor() { + super(); + this.type = 'sessionStorage'; + } +} + +class LocalStorage extends VnStorage { + constructor() { + super(); + this.type = 'localStorage'; + } +} + +module.service('sessionStorage', SessionStorage); +module.service('localStorage', LocalStorage); diff --git a/client/production/src/production-table/production-table.js b/client/production/src/production-table/production-table.js index 96ebf6c2e..91c24314f 100644 --- a/client/production/src/production-table/production-table.js +++ b/client/production/src/production-table/production-table.js @@ -32,7 +32,6 @@ export class ProductionTable { onOrder(field, order) { let reverse = order === 'DESC'; this.tickets = this.$filter('orderBy')(this.tickets, field, reverse); - this.pageTickets(); } pageTickets() { let init = (this.pageTable.filter.page - 1) * this.itemsDisplayedInList; @@ -46,9 +45,9 @@ ProductionTable.$inject = ['$filter']; ngModule.component('vnProductionTable', { template: require('./production-table.html'), bindings: { - tickets: '=', + tickets: '<', footer: '<', - checkAll: '=' + checkAll: '<' }, controller: ProductionTable });