From 87add6cd337a4edb0d5131ccab9aea47330b5fbf Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 2 Oct 2019 19:24:42 +0200 Subject: [PATCH 01/13] vnDataViewer --- front/core/components/data-viewer/index.html | 25 +++ front/core/components/data-viewer/index.js | 39 ++++ front/core/components/data-viewer/style.scss | 14 ++ front/core/components/index.js | 1 + front/core/components/table/index.html | 11 +- front/core/components/table/index.js | 12 -- front/salix/styles/list.scss | 2 +- front/salix/styles/variables.scss | 2 +- modules/agency/front/basic-data/index.html | 16 +- modules/agency/front/events/index.html | 17 +- modules/agency/front/exclusions/index.html | 39 ++-- modules/agency/front/index/index.html | 33 ++-- modules/agency/front/warehouses/index.html | 15 +- modules/client/front/address/index/index.html | 129 ++++++------- modules/client/front/balance/index/index.html | 14 +- .../front/credit-insurance/index/index.html | 103 +++++----- modules/client/front/credit/index/index.html | 43 +++-- modules/client/front/dms/index/index.html | 179 +++++++++--------- modules/client/front/greuge/index/index.html | 7 +- modules/client/front/index/index.html | 81 ++++---- modules/client/front/mandate/index.html | 50 ++--- modules/client/front/note/index/index.html | 10 +- .../client/front/recovery/index/index.html | 68 +++---- modules/client/front/sample/index/index.html | 19 +- modules/client/front/web-payment/index.html | 91 ++++----- .../client/front/web-payment/locale/es.yml | 1 - modules/worker/front/log/index.html | 6 +- 27 files changed, 554 insertions(+), 473 deletions(-) create mode 100644 front/core/components/data-viewer/index.html create mode 100644 front/core/components/data-viewer/index.js create mode 100644 front/core/components/data-viewer/style.scss diff --git a/front/core/components/data-viewer/index.html b/front/core/components/data-viewer/index.html new file mode 100644 index 000000000..1a5a76ef8 --- /dev/null +++ b/front/core/components/data-viewer/index.html @@ -0,0 +1,25 @@ +
+
+ + +
+
+ + + + Enter a new search + + + No results + +
\ No newline at end of file diff --git a/front/core/components/data-viewer/index.js b/front/core/components/data-viewer/index.js new file mode 100644 index 000000000..2ec61ee5a --- /dev/null +++ b/front/core/components/data-viewer/index.js @@ -0,0 +1,39 @@ +import ngModule from '../../module'; +import './style.scss'; + +export default class DataViewer { + get computedData() { + return this.data || (this.model && this.model.data); + } + + get computedLoading() { + return this.isLoading || (this.model && this.model.isRefreshing); + } + + get hasData() { + let data = this.computedData; + return data && data.length; + } + + get status() { + if (this.hasData) + return null; + if (this.computedLoading) + return 'loading'; + if (this.computedData) + return 'empty'; + else + return 'clear'; + } +} + +ngModule.component('vnDataViewer', { + template: require('./index.html'), + transclude: true, + controller: DataViewer, + bindings: { + model: ' .empty-rows { + display: block; + text-align: center; + padding: 1.5em; + box-sizing: border-box; + color: $color-font-secondary; + font-size: 1.4em; + } +} \ No newline at end of file diff --git a/front/core/components/index.js b/front/core/components/index.js index e8adb008e..54f9f18f2 100644 --- a/front/core/components/index.js +++ b/front/core/components/index.js @@ -37,6 +37,7 @@ import './calendar'; import './check'; import './chip'; import './color-legend'; +import './data-viewer'; import './input-number'; import './input-time'; import './input-file'; diff --git a/front/core/components/table/index.html b/front/core/components/table/index.html index a5abd1c66..e7ae44886 100644 --- a/front/core/components/table/index.html +++ b/front/core/components/table/index.html @@ -1,11 +1,2 @@ -
- - - - - Enter a new search - - - No results - +
\ No newline at end of file diff --git a/front/core/components/table/index.js b/front/core/components/table/index.js index d091e8345..352a39b4a 100644 --- a/front/core/components/table/index.js +++ b/front/core/components/table/index.js @@ -8,18 +8,6 @@ export default class Table { this.field = null; this.order = null; this.autoLoad = true; - - $transclude($scope.$parent, clone => { - angular.element($element[0].querySelector('.table')).append(clone); - }); - } - - get isRefreshing() { - return (this.model && this.model.isRefreshing); - } - - get isPaging() { - return (this.model && this.model.isPaging); } setOrder(field, order) { diff --git a/front/salix/styles/list.scss b/front/salix/styles/list.scss index c483feca1..3a6d0d6d9 100644 --- a/front/salix/styles/list.scss +++ b/front/salix/styles/list.scss @@ -1,7 +1,7 @@ @import "./effects"; .vn-list { - max-width: 36em; + max-width: $width-sm; margin: 0 auto; a.vn-list-item { diff --git a/front/salix/styles/variables.scss b/front/salix/styles/variables.scss index 6bc311c33..932596ef9 100644 --- a/front/salix/styles/variables.scss +++ b/front/salix/styles/variables.scss @@ -6,7 +6,7 @@ $mobile-width: 800px; // Width $width-xs: 25em; -$width-sm: 32em; +$width-sm: 34em; $width-md: 50em; $width-lg: 80em; $width-xl: 100em; diff --git a/modules/agency/front/basic-data/index.html b/modules/agency/front/basic-data/index.html index 8749494e1..8e3067877 100644 --- a/modules/agency/front/basic-data/index.html +++ b/modules/agency/front/basic-data/index.html @@ -5,7 +5,10 @@ form="form" save="patch"> -
+ - - + + + +
diff --git a/modules/agency/front/events/index.html b/modules/agency/front/events/index.html index 93132501d..b54ee8f0b 100644 --- a/modules/agency/front/events/index.html +++ b/modules/agency/front/events/index.html @@ -1,6 +1,10 @@
-
- + + +
+
-
- - - - - No records found - +
- - + + + - - {{::row.day | dateTime:'dd/MM/yyyy'}} - - - - - + + {{::row.day | dateTime:'dd/MM/yyyy'}} + + + + + - - - - - - - No records found - + + +
+ auto-load="true">
-
- - - - -
- + + + + + + @@ -59,8 +62,8 @@ - - + +
+ + @@ -13,13 +17,8 @@ - - - - - - No records found - + + - + + + + diff --git a/modules/client/front/balance/index/index.html b/modules/client/front/balance/index/index.html index a03790582..55ad2f615 100644 --- a/modules/client/front/balance/index/index.html +++ b/modules/client/front/balance/index/index.html @@ -3,7 +3,8 @@ url="/client/api/receipts/filter" params="$ctrl.params" limit="20" - data="$ctrl.balances"> + data="$ctrl.balances" + auto-load="true"> -
+
@@ -40,11 +41,12 @@ - + + - Date + Date Creation date Employee Reference @@ -97,8 +99,8 @@ - - + +
+ - - - - - - - - -
Since {{::classification.started | dateTime:'dd/MM/yyyy'}}
-
To {{classification.finished | dateTime:'dd/MM/yyyy'}}
-
- - - - - - - - - - - - - - - - - - - -
-
-
- - - No results - - + + + + + + + + +
Since {{::classification.started | dateTime:'dd/MM/yyyy'}}
+
To {{classification.finished | dateTime:'dd/MM/yyyy'}}
+
+ + + + + + + + + + + + + + + + + + + +
+
+
-
+ + data="credits" + order="created DESC" + auto-load="true"> -
+ - - - - Since - Employee - Credit - - - - - {{::credit.created | dateTime:'dd/MM/yyyy HH:mm'}} - {{::credit.worker.user.nickname}} - {{::credit.amount | currency:'EUR':2}} - - - + + + + Since + Employee + Credit + + + + + {{::credit.created | dateTime:'dd/MM/yyyy HH:mm'}} + {{::credit.worker.user.nickname}} + {{::credit.amount | currency:'EUR':2}} + + + - -
+ + data="$ctrl.clientDms" + order="dmsFk DESC" + auto-load="true"> -
+ - - - - Id - Type - Order - Reference - Description - Original - File - Employee - Created - - - - - - - - {{::document.dmsFk}} - - - {{::document.dms.dmsType.name}} - - - - - {{::document.dms.hardCopyNumber}} - - - - - {{::document.dms.reference}} - - - - - {{::document.dms.description}} - - - - - - - - {{::document.dms.file}} - - - - - {{::document.dms.worker.user.nickname | dashIfEmpty}} - - - {{::document.dms.created | dateTime:'dd/MM/yyyy HH:mm'}} - - - - - - - - - - - - + + + + Id + Type + Order + Reference + Description + Original + File + Employee + Created + + + + + + + + {{::document.dmsFk}} + + + {{::document.dms.dmsType.name}} + + + + + {{::document.dms.hardCopyNumber}} + + + + + {{::document.dms.reference}} + + + + + {{::document.dms.description}} + + + + + + + + {{::document.dms.file}} + + + + + {{::document.dms.worker.user.nickname | dashIfEmpty}} + + + {{::document.dms.created | dateTime:'dd/MM/yyyy HH:mm'}} + + + + icon="cloud_download" + title="{{'Download file' | translate}}"> - - - - + + + + + + + + + + + + + -
- + diff --git a/modules/client/front/greuge/index/index.html b/modules/client/front/greuge/index/index.html index a5e7e5f56..9ce76491c 100644 --- a/modules/client/front/greuge/index/index.html +++ b/modules/client/front/greuge/index/index.html @@ -11,7 +11,9 @@ path="/client/api/greuges/{{$ctrl.$stateParams.id}}/sumAmount" options="mgEdit"> -
+ - -
+ - - - - -
{{::client.name}}
- - - - - - - - -
- - - - - + + +
+ + +
{{::client.name}}
+ + + + + + + + +
+ + + + + +
- -
- - No results - - - Enter a new search - -
- + + + diff --git a/modules/client/front/mandate/index.html b/modules/client/front/mandate/index.html index b4db8970d..c5bfb058a 100644 --- a/modules/client/front/mandate/index.html +++ b/modules/client/front/mandate/index.html @@ -5,30 +5,32 @@ link="{clientFk: $ctrl.$stateParams.id}" limit="20" data="mandates" - auto-load="false"> + order="created DESC" + auto-load="true"> -
+ - - - - Id - Company - Type - Register date - End date - - - - - {{::mandate.id}} - {{::mandate.company.code}} - {{::mandate.mandateType.name}} - {{::mandate.created | dateTime:'dd/MM/yyyy HH:mm' }} - {{::mandate.finished | dateTime:'dd/MM/yyyy HH:mm' || '-'}} - - - + + + + Id + Company + Type + Register date + End date + + + + + {{::mandate.id}} + {{::mandate.company.code}} + {{::mandate.mandateType.name}} + {{::mandate.created | dateTime:'dd/MM/yyyy HH:mm' }} + {{::mandate.finished | dateTime:'dd/MM/yyyy HH:mm' || '-'}} + + + - - \ No newline at end of file + \ No newline at end of file diff --git a/modules/client/front/note/index/index.html b/modules/client/front/note/index/index.html index a9182634e..a653ef9da 100644 --- a/modules/client/front/note/index/index.html +++ b/modules/client/front/note/index/index.html @@ -6,7 +6,9 @@ data="notes" auto-load="true"> -
+
-
- No results -
-
- +
+ order="started DESC" + auto-load="true"> -
+ - - - - - Since - To - Amount - Period - - - - - - - - - {{::recovery.started | dateTime:'dd/MM/yyyy' }} - {{recovery.finished | dateTime:'dd/MM/yyyy' }} - {{::recovery.amount | currency: 'EUR': 0}} - {{::recovery.period}} - - - + + + + + Since + To + Amount + Period + + + + + + + + + {{::recovery.started | dateTime:'dd/MM/yyyy' }} + {{recovery.finished | dateTime:'dd/MM/yyyy' }} + {{::recovery.amount | currency: 'EUR': 0}} + {{::recovery.period}} + + + - -
+ + order="created DESC" + auto-load="true"> -
+ - Sent + Sent Description Worker Company @@ -36,14 +39,16 @@ - -
+ -
+ \ No newline at end of file diff --git a/modules/client/front/web-payment/index.html b/modules/client/front/web-payment/index.html index bd3cbe446..326945c21 100644 --- a/modules/client/front/web-payment/index.html +++ b/modules/client/front/web-payment/index.html @@ -3,50 +3,53 @@ url="/client/api/clients/getTransactions" link="{clientFk: $ctrl.$stateParams.id}" limit="20" - data="transactions" auto-load="false"> + data="transactions" + order="created DESC" + auto-load="true"> -
+ - - - - State - Id - Amount - Payed - Confirm - - - - - - - - - - - {{::transaction.id}} - {{::transaction.amount | currency: 'EUR':2}} - {{::transaction.created | dateTime:'dd/MM/yyyy HH:mm'}} - - - - - - - + + + + State + Id + Date + Amount + + + + + + + + + + + + {{::transaction.id}} + {{::transaction.created | dateTime:'dd/MM/yyyy HH:mm'}} + {{::transaction.amount | currency: 'EUR':2}} + + + + + + + - -
\ No newline at end of file + \ No newline at end of file diff --git a/modules/client/front/web-payment/locale/es.yml b/modules/client/front/web-payment/locale/es.yml index 099ca359c..8e988857c 100644 --- a/modules/client/front/web-payment/locale/es.yml +++ b/modules/client/front/web-payment/locale/es.yml @@ -1,6 +1,5 @@ Web Payment: Pago Web Confirmed: Confirmado -Payed: Pagado Confirm transaction: Confirmar transacción Confirm: Confirmar State: Estado \ No newline at end of file diff --git a/modules/worker/front/log/index.html b/modules/worker/front/log/index.html index 0de0eadf6..4f170ac35 100644 --- a/modules/worker/front/log/index.html +++ b/modules/worker/front/log/index.html @@ -7,7 +7,9 @@ limit="20" auto-load="true"> -
+ @@ -95,7 +97,7 @@ -
+ From ec9797a4b3ad8080c68e336c812305d5728dd0a9 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 2 Oct 2019 21:02:49 +0200 Subject: [PATCH 02/13] vnDataViewer applied to all module indexes --- e2e/helpers/selectors.js | 4 +- .../04-item-module/10_item_index.spec.js | 2 +- front/core/components/table/index.js | 4 +- modules/claim/front/index/index.html | 35 ++--- modules/client/front/index/index.html | 114 +++++++++-------- modules/invoiceOut/front/index/index.html | 22 +++- modules/item/front/index/index.html | 62 ++++----- modules/order/front/index/index.html | 35 +++-- modules/route/front/index/index.html | 49 ++++--- modules/ticket/front/index/index.html | 59 ++++----- modules/ticket/front/index/style.scss | 1 - modules/travel/front/index/index.html | 33 ++--- modules/worker/front/index/index.html | 120 +++++++++--------- 13 files changed, 286 insertions(+), 254 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index cfa9faa20..351053a02 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -190,8 +190,8 @@ export default { searchItemInput: 'vn-searchbar vn-textfield input', searchButton: 'vn-searchbar vn-icon[icon="search"]', closeItemSummaryPreview: 'vn-item-index [vn-id="preview"] button.close', - fieldsToShowButton: 'vn-item-index vn-table > div.ng-scope > div > vn-icon-button[icon="menu"]', - fieldsToShowForm: 'vn-item-index > div > vn-card > div > vn-table > div.ng-scope > div > vn-dialog > div > form', + fieldsToShowButton: 'vn-item-index vn-table > div > div > vn-icon-button[icon="menu"]', + fieldsToShowForm: 'vn-item-index vn-table > div > div > vn-dialog > div > form', firstItemImage: 'vn-item-index vn-tbody > a:nth-child(1) > vn-td:nth-child(1)', firstItemId: 'vn-item-index vn-tbody > a:nth-child(1) > vn-td:nth-child(2)', idCheckbox: 'vn-item-index vn-dialog form vn-horizontal:nth-child(2) > vn-check', diff --git a/e2e/paths/04-item-module/10_item_index.spec.js b/e2e/paths/04-item-module/10_item_index.spec.js index b83b37c59..a2810d33c 100644 --- a/e2e/paths/04-item-module/10_item_index.spec.js +++ b/e2e/paths/04-item-module/10_item_index.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -describe('Item index path', () => { +fdescribe('Item index path', () => { const nightmare = createNightmare(); beforeAll(() => { diff --git a/front/core/components/table/index.js b/front/core/components/table/index.js index 352a39b4a..0b9236c84 100644 --- a/front/core/components/table/index.js +++ b/front/core/components/table/index.js @@ -25,7 +25,9 @@ export default class Table { } $onChanges() { - if (this.model && this.autoLoad) + // FIXME: The autoload property should be removed from vnTable + // because it's already implemented at vnModel + if (this.autoLoad && this.model && !this.model.data) this.applyOrder(); } diff --git a/modules/claim/front/index/index.html b/modules/claim/front/index/index.html index caeb756de..46fd577e1 100644 --- a/modules/claim/front/index/index.html +++ b/modules/claim/front/index/index.html @@ -3,20 +3,23 @@ url="/claim/api/Claims/filter" limit="20" data="claims" - order="claimStateFk ASC, created DESC"> + order="claimStateFk ASC, created DESC" + auto-load="true">
-
- - - - -
- + + + + + + @@ -62,10 +65,12 @@ - - + +
- + + diff --git a/modules/client/front/index/index.html b/modules/client/front/index/index.html index ae8daab75..ec09a936d 100644 --- a/modules/client/front/index/index.html +++ b/modules/client/front/index/index.html @@ -3,68 +3,74 @@ url="/item/api/Clients" order="id DESC" limit="8" - data="clients" - auto-load="false"> + data="clients"> -
- - + - + + \ No newline at end of file diff --git a/modules/invoiceOut/front/index/index.html b/modules/invoiceOut/front/index/index.html index 744b52fad..ef7bd988f 100644 --- a/modules/invoiceOut/front/index/index.html +++ b/modules/invoiceOut/front/index/index.html @@ -7,7 +7,7 @@
- +
- - + + + Reference @@ -67,15 +71,19 @@ - - + +
- + + - + + \ No newline at end of file diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index 40d816bb5..d692d61f6 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -3,35 +3,39 @@ url="/item/api/Items/filter" limit="12" order="isActive DESC, name, id" - data="items" - auto-load="false"> + data="items">
-
- - - - - - - - -
- - + + + + + + + + + + + @@ -124,8 +128,8 @@ - - + +
diff --git a/modules/order/front/index/index.html b/modules/order/front/index/index.html index 62094941e..a22e7501a 100644 --- a/modules/order/front/index/index.html +++ b/modules/order/front/index/index.html @@ -3,24 +3,23 @@ url="/api/Orders/filter" limit="20" data="orders" - order="landed DESC, clientFk" - auto-load="false"> + order="landed DESC, clientFk">
-
- - - - -
- - + + + + + + + Id @@ -71,8 +70,8 @@ - - + +
diff --git a/modules/route/front/index/index.html b/modules/route/front/index/index.html index 969c5f380..3cb4e13eb 100644 --- a/modules/route/front/index/index.html +++ b/modules/route/front/index/index.html @@ -3,32 +3,36 @@ url="/api/Routes/filter" limit="20" data="routes" - order="created DESC"> + order="created DESC" + auto-load="true"> - + + - + \ No newline at end of file diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index 3c32c6fcf..0f70dea40 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -4,34 +4,35 @@ limit="20" params="::$ctrl.params" data="tickets" - order="shipped DESC, zoneHour ASC, zoneMinute ASC, clientFk" - auto-load="false"> + order="shipped DESC, zoneHour ASC, zoneMinute ASC, clientFk">
-
- - - - - - - - -
- - + + + + + + + + + + + @@ -42,7 +43,7 @@ Id Salesperson - Date + Date Hour Alias Province @@ -142,8 +143,8 @@ - - + +
diff --git a/modules/ticket/front/index/style.scss b/modules/ticket/front/index/style.scss index 6a935c7f6..ccf913ff5 100644 --- a/modules/ticket/front/index/style.scss +++ b/modules/ticket/front/index/style.scss @@ -10,7 +10,6 @@ vn-ticket-index { color: initial; } } - vn-searchbar { width: 100% } diff --git a/modules/travel/front/index/index.html b/modules/travel/front/index/index.html index c7f2a6d6e..faa21144c 100644 --- a/modules/travel/front/index/index.html +++ b/modules/travel/front/index/index.html @@ -3,23 +3,24 @@ url="/travel/api/Travels" filter="::$ctrl.filter" limit="20" - data="travels" - auto-load="false"> + data="travels">
-
- - - - -
- - + + + + + + + Id @@ -50,6 +51,6 @@ - +
\ No newline at end of file diff --git a/modules/worker/front/index/index.html b/modules/worker/front/index/index.html index 3c254e7f7..ce1a438b5 100644 --- a/modules/worker/front/index/index.html +++ b/modules/worker/front/index/index.html @@ -5,72 +5,70 @@ order="id" data="workers"> -
-
- + - + + \ No newline at end of file From 8e2884b28cc311d69c385b59e7e68428d068515f Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 3 Oct 2019 09:56:29 +0200 Subject: [PATCH 03/13] removed focus from describe --- e2e/paths/04-item-module/10_item_index.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/04-item-module/10_item_index.spec.js b/e2e/paths/04-item-module/10_item_index.spec.js index a2810d33c..b83b37c59 100644 --- a/e2e/paths/04-item-module/10_item_index.spec.js +++ b/e2e/paths/04-item-module/10_item_index.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -fdescribe('Item index path', () => { +describe('Item index path', () => { const nightmare = createNightmare(); beforeAll(() => { From a8f2000f3fbabb3286981157df08e511216a53ac Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 3 Oct 2019 11:37:44 +0200 Subject: [PATCH 04/13] Cambios mockup #1745 --- front/salix/styles/photo-list.scss | 2 ++ modules/claim/front/dms/index/index.html | 8 +++++++- modules/claim/front/dms/index/style.scss | 19 +++++++++++++------ modules/claim/front/dms/locale/es.yml | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/front/salix/styles/photo-list.scss b/front/salix/styles/photo-list.scss index c573d06a2..b4e6ec698 100644 --- a/front/salix/styles/photo-list.scss +++ b/front/salix/styles/photo-list.scss @@ -17,6 +17,8 @@ box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12); + background: no-repeat center center fixed; + background-size: cover !important; overflow: hidden; cursor: zoom-in; height: 100%; diff --git a/modules/claim/front/dms/index/index.html b/modules/claim/front/dms/index/index.html index 9b24c65ca..10e35e58e 100644 --- a/modules/claim/front/dms/index/index.html +++ b/modules/claim/front/dms/index/index.html @@ -4,7 +4,13 @@ limit="20" data="$ctrl.photos"> - + +
+
+
Drag & Drop files here...
+
+ +
Date: Thu, 3 Oct 2019 19:34:24 +0200 Subject: [PATCH 05/13] ModelProxy.status, Paging removed, locale fixes --- .../core/components/crud-model/crud-model.js | 12 ++-- front/core/components/data-viewer/index.html | 14 ++-- front/core/components/data-viewer/index.js | 28 ++++---- front/core/components/index.js | 1 - .../components/model-proxy/model-proxy.js | 22 ++++++- .../components/pagination/pagination.html | 9 ++- front/core/components/pagination/style.scss | 3 +- front/core/components/paging/paging.html | 11 ---- front/core/components/paging/paging.js | 58 ----------------- front/core/components/paging/paging.spec.js | 65 ------------------- front/core/components/paging/style.scss | 40 ------------ front/core/components/popover/popover.js | 5 +- front/core/locale/es.yml | 3 + front/core/vendor.js | 5 -- front/salix/locale/es.yml | 2 - .../client/front/credit/index/locale/es.yml | 3 +- .../client/front/recovery/index/locale/es.yml | 1 - modules/item/front/locale/es.yml | 2 - modules/order/front/catalog/index.js | 2 +- modules/order/front/locale/es.yml | 2 - 20 files changed, 60 insertions(+), 228 deletions(-) delete mode 100644 front/core/components/paging/paging.html delete mode 100644 front/core/components/paging/paging.js delete mode 100644 front/core/components/paging/paging.spec.js delete mode 100644 front/core/components/paging/style.scss diff --git a/front/core/components/crud-model/crud-model.js b/front/core/components/crud-model/crud-model.js index 4f3058305..0839881ab 100644 --- a/front/core/components/crud-model/crud-model.js +++ b/front/core/components/crud-model/crud-model.js @@ -207,8 +207,8 @@ export default class CrudModel extends ModelProxy { sendRequest(filter, append) { this.cancelRequest(); this.canceler = this.$q.defer(); - this.isRefreshing = !append; this.isPaging = append; + if (!append) this.status = 'loading'; let params = Object.assign( {filter}, @@ -221,9 +221,8 @@ export default class CrudModel extends ModelProxy { return this.$http.get(this._url, options).then( json => this.onRemoteDone(json, filter, append), - json => this.onRemoteError(json) + json => this.onRemoteError(json, append) ).finally(() => { - this.isRefreshing = false; this.isPaging = false; }); } @@ -243,7 +242,12 @@ export default class CrudModel extends ModelProxy { this.onRequestEnd(); } - onRemoteError(err) { + onRemoteError(err, append) { + if (!append) { + this.clear(); + this.status = 'error'; + } + this.onRequestEnd(); throw err; } diff --git a/front/core/components/data-viewer/index.html b/front/core/components/data-viewer/index.html index 1a5a76ef8..dd696fda3 100644 --- a/front/core/components/data-viewer/index.html +++ b/front/core/components/data-viewer/index.html @@ -1,22 +1,28 @@ -
+
+ model="$ctrl.model" + pad-medium-top>
+ enable="::true"> Enter a new search + + Ups! It seems there was an error + diff --git a/front/core/components/data-viewer/index.js b/front/core/components/data-viewer/index.js index 2ec61ee5a..1f967d94b 100644 --- a/front/core/components/data-viewer/index.js +++ b/front/core/components/data-viewer/index.js @@ -2,28 +2,22 @@ import ngModule from '../../module'; import './style.scss'; export default class DataViewer { - get computedData() { - return this.data || (this.model && this.model.data); - } - - get computedLoading() { - return this.isLoading || (this.model && this.model.isRefreshing); - } - - get hasData() { - let data = this.computedData; - return data && data.length; + get isReady() { + return this.status == 'ready'; } get status() { - if (this.hasData) - return null; - if (this.computedLoading) + if (this.model) + return this.model.status; + + if (this.isLoading) return 'loading'; - if (this.computedData) - return 'empty'; - else + if (!this.data) return 'clear'; + if (this.data.length) + return 'ready'; + else + return 'empty'; } } diff --git a/front/core/components/index.js b/front/core/components/index.js index 54f9f18f2..ff063ad24 100644 --- a/front/core/components/index.js +++ b/front/core/components/index.js @@ -26,7 +26,6 @@ import './card/card'; import './float-button/float-button'; import './step-control/step-control'; import './label-value/label-value'; -import './paging/paging'; import './pagination/pagination'; import './searchbar/searchbar'; import './scroll-up/scroll-up'; diff --git a/front/core/components/model-proxy/model-proxy.js b/front/core/components/model-proxy/model-proxy.js index 342841bda..1eaf749d5 100644 --- a/front/core/components/model-proxy/model-proxy.js +++ b/front/core/components/model-proxy/model-proxy.js @@ -57,6 +57,7 @@ export default class ModelProxy extends DataModel { constructor($element, $scope) { super($element, $scope); this.resetChanges(); + this.status = 'clear'; } get orgData() { @@ -90,6 +91,14 @@ export default class ModelProxy extends DataModel { set data(value) { this._data = value; + + if (value == null) + this.status = 'clear'; + else if (value.length) + this.status = 'ready'; + else + this.status = 'empty'; + this.emit('dataChange'); this.emit('dataUpdate'); } @@ -109,8 +118,12 @@ export default class ModelProxy extends DataModel { this.removed.push(item); this.isChanged = true; + if (!this.data.length) + this.status = 'empty'; + this.emit('rowRemove', index); this.emit('dataUpdate'); + if (this.autoSave) this.save(); } @@ -131,8 +144,11 @@ export default class ModelProxy extends DataModel { this.data.push(newRow); this.isChanged = true; + this.status = 'ready'; + this.emit('rowInsert', index); this.emit('dataUpdate'); + return index; } @@ -322,10 +338,10 @@ export class Paginable { } /** - * @type {Boolean} Whether the model is refreshing. + * @type {ready|loading|clear|empty|error} The current model status. */ - get isRefreshing() { - return false; + get status() { + return null; } /** diff --git a/front/core/components/pagination/pagination.html b/front/core/components/pagination/pagination.html index 9da15c002..5bc1b67f6 100644 --- a/front/core/components/pagination/pagination.html +++ b/front/core/components/pagination/pagination.html @@ -1,13 +1,12 @@ -
+
+ ng-if="$ctrl.model.isPaging" + enable="::true">
\ No newline at end of file diff --git a/front/core/components/pagination/style.scss b/front/core/components/pagination/style.scss index 0cacb53e3..2610bc502 100644 --- a/front/core/components/pagination/style.scss +++ b/front/core/components/pagination/style.scss @@ -3,7 +3,8 @@ vn-pagination { display: block; text-align: center; - & > div > vn-icon-button { + & > div > vn-icon-button { font-size: 2em; + padding: 0; } } \ No newline at end of file diff --git a/front/core/components/paging/paging.html b/front/core/components/paging/paging.html deleted file mode 100644 index 6e71f321d..000000000 --- a/front/core/components/paging/paging.html +++ /dev/null @@ -1,11 +0,0 @@ - - \ No newline at end of file diff --git a/front/core/components/paging/paging.js b/front/core/components/paging/paging.js deleted file mode 100644 index 850b9c722..000000000 --- a/front/core/components/paging/paging.js +++ /dev/null @@ -1,58 +0,0 @@ -import ngModule from '../../module'; -import './style.scss'; - -export default class Paging { - get numPages() { - return Math.ceil(this.numItems / this.numPerPage); - } - - constructor($http, $scope) { - this.$http = $http; - this.$scope = $scope; - this.where = this.filter; - this.numPerPage = null; - this.numItems = 0; - $scope.$watch('$ctrl.index.model.length', () => this.onModelUpdated()); - } - - $onChanges(changes) { - if (!this.index) return; - this.numPerPage = this.index.filter.size; - this.currentPage = this.index.filter.page; - if (changes.total) - this.numItems = changes.total.currentValue; - } - - onModelUpdated() { - let index = this.index; - let filter = index.filter; - - if (filter.page >= this.numPages && index.model.length >= this.numPerPage) - this.numItems = filter.page * filter.size + 1; - } - - onPageChange(page) { - this.index.filter.page = page; - if (typeof this.pageChange === 'undefined') { - this.index.accept(); - } else { - this.pageChange(); - } - } - $doCheck() { - if (this.index && this.index.filter && this.index.filter.page && this.index.filter.page != this.currentPage) { - this.currentPage = this.index.filter.page; - } - } -} -Paging.$inject = ['$http', '$scope']; - -ngModule.component('vnPaging', { - template: require('./paging.html'), - bindings: { - index: '<', - pageChange: '&?', - total: '<' - }, - controller: Paging -}); diff --git a/front/core/components/paging/paging.spec.js b/front/core/components/paging/paging.spec.js deleted file mode 100644 index 9f6023ff6..000000000 --- a/front/core/components/paging/paging.spec.js +++ /dev/null @@ -1,65 +0,0 @@ -import './paging.js'; - -describe('Component vnPaging', () => { - let $scope; - let controller; - - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); - - beforeEach(angular.mock.inject(($componentController, $rootScope) => { - $scope = $rootScope.$new(); - controller = $componentController('vnPaging', {$scope}); - })); - - describe('$onChanges()', () => { - it(`should define numberPage and currentPage based on index.filter properties`, () => { - controller.index = {filter: {size: 'something', page: 'something else'}}; - controller.$onChanges({index: 'simpleChange', currentValue: 'current value', previousValue: 'previous value'}); - - expect(controller.numPerPage).toBe(controller.index.filter.size); - expect(controller.currentPage).toEqual(controller.index.filter.page); - }); - - it(`should define numItems based on changes.total.currentValue`, () => { - controller.index = {filter: {size: 'something', page: 'something else'}}; - controller.$onChanges({total: {currentValue: 'current value'}}); - - expect(controller.numItems).toEqual('current value'); - }); - }); - - describe('onModelUpdated()', () => { - it(`should define controllers numItems as the result of page times size plus one`, () => { - controller.numPerPage = 2; - controller.index = { - filter: {size: 10, page: 10}, - model: ['one mother..', 'another model..', 'last model..'] - }; - controller.onModelUpdated(); - - expect(controller.numItems).toBe(101); - }); - }); - - describe('onPageChange()', () => { - it(`should call accept() since pageChange property is undefined`, () => { - controller.index = {accept: () => {}, filter: {page: 0}}; - spyOn(controller.index, 'accept'); - controller.onPageChange(100); - - expect(controller.index.accept).toHaveBeenCalledWith(); - }); - - it(`should call pageChange() since pageChange property isn't undefined`, () => { - controller.index = {accept: () => {}, filter: {page: 0}}; - controller.pageChange = true; - spyOn(controller, 'pageChange'); - controller.onPageChange(100); - - expect(controller.pageChange).toHaveBeenCalledWith(); - }); - }); -}); - diff --git a/front/core/components/paging/style.scss b/front/core/components/paging/style.scss deleted file mode 100644 index e88202e49..000000000 --- a/front/core/components/paging/style.scss +++ /dev/null @@ -1,40 +0,0 @@ -@import "variables"; - -vn-paging { - display: block; - text-align: center; - - ul { - box-shadow: 0 0 .4em $color-shadow; - background-color: #fff; - display: inline-block; - margin: 20px 0; - border-radius: .1em; - padding: 0; - } - li { - display: inline; - - &:first-child > a, - &:first-child > span { - margin-left: 0; - } - &.active > a { - background: $color-active; - color: #fff; - } - & > a, - & > span { - position: relative; - float: left; - padding: 6px 12px; - margin-left: -1px; - line-height: 1.42857143; - color: inherit; - text-decoration: none; - } - &:not(.active) > a:hover { - background-color: #ddd; - } - } -} diff --git a/front/core/components/popover/popover.js b/front/core/components/popover/popover.js index 8babe867d..be6546246 100644 --- a/front/core/components/popover/popover.js +++ b/front/core/components/popover/popover.js @@ -180,11 +180,8 @@ export default class Popover extends Component { onDocKeyDown(event) { if (event.defaultPrevented) return; - - if (event.keyCode == 27) { // Esc - event.preventDefault(); + if (event.code == 'Escape') this.hide(); - } } onMouseDown(event) { diff --git a/front/core/locale/es.yml b/front/core/locale/es.yml index 01a17aa48..1fcd12b98 100644 --- a/front/core/locale/es.yml +++ b/front/core/locale/es.yml @@ -24,6 +24,9 @@ Value should be %s characters long: El valor debe ser de %s carácteres de longi Value should have a length between %s and %s: El valor debe tener una longitud de entre %s y %s Value should have at least %s characters: El valor debe tener al menos %s carácteres Value should have at most %s characters: El valor debe tener un máximo de %s carácteres +Enter a new search: Introduce una nueva búsqueda +No results: Sin resultados +Ups! It seems there was an error: ¡Vaya! Parece que ha habido un error General search: Busqueda general January: Enero February: Febrero diff --git a/front/core/vendor.js b/front/core/vendor.js index 44d041ebe..ac4364feb 100644 --- a/front/core/vendor.js +++ b/front/core/vendor.js @@ -7,10 +7,6 @@ import 'angular-translate-loader-partial'; import '@uirouter/angularjs'; import 'mg-crud'; import 'oclazyload'; -/* -import 'angular-material'; -import 'angular-material/modules/scss/angular-material.scss'; -*/ import 'angular-moment'; export const ngDeps = [ @@ -18,7 +14,6 @@ export const ngDeps = [ 'ui.router', 'mgCrud', 'oc.lazyLoad', - // 'ngMaterial', 'angularMoment' ]; diff --git a/front/salix/locale/es.yml b/front/salix/locale/es.yml index 2056210e4..898728363 100644 --- a/front/salix/locale/es.yml +++ b/front/salix/locale/es.yml @@ -14,8 +14,6 @@ Push on applications menu: Para abrir un módulo pulsa en el menú de aplicacion Return to module index: Volver a la página principal del módulo What is new: Novedades de la versión Settings: Ajustes -Enter a new search: Introduce una nueva búsqueda -No results: Sin resultados # Actions diff --git a/modules/client/front/credit/index/locale/es.yml b/modules/client/front/credit/index/locale/es.yml index b4b5940cf..a15a1085f 100644 --- a/modules/client/front/credit/index/locale/es.yml +++ b/modules/client/front/credit/index/locale/es.yml @@ -1,3 +1,2 @@ Since : Desde -Employee : Empleado -No results: Sin resultados \ No newline at end of file +Employee : Empleado \ No newline at end of file diff --git a/modules/client/front/recovery/index/locale/es.yml b/modules/client/front/recovery/index/locale/es.yml index 5b21429f4..0cb5b3ed6 100644 --- a/modules/client/front/recovery/index/locale/es.yml +++ b/modules/client/front/recovery/index/locale/es.yml @@ -1,5 +1,4 @@ Since: Desde Employee: Empleado -No results: Sin resultados To: Hasta Finish that recovery period: Terminar el recobro \ No newline at end of file diff --git a/modules/item/front/locale/es.yml b/modules/item/front/locale/es.yml index c922656c4..c071d2c69 100644 --- a/modules/item/front/locale/es.yml +++ b/modules/item/front/locale/es.yml @@ -33,8 +33,6 @@ Remove niche: Quitar nicho Add barcode: Añadir código de barras Remove barcode: Quitar código de barras Buyer: Comprador -No results: Sin resultados -Enter a new search: Introduce una nueva búsqueda Tag: Etiqueta Worker: Trabajador Available: Disponible diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js index a5d7ee968..758c56f0e 100644 --- a/modules/order/front/catalog/index.js +++ b/modules/order/front/catalog/index.js @@ -131,7 +131,7 @@ class Controller { } get isRefreshing() { - return this.$scope.model && this.$scope.model.isRefreshing; + return this.$scope.model && this.$scope.model.status == 'loading'; } } diff --git a/modules/order/front/locale/es.yml b/modules/order/front/locale/es.yml index 943606a47..0ada37bfd 100644 --- a/modules/order/front/locale/es.yml +++ b/modules/order/front/locale/es.yml @@ -3,8 +3,6 @@ Catalog: Catálogo from: desde results: resultados More than: Más de -No results: Sin resultados -Enter a new search: Introduce una nueva búsqueda Plant: Planta Flower: Flor Handmade: Confección From 69ef2c2e27366a96c1563c948df504d0bc9f683a Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 4 Oct 2019 09:28:09 +0200 Subject: [PATCH 06/13] update zone and shipped on #1746 --- .../front/basic-data/step-one/index.html | 3 +- .../ticket/front/basic-data/step-one/index.js | 56 +++---- .../front/basic-data/step-one/index.spec.js | 157 +++++++++++++++++- 3 files changed, 179 insertions(+), 37 deletions(-) diff --git a/modules/ticket/front/basic-data/step-one/index.html b/modules/ticket/front/basic-data/step-one/index.html index 3d79b9b68..4e3cf361a 100644 --- a/modules/ticket/front/basic-data/step-one/index.html +++ b/modules/ticket/front/basic-data/step-one/index.html @@ -14,6 +14,7 @@ label="Client" show-field="name" value-field="id" + search-function="{or: [{id: $search}, {name: {like: '%'+ $search +'%'}}]}" field="$ctrl.clientId" initial-data="$ctrl.clientId" order="id"> @@ -23,7 +24,7 @@ label="Address" show-field="nickname" value-field="id" - field="$ctrl.ticket.addressFk" + field="$ctrl.addressId" order="isActive DESC"> {{::isActive ? '' : 'INACTIVE'}} {{::nickname}} diff --git a/modules/ticket/front/basic-data/step-one/index.js b/modules/ticket/front/basic-data/step-one/index.js index 862a7a315..09632ba5a 100644 --- a/modules/ticket/front/basic-data/step-one/index.js +++ b/modules/ticket/front/basic-data/step-one/index.js @@ -26,10 +26,7 @@ class Controller { } get clientId() { - if (this.ticket) - return this.ticket.clientFk; - - return null; + return this.ticket && this.ticket.clientFk; } set clientId(value) { @@ -39,11 +36,24 @@ class Controller { this.onChangeClient(value); } - get warehouseId() { - if (this.ticket) - return this.ticket.warehouseFk; + get addressId() { + return this.ticket && this.ticket.addressFk; + } - return null; + set addressId(value) { + if (value != this.ticket.addressFk) { + this.ticket.addressFk = value; + this.getShipped({ + landed: this.ticket.landed, + addressFk: value, + agencyModeFk: this.ticket.agencyModeFk, + warehouseFk: this.ticket.warehouseFk + }); + } + } + + get warehouseId() { + return this.ticket && this.ticket.warehouseFk; } set warehouseId(value) { @@ -60,10 +70,7 @@ class Controller { get shipped() { - if (this.ticket) - return this.ticket.shipped; - - return null; + return this.ticket && this.ticket.shipped; } set shipped(value) { @@ -77,10 +84,7 @@ class Controller { } get landed() { - if (this.ticket) - return this.ticket.landed; - - return null; + return this.ticket && this.ticket.landed; } set landed(value) { @@ -94,17 +98,14 @@ class Controller { } get agencyModeId() { - if (this.ticket) - return this.ticket.agencyModeFk; - - return null; + return this.ticket && this.ticket.agencyModeFk; } set agencyModeId(value) { if (value != this.ticket.agencyModeFk) { this.ticket.agencyModeFk = value; - this.getShipped({ - landed: this.ticket.landed, + this.getLanded({ + shipped: this.ticket.shipped, addressFk: this.ticket.addressFk, agencyModeFk: value, warehouseFk: this.ticket.warehouseFk @@ -113,10 +114,7 @@ class Controller { } get zoneId() { - if (this.ticket) - return this.ticket.zoneFk; - - return null; + return this.ticket && this.ticket.zoneFk; } set zoneId(value) { @@ -206,9 +204,10 @@ class Controller { this.$http.get(query, {params}).then(res => { if (res.data) { this.ticket.zoneFk = res.data.zoneFk; - this.ticket.landed = res.data.landed; this.ticket.agencyModeFk = res.data.agencyModeFk; this.ticket.warehouseFk = res.data.warehouseFk; + this.ticket.landed = res.data.landed; + this.ticket.shipped = params.shipped; } else { return this.vnApp.showError( this.$translate.instant(`No delivery zone available for this landing date`) @@ -226,9 +225,10 @@ class Controller { this.$http.get(query, {params}).then(res => { if (res.data) { this.ticket.zoneFk = res.data.zoneFk; - this.ticket.shipped = res.data.shipped; this.ticket.agencyModeFk = res.data.agencyModeFk; this.ticket.warehouseFk = res.data.warehouseFk; + this.ticket.landed = params.landed; + this.ticket.shipped = res.data.shipped; } else { return this.vnApp.showError( this.$translate.instant(`No delivery zone available for this landing date`) diff --git a/modules/ticket/front/basic-data/step-one/index.spec.js b/modules/ticket/front/basic-data/step-one/index.spec.js index c743ca911..89ca7f171 100644 --- a/modules/ticket/front/basic-data/step-one/index.spec.js +++ b/modules/ticket/front/basic-data/step-one/index.spec.js @@ -5,14 +5,16 @@ describe('Ticket', () => { let $state; let controller; let $httpBackend; + let $httpParamSerializer; beforeEach(angular.mock.module('ticket', $translateProvider => { $translateProvider.translations('en', {}); })); - beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => { + beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, _$httpParamSerializer_) => { $state = _$state_; $httpBackend = _$httpBackend_; + $httpParamSerializer = _$httpParamSerializer_; controller = $componentController('vnTicketBasicDataStepOne', {$state}); controller.ticket = { addressFk: 121, @@ -37,6 +39,14 @@ describe('Ticket', () => { }); }); + describe('clientId() getter', () => { + it('should return the clientFk property', () => { + controller.ticket = {id: 1, clientFk: 102}; + + expect(controller.clientId).toEqual(102); + }); + }); + describe('clientId() setter', () => { it('should set clientId property and call onChangeClient() method ', () => { spyOn(controller, 'onChangeClient'); @@ -47,6 +57,69 @@ describe('Ticket', () => { }); }); + describe('adressId() getter', () => { + it('should return the addressFk property', () => { + controller.ticket = {id: 1, addressFk: 99}; + + expect(controller.addressId).toEqual(99); + }); + }); + + describe('addressId() setter', () => { + it('should set addressId property and call getShipped() method ', () => { + spyOn(controller, 'getShipped'); + controller.ticket.addressFk = 99; + controller.addressId = 100; + const landed = new Date(); + const spectedResult = { + landed: landed, + addressFk: 100, + agencyModeFk: 7, + warehouseFk: 1 + }; + controller.landed = landed; + + expect(controller.getShipped).toHaveBeenCalledWith(spectedResult); + expect(controller.ticket.addressFk).toEqual(100); + }); + }); + + describe('warehouseId() getter', () => { + it('should return the warehouseId property', () => { + controller.ticket.warehouseFk = 2; + + expect(controller.warehouseId).toEqual(2); + }); + }); + + describe('warehouseId() setter', () => { + it('should set warehouseId property and call getShipped() method ', () => { + spyOn(controller, 'getShipped'); + controller.ticket.warehouseId = 1; + controller.warehouseId = 2; + const landed = new Date(); + const spectedResult = { + landed: landed, + addressFk: 121, + agencyModeFk: 7, + warehouseFk: 2 + }; + controller.landed = landed; + + expect(controller.getShipped).toHaveBeenCalledWith(spectedResult); + expect(controller.ticket.warehouseFk).toEqual(2); + }); + }); + + describe('shipped() getter', () => { + it('should return the shipped property', () => { + const shipped = new Date(); + controller.ticket.shipped = shipped; + + expect(controller.shipped).toEqual(shipped); + }); + }); + describe('shipped() setter', () => { it('should set shipped property and call getLanded() method ', () => { spyOn(controller, 'getLanded'); @@ -59,11 +132,19 @@ describe('Ticket', () => { }; controller.shipped = shipped; - expect(controller.getLanded).toHaveBeenCalledWith(spectedResult); }); }); + describe('landed() getter', () => { + it('should return the landed property', () => { + const landed = new Date(); + controller.ticket.landed = landed; + + expect(controller.landed).toEqual(landed); + }); + }); + describe('landed() setter', () => { it('should set shipped property and call getShipped() method ', () => { spyOn(controller, 'getShipped'); @@ -81,21 +162,29 @@ describe('Ticket', () => { }); }); + describe('agencyModeId() getter', () => { + it('should return the agencyModeFk property', () => { + controller.ticket.agencyModeFk = 66; + + expect(controller.agencyModeId).toEqual(66); + }); + }); + describe('agencyModeId() setter', () => { - it('should set agencyModeId property and call onChangeAgencyMode() method', () => { - spyOn(controller, 'getShipped'); - const landed = new Date(); + it('should set agencyModeId property and call getLanded() method', () => { + spyOn(controller, 'getLanded'); + const shipped = new Date(); const agencyModeId = 8; const spectedResult = { - landed: landed, + shipped: shipped, addressFk: 121, agencyModeFk: agencyModeId, warehouseFk: 1 }; - controller.ticket.landed = landed; + controller.ticket.shipped = shipped; controller.agencyModeId = 8; - expect(controller.getShipped).toHaveBeenCalledWith(spectedResult); + expect(controller.getLanded).toHaveBeenCalledWith(spectedResult); }); it('should do nothing if attempting to set the same agencyMode id', () => { @@ -115,6 +204,14 @@ describe('Ticket', () => { }); }); + describe('zoneId() getter', () => { + it('should return the zoneFk property', () => { + controller.ticket.zoneFk = 10; + + expect(controller.zoneId).toEqual(10); + }); + }); + describe('zoneId() setter', () => { it('should set zoneId property and call onChangeZone() method ', () => { const zoneId = 5; @@ -223,5 +320,49 @@ describe('Ticket', () => { $httpBackend.flush(); }); }); + + describe('getLanded()', () => { + it('should return an available landed date', async() => { + const shipped = new Date(); + const expectedResult = {landed: new Date()}; + const params = { + shipped: shipped, + addressFk: 121, + agencyModeFk: 7, + warehouseFk: 1 + }; + const serializedParams = $httpParamSerializer(params); + + $httpBackend.when('GET', `/api/Agencies/getLanded?${serializedParams}`).respond(200, expectedResult); + $httpBackend.expect('GET', `/api/Agencies/getLanded?${serializedParams}`); + controller.getLanded(params); + $httpBackend.flush(); + + expect(controller.shipped).toEqual(shipped); + expect(controller.landed).toEqual(expectedResult.landed); + }); + }); + + describe('getShipped()', () => { + it('should return an available shipped date', async() => { + const landed = new Date(); + const expectedResult = {shipped: new Date()}; + const params = { + landed: landed, + addressFk: 121, + agencyModeFk: 7, + warehouseFk: 1 + }; + const serializedParams = $httpParamSerializer(params); + + $httpBackend.when('GET', `/api/Agencies/getShipped?${serializedParams}`).respond(200, expectedResult); + $httpBackend.expect('GET', `/api/Agencies/getShipped?${serializedParams}`); + controller.getShipped(params); + $httpBackend.flush(); + + expect(controller.shipped).toEqual(expectedResult.shipped); + expect(controller.landed).toEqual(landed); + }); + }); }); }); From da2c763573437e3d3179cccc5fdac41b8528cce5 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 4 Oct 2019 10:07:45 +0200 Subject: [PATCH 07/13] #1705 item.index optimizar velocidad --- modules/item/back/methods/item/filter.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index 4e390227b..ad7edfa8c 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -62,13 +62,26 @@ module.exports = Self => { Self.filter = async(ctx, filter) => { let conn = Self.dataSource.connector; + let codeWhere; + + if (ctx.args.search) { + let items = await Self.app.models.ItemBarcode.find({ + where: {code: ctx.args.search}, + fields: ['itemFk'] + }); + let itemIds = []; + for (const item of items) + itemIds.push(item.itemFk); + + codeWhere = {'i.id': {inq: itemIds}}; + } let where = buildFilter(ctx.args, (param, value) => { switch (param) { case 'search': return /^\d+$/.test(value) - ? {or: [{'i.id': value}, {'ib.code': value}]} - : {or: [{'i.name': {like: `%${value}%`}}, {'ib.code': value}]}; + ? {or: [{'i.id': value}, codeWhere]} + : {or: [{'i.name': {like: `%${value}%`}}, codeWhere]}; case 'id': return {'i.id': value}; case 'description': @@ -83,8 +96,8 @@ module.exports = Self => { return {'i.isActive': value}; } }); - filter = mergeFilters(filter, {where}); + let stmts = []; let stmt; @@ -123,8 +136,7 @@ module.exports = Self => { LEFT JOIN origin ori ON ori.id = i.originFk LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = t.warehouseFk LEFT JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN itemPlacement itn ON itn.itemFk = i.id AND itn.warehouseFk = t.warehouseFk - LEFT JOIN itemBarcode ib ON ib.itemFk = i.id` + LEFT JOIN itemPlacement itn ON itn.itemFk = i.id AND itn.warehouseFk = t.warehouseFk` ); if (ctx.args.tags) { @@ -150,7 +162,6 @@ module.exports = Self => { } stmt.merge(conn.makeWhere(filter.where)); - stmt.merge(`GROUP BY i.id`); stmt.merge(conn.makePagination(filter)); let itemsIndex = stmts.push(stmt) - 1; From 7b7d7664e10cefed4a45950b9fbc64e65f4a6386 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 4 Oct 2019 11:18:07 +0200 Subject: [PATCH 08/13] disabled autoload on stowaway model #1747 --- modules/ticket/front/descriptor/addStowaway.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/descriptor/addStowaway.html b/modules/ticket/front/descriptor/addStowaway.html index 74554d2be..3efaedc8d 100644 --- a/modules/ticket/front/descriptor/addStowaway.html +++ b/modules/ticket/front/descriptor/addStowaway.html @@ -12,7 +12,7 @@
Stowaways to add
- + Ticket id From b4c23b86a2a7d20be71ce144fa0a250ed4f9d5fd Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 4 Oct 2019 11:39:24 +0200 Subject: [PATCH 09/13] fixed summary button --- modules/ticket/front/summary/index.html | 6 +++++- modules/ticket/front/summary/style.scss | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index 383d02ec9..d97c3125a 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -1,5 +1,9 @@ -
Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} ({{$ctrl.summary.client.id}}) - {{$ctrl.summary.nickname}} +
+ + Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} + ({{$ctrl.summary.client.id}}) - {{$ctrl.summary.nickname}} + Date: Fri, 4 Oct 2019 12:33:16 +0200 Subject: [PATCH 10/13] New: vnToggle, vnField, vnCheck & vnRadio refactor --- front/core/components/check/index.html | 2 +- front/core/components/check/index.js | 47 +--- front/core/components/check/style.scss | 45 +--- front/core/components/field/index.html | 36 +++ front/core/components/field/index.js | 178 ++++++++++++++ front/core/components/field/style.scss | 227 ++++++++++++++++++ front/core/components/index.js | 5 +- front/core/components/radio/index.js | 69 ++---- front/core/components/radio/index.spec.js | 47 +--- front/core/components/radio/style.scss | 41 +--- .../components/{radio => toggle}/index.html | 2 +- front/core/components/toggle/index.js | 62 +++++ front/core/components/toggle/style.scss | 50 ++++ front/core/components/treeview/style.scss | 2 +- front/salix/styles/variables.scss | 3 + package-lock.json | 127 +++++----- 16 files changed, 672 insertions(+), 271 deletions(-) create mode 100644 front/core/components/field/index.html create mode 100644 front/core/components/field/index.js create mode 100644 front/core/components/field/style.scss rename front/core/components/{radio => toggle}/index.html (78%) create mode 100644 front/core/components/toggle/index.js create mode 100644 front/core/components/toggle/style.scss diff --git a/front/core/components/check/index.html b/front/core/components/check/index.html index dd0a5d012..8c8171410 100644 --- a/front/core/components/check/index.html +++ b/front/core/components/check/index.html @@ -1,4 +1,4 @@ -
+
diff --git a/front/core/components/check/index.js b/front/core/components/check/index.js index 471be638a..35ff07e8a 100644 --- a/front/core/components/check/index.js +++ b/front/core/components/check/index.js @@ -1,29 +1,16 @@ import ngModule from '../../module'; -import Component from '../../lib/component'; +import Toggle from '../toggle'; import './style.scss'; /** * Basic element for user input. You can use this to supply a way for the user * to toggle an option. * - * @property {String} label Label to display along the component - * @property {any} field The value with which the element is linked - * @property {Boolean} checked Whether the checkbox is checked - * @property {Boolean} disabled Put component in disabled mode * @property {Boolean} tripleState Switch between three states when clicked * @property {Boolean} indeterminate Sets the element into indeterminate state * @property {String} info Shows a text information tooltip to the user */ -export default class Controller extends Component { - constructor($element, $, $attrs) { - super($element, $); - - let element = this.element; - element.addEventListener('click', e => this.onClick(e)); - element.addEventListener('keydown', e => this.onKeydown(e)); - element.tabIndex = 0; - } - +export default class Check extends Toggle { set field(value) { this._field = value; this.element.classList.toggle('checked', Boolean(value)); @@ -34,14 +21,12 @@ export default class Controller extends Component { return this._field; } - set disabled(value) { - this.element.tabIndex = !value ? 0 : -1; - this.element.classList.toggle('disabled', Boolean(value)); - this._disabled = value; + set checked(value) { + this.field = Boolean(value); } - get disabled() { - return this._disabled; + get checked() { + return Boolean(this.field); } set indeterminate(value) { @@ -63,9 +48,7 @@ export default class Controller extends Component { } onClick(event) { - event.preventDefault(); - - if (this.disabled) return; + if (super.onClick(event)) return; if (this.tripleState) { if (this.field == null) @@ -77,28 +60,18 @@ export default class Controller extends Component { } else this.field = !this.field; - this.$.$applyAsync(); - this.element.dispatchEvent(new Event('change')); - this.emit('change', {value: this.field}); - } - - onKeydown(event) { - if (event.code == 'Space') - this.onClick(event); + this.changed(); } } -Controller.$inject = ['$element', '$scope', '$attrs']; - ngModule.component('vnCheck', { template: require('./index.html'), - controller: Controller, - + controller: Check, bindings: { label: '@?', field: '=?', - checked: ' .check { - position: relative; - box-sizing: border-box; - display: inline-block; - vertical-align: middle; + & > .btn { border-radius: 2px; - width: 20px; - height: 20px; transition: background 250ms; - border: 2px solid #666; - margin: 6px 0; - margin-right: .4em; & > .mark { box-sizing: border-box; @@ -29,13 +12,10 @@ vn-check { border-width: 0; } } - &.checked > .check { - background-color: $color-main; + &.checked > .btn { border-color: $color-main; + background-color: $color-main; - & > .focus-mark { - background-color: rgba($color-main, .15); - } & > .mark { top: 0; left: 4px; @@ -47,7 +27,7 @@ vn-check { border-left: 0; } } - &.indeterminate > .check > .mark { + &.indeterminate > .btn > .mark { top: 50%; left: 50%; transform: translate(-50%, -50%); @@ -55,23 +35,6 @@ vn-check { height: 2px; border-bottom: 2px solid #666; } - & > .check > .focus-mark { - position: absolute; - top: 50%; - left: 50%; - height: 38px; - width: 38px; - margin-top: -19px; - margin-left: -19px; - border-radius: 50%; - transform: scale3d(0, 0, 0); - transition: background 250ms; - transition: transform 250ms; - background-color: rgba(0, 0, 0, .1); - } - &:focus:not(.disabled) > .check > .focus-mark { - transform: scale3d(1, 1, 1); - } & > vn-icon { margin-left: 5px; color: $color-font-secondary; diff --git a/front/core/components/field/index.html b/front/core/components/field/index.html new file mode 100644 index 000000000..a2401ee4f --- /dev/null +++ b/front/core/components/field/index.html @@ -0,0 +1,36 @@ +
+
+
+
+
+
+ +
+
+ +
+
+ + + + +
+
+
+
+
+
+
diff --git a/front/core/components/field/index.js b/front/core/components/field/index.js new file mode 100644 index 000000000..5d78f0d66 --- /dev/null +++ b/front/core/components/field/index.js @@ -0,0 +1,178 @@ +import ngModule from '../../module'; +import Component from '../../lib/component'; +import './style.scss'; + +export default class Field extends Component { + constructor($element, $scope) { + super($element, $scope); + this._value = undefined; + this.prefix = null; + this.suffix = null; + + this.input = this.element.querySelector('input'); + this.classList = this.element.classList; + this.classList.add('vn-field'); + + this.element.addEventListener('focusin', + () => this.onFocus(true)); + this.element.addEventListener('focusout', + () => this.onFocus(false)); + this.element.addEventListener('click', + () => this.onClick()); + } + + $onInit() { + if (this.info) this.classList.add('has-icons'); + } + + set field(value) { + this._field = value; + this.classList.toggle('not-empty', value != null && value !== ''); + } + + get field() { + return this._field; + } + + set type(value) { + this.input.type = value; + } + + get type() { + return this.input.type; + } + + set disabled(value) { + this._disabled = boolTag(value); + this.input.disabled = this._disabled; + this.classList.toggle('disabled', this._disabled); + } + + get disabled() { + return this._disabled; + } + + set readonly(value) { + this._readonly = boolTag(value); + this.input.readOnly = this._readonly; + this.classList.toggle('readonly', this._readonly); + } + + get readonly() { + return this._readonly; + } + + set required(value) { + this._required = boolTag(value); + let required = this.element.querySelector('.required'); + display(required, this._required); + } + + get required() { + return this._required; + } + + set prefix(value) { + this._prefix = value; + this.refreshFix('.prefix', value); + } + + get prefix() { + return this._prefix; + } + + set suffix(value) { + this._suffix = value; + this.refreshFix('.suffix', value); + } + + get suffix() { + return this._suffix; + } + + set hint(value) { + this._hint = value; + this.refreshHint(); + } + + get hint() { + return this._hint; + } + + set error(value) { + this._error = value; + this.refreshHint(); + this.classList.toggle('invalid', Boolean(value)); + } + + get error() { + return this._error; + } + + refreshHint() { + let hint = this.error || this.hint || ''; + let hintEl = this.element.querySelector('.hint'); + hintEl.innerText = hint; + hintEl.classList.toggle('filled', Boolean(hint)); + } + + refreshFix(selector, text) { + let fix = this.element.querySelector(selector); + display(fix, text); + fix.innerText = text || ''; + } + + onClick() { + if (this.input !== document.activeElement) + this.input.focus(); + } + + onFocus(hasFocus) { + this.classList.toggle('focused', hasFocus); + } + + onClear() { + this.input.value = ''; + this.input.dispatchEvent(new Event('change')); + } + + focus() { + this.input.focus(); + } + + select() { + this.input.select(); + } +} +Field.$inject = ['$element', '$scope']; + +ngModule.component('vnField', { + template: require('./index.html'), + transclude: { + prepend: '?prepend', + append: '?append' + }, + controller: Field, + bindings: { + field: '=?', + label: '@?', + name: '@?', + type: '@?', + info: '@?', + disabled: '@?', + readonly: '@?', + required: '@?', + prefix: '@?', + suffix: '@?', + hint: '@?', + error: ' .container { + display: flex; + align-items: stretch; + position: relative; + height: 56px; + + & > .infix { + position: relative; + display: flex; + flex: auto; + width: 100%; + min-width: 0; + + & > label { + position: absolute; + left: 0; + top: 18px; + line-height: 20px; + pointer-events: none; + color: $color-font-secondary; + transition-property: top, color, font-size; + transition-duration: 400ms; + transition-timing-function: cubic-bezier(.4, 0, .2, 1); + + & > .required { + display: none; + color: $color-alert + } + } + & > .fix { + padding-top: 24px; + line-height: 24px; + font-size: $input-font-size; + opacity: 0; + transition: opacity 200ms ease-in-out; + + &.prefix { + padding-right: 5px; + } + &.suffix { + padding-left: 5px; + } + } + & > .control { + height: 100%; + flex: auto; + } + & > .control > input { + padding-top: 24px; + padding-bottom: 8px; + height: inherit; + outline: none; + border: none; + font-family: Arial, sans-serif; + display: block; + font-size: $input-font-size; + width: 100%; + background: 0; + color: inherit; + box-sizing: border-box; + + &[type=time], + &[type=date] { + clip-path: inset(0 20px 0 0); + } + &[type=number] { + -moz-appearance: textfield; + + &::-webkit-outer-spin-button, + &::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; + } + } + &:invalid { + box-shadow: none; + } + } + } + & > .prepend, + & > .append, + & > .icons { + display: flex; + align-items: center; + color: $color-font-secondary; + } + & > .prepend > prepend, + & > .append > append, + & > .icons { + display: flex; + + & > vn-icon { + font-size: 24px; + } + } + & > .prepend > prepend { + padding-right: 12px; + } + & > .append > append { + padding-left: 12px; + } + & > .icons > vn-icon[icon=clear] { + display: none; + cursor: pointer; + } + & > .underline { + position: absolute; + bottom: 0; + content: ' '; + pointer-events: none; + width: 100%; + + &.blur { + border-bottom: 1px solid $color-input-underline; + transition: border-color 200ms ease-in-out; + } + &.focus { + height: 2px; + background-color: $color-main; + left: 50%; + width: 0; + transition-property: width, left, background-color; + transition-duration: 300ms; + transition-timing-function: cubic-bezier(.4, 0, .2, 1); + } + } + } + &.not-empty > .container, + &.focused > .container { + & > .infix { + & > .fix { + opacity: 1; + } + & > label { + top: 5px; + color: $color-main; + padding: 0; + font-size: 12px; + } + } + } + &.has-icons, + &.not-empty:hover, + &.not-empty.focused { + & > .container > .append > append { + padding-left: 0; + } + & > .container > .icons { + padding-left: 12px; + } + } + &:not(.disabled):not(.readonly) { + &.focused > .container > .underline.focus { + left: 0; + width: 100%; + } + & > .container:hover > .underline.blur { + border-color: $color-input-underline-hover; + } + &.not-empty:hover, + &.not-empty.focused { + & > .container > .icons > vn-icon[icon=clear] { + display: initial; + } + } + } + &:not(.not-empty):not(.focused) > .container > .infix > .control > input { + &[type=time], + &[type=date] { + opacity: 0; + } + } + &.readonly > .container { + & > .infix > .control > input { + caret-color: transparent; + } + & > .underline.blur { + border-bottom-style: dashed; + } + } + & > .hint { + z-index: -1; + padding-top: 8px; + height: 20px; + color: rgba(0, 0, 0, .4); + font-size: 12px; + transform: translateY(-28px); + transition-property: opacity, transform, color; + transition-duration: 200ms; + transition-timing-function: ease-in-out; + opacity: 0; + + &.filled { + z-index: 0; + opacity: 1; + transform: translateY(0); + } + } + &.invalid { + & > .container { + & > .infix > label { + color: $color-alert; + } + & > .underline.focus { + background-color: $color-alert; + } + & > .underline.blur { + border-bottom-color: $color-alert; + opacity: 1; + } + } + & > .hint { + color: $color-alert; + } + } +} +vn-table { + .vn-field { + margin: 0; + } +} diff --git a/front/core/components/index.js b/front/core/components/index.js index ff063ad24..1cfb18dca 100644 --- a/front/core/components/index.js +++ b/front/core/components/index.js @@ -29,18 +29,19 @@ import './label-value/label-value'; import './pagination/pagination'; import './searchbar/searchbar'; import './scroll-up/scroll-up'; -import './table'; -import './td-editable'; import './input-range'; import './calendar'; import './check'; import './chip'; import './color-legend'; import './data-viewer'; +import './field'; import './input-number'; import './input-time'; import './input-file'; import './radio'; +import './table'; +import './td-editable'; import './th'; import './treeview'; import './treeview/child'; diff --git a/front/core/components/radio/index.js b/front/core/components/radio/index.js index a8475c256..e965196c8 100644 --- a/front/core/components/radio/index.js +++ b/front/core/components/radio/index.js @@ -1,29 +1,14 @@ import ngModule from '../../module'; -import Component from '../../lib/component'; +import Toggle from '../toggle'; import './style.scss'; /** * Basic element for user input. You can use this to supply a way for the user * to pick an option from multiple choices. * - * @property {String} label Label to display along the component - * @property {any} field The value with which the element is linked - * @property {Boolean} checked Whether the radio is checked * @property {String} val The actual value of the option - * @property {Boolean} disabled Put component in disabled mode */ -export default class Controller extends Component { - constructor($element, $, $attrs) { - super($element, $); - this.hasInfo = Boolean($attrs.info); - this.info = $attrs.info || null; - - let element = this.element; - element.addEventListener('click', e => this.onClick(e)); - element.addEventListener('keydown', e => this.onKeydown(e)); - element.tabIndex = 0; - } - +export default class Radio extends Toggle { set field(value) { this._field = value; this.element.classList.toggle('checked', @@ -34,6 +19,14 @@ export default class Controller extends Component { return this._field; } + set checked(value) { + this.field = value ? this.val : null; + } + + get checked() { + return this.field == this.val; + } + set val(value) { this._val = value; this.field = this.field; @@ -43,51 +36,21 @@ export default class Controller extends Component { return this._val; } - set checked(value) { - this.field = value ? this.val : null; - this.$.$applyAsync(); - } - - get checked() { - return this.field == this.val; - } - - set disabled(value) { - this.element.tabIndex = !value ? 0 : -1; - this.element.classList.toggle('disabled', Boolean(value)); - this._disabled = value; - } - - get disabled() { - return this._disabled; - } - onClick(event) { - if (this.disabled) return; - event.preventDefault(); - + if (super.onClick(event)) return; this.field = this.val; - this.$.$applyAsync(); - this.element.dispatchEvent(new Event('change')); - } - - onKeydown(event) { - if (event.code == 'Space') - this.onClick(event); + this.changed(); } } -Controller.$inject = ['$element', '$scope', '$attrs']; - ngModule.component('vnRadio', { - template: require('./index.html'), - controller: Controller, - + template: require('../toggle/index.html'), + controller: Radio, bindings: { label: '@?', field: '=?', + disabled: ' { +describe('Component vnRadio', () => { let $element; let $ctrl; let element; @@ -8,8 +8,8 @@ describe('Component vnCheck', () => { })); beforeEach(inject(($compile, $rootScope) => { - $element = $compile(` { }); describe('field() setter', () => { - it(`should set model value`, () => { - $ctrl.field = true; - - expect($ctrl.field).toEqual(true); - }); - - it(`should uncheck value and change to true when clicked`, () => { - $ctrl.field = false; + it(`should change field value when clicked`, () => { element.click(); - expect($ctrl.field).toEqual(true); - }); - - it(`should check value and change to false when clicked`, () => { - $ctrl.field = true; - element.click(); - - expect($ctrl.field).toEqual(false); - }); - - it(`should uncheck value and change to null when clicked`, () => { - $ctrl.field = false; - $ctrl.tripleState = true; - element.click(); - - expect($ctrl.field).toEqual(null); - }); - - it(`should set value to null and change to true when clicked`, () => { - $ctrl.field = null; - $ctrl.tripleState = true; - element.click(); - - expect($ctrl.field).toEqual(true); - }); - - it(`should cast value to boolean when clicked`, () => { - $ctrl.field = 0; - element.click(); - - expect($ctrl.field).toEqual(true); + expect($ctrl.field).toEqual('myVal'); }); }); }); diff --git a/front/core/components/radio/style.scss b/front/core/components/radio/style.scss index a459cb96f..dd1555b7f 100644 --- a/front/core/components/radio/style.scss +++ b/front/core/components/radio/style.scss @@ -1,31 +1,14 @@ @import "variables"; vn-radio { - position: relative; - cursor: pointer; - display: inline-block; - outline: none; - - &.disabled { - cursor: inherit; - } - & > .radio { - position: relative; - box-sizing: border-box; - display: inline-block; - vertical-align: middle; + & > .btn { border-radius: 50%; - width: 20px; - height: 20px; - border: 2px solid #666; - margin: 6px 0; - margin-right: .4em; & > .mark { transition: background 250ms; } } - &.checked > .radio { + &.checked > .btn { border-color: $color-main; & > .mark { @@ -38,25 +21,5 @@ vn-radio { height: 10px; background-color: $color-main; } - & > .focus-mark { - background-color: rgba($color-main, .15); - } - } - & > .radio > .focus-mark { - position: absolute; - top: 50%; - left: 50%; - height: 38px; - width: 38px; - margin-top: -19px; - margin-left: -19px; - border-radius: 50%; - transform: scale3d(0, 0, 0); - transition: background 250ms; - transition: transform 250ms; - background-color: rgba(0, 0, 0, .1); - } - &:focus:not(.disabled) > .radio > .focus-mark { - transform: scale3d(1, 1, 1); } } diff --git a/front/core/components/radio/index.html b/front/core/components/toggle/index.html similarity index 78% rename from front/core/components/radio/index.html rename to front/core/components/toggle/index.html index 8a8e12b8f..3ec11242e 100644 --- a/front/core/components/radio/index.html +++ b/front/core/components/toggle/index.html @@ -1,4 +1,4 @@ -
+
diff --git a/front/core/components/toggle/index.js b/front/core/components/toggle/index.js new file mode 100644 index 000000000..7642c8973 --- /dev/null +++ b/front/core/components/toggle/index.js @@ -0,0 +1,62 @@ +import ngModule from '../../module'; +import Component from '../../lib/component'; +import './style.scss'; + +/** + * Base component with common logic and styles for checkbox and radio button. + * + * @property {String} label Label to display along the component + * @property {any} field The value with which the element is linked + * @property {Boolean} checked Whether the checkbox is checked + * @property {Boolean} disabled Put component in disabled mode + */ +export default class Toggle extends Component { + constructor($element, $) { + super($element, $); + + let element = this.element; + element.tabIndex = 0; + element.addEventListener('click', e => this.onClick(e)); + element.addEventListener('keydown', e => this.onKeydown(e)); + element.classList.add('vn-toggle'); + } + + set disabled(value) { + this.element.tabIndex = !value ? 0 : -1; + this.element.classList.toggle('disabled', Boolean(value)); + this._disabled = value; + } + + get disabled() { + return this._disabled; + } + + onKeydown(event) { + if (event.code == 'Space') + this.onClick(event); + } + + onClick(event) { + if (this.disabled || event.defaultPrevented) + return true; + + event.preventDefault(); + } + + changed() { + this.$.$applyAsync(); + this.element.dispatchEvent(new Event('change')); + this.emit('change', {value: this.field}); + } +} +Toggle.$inject = ['$element', '$scope']; + +ngModule.component('vnToggle', { + controller: Toggle, + bindings: { + label: '@?', + field: '=?', + disabled: ' span { + font-size: $input-font-size; + } + & > .btn { + position: relative; + box-sizing: border-box; + display: inline-block; + vertical-align: middle; + width: 20px; + height: 20px; + margin: 6px 0; + margin-right: .4em; + border: 2px solid #666; + } + &.checked > .btn { + border-color: $color-main; + + & > .focus-mark { + background-color: rgba($color-main, .15); + } + } + & > .btn > .focus-mark { + position: absolute; + top: 50%; + left: 50%; + height: 38px; + width: 38px; + margin-top: -19px; + margin-left: -19px; + border-radius: 50%; + transform: scale3d(0, 0, 0); + transition: background 250ms; + transition: transform 250ms; + background-color: rgba(0, 0, 0, .1); + } + &:focus:not(.disabled) > .btn > .focus-mark { + transform: scale3d(1, 1, 1); + } +} diff --git a/front/core/components/treeview/style.scss b/front/core/components/treeview/style.scss index 6370d0274..0ea1074a9 100644 --- a/front/core/components/treeview/style.scss +++ b/front/core/components/treeview/style.scss @@ -28,7 +28,7 @@ vn-treeview { & > vn-check:not(.indeterminate) { color: $color-main; - & > .check { + & > .btn { border-color: $color-main; } } diff --git a/front/salix/styles/variables.scss b/front/salix/styles/variables.scss index 932596ef9..ba77cd274 100644 --- a/front/salix/styles/variables.scss +++ b/front/salix/styles/variables.scss @@ -2,6 +2,7 @@ $menu-width: 16em; $topbar-height: 4em; $mobile-width: 800px; +$input-font-size: 14px; // Width @@ -49,6 +50,7 @@ $color-alert: #f42121; $color-spacer: rgba(0, 0, 0, .3); $color-spacer-light: rgba(0, 0, 0, .12); $color-input-underline: rgba(0, 0, 0, .12); +$color-input-underline-hover: rgba(0, 0, 0, .6); $color-shadow: rgba(0, 0, 0, .2); $color-hightlight: rgba(0, 0, 0, .05); $color-hover-cd: rgba(0, 0, 0, .1); @@ -86,6 +88,7 @@ $color-secondary: #ccc; $color-success: #a3d131; $color-notice: #32b1ce; $color-alert: #f42121; + $color-spacer: rgba(255, 255, 255, .3); $color-spacer-light: rgba(255, 255, 255, .12); $color-input-underline: rgba(255, 255, 255, .12); diff --git a/package-lock.json b/package-lock.json index 535c5229d..7b4445337 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2166,7 +2166,7 @@ }, "util": { "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -2960,7 +2960,7 @@ "base": { "version": "0.11.2", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", "dev": true, "requires": { "cache-base": "^1.0.1", @@ -3293,7 +3293,7 @@ }, "browserify-rsa": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { @@ -3352,7 +3352,7 @@ }, "buffer": { "version": "4.9.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "requires": { "base64-js": "^1.0.2", @@ -3490,7 +3490,7 @@ "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", "dev": true, "requires": { "collection-visit": "^1.0.0", @@ -3528,7 +3528,7 @@ }, "camelcase-keys": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { @@ -3667,7 +3667,7 @@ "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha1-+TNprouafOAv1B+q0MqDAzGQxGM=", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", "dev": true, "requires": { "arr-union": "^3.1.0", @@ -4769,7 +4769,7 @@ "dot-prop": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", - "integrity": "sha1-HxngwuGqDjJ5fEl5nyg3rGr2nFc=", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", "requires": { "is-obj": "^1.0.0" } @@ -4801,7 +4801,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -4924,7 +4924,7 @@ "dependencies": { "fs-extra": { "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", + "resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", "dev": true, "requires": { @@ -4937,7 +4937,7 @@ }, "jsonfile": { "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", "dev": true, "requires": { @@ -5840,7 +5840,7 @@ }, "file-loader": { "version": "1.1.11", - "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", + "resolved": "http://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", "integrity": "sha512-TGR4HU7HUsGg6GCOPJnFk06RhWgEWFLAGWiT6rcD+GRC2keU3s9RGJ+b3Z6/U73jwwNb2gKLJ7YCrp+jvU4ALg==", "dev": true, "requires": { @@ -6204,7 +6204,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -6225,12 +6226,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6245,17 +6248,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -6372,7 +6378,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -6384,6 +6391,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6398,6 +6406,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6405,12 +6414,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -6429,6 +6440,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -6509,7 +6521,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -6521,6 +6534,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -6606,7 +6620,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -6642,6 +6657,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -6661,6 +6677,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -6704,12 +6721,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -6992,7 +7011,7 @@ "global-modules": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha1-bXcPDrUjrHgWTXK15xqIdyZcw+o=", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "dev": true, "requires": { "global-prefix": "^1.0.1", @@ -7029,7 +7048,7 @@ }, "globby": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "resolved": "http://registry.npmjs.org/globby/-/globby-5.0.0.tgz", "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", "dev": true, "requires": { @@ -7133,7 +7152,7 @@ }, "got": { "version": "6.7.1", - "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", + "resolved": "http://registry.npmjs.org/got/-/got-6.7.1.tgz", "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", "dev": true, "requires": { @@ -7466,7 +7485,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, @@ -7686,7 +7705,7 @@ "dependencies": { "es6-promise": { "version": "3.3.1", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "resolved": "http://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=", "dev": true }, @@ -8720,7 +8739,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=" }, "is-path-cwd": { @@ -8750,7 +8769,7 @@ "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "requires": { "isobject": "^3.0.1" @@ -9101,7 +9120,7 @@ }, "jasmine-core": { "version": "2.99.1", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", + "resolved": "http://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", "integrity": "sha1-5kAN8ea1bhMLYcS80JPap/boyhU=", "dev": true }, @@ -10224,7 +10243,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -11013,7 +11032,7 @@ }, "media-typer": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, "mem": { @@ -11038,7 +11057,7 @@ }, "meow": { "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz", "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { @@ -11161,7 +11180,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" }, "minstache": { @@ -11273,7 +11292,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" @@ -11281,7 +11300,7 @@ "dependencies": { "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" } } @@ -11482,7 +11501,7 @@ }, "multipipe": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", + "resolved": "http://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", "dev": true, "requires": { @@ -11688,7 +11707,7 @@ }, "jsesc": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true }, @@ -12330,7 +12349,7 @@ "dependencies": { "minimist": { "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", "dev": true }, @@ -12392,7 +12411,7 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, @@ -12408,7 +12427,7 @@ }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -12931,7 +12950,7 @@ }, "pretty-bytes": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", + "resolved": "http://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", "integrity": "sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ=", "dev": true, "requires": { @@ -13022,7 +13041,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -13040,7 +13059,7 @@ }, "through2": { "version": "0.2.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.2.3.tgz", + "resolved": "http://registry.npmjs.org/through2/-/through2-0.2.3.tgz", "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=", "dev": true, "requires": { @@ -13859,7 +13878,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { @@ -13984,7 +14003,7 @@ "dependencies": { "source-map": { "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { @@ -14404,7 +14423,7 @@ "snapdragon-node": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "dev": true, "requires": { "define-property": "^1.0.0", @@ -14455,7 +14474,7 @@ "snapdragon-util": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", "dev": true, "requires": { "kind-of": "^3.2.0" @@ -14736,7 +14755,7 @@ "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "dev": true, "requires": { "extend-shallow": "^3.0.0" @@ -14745,7 +14764,7 @@ "split2": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", - "integrity": "sha1-GGsldbz4PoW30YRldWI47k7kJJM=", + "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", "dev": true, "requires": { "through2": "^2.0.2" @@ -15671,7 +15690,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "through2": { @@ -15866,7 +15885,7 @@ "touch": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha1-/jZfX3XsntTlaCXgu3bSSrdK+Ds=", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", "dev": true, "requires": { "nopt": "~1.0.10" @@ -15964,7 +15983,7 @@ }, "tty-browserify": { "version": "0.0.0", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "resolved": "http://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", "dev": true }, From 9b385f4b90f321ba7025d2fa7aea6941a59d6265 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 4 Oct 2019 13:12:53 +0200 Subject: [PATCH 11/13] #1749 Fixed --- front/salix/styles/variables.scss | 2 +- modules/worker/front/time-control/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/front/salix/styles/variables.scss b/front/salix/styles/variables.scss index ba77cd274..5b96973f2 100644 --- a/front/salix/styles/variables.scss +++ b/front/salix/styles/variables.scss @@ -2,7 +2,7 @@ $menu-width: 16em; $topbar-height: 4em; $mobile-width: 800px; -$input-font-size: 14px; +$input-font-size: 16px; // Width diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index 551d5531d..a13a1d384 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -218,9 +218,9 @@ class Controller { const timed = new Date(weekday.dated); const now = new Date(); - now.setHours(now.getHours(), now.getMinutes(), 0, 0); now.setMonth(timed.getMonth()); now.setDate(timed.getDate()); + now.setHours(0, 0, 0, 0); this.newTime = now; this.selectedWeekday = weekday; From 82fd9505ea0da0a18d85ca2d69bf6b4513dc4505 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 4 Oct 2019 13:13:14 +0200 Subject: [PATCH 12/13] =?UTF-8?q?#1587=20e2e=20client.create=20A=C3=B1adir?= =?UTF-8?q?=20c=C3=B3digo=20postal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../02-client-module/01_create_client.spec.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/e2e/paths/02-client-module/01_create_client.spec.js b/e2e/paths/02-client-module/01_create_client.spec.js index b67a89e68..f2fe30464 100644 --- a/e2e/paths/02-client-module/01_create_client.spec.js +++ b/e2e/paths/02-client-module/01_create_client.spec.js @@ -65,6 +65,18 @@ describe('Client create path', () => { expect(result).toEqual('Some fields are invalid'); }); + it(`should attempt to create a new user with all it's data but wrong postal code`, async() => { + const result = await nightmare + .clearInput(selectors.createClientView.email) + .write(selectors.createClientView.email, 'CarolDanvers@verdnatura.es') + .clearInput(selectors.createClientView.postcode) + .write(selectors.createClientView.postcode, '479999') + .waitToClick(selectors.createClientView.createButton) + .waitForLastSnackbar(); + + expect(result).toEqual(`The postcode doesn't exists. Ensure you put the correct format`); + }); + it(`should check for autocompleted city, province and country`, async() => { const clientCity = await nightmare .waitToGetProperty(`${selectors.createClientView.city}`, 'value'); @@ -82,8 +94,8 @@ describe('Client create path', () => { it(`should create a new user with all correct data`, async() => { const result = await nightmare - .clearInput(selectors.createClientView.email) - .write(selectors.createClientView.email, 'caroldanvers@verdnatura.es') + .clearInput(selectors.createClientView.postcode) + .write(selectors.createClientView.postcode, '46000') .waitToClick(selectors.createClientView.createButton) .waitForLastSnackbar(); From 95b96bb91f309cacfd3a8c993e55476c32f934a2 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 4 Oct 2019 14:27:55 +0200 Subject: [PATCH 13/13] added default schema --- db/changes/10081-agency/00-zone.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/db/changes/10081-agency/00-zone.sql b/db/changes/10081-agency/00-zone.sql index 6abab582e..d01008a32 100644 --- a/db/changes/10081-agency/00-zone.sql +++ b/db/changes/10081-agency/00-zone.sql @@ -1,5 +1,6 @@ +USE `vn`; -CREATE TABLE vn.`zoneWarehouse` ( +CREATE TABLE `vn`.`zoneWarehouse` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `zoneFk` int(11) NOT NULL, `warehouseFk` smallint(6) unsigned NOT NULL, @@ -10,7 +11,7 @@ CREATE TABLE vn.`zoneWarehouse` ( CONSTRAINT `zoneWarehouse_ibfk_2` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; -CREATE TABLE vn.`zoneEvent` ( +CREATE TABLE `vn`.`zoneEvent` ( `id` int(11) NOT NULL AUTO_INCREMENT, `zoneFk` int(11) NOT NULL, `from` date DEFAULT NULL, @@ -25,7 +26,7 @@ CREATE TABLE vn.`zoneEvent` ( CONSTRAINT `zoneEvent_ibfk_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8; -CREATE TABLE vn.`zoneExclusion` ( +CREATE TABLE `vn`.`zoneExclusion` ( `id` int(11) NOT NULL AUTO_INCREMENT, `zoneFk` int(11) NOT NULL, `day` date NOT NULL,