From 64124376f0a1d8e85199bff13e9778aa2c95f496 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 14 Nov 2019 14:37:18 +0100 Subject: [PATCH] Final fixes --- .gitignore | 2 +- db/changes/10081-agency/00-zone_getEvents.sql | 41 +++-- .../00-ACL.sql | 0 .../00-travelLog.sql | 0 .../00-upperGap.sql | 0 .../00-userLog.sql | 0 .../00-userPhoneType.sql | 0 .../00-zone.sql | 0 .../01-userPhone.sql | 0 .../01-zone_getAgency.sql | 0 .../01-zone_getFirstShipped.sql | 0 .../01-zone_getLanded.sql | 0 .../01-zone_getShippedWarehouse.sql | 0 .../01-zone_getWarehouse.sql | 0 .../02-catalog_componentCalculate.sql | 0 .../02-ticketCalculate__.sql | 0 .../02-zoneGetAgency.sql | 0 .../02-zoneGetFirstShipped__.sql | 0 .../02-zoneGetLanded.sql | 0 .../02-zoneGetShipped.sql | 0 .../02-zoneGetShippedWarehouse.sql | 0 .../03-available_calc.sql | 0 .../03-catalog_calculate.sql | 0 .../03-order_confirmWithUser.sql | 0 .../03-ticketCalculateClon.sql | 0 .../03-ticketComponentCalculate.sql | 0 .../03-ticketCreateWithUser.sql | 0 .../03-ticketCreateWithoutZone.sql | 0 .../04-zone_getOptionsForDated.sql | 0 .../04-zone_getOptionsForLanding.sql | 0 .../04-zone_getOptionsForShipment.sql | 0 .../05-catalog_calcFromItem.sql | 0 e2e/helpers/extensions.js | 13 +- e2e/paths/01-login/01_login.spec.js | 2 +- front/core/components/drop-down/index.js | 2 +- front/core/components/searchbar/style.scss | 6 +- front/core/styles/variables.scss | 4 +- front/salix/components/index.js | 1 - .../main-menu.spec.js => layout/index..js} | 5 +- front/salix/components/layout/index.html | 28 +-- front/salix/components/layout/index.js | 11 ++ front/salix/components/layout/index.spec.js | 25 +++ front/salix/components/layout/logo-text.svg | 114 +++++++++++++ front/salix/components/layout/logo.svg | 160 +++++++----------- front/salix/components/layout/style.scss | 76 ++++++--- .../salix/components/main-menu/main-menu.html | 15 -- front/salix/components/main-menu/main-menu.js | 29 ---- front/salix/components/main-menu/style.scss | 56 ------ front/salix/components/side-menu/style.scss | 4 +- .../salix/components/user-popover/index.html | 35 ++-- front/salix/components/user-popover/index.js | 5 +- .../salix/components/user-popover/style.scss | 22 ++- front/salix/locale/es.yml | 1 + modules/agency/back/methods/zone/getEvents.js | 16 +- modules/agency/front/delivery-days/index.html | 71 ++++---- modules/agency/front/delivery-days/index.js | 13 +- modules/agency/front/delivery-days/style.scss | 4 + modules/agency/front/routes.json | 2 +- 58 files changed, 416 insertions(+), 347 deletions(-) rename db/changes/{10100-AllSaints => 10100-allSaints}/00-ACL.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/00-travelLog.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/00-upperGap.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/00-userLog.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/00-userPhoneType.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/00-zone.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/01-userPhone.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/01-zone_getAgency.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/01-zone_getFirstShipped.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/01-zone_getLanded.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/01-zone_getShippedWarehouse.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/01-zone_getWarehouse.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/02-catalog_componentCalculate.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/02-ticketCalculate__.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/02-zoneGetAgency.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/02-zoneGetFirstShipped__.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/02-zoneGetLanded.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/02-zoneGetShipped.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/02-zoneGetShippedWarehouse.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/03-available_calc.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/03-catalog_calculate.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/03-order_confirmWithUser.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/03-ticketCalculateClon.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/03-ticketComponentCalculate.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/03-ticketCreateWithUser.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/03-ticketCreateWithoutZone.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/04-zone_getOptionsForDated.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/04-zone_getOptionsForLanding.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/04-zone_getOptionsForShipment.sql (100%) rename db/changes/{10100-AllSaints => 10100-allSaints}/05-catalog_calcFromItem.sql (100%) rename front/salix/components/{main-menu/main-menu.spec.js => layout/index..js} (77%) create mode 100644 front/salix/components/layout/index.spec.js create mode 100644 front/salix/components/layout/logo-text.svg delete mode 100644 front/salix/components/main-menu/main-menu.html delete mode 100644 front/salix/components/main-menu/main-menu.js delete mode 100644 front/salix/components/main-menu/style.scss diff --git a/.gitignore b/.gitignore index 3ef8c28fd..8cb76a829 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ coverage node_modules -dist/* +dist e2e/dms/*/ !e2e/dms/c4c !e2e/dms/c81 diff --git a/db/changes/10081-agency/00-zone_getEvents.sql b/db/changes/10081-agency/00-zone_getEvents.sql index 199074a72..35d95f7bb 100644 --- a/db/changes/10081-agency/00-zone_getEvents.sql +++ b/db/changes/10081-agency/00-zone_getEvents.sql @@ -1,10 +1,12 @@ +USE `vn`; +DROP procedure IF EXISTS `zone_getEvents`; -DROP PROCEDURE IF EXISTS `vn`.`zone_getEvents`; DELIMITER $$ -CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`zone_getEvents`( - vAgencyModeFk INT, +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `zone_getEvents`( vProvinceFk INT, - vPostCode VARCHAR(255)) + vPostCode VARCHAR(255), + vAgencyModeFk INT) BEGIN /** * Returns available events for the passed province/postcode and agency. @@ -13,9 +15,9 @@ BEGIN * @param vProvinceFk The province id * @param vPostCode The postcode or %NULL to use the province */ - DECLARE vGeoFk INT; - - IF vPostCode IS NOT NULL THEN + DECLARE vGeoFk INT; + + IF vPostCode IS NOT NULL THEN SELECT p.geoFk INTO vGeoFk FROM postCode p JOIN town t ON t.id = p.townFk @@ -24,24 +26,27 @@ BEGIN ELSE SELECT geoFk INTO vGeoFk FROM province - WHERE id = vProvinceFk; - END IF; + WHERE id = vProvinceFk; + END IF; - CALL zone_getFromGeo(vGeoFk); - - DELETE t FROM tmp.zone t - JOIN zone z ON z.id = t.id - WHERE z.agencyModeFk != vAgencyModeFk; - - SELECT e.`from`, e.`to`, e.weekDays + CALL zone_getFromGeo(vGeoFk); + + IF vAgencyModeFk IS NOT NULL THEN + DELETE t FROM tmp.zone t + JOIN zone z ON z.id = t.id + WHERE z.agencyModeFk != vAgencyModeFk; + END IF; + + SELECT e.`from`, e.`to`, e.weekDays FROM tmp.zone t JOIN zoneEvent e ON e.zoneFk = t.id; - - SELECT DISTINCT e.`day` + + SELECT DISTINCT e.`day` FROM tmp.zone t JOIN zoneExclusion e ON e.zoneFk = t.id; DROP TEMPORARY TABLE tmp.zone; END$$ + DELIMITER ; diff --git a/db/changes/10100-AllSaints/00-ACL.sql b/db/changes/10100-allSaints/00-ACL.sql similarity index 100% rename from db/changes/10100-AllSaints/00-ACL.sql rename to db/changes/10100-allSaints/00-ACL.sql diff --git a/db/changes/10100-AllSaints/00-travelLog.sql b/db/changes/10100-allSaints/00-travelLog.sql similarity index 100% rename from db/changes/10100-AllSaints/00-travelLog.sql rename to db/changes/10100-allSaints/00-travelLog.sql diff --git a/db/changes/10100-AllSaints/00-upperGap.sql b/db/changes/10100-allSaints/00-upperGap.sql similarity index 100% rename from db/changes/10100-AllSaints/00-upperGap.sql rename to db/changes/10100-allSaints/00-upperGap.sql diff --git a/db/changes/10100-AllSaints/00-userLog.sql b/db/changes/10100-allSaints/00-userLog.sql similarity index 100% rename from db/changes/10100-AllSaints/00-userLog.sql rename to db/changes/10100-allSaints/00-userLog.sql diff --git a/db/changes/10100-AllSaints/00-userPhoneType.sql b/db/changes/10100-allSaints/00-userPhoneType.sql similarity index 100% rename from db/changes/10100-AllSaints/00-userPhoneType.sql rename to db/changes/10100-allSaints/00-userPhoneType.sql diff --git a/db/changes/10100-AllSaints/00-zone.sql b/db/changes/10100-allSaints/00-zone.sql similarity index 100% rename from db/changes/10100-AllSaints/00-zone.sql rename to db/changes/10100-allSaints/00-zone.sql diff --git a/db/changes/10100-AllSaints/01-userPhone.sql b/db/changes/10100-allSaints/01-userPhone.sql similarity index 100% rename from db/changes/10100-AllSaints/01-userPhone.sql rename to db/changes/10100-allSaints/01-userPhone.sql diff --git a/db/changes/10100-AllSaints/01-zone_getAgency.sql b/db/changes/10100-allSaints/01-zone_getAgency.sql similarity index 100% rename from db/changes/10100-AllSaints/01-zone_getAgency.sql rename to db/changes/10100-allSaints/01-zone_getAgency.sql diff --git a/db/changes/10100-AllSaints/01-zone_getFirstShipped.sql b/db/changes/10100-allSaints/01-zone_getFirstShipped.sql similarity index 100% rename from db/changes/10100-AllSaints/01-zone_getFirstShipped.sql rename to db/changes/10100-allSaints/01-zone_getFirstShipped.sql diff --git a/db/changes/10100-AllSaints/01-zone_getLanded.sql b/db/changes/10100-allSaints/01-zone_getLanded.sql similarity index 100% rename from db/changes/10100-AllSaints/01-zone_getLanded.sql rename to db/changes/10100-allSaints/01-zone_getLanded.sql diff --git a/db/changes/10100-AllSaints/01-zone_getShippedWarehouse.sql b/db/changes/10100-allSaints/01-zone_getShippedWarehouse.sql similarity index 100% rename from db/changes/10100-AllSaints/01-zone_getShippedWarehouse.sql rename to db/changes/10100-allSaints/01-zone_getShippedWarehouse.sql diff --git a/db/changes/10100-AllSaints/01-zone_getWarehouse.sql b/db/changes/10100-allSaints/01-zone_getWarehouse.sql similarity index 100% rename from db/changes/10100-AllSaints/01-zone_getWarehouse.sql rename to db/changes/10100-allSaints/01-zone_getWarehouse.sql diff --git a/db/changes/10100-AllSaints/02-catalog_componentCalculate.sql b/db/changes/10100-allSaints/02-catalog_componentCalculate.sql similarity index 100% rename from db/changes/10100-AllSaints/02-catalog_componentCalculate.sql rename to db/changes/10100-allSaints/02-catalog_componentCalculate.sql diff --git a/db/changes/10100-AllSaints/02-ticketCalculate__.sql b/db/changes/10100-allSaints/02-ticketCalculate__.sql similarity index 100% rename from db/changes/10100-AllSaints/02-ticketCalculate__.sql rename to db/changes/10100-allSaints/02-ticketCalculate__.sql diff --git a/db/changes/10100-AllSaints/02-zoneGetAgency.sql b/db/changes/10100-allSaints/02-zoneGetAgency.sql similarity index 100% rename from db/changes/10100-AllSaints/02-zoneGetAgency.sql rename to db/changes/10100-allSaints/02-zoneGetAgency.sql diff --git a/db/changes/10100-AllSaints/02-zoneGetFirstShipped__.sql b/db/changes/10100-allSaints/02-zoneGetFirstShipped__.sql similarity index 100% rename from db/changes/10100-AllSaints/02-zoneGetFirstShipped__.sql rename to db/changes/10100-allSaints/02-zoneGetFirstShipped__.sql diff --git a/db/changes/10100-AllSaints/02-zoneGetLanded.sql b/db/changes/10100-allSaints/02-zoneGetLanded.sql similarity index 100% rename from db/changes/10100-AllSaints/02-zoneGetLanded.sql rename to db/changes/10100-allSaints/02-zoneGetLanded.sql diff --git a/db/changes/10100-AllSaints/02-zoneGetShipped.sql b/db/changes/10100-allSaints/02-zoneGetShipped.sql similarity index 100% rename from db/changes/10100-AllSaints/02-zoneGetShipped.sql rename to db/changes/10100-allSaints/02-zoneGetShipped.sql diff --git a/db/changes/10100-AllSaints/02-zoneGetShippedWarehouse.sql b/db/changes/10100-allSaints/02-zoneGetShippedWarehouse.sql similarity index 100% rename from db/changes/10100-AllSaints/02-zoneGetShippedWarehouse.sql rename to db/changes/10100-allSaints/02-zoneGetShippedWarehouse.sql diff --git a/db/changes/10100-AllSaints/03-available_calc.sql b/db/changes/10100-allSaints/03-available_calc.sql similarity index 100% rename from db/changes/10100-AllSaints/03-available_calc.sql rename to db/changes/10100-allSaints/03-available_calc.sql diff --git a/db/changes/10100-AllSaints/03-catalog_calculate.sql b/db/changes/10100-allSaints/03-catalog_calculate.sql similarity index 100% rename from db/changes/10100-AllSaints/03-catalog_calculate.sql rename to db/changes/10100-allSaints/03-catalog_calculate.sql diff --git a/db/changes/10100-AllSaints/03-order_confirmWithUser.sql b/db/changes/10100-allSaints/03-order_confirmWithUser.sql similarity index 100% rename from db/changes/10100-AllSaints/03-order_confirmWithUser.sql rename to db/changes/10100-allSaints/03-order_confirmWithUser.sql diff --git a/db/changes/10100-AllSaints/03-ticketCalculateClon.sql b/db/changes/10100-allSaints/03-ticketCalculateClon.sql similarity index 100% rename from db/changes/10100-AllSaints/03-ticketCalculateClon.sql rename to db/changes/10100-allSaints/03-ticketCalculateClon.sql diff --git a/db/changes/10100-AllSaints/03-ticketComponentCalculate.sql b/db/changes/10100-allSaints/03-ticketComponentCalculate.sql similarity index 100% rename from db/changes/10100-AllSaints/03-ticketComponentCalculate.sql rename to db/changes/10100-allSaints/03-ticketComponentCalculate.sql diff --git a/db/changes/10100-AllSaints/03-ticketCreateWithUser.sql b/db/changes/10100-allSaints/03-ticketCreateWithUser.sql similarity index 100% rename from db/changes/10100-AllSaints/03-ticketCreateWithUser.sql rename to db/changes/10100-allSaints/03-ticketCreateWithUser.sql diff --git a/db/changes/10100-AllSaints/03-ticketCreateWithoutZone.sql b/db/changes/10100-allSaints/03-ticketCreateWithoutZone.sql similarity index 100% rename from db/changes/10100-AllSaints/03-ticketCreateWithoutZone.sql rename to db/changes/10100-allSaints/03-ticketCreateWithoutZone.sql diff --git a/db/changes/10100-AllSaints/04-zone_getOptionsForDated.sql b/db/changes/10100-allSaints/04-zone_getOptionsForDated.sql similarity index 100% rename from db/changes/10100-AllSaints/04-zone_getOptionsForDated.sql rename to db/changes/10100-allSaints/04-zone_getOptionsForDated.sql diff --git a/db/changes/10100-AllSaints/04-zone_getOptionsForLanding.sql b/db/changes/10100-allSaints/04-zone_getOptionsForLanding.sql similarity index 100% rename from db/changes/10100-AllSaints/04-zone_getOptionsForLanding.sql rename to db/changes/10100-allSaints/04-zone_getOptionsForLanding.sql diff --git a/db/changes/10100-AllSaints/04-zone_getOptionsForShipment.sql b/db/changes/10100-allSaints/04-zone_getOptionsForShipment.sql similarity index 100% rename from db/changes/10100-AllSaints/04-zone_getOptionsForShipment.sql rename to db/changes/10100-allSaints/04-zone_getOptionsForShipment.sql diff --git a/db/changes/10100-AllSaints/05-catalog_calcFromItem.sql b/db/changes/10100-allSaints/05-catalog_calcFromItem.sql similarity index 100% rename from db/changes/10100-AllSaints/05-catalog_calcFromItem.sql rename to db/changes/10100-allSaints/05-catalog_calcFromItem.sql diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 3f021c910..4d6285603 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -45,14 +45,15 @@ let actions = { login: async function(userName) { if (currentUser !== userName) { - let logoutClicked = await this.clickIfExists('#logout'); + let accountClicked = await this.clickIfExists('#user'); - if (logoutClicked) { + if (accountClicked) { let buttonSelector = '.vn-dialog.shown button[response=accept]'; - await this.wait(buttonSelector => { - return document.querySelector(buttonSelector) != null - || location.hash == '#!/login'; - }, buttonSelector); + await this.waitToClick('#logout') + .wait(buttonSelector => { + return document.querySelector(buttonSelector) != null + || location.hash == '#!/login'; + }, buttonSelector); await this.clickIfExists(buttonSelector); } diff --git a/e2e/paths/01-login/01_login.spec.js b/e2e/paths/01-login/01_login.spec.js index 03acc98a8..f612ad23c 100644 --- a/e2e/paths/01-login/01_login.spec.js +++ b/e2e/paths/01-login/01_login.spec.js @@ -30,7 +30,7 @@ describe('Login path', () => { it('should log in', async() => { const url = await nightmare .doLogin('employee', null) - .wait('#logout') + .wait('#user') .parsedUrl(); expect(url.hash).toEqual('#!/'); diff --git a/front/core/components/drop-down/index.js b/front/core/components/drop-down/index.js index 25376841c..9f2dfe424 100644 --- a/front/core/components/drop-down/index.js +++ b/front/core/components/drop-down/index.js @@ -394,7 +394,7 @@ export default class DropDown extends Popover { let filter = { order, - limit: this.limit || 8 + limit: this.limit || 30 }; if (model instanceof CrudModel) { diff --git a/front/core/components/searchbar/style.scss b/front/core/components/searchbar/style.scss index e2f8409b0..31907792c 100644 --- a/front/core/components/searchbar/style.scss +++ b/front/core/components/searchbar/style.scss @@ -2,7 +2,7 @@ vn-searchbar { display: block; - max-width: 30em; + max-width: 35em; margin: 0 auto; .search-params { @@ -10,7 +10,7 @@ vn-searchbar { margin: .05em 0; overflow: visible; display: flex; - max-width: 16em; + max-width: 24em; & > .search-param { color: rgba(0, 0, 0, .6); @@ -19,7 +19,7 @@ vn-searchbar { margin-left: .2em; display: inline-block; border-radius: .8em; - max-width: 18em; + max-width: 12em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; diff --git a/front/core/styles/variables.scss b/front/core/styles/variables.scss index cd918342c..89e487ad7 100644 --- a/front/core/styles/variables.scss +++ b/front/core/styles/variables.scss @@ -36,11 +36,11 @@ $color-font-bg-marginal: rgba(0, 0, 0, .4); $color-font-bg-dark: rgba(255, 255, 255, .7); $color-font-bg-dark-marginal: rgba(255, 255, 255, .4); -$color-header: darken($color-primary, 5%); +$color-header: #3d3d3d; $color-menu-header: #3d3d3d; $color-bg: #e5e5e5; $color-bg-dark: #3d3d3d; -$color-active: $color-primary; +$color-active: #3d3d3d; $color-active-font: $color-font-dark; $color-bg-panel: white; $color-main: $color-primary; diff --git a/front/salix/components/index.js b/front/salix/components/index.js index af8380498..2afd55edf 100644 --- a/front/salix/components/index.js +++ b/front/salix/components/index.js @@ -5,7 +5,6 @@ import './home/home'; import './layout'; import './left-menu/left-menu'; import './login/login'; -import './main-menu/main-menu'; import './module-card'; import './module-main'; import './side-menu/side-menu'; diff --git a/front/salix/components/main-menu/main-menu.spec.js b/front/salix/components/layout/index..js similarity index 77% rename from front/salix/components/main-menu/main-menu.spec.js rename to front/salix/components/layout/index..js index 693bf8291..9fdcfc034 100644 --- a/front/salix/components/main-menu/main-menu.spec.js +++ b/front/salix/components/layout/index..js @@ -1,4 +1,4 @@ -import './main-menu.js'; +import './index.js'; describe('Component vnMainMenu', () => { let $httpBackend; @@ -14,8 +14,7 @@ describe('Component vnMainMenu', () => { describe('getCurrentUserName()', () => { it(`should set the user name property in the controller`, () => { - $httpBackend.when('GET', `Accounts/getCurrentUserData`).respond({name: 'batman'}); - $httpBackend.expect('GET', `Accounts/getCurrentUserData`); + $httpBackend.expect('GET', `Accounts/getUserData`).respond({name: 'batman'}); controller.getCurrentUserName(); $httpBackend.flush(); diff --git a/front/salix/components/layout/index.html b/front/salix/components/layout/index.html index 498189268..0ad400114 100644 --- a/front/salix/components/layout/index.html +++ b/front/salix/components/layout/index.html @@ -5,7 +5,10 @@ ng-if="$ctrl.leftMenu" ng-click="$ctrl.leftMenu.show()"> -
+
+
{{$ctrl.$state.current.description}}
@@ -15,7 +18,7 @@
-
+
+ +
    +
  • + + Home +
  • @@ -39,16 +52,11 @@
+ + -
- - - -
diff --git a/front/salix/components/layout/index.js b/front/salix/components/layout/index.js index f386c5654..883b010ba 100644 --- a/front/salix/components/layout/index.js +++ b/front/salix/components/layout/index.js @@ -7,6 +7,17 @@ export class Layout extends Component { super($element, $); this.modules = vnModules.get(); } + + $onInit() { + this.getUserData(); + } + + getUserData() { + this.$http.get('Accounts/getCurrentUserData').then(json => { + this.$.$root.user = json.data; + window.localStorage.currentUserWorkerId = json.data.workerId; + }); + } } Layout.$inject = ['$element', '$scope', 'vnModules']; diff --git a/front/salix/components/layout/index.spec.js b/front/salix/components/layout/index.spec.js new file mode 100644 index 000000000..7163acb65 --- /dev/null +++ b/front/salix/components/layout/index.spec.js @@ -0,0 +1,25 @@ +import './index.js'; + +describe('Component vnLayout', () => { + let $httpBackend; + let controller; + + beforeEach(ngModule('salix')); + + beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { + let vnModules = {get: () => {}}; + $httpBackend = _$httpBackend_; + let $element = angular.element('
'); + controller = $componentController('vnLayout', {$element, vnModules}); + })); + + describe('getUserData()', () => { + it(`should set the user name property in the controller`, () => { + $httpBackend.expect('GET', `Accounts/getCurrentUserData`).respond({name: 'batman'}); + controller.getUserData(); + $httpBackend.flush(); + + expect(controller.$.$root.user.name).toEqual('batman'); + }); + }); +}); diff --git a/front/salix/components/layout/logo-text.svg b/front/salix/components/layout/logo-text.svg new file mode 100644 index 000000000..53d190b4e --- /dev/null +++ b/front/salix/components/layout/logo-text.svg @@ -0,0 +1,114 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/front/salix/components/layout/logo.svg b/front/salix/components/layout/logo.svg index 53d190b4e..1a111f2f1 100644 --- a/front/salix/components/layout/logo.svg +++ b/front/salix/components/layout/logo.svg @@ -1,5 +1,5 @@ - + image/svg+xml + + + + + + image/svg+xml + + + + + + + + + + \ No newline at end of file + d="m 12,48 c -0.4,0 -0.7,-0.3 -0.7,-0.6 0,-0.4 0.2,-0.7 0.6,-0.8 0,0 3,-0.3 5.5,-3.4 3,-3.8 4.1,-10.1 3,-18.4 C 19.3,16.3 20.6,9.7 24.1,5.3 27.8,0.6 32.5,0 32.7,0 c 0.4,0 0.7,0.2 0.8,0.6 0,0.4 -0.2,0.7 -0.6,0.8 0,0 -4.3,0.6 -7.6,4.7 -3.3,4.2 -4.4,10.4 -3.4,18.5 1.1,8.8 0,15.4 -3.4,19.5 -2.8,3.5 -6.2,3.9 -6.5,3.9 0.1,0 0.1,0 0,0 z" + class="st1" /> + + + diff --git a/front/salix/components/layout/style.scss b/front/salix/components/layout/style.scss index 5d5884e8a..9a9d903a6 100644 --- a/front/salix/components/layout/style.scss +++ b/front/salix/components/layout/style.scss @@ -1,4 +1,4 @@ -@import "variables"; +@import "effects"; vn-layout { & > vn-topbar { @@ -12,13 +12,21 @@ vn-layout { padding: 0 1em; justify-content: space-between; - & > .start { - flex: 1; + & > .side { + flex: auto; display: flex; align-items: center; - overflow: hidden; + width: 5em; + transition: width 200ms; + } + & > .start { padding-right: 1em; + overflow: hidden; + & > .logo > img { + height: 2em; + display: block; + } & > .main-title { font-size: 1.6em; text-overflow: ellipsis; @@ -28,57 +36,46 @@ vn-layout { } & > vn-spinner { padding: 0 .4em; - color: $color-font-dark; } } & > vn-slot { flex: auto; } & > .end { - flex: 1; padding-left: 1em; - align-items: center; justify-content: flex-end; - display: flex; + } + .show-menu { + display: none; } .vn-button { color: inherit; font-size: 1.05em; padding: 0; } - .show-menu { - display: none; - } } & > vn-side-menu > .menu { display: flex; flex-direction: column; align-items: stretch; - & > .header { - background-color: $color-menu-header; - padding: $spacing-md; - color: $color-font-dark; - - & > .logo > img { - width: 100%; - display: block; - } - } & > vn-slot { flex: 1; overflow: auto; } } &.left-menu { - & > vn-topbar { - left: $menu-width; + & > vn-topbar > .start { + width: 5em + $menu-width; } & > .main-view { padding-left: $menu-width; } } &.right-menu { + & > vn-topbar > .end { + width: 5em + $menu-width; + } & > .main-view { padding-right: $menu-width; } @@ -104,6 +101,12 @@ vn-layout { } @media screen and (max-width: $mobile-width) { & > vn-topbar { + & > .start > .logo { + display: none; + } + & > .side { + flex: 1; + } .show-menu { display: block; } @@ -127,3 +130,30 @@ vn-layout { } } } +.vn-popover .modules-menu { + list-style-type: none; + margin: 0; + color: $color-font-dark; + + & > li { + @extend %clickable-light; + background-color: $color-main; + margin-bottom: .6em; + padding: .8em; + border-radius: .1em; + min-width: 8em; + white-space: nowrap; + + &:last-child { + margin-bottom: 0; + } + & > vn-icon { + padding-right: .3em; + vertical-align: middle; + } + } +} +#user { + font-size: 1.5em; + height: auto; +} diff --git a/front/salix/components/main-menu/main-menu.html b/front/salix/components/main-menu/main-menu.html deleted file mode 100644 index 9412de2dc..000000000 --- a/front/salix/components/main-menu/main-menu.html +++ /dev/null @@ -1,15 +0,0 @@ -
- {{$root.user.nickname}} -
- - - - \ No newline at end of file diff --git a/front/salix/components/main-menu/main-menu.js b/front/salix/components/main-menu/main-menu.js deleted file mode 100644 index 2c4d22af5..000000000 --- a/front/salix/components/main-menu/main-menu.js +++ /dev/null @@ -1,29 +0,0 @@ -import ngModule from '../../module'; -import './style.scss'; - -export default class MainMenu { - constructor($, $http, vnAuth) { - Object.assign(this, { - $, - $http, - vnAuth - }); - } - - $onInit() { - this.getCurrentUserName(); - } - - getCurrentUserName() { - this.$http.get('Accounts/getCurrentUserData').then(json => { - this.$.$root.user = json.data; - window.localStorage.currentUserWorkerId = json.data.workerId; - }); - } -} -MainMenu.$inject = ['$scope', '$http', 'vnAuth']; - -ngModule.component('vnMainMenu', { - template: require('./main-menu.html'), - controller: MainMenu -}); diff --git a/front/salix/components/main-menu/style.scss b/front/salix/components/main-menu/style.scss deleted file mode 100644 index 0942a0a95..000000000 --- a/front/salix/components/main-menu/style.scss +++ /dev/null @@ -1,56 +0,0 @@ -@import "effects"; -@import "variables"; - -vn-main-menu { - display: flex; - align-items: center; - justify-content: space-between; - box-sizing: border-box; - - & > * { - transition: color 250ms ease-out; - } - & > #user { - flex: 1; - vertical-align: middle; - font-weight: bold; - margin-right: .2em; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - cursor: pointer; - } - & > .vn-button { - height: initial; - color: inherit; - padding: 0; - } - & > :hover { - color: $color-main; - opacity: 1; - } -} - -.vn-popover .modules-menu { - list-style-type: none; - margin: 0; - color: $color-font-dark; - - & > li { - @extend %clickable-light; - background-color: $color-main; - margin-bottom: .6em; - padding: .8em; - border-radius: .1em; - min-width: 8em; - white-space: nowrap; - - &:last-child { - margin-bottom: 0; - } - & > vn-icon { - padding-right: .3em; - vertical-align: middle; - } - } -} diff --git a/front/salix/components/side-menu/style.scss b/front/salix/components/side-menu/style.scss index 6f1c22f14..239d15cf6 100644 --- a/front/salix/components/side-menu/style.scss +++ b/front/salix/components/side-menu/style.scss @@ -13,19 +13,19 @@ vn-side-menu > .menu { background-color: $color-bg-panel; box-shadow: 0 .1em .2em $color-shadow; overflow: auto; + top: $topbar-height; &.left { left: 0; - top: 0; } &.right { right: 0; - top: $topbar-height; } @media screen and (max-width: $mobile-width) { transition: transform 200ms ease-out; z-index: 15; + top: 0; &.left { transform: translateZ(0) translateX(-$menu-width); diff --git a/front/salix/components/user-popover/index.html b/front/salix/components/user-popover/index.html index 1e17313f1..f34219d26 100644 --- a/front/salix/components/user-popover/index.html +++ b/front/salix/components/user-popover/index.html @@ -13,18 +13,33 @@
- -
-
-
- {{$root.user.nickname}} -
-
- {{::$root.user.name}} + +
+
+
+
+ {{$root.user.nickname}} +
+
+ {{::$root.user.name}} +
+ +
- - + + My account
diff --git a/front/salix/components/user-popover/index.js b/front/salix/components/user-popover/index.js index 5addec4a2..764b0cae9 100644 --- a/front/salix/components/user-popover/index.js +++ b/front/salix/components/user-popover/index.js @@ -12,11 +12,12 @@ let languages = { }; class Controller { - constructor($, $translate, vnConfig) { + constructor($, $translate, vnConfig, vnAuth) { Object.assign(this, { $, $translate, vnConfig, + vnAuth, lang: $translate.use(), langs: [] }); @@ -86,7 +87,7 @@ class Controller { this.$.popover.show(event.target); } } -Controller.$inject = ['$scope', '$translate', 'vnConfig']; +Controller.$inject = ['$scope', '$translate', 'vnConfig', 'vnAuth']; ngModule.component('vnUserPopover', { template: require('./index.html'), diff --git a/front/salix/components/user-popover/style.scss b/front/salix/components/user-popover/style.scss index 5d1745ca1..c8325c9f6 100644 --- a/front/salix/components/user-popover/style.scss +++ b/front/salix/components/user-popover/style.scss @@ -8,11 +8,8 @@ align-items: center; & > vn-icon { - font-size: 60px; - border-radius: 50%; - color: $color-font-dark; - background: $color-marginal; - padding: .1em; + font-size: 80px; + color: $color-font-bg-marginal; } & > div { display: flex; @@ -20,10 +17,21 @@ justify-content: space-between; flex: 1; - & > .user { - max-width: 10em; + & > div { + display: flex; padding-bottom: .5em; + + & > .user { + flex: 1; + max-width: 8em; + } } } } +} +#logout { + float: right; + height: initial; + vertical-align: middle; + font-size: 1em; } \ No newline at end of file diff --git a/front/salix/locale/es.yml b/front/salix/locale/es.yml index a7f1dc93a..2f65ab255 100644 --- a/front/salix/locale/es.yml +++ b/front/salix/locale/es.yml @@ -1,4 +1,5 @@ Applications: Aplicaciones +Account: Cuenta Language: Idioma Change language: Cambiar idioma Data saved!: ¡Datos guardados! diff --git a/modules/agency/back/methods/zone/getEvents.js b/modules/agency/back/methods/zone/getEvents.js index b294222b5..1c70dfffd 100644 --- a/modules/agency/back/methods/zone/getEvents.js +++ b/modules/agency/back/methods/zone/getEvents.js @@ -4,19 +4,18 @@ module.exports = Self => { description: 'Returns delivery days for a postcode', accepts: [ { - arg: 'agencyModeFk', - type: 'Number', - description: 'The agency mode id', - required: true - }, { arg: 'provinceFk', type: 'Number', description: 'The province id', required: true }, { - arg: 'postCode', + arg: 'search', type: 'String', description: 'The postcode' + }, { + arg: 'agencyModeFk', + type: 'Number', + description: 'The agency mode id' } ], returns: { @@ -29,12 +28,11 @@ module.exports = Self => { } }); - Self.getEvents = async(agencyModeFk, provinceFk, postCode) => { + Self.getEvents = async(provinceFk, postCode, agencyModeFk) => { let [events, exclusions] = await Self.rawSql( `CALL zone_getEvents(?, ?, ?)`, - [agencyModeFk, provinceFk, postCode] + [provinceFk, postCode, agencyModeFk] ); - return {events, exclusions}; }; }; diff --git a/modules/agency/front/delivery-days/index.html b/modules/agency/front/delivery-days/index.html index dca452c63..2b8a0e423 100644 --- a/modules/agency/front/delivery-days/index.html +++ b/modules/agency/front/delivery-days/index.html @@ -1,46 +1,33 @@
-
- - - - - - - - -
{{name}}
-
- {{country.country}} -
-
-
- - -
-
- - -
+ data="data">
+ +
+ + +
{{name}}
+
+ {{country.country}} +
+
+
+ + + + + +
+
diff --git a/modules/agency/front/delivery-days/index.js b/modules/agency/front/delivery-days/index.js index cebfdbf7e..e9c885a13 100644 --- a/modules/agency/front/delivery-days/index.js +++ b/modules/agency/front/delivery-days/index.js @@ -1,20 +1,17 @@ import ngModule from '../module'; +import Section from 'salix/components/section'; import './style.scss'; -class Controller { - constructor($, $http) { - Object.assign(this, { - $, - $http - }); +class Controller extends Section { + $onInit() { + this.$.params = {}; } onSubmit() { - this.$http.get(`Zones/getEvents`, {params: this.params}) + this.$http.get(`Zones/getEvents`, {params: this.$.params}) .then(res => this.$.data = res.data); } } -Controller.$inject = ['$scope', '$http']; ngModule.component('vnZoneDeliveryDays', { template: require('./index.html'), diff --git a/modules/agency/front/delivery-days/style.scss b/modules/agency/front/delivery-days/style.scss index 1db8edfbf..79f95a3dc 100644 --- a/modules/agency/front/delivery-days/style.scss +++ b/modules/agency/front/delivery-days/style.scss @@ -9,4 +9,8 @@ vn-zone-delivery-days { min-width: 16.5em; } } + form { + display: flex; + flex-direction: column; + } } \ No newline at end of file diff --git a/modules/agency/front/routes.json b/modules/agency/front/routes.json index f16875620..7c5b1338d 100644 --- a/modules/agency/front/routes.json +++ b/modules/agency/front/routes.json @@ -29,7 +29,7 @@ "component": "vn-zone-index", "description": "Zones" }, { - "url": "/delivery-days", + "url": "/delivery-days?q", "state": "zone.deliveryDays", "component": "vn-zone-delivery-days", "description": "Delivery days"