From 25efbac79368cbce78ebd6238af20f1651de419e Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 5 Nov 2018 15:06:13 +0100 Subject: [PATCH 1/3] left-menu with collapsable menu #780 --- client/claim/routes.json | 18 ++-- client/client/routes.json | 88 +++++++------------ client/client/src/locale/es.yml | 3 +- client/item/routes.json | 38 +++----- client/order/routes.json | 14 ++- client/salix/src/components/index.js | 1 - .../src/components/left-menu/left-menu.html | 32 +++++-- .../src/components/left-menu/left-menu.js | 67 ++++++++++---- .../components/left-menu/left-menu.spec.js | 24 ++--- .../src/components/left-menu/menu-item.html | 9 -- .../src/components/left-menu/menu-item.js | 8 -- .../salix/src/components/left-menu/style.scss | 49 ++++++++++- client/salix/src/config-routes.js | 3 +- client/ticket/routes.json | 58 ++++-------- e2e/helpers/selectors.js | 53 +++++------ .../client-module/07_edit_web_access.spec.js | 2 + e2e/paths/client-module/11_mandate.spec.js | 1 + 17 files changed, 235 insertions(+), 233 deletions(-) delete mode 100644 client/salix/src/components/left-menu/menu-item.html delete mode 100644 client/salix/src/components/left-menu/menu-item.js diff --git a/client/claim/routes.json b/client/claim/routes.json index e8562dcf6c..a418ef8aad 100644 --- a/client/claim/routes.json +++ b/client/claim/routes.json @@ -40,9 +40,6 @@ "params": { "claim": "$ctrl.claim" }, - "menu": { - "icon": "settings" - }, "acl": ["salesPerson"] }, { @@ -53,9 +50,6 @@ "params": { "claim": "$ctrl.claim" }, - "menu": { - "icon": "icon-details" - }, "acl": ["salesPerson"] }, { @@ -66,9 +60,6 @@ "params": { "claim": "$ctrl.claim" }, - "menu": { - "icon": "icon-traceability" - }, "acl": ["salesAssistant"] }, { @@ -79,10 +70,13 @@ "params": { "claim": "$ctrl.claim" }, - "menu": { - "icon": "icon-actions" - }, "acl": ["salesAssistant"] } + ], + "menu": [ + {"state": "claim.card.basicData", "icon": "settings"}, + {"state": "claim.card.detail", "icon": "icon-details"}, + {"state": "claim.card.development", "icon": "icon-traceability"}, + {"state": "claim.card.action", "icon": "icon-actions"} ] } \ No newline at end of file diff --git a/client/client/routes.json b/client/client/routes.json index 328c297eb4..c8dc883007 100644 --- a/client/client/routes.json +++ b/client/client/routes.json @@ -46,9 +46,6 @@ "description": "Basic data", "params": { "client": "$ctrl.client" - }, - "menu": { - "icon": "settings" } }, { @@ -58,9 +55,6 @@ "description": "Fiscal data", "params": { "client": "$ctrl.client" - }, - "menu": { - "icon": "account_balance" } }, { @@ -70,9 +64,6 @@ "description": "Pay method", "params": { "client": "$ctrl.client" - }, - "menu": { - "icon": "icon-payment" } }, { @@ -88,10 +79,7 @@ "description": "Addresses", "params": { "client": "$ctrl.client" - }, - "menu": { - "icon": "local_shipping" - } + } }, { "url": "/create", @@ -112,10 +100,7 @@ "description": "Web access", "params": { "client": "$ctrl.client" - }, - "menu": { - "icon": "cloud" - } + } }, { "url": "/note", @@ -130,9 +115,6 @@ "description": "Notes", "params": { "client": "$ctrl.client" - }, - "menu": { - "icon": "insert_drive_file" } }, { @@ -154,9 +136,6 @@ "description": "Credits", "params": { "client": "$ctrl.client" - }, - "menu": { - "icon": "credit_card" } }, { @@ -182,9 +161,6 @@ "description": "Greuges", "params": { "client": "$ctrl.client" - }, - "menu": { - "icon": "work" } }, { @@ -201,10 +177,7 @@ "url": "/mandate", "state": "client.card.mandate", "component": "vn-client-mandate", - "description": "Mandates", - "menu": { - "icon": "pan_tool" - } + "description": "Mandates" }, { "url": "/risk", @@ -219,9 +192,6 @@ "description": "Risk", "params": { "client": "$ctrl.client" - }, - "menu": { - "icon": "icon-invoices" } }, { @@ -246,9 +216,6 @@ "description": "Recoveries", "params": { "client": "$ctrl.client" - }, - "menu": { - "icon": "icon-recovery" } }, { @@ -259,7 +226,7 @@ "params": { "client": "$ctrl.client" } - }, + }, { "url": "/credit-insurance", "abstract": true, @@ -274,11 +241,7 @@ "description": "Credit contracts", "params": { "client": "$ctrl.client" - }, - "menu": { - "icon": "icon-solunion" - }, - "acl": ["creditInsurance"] + } }, { "url": "/create", @@ -301,6 +264,7 @@ "state": "client.card.creditInsurance.insurance.index", "component": "vn-client-credit-insurance-insurance-index", "description": "Requested credits", + "acl": ["creditInsurance"], "params": { "client": "$ctrl.client" } @@ -321,9 +285,6 @@ "description": "Contacts", "params": { "client": "$ctrl.client" - }, - "menu": { - "icon": "contact_phone" } }, { @@ -339,9 +300,6 @@ "description": "Samples", "params": { "client": "$ctrl.client" - }, - "menu": { - "icon": "mail" } }, { @@ -357,19 +315,37 @@ "url": "/web-payment", "state": "client.card.webPayment", "component": "vn-client-web-payment", - "description": "Web Payment", - "menu": { - "icon": "" - } + "description": "Web Payment" }, { "url" : "/log", "state": "client.card.log", "component": "vn-client-log", - "description": "Log", - "menu": { - "icon": "history" - } + "description": "Log" + } + ], + "menu": [ + {"state": "client.card.basicData", "icon": "settings"}, + {"state": "client.card.fiscalData", "icon": "account_balance"}, + {"state": "client.card.billingData", "icon": "icon-payment"}, + {"state": "client.card.address.index", "icon": "local_shipping"}, + {"state": "client.card.note.index", "icon": "insert_drive_file"}, + {"state": "client.card.credit.index", "icon": "credit_card"}, + {"state": "client.card.greuge.index", "icon": "work"}, + {"state": "client.card.risk.index", "icon": "icon-invoices"}, + {"state": "client.card.recovery.index", "icon": "icon-recovery"}, + {"state": "client.card.log", "icon": "history"}, + { + "description": "Others", + "icon": "more", + "childs": [ + {"state": "client.card.webAccess", "icon": "cloud"}, + {"state": "client.card.mandate", "icon": "pan_tool"}, + {"state": "client.card.creditInsurance.index", "icon": "icon-solunion"}, + {"state": "client.card.contact", "icon": "contact_phone"}, + {"state": "client.card.sample.index", "icon": "mail"}, + {"state": "client.card.webPayment", "icon": ""} + ] } ] } diff --git a/client/client/src/locale/es.yml b/client/client/src/locale/es.yml index 2987c51a12..8cae2a375f 100644 --- a/client/client/src/locale/es.yml +++ b/client/client/src/locale/es.yml @@ -22,7 +22,8 @@ Worker: Trabajador Send: Enviar Sample: Plantilla Credit: Crédito -Are you sure you want to delete this expedition?: Está seguro de borrar esta expedición? +Are you sure you want to delete this expedition?: ¿Está seguro de borrar esta expedición? +Others: Otros # Sections Clients: Clientes diff --git a/client/item/routes.json b/client/item/routes.json index 66a7ebb0b2..d5a098934c 100644 --- a/client/item/routes.json +++ b/client/item/routes.json @@ -37,9 +37,6 @@ "params": { "item": "$ctrl.item" }, - "menu": { - "icon": "settings" - }, "acl": ["buyer"] }, { @@ -50,9 +47,6 @@ "params": { "item-tags": "$ctrl.itemTags" }, - "menu": { - "icon": "icon-tags" - }, "acl": ["buyer"] }, { @@ -60,9 +54,6 @@ "state": "item.card.tax", "component": "vn-item-tax", "description": "Tax", - "menu": { - "icon": "icon-tax" - }, "acl": ["administrative","buyer"] }, { @@ -72,9 +63,6 @@ "description": "History", "params": { "item": "$ctrl.item" - }, - "menu": { - "icon": "history" } }, { @@ -85,9 +73,6 @@ "params": { "item": "$ctrl.item" }, - "menu": { - "icon": "place" - }, "acl": ["buyer","replenisher"] }, { @@ -98,9 +83,6 @@ "params": { "item": "$ctrl.item" }, - "menu": { - "icon": "local_florist" - }, "acl": ["buyer"] }, { @@ -111,9 +93,6 @@ "params": { "item": "$ctrl.item" }, - "menu": { - "icon": "icon-barcode" - }, "acl": ["buyer","replenisher"] }, { @@ -133,9 +112,6 @@ "params": { "item": "$ctrl.item" }, - "menu": { - "icon": "icon-transaction" - }, "acl": ["employee"] }, { @@ -146,10 +122,18 @@ "params": { "item": "$ctrl.item" }, - "menu": { - "icon": "icon-regentry" - }, "acl": ["employee"] } + ], + "menu": [ + {"state": "item.card.data", "icon": "settings"}, + {"state": "item.card.tags", "icon": "icon-tags"}, + {"state": "item.card.tax", "icon": "icon-tax"}, + {"state": "item.card.history", "icon": "history"}, + {"state": "item.card.niche", "icon": "place"}, + {"state": "item.card.botanical", "icon": "local_florist"}, + {"state": "item.card.itemBarcode", "icon": "icon-barcode"}, + {"state": "item.card.diary", "icon": "icon-transaction"}, + {"state": "item.card.last-entries", "icon": "icon-regentry"} ] } \ No newline at end of file diff --git a/client/order/routes.json b/client/order/routes.json index 59d5fd24ef..4a2bf6b61f 100644 --- a/client/order/routes.json +++ b/client/order/routes.json @@ -39,9 +39,6 @@ "description": "Catalog", "params": { "order": "$ctrl.order" - }, - "menu": { - "icon": "shopping_cart" } }, { @@ -51,9 +48,6 @@ "description": "Volume", "params": { "order": "$ctrl.order" - }, - "menu": { - "icon": "icon-volume" } }, { @@ -63,9 +57,6 @@ "description": "Lines", "params": { "order": "$ctrl.order" - }, - "menu": { - "icon": "icon-lines" } }, { @@ -74,5 +65,10 @@ "component": "vn-order-create", "description": "New order" } + ], + "menu": [ + {"state": "order.card.catalog", "icon": "shopping_cart"}, + {"state": "order.card.volume", "icon": "icon-volume"}, + {"state": "order.card.line", "icon": "icon-lines"} ] } \ No newline at end of file diff --git a/client/salix/src/components/index.js b/client/salix/src/components/index.js index 9e8b6f69be..9b0bc46ff3 100644 --- a/client/salix/src/components/index.js +++ b/client/salix/src/components/index.js @@ -2,6 +2,5 @@ import './app/app'; import './home/home'; import './main-menu/main-menu'; import './left-menu/left-menu'; -import './left-menu/menu-item'; import './topbar/topbar'; import './user-configuration-popover' diff --git a/client/salix/src/components/left-menu/left-menu.html b/client/salix/src/components/left-menu/left-menu.html index 50fe2df21d..85a7716bb6 100644 --- a/client/salix/src/components/left-menu/left-menu.html +++ b/client/salix/src/components/left-menu/left-menu.html @@ -1,9 +1,25 @@ - - - -
    - -
-
-
+ + + + + + diff --git a/client/salix/src/components/left-menu/left-menu.js b/client/salix/src/components/left-menu/left-menu.js index 380df87840..204d7ddc1b 100644 --- a/client/salix/src/components/left-menu/left-menu.js +++ b/client/salix/src/components/left-menu/left-menu.js @@ -2,23 +2,46 @@ import ngModule from '../../module'; import './style.scss'; export default class LeftMenu { - constructor(aclService, $state, $transitions) { - this.aclService = aclService; + constructor($state, $transitions) { this.$state = $state; this.deregisterCallback = $transitions.onSuccess({}, transition => this.activateItem()); this._depth = 3; + let states = this.$state.router.stateRegistry.states; + let moduleIndex = this.$state.current.data.moduleIndex; + let moduleFile = window.routes[moduleIndex] || []; + let menu = moduleFile.menu; let items = []; - let routes = this.$state.current.data.routes || []; - routes.forEach(i => { - if (i.menu && this.aclService.routeHasPermission(i)) - items.push({ - description: i.description, - icon: i.menu.icon, - href: i.state - }); - }); + + for (let item of menu) { + let route = states[item.state]; + let newItem = { + icon: item.icon, + childs: [] + }; + + if (item.state && !route) continue; + if (item.state) { + newItem.description = route.self.description; + newItem.state = item.state; + } else { + for (let child of item.childs) { + let route = states[child.state]; + + if(!route) continue; + + newItem.description = item.description; + newItem.childs.push({ + description: route.self.description, + icon: child.icon, + state: child.state + }); + }; + } + + items.push(newItem); + } this.items = items; this.activateItem(); @@ -40,16 +63,30 @@ export default class LeftMenu { .join('.'); let re = new RegExp(`^${myState}(\\..*)?$`); - if (this.items) - for (let item of this.items) - item.active = re.test(item.href); + if (this.items) { + // Check items matching current path + for (let item of this.items) { + item.active = re.test(item.state); + + for (let child of item.childs) { + child.active = re.test(child.state); + if (child.active) + item.active = child.active; + } + } + } + } + + setActive(item) { + if (item.state) return; + item.active = !item.active; } $onDestroy() { this.deregisterCallback(); } } -LeftMenu.$inject = ['aclService', '$state', '$transitions']; +LeftMenu.$inject = ['$state', '$transitions']; ngModule.component('vnLeftMenu', { template: require('./left-menu.html'), diff --git a/client/salix/src/components/left-menu/left-menu.spec.js b/client/salix/src/components/left-menu/left-menu.spec.js index a0686ab68f..6f3fc5796d 100644 --- a/client/salix/src/components/left-menu/left-menu.spec.js +++ b/client/salix/src/components/left-menu/left-menu.spec.js @@ -1,31 +1,25 @@ import './left-menu.js'; describe('Component vnLeftMenu', () => { - let $scope; let $state; - let $httpBackend; let controller; - let aclService; + let $window; beforeEach(() => { angular.mock.module('salix'); }); - beforeEach(angular.mock.inject((_$componentController_, $rootScope, _aclService_, _$state_, _$httpBackend_) => { - $scope = $rootScope.$new(); + beforeEach(angular.mock.inject((_$componentController_, _$state_, _$window_) => { $state = _$state_; - $state.current.data = { - routes: [] - }; $state.current.name = 'client.card.summary'; - aclService = _aclService_; - $httpBackend = _$httpBackend_; - $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); - controller = _$componentController_('vnLeftMenu', {$scope: $scope, $state: $state, aclService: aclService}); + $state.current.data = {moduleIndex: 0}; + $window = _$window_; + $window.routes = [{menu: []}]; + controller = _$componentController_('vnLeftMenu', {$state, $window}); controller.items = [ - {description: 'Client', href: 'client', icon: null}, - {description: 'Client', href: 'client.card', icon: null}, - {description: 'Client summary', href: 'client.card.summary', icon: 'myicon'} + {description: 'Client', state: 'client', icon: null, childs: []}, + {description: 'Client', state: 'client.card', icon: null, childs: []}, + {description: 'Client summary', state: 'client.card.summary', icon: 'myicon', childs: []} ]; })); diff --git a/client/salix/src/components/left-menu/menu-item.html b/client/salix/src/components/left-menu/menu-item.html deleted file mode 100644 index 43a6f68b0b..0000000000 --- a/client/salix/src/components/left-menu/menu-item.html +++ /dev/null @@ -1,9 +0,0 @@ -
  • - - - - {{::$ctrl.item.description}} - -
  • \ No newline at end of file diff --git a/client/salix/src/components/left-menu/menu-item.js b/client/salix/src/components/left-menu/menu-item.js deleted file mode 100644 index f6c93c2daa..0000000000 --- a/client/salix/src/components/left-menu/menu-item.js +++ /dev/null @@ -1,8 +0,0 @@ -import ngModule from '../../module'; - -ngModule.component('vnMenuItem', { - template: require('./menu-item.html'), - bindings: { - item: '<' - } -}); diff --git a/client/salix/src/components/left-menu/style.scss b/client/salix/src/components/left-menu/style.scss index 311d94fccf..98cad3dba1 100644 --- a/client/salix/src/components/left-menu/style.scss +++ b/client/salix/src/components/left-menu/style.scss @@ -1,12 +1,53 @@ @import "effects"; -vn-menu-item { - & > li { - @extend %clickable; +vn-left-menu { + ul { + margin: 0; + padding: 0; + width: 100%; - &.active { + & > li { + list-style: none; + display: block; + + & > ul > li > a { + padding-left: 2em + } + } + + & > li > a { + @extend %clickable; + padding: .5em 1em; + display: block; + + & > vn-icon:nth-child(1) { + vertical-align: middle; + margin-right: .4em + } + + & > vn-icon:nth-child(2) { + float: right; + margin-left: .4em + } + } + + & > li > a.active { background-color: $main-header; color: white; } + + & > li > a.expanded { + & > vn-icon[icon="keyboard_arrow_down"] { + transition: all 0.2s; + transform: rotate(180deg); + } + } + + & > li > a.collapsed { + & > vn-icon[icon="keyboard_arrow_down"] { + transition: all 0.2s; + transform: rotate(0deg); + } + } } } diff --git a/client/salix/src/config-routes.js b/client/salix/src/config-routes.js index 55d667ce89..bfa17c0647 100644 --- a/client/salix/src/config-routes.js +++ b/client/salix/src/config-routes.js @@ -45,6 +45,7 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider, modulesF let moduleName = window.routes[file].module; let validations = window.routes[file].validations || false; let mainModule = modulesFactory.$get().getMainRoute(fileRoutes); + if (mainModule) { let count = fileRoutes.length; for (let i = 0; i < count; i++) { @@ -59,7 +60,7 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider, modulesF loader: loader(moduleName, validations) }, data: { - routes: fileRoutes + moduleIndex: file } }; if (route.abstract) diff --git a/client/ticket/routes.json b/client/ticket/routes.json index ace5892666..084e8b26f0 100644 --- a/client/ticket/routes.json +++ b/client/ticket/routes.json @@ -48,9 +48,6 @@ "description": "Basic data", "params": { "ticket": "$ctrl.data" - }, - "menu": { - "icon": "settings" } }, { @@ -78,9 +75,6 @@ "description": "Sale", "params": { "ticket": "$ctrl.ticket" - }, - "menu": { - "icon": "icon-lines" } }, { @@ -90,9 +84,6 @@ "description": "Notes", "params": { "ticket": "$ctrl.ticket" - }, - "menu": { - "icon": "insert_drive_file" } }, { @@ -102,9 +93,6 @@ "description": "Volume", "params": { "ticket": "$ctrl.ticket" - }, - "menu": { - "icon": "icon-volume" } }, { @@ -114,9 +102,6 @@ "description": "Expedition", "params": { "ticket": "$ctrl.ticket" - }, - "menu": { - "icon": "icon-volum" } }, { @@ -132,9 +117,6 @@ "description": "Packages", "params": { "ticket": "$ctrl.ticket" - }, - "menu": { - "icon": "icon-bucket" } }, { @@ -150,9 +132,6 @@ "description": "Tracking", "params": { "ticket": "$ctrl.ticket" - }, - "menu": { - "icon": "remove_red_eye" } }, { @@ -172,9 +151,6 @@ "description": "Sale checked", "params": { "ticket": "$ctrl.ticket" - }, - "menu": { - "icon": "assignment" } }, { @@ -184,9 +160,6 @@ "description": "Components", "params": { "ticket": "$ctrl.ticket" - }, - "menu": { - "icon": "icon-components" } }, { @@ -196,9 +169,6 @@ "description": "Sale tracking", "params": { "ticket": "$ctrl.ticket" - }, - "menu": { - "icon": "assignment" } }, { @@ -208,28 +178,34 @@ "description": "Pictures", "params": { "ticket": "$ctrl.ticket" - }, - "menu": { - "icon": "image" } }, { "url" : "/log", "state": "ticket.card.log", "component": "vn-ticket-log", - "description": "Log", - "menu": { - "icon": "history" - } + "description": "Log" }, { "url" : "/weekly", "state": "ticket.weekly", "component": "vn-ticket-weekly", - "description": "Weekly", - "menu": { - "icon": "history" - } + "description": "Weekly" } + ], + "menu": [ + {"state": "ticket.card.data.stepOne", "icon": "settings"}, + {"state": "ticket.card.sale", "icon": "icon-lines"}, + {"state": "ticket.card.observation", "icon": "insert_drive_file"}, + {"state": "ticket.card.volume", "icon": "icon-volume"}, + {"state": "ticket.card.expedition", "icon": "icon-volum"}, + {"state": "ticket.card.package.index", "icon": "icon-bucket"}, + {"state": "ticket.card.tracking.index", "icon": "remove_red_eye"}, + {"state": "ticket.card.saleChecked", "icon": "assignment"}, + {"state": "ticket.card.components", "icon": "icon-components"}, + {"state": "ticket.card.saleTracking", "icon": "assignment"}, + {"state": "ticket.card.picture", "icon": "image"}, + {"state": "ticket.card.log", "icon": "history"}, + {"state": "ticket.weekly", "icon": "history"} ] } \ No newline at end of file diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 2dea34a31b..c0b4548579 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -18,7 +18,8 @@ export default { searchClientInput: `${components.vnTextfield}`, searchButton: `vn-searchbar vn-icon[icon="search"]`, searchResult: `vn-item-client a`, - createClientButton: `${components.vnFloatButton}` + createClientButton: `${components.vnFloatButton}`, + othersButton: `vn-left-menu li[name="Others"] > a` }, createClientView: { name: `${components.vnTextfield}[name="name"]`, @@ -32,7 +33,7 @@ export default { cancelButton: `vn-button[href="#!/client/index"]` }, clientBasicData: { - basicDataButton: `vn-menu-item a[ui-sref="client.card.basicData"]`, + basicDataButton: `vn-left-menu a[ui-sref="client.card.basicData"]`, nameInput: `${components.vnTextfield}[name="name"]`, contactInput: `${components.vnTextfield}[name="contact"]`, phoneInput: `${components.vnTextfield}[name="phone"]`, @@ -47,7 +48,7 @@ export default { saveButton: `${components.vnSubmit}` }, clientFiscalData: { - fiscalDataButton: `vn-menu-item a[ui-sref="client.card.fiscalData"]`, + fiscalDataButton: `vn-left-menu a[ui-sref="client.card.fiscalData"]`, socialNameInput: `${components.vnTextfield}[name="socialName"]`, fiscalIdInput: `${components.vnTextfield}[name="fi"]`, equalizationTaxCheckboxLabel: `vn-check[label='Is equalizated'] > label > input`, @@ -74,7 +75,7 @@ export default { saveButton: `${components.vnSubmit}` }, clientPayMethod: { - payMethodButton: `vn-menu-item a[ui-sref="client.card.billingData"]`, + payMethodButton: `vn-left-menu a[ui-sref="client.card.billingData"]`, payMethodInput: `vn-autocomplete[field="$ctrl.client.payMethodFk"] input`, payMethodIBANOption: `vn-autocomplete[field="$ctrl.client.payMethodFk"] vn-drop-down ul > li:nth-child(5)`, payMethodOptionOne: `vn-autocomplete[field="$ctrl.client.payMethodFk"] vn-drop-down ul > li:nth-child(2)`, @@ -91,7 +92,7 @@ export default { saveButton: `${components.vnSubmit}` }, clientAddresses: { - addressesButton: `vn-menu-item a[ui-sref="client.card.address.index"]`, + addressesButton: `vn-left-menu a[ui-sref="client.card.address.index"]`, createAddress: `vn-client-address-index ${components.vnFloatButton}`, defaultCheckboxInput: `vn-check[label='Default'] > label > input`, consigneeInput: `${components.vnTextfield}[name="nickname"]`, @@ -124,27 +125,27 @@ export default { cancelButton: `button[ui-sref="client.card.address.index"]` }, clientWebAccess: { - webAccessButton: `vn-menu-item a[ui-sref="client.card.webAccess"]`, + webAccessButton: `vn-left-menu a[ui-sref="client.card.webAccess"]`, enableWebAccessCheckbox: `vn-check[label='Enable web access'] > label > input`, userNameInput: `${components.vnTextfield}[name="name"]`, saveButton: `${components.vnSubmit}` }, clientNotes: { - notesButton: `vn-menu-item a[ui-sref="client.card.note.index"]`, + notesButton: `vn-left-menu a[ui-sref="client.card.note.index"]`, addNoteFloatButton: `${components.vnFloatButton}`, noteInput: `vn-textarea[label="Note"]`, saveButton: `${components.vnSubmit}`, firstNoteText: 'vn-client-note .text' }, clientCredit: { - creditButton: `vn-menu-item a[ui-sref="client.card.credit.index"]`, + creditButton: `vn-left-menu a[ui-sref="client.card.credit.index"]`, addCreditFloatButton: `${components.vnFloatButton}`, creditInput: `${components.vnTextfield}[name="credit"]`, saveButton: `${components.vnSubmit}`, firstCreditText: 'vn-client-credit-index vn-card > div vn-table vn-tbody > vn-tr' }, clientGreuge: { - greugeButton: `vn-menu-item a[ui-sref="client.card.greuge.index"]`, + greugeButton: `vn-left-menu a[ui-sref="client.card.greuge.index"]`, addGreugeFloatButton: `${components.vnFloatButton}`, amountInput: `${components.vnTextfield}[name="amount"]`, descriptionInput: `${components.vnTextfield}[name="description"]`, @@ -154,15 +155,15 @@ export default { firstGreugeText: 'vn-client-greuge-index vn-card > div vn-table vn-tbody > vn-tr' }, clientMandate: { - mandateButton: `vn-menu-item a[ui-sref="client.card.mandate"]`, + mandateButton: `vn-left-menu a[ui-sref="client.card.mandate"]`, firstMandateText: 'vn-client-mandate vn-card > div vn-table vn-tbody > vn-tr' }, clientInvoices: { - invoicesButton: `vn-menu-item a[ui-sref="client.card.invoice"]`, + invoicesButton: `vn-left-menu a[ui-sref="client.card.invoice"]`, firstInvoiceText: 'vn-client-invoice vn-card > div vn-table vn-tbody > vn-tr' }, clientLog: { - logButton: `vn-menu-item a[ui-sref="client.card.log"]`, + logButton: `vn-left-menu a[ui-sref="client.card.log"]`, lastModificationPreviousValue: 'vn-client-log vn-table vn-td.before', lastModificationCurrentValue: 'vn-client-log vn-table vn-td.after' @@ -191,7 +192,7 @@ export default { }, itemBasicData: { goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]', - basicDataButton: `vn-menu-item a[ui-sref="item.card.data"]`, + basicDataButton: `vn-left-menu a[ui-sref="item.card.data"]`, typeSelect: `vn-autocomplete[field="$ctrl.item.typeFk"] input`, typeSelectOptionThree: `vn-autocomplete[field="$ctrl.item.typeFk"] vn-drop-down ul > li:nth-child(3)`, intrastatSelect: `vn-autocomplete[field="$ctrl.item.intrastatFk"] input`, @@ -208,7 +209,7 @@ export default { }, itemTags: { goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]', - tagsButton: `vn-menu-item a[ui-sref="item.card.tags"]`, + tagsButton: `vn-left-menu a[ui-sref="item.card.tags"]`, firstRemoveTagButton: `vn-item-tags vn-horizontal:nth-child(2) vn-icon-button[icon="remove_circle_outline"]`, firstTagSelect: `vn-item-tags vn-horizontal:nth-child(2) > vn-autocomplete[field="itemTag.tagFk"] input`, firstTagSelectOptionOne: `vn-item-tags vn-horizontal:nth-child(2) > vn-autocomplete[field="itemTag.tagFk"] vn-drop-down ul > li:nth-child(1)`, @@ -237,7 +238,7 @@ export default { submitItemTagsButton: `${components.vnSubmit}` }, itemTax: { - taxButton: `vn-menu-item a[ui-sref="item.card.tax"]`, + taxButton: `vn-left-menu a[ui-sref="item.card.tax"]`, firstClassSelect: `vn-horizontal:nth-child(2) > vn-autocomplete[field="tax.taxClassFk"] input`, firstClassSelectOptionTwo: `vn-horizontal:nth-child(2) > vn-autocomplete vn-drop-down ul > li:nth-child(2)`, secondClassSelect: `vn-horizontal:nth-child(3) > vn-autocomplete[field="tax.taxClassFk"] input`, @@ -247,14 +248,14 @@ export default { submitTaxButton: `${components.vnSubmit}` }, itemBarcodes: { - barcodeButton: `vn-menu-item a[ui-sref="item.card.itemBarcode"]`, + barcodeButton: `vn-left-menu a[ui-sref="item.card.itemBarcode"]`, addBarcodeButton: `vn-icon[icon="add_circle"]`, thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(4) > ${components.vnTextfield}`, submitBarcodesButton: `${components.vnSubmit}`, firstCodeRemoveButton: `vn-item-barcode vn-horizontal vn-none vn-icon[icon="remove_circle_outline"]` }, itemNiches: { - nicheButton: `vn-menu-item a[ui-sref="item.card.niche"]`, + nicheButton: `vn-left-menu a[ui-sref="item.card.niche"]`, addNicheButton: `vn-icon[icon="add_circle"]`, firstWarehouseSelect: `vn-autocomplete[field="niche.warehouseFk"] input`, firstWarehouseSelectSecondOption: `vn-autocomplete[field="niche.warehouseFk"] vn-drop-down ul > li:nth-child(2)`, @@ -268,7 +269,7 @@ export default { submitNichesButton: `${components.vnSubmit}` }, itemBotanical: { - botanicalButton: `vn-menu-item a[ui-sref="item.card.botanical"]`, + botanicalButton: `vn-left-menu a[ui-sref="item.card.botanical"]`, botanicalInput: `vn-horizontal:nth-child(2) > ${components.vnTextfield}`, genusSelect: `vn-autocomplete[field="$ctrl.botanical.genusFk"] input`, genusSelectOptionOne: `vn-autocomplete[field="$ctrl.botanical.genusFk"] vn-drop-down ul > li:nth-child(1)`, @@ -294,7 +295,7 @@ export default { searchButton: `vn-ticket-index vn-searchbar vn-icon[icon="search"]` }, ticketNotes: { - notesButton: `vn-menu-item a[ui-sref="ticket.card.observation"]`, + notesButton: `vn-left-menu a[ui-sref="ticket.card.observation"]`, firstNoteRemoveButton: `vn-icon[icon="remove_circle_outline"]`, addNoteButton: `vn-icon[icon="add_circle"]`, firstNoteSelect: `vn-autocomplete[field="observation.observationTypeFk"] input`, @@ -303,13 +304,13 @@ export default { submitNotesButton: `${components.vnSubmit}` }, ticketExpedition: { - expeditionButton: `vn-menu-item a[ui-sref="ticket.card.expedition"]`, + expeditionButton: `vn-left-menu a[ui-sref="ticket.card.expedition"]`, secondExpeditionRemoveButton: `vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button[icon="delete"]`, acceptDeleteRowButton: `vn-ticket-expedition > vn-confirm[vn-id="delete-expedition"] button[response=ACCEPT]`, expeditionRow: `vn-ticket-expedition vn-table vn-tbody > vn-tr` }, ticketPackages: { - packagesButton: `vn-menu-item a[ui-sref="ticket.card.package.index"]`, + packagesButton: `vn-left-menu a[ui-sref="ticket.card.package.index"]`, firstPackageSelect: `vn-autocomplete[label="Package"] > div > div > input`, firstPackageSelectOptionTwo: `vn-autocomplete[label="Package"] vn-drop-down ul > li:nth-child(2)`, firstQuantityInput: `vn-textfield[label="Quantity"] input`, @@ -322,7 +323,7 @@ export default { saleLine: `vn-table div > vn-tbody > vn-tr`, saleDescriptorPopover: 'vn-ticket-sale vn-item-descriptor-popover > vn-popover', saleDescriptorPopoverSummaryButton: 'vn-item-descriptor-popover a[href="#!/item/1/summary"]', - saleButton: `vn-menu-item a[ui-sref="ticket.card.sale"]`, + saleButton: `vn-left-menu a[ui-sref="ticket.card.sale"]`, descriptorItemDiaryButton: `vn-item-descriptor > vn-card > div > vn-horizontal.quicklinks.ng-scope > vn-horizontal > a > vn-icon > i`, firstSaleText: `vn-table div > vn-tbody > vn-tr:nth-child(1)`, firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(3) > img', @@ -375,7 +376,7 @@ export default { saveButton: `${components.vnSubmit}` }, ticketBasicData: { - basicDataButton: `vn-menu-item a[ui-sref="ticket.card.data.stepOne"]`, + basicDataButton: `vn-left-menu a[ui-sref="ticket.card.data.stepOne"]`, clientSelect: `vn-autocomplete[field="$ctrl.clientFk"] input`, clientSelectThirdOption: `vn-autocomplete[field="$ctrl.clientFk"] vn-drop-down ul > li:nth-child(3)`, addressSelect: `vn-autocomplete[field="$ctrl.ticket.addressFk"] input`, @@ -390,7 +391,7 @@ export default { chargesReasonFirstOption: `vn-autocomplete[field="$ctrl.ticket.option"] vn-drop-down ul > li:nth-child(1)` }, ticketComponents: { - componentsButton: `vn-menu-item a[ui-sref="ticket.card.components"]`, + componentsButton: `vn-left-menu a[ui-sref="ticket.card.components"]`, base: 'vn-ticket-components tfoot > tr:nth-child(1) > td', margin: 'vn-ticket-components tfoot > tr:nth-child(2) > td', total: 'vn-ticket-components tfoot > tr:nth-child(3) > td' @@ -407,7 +408,7 @@ export default { searchButton: `vn-claim-index vn-searchbar vn-icon[icon="search"]` }, claimBasicData: { - basicDataButton: `vn-menu-item a[ui-sref="claim.card.basicData"]`, + basicDataButton: `vn-left-menu a[ui-sref="claim.card.basicData"]`, claimStateSelect: `vn-autocomplete[field="$ctrl.claim.claimStateFk"] input`, claimStateSelectThirdOption: `vn-autocomplete[field="$ctrl.claim.claimStateFk"] vn-drop-down ul > li:nth-child(3)`, claimStateSelectFourthOption: `vn-autocomplete[field="$ctrl.claim.claimStateFk"] vn-drop-down ul > li:nth-child(4)`, @@ -417,7 +418,7 @@ export default { saveButton: `${components.vnSubmit}` }, claimDetails: { - detailsButton: `vn-menu-item a[ui-sref="claim.card.detail"]`, + detailsButton: `vn-left-menu a[ui-sref="claim.card.detail"]`, addItemButton: `vn-claim-detail a vn-float-button` }, }; diff --git a/e2e/paths/client-module/07_edit_web_access.spec.js b/e2e/paths/client-module/07_edit_web_access.spec.js index 5559cd5a24..764220f817 100644 --- a/e2e/paths/client-module/07_edit_web_access.spec.js +++ b/e2e/paths/client-module/07_edit_web_access.spec.js @@ -36,6 +36,7 @@ describe('Client', () => { const url = await nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientsIndex.othersButton) .waitToClick(selectors.clientWebAccess.webAccessButton) .waitForURL('web-access') .url(); @@ -58,6 +59,7 @@ describe('Client', () => { const result = await nightmare .waitToClick(selectors.clientBasicData.basicDataButton) .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientsIndex.othersButton) .waitToClick(selectors.clientWebAccess.webAccessButton) .wait(selectors.clientWebAccess.enableWebAccessCheckbox) .evaluate((selector) => { diff --git a/e2e/paths/client-module/11_mandate.spec.js b/e2e/paths/client-module/11_mandate.spec.js index c036c0f473..2852a130aa 100644 --- a/e2e/paths/client-module/11_mandate.spec.js +++ b/e2e/paths/client-module/11_mandate.spec.js @@ -36,6 +36,7 @@ describe('Client', () => { const url = await nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter') .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientsIndex.othersButton) .waitToClick(selectors.clientMandate.mandateButton) .waitForURL('mandate') .url(); From 452363751ce663a2172279d994aa9489248cadf3 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Tue, 6 Nov 2018 08:56:06 +0100 Subject: [PATCH 2/3] indentation --- .../common/methods/claim/specs/createFromSales.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/claim/common/methods/claim/specs/createFromSales.spec.js b/services/claim/common/methods/claim/specs/createFromSales.spec.js index 8e770fd7f7..adf657393a 100644 --- a/services/claim/common/methods/claim/specs/createFromSales.spec.js +++ b/services/claim/common/methods/claim/specs/createFromSales.spec.js @@ -4,7 +4,7 @@ describe('Claim Create', () => { let newDate = new Date(); let createdClaimFk; - afterAll(async() => { + afterAll(async () => { await app.models.Claim.destroyById(createdClaimFk); }); @@ -23,7 +23,7 @@ describe('Claim Create', () => { let params = {claim: newClaim, sales: newSale}; - it('should create a new claim', async() => { + it('should create a new claim', async () => { let claim = await app.models.Claim.createFromSales(params); expect(claim.ticketFk).toEqual(newClaim.ticketFk); @@ -39,7 +39,7 @@ describe('Claim Create', () => { createdClaimFk = claim.id; }); - it('should not be able to create a claim if exists that sale', async() => { + it('should not be able to create a claim if exists that sale', async () => { let error; await app.models.Claim.createFromSales(params) From 130c91cc786d94f797a81faacfce35332f307119 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 6 Nov 2018 09:03:47 +0100 Subject: [PATCH 3/3] eslint allow brackets on multiline statements --- .eslintrc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index b4b508915d..233dd57c78 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -26,7 +26,7 @@ rules: bracketSpacing: 0 space-infix-ops: 1 prefer-const: 0 - curly: [error, multi] + curly: [error, multi-or-nest] indent: [error, 4] arrow-parens: [error, as-needed] jasmine/no-focused-tests: 0 \ No newline at end of file