From e58d4e5db3451316308d2e2bb196676d0da5ce7e Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 4 Jul 2023 14:42:51 +0200 Subject: [PATCH 1/5] =?UTF-8?q?refs=20#4770=20feat:=20a=C3=B1adida=20secci?= =?UTF-8?q?=C3=B3n=20'Troncales'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/changes/232801/00-roadmap.sql | 10 + db/changes/232801/00-roadmapACL.sql | 4 + db/dump/fixtures.sql | 15 +- front/core/styles/icons/salixfont.css | 805 +++++++++--------- front/core/styles/icons/salixfont.eot | Bin 46420 -> 49176 bytes front/core/styles/icons/salixfont.svg | 7 +- front/core/styles/icons/salixfont.ttf | Bin 46248 -> 49004 bytes front/core/styles/icons/salixfont.woff | Bin 46324 -> 49080 bytes modules/client/front/summary/style.scss | 4 +- modules/entry/front/buy/index/style.scss | 9 +- modules/route/back/methods/roadmap/clone.js | 81 ++ modules/route/back/model-config.json | 14 +- .../route/back/models/expedition-truck.json | 43 + modules/route/back/models/roadmap.js | 3 + modules/route/back/models/roadmap.json | 63 ++ modules/route/front/index.js | 1 + .../route/front/roadmap/basic-data/index.html | 98 +++ .../route/front/roadmap/basic-data/index.js | 16 + modules/route/front/roadmap/card/index.html | 5 + modules/route/front/roadmap/card/index.js | 19 + modules/route/front/roadmap/create/index.html | 37 + modules/route/front/roadmap/create/index.js | 23 + modules/route/front/roadmap/create/style.scss | 6 + .../route/front/roadmap/descriptor/index.html | 39 + .../route/front/roadmap/descriptor/index.js | 26 + .../front/roadmap/descriptor/locale/es.yml | 3 + modules/route/front/roadmap/index.js | 9 + modules/route/front/roadmap/index/index.html | 112 +++ modules/route/front/roadmap/index/index.js | 62 ++ .../route/front/roadmap/index/locale/es.yml | 3 + modules/route/front/roadmap/locale/es.yml | 14 + modules/route/front/roadmap/main/index.html | 20 + modules/route/front/roadmap/main/index.js | 61 ++ .../route/front/roadmap/main/locale/es.yml | 1 + .../front/roadmap/search-panel/index.html | 74 ++ .../route/front/roadmap/search-panel/index.js | 7 + modules/route/front/roadmap/stops/index.html | 71 ++ modules/route/front/roadmap/stops/index.js | 39 + .../route/front/roadmap/stops/locale/es.yml | 4 + .../route/front/roadmap/summary/index.html | 113 +++ modules/route/front/roadmap/summary/index.js | 68 ++ .../route/front/roadmap/summary/locale/es.yml | 3 + .../route/front/roadmap/summary/style.scss | 11 + modules/route/front/routes.json | 47 +- modules/shelving/front/descriptor/index.html | 8 +- .../shelving/front/descriptor/locale/es.yml | 3 + modules/worker/front/create/index.html | 2 +- modules/worker/front/create/locale/es.yml | 2 +- 48 files changed, 1643 insertions(+), 422 deletions(-) create mode 100644 db/changes/232801/00-roadmap.sql create mode 100644 db/changes/232801/00-roadmapACL.sql create mode 100644 modules/route/back/methods/roadmap/clone.js create mode 100644 modules/route/back/models/expedition-truck.json create mode 100644 modules/route/back/models/roadmap.js create mode 100644 modules/route/back/models/roadmap.json create mode 100644 modules/route/front/roadmap/basic-data/index.html create mode 100644 modules/route/front/roadmap/basic-data/index.js create mode 100644 modules/route/front/roadmap/card/index.html create mode 100644 modules/route/front/roadmap/card/index.js create mode 100644 modules/route/front/roadmap/create/index.html create mode 100644 modules/route/front/roadmap/create/index.js create mode 100644 modules/route/front/roadmap/create/style.scss create mode 100644 modules/route/front/roadmap/descriptor/index.html create mode 100644 modules/route/front/roadmap/descriptor/index.js create mode 100644 modules/route/front/roadmap/descriptor/locale/es.yml create mode 100644 modules/route/front/roadmap/index.js create mode 100644 modules/route/front/roadmap/index/index.html create mode 100644 modules/route/front/roadmap/index/index.js create mode 100644 modules/route/front/roadmap/index/locale/es.yml create mode 100644 modules/route/front/roadmap/locale/es.yml create mode 100644 modules/route/front/roadmap/main/index.html create mode 100644 modules/route/front/roadmap/main/index.js create mode 100644 modules/route/front/roadmap/main/locale/es.yml create mode 100644 modules/route/front/roadmap/search-panel/index.html create mode 100644 modules/route/front/roadmap/search-panel/index.js create mode 100644 modules/route/front/roadmap/stops/index.html create mode 100644 modules/route/front/roadmap/stops/index.js create mode 100644 modules/route/front/roadmap/stops/locale/es.yml create mode 100644 modules/route/front/roadmap/summary/index.html create mode 100644 modules/route/front/roadmap/summary/index.js create mode 100644 modules/route/front/roadmap/summary/locale/es.yml create mode 100644 modules/route/front/roadmap/summary/style.scss create mode 100644 modules/shelving/front/descriptor/locale/es.yml diff --git a/db/changes/232801/00-roadmap.sql b/db/changes/232801/00-roadmap.sql new file mode 100644 index 000000000..a2835160f --- /dev/null +++ b/db/changes/232801/00-roadmap.sql @@ -0,0 +1,10 @@ +ALTER TABLE `vn`.`roadmap` COMMENT='Troncales diarios que se contratan'; +ALTER TABLE `vn`.`roadmap` ADD price decimal(10,2) NULL; +ALTER TABLE `vn`.`roadmap` ADD driverName varchar(45) NULL; +ALTER TABLE `vn`.`roadmap` ADD name varchar(45) NOT NULL; +ALTER TABLE `vn`.`roadmap` CHANGE name name varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL AFTER id; +ALTER TABLE `vn`.`roadmap` MODIFY COLUMN etd datetime NOT NULL; + +ALTER TABLE `vn`.`expeditionTruck` COMMENT='Distintas paradas que hacen los trocales'; +ALTER TABLE `vn`.`expeditionTruck` DROP FOREIGN KEY expeditionTruck_FK_2; +ALTER TABLE `vn`.`expeditionTruck` ADD CONSTRAINT expeditionTruck_FK_2 FOREIGN KEY (roadmapFk) REFERENCES vn.roadmap(id) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/db/changes/232801/00-roadmapACL.sql b/db/changes/232801/00-roadmapACL.sql new file mode 100644 index 000000000..8954ecb27 --- /dev/null +++ b/db/changes/232801/00-roadmapACL.sql @@ -0,0 +1,4 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Roadmap', '*', '*', 'ALLOW', 'ROLE', 'employee'), + ('ExpeditionTruck', '*', '*', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 208eb2c21..a5cc2ddbe 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2593,7 +2593,7 @@ UPDATE `vn`.`ticket` UPDATE `vn`.`ticket` SET refFk = 'A1111111' - WHERE id = 6; + WHERE id = 6; INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`) VALUES @@ -2602,9 +2602,18 @@ INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`) (3, 6, 5), (4, 7, 1); -INSERT INTO `vn`.`expeditionTruck` (`id`, `eta`, `description`) +INSERT INTO `vn`.`roadmap` (`id`, `name`, `tractorPlate`, `trailerPlate`, `phone`, `supplierFk`, `etd`, `observations`, `userFk`, `price`, `driverName`) VALUES - (1, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +3 YEAR))), 'Best truck in fleet'); + (1, 'val-algemesi', 'RE-001', 'PO-001', '111111111', 1, util.VN_NOW(), 'this is test observation', 1, 15, 'Batman'), + (2, 'alg-valencia', 'RE-002', 'PO-002', '111111111', 1, util.VN_NOW(), 'test observation', 1, 20, 'Robin'), + (3, 'alz-algemesi', 'RE-003', 'PO-003', '222222222', 2, DATE_ADD(util.VN_NOW(), INTERVAL 2 DAY), 'observations...', 2, 25, 'Driverman'); + +INSERT INTO `vn`.`expeditionTruck` (`id`, `roadmapFk`, `warehouseFk`, `eta`, `description`, `userFk`) + VALUES + (1, 1, 1, DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY), 'Best truck in fleet', 1), + (2, 1, 2, DATE_ADD(util.VN_NOW(), INTERVAL '1 2' DAY_HOUR), 'Second truck in fleet', 1), + (3, 1, 3, DATE_ADD(util.VN_NOW(), INTERVAL '1 4' DAY_HOUR), 'Third truck in fleet', 1), + (4, 2, 1, DATE_ADD(util.VN_NOW(), INTERVAL 3 DAY), 'Truck red', 1); INSERT INTO `vn`.`expeditionPallet` (`id`, `truckFk`, `built`, `position`, `isPrint`) VALUES diff --git a/front/core/styles/icons/salixfont.css b/front/core/styles/icons/salixfont.css index 6f9b1fe15..37f489fe2 100644 --- a/front/core/styles/icons/salixfont.css +++ b/front/core/styles/icons/salixfont.css @@ -1,402 +1,411 @@ @font-face { - font-family: 'salixfont'; - src: - url('./salixfont.ttf?wtrl3') format('truetype'), - url('./salixfont.woff?wtrl3') format('woff'), - url('./salixfont.svg?wtrl3#salixfont') format('svg'); - font-weight: normal; - font-style: normal; -} + font-family: 'salixfont'; + src: + url('./salixfont.ttf?wtrl3') format('truetype'), + url('./salixfont.woff?wtrl3') format('woff'), + url('./salixfont.svg?wtrl3#salixfont') format('svg'); + font-weight: normal; + font-style: normal; + } -[class^="icon-"], [class*=" icon-"] { - /* use !important to prevent issues with browser extensions that change fonts */ - font-family: 'salixfont' !important; - speak: none; - font-style: normal; - font-weight: normal; - font-variant: normal; - text-transform: none; - line-height: 1; + [class^="icon-"], [class*=" icon-"] { + /* use !important to prevent issues with browser extensions that change fonts */ + font-family: 'salixfont' !important; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; - /* Better Font Rendering =========== */ - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } -.icon-agency-term:before { - content: "\e950"; -} -.icon-defaulter:before { - content: "\e94b"; -} -.icon-100:before { - content: "\e95a"; -} -.icon-clientUnpaid:before { - content: "\e95b"; -} -.icon-history:before { - content: "\e968"; -} -.icon-Person:before { - content: "\e901"; -} -.icon-accessory:before { - content: "\e90a"; -} -.icon-account:before { - content: "\e92a"; -} -.icon-actions:before { - content: "\e960"; -} -.icon-addperson:before { - content: "\e90e"; -} -.icon-agency:before { - content: "\e938"; -} -.icon-albaran:before { - content: "\e94d"; -} -.icon-anonymous:before { - content: "\e930"; -} -.icon-apps:before { - content: "\e951"; -} -.icon-artificial:before { - content: "\e90b"; -} -.icon-attach:before { - content: "\e92e"; -} -.icon-barcode:before { - content: "\e971"; -} -.icon-basket:before { - content: "\e914"; -} -.icon-basketadd:before { - content: "\e913"; -} -.icon-bin:before { - content: "\e96f"; -} -.icon-botanical:before { - content: "\e972"; -} -.icon-bucket:before { - content: "\e97a"; -} -.icon-buscaman:before { - content: "\e93b"; -} -.icon-buyrequest:before { - content: "\e932"; -} -.icon-calc_volum .path1:before { - content: "\e915"; -} -.icon-calc_volum .path2:before { - content: "\e916"; - margin-left: -1em; -} -.icon-calc_volum .path3:before { - content: "\e917"; - margin-left: -1em; -} -.icon-calc_volum .path4:before { - content: "\e918"; - margin-left: -1em; -} -.icon-calc_volum .path5:before { - content: "\e919"; - margin-left: -1em; -} -.icon-calc_volum .path6:before { - content: "\e91a"; - margin-left: -1em; -} -.icon-calendar:before { - content: "\e93d"; -} -.icon-catalog:before { - content: "\e937"; -} -.icon-claims:before { - content: "\e963"; -} -.icon-client:before { - content: "\e928"; -} -.icon-clone:before { - content: "\e973"; -} -.icon-columnadd:before { - content: "\e954"; -} -.icon-columndelete:before { - content: "\e953"; -} -.icon-components:before { - content: "\e946"; -} -.icon-consignatarios:before { - content: "\e93f"; -} -.icon-control:before { - content: "\e949"; -} -.icon-credit:before { - content: "\e927"; -} -.icon-deletedTicket:before { - content: "\e935"; -} -.icon-deleteline:before { - content: "\e955"; -} -.icon-delivery:before { - content: "\e939"; -} -.icon-deliveryprices:before { - content: "\e91c"; -} -.icon-details:before { - content: "\e961"; -} -.icon-dfiscales:before { - content: "\e984"; -} -.icon-disabled:before { - content: "\e921"; -} -.icon-doc:before { - content: "\e977"; -} -.icon-entry:before { - content: "\e934"; -} -.icon-exit:before { - content: "\e92f"; -} -.icon-eye:before { - content: "\e976"; -} -.icon-fixedPrice:before { - content: "\e90d"; -} -.icon-flower:before { - content: "\e90c"; -} -.icon-frozen:before { - content: "\e900"; -} -.icon-fruit:before { - content: "\e903"; -} -.icon-funeral:before { - content: "\e904"; -} -.icon-greenery:before { - content: "\e907"; -} -.icon-greuge:before { - content: "\e944"; -} -.icon-grid:before { - content: "\e980"; -} -.icon-handmade:before { - content: "\e909"; -} -.icon-handmadeArtificial:before { - content: "\e902"; -} -.icon-headercol:before { - content: "\e958"; -} -.icon-info:before { - content: "\e952"; -} -.icon-inventory:before { - content: "\e92b"; -} -.icon-invoice:before { - content: "\e923"; -} -.icon-invoice-in:before { - content: "\e911"; -} -.icon-invoice-in-create:before { - content: "\e912"; -} -.icon-invoice-out:before { - content: "\e910"; -} -.icon-isTooLittle:before { - content: "\e91b"; -} -.icon-item:before { - content: "\e956"; -} -.icon-languaje:before { - content: "\e926"; -} -.icon-lines:before { - content: "\e942"; -} -.icon-linesprepaired:before { - content: "\e948"; -} -.icon-logout:before { - content: "\e936"; -} -.icon-mana:before { - content: "\e96a"; -} -.icon-mandatory:before { - content: "\e97b"; -} -.icon-net:before { - content: "\e931"; -} -.icon-niche:before { - content: "\e96c"; -} -.icon-no036:before { - content: "\e920"; -} -.icon-noPayMethod:before { - content: "\e905"; -} -.icon-notes:before { - content: "\e941"; -} -.icon-noweb:before { - content: "\e91f"; -} -.icon-onlinepayment:before { - content: "\e91d"; -} -.icon-package:before { - content: "\e978"; -} -.icon-payment:before { - content: "\e97e"; -} -.icon-pbx:before { - content: "\e93c"; -} -.icon-pets:before { - content: "\e947"; -} -.icon-photo:before { - content: "\e924"; -} -.icon-plant:before { - content: "\e908"; -} -.icon-polizon:before { - content: "\e95e"; -} -.icon-preserved:before { - content: "\e906"; -} -.icon-recovery:before { - content: "\e97c"; -} -.icon-regentry:before { - content: "\e964"; -} -.icon-reserva:before { - content: "\e959"; -} -.icon-revision:before { - content: "\e94a"; -} -.icon-risk:before { - content: "\e91e"; -} -.icon-services:before { - content: "\e94c"; -} -.icon-settings:before { - content: "\e979"; -} -.icon-shipment-01:before { - content: "\e929"; -} -.icon-sign:before { - content: "\e95d"; -} -.icon-sms:before { - content: "\e975"; -} -.icon-solclaim:before { - content: "\e95f"; -} -.icon-solunion:before { - content: "\e94e"; -} -.icon-stowaway:before { - content: "\e94f"; -} -.icon-splitline:before { - content: "\e93e"; -} -.icon-splur:before { - content: "\e970"; -} -.icon-supplier:before { - content: "\e925"; -} -.icon-supplierfalse:before { - content: "\e90f"; -} -.icon-tags:before { - content: "\e96d"; -} -.icon-tax:before { - content: "\e940"; -} -.icon-thermometer:before { - content: "\e933"; -} -.icon-ticket:before { - content: "\e96b"; -} -.icon-ticketAdd:before { - content: "\e945"; -} -.icon-traceability:before { - content: "\e962"; -} -.icon-transaction:before { - content: "\e966"; -} -.icon-treatments:before { - content: "\e922"; -} -.icon-unavailable:before { - content: "\e92c"; -} -.icon-volume:before { - content: "\e96e"; -} -.icon-wand:before { - content: "\e93a"; -} -.icon-web:before { - content: "\e982"; -} -.icon-wiki:before { - content: "\e92d"; -} -.icon-worker:before { - content: "\e957"; -} -.icon-zone:before { - content: "\e943"; -} + .icon-trailer:before { + content: "\e967"; + } + .icon-grafana:before { + content: "\e965"; + } + .icon-trolley:before { + content: "\e95c"; + } + .icon-agency-term:before { + content: "\e950"; + } + .icon-defaulter:before { + content: "\e94b"; + } + .icon-100:before { + content: "\e95a"; + } + .icon-clientUnpaid:before { + content: "\e95b"; + } + .icon-history:before { + content: "\e968"; + } + .icon-Person:before { + content: "\e901"; + } + .icon-accessory:before { + content: "\e90a"; + } + .icon-account:before { + content: "\e92a"; + } + .icon-actions:before { + content: "\e960"; + } + .icon-addperson:before { + content: "\e90e"; + } + .icon-agency:before { + content: "\e938"; + } + .icon-albaran:before { + content: "\e94d"; + } + .icon-anonymous:before { + content: "\e930"; + } + .icon-apps:before { + content: "\e951"; + } + .icon-artificial:before { + content: "\e90b"; + } + .icon-attach:before { + content: "\e92e"; + } + .icon-barcode:before { + content: "\e971"; + } + .icon-basket:before { + content: "\e914"; + } + .icon-basketadd:before { + content: "\e913"; + } + .icon-bin:before { + content: "\e96f"; + } + .icon-botanical:before { + content: "\e972"; + } + .icon-bucket:before { + content: "\e97a"; + } + .icon-buscaman:before { + content: "\e93b"; + } + .icon-buyrequest:before { + content: "\e932"; + } + .icon-calc_volum .path1:before { + content: "\e915"; + } + .icon-calc_volum .path2:before { + content: "\e916"; + margin-left: -1em; + } + .icon-calc_volum .path3:before { + content: "\e917"; + margin-left: -1em; + } + .icon-calc_volum .path4:before { + content: "\e918"; + margin-left: -1em; + } + .icon-calc_volum .path5:before { + content: "\e919"; + margin-left: -1em; + } + .icon-calc_volum .path6:before { + content: "\e91a"; + margin-left: -1em; + } + .icon-calendar:before { + content: "\e93d"; + } + .icon-catalog:before { + content: "\e937"; + } + .icon-claims:before { + content: "\e963"; + } + .icon-client:before { + content: "\e928"; + } + .icon-clone:before { + content: "\e973"; + } + .icon-columnadd:before { + content: "\e954"; + } + .icon-columndelete:before { + content: "\e953"; + } + .icon-components:before { + content: "\e946"; + } + .icon-consignatarios:before { + content: "\e93f"; + } + .icon-control:before { + content: "\e949"; + } + .icon-credit:before { + content: "\e927"; + } + .icon-deletedTicket:before { + content: "\e935"; + } + .icon-deleteline:before { + content: "\e955"; + } + .icon-delivery:before { + content: "\e939"; + } + .icon-deliveryprices:before { + content: "\e91c"; + } + .icon-details:before { + content: "\e961"; + } + .icon-dfiscales:before { + content: "\e984"; + } + .icon-disabled:before { + content: "\e921"; + } + .icon-doc:before { + content: "\e977"; + } + .icon-entry:before { + content: "\e934"; + } + .icon-exit:before { + content: "\e92f"; + } + .icon-eye:before { + content: "\e976"; + } + .icon-fixedPrice:before { + content: "\e90d"; + } + .icon-flower:before { + content: "\e90c"; + } + .icon-frozen:before { + content: "\e900"; + } + .icon-fruit:before { + content: "\e903"; + } + .icon-funeral:before { + content: "\e904"; + } + .icon-greenery:before { + content: "\e907"; + } + .icon-greuge:before { + content: "\e944"; + } + .icon-grid:before { + content: "\e980"; + } + .icon-handmade:before { + content: "\e909"; + } + .icon-handmadeArtificial:before { + content: "\e902"; + } + .icon-headercol:before { + content: "\e958"; + } + .icon-info:before { + content: "\e952"; + } + .icon-inventory:before { + content: "\e92b"; + } + .icon-invoice:before { + content: "\e923"; + } + .icon-invoice-in:before { + content: "\e911"; + } + .icon-invoice-in-create:before { + content: "\e912"; + } + .icon-invoice-out:before { + content: "\e910"; + } + .icon-isTooLittle:before { + content: "\e91b"; + } + .icon-item:before { + content: "\e956"; + } + .icon-languaje:before { + content: "\e926"; + } + .icon-lines:before { + content: "\e942"; + } + .icon-linesprepaired:before { + content: "\e948"; + } + .icon-logout:before { + content: "\e936"; + } + .icon-mana:before { + content: "\e96a"; + } + .icon-mandatory:before { + content: "\e97b"; + } + .icon-net:before { + content: "\e931"; + } + .icon-niche:before { + content: "\e96c"; + } + .icon-no036:before { + content: "\e920"; + } + .icon-noPayMethod:before { + content: "\e905"; + } + .icon-notes:before { + content: "\e941"; + } + .icon-noweb:before { + content: "\e91f"; + } + .icon-onlinepayment:before { + content: "\e91d"; + } + .icon-package:before { + content: "\e978"; + } + .icon-payment:before { + content: "\e97e"; + } + .icon-pbx:before { + content: "\e93c"; + } + .icon-pets:before { + content: "\e947"; + } + .icon-photo:before { + content: "\e924"; + } + .icon-plant:before { + content: "\e908"; + } + .icon-polizon:before { + content: "\e95e"; + } + .icon-preserved:before { + content: "\e906"; + } + .icon-recovery:before { + content: "\e97c"; + } + .icon-regentry:before { + content: "\e964"; + } + .icon-reserva:before { + content: "\e959"; + } + .icon-revision:before { + content: "\e94a"; + } + .icon-risk:before { + content: "\e91e"; + } + .icon-services:before { + content: "\e94c"; + } + .icon-settings:before { + content: "\e979"; + } + .icon-shipment-01:before { + content: "\e929"; + } + .icon-sign:before { + content: "\e95d"; + } + .icon-sms:before { + content: "\e975"; + } + .icon-solclaim:before { + content: "\e95f"; + } + .icon-solunion:before { + content: "\e94e"; + } + .icon-stowaway:before { + content: "\e94f"; + } + .icon-splitline:before { + content: "\e93e"; + } + .icon-splur:before { + content: "\e970"; + } + .icon-supplier:before { + content: "\e925"; + } + .icon-supplierfalse:before { + content: "\e90f"; + } + .icon-tags:before { + content: "\e96d"; + } + .icon-tax:before { + content: "\e940"; + } + .icon-thermometer:before { + content: "\e933"; + } + .icon-ticket:before { + content: "\e96b"; + } + .icon-ticketAdd:before { + content: "\e945"; + } + .icon-traceability:before { + content: "\e962"; + } + .icon-transaction:before { + content: "\e966"; + } + .icon-treatments:before { + content: "\e922"; + } + .icon-unavailable:before { + content: "\e92c"; + } + .icon-volume:before { + content: "\e96e"; + } + .icon-wand:before { + content: "\e93a"; + } + .icon-web:before { + content: "\e982"; + } + .icon-wiki:before { + content: "\e92d"; + } + .icon-worker:before { + content: "\e957"; + } + .icon-zone:before { + content: "\e943"; + } diff --git a/front/core/styles/icons/salixfont.eot b/front/core/styles/icons/salixfont.eot index 61a3be8b7a499b5ad3f597168c821e1139893db8..6a158c806f3d7e215af3cca22ba80fed7ad300b4 100644 GIT binary patch delta 3142 zcmZuzU2Ggz6~5>G&Hv2qdUn@d|L?BXPMo+q`{%?>q6oE3D3%&GaSUn;7*djlgoZY% z(gDnF_a^r?Ly4~QooP(>r8A|B$xcW3OxL9EWq z+_`h^Io~<=-0$qWf9K!-iqM1C7(4ss72T80=EetC4nNa>@7^mjjL`^V?CI01Pn^dy zhxe;^+NaMx^@Zo2eR%`#uQ2wD3uhi(Jyrkmk6vPI!|3eWMU$Bg~zY1pvOtzJCOe!!n(?AOmgf8vX)=Y}5r^va))VB%FM zymgR8eSXalM)lOw#4K0&++0n`rd!8i4Vm! zR%H#ghq0-AtvK1Oy;7Mf=f&ZC zd8$&WmkOBOvqv1h`Tm0V`U@}Iykt$pm8q#pJYhM`?J@t|N53a~Ve>4tK6;0(KmM&@ zr%!AKc&>|U{5WE2#&B%yltwja=tP&w*<`Gtkc?5X&)mxpT}n#5`E0yEcN4xHqHfac zBnN0eH9OryG@nVSm(0<0(yS)c=6>o_q0sI3ItS?hB?qa~=pLYhG!2zIWtOmFma4i| z)ptM}q2dUQ5+0fN?R$HH+Rc`^r-P*3>|rzyY4zF}lvWRz;K%BRRLdfR{oR!8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11P|u$Fc^ReZG3%;fng(%&&ZUUSW&<*i>Zu(VbckqdWF2iT*=h9@SE;Hffqmp z^9u5dOBk4eQVd%GNMGC&70Gw?7lGAO)^ewp$z?PbQx;+Hiq>s~gzY25MxS%y>Y2vcLhh&Av=Rots~Gi*auLI?IA_ zbLE0?DH*$|9QpD5HeVUIS-^%o;A}bwVu0w$Z+4k8Hf&be-OM<7^&SOA=FM03$T51j z*0~k9Gr1?ZZ}5=vSm7z)xyFmno5v@_XOgd#?;XDozY4z<{u=%b{^tTL0x|-60!0E# c0#5{Yg$abkge?lY0yLcwh#NNB?YqSY0AsU==>Px# diff --git a/front/core/styles/icons/salixfont.svg b/front/core/styles/icons/salixfont.svg index d6bfd5d74..da5404842 100644 --- a/front/core/styles/icons/salixfont.svg +++ b/front/core/styles/icons/salixfont.svg @@ -98,7 +98,8 @@ - + + @@ -107,7 +108,9 @@ + + @@ -131,4 +134,4 @@ - + \ No newline at end of file diff --git a/front/core/styles/icons/salixfont.ttf b/front/core/styles/icons/salixfont.ttf index 89d3bd57d3429a743fb9421dd39b7ae8a38b38e7..b484f2a6022b2897ea5e4eff21768a430dce4a00 100644 GIT binary patch delta 3124 zcmZ8jU2I%O6`nIQcjo@z-SypFd;Pz=UORE(?%h8(&W|FLl29Twe@;McfrysmA)zUa zsw6_XLMcd86|^#~)Cbytgp`M(D43r%0ufcEsu1LfK9C30CnTf@5K<8jN#L7%ZO6en zJ9mE0ob#PCXTI^(zwtZw`Kwdu$B(@>#~6(<#$Gyg@`ZEw7BIeouYKyw#jpL~)gRx$ z_$p)Xo5q{QZc=eD@Xk0PXY499x2 zwCYJqC8|=*Cu0SLWP*}MOUjt=KUqwNm$!M{iNMXcF_)M_xgKiF_+39S)kdZ zT~F%m9n`Bsp`Q+VyJ;6CyQ$ae@1or_3zdgup0Hz{>Z(y!4?!EF@)(U1KDqbxw!1{# zcE_|?C+W5a=q*AzgKiF`GXN&|(P>DHJTlndO37A2YouN8;@7CR8k^CydH~svdr80D z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ss index 77fc020ef..7dc1cc928 100644 --- a/modules/client/front/summary/style.scss +++ b/modules/client/front/summary/style.scss @@ -8,7 +8,7 @@ vn-client-summary .summary { } vn-horizontal h4 .grafana:after { - content: 'contact_support'; - font-size: 17px; + font-family: 'salixfont' !important; + content: "\e965"; } } diff --git a/modules/entry/front/buy/index/style.scss b/modules/entry/front/buy/index/style.scss index 04c8d130a..3fad252df 100644 --- a/modules/entry/front/buy/index/style.scss +++ b/modules/entry/front/buy/index/style.scss @@ -3,14 +3,13 @@ vn-entry-buy-index vn-card { max-width: $width-xl; - + .dark-row { background-color: lighten($color-marginal, 10%); } thead tr { - border-left: 1px solid white; - border-right: 1px solid white; + border: 1px solid white;; } tbody tr:nth-child(1), @@ -22,7 +21,7 @@ vn-entry-buy-index vn-card { tbody tr:nth-child(2) { border-bottom: 1px solid $color-spacer; } - + tbody{ border-bottom: 1px solid $color-spacer; } @@ -40,4 +39,4 @@ vn-entry-buy-index vn-card { } } -$color-font-link-medium: lighten($color-font-link, 20%) \ No newline at end of file +$color-font-link-medium: lighten($color-font-link, 20%) diff --git a/modules/route/back/methods/roadmap/clone.js b/modules/route/back/methods/roadmap/clone.js new file mode 100644 index 000000000..456ed823d --- /dev/null +++ b/modules/route/back/methods/roadmap/clone.js @@ -0,0 +1,81 @@ +const UserError = require('vn-loopback/util/user-error'); +module.exports = Self => { + Self.remoteMethod('clone', { + description: 'Clones the selected routes', + accessType: 'WRITE', + accepts: [ + { + arg: 'ids', + type: ['number'], + required: true, + description: 'The routes ids to clone' + }, + { + arg: 'etd', + type: 'date', + required: true, + description: 'The estimated time of departure for all roadmaps' + } + ], + returns: { + type: ['Object'], + root: true + }, + http: { + path: `/clone`, + verb: 'POST' + } + }); + + Self.clone = async(ids, etd) => { + const tx = await Self.beginTransaction({}); + try { + const models = Self.app.models; + const options = {transaction: tx}; + const originalRoadmaps = await models.Roadmap.find({ + where: {id: {inq: ids}}, + fields: [ + 'id', + 'name', + 'tractorPlate', + 'trailerPlate', + 'phone', + 'supplierFk', + 'etd', + 'observations', + 'price'], + include: [{ + relation: 'expeditionTruck', + scope: { + fields: ['roadmapFk', 'warehouseFk', 'eta', 'description'] + } + }] + + }, options); + + if (ids.length != originalRoadmaps.length) + throw new UserError(`The amount of roadmaps found don't match`); + + for (const roadmap of originalRoadmaps) { + roadmap.id = undefined; + roadmap.etd = etd; + + const clone = await models.Roadmap.create(roadmap, options); + + const expeditionTrucks = roadmap.expeditionTruck(); + expeditionTrucks.map(expeditionTruck => { + expeditionTruck.roadmapFk = clone.id; + return expeditionTruck; + }); + await models.ExpeditionTruck.create(expeditionTrucks, options); + } + + await tx.commit(); + + return true; + } catch (e) { + await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/route/back/model-config.json b/modules/route/back/model-config.json index 31aaad9f5..6688a243a 100644 --- a/modules/route/back/model-config.json +++ b/modules/route/back/model-config.json @@ -5,18 +5,22 @@ "AgencyTermConfig": { "dataSource": "vn" }, - "Route": { + "DeliveryPoint": { "dataSource": "vn" }, - "Vehicle": { + "ExpeditionTruck": { + "dataSource": "vn" + }, + "Roadmap": { + "dataSource": "vn" + }, + "Route": { "dataSource": "vn" }, "RouteLog": { "dataSource": "vn" }, - "DeliveryPoint": { + "Vehicle": { "dataSource": "vn" } } - - diff --git a/modules/route/back/models/expedition-truck.json b/modules/route/back/models/expedition-truck.json new file mode 100644 index 000000000..8edc7347f --- /dev/null +++ b/modules/route/back/models/expedition-truck.json @@ -0,0 +1,43 @@ +{ + "name": "ExpeditionTruck", + "base": "VnModel", + "options": { + "mysql": { + "table": "expeditionTruck" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "roadmapFk": { + "type": "number" + }, + "warehouseFk": { + "type": "number" + }, + "eta": { + "type": "date" + }, + "description": { + "type": "string" + }, + "userFk": { + "type": "number" + } + }, + "relations": { + "roadmap": { + "type": "belongsTo", + "model": "Roadmap", + "foreignKey": "roadmapFk" + }, + "warehouse": { + "type": "belongsTo", + "model": "Warehouse", + "foreignKey": "warehouseFk" + } + } +} diff --git a/modules/route/back/models/roadmap.js b/modules/route/back/models/roadmap.js new file mode 100644 index 000000000..4a2a02022 --- /dev/null +++ b/modules/route/back/models/roadmap.js @@ -0,0 +1,3 @@ +module.exports = Self => { + require('../methods/roadmap/clone')(Self); +}; diff --git a/modules/route/back/models/roadmap.json b/modules/route/back/models/roadmap.json new file mode 100644 index 000000000..7ca8fe0f6 --- /dev/null +++ b/modules/route/back/models/roadmap.json @@ -0,0 +1,63 @@ +{ + "name": "Roadmap", + "base": "VnModel", + "options": { + "mysql": { + "table": "roadmap" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string" + }, + "tractorPlate": { + "type": "string" + }, + "trailerPlate": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "supplierFk": { + "type": "number" + }, + "etd": { + "type": "date" + }, + "observations": { + "type": "string" + }, + "userFk": { + "type": "number" + }, + "price": { + "type": "number" + }, + "driverName": { + "type": "string" + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "userFk" + }, + "supplier": { + "type": "belongsTo", + "model": "Supplier", + "foreignKey": "supplierFk" + }, + "expeditionTruck": { + "type": "hasMany", + "model": "ExpeditionTruck", + "foreignKey": "roadmapFk" + } + } +} diff --git a/modules/route/front/index.js b/modules/route/front/index.js index c43048df5..803fc1045 100644 --- a/modules/route/front/index.js +++ b/modules/route/front/index.js @@ -16,3 +16,4 @@ import './agency-term/createInvoiceIn'; import './agency-term-search-panel'; import './ticket-popup'; import './sms'; +import './roadmap'; diff --git a/modules/route/front/roadmap/basic-data/index.html b/modules/route/front/roadmap/basic-data/index.html new file mode 100644 index 000000000..28c67eb47 --- /dev/null +++ b/modules/route/front/roadmap/basic-data/index.html @@ -0,0 +1,98 @@ + + + +
+ + + + + + + + + + + + + + + + + + + {{::id}} - {{::nickname}} + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/modules/route/front/roadmap/basic-data/index.js b/modules/route/front/roadmap/basic-data/index.js new file mode 100644 index 000000000..d5b39b76e --- /dev/null +++ b/modules/route/front/roadmap/basic-data/index.js @@ -0,0 +1,16 @@ +import ngModule from '../../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section { + onSubmit() { + this.$.watcher.submit(); + } +} + +ngModule.component('vnRoadmapBasicData', { + template: require('./index.html'), + controller: Controller, + bindings: { + roadmap: '<' + } +}); diff --git a/modules/route/front/roadmap/card/index.html b/modules/route/front/roadmap/card/index.html new file mode 100644 index 000000000..97ca40f95 --- /dev/null +++ b/modules/route/front/roadmap/card/index.html @@ -0,0 +1,5 @@ + + + + + diff --git a/modules/route/front/roadmap/card/index.js b/modules/route/front/roadmap/card/index.js new file mode 100644 index 000000000..ff2d13616 --- /dev/null +++ b/modules/route/front/roadmap/card/index.js @@ -0,0 +1,19 @@ +import ngModule from '../../module'; +import ModuleCard from 'salix/components/module-card'; + +class Controller extends ModuleCard { + reload() { + const filter = { + include: [ + {relation: 'supplier'} + ] + }; + this.$http.get(`Roadmaps/${this.$params.id}`, {filter}) + .then(res => this.roadmap = res.data); + } +} + +ngModule.vnComponent('vnRoadmapCard', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/route/front/roadmap/create/index.html b/modules/route/front/roadmap/create/index.html new file mode 100644 index 000000000..f5a26566e --- /dev/null +++ b/modules/route/front/roadmap/create/index.html @@ -0,0 +1,37 @@ + + +
+ + + + + + + + + + + + + + + + +
diff --git a/modules/route/front/roadmap/create/index.js b/modules/route/front/roadmap/create/index.js new file mode 100644 index 000000000..7e638da94 --- /dev/null +++ b/modules/route/front/roadmap/create/index.js @@ -0,0 +1,23 @@ +import ngModule from '../../module'; +import Section from 'salix/components/section'; +import './style.scss'; + +class Controller extends Section { + constructor($element, $, $transclude, vnReport, vnEmail) { + super($element, $, $transclude); + this.roadmap = {etd: Date.vnNew()}; + } + + onSubmit() { + this.$.watcher.submit().then( + res => this.$state.go('route.roadmap.card.summary', {id: res.data.id}) + ); + } +} + +Controller.$inject = ['$element', '$scope']; + +ngModule.vnComponent('vnRoadmapCreate', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/route/front/roadmap/create/style.scss b/modules/route/front/roadmap/create/style.scss new file mode 100644 index 000000000..8ee7ecb09 --- /dev/null +++ b/modules/route/front/roadmap/create/style.scss @@ -0,0 +1,6 @@ +vn-ticket-request { + .vn-textfield { + margin: 0!important; + max-width: 100px; + } +} diff --git a/modules/route/front/roadmap/descriptor/index.html b/modules/route/front/roadmap/descriptor/index.html new file mode 100644 index 000000000..92ae8eab1 --- /dev/null +++ b/modules/route/front/roadmap/descriptor/index.html @@ -0,0 +1,39 @@ + + + + Delete roadmap + + + +
+ + + + + + + {{$ctrl.roadmap.supplier.nickname}} + + +
+
+
+ + + + diff --git a/modules/route/front/roadmap/descriptor/index.js b/modules/route/front/roadmap/descriptor/index.js new file mode 100644 index 000000000..2846b073a --- /dev/null +++ b/modules/route/front/roadmap/descriptor/index.js @@ -0,0 +1,26 @@ +import ngModule from '../../module'; +import Descriptor from 'salix/components/descriptor'; + +class Controller extends Descriptor { + get roadmap() { + return this.entity; + } + + set roadmap(value) { + this.entity = value; + } + + onDelete() { + return this.$http.delete(`Roadmaps/${this.roadmap.id}`) + .then(() => this.$state.go('route.roadmap')) + .then(() => this.vnApp.showSuccess(this.$t('Roadmap removed'))); + } +} + +ngModule.component('vnRoadmapDescriptor', { + template: require('./index.html'), + controller: Controller, + bindings: { + roadmap: '<' + } +}); diff --git a/modules/route/front/roadmap/descriptor/locale/es.yml b/modules/route/front/roadmap/descriptor/locale/es.yml new file mode 100644 index 000000000..376209694 --- /dev/null +++ b/modules/route/front/roadmap/descriptor/locale/es.yml @@ -0,0 +1,3 @@ +Delete roadmap: Eliminar troncal +The roadmap will be removed: La troncal será eliminada +Roadmap removed: Troncal eliminada diff --git a/modules/route/front/roadmap/index.js b/modules/route/front/roadmap/index.js new file mode 100644 index 000000000..91b782a9b --- /dev/null +++ b/modules/route/front/roadmap/index.js @@ -0,0 +1,9 @@ +import './main'; +import './index/'; +import './summary'; +import './card'; +import './descriptor'; +import './create'; +import './basic-data'; +import './search-panel'; +import './stops'; diff --git a/modules/route/front/roadmap/index/index.html b/modules/route/front/roadmap/index/index.html new file mode 100644 index 000000000..6f8cbecc4 --- /dev/null +++ b/modules/route/front/roadmap/index/index.html @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + Roadmap + ETD + Carrier + Plate + Price + Observations + + + + + + + + + + {{::roadmap.name}} + {{::roadmap.etd | date:'dd/MM/yyyy HH:mm'}} + + + {{::roadmap.supplier.nickname}} + + + {{::roadmap.tractorPlate | dashIfEmpty}} + {{::roadmap.price | currency: 'EUR':2 | dashIfEmpty}} + {{::roadmap.observations | dashIfEmpty}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/route/front/roadmap/index/index.js b/modules/route/front/roadmap/index/index.js new file mode 100644 index 000000000..3ffc5b4b1 --- /dev/null +++ b/modules/route/front/roadmap/index/index.js @@ -0,0 +1,62 @@ +import ngModule from '../../module'; +import Section from 'salix/components/section'; + +class Controller extends Section { + get checked() { + const roadmaps = this.$.model.data || []; + const checkedRoadmap = []; + for (let roadmap of roadmaps) { + if (roadmap.checked) + checkedRoadmap.push(roadmap); + } + + return checkedRoadmap; + } + + get totalChecked() { + return this.checked.length; + } + + preview(roadmap) { + this.roadmapSelected = roadmap; + this.$.summary.show(); + } + + openClonationDialog() { + this.$.clonationDialog.show(); + this.etd = Date.vnNew(); + } + + cloneSelectedRoadmaps() { + try { + if (!this.etd) + throw new Error(`The date can't be empty`); + + const roadmapsIds = []; + for (let roadmap of this.checked) + roadmapsIds.push(roadmap.id); + + return this.$http.post('Roadmaps/clone', {ids: roadmapsIds, etd: this.etd}).then(() => { + this.$.model.refresh(); + this.vnApp.showSuccess(this.$t('Data saved!')); + }); + } catch (e) { + this.vnApp.showError(this.$t(e.message)); + } + } + + deleteRoadmaps() { + console.log(this.checked); + + for (const roadmap of this.checked) { + this.$http.delete(`Roadmaps/${roadmap.id}`) + .then(() => this.$.model.refresh()) + .then(() => this.vnApp.showSuccess(this.$t('Roadmaps removed'))); + } + } +} + +ngModule.vnComponent('vnRoadmapIndex', { + template: require('./index.html'), + controller: Controller +}); diff --git a/modules/route/front/roadmap/index/locale/es.yml b/modules/route/front/roadmap/index/locale/es.yml new file mode 100644 index 000000000..dd93eac6e --- /dev/null +++ b/modules/route/front/roadmap/index/locale/es.yml @@ -0,0 +1,3 @@ +Delete roadmap(s): Eliminar troncal(es) +Selected roadmaps will be removed: Los troncales seleccionados serán eliminados +Roadmaps removed: Troncales eliminados diff --git a/modules/route/front/roadmap/locale/es.yml b/modules/route/front/roadmap/locale/es.yml new file mode 100644 index 000000000..e136eca31 --- /dev/null +++ b/modules/route/front/roadmap/locale/es.yml @@ -0,0 +1,14 @@ +Roadmaps: Troncales +Roadmap: Troncal +Driver name: Nombre conductor +Plate: Matrícula +Price: Precio +Observations: Observaciones +Clone selected roadmaps: Clonar troncales seleccionadas +Select the estimated time of departure (ETD): Seleccione la hora estimada de salida (ETD) +Create roadmap: Crear troncal +Tractor plate: Matrícula tractor +Trailer plate: Matrícula trailer +Carrier: Transportista +ETD date: Fecha ETD +ETD hour: Hora ETD diff --git a/modules/route/front/roadmap/main/index.html b/modules/route/front/roadmap/main/index.html new file mode 100644 index 000000000..3a8eb2599 --- /dev/null +++ b/modules/route/front/roadmap/main/index.html @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/modules/route/front/roadmap/main/index.js b/modules/route/front/roadmap/main/index.js new file mode 100644 index 000000000..e7b3366f2 --- /dev/null +++ b/modules/route/front/roadmap/main/index.js @@ -0,0 +1,61 @@ +import ngModule from '../../module'; +import ModuleMain from 'salix/components/module-main'; + +export default class Roadmap extends ModuleMain { + constructor($element, $) { + super($element, $); + + this.include = { + relation: 'supplier', + scope: { + fields: ['nickname'] + } + }; + } + + $postLink() { + const from = Date.vnNew(); + from.setHours(0, 0, 0, 0); + + const to = Date.vnNew(); + to.setHours(23, 59, 59, 999); + + this.filterParams = { + from: from, + to: to + }; + + this.$.model.addFilter({where: { + and: [ + {etd: {gte: from}}, + {etd: {lte: to}} + ] + }}); + } + + exprBuilder(param, value) { + switch (param) { + case 'search': + return /^\d+$/.test(value) + ? {id: value} + : {name: {like: `%${value}%`}}; + case 'from': + return {etd: {gte: value}}; + case 'to': + return {etd: {lte: value}}; + case 'supplierFk': + case 'price': + return {[param]: value}; + case 'tractorPlate': + case 'trailerPlate': + case 'phone': + case 'driverName': + return {[param]: {like: `%${value}%`}}; + } + } +} + +ngModule.vnComponent('vnRoadmap', { + controller: Roadmap, + template: require('./index.html') +}); diff --git a/modules/route/front/roadmap/main/locale/es.yml b/modules/route/front/roadmap/main/locale/es.yml new file mode 100644 index 000000000..78342bce8 --- /dev/null +++ b/modules/route/front/roadmap/main/locale/es.yml @@ -0,0 +1 @@ +Search roadmap by id or trunk: Buscar troncales por id o troncal diff --git a/modules/route/front/roadmap/search-panel/index.html b/modules/route/front/roadmap/search-panel/index.html new file mode 100644 index 000000000..53fd37344 --- /dev/null +++ b/modules/route/front/roadmap/search-panel/index.html @@ -0,0 +1,74 @@ +
+
+ + + + +
+ + + + + + +
+ + + + + + + + + + {{::id}} - {{::nickname}} + + + + + + + + + + + + + + +
+
diff --git a/modules/route/front/roadmap/search-panel/index.js b/modules/route/front/roadmap/search-panel/index.js new file mode 100644 index 000000000..499027d14 --- /dev/null +++ b/modules/route/front/roadmap/search-panel/index.js @@ -0,0 +1,7 @@ +import ngModule from '../../module'; +import SearchPanel from 'core/components/searchbar/search-panel'; + +ngModule.component('vnRoadmapSearchPanel', { + template: require('./index.html'), + controller: SearchPanel +}); diff --git a/modules/route/front/roadmap/stops/index.html b/modules/route/front/roadmap/stops/index.html new file mode 100644 index 000000000..b69492a21 --- /dev/null +++ b/modules/route/front/roadmap/stops/index.html @@ -0,0 +1,71 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/modules/route/front/roadmap/stops/index.js b/modules/route/front/roadmap/stops/index.js new file mode 100644 index 000000000..075a1c8a4 --- /dev/null +++ b/modules/route/front/roadmap/stops/index.js @@ -0,0 +1,39 @@ +import ngModule from '../../module'; +import Section from 'salix/components/section'; + +export default class Controller extends Section { + add() { + const filter = { + fields: ['etd'] + }; + this.$http.get(`Roadmaps/${this.$params.id}`, {filter}) + .then(res => { + this.roadmap = res.data; + + const eta = new Date(this.roadmap.etd); + eta.setDate(eta.getDate() + 1); + + this.$.model.insert({ + roadmapFk: this.$params.id, + eta: eta + }); + }); + } + + onSubmit() { + this.$.watcher.check(); + this.$.model.save().then(() => { + this.$.watcher.notifySaved(); + this.$.watcher.updateOriginalData(); + this.$.model.refresh(); + }); + } +} + +ngModule.component('vnRoadmapStops', { + template: require('./index.html'), + controller: Controller, + bindings: { + roadmap: '<' + } +}); diff --git a/modules/route/front/roadmap/stops/locale/es.yml b/modules/route/front/roadmap/stops/locale/es.yml new file mode 100644 index 000000000..1db275949 --- /dev/null +++ b/modules/route/front/roadmap/stops/locale/es.yml @@ -0,0 +1,4 @@ +Remove stop: Eliminar parada +Add stop: Añadir parada +ETA date: Fecha ETA +ETA hour: Hora ETA diff --git a/modules/route/front/roadmap/summary/index.html b/modules/route/front/roadmap/summary/index.html new file mode 100644 index 000000000..e6b50601e --- /dev/null +++ b/modules/route/front/roadmap/summary/index.html @@ -0,0 +1,113 @@ + +
+ {{summary.id}} - {{summary.name}} +
+ + + + + {{summary.supplier.nickname}} + + + + + + + + + + + + + + + + + + +

+ + Stops + + + +

+ + + + Wharehouse + ETA + + + + + {{expeditionTruck.warehouse.name}} + {{expeditionTruck.eta | date:'dd/MM/yyyy HH:mm'}} + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/route/front/roadmap/summary/index.js b/modules/route/front/roadmap/summary/index.js new file mode 100644 index 000000000..041b43ce3 --- /dev/null +++ b/modules/route/front/roadmap/summary/index.js @@ -0,0 +1,68 @@ +import ngModule from '../../module'; +import Component from 'core/lib/component'; +import './style.scss'; + +class Controller extends Component { + set roadmap(value) { + this._roadmap = value; + this.$.summary = null; + if (!value) return; + + this.loadData(); + } + + get roadmap() { + return this._roadmap; + } + + loadData() { + const filter = { + include: [ + {relation: 'supplier'}, + {relation: 'worker'}, + {relation: 'expeditionTruck', + scope: { + include: [ + {relation: 'warehouse'} + ] + }} + ] + }; + this.$http.get(`Roadmaps/${this.roadmap.id}`, {filter}) + .then(res => this.$.summary = res.data); + } + + getETD() { + const eta = new Date(this.roadmap.etd); + eta.setDate(eta.getDate() + 1); + + this.expeditionTruck = {eta: eta}; + } + + onAddAccept() { + try { + const data = { + roadmapFk: this.roadmap.id, + warehouseFk: this.expeditionTruck.warehouseFk, + eta: this.expeditionTruck.eta, + description: this.expeditionTruck.description + }; + + this.$http.post(`ExpeditionTrucks`, data) + .then(() => { + this.loadData(); + this.vnApp.showSuccess(this.$t('Data saved!')); + }); + } catch (e) { + this.vnApp.showError(this.$t(e.message)); + } + } +} + +ngModule.component('vnRoadmapSummary', { + template: require('./index.html'), + controller: Controller, + bindings: { + roadmap: '<' + } +}); diff --git a/modules/route/front/roadmap/summary/locale/es.yml b/modules/route/front/roadmap/summary/locale/es.yml new file mode 100644 index 000000000..f2d82438a --- /dev/null +++ b/modules/route/front/roadmap/summary/locale/es.yml @@ -0,0 +1,3 @@ +Stops: Paradas +Wharehouse: Almacén +You must fill all the fields: Debes rellenar todos los campos diff --git a/modules/route/front/roadmap/summary/style.scss b/modules/route/front/roadmap/summary/style.scss new file mode 100644 index 000000000..8e75d3e0b --- /dev/null +++ b/modules/route/front/roadmap/summary/style.scss @@ -0,0 +1,11 @@ +@import "variables"; + + +vn-roadmap-summary .summary { + a { + display: flex; + align-items: center; + height: 18.328px; + } + +} diff --git a/modules/route/front/routes.json b/modules/route/front/routes.json index 75e1fdc57..3b866581d 100644 --- a/modules/route/front/routes.json +++ b/modules/route/front/routes.json @@ -7,12 +7,17 @@ "menus": { "main": [ {"state": "route.index", "icon": "icon-delivery"}, - {"state": "route.agencyTerm.index", "icon": "icon-agency-term"} + {"state": "route.agencyTerm.index", "icon": "icon-agency-term"}, + {"state": "route.roadmap", "icon": "icon-trailer"} ], "card": [ {"state": "route.card.basicData", "icon": "settings"}, {"state": "route.card.tickets", "icon": "icon-ticket"}, {"state": "route.card.log", "icon": "history"} + ], + "roadmap": [ + {"state": "route.roadmap.card.basicData", "icon": "settings"}, + {"state": "route.roadmap.card.stops", "icon": "icon-lines"} ] }, "routes": [ @@ -90,6 +95,46 @@ "route": "$ctrl.route" }, "acl": ["delivery"] + }, { + "url": "/roadmap?q", + "state": "route.roadmap", + "component": "vn-roadmap", + "description": "Roadmaps" + }, { + "url": "/create", + "state": "route.roadmap.create", + "component": "vn-roadmap-create", + "description": "Create roadmap" + },{ + "url": "/:id", + "state": "route.roadmap.card", + "component": "vn-roadmap-card", + "abstract": true, + "description": "Detail" + },{ + "url": "/summary", + "state": "route.roadmap.card.summary", + "component": "vn-roadmap-summary", + "description": "Summary", + "params": { + "roadmap": "$ctrl.roadmap" + } + },{ + "url": "/basic-data", + "state": "route.roadmap.card.basicData", + "component": "vn-roadmap-basic-data", + "description": "Basic data", + "params": { + "roadmap": "$ctrl.roadmap" + } + }, { + "url": "/stops", + "state": "route.roadmap.card.stops", + "component": "vn-roadmap-stops", + "description": "Stops", + "params": { + "route": "$ctrl.roadmap" + } } ] } diff --git a/modules/shelving/front/descriptor/index.html b/modules/shelving/front/descriptor/index.html index 1344bb52a..53dd37258 100644 --- a/modules/shelving/front/descriptor/index.html +++ b/modules/shelving/front/descriptor/index.html @@ -7,7 +7,7 @@ ng-click="deleteShelving.show()" name="deleteShelving" translate> - Delete + Delete shelving @@ -32,7 +32,7 @@ @@ -40,6 +40,6 @@ - - \ No newline at end of file + diff --git a/modules/shelving/front/descriptor/locale/es.yml b/modules/shelving/front/descriptor/locale/es.yml new file mode 100644 index 000000000..e7fafc320 --- /dev/null +++ b/modules/shelving/front/descriptor/locale/es.yml @@ -0,0 +1,3 @@ +Delete shelving: Eliminar carro +Shelving will be removed: El carro será eliminado +Shelving removed: Carro eliminado diff --git a/modules/worker/front/create/index.html b/modules/worker/front/create/index.html index eb45704a7..481746761 100644 --- a/modules/worker/front/create/index.html +++ b/modules/worker/front/create/index.html @@ -38,7 +38,7 @@ Date: Tue, 4 Jul 2023 15:04:32 +0200 Subject: [PATCH 2/5] refs #4770 feat: add test --- .../back/methods/roadmap/specs/clone.spec.js | 109 ++++++++++++++++++ .../route/front/roadmap/card/index.spec.js | 27 +++++ .../route/front/roadmap/create/index.spec.js | 107 +++++++++++++++++ .../route/front/roadmap/index/index.spec.js | 94 +++++++++++++++ .../route/front/roadmap/main/index.spec.js | 31 +++++ 5 files changed, 368 insertions(+) create mode 100644 modules/route/back/methods/roadmap/specs/clone.spec.js create mode 100644 modules/route/front/roadmap/card/index.spec.js create mode 100644 modules/route/front/roadmap/create/index.spec.js create mode 100644 modules/route/front/roadmap/index/index.spec.js create mode 100644 modules/route/front/roadmap/main/index.spec.js diff --git a/modules/route/back/methods/roadmap/specs/clone.spec.js b/modules/route/back/methods/roadmap/specs/clone.spec.js new file mode 100644 index 000000000..41e696157 --- /dev/null +++ b/modules/route/back/methods/roadmap/specs/clone.spec.js @@ -0,0 +1,109 @@ +const app = require('vn-loopback/server/server'); +const models = require('vn-loopback/server/server').models; + +describe('AgencyTerm filter()', () => { + const authUserId = 9; + const today = Date.vnNew(); + today.setHours(2, 0, 0, 0); + + it('should return all results matching the filter', async() => { + const tx = await models.AgencyTerm.beginTransaction({}); + + try { + const options = {transaction: tx}; + const filter = {}; + const ctx = {req: {accessToken: {userId: authUserId}}}; + + const agencyTerms = await models.AgencyTerm.filter(ctx, filter, options); + const firstAgencyTerm = agencyTerms[0]; + + expect(firstAgencyTerm.routeFk).toEqual(1); + expect(agencyTerms.length).toEqual(5); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return results matching "search" searching by integer', async() => { + let ctx = { + args: { + search: 1, + } + }; + + let result = await app.models.AgencyTerm.filter(ctx); + + expect(result.length).toEqual(1); + expect(result[0].routeFk).toEqual(1); + }); + + it('should return results matching "search" searching by string', async() => { + let ctx = { + args: { + search: 'Plants SL', + } + }; + + let result = await app.models.AgencyTerm.filter(ctx); + + expect(result.length).toEqual(2); + }); + + it('should return results matching "from" and "to"', async() => { + const tx = await models.Buy.beginTransaction({}); + const options = {transaction: tx}; + + try { + const from = Date.vnNew(); + from.setHours(0, 0, 0, 0); + + const to = Date.vnNew(); + to.setHours(23, 59, 59, 999); + + const ctx = { + args: { + from: from, + to: to + } + }; + + const results = await models.AgencyTerm.filter(ctx, options); + + expect(results.length).toBe(5); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return results matching "agencyModeFk"', async() => { + let ctx = { + args: { + agencyModeFk: 1, + } + }; + + let result = await app.models.AgencyTerm.filter(ctx); + + expect(result.length).toEqual(1); + expect(result[0].routeFk).toEqual(1); + }); + + it('should return results matching "agencyFk"', async() => { + let ctx = { + args: { + agencyFk: 2, + } + }; + + let result = await app.models.AgencyTerm.filter(ctx); + + expect(result.length).toEqual(1); + expect(result[0].routeFk).toEqual(2); + }); +}); diff --git a/modules/route/front/roadmap/card/index.spec.js b/modules/route/front/roadmap/card/index.spec.js new file mode 100644 index 000000000..ab2314bb9 --- /dev/null +++ b/modules/route/front/roadmap/card/index.spec.js @@ -0,0 +1,27 @@ +import './index'; + +describe('component vnItemTypeCard', () => { + let controller; + let $httpBackend; + + beforeEach(ngModule('item')); + + beforeEach(inject(($componentController, _$httpBackend_) => { + $httpBackend = _$httpBackend_; + controller = $componentController('vnItemTypeCard', {$element: null}); + })); + + describe('reload()', () => { + it('should reload the controller data', () => { + controller.$params.id = 1; + + const itemType = {id: 1}; + + $httpBackend.expectGET('ItemTypes/1').respond(itemType); + controller.reload(); + $httpBackend.flush(); + + expect(controller.itemType).toEqual(itemType); + }); + }); +}); diff --git a/modules/route/front/roadmap/create/index.spec.js b/modules/route/front/roadmap/create/index.spec.js new file mode 100644 index 000000000..d6d9883a7 --- /dev/null +++ b/modules/route/front/roadmap/create/index.spec.js @@ -0,0 +1,107 @@ +import './index'; +import watcher from 'core/mocks/watcher.js'; + +describe('AgencyTerm', () => { + describe('Component vnAgencyTermCreateInvoiceIn', () => { + let controller; + let $scope; + let $httpBackend; + let $httpParamSerializer; + + beforeEach(ngModule('route')); + + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { + $scope = $rootScope.$new(); + $httpBackend = _$httpBackend_; + $httpParamSerializer = _$httpParamSerializer_; + const $element = angular.element(''); + controller = $componentController('vnAgencyTermCreateInvoiceIn', {$element}); + controller._route = { + id: 1 + }; + })); + + describe('$onChanges()', () => { + it('should update the params data when $params.q is defined', () => { + controller.$params = {q: '{"supplierName": "Plants SL","rows": null}'}; + + const params = {q: '{"supplierName": "Plants SL", "rows": null}'}; + const json = JSON.parse(params.q); + + controller.$onChanges(); + + expect(controller.params).toEqual(json); + }); + }); + + describe('route() setter', () => { + it('should set the ticket data and then call setDefaultParams() and getAllowedContentTypes()', () => { + jest.spyOn(controller, 'setDefaultParams'); + jest.spyOn(controller, 'getAllowedContentTypes'); + controller.route = { + id: 1 + }; + + expect(controller.route).toBeDefined(); + expect(controller.setDefaultParams).toHaveBeenCalledWith(); + expect(controller.getAllowedContentTypes).toHaveBeenCalledWith(); + }); + }); + + describe('getAllowedContentTypes()', () => { + it('should make an HTTP GET request to get the allowed content types', () => { + const expectedResponse = ['image/png', 'image/jpg']; + $httpBackend.expect('GET', `DmsContainers/allowedContentTypes`).respond(expectedResponse); + controller.getAllowedContentTypes(); + $httpBackend.flush(); + + expect(controller.allowedContentTypes).toBeDefined(); + expect(controller.allowedContentTypes).toEqual('image/png, image/jpg'); + }); + }); + + describe('setDefaultParams()', () => { + it('should perform a GET query and define the dms property on controller', () => { + const params = {filter: { + where: {code: 'invoiceIn'} + }}; + const serializedParams = $httpParamSerializer(params); + $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 1, code: 'invoiceIn'}); + controller.params = {supplierName: 'Plants SL'}; + controller.setDefaultParams(); + $httpBackend.flush(); + + expect(controller.dms).toBeDefined(); + expect(controller.dms.dmsTypeId).toEqual(1); + }); + }); + + describe('onSubmit()', () => { + it('should make an HTTP POST request to save the form data', () => { + controller.$.watcher = watcher; + + jest.spyOn(controller.$.watcher, 'updateOriginalData'); + const files = [{id: 1, name: 'MyFile'}]; + controller.dms = {files}; + const serializedParams = $httpParamSerializer(controller.dms); + const query = `dms/uploadFile?${serializedParams}`; + controller.params = {rows: null}; + + $httpBackend.expect('POST', query).respond({}); + $httpBackend.expect('POST', 'AgencyTerms/createInvoiceIn').respond({}); + controller.onSubmit(); + $httpBackend.flush(); + }); + }); + + describe('onFileChange()', () => { + it('should set dms hasFileAttached property to true if has any files', () => { + const files = [{id: 1, name: 'MyFile'}]; + controller.onFileChange(files); + $scope.$apply(); + + expect(controller.dms.hasFileAttached).toBeTruthy(); + }); + }); + }); +}); diff --git a/modules/route/front/roadmap/index/index.spec.js b/modules/route/front/roadmap/index/index.spec.js new file mode 100644 index 000000000..55c40daa5 --- /dev/null +++ b/modules/route/front/roadmap/index/index.spec.js @@ -0,0 +1,94 @@ +import './index.js'; +import crudModel from 'core/mocks/crud-model'; + +describe('AgencyTerm', () => { + describe('Component vnAgencyTermIndex', () => { + let controller; + let $window; + + beforeEach(ngModule('route')); + + beforeEach(inject(($componentController, _$window_) => { + $window = _$window_; + const $element = angular.element(''); + controller = $componentController('vnAgencyTermIndex', {$element}); + controller.$.model = crudModel; + controller.$.model.data = [ + {supplierFk: 1, totalPrice: null}, + {supplierFk: 1}, + {supplierFk: 2} + ]; + })); + + describe('checked() getter', () => { + it('should return the checked lines', () => { + const data = controller.$.model.data; + data[0].checked = true; + + const checkedRows = controller.checked; + + const firstCheckedRow = checkedRows[0]; + + expect(firstCheckedRow.supplierFk).toEqual(1); + }); + }); + + describe('totalCheked() getter', () => { + it('should return the total checked lines', () => { + const data = controller.$.model.data; + data[0].checked = true; + + const checkedRows = controller.totalChecked; + + expect(checkedRows).toEqual(1); + }); + }); + + describe('preview()', () => { + it('should show the summary dialog', () => { + controller.$.summary = {show: () => {}}; + jest.spyOn(controller.$.summary, 'show'); + + let event = new MouseEvent('click', { + view: $window, + bubbles: true, + cancelable: true + }); + const route = {id: 1}; + + controller.preview(event, route); + + expect(controller.$.summary.show).toHaveBeenCalledWith(); + }); + }); + + describe('createInvoiceIn()', () => { + it('should throw an error if more than one autonomous are checked', () => { + jest.spyOn(controller.vnApp, 'showError'); + const data = controller.$.model.data; + data[0].checked = true; + data[2].checked = true; + + controller.createInvoiceIn(); + + expect(controller.vnApp.showError).toHaveBeenCalled(); + }); + + it('should call the function go() on $state to go to the file management', () => { + jest.spyOn(controller.$state, 'go'); + const data = controller.$.model.data; + data[0].checked = true; + + controller.createInvoiceIn(); + + delete data[0].checked; + const params = JSON.stringify({ + supplierName: data[0].supplierName, + rows: [data[0]] + }); + + expect(controller.$state.go).toHaveBeenCalledWith('route.agencyTerm.createInvoiceIn', {q: params}); + }); + }); + }); +}); diff --git a/modules/route/front/roadmap/main/index.spec.js b/modules/route/front/roadmap/main/index.spec.js new file mode 100644 index 000000000..dcb14ec0e --- /dev/null +++ b/modules/route/front/roadmap/main/index.spec.js @@ -0,0 +1,31 @@ +import './index'; + +describe('Item', () => { + describe('Component vnItemType', () => { + let controller; + + beforeEach(ngModule('item')); + + beforeEach(inject($componentController => { + const $element = angular.element(''); + controller = $componentController('vnItemType', {$element}); + })); + + describe('exprBuilder()', () => { + it('should return a filter based on a search by id', () => { + const filter = controller.exprBuilder('search', '123'); + + expect(filter).toEqual({id: '123'}); + }); + + it('should return a filter based on a search by name or code', () => { + const filter = controller.exprBuilder('search', 'Alstroemeria'); + + expect(filter).toEqual({or: [ + {name: {like: '%Alstroemeria%'}}, + {code: {like: '%Alstroemeria%'}}, + ]}); + }); + }); + }); +}); From 6655807d8042cb99de271d40330ebfd6eb652e3f Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 11 Jul 2023 13:50:38 +0200 Subject: [PATCH 3/5] refs #4770 refactor: change acl --- db/changes/232801/00-roadmapACL.sql | 6 ++++-- modules/route/front/roadmap/summary/style.scss | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/db/changes/232801/00-roadmapACL.sql b/db/changes/232801/00-roadmapACL.sql index 8954ecb27..4fc116f86 100644 --- a/db/changes/232801/00-roadmapACL.sql +++ b/db/changes/232801/00-roadmapACL.sql @@ -1,4 +1,6 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES - ('Roadmap', '*', '*', 'ALLOW', 'ROLE', 'employee'), - ('ExpeditionTruck', '*', '*', 'ALLOW', 'ROLE', 'employee'); + ('Roadmap', '*', '*', 'ALLOW', 'ROLE', 'palletizerBoss'), + ('Roadmap', '*', '*', 'ALLOW', 'ROLE', 'productionBoss'), + ('ExpeditionTruck', '*', '*', 'ALLOW', 'ROLE', 'palletizerBoss'), + ('ExpeditionTruck', '*', '*', 'ALLOW', 'ROLE', 'productionBoss'); diff --git a/modules/route/front/roadmap/summary/style.scss b/modules/route/front/roadmap/summary/style.scss index 8e75d3e0b..63b3f625a 100644 --- a/modules/route/front/roadmap/summary/style.scss +++ b/modules/route/front/roadmap/summary/style.scss @@ -1,6 +1,5 @@ @import "variables"; - vn-roadmap-summary .summary { a { display: flex; From 392dc5060a7707c4fa288c7b1b85b67e503903de Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 13 Jul 2023 10:19:12 +0200 Subject: [PATCH 4/5] refs #4770 delete test --- .../route/front/roadmap/card/index.spec.js | 27 ----- .../route/front/roadmap/create/index.spec.js | 107 ------------------ .../route/front/roadmap/index/index.spec.js | 94 --------------- .../route/front/roadmap/main/index.spec.js | 31 ----- modules/ticket/front/descriptor-menu/index.js | 2 +- 5 files changed, 1 insertion(+), 260 deletions(-) delete mode 100644 modules/route/front/roadmap/card/index.spec.js delete mode 100644 modules/route/front/roadmap/create/index.spec.js delete mode 100644 modules/route/front/roadmap/index/index.spec.js delete mode 100644 modules/route/front/roadmap/main/index.spec.js diff --git a/modules/route/front/roadmap/card/index.spec.js b/modules/route/front/roadmap/card/index.spec.js deleted file mode 100644 index ab2314bb9..000000000 --- a/modules/route/front/roadmap/card/index.spec.js +++ /dev/null @@ -1,27 +0,0 @@ -import './index'; - -describe('component vnItemTypeCard', () => { - let controller; - let $httpBackend; - - beforeEach(ngModule('item')); - - beforeEach(inject(($componentController, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - controller = $componentController('vnItemTypeCard', {$element: null}); - })); - - describe('reload()', () => { - it('should reload the controller data', () => { - controller.$params.id = 1; - - const itemType = {id: 1}; - - $httpBackend.expectGET('ItemTypes/1').respond(itemType); - controller.reload(); - $httpBackend.flush(); - - expect(controller.itemType).toEqual(itemType); - }); - }); -}); diff --git a/modules/route/front/roadmap/create/index.spec.js b/modules/route/front/roadmap/create/index.spec.js deleted file mode 100644 index d6d9883a7..000000000 --- a/modules/route/front/roadmap/create/index.spec.js +++ /dev/null @@ -1,107 +0,0 @@ -import './index'; -import watcher from 'core/mocks/watcher.js'; - -describe('AgencyTerm', () => { - describe('Component vnAgencyTermCreateInvoiceIn', () => { - let controller; - let $scope; - let $httpBackend; - let $httpParamSerializer; - - beforeEach(ngModule('route')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { - $scope = $rootScope.$new(); - $httpBackend = _$httpBackend_; - $httpParamSerializer = _$httpParamSerializer_; - const $element = angular.element(''); - controller = $componentController('vnAgencyTermCreateInvoiceIn', {$element}); - controller._route = { - id: 1 - }; - })); - - describe('$onChanges()', () => { - it('should update the params data when $params.q is defined', () => { - controller.$params = {q: '{"supplierName": "Plants SL","rows": null}'}; - - const params = {q: '{"supplierName": "Plants SL", "rows": null}'}; - const json = JSON.parse(params.q); - - controller.$onChanges(); - - expect(controller.params).toEqual(json); - }); - }); - - describe('route() setter', () => { - it('should set the ticket data and then call setDefaultParams() and getAllowedContentTypes()', () => { - jest.spyOn(controller, 'setDefaultParams'); - jest.spyOn(controller, 'getAllowedContentTypes'); - controller.route = { - id: 1 - }; - - expect(controller.route).toBeDefined(); - expect(controller.setDefaultParams).toHaveBeenCalledWith(); - expect(controller.getAllowedContentTypes).toHaveBeenCalledWith(); - }); - }); - - describe('getAllowedContentTypes()', () => { - it('should make an HTTP GET request to get the allowed content types', () => { - const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.expect('GET', `DmsContainers/allowedContentTypes`).respond(expectedResponse); - controller.getAllowedContentTypes(); - $httpBackend.flush(); - - expect(controller.allowedContentTypes).toBeDefined(); - expect(controller.allowedContentTypes).toEqual('image/png, image/jpg'); - }); - }); - - describe('setDefaultParams()', () => { - it('should perform a GET query and define the dms property on controller', () => { - const params = {filter: { - where: {code: 'invoiceIn'} - }}; - const serializedParams = $httpParamSerializer(params); - $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 1, code: 'invoiceIn'}); - controller.params = {supplierName: 'Plants SL'}; - controller.setDefaultParams(); - $httpBackend.flush(); - - expect(controller.dms).toBeDefined(); - expect(controller.dms.dmsTypeId).toEqual(1); - }); - }); - - describe('onSubmit()', () => { - it('should make an HTTP POST request to save the form data', () => { - controller.$.watcher = watcher; - - jest.spyOn(controller.$.watcher, 'updateOriginalData'); - const files = [{id: 1, name: 'MyFile'}]; - controller.dms = {files}; - const serializedParams = $httpParamSerializer(controller.dms); - const query = `dms/uploadFile?${serializedParams}`; - controller.params = {rows: null}; - - $httpBackend.expect('POST', query).respond({}); - $httpBackend.expect('POST', 'AgencyTerms/createInvoiceIn').respond({}); - controller.onSubmit(); - $httpBackend.flush(); - }); - }); - - describe('onFileChange()', () => { - it('should set dms hasFileAttached property to true if has any files', () => { - const files = [{id: 1, name: 'MyFile'}]; - controller.onFileChange(files); - $scope.$apply(); - - expect(controller.dms.hasFileAttached).toBeTruthy(); - }); - }); - }); -}); diff --git a/modules/route/front/roadmap/index/index.spec.js b/modules/route/front/roadmap/index/index.spec.js deleted file mode 100644 index 55c40daa5..000000000 --- a/modules/route/front/roadmap/index/index.spec.js +++ /dev/null @@ -1,94 +0,0 @@ -import './index.js'; -import crudModel from 'core/mocks/crud-model'; - -describe('AgencyTerm', () => { - describe('Component vnAgencyTermIndex', () => { - let controller; - let $window; - - beforeEach(ngModule('route')); - - beforeEach(inject(($componentController, _$window_) => { - $window = _$window_; - const $element = angular.element(''); - controller = $componentController('vnAgencyTermIndex', {$element}); - controller.$.model = crudModel; - controller.$.model.data = [ - {supplierFk: 1, totalPrice: null}, - {supplierFk: 1}, - {supplierFk: 2} - ]; - })); - - describe('checked() getter', () => { - it('should return the checked lines', () => { - const data = controller.$.model.data; - data[0].checked = true; - - const checkedRows = controller.checked; - - const firstCheckedRow = checkedRows[0]; - - expect(firstCheckedRow.supplierFk).toEqual(1); - }); - }); - - describe('totalCheked() getter', () => { - it('should return the total checked lines', () => { - const data = controller.$.model.data; - data[0].checked = true; - - const checkedRows = controller.totalChecked; - - expect(checkedRows).toEqual(1); - }); - }); - - describe('preview()', () => { - it('should show the summary dialog', () => { - controller.$.summary = {show: () => {}}; - jest.spyOn(controller.$.summary, 'show'); - - let event = new MouseEvent('click', { - view: $window, - bubbles: true, - cancelable: true - }); - const route = {id: 1}; - - controller.preview(event, route); - - expect(controller.$.summary.show).toHaveBeenCalledWith(); - }); - }); - - describe('createInvoiceIn()', () => { - it('should throw an error if more than one autonomous are checked', () => { - jest.spyOn(controller.vnApp, 'showError'); - const data = controller.$.model.data; - data[0].checked = true; - data[2].checked = true; - - controller.createInvoiceIn(); - - expect(controller.vnApp.showError).toHaveBeenCalled(); - }); - - it('should call the function go() on $state to go to the file management', () => { - jest.spyOn(controller.$state, 'go'); - const data = controller.$.model.data; - data[0].checked = true; - - controller.createInvoiceIn(); - - delete data[0].checked; - const params = JSON.stringify({ - supplierName: data[0].supplierName, - rows: [data[0]] - }); - - expect(controller.$state.go).toHaveBeenCalledWith('route.agencyTerm.createInvoiceIn', {q: params}); - }); - }); - }); -}); diff --git a/modules/route/front/roadmap/main/index.spec.js b/modules/route/front/roadmap/main/index.spec.js deleted file mode 100644 index dcb14ec0e..000000000 --- a/modules/route/front/roadmap/main/index.spec.js +++ /dev/null @@ -1,31 +0,0 @@ -import './index'; - -describe('Item', () => { - describe('Component vnItemType', () => { - let controller; - - beforeEach(ngModule('item')); - - beforeEach(inject($componentController => { - const $element = angular.element(''); - controller = $componentController('vnItemType', {$element}); - })); - - describe('exprBuilder()', () => { - it('should return a filter based on a search by id', () => { - const filter = controller.exprBuilder('search', '123'); - - expect(filter).toEqual({id: '123'}); - }); - - it('should return a filter based on a search by name or code', () => { - const filter = controller.exprBuilder('search', 'Alstroemeria'); - - expect(filter).toEqual({or: [ - {name: {like: '%Alstroemeria%'}}, - {code: {like: '%Alstroemeria%'}}, - ]}); - }); - }); - }); -}); diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index 0b47102ac..0fc8488ca 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -270,7 +270,7 @@ class Controller extends Section { }); } - return this.$http.post(`Tickets/invoiceTickets`, params) + return this.$http.post(`Tickets/invoiceTickets`, {ticketsIds: [this.id]}) .then(() => this.reload()) .then(() => this.vnApp.showSuccess(this.$t('Ticket invoiced'))); } From c91db1b42922acaccfe7dd562f2b006997b7b8a0 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 13 Jul 2023 10:19:57 +0200 Subject: [PATCH 5/5] a --- back/methods/vn-user/specs/addAlias.spec.js | 68 --------------------- 1 file changed, 68 deletions(-) delete mode 100644 back/methods/vn-user/specs/addAlias.spec.js diff --git a/back/methods/vn-user/specs/addAlias.spec.js b/back/methods/vn-user/specs/addAlias.spec.js deleted file mode 100644 index ef657a3a8..000000000 --- a/back/methods/vn-user/specs/addAlias.spec.js +++ /dev/null @@ -1,68 +0,0 @@ -const {models} = require('vn-loopback/server/server'); - -describe('VnUser addAlias()', () => { - const employeeId = 1; - const sysadminId = 66; - const developerId = 9; - const customerId = 2; - const mailAlias = 1; - it('should throw an error when user not has privileges', async() => { - const ctx = {req: {accessToken: {userId: employeeId}}}; - const tx = await models.VnUser.beginTransaction({}); - - let error; - try { - const options = {transaction: tx}; - - await models.VnUser.addAlias(ctx, employeeId, mailAlias, options); - - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error.message).toContain(`You don't have grant privilege`); - }); - - it('should throw an error when user has privileges but not has the role from user', async() => { - const ctx = {req: {accessToken: {userId: sysadminId}}}; - const tx = await models.VnUser.beginTransaction({}); - - let error; - try { - const options = {transaction: tx}; - - await models.VnUser.addAlias(ctx, employeeId, mailAlias, options); - - await tx.rollback(); - } catch (e) { - error = e; - await tx.rollback(); - } - - expect(error.message).toContain(`You cannot assign an alias that you are not assigned to`); - }); - - it('should add an alias', async() => { - const ctx = {req: {accessToken: {userId: developerId}}}; - const tx = await models.VnUser.beginTransaction({}); - - let result; - try { - const options = {transaction: tx}; - - const user = await models.VnUser.findById(developerId, null, options); - await user.updateAttribute('hasGrant', true, options); - - result = await models.VnUser.addAlias(ctx, customerId, mailAlias, options); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - } - - expect(result.mailAlias).toBe(mailAlias); - expect(result.account).toBe(customerId); - }); -});