From 7986405a7276e4c5e05c08a55069d70ce5342113 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 4 Feb 2019 10:10:57 +0100 Subject: [PATCH 01/24] added sepa-core & letter-debtor --- modules/item/front/diary/index.js | 4 +- print/common/css/layout.css | 192 +++++---- print/common/css/misc.css | 10 +- print/config/routes.json | 1 + print/lib/reportEngine.js | 2 +- print/report/payment-update/index.js | 4 +- print/report/printer-setup/index.js | 10 +- .../report/report-footer/assets/css/style.css | 7 +- .../report/report-header/assets/css/style.css | 4 +- .../assets/css/style.css | 2 +- .../report/rpt-claim-pickup-order/index.html | 64 +-- .../rpt-letter-debtor/assets/css/style.css | 2 +- print/report/rpt-letter-debtor/index.html | 78 ++-- .../report/rpt-sepa-core/assets/css/style.css | 21 +- print/report/rpt-sepa-core/index.html | 371 ++++++------------ print/report/rpt-sepa-core/locale.js | 25 +- print/report/sepa-core/assets/css/index.js | 6 + print/report/sepa-core/assets/css/style.css | 40 ++ print/report/sepa-core/index.html | 29 ++ print/report/sepa-core/index.js | 48 +++ print/report/sepa-core/locale.js | 16 + 21 files changed, 524 insertions(+), 412 deletions(-) create mode 100644 print/report/sepa-core/assets/css/index.js create mode 100644 print/report/sepa-core/assets/css/style.css create mode 100644 print/report/sepa-core/index.html create mode 100755 print/report/sepa-core/index.js create mode 100644 print/report/sepa-core/locale.js diff --git a/modules/item/front/diary/index.js b/modules/item/front/diary/index.js index 09d3383fd..6745ad94c 100644 --- a/modules/item/front/diary/index.js +++ b/modules/item/front/diary/index.js @@ -147,8 +147,8 @@ class Controller { this.$scope.descriptor.ticketFk = sale.origin; this.$scope.descriptor.parent = event.target; this.$scope.descriptor.show(); + event.preventDefault(); - event.stopImmediatePropagation(); } showClientDescriptor(event, sale) { @@ -157,8 +157,8 @@ class Controller { this.$scope.clientDescriptor.clientFk = sale.clientFk; this.$scope.clientDescriptor.parent = event.target; this.$scope.clientDescriptor.show(); + event.preventDefault(); - event.stopImmediatePropagation(); } onDescriptorLoad() { diff --git a/print/common/css/layout.css b/print/common/css/layout.css index 2f2a4f7c9..216d9fcae 100644 --- a/print/common/css/layout.css +++ b/print/common/css/layout.css @@ -1,5 +1,5 @@ .container { - font-family: verdana, sans-serif; + font-family: arial, sans-serif; font-size: 16px; zoom: 0.55 } @@ -33,9 +33,18 @@ float: left } +.clearfix { + overflow: hidden; + display: block; + clear: both +} + .row { - white-space: nowrap; - margin-bottom: 15px + margin-bottom: 15px; + overflow: hidden; + display: block; + clear: both; + width: 100% } .row.small { @@ -52,13 +61,36 @@ box-sizing: border-box } +.row:last-child { + margin-bottom: 0 +} + +.row.inline .text { + display: table-cell; + margin-bottom: 0; + width: 30% +} + +.row.inline .control { + display: table-cell; + padding-left: 20px; + font-weight: bold; + color: #000; + width: 70% +} + +.row.inline .description { + position: static; + overflow: visible +} + .row .description { position: relative; padding-top: 2px; - overflow: hidden; font-size: 9px; + overflow: hidden; display: block; - color: #999 + clear: both } .row .line { @@ -78,42 +110,17 @@ float: left } -.row:last-child { - margin-bottom: 0 -} - -.row.inline .text { - display: inline-block; - margin-bottom: 0; - width: 40%; - -} - -.row.inline .control { - display: inline-block; - font-weight: bold; - padding-left: 20px; - color: #000; - width: 60% -} - -.row.inline .description { - position: static; - overflow: visible -} - .panel { position: relative } .panel .header { background-color: #FFF; - position:absolute; - left: 17.5px; - top: -12px; padding: 2.5px 5px; - + position: absolute; font-weight: bold; + left: 17.5px; + top: -12px } .panel .body { @@ -127,22 +134,27 @@ margin-top: 0 } -.box { - border-top: 1px solid #CCC; - border-right: 1px solid #CCC; +.field { border-bottom: 1px solid #CCC; - font-weight: bold; - text-align: center; - padding-top: 4px; - width: 25px; - height: 21px; - color: #000; + border-left: 1px solid #CCC; + border-top: 1px solid #CCC; float: left } -.box.crossed { - font-weight: 100; - font-size: 16px +.field span { + border-right: 1px solid #CCC; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + display: table-cell; + vertical-align: middle; + text-align: center; + font-weight: bold +} + +.field.square span { + height: 35.4px; + width: 35.4px } .pull-left { @@ -153,53 +165,89 @@ float: right } -.verticalText { +.vertical-text { -moz-transform: rotate(90deg); -webkit-transform: rotate(90deg); transform: rotate(90deg); position: absolute; text-align: center; font-size: .65em; + right: -108px; width: 200px; - border: 2px solid #000; - right: -110px; top: 50% } -vn-table { +table { border-collapse: collapse; - margin: 20px 0; - display: table; - width: 100%; + border-spacing: 0; } -vn-thead { +.row-oriented, .column-oriented { + text-align: left; + width: 100% +} + +.row-oriented .description, +.column-oriented .description { + font-size: 0.6em; + color: #888; + padding: 0 !important +} + +.row-oriented .description .line, +.column-oriented .description .line { + border-bottom: 1px solid #DDD; + border-right: 1px solid #DDD; + border-left: 1px solid #DDD; + margin-top: 10px; + color: #999; + padding: 5px +} + +.row-oriented .description span, +.column-oriented .description span { + background-color: #FFF; + margin: -5px 0 0 50px; + display: block; + padding: 5px; + float: left +} + +.column-oriented { + margin: 20px 0 +} + +.column-oriented tfoot { + border-top: 1px solid #808080; +} + +.column-oriented td, .column-oriented th { + padding: 5px 10px +} + +.column-oriented thead { + background-color: #c0c0c0 +} + +.column-oriented thead tr { border-bottom: 1px solid #808080; border-top: 1px solid #808080; - display: table-header-group + background-color: #c0c0c0 } -vn-tbody { - border-top: 3px solid #888888; - display: table-row-group +.column-oriented tfoot tr:first-child td { + padding-top: 20px !important; } -vn-tfoot { - border-top: 1px solid #808080; - display: table-footer-group +.panel .row-oriented td, .panel .row-oriented th { + padding: 10px 0 } -vn-tr { - display: table-row -} - -vn-th { - font-weight: bold +.row-oriented > tbody > tr > td { + width: 30% } -vn-td, vn-th { - vertical-align: middle; - display: table-cell; - text-align: left; - padding: 5px 0 -} +.row-oriented > tbody > tr > th { + padding-left: 30px; + width: 70% +} \ No newline at end of file diff --git a/print/common/css/misc.css b/print/common/css/misc.css index d1e7edf27..91af817b1 100644 --- a/print/common/css/misc.css +++ b/print/common/css/misc.css @@ -10,6 +10,14 @@ text-align: right } -.gray { +.font.gray { color: #555 +} + +.font.light-gray { + color: #888 +} + +.font.small { + font-size: 0.65em } \ No newline at end of file diff --git a/print/config/routes.json b/print/config/routes.json index 242557e51..bb3b39aa8 100644 --- a/print/config/routes.json +++ b/print/config/routes.json @@ -5,6 +5,7 @@ {"type": "email", "name": "letter-debtor-st"}, {"type": "email", "name": "letter-debtor-nd"}, {"type": "email", "name": "claim-pickup-order"}, + {"type": "email", "name": "sepa-core"}, {"type": "report", "name": "delivery-note"}, {"type": "report", "name": "invoice"}, {"type": "report", "name": "rpt-claim-pickup-order"}, diff --git a/print/lib/reportEngine.js b/print/lib/reportEngine.js index 899893b7f..0bdef6aa9 100644 --- a/print/lib/reportEngine.js +++ b/print/lib/reportEngine.js @@ -107,7 +107,7 @@ module.exports = { format: 'A4', border: '1.5cm', footer: { - height: '80px', + height: '60px', } }; diff --git a/print/report/payment-update/index.js b/print/report/payment-update/index.js index d5a51d255..05c0bb64a 100755 --- a/print/report/payment-update/index.js +++ b/print/report/payment-update/index.js @@ -13,7 +13,7 @@ module.exports = { if (!params.clientFk) throw new UserException('No client id specified'); - return this.methods.fetchClientData(params.clientFk) + return this.methods.fetchClient(params.clientFk) .then(([result]) => { if (!result) throw new UserException('No client data found'); @@ -24,7 +24,7 @@ module.exports = { this.$i18n.locale = this.locale; }, methods: { - fetchClientData(clientFk) { + fetchClient(clientFk) { return database.pool.query(` SELECT u.lang locale, diff --git a/print/report/printer-setup/index.js b/print/report/printer-setup/index.js index 5214bbb43..aaf0a4d5d 100755 --- a/print/report/printer-setup/index.js +++ b/print/report/printer-setup/index.js @@ -1,6 +1,4 @@ const database = require(`${appPath}/lib/database`); -const emailHeader = require('../email-header'); -const emailFooter = require('../email-footer'); const UserException = require(`${appPath}/lib/exceptions/userException`); module.exports = { @@ -13,7 +11,7 @@ module.exports = { if (!params.clientFk) throw new UserException('No client id specified'); - return this.methods.fetchClientData(params.clientFk) + return this.methods.fetchClient(params.clientFk) .then(([result]) => { if (!result) throw new UserException('No client data found'); @@ -29,7 +27,7 @@ module.exports = { }; }, methods: { - fetchClientData(clientFk) { + fetchClient(clientFk) { return database.pool.query(` SELECT c.id, @@ -47,7 +45,7 @@ module.exports = { }, }, components: { - 'email-header': emailHeader, - 'email-footer': emailFooter, + 'email-header': require('../email-header'), + 'email-footer': require('../email-footer'), }, }; diff --git a/print/report/report-footer/assets/css/style.css b/print/report/report-footer/assets/css/style.css index 5c44d3a6d..3422b3cc2 100644 --- a/print/report/report-footer/assets/css/style.css +++ b/print/report/report-footer/assets/css/style.css @@ -1,13 +1,12 @@ footer { font-family: verdana, sans-serif; - font-size: 12px; + font-size: 0.55em; color: #555; - zoom: 0.55 + zoom: 0.65 } footer, footer p { - text-align: center; - font-size: 12px + text-align: center } footer .page { diff --git a/print/report/report-header/assets/css/style.css b/print/report/report-header/assets/css/style.css index c152261de..39525c1b5 100644 --- a/print/report/report-header/assets/css/style.css +++ b/print/report/report-header/assets/css/style.css @@ -3,11 +3,11 @@ header { padding-bottom: 10px; margin-bottom: 40px; text-align: center; - font-size: 12px; + font-size: 0.65em; color: #555 } header img { margin-bottom: 10px; width: 350px -} \ No newline at end of file +} diff --git a/print/report/rpt-claim-pickup-order/assets/css/style.css b/print/report/rpt-claim-pickup-order/assets/css/style.css index dcf1a56ae..21b89e27b 100644 --- a/print/report/rpt-claim-pickup-order/assets/css/style.css +++ b/print/report/rpt-claim-pickup-order/assets/css/style.css @@ -9,7 +9,7 @@ font-size: 2em } -vn-table { +table.column-oriented { margin-top: 50px !important } diff --git a/print/report/rpt-claim-pickup-order/index.html b/print/report/rpt-claim-pickup-order/index.html index 9862260f2..c5001c984 100644 --- a/print/report/rpt-claim-pickup-order/index.html +++ b/print/report/rpt-claim-pickup-order/index.html @@ -8,18 +8,22 @@

{{$t('title')}}

-
-
{{$t('claimId')}}:
-
{{claimId}}
-
-
-
{{$t('clientId')}}:
-
{{clientId}}
-
-
-
{{$t('date')}}:
-
{{dated()}}
-
+ + + + + + + + + + + + + + + +
{{$t('claimId')}}{{claimId}}
{{$t('clientId')}}{{clientId}}
{{$t('date')}}{{dated()}}
@@ -41,24 +45,24 @@
- - - - {{$t('reference')}} - {{$t('quantity')}} - {{$t('claims')}} - {{$t('concept')}} - - - - - {{sale.id}} - {{sale.quantity}} - {{sale.claimQuantity}} - {{sale.concept}} - - - + + + + + + + + + + + + + + + + + +
{{$t('reference')}}{{$t('quantity')}}{{$t('claims')}}{{$t('concept')}}
{{sale.id}}{{sale.quantity}}{{sale.claimQuantity}}{{sale.concept}}
diff --git a/print/report/rpt-letter-debtor/assets/css/style.css b/print/report/rpt-letter-debtor/assets/css/style.css index ae9b314c0..05dbab652 100644 --- a/print/report/rpt-letter-debtor/assets/css/style.css +++ b/print/report/rpt-letter-debtor/assets/css/style.css @@ -9,6 +9,6 @@ font-size: 2em } -vn-table { +table.column-oriented { margin-top: 50px !important } \ No newline at end of file diff --git a/print/report/rpt-letter-debtor/index.html b/print/report/rpt-letter-debtor/index.html index e2458f223..b65bfb97f 100644 --- a/print/report/rpt-letter-debtor/index.html +++ b/print/report/rpt-letter-debtor/index.html @@ -8,14 +8,18 @@

{{$t('title')}}

-
-
{{$t('clientId')}}:
-
{{clientId}}
-
-
-
{{$t('date')}}:
-
{{dated()}}
-
+ + + + + + + + + + + +
{{$t('clientId')}}{{clientId}}
{{$t('date')}}{{dated()}}
@@ -37,35 +41,35 @@
- - - - {{$t('date')}} - {{$t('concept')}} - {{$t('invoiced')}} - {{$t('payed')}} - {{$t('balance')}} - - - - - {{toISOString(sale.issued)}} - {{sale.ref}} - {{sale.debtOut}} - {{sale.debtIn}} - {{getBalance(sale)}} - - - - - - Total - {{getTotalDebtOut()}} - {{getTotalDebtIn()}} - {{totalBalance}} - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('date')}}{{$t('concept')}}{{$t('invoiced')}}{{$t('payed')}}{{$t('balance')}}
{{toISOString(sale.issued)}}{{sale.ref}}{{sale.debtOut}}{{sale.debtIn}}{{getBalance(sale)}}
Total {{getTotalDebtOut()}}{{getTotalDebtIn()}}{{totalBalance}}
+

{{$t('title')}}

-
{{$t('supplier.toCompleteBySupplier')}}
-
-
{{$t('supplier.orderReference')}}
-
{{mandateCode}}
-
-
-
{{$t('supplier.identifier')}}
-
ES89000B97367486
-
-
-
{{$t('supplier.name')}}
-
{{supplierName}}
-
-
-
{{$t('supplier.street')}}
-
{{supplierStreet}}
-
-
-
{{$t('supplier.location')}}
-
{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})
-
-
-
{{$t('supplier.country')}}
-
{{supplierCountry}}
+
+ {{$t('supplier.toCompleteBySupplier')}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('supplier.orderReference')}}{{mandateCode}} +
{{$t('supplier.identifier')}}ES89000B97367486
{{$t('supplier.name')}}{{supplierName}}
{{$t('supplier.street')}}{{supplierStreet}}
{{$t('supplier.location')}}{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})
{{$t('supplier.country')}}{{supplierCountry}}
-
+

{{$t('description')}}

+

+ {{$t('documentCopy')}} +

+ +
-
{{$t('supplier.toCompleteBySupplier')}}
-
-
{{$t('supplier.orderReference')}}
-
{{mandateCode}}
+
+ {{$t('client.toCompleteByClient')}}
-
-
{{$t('supplier.identifier')}}
-
ES89000B97367486
-
-
-
{{$t('supplier.name')}}
-
{{supplierName}}
-
-
-
{{$t('supplier.street')}}
-
{{supplierStreet}}
-
-
-
{{$t('supplier.location')}}
-
{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})
-
-
-
{{$t('supplier.country')}}
-
{{supplierCountry}}
-
-
-
-
-
-
{{$t('supplier.toCompleteBySupplier')}}
-
-
{{$t('supplier.orderReference')}}
-
{{mandateCode}}
-
-
-
{{$t('supplier.identifier')}}
-
ES89000B97367486
-
-
-
{{$t('supplier.name')}}
-
{{supplierName}}
-
-
-
{{$t('supplier.street')}}
-
{{supplierStreet}}
-
-
-
{{$t('supplier.location')}}
-
{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})
-
-
-
{{$t('supplier.country')}}
-
{{supplierCountry}}
-
-
-
- - -
-
-
{{$t('supplier.toCompleteBySupplier')}}
-
-
{{$t('supplier.orderReference')}}
-
{{mandateCode}}
-
-
-
{{$t('supplier.identifier')}}
-
ES89000B97367486
-
-
-
{{$t('supplier.name')}}
-
{{supplierName}}
-
-
-
{{$t('supplier.street')}}
-
{{supplierStreet}}
-
-
-
{{$t('supplier.location')}}
-
{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})
-
-
-
{{$t('supplier.country')}}
-
{{supplierCountry}}
-
-
-
- -
-
-
{{$t('supplier.toCompleteBySupplier')}}
-
-
{{$t('supplier.orderReference')}}
-
{{mandateCode}}
-
-
-
{{$t('supplier.identifier')}}
-
ES89000B97367486
-
-
-
{{$t('supplier.name')}}
-
{{supplierName}}
-
-
-
{{$t('supplier.street')}}
-
{{supplierStreet}}
-
-
-
{{$t('supplier.location')}}
-
{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})
-
-
-
{{$t('supplier.country')}}
-
{{supplierCountry}}
-
-
-
- - -
-
-
{{$t('supplier.toCompleteBySupplier')}}
-
-
{{$t('supplier.orderReference')}}
-
{{mandateCode}}
-
-
-
{{$t('supplier.identifier')}}
-
ES89000B97367486
-
-
-
{{$t('supplier.name')}}
-
{{supplierName}}
-
-
-
{{$t('supplier.street')}}
-
{{supplierStreet}}
-
-
-
{{$t('supplier.location')}}
-
{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})
-
-
-
{{$t('supplier.country')}}
-
{{supplierCountry}}
-
-
-
- - + + + + {{$t('client.accountNumber')}} + + + +
+ E + S + +
+ + + + +
+ {{$t('client.accountNumberFormat')}} +
+ + + + {{$t('client.paymentType')}} + + + + + + + + + +
+
+ X +
+
{{$t('client.recurrent')}}O +
+ +
+
{{$t('client.unique')}}
+ + + + {{$t('client.signLocation')}} + {{dated()}}, {{supplierProvince}} + + + {{$t('client.sign')}} + + + + +
+
+ +

{{$t('mandatoryFields')}}

+

{{$t('sendOrder')}}

diff --git a/print/report/rpt-sepa-core/locale.js b/print/report/rpt-sepa-core/locale.js index e95265a26..c5b5f7519 100644 --- a/print/report/rpt-sepa-core/locale.js +++ b/print/report/rpt-sepa-core/locale.js @@ -2,6 +2,15 @@ module.exports = { messages: { es: { title: 'Orden de domiciliación de adeudo SEPA CORE', + description: `Mediante la firma de esta orden de domiciliación, el deudor autoriza (A) al acreedor a enviar instrucciones + a la entidad del deudor para adeudar su cuenta y (B) a la entidad para efectuar los adeudos en su cuenta siguiendo las + instrucciones del acreedor.Como parte de sus derechos, el deudor está legitimado al reembolso por su entidad en los + términos y condiciones del contrato suscrito con la misma. La solicitud de reembolso deberá efectuarse dentro de las + ocho semanas que adeudo en cuenta. Puede obtener información adicional sobre sus derechos en su entidad financiera.`, + documentCopy: `Debe llevar a su Entidad Bancaria una copia + del documento firmado para que lo registre y evitar la devolución.`, + mandatoryFields: `TODOS LOS CAMPOS HAN DE SER CUMPLIMENTADOS OBLIGATORIAMENTE.`, + sendOrder: `UNA VEZ FIRMADA ESTA ORDEN DE DOMICILIACIÓN DEBE SER ENVIADA AL ACREEDOR PARA SU CUSTODIA Y ES RECOMENDABLE FACILITAR UNA COPIA A SU ENTIDAD BANCARIA.`, supplier: { toCompleteBySupplier: 'A cumplimentar por el acreedor', orderReference: 'Referencia de la orden de domiciliación', @@ -9,11 +18,25 @@ module.exports = { name: 'Nombre del acreedor', street: 'Dirección', location: 'CP - Población - Provincia', - country: 'País', + country: 'País' }, client: { toCompleteByClient: 'A cumplimentar por el deudor', + name: 'Nombre del deudor/es', + street: 'Dirección del deudor', + location: 'CP - Población - Provincia', + country: 'País del deudor', + swift: 'Swift BIC', + accountNumber: 'Número de cuenta - IBAN', + accountHolder: '(Titular/es de la cuenta de cargo)', + accountNumberFormat: 'En España el IBAN consta de 24 posiciones comenzando siempre por ES', + paymentType: 'Tipo de pago', + recurrent: 'Recurrente', + unique: 'Único', + signLocation: 'Fecha - Localidad', + sign: 'Firma del deudor y sello', }, + order: 'Ord. domiciliación {0}', }, }, }; diff --git a/print/report/sepa-core/assets/css/index.js b/print/report/sepa-core/assets/css/index.js new file mode 100644 index 000000000..c1943eee1 --- /dev/null +++ b/print/report/sepa-core/assets/css/index.js @@ -0,0 +1,6 @@ +const CssReader = require(`${appPath}/lib/cssReader`); + +module.exports = new CssReader([ + `${appPath}/common/css/layout.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/report/sepa-core/assets/css/style.css b/print/report/sepa-core/assets/css/style.css new file mode 100644 index 000000000..a197ee5cd --- /dev/null +++ b/print/report/sepa-core/assets/css/style.css @@ -0,0 +1,40 @@ +body { + background-color: #EEE +} + +.container { + max-width: 600px; + min-width: 320px; + margin: 0 auto; + color: #555 +} + +.main { + background-color: #FFF; + padding: 20px +} + +.main a { + color: #8dba25 +} + +.main h1 { + color: #999 +} + +.main h3 { + font-size: 16px +} + +.title { + background-color: #95d831; + text-transform: uppercase; + text-align: center; + padding: 35px 0 +} + +.title h1 { + font-size: 32px; + color: #333; + margin: 0 +} \ No newline at end of file diff --git a/print/report/sepa-core/index.html b/print/report/sepa-core/index.html new file mode 100644 index 000000000..6c1355708 --- /dev/null +++ b/print/report/sepa-core/index.html @@ -0,0 +1,29 @@ + + + + {{ $t('subject') }} + + +
+ + + + +
+ +
+

{{ $t('title') }}

+
+ + +

{{$t('description.dear')}},

+

{{$t('description.instructions')}}

+

{{$t('description.conclusion')}}

+ +
+ + + +
+ + \ No newline at end of file diff --git a/print/report/sepa-core/index.js b/print/report/sepa-core/index.js new file mode 100755 index 000000000..3a281ec32 --- /dev/null +++ b/print/report/sepa-core/index.js @@ -0,0 +1,48 @@ +const database = require(`${appPath}/lib/database`); +const reportEngine = require(`${appPath}/lib/reportEngine.js`); +const UserException = require(`${appPath}/lib/exceptions/userException`); + +module.exports = { + name: 'sepa-core', + async asyncData(ctx, params) { + const promises = []; + const data = { + isPreview: ctx.method === 'GET', + }; + + if (!params.clientFk) + throw new UserException('No client id specified'); + + promises.push(reportEngine.toPdf('rpt-sepa-core', ctx)); + promises.push(this.methods.fetchClient(params.clientFk)); + + return Promise.all(promises).then(result => { + const stream = result[0]; + const [[client]] = result[1]; + + Object.assign(data, client); + Object.assign(data, {attachments: [{filename: 'rpt-sepa-core.pdf', content: stream}]}); + + return data; + }); + }, + created() { + this.$i18n.locale = this.locale; + }, + + methods: { + fetchClient(clientFk) { + return database.pool.query(` + SELECT + u.lang locale, + c.email recipient + FROM client c + JOIN account.user u ON u.id = c.id + WHERE c.id = ?`, [clientFk]); + }, + }, + components: { + 'email-header': require('../email-header'), + 'email-footer': require('../email-footer'), + }, +}; diff --git a/print/report/sepa-core/locale.js b/print/report/sepa-core/locale.js new file mode 100644 index 000000000..0eea8d9f3 --- /dev/null +++ b/print/report/sepa-core/locale.js @@ -0,0 +1,16 @@ +module.exports = { + messages: { + es: { + subject: 'Solicitud de domiciliación bancaria', + title: 'Domiciliación SEPA CORE', + description: { + dear: 'Estimado cliente', + instructions: `Para poder tramitar tu solicitud de cambio de tu forma de pago a giro bancario, + te adjuntamos los documentos correspondientes a la ley de pago, que tienes que cumplimentar y enviarnos.`, + conclusion: 'Gracias por tu atención.' + }, + }, + }, +}; + + From af6a9d8022db8af4a01d8d28af1f45398ad858a5 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 4 Feb 2019 12:14:07 +0100 Subject: [PATCH 02/24] fixed zone treeview bugs --- front/core/components/treeview/child.html | 2 +- front/core/components/treeview/index.js | 1 + modules/agency/front/index/index.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/front/core/components/treeview/child.html b/front/core/components/treeview/child.html index 437e7ca7d..af5fe128b 100644 --- a/front/core/components/treeview/child.html +++ b/front/core/components/treeview/child.html @@ -5,7 +5,7 @@ - diff --git a/front/core/components/treeview/index.js b/front/core/components/treeview/index.js index 6449ec450..e732d4347 100644 --- a/front/core/components/treeview/index.js +++ b/front/core/components/treeview/index.js @@ -20,6 +20,7 @@ export default class Treeview extends Component { refresh() { this.model.refresh().then(() => { this.data = this.model.data; + console.log(this.data); this.repaintAll(); }); } diff --git a/modules/agency/front/index/index.js b/modules/agency/front/index/index.js index 6c2d250c5..0958059af 100644 --- a/modules/agency/front/index/index.js +++ b/modules/agency/front/index/index.js @@ -16,7 +16,7 @@ export default class Controller { case 'search': return /^\d+$/.test(value) ? {id: value} - : {name: {regexp: value}}; + : {name: {like: `%${value}%`}}; case 'warehouseFk': case 'agencyModeFk': return {[param]: value}; From 879c9b8877664f4ee15d91fdd6897d5382ac44bb Mon Sep 17 00:00:00 2001 From: Gerard Date: Mon, 4 Feb 2019 12:24:47 +0100 Subject: [PATCH 03/24] #1093 ticket.descriptor ha dejado de funcionar en el modulo item --- .../item/front/ticket-descriptor/addStowaway.js | 8 +++----- modules/item/front/ticket-descriptor/index.html | 5 +++-- modules/item/front/ticket-descriptor/index.js | 15 ++++++++++++--- .../front/ticket-descriptor/removeStowaway.js | 8 +++----- modules/ticket/front/card/index.html | 2 +- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/modules/item/front/ticket-descriptor/addStowaway.js b/modules/item/front/ticket-descriptor/addStowaway.js index b1e530850..514d46503 100644 --- a/modules/item/front/ticket-descriptor/addStowaway.js +++ b/modules/item/front/ticket-descriptor/addStowaway.js @@ -20,7 +20,7 @@ class Controller { let params = {id: this.possibleStowaways[index].id, shipFk: this.ticket.id}; this.$http.post(`/api/Stowaways/`, params) .then(() => { - this.card.reload(); + this.cardReload(); this.vnApp.showSuccess(this.$translate.instant('Data saved!')); }); } @@ -40,9 +40,7 @@ ngModule.component('vnAddStowaway', { template: require('./addStowaway.html'), controller: Controller, bindings: { - ticket: '<' - }, - require: { - card: '^vnTicketCard' + ticket: '<', + cardReload: '&?' } }); diff --git a/modules/item/front/ticket-descriptor/index.html b/modules/item/front/ticket-descriptor/index.html index 1dd69d7b8..3e23a2175 100644 --- a/modules/item/front/ticket-descriptor/index.html +++ b/modules/item/front/ticket-descriptor/index.html @@ -100,6 +100,7 @@ show-field="id" value-field="id" vn-tooltip="Ship stowaways" + tooltip-position="up" data="$ctrl.ticket.ship" on-change="$ctrl.goToTicket(value)"> @@ -152,5 +153,5 @@ question="You are going to delete this ticket" message="Continue anyway?"> - - \ No newline at end of file + + \ No newline at end of file diff --git a/modules/item/front/ticket-descriptor/index.js b/modules/item/front/ticket-descriptor/index.js index 91e323ff8..948994701 100644 --- a/modules/item/front/ticket-descriptor/index.js +++ b/modules/item/front/ticket-descriptor/index.js @@ -11,7 +11,7 @@ class Controller { this.moreOptions = [ {callback: this.showAddTurnDialog, name: 'Add turn', show: true}, {callback: this.showDeleteTicketDialog, name: 'Delete ticket', show: true}, - {callback: this.showAddStowaway, name: 'Add stowaway', show: true}, + {callback: this.showAddStowaway, name: 'Add stowaway', show: () => this.isTicketModule()}, {callback: this.showRemoveStowaway, name: 'Remove stowaway', show: () => this.shouldShowRemoveStowaway()}, /* callback: this.showChangeShipped, name: 'Change shipped hour', show: true} */ ]; @@ -37,8 +37,16 @@ class Controller { } } + isTicketModule() { + let path = this.$state.getCurrentPath(); + if (path[1].state.name === 'ticket') + return true; + + return false; + } + shouldShowRemoveStowaway() { - if (!this._ticket) + if (!this._ticket || !this.isTicketModule()) return false; return (this._ticket.stowaway || (this._ticket.ship && this._ticket.ship.length > 0)); @@ -157,7 +165,8 @@ Controller.$inject = ['$state', '$scope', '$http', 'vnApp', '$translate']; ngModule.component('vnTicketDescriptor', { template: require('./index.html'), bindings: { - ticket: '<' + ticket: '<', + cardReload: '&' }, controller: Controller }); diff --git a/modules/item/front/ticket-descriptor/removeStowaway.js b/modules/item/front/ticket-descriptor/removeStowaway.js index 6d4e966bf..9553a8a66 100644 --- a/modules/item/front/ticket-descriptor/removeStowaway.js +++ b/modules/item/front/ticket-descriptor/removeStowaway.js @@ -46,7 +46,7 @@ class Controller { deleteStowaway(response) { if (response === 'ACCEPT') { this.$http.delete(`/api/Stowaways/${this.stowawayToDelete.id}`).then(res => { - this.card.reload(); + this.cardReload(); this.vnApp.showSuccess(this.$translate.instant('Data saved!')); }); } @@ -72,9 +72,7 @@ ngModule.component('vnRemoveStowaway', { template: require('./removeStowaway.html'), controller: Controller, bindings: { - ticket: '<' - }, - require: { - card: '^vnTicketCard' + ticket: '<', + cardReload: '&?' } }); diff --git a/modules/ticket/front/card/index.html b/modules/ticket/front/card/index.html index ca8c7d88b..99f8933f3 100644 --- a/modules/ticket/front/card/index.html +++ b/modules/ticket/front/card/index.html @@ -1,6 +1,6 @@
- +
From 3869742fd7a3bc08fae68eaca4cc273361879129 Mon Sep 17 00:00:00 2001 From: Gerard Date: Mon, 4 Feb 2019 12:41:38 +0100 Subject: [PATCH 04/24] =?UTF-8?q?#1088=20ticket.descriptor=20a=C3=B1adir?= =?UTF-8?q?=20polizon=20interval=20server=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/ticket/back/methods/ticket/getPossibleStowaways.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/ticket/back/methods/ticket/getPossibleStowaways.js b/modules/ticket/back/methods/ticket/getPossibleStowaways.js index 4ff5fa9d5..581a0a9c3 100644 --- a/modules/ticket/back/methods/ticket/getPossibleStowaways.js +++ b/modules/ticket/back/methods/ticket/getPossibleStowaways.js @@ -20,6 +20,10 @@ module.exports = Self => { Self.getPossibleStowaways = async ticketFk => { let ship = await Self.app.models.Ticket.findById(ticketFk); + + if (!ship || !ship.shipped) + return []; + let lowestDate = new Date(ship.shipped.getTime()); lowestDate.setHours(0, 0, -1, 0); From ef27606047785e261f60661d3186e3c8be56f19e Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 4 Feb 2019 14:47:55 +0100 Subject: [PATCH 05/24] #1087 Implementar clickIfVisible --- e2e/helpers/extensions.js | 13 +++++++++++++ e2e/helpers/selectors.js | 3 ++- e2e/paths/item-module/01_item_summary.spec.js | 7 +++++++ .../item-module/02_edit_item_basic_data.spec.js | 7 +++++++ .../05_create_new_tracking_state.spec.js | 3 ++- e2e/paths/ticket-module/07_edit_sale.spec.js | 8 ++++---- 6 files changed, 35 insertions(+), 6 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index a41b5855c..b635de9de 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -190,6 +190,19 @@ let actions = { }, done, selector); }, + clickIfVisible: function(selector, done) { + this.wait(selector) + .isVisible(selector) + .then(visible => { + if (visible) + return this.click(selector); + + throw new Error(`invisible selector: ${selector}`); + }) + .then(done) + .catch(done); + }, + countElement: function(selector, done) { this.evaluate_now(selector => { return document.querySelectorAll(selector).length; diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 42d05aafa..eddf8ad11 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -192,6 +192,7 @@ export default { moreMenuRegularizeButton: `vn-item-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(1)`, regularizeQuantityInput: `vn-item-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-textfield > div > div > div.infix > input`, regularizeWarehouseAutocomplete: 'vn-item-descriptor > vn-dialog vn-autocomplete[field="$ctrl.warehouseFk"]', + editButton: 'vn-item-card vn-item-descriptor vn-float-button[icon="edit"]', regularizeSaveButton: `vn-item-descriptor > vn-dialog > div > form > div.buttons > tpl-buttons > button` }, itemBasicData: { @@ -335,7 +336,7 @@ export default { descriptorItemDiaryButton: `vn-item-descriptor .quicklinks.ng-scope > vn-horizontal > a > vn-icon > i`, newItemButton: 'vn-float-button[icon="add"]', firstSaleText: `vn-table div > vn-tbody > vn-tr:nth-child(1)`, - firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(3) > img', + firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img', firstSaleZoomedImage: 'body > div > div > img', firstSaleQuantity: `vn-textfield[model="sale.quantity"]:nth-child(1) input`, firstSaleQuantityClearInput: `vn-textfield[model="sale.quantity"] div.suffix > i`, diff --git a/e2e/paths/item-module/01_item_summary.spec.js b/e2e/paths/item-module/01_item_summary.spec.js index ee6fd8785..1364aa00a 100644 --- a/e2e/paths/item-module/01_item_summary.spec.js +++ b/e2e/paths/item-module/01_item_summary.spec.js @@ -163,6 +163,13 @@ describe('Item summary path', () => { expect(url.hash).toContain('summary'); }); + it(`should check the descritor edit button is not visible for employee`, async() => { + const visibleButton = await nightmare + .isVisible(selectors.itemDescriptor.editButton); + + expect(visibleButton).toBeFalsy(); + }); + it(`should check the item summary shows fields from basic data section`, async() => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.basicData, 'Object2 Gem2 3') diff --git a/e2e/paths/item-module/02_edit_item_basic_data.spec.js b/e2e/paths/item-module/02_edit_item_basic_data.spec.js index 56bdf6647..3a06a2a77 100644 --- a/e2e/paths/item-module/02_edit_item_basic_data.spec.js +++ b/e2e/paths/item-module/02_edit_item_basic_data.spec.js @@ -11,6 +11,13 @@ describe('Item Edit basic data path', () => { .accessToSection('item.card.data'); }); + it(`should check the descritor edit button is visible for buyer`, async() => { + const visibleButton = await nightmare + .isVisible(selectors.itemDescriptor.editButton); + + expect(visibleButton).toBeTruthy(); + }); + it(`should edit the item basic data`, async() => { const result = await nightmare .clearInput(selectors.itemBasicData.nameInput) diff --git a/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js b/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js index af2fd8a31..787809a86 100644 --- a/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js +++ b/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js @@ -14,10 +14,11 @@ describe('Ticket Create new tracking state path', () => { it('should access to the create state view by clicking the create floating button', async() => { let url = await nightmare - .waitToClick(selectors.ticketTracking.createStateButton) + .clickIfVisible(selectors.ticketTracking.createStateButton) .wait(selectors.createStateView.stateAutocomplete) .parsedUrl(); + expect(url.hash).toContain('tracking/edit'); }); diff --git a/e2e/paths/ticket-module/07_edit_sale.spec.js b/e2e/paths/ticket-module/07_edit_sale.spec.js index 1e1302ab8..84d793ec0 100644 --- a/e2e/paths/ticket-module/07_edit_sale.spec.js +++ b/e2e/paths/ticket-module/07_edit_sale.spec.js @@ -62,7 +62,7 @@ describe('Ticket Edit sale path', () => { it(`should click on the thumbnail image of the 1st sale and see the zoomed image`, async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSaleThumbnailImage) + .clickIfVisible(selectors.ticketSales.firstSaleThumbnailImage) .countElement(selectors.ticketSales.firstSaleZoomedImage); expect(result).toEqual(1); @@ -70,7 +70,7 @@ describe('Ticket Edit sale path', () => { it(`should click on the zoomed image to close it`, async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSaleZoomedImage) + .clickIfVisible(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage); expect(result).toEqual(0); @@ -94,7 +94,7 @@ describe('Ticket Edit sale path', () => { it(`should click on the descriptor image of the 1st sale and see the zoomed image`, async() => { const result = await nightmare - .waitToClick('vn-item-descriptor img') + .clickIfVisible('vn-item-descriptor img') .countElement(selectors.ticketSales.firstSaleZoomedImage); expect(result).toEqual(1); @@ -102,7 +102,7 @@ describe('Ticket Edit sale path', () => { it(`should click on the zoomed image to close it`, async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSaleZoomedImage) + .clickIfVisible(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage); expect(result).toEqual(0); From bce67487c187bc564f5187fb0d34d1e85ab87ca5 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 4 Feb 2019 15:21:10 +0100 Subject: [PATCH 06/24] catalog filter requery fix #1034 --- modules/order/front/filter/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/order/front/filter/index.js b/modules/order/front/filter/index.js index aa3f3cc3d..e4a25eb52 100644 --- a/modules/order/front/filter/index.js +++ b/modules/order/front/filter/index.js @@ -27,9 +27,9 @@ class Controller { } set order(value) { - this._order = value; + if (!value.id || this._order) return; - if (!value.id) return; + this._order = value; this.$scope.$$postDigest(() => { let category; From ee62ecc8433bdde731e261f670908ebea0a2039c Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Mon, 4 Feb 2019 15:40:57 +0100 Subject: [PATCH 07/24] #1051 task update plus e2e fixes --- e2e/helpers/selectors.js | 2 +- e2e/paths/ticket-module/07_edit_sale.spec.js | 3 ++- .../ticket-module/12_delete_ticket_from_descriptor.spec.js | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index eddf8ad11..b3b937f48 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -191,7 +191,7 @@ export default { moreMenu: `vn-item-descriptor vn-icon-menu > div > vn-icon`, moreMenuRegularizeButton: `vn-item-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(1)`, regularizeQuantityInput: `vn-item-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-textfield > div > div > div.infix > input`, - regularizeWarehouseAutocomplete: 'vn-item-descriptor > vn-dialog vn-autocomplete[field="$ctrl.warehouseFk"]', + regularizeWarehouseAutocomplete: 'vn-item-descriptor vn-dialog vn-autocomplete[field="$ctrl.warehouseFk"]', editButton: 'vn-item-card vn-item-descriptor vn-float-button[icon="edit"]', regularizeSaveButton: `vn-item-descriptor > vn-dialog > div > form > div.buttons > tpl-buttons > button` }, diff --git a/e2e/paths/ticket-module/07_edit_sale.spec.js b/e2e/paths/ticket-module/07_edit_sale.spec.js index 84d793ec0..bc7889be0 100644 --- a/e2e/paths/ticket-module/07_edit_sale.spec.js +++ b/e2e/paths/ticket-module/07_edit_sale.spec.js @@ -70,6 +70,7 @@ describe('Ticket Edit sale path', () => { it(`should click on the zoomed image to close it`, async() => { const result = await nightmare + .wait(1000) .clickIfVisible(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage); @@ -100,7 +101,7 @@ describe('Ticket Edit sale path', () => { expect(result).toEqual(1); }); - it(`should click on the zoomed image to close it`, async() => { + it(`should now click on the zoomed image to close it`, async() => { const result = await nightmare .clickIfVisible(selectors.ticketSales.firstSaleZoomedImage) .countElement(selectors.ticketSales.firstSaleZoomedImage); diff --git a/e2e/paths/ticket-module/12_delete_ticket_from_descriptor.spec.js b/e2e/paths/ticket-module/12_delete_ticket_from_descriptor.spec.js index 5dc2903e9..865c36c5f 100644 --- a/e2e/paths/ticket-module/12_delete_ticket_from_descriptor.spec.js +++ b/e2e/paths/ticket-module/12_delete_ticket_from_descriptor.spec.js @@ -1,7 +1,8 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -describe('Ticket descriptor path', () => { +// #1051 Traducciones que fallan +xdescribe('Ticket descriptor path', () => { const nightmare = createNightmare(); beforeAll(() => { From 333d8533358ab1aa1f81208de9477b02c967eab4 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 5 Feb 2019 07:58:05 +0100 Subject: [PATCH 08/24] fixed print translations bug --- print/config/routes.json | 4 +- print/report/claim-pickup-order/index.html | 2 +- print/report/claim-pickup-order/index.js | 3 +- print/report/client-welcome/index.html | 2 +- print/report/client-welcome/index.js | 3 +- .../report/delivery-note/assets/css/style.css | 3 - print/report/delivery-note/index.html | 4 - print/report/delivery-note/index.js | 35 -------- print/report/delivery-note/locale.js | 8 -- print/report/email-footer/index.js | 4 + print/report/email-footer/locale.js | 19 ++++ print/report/letter-debtor-nd/index.html | 2 +- print/report/letter-debtor-nd/index.js | 3 +- print/report/letter-debtor-st/index.html | 2 +- print/report/letter-debtor-st/index.js | 3 +- print/report/payment-update/index.html | 2 +- print/report/payment-update/index.js | 3 +- print/report/printer-setup/index.html | 2 +- print/report/printer-setup/index.js | 3 +- print/report/report-footer/index.js | 6 +- print/report/report-header/index.js | 4 + .../report/rpt-claim-pickup-order/index.html | 3 +- print/report/rpt-claim-pickup-order/index.js | 3 +- .../rpt-delivery-note/assets/css/index.js | 7 ++ .../rpt-delivery-note/assets/css/style.css | 14 +++ print/report/rpt-delivery-note/index.html | 86 +++++++++++++++++++ print/report/rpt-delivery-note/index.js | 72 ++++++++++++++++ print/report/rpt-delivery-note/locale.js | 16 ++++ print/report/rpt-letter-debtor/index.html | 3 +- print/report/rpt-letter-debtor/index.js | 3 +- print/report/rpt-sepa-core/index.html | 3 +- print/report/sepa-core/index.js | 3 +- 32 files changed, 259 insertions(+), 71 deletions(-) delete mode 100644 print/report/delivery-note/assets/css/style.css delete mode 100644 print/report/delivery-note/index.html delete mode 100755 print/report/delivery-note/index.js delete mode 100644 print/report/delivery-note/locale.js create mode 100644 print/report/rpt-delivery-note/assets/css/index.js create mode 100644 print/report/rpt-delivery-note/assets/css/style.css create mode 100644 print/report/rpt-delivery-note/index.html create mode 100755 print/report/rpt-delivery-note/index.js create mode 100644 print/report/rpt-delivery-note/locale.js diff --git a/print/config/routes.json b/print/config/routes.json index bb3b39aa8..4fa82eea3 100644 --- a/print/config/routes.json +++ b/print/config/routes.json @@ -6,8 +6,8 @@ {"type": "email", "name": "letter-debtor-nd"}, {"type": "email", "name": "claim-pickup-order"}, {"type": "email", "name": "sepa-core"}, - {"type": "report", "name": "delivery-note"}, - {"type": "report", "name": "invoice"}, + {"type": "report", "name": "rpt-delivery-note"}, + {"type": "report", "name": "rpt-invoice"}, {"type": "report", "name": "rpt-claim-pickup-order"}, {"type": "report", "name": "rpt-letter-debtor"}, {"type": "report", "name": "rpt-sepa-core"}, diff --git a/print/report/claim-pickup-order/index.html b/print/report/claim-pickup-order/index.html index d598d3261..4790693f5 100644 --- a/print/report/claim-pickup-order/index.html +++ b/print/report/claim-pickup-order/index.html @@ -26,7 +26,7 @@

{{$t('sections.howToBuy.stock')}}

{{$t('sections.howToBuy.delivery')}}

--> - + \ No newline at end of file diff --git a/print/report/claim-pickup-order/index.js b/print/report/claim-pickup-order/index.js index 95d381d5c..38cb65e78 100755 --- a/print/report/claim-pickup-order/index.js +++ b/print/report/claim-pickup-order/index.js @@ -30,7 +30,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, methods: { fetchClient(claimFk) { diff --git a/print/report/client-welcome/index.html b/print/report/client-welcome/index.html index fc0295b8f..28c36bd1a 100644 --- a/print/report/client-welcome/index.html +++ b/print/report/client-welcome/index.html @@ -62,7 +62,7 @@

- + \ No newline at end of file diff --git a/print/report/client-welcome/index.js b/print/report/client-welcome/index.js index aeca24a06..1e6b7934c 100755 --- a/print/report/client-welcome/index.js +++ b/print/report/client-welcome/index.js @@ -19,7 +19,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, methods: { fetchClient(clientFk) { diff --git a/print/report/delivery-note/assets/css/style.css b/print/report/delivery-note/assets/css/style.css deleted file mode 100644 index 918036c36..000000000 --- a/print/report/delivery-note/assets/css/style.css +++ /dev/null @@ -1,3 +0,0 @@ -.blue { - color: blue -} \ No newline at end of file diff --git a/print/report/delivery-note/index.html b/print/report/delivery-note/index.html deleted file mode 100644 index 37d97258a..000000000 --- a/print/report/delivery-note/index.html +++ /dev/null @@ -1,4 +0,0 @@ -
- {{$t('clientId')}}: {{ id1 }} {{ id2 }} - heey -
\ No newline at end of file diff --git a/print/report/delivery-note/index.js b/print/report/delivery-note/index.js deleted file mode 100755 index 34c80b1f8..000000000 --- a/print/report/delivery-note/index.js +++ /dev/null @@ -1,35 +0,0 @@ -const database = require(`${appPath}/lib/database`); -const UserException = require(`${appPath}/lib/exceptions/userException`); - -module.exports = { - name: 'delivery-note', - async asyncData(ctx, params) { - const promises = []; - const dataIndex = promises.push(this.methods.fetchData()) - 1; - const itemsIndex = promises.push(this.methods.fetchItems()) - 1; - - return Promise.all(promises).then(result => { - const [[data]] = result[dataIndex]; - const [[items]] = result[itemsIndex]; - - return { - id1: data.id, - id2: items.id, - }; - }); - }, - data() { - return { - id: null, - }; - }, - methods: { - fetchData() { - return database.pool.query('SELECT 1 AS id'); - }, - - fetchItems() { - return database.pool.query('SELECT 2 AS id'); - }, - }, -}; diff --git a/print/report/delivery-note/locale.js b/print/report/delivery-note/locale.js deleted file mode 100644 index ed35f8b4e..000000000 --- a/print/report/delivery-note/locale.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - messages: { - es: { - clientId: 'Id cliente', - }, - }, -} -; \ No newline at end of file diff --git a/print/report/email-footer/index.js b/print/report/email-footer/index.js index 6cd80b610..22321dd7d 100755 --- a/print/report/email-footer/index.js +++ b/print/report/email-footer/index.js @@ -6,6 +6,9 @@ module.exports = { }; }, created() { + if (this.locale) + this.$i18n.locale = this.locale; + const embeded = []; this.files.map(file => { const src = this.isPreview ? `/api/${file}` : `cid:${file}`; @@ -27,4 +30,5 @@ module.exports = { ], }; }, + props: ['locale'] }; diff --git a/print/report/email-footer/locale.js b/print/report/email-footer/locale.js index 5782783e8..7e8aa401d 100644 --- a/print/report/email-footer/locale.js +++ b/print/report/email-footer/locale.js @@ -19,5 +19,24 @@ module.exports = { escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación.`, }, }, + /* fr: { + buttons: { + webAcccess: 'Visitez notre site web', + info: 'Ayúdanos a mejorar', + }, + privacy: { + fiscalAddress: 'VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla · www.verdnatura.es · clientes@verdnatura.es', + disclaimer: `- AVISO - Ce message est privé et confidentiel et doit être utilisé. + exclusivamente por la persona destinataria del mismo. Si has recibido este mensaje + por error, te rogamos lo comuniques al remitente y borres dicho mensaje y cualquier documento + adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a + ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace + responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.`, + law: `En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, + te comunicamos que los datos personales que facilites se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., + pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por + escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación.`, + }, + }, */ }, }; diff --git a/print/report/letter-debtor-nd/index.html b/print/report/letter-debtor-nd/index.html index 384def01f..f7d4c39b3 100644 --- a/print/report/letter-debtor-nd/index.html +++ b/print/report/letter-debtor-nd/index.html @@ -52,7 +52,7 @@

- + diff --git a/print/report/letter-debtor-nd/index.js b/print/report/letter-debtor-nd/index.js index 49aa46bbf..b68e9cc93 100755 --- a/print/report/letter-debtor-nd/index.js +++ b/print/report/letter-debtor-nd/index.js @@ -30,7 +30,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, methods: { fetchClient(clientFk, companyFk) { diff --git a/print/report/letter-debtor-st/index.html b/print/report/letter-debtor-st/index.html index 73e220563..e87a2f9f1 100644 --- a/print/report/letter-debtor-st/index.html +++ b/print/report/letter-debtor-st/index.html @@ -35,7 +35,7 @@

- + diff --git a/print/report/letter-debtor-st/index.js b/print/report/letter-debtor-st/index.js index a1a4d8833..8d6ca0362 100755 --- a/print/report/letter-debtor-st/index.js +++ b/print/report/letter-debtor-st/index.js @@ -31,7 +31,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, methods: { fetchClient(clientFk, companyFk) { diff --git a/print/report/payment-update/index.html b/print/report/payment-update/index.html index f74a51493..2f0f130ed 100644 --- a/print/report/payment-update/index.html +++ b/print/report/payment-update/index.html @@ -38,7 +38,7 @@

{{ $t('notifyAnError') }}

- + diff --git a/print/report/payment-update/index.js b/print/report/payment-update/index.js index 05c0bb64a..23218ec89 100755 --- a/print/report/payment-update/index.js +++ b/print/report/payment-update/index.js @@ -21,7 +21,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, methods: { fetchClient(clientFk) { diff --git a/print/report/printer-setup/index.html b/print/report/printer-setup/index.html index 1bf622186..52a0535a4 100644 --- a/print/report/printer-setup/index.html +++ b/print/report/printer-setup/index.html @@ -49,7 +49,7 @@

- + diff --git a/print/report/printer-setup/index.js b/print/report/printer-setup/index.js index aaf0a4d5d..eedb83f80 100755 --- a/print/report/printer-setup/index.js +++ b/print/report/printer-setup/index.js @@ -19,7 +19,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, data() { return { diff --git a/print/report/report-footer/index.js b/print/report/report-footer/index.js index 1ba36b1d7..f2eb42d66 100755 --- a/print/report/report-footer/index.js +++ b/print/report/report-footer/index.js @@ -1,4 +1,8 @@ module.exports = { name: 'report-footer', - props: ['leftText', 'centerText'] + created() { + if (this.locale) + this.$i18n.locale = this.locale; + }, + props: ['leftText', 'centerText', 'locale'] }; diff --git a/print/report/report-header/index.js b/print/report/report-header/index.js index 5928a678e..8eae2e25a 100755 --- a/print/report/report-header/index.js +++ b/print/report/report-header/index.js @@ -1,6 +1,9 @@ module.exports = { name: 'report-header', created() { + if (this.locale) + this.$i18n.locale = this.locale; + const embeded = []; this.files.map(file => { embeded[file] = `file://${__dirname + file}`; @@ -12,4 +15,5 @@ module.exports = { files: ['/assets/images/report-logo.svg'], }; }, + props: ['locale'] }; diff --git a/print/report/rpt-claim-pickup-order/index.html b/print/report/rpt-claim-pickup-order/index.html index c5001c984..568d972d9 100644 --- a/print/report/rpt-claim-pickup-order/index.html +++ b/print/report/rpt-claim-pickup-order/index.html @@ -75,7 +75,8 @@ + :center-text="clientName" + :locale="locale"> diff --git a/print/report/rpt-claim-pickup-order/index.js b/print/report/rpt-claim-pickup-order/index.js index 686a40cd3..8c172aa9c 100755 --- a/print/report/rpt-claim-pickup-order/index.js +++ b/print/report/rpt-claim-pickup-order/index.js @@ -27,7 +27,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, methods: { dated: () => { diff --git a/print/report/rpt-delivery-note/assets/css/index.js b/print/report/rpt-delivery-note/assets/css/index.js new file mode 100644 index 000000000..d40ab4984 --- /dev/null +++ b/print/report/rpt-delivery-note/assets/css/index.js @@ -0,0 +1,7 @@ +const CssReader = require(`${appPath}/lib/cssReader`); + +module.exports = new CssReader([ + `${appPath}/common/css/layout.css`, + `${appPath}/common/css/misc.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/report/rpt-delivery-note/assets/css/style.css b/print/report/rpt-delivery-note/assets/css/style.css new file mode 100644 index 000000000..05dbab652 --- /dev/null +++ b/print/report/rpt-delivery-note/assets/css/style.css @@ -0,0 +1,14 @@ +.container { + color: #000 +} + +.title { + font-weight: 100; + margin-top: 0; + margin-bottom: 20px; + font-size: 2em +} + +table.column-oriented { + margin-top: 50px !important +} \ No newline at end of file diff --git a/print/report/rpt-delivery-note/index.html b/print/report/rpt-delivery-note/index.html new file mode 100644 index 000000000..fb59a88e1 --- /dev/null +++ b/print/report/rpt-delivery-note/index.html @@ -0,0 +1,86 @@ + + + +
+ +
+
+
+
+

{{$t('title')}}

+ + + + + + + + + + + + + + + +
{{$t('clientId')}}{{clientId}}
{{$t('ticketId')}}{{ticketId}}
{{$t('date')}}{{dated()}}
+
+
+
+
+
{{$t('clientData')}}
+
+

{{clientName}}

+
+ {{street}} +
+
+ {{postcode}}, {{city}} ({{province}}) +
+
+ {{country}} +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
{{$t('date')}}{{$t('concept')}}{{$t('invoiced')}}{{$t('payed')}}{{$t('balance')}}
{{toISOString(sale.issued)}}{{sale.ref}}{{sale.debtOut}}{{sale.debtIn}}{{a}}
+
+ + + +
+ + \ No newline at end of file diff --git a/print/report/rpt-delivery-note/index.js b/print/report/rpt-delivery-note/index.js new file mode 100755 index 000000000..1056fb1d1 --- /dev/null +++ b/print/report/rpt-delivery-note/index.js @@ -0,0 +1,72 @@ +const strftime = require('strftime'); +const database = require(`${appPath}/lib/database`); +const UserException = require(`${appPath}/lib/exceptions/userException`); + +module.exports = { + name: 'rpt-delivery-note', + async asyncData(ctx, params) { + const promises = []; + const data = {}; + + if (!params.ticketFk) + throw new UserException('No ticket id specified'); + + promises.push(this.methods.fetchClient(params.ticketFk)); + // promises.push(this.methods.fetchSales(params.ticketFk)); + + return Promise.all(promises).then(result => { + const [[client]] = result[0]; + // const [[sales]] = result[1]; + + if (!client) + throw new UserException('No client data found'); + + Object.assign(data, client); + + return data; + }); + }, + created() { + if (this.locale) + this.$i18n.locale = this.locale; + }, + data() { + return {totalBalance: 0.00}; + }, + methods: { + fetchClient(ticketFk) { + return database.pool.query( + `SELECT + c.id clientId, + u.lang locale, + c.email AS recipient, + c.socialName AS clientName, + c.street, + c.postcode, + c.city, + c.fi, + p.name AS province, + ct.country + FROM ticket t + JOIN client c ON c.id = t.clientFk + JOIN account.user u ON u.id = c.id + JOIN country ct ON ct.id = c.countryFk + LEFT JOIN province p ON p.id = c.provinceFk + WHERE t.id = ?`, [ticketFk]); + }, + fetchSales(clientFk, companyFk) { + return database.pool.query( + `CALL vn.clientGetDebtDiary(?, ?)`, [clientFk, companyFk]); + }, + dated: () => { + return strftime('%d-%m-%Y', new Date()); + }, + toISOString: date => { + return strftime('%d-%m-%Y', date); + }, + }, + components: { + 'report-header': require('../report-header'), + 'report-footer': require('../report-footer'), + }, +}; diff --git a/print/report/rpt-delivery-note/locale.js b/print/report/rpt-delivery-note/locale.js new file mode 100644 index 000000000..d08c50144 --- /dev/null +++ b/print/report/rpt-delivery-note/locale.js @@ -0,0 +1,16 @@ +module.exports = { + messages: { + es: { + title: 'Albarán', + ticketId: 'Albarán', + clientId: 'Cliente', + clientData: 'Datos del cliente', + date: 'Fecha', + concept: 'Concepto', + invoiced: 'Facturado', + payed: 'Pagado', + balance: 'Saldo', + ticket: 'Albarán {0}' + }, + }, +}; diff --git a/print/report/rpt-letter-debtor/index.html b/print/report/rpt-letter-debtor/index.html index b65bfb97f..6ced7b98a 100644 --- a/print/report/rpt-letter-debtor/index.html +++ b/print/report/rpt-letter-debtor/index.html @@ -74,7 +74,8 @@ + :center-text="clientName" + :locale="locale"> diff --git a/print/report/rpt-letter-debtor/index.js b/print/report/rpt-letter-debtor/index.js index 2b72b6242..7fa049a9e 100755 --- a/print/report/rpt-letter-debtor/index.js +++ b/print/report/rpt-letter-debtor/index.js @@ -30,7 +30,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, data() { return {totalBalance: 0.00}; diff --git a/print/report/rpt-sepa-core/index.html b/print/report/rpt-sepa-core/index.html index 84b458eea..220346946 100644 --- a/print/report/rpt-sepa-core/index.html +++ b/print/report/rpt-sepa-core/index.html @@ -142,7 +142,8 @@ + :center-text="clientName" + :locale="locale"> diff --git a/print/report/sepa-core/index.js b/print/report/sepa-core/index.js index 3a281ec32..00fe18c3f 100755 --- a/print/report/sepa-core/index.js +++ b/print/report/sepa-core/index.js @@ -27,7 +27,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, methods: { From 3a7413dda1f618de1521e28b8e29728ec3180a0d Mon Sep 17 00:00:00 2001 From: Bernat Date: Tue, 5 Feb 2019 08:44:56 +0100 Subject: [PATCH 09/24] update acl --- services/db/install/changes/1.2-CHECK/24.ACL.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 services/db/install/changes/1.2-CHECK/24.ACL.sql diff --git a/services/db/install/changes/1.2-CHECK/24.ACL.sql b/services/db/install/changes/1.2-CHECK/24.ACL.sql new file mode 100644 index 000000000..6043c4fb6 --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/24.ACL.sql @@ -0,0 +1,2 @@ +INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (144, 'Stowaway', '*', '*', 'ALLOW', 'ROLE', 'employee'); +INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (145, 'Ticket', 'getPossibleStowaways', 'READ', 'ALLOW', 'ROLE', 'employee'); From 1dbb75a1b89a193e2d23b09af7ec355c6741df0d Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 5 Feb 2019 09:13:15 +0100 Subject: [PATCH 10/24] vnSideMenu, vnBackground, style fixes --- front/Dockerfile | 1 - front/core/locale/es.yml | 3 +- front/salix/components/app/app.html | 19 +-- front/salix/components/app/app.js | 48 ++---- front/salix/components/app/style.scss | 60 +------ .../salix/components/background/background.js | 1 + front/salix/components/background/style.scss | 26 ++++ front/salix/components/index.js | 2 + .../salix/components/main-menu/main-menu.html | 47 +++--- front/salix/components/main-menu/main-menu.js | 16 +- front/salix/components/main-menu/style.scss | 7 +- .../salix/components/side-menu/side-menu.html | 9 ++ front/salix/components/side-menu/side-menu.js | 78 ++++++++++ front/salix/components/side-menu/style.scss | 37 +++++ front/salix/index.ejs | 2 +- front/salix/manifest.json | 8 +- front/salix/styles/descriptor.scss | 5 + front/salix/styles/variables.scss | 4 + modules/agency/front/calendar/index.js | 11 -- modules/agency/front/card/index.html | 4 +- modules/agency/front/location/index.html | 7 +- modules/claim/front/card/index.html | 4 +- modules/client/front/card/index.html | 4 +- .../front/descriptor-popover/style.scss | 5 +- modules/client/front/search-panel/index.html | 146 +++++++++--------- modules/item/front/card/index.html | 4 +- .../item/front/descriptor-popover/style.scss | 4 - .../ticket-descriptor-popover/style.scss | 6 +- modules/order/front/card/index.html | 4 +- modules/order/front/catalog/index.html | 7 +- modules/order/front/filter/index.js | 11 +- modules/ticket/front/card/index.html | 4 +- modules/worker/front/card/index.html | 4 +- webpack.config.js | 12 +- 34 files changed, 331 insertions(+), 279 deletions(-) create mode 100644 front/salix/components/background/background.js create mode 100644 front/salix/components/background/style.scss create mode 100644 front/salix/components/side-menu/side-menu.html create mode 100644 front/salix/components/side-menu/side-menu.js create mode 100644 front/salix/components/side-menu/style.scss create mode 100644 front/salix/styles/variables.scss diff --git a/front/Dockerfile b/front/Dockerfile index 0bbf71f40..d6fe5d4f8 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -13,6 +13,5 @@ COPY front/nginx.conf sites-available/salix RUN rm sites-enabled/default && ln -s ../sites-available/salix sites-enabled/salix COPY dist /salix/dist -COPY front/salix/manifest.json /salix/dist/ CMD ["nginx", "-g", "daemon off;"] diff --git a/front/core/locale/es.yml b/front/core/locale/es.yml index 10d172444..3cd6428f3 100644 --- a/front/core/locale/es.yml +++ b/front/core/locale/es.yml @@ -37,4 +37,5 @@ September: Septiembre October: Octubre November: Noviembre December: Diciembre -Has delivery: Hay reparto \ No newline at end of file +Has delivery: Hay reparto +Loading: Cargando \ No newline at end of file diff --git a/front/salix/components/app/app.html b/front/salix/components/app/app.html index 922b48ce8..c69d07375 100644 --- a/front/salix/components/app/app.html +++ b/front/salix/components/app/app.html @@ -3,10 +3,10 @@ Logo + class="show-menu" + ng-if="$ctrl.leftMenu" + ng-click="$ctrl.leftMenu.show()">
{{$ctrl.$state.current.description}} @@ -14,20 +14,15 @@ + class="show-menu" + ng-if="$ctrl.rightMenu" + ng-click="$ctrl.rightMenu.show()">
+ ng-class="{padding: $ctrl.showTopbar}">
-
-
\ No newline at end of file diff --git a/front/salix/components/app/app.js b/front/salix/components/app/app.js index 6a8ecb247..edf482712 100644 --- a/front/salix/components/app/app.js +++ b/front/salix/components/app/app.js @@ -1,19 +1,18 @@ import ngModule from '../../module'; import './style.scss'; +/** + * The main graphical application component. + * + * @property {SideMenu} leftMenu The left menu, if it's present + * @property {SideMenu} rightMenu The left menu, if it's present + */ export default class App { - constructor($, $element, vnApp, $state, $transitions) { + constructor($, $state, vnApp) { Object.assign(this, { $, - $element, - vnApp, - $state - }); - - $transitions.onStart({}, transition => { - let state = transition.targetState().name(); - this.showLeftMenuButton = state.split('.').length >= 3; - this.hideMenus(); + $state, + vnApp }); } @@ -30,33 +29,6 @@ export default class App { return state && state != 'login'; } - get leftMenu() { - return this.$element[0].querySelector('.left-menu'); - } - - showLeftMenu() { - if (!this.leftMenu) return; - this.leftMenu.classList.add('shown'); - this.leftMenuShown = true; - } - - showRightMenu() { - if (!this.rightMenu) return; - this.rightMenu.classList.add('shown'); - this.rightMenuShown = true; - } - - hideMenus() { - if (this.leftMenuShown) { - this.leftMenu.classList.remove('shown'); - this.leftMenuShown = false; - } - if (this.rightMenuShown) { - this.rightMenu.classList.remove('shown'); - this.rightMenuShown = false; - } - } - showMessage(message) { this.$.snackbar.show({message: message}); } @@ -69,7 +41,7 @@ export default class App { this.$.snackbar.showError({message: message}); } } -App.$inject = ['$scope', '$element', 'vnApp', '$state', '$transitions']; +App.$inject = ['$scope', '$state', 'vnApp']; ngModule.component('vnApp', { template: require('./app.html'), diff --git a/front/salix/components/app/style.scss b/front/salix/components/app/style.scss index 2103c4251..6cb07e4aa 100644 --- a/front/salix/components/app/style.scss +++ b/front/salix/components/app/style.scss @@ -1,9 +1,6 @@ @import "background"; @import "margin"; - -$menu-width: 16em; -$topbar-height: 4em; -$mobile-width: 800px; +@import "variables"; body { @extend .bg-content; @@ -72,27 +69,6 @@ vn-app { margin: 0 auto; padding-left: $menu-width; - %side-menu { - display: block; - position: fixed; - z-index: 5; - bottom: 0; - width: $menu-width; - min-width: $menu-width; - background-color: white; - box-shadow: 0 .1em .2em rgba(1, 1, 1, .2); - overflow: auto; - } - .left-menu { - @extend %side-menu; - top: $topbar-height; - left: 0; - } - .right-menu { - @extend %side-menu; - top: $topbar-height; - right: 0; - } } .main-with-right-menu { padding-right: $menu-width; @@ -102,18 +78,6 @@ vn-app { } } } - & > .background { - display: none; - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: black; - z-index: 14; - opacity: 0; - transition: opacity 200ms ease-out; - } @media screen and (max-width: $mobile-width) { & > vn-topbar > header { @@ -135,32 +99,10 @@ vn-app { } vn-main-block { padding-left: 0; - - %side-menu-mobile { - top: 0; - transition: transform 200ms ease-out; - z-index: 15; - - &.shown { - transform: translateZ(0) translateX(0); - } - } - .left-menu { - @extend %side-menu-mobile; - transform: translateZ(0) translateX(-$menu-width); - } - .right-menu { - @extend %side-menu-mobile; - transform: translateZ(0) translateX($menu-width); - } } .main-with-right-menu { padding-right: 0; } } - & > .background.shown { - display: block; - opacity: .3; - } } } diff --git a/front/salix/components/background/background.js b/front/salix/components/background/background.js new file mode 100644 index 000000000..423b033ce --- /dev/null +++ b/front/salix/components/background/background.js @@ -0,0 +1 @@ +import './style.scss'; diff --git a/front/salix/components/background/style.scss b/front/salix/components/background/style.scss new file mode 100644 index 000000000..c75b69c52 --- /dev/null +++ b/front/salix/components/background/style.scss @@ -0,0 +1,26 @@ +@import "variables"; + +@keyframes fadein { + from { + opacity: 0; + } +} + +vn-background { + display: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: black; + z-index: 14; + + @media screen and (max-width: $mobile-width) { + &.shown { + display: block; + opacity: .3; + animation: 500ms ease-out fadein; + } + } +} diff --git a/front/salix/components/index.js b/front/salix/components/index.js index b90b221a4..a5ce18e4c 100644 --- a/front/salix/components/index.js +++ b/front/salix/components/index.js @@ -2,6 +2,8 @@ import './app/app'; import './login/login'; import './home/home'; import './main-menu/main-menu'; +import './background/background'; +import './side-menu/side-menu'; import './left-menu/left-menu'; import './topbar/topbar'; import './user-configuration-popover'; diff --git a/front/salix/components/main-menu/main-menu.html b/front/salix/components/main-menu/main-menu.html index b607450b8..188f854eb 100644 --- a/front/salix/components/main-menu/main-menu.html +++ b/front/salix/components/main-menu/main-menu.html @@ -5,26 +5,31 @@ class="unselectable"> {{currentUserName}}
- - - -
    -
  • - - {{::mod.name}} -
  • -
-
- - +
+ + + +
    +
  • + + {{::mod.name}} +
  • +
+
+
+
+ + +
- + \ No newline at end of file diff --git a/front/salix/components/main-menu/main-menu.js b/front/salix/components/main-menu/main-menu.js index 684f63aab..287c89d97 100644 --- a/front/salix/components/main-menu/main-menu.js +++ b/front/salix/components/main-menu/main-menu.js @@ -2,13 +2,13 @@ import ngModule from '../../module'; import './style.scss'; export default class MainMenu { - constructor($translate, $scope, $http, $window, vnModules, vnAuth) { - this.$ = $scope; - this.$http = $http; - this.$translate = $translate; - this.$window = $window; - this.modules = vnModules.get(); - this.vnAuth = vnAuth; + constructor($, $http, vnAuth, vnModules) { + Object.assign(this, { + $, + $http, + vnAuth, + modules: vnModules.get() + }); } $onInit() { @@ -30,7 +30,7 @@ export default class MainMenu { this.vnAuth.logout(); } } -MainMenu.$inject = ['$translate', '$scope', '$http', '$window', 'vnModules', 'vnAuth']; +MainMenu.$inject = ['$scope', '$http', 'vnAuth', 'vnModules']; ngModule.component('vnMainMenu', { template: require('./main-menu.html'), diff --git a/front/salix/components/main-menu/style.scss b/front/salix/components/main-menu/style.scss index 24ca495ea..87cd78557 100644 --- a/front/salix/components/main-menu/style.scss +++ b/front/salix/components/main-menu/style.scss @@ -12,7 +12,7 @@ vn-main-menu { & > * { cursor: pointer; - padding-left: .3em; + padding-left: .6em; &:hover { color: $main-01; @@ -21,10 +21,9 @@ vn-main-menu { & > #user { vertical-align: middle; font-weight: bold; - padding-right: .4em; + margin-right: .2em; } - & > vn-icon, - & > a > vn-icon { + & > div > vn-icon { display: block; font-size: 2.1em; } diff --git a/front/salix/components/side-menu/side-menu.html b/front/salix/components/side-menu/side-menu.html new file mode 100644 index 000000000..b56d3cece --- /dev/null +++ b/front/salix/components/side-menu/side-menu.html @@ -0,0 +1,9 @@ + + + diff --git a/front/salix/components/side-menu/side-menu.js b/front/salix/components/side-menu/side-menu.js new file mode 100644 index 000000000..14220c4a3 --- /dev/null +++ b/front/salix/components/side-menu/side-menu.js @@ -0,0 +1,78 @@ +import ngModule from '../../module'; +import './style.scss'; + +/** + * A side menu. + * + * @property {String} side [left|right] The side where the menu is displayed + * @property {Boolean} shown Whether the menu it's currently displayed (Only for small viewports) + */ +export default class SideMenu { + constructor($, $element, $window, $transitions) { + Object.assign(this, { + $, + $element, + $window, + $transitions, + side: 'left' + }); + } + + $onInit() { + this.menu = this.$element[0].querySelector('.menu'); + + if (this.side == 'right') { + this.menu.classList.add('right'); + this.app.rightMenu = this; + } else { + this.menu.classList.add('left'); + this.app.leftMenu = this; + } + } + + $onDestroy() { + if (this.side == 'right') + this.app.rightMenu = null; + else + this.app.leftMenu = null; + } + + onEscape(event) { + if (!event.defaultPrevented && event.key == 'Escape') { + event.preventDefault(); + this.hide(); + this.$.$digest(); + } + } + + onTransition(transition) { + if (transition.from().name !== transition.to().name) + this.hide(); + } + + show() { + this.shown = true; + this.handler = e => this.onEscape(e); + this.$window.addEventListener('keydown', this.handler); + this.stateHandler = this.$transitions.onStart({}, t => this.onTransition(t)); + } + + hide() { + this.$window.removeEventListener('keydown', this.handler); + this.stateHandler(); + this.shown = false; + } +} +SideMenu.$inject = ['$scope', '$element', '$window', '$transitions']; + +ngModule.component('vnSideMenu', { + template: require('./side-menu.html'), + controller: SideMenu, + transclude: true, + bindings: { + side: '@?' + }, + require: { + app: '^vnApp' + } +}); diff --git a/front/salix/components/side-menu/style.scss b/front/salix/components/side-menu/style.scss new file mode 100644 index 000000000..98084022d --- /dev/null +++ b/front/salix/components/side-menu/style.scss @@ -0,0 +1,37 @@ +@import "variables"; + +vn-side-menu > .menu { + display: block; + position: fixed; + z-index: 5; + bottom: 0; + width: $menu-width; + min-width: $menu-width; + background-color: white; + box-shadow: 0 .1em .2em rgba(1, 1, 1, .2); + overflow: auto; + top: $topbar-height; + + &.left { + left: 0; + } + &.right { + right: 0; + } + + @media screen and (max-width: $mobile-width) { + top: 0; + transition: transform 200ms ease-out; + z-index: 15; + + &.left { + transform: translateZ(0) translateX(-$menu-width); + } + &.right { + transform: translateZ(0) translateX($menu-width); + } + &.shown { + transform: translateZ(0) translateX(0); + } + } +} diff --git a/front/salix/index.ejs b/front/salix/index.ejs index 9f4535540..3aed9d9a6 100644 --- a/front/salix/index.ejs +++ b/front/salix/index.ejs @@ -4,7 +4,7 @@ - + diff --git a/front/salix/manifest.json b/front/salix/manifest.json index bf7e237fb..29deedbcd 100644 --- a/front/salix/manifest.json +++ b/front/salix/manifest.json @@ -1,12 +1,12 @@ { "name": "Salix", + "start_url": "index.html", + "display": "standalone", + "theme_color": "#3d3d3d", "icons": [ { "src": "favicon.ico", "sizes": "512x512" } - ], - "start_url": "index.html", - "display": "standalone", - "theme_color": "#3d3d3d" + ] } diff --git a/front/salix/styles/descriptor.scss b/front/salix/styles/descriptor.scss index 7837a8326..ddd4ea73e 100644 --- a/front/salix/styles/descriptor.scss +++ b/front/salix/styles/descriptor.scss @@ -77,4 +77,9 @@ } } } +} +vn-popover { + .vn-descriptor > .header > a:first-child { + visibility: hidden; + } } \ No newline at end of file diff --git a/front/salix/styles/variables.scss b/front/salix/styles/variables.scss new file mode 100644 index 000000000..cadbe1fa4 --- /dev/null +++ b/front/salix/styles/variables.scss @@ -0,0 +1,4 @@ + +$menu-width: 16em; +$topbar-height: 4em; +$mobile-width: 800px; \ No newline at end of file diff --git a/modules/agency/front/calendar/index.js b/modules/agency/front/calendar/index.js index a26b705a8..f08a47601 100644 --- a/modules/agency/front/calendar/index.js +++ b/modules/agency/front/calendar/index.js @@ -17,14 +17,6 @@ class Controller { this.ndMonth = this.$scope.ndMonth; } - $onInit() { - this.app.rightMenu = this.$element[0]; - } - - $onDestroy() { - this.app.rightMenu = null; - } - get zone() { return this._zone; } @@ -152,9 +144,6 @@ Controller.$inject = ['$element', '$scope', '$stateParams', '$http']; ngModule.component('vnZoneCalendar', { template: require('./index.html'), controller: Controller, - require: { - app: '^vnApp' - }, bindings: { zone: '<' } diff --git a/modules/agency/front/card/index.html b/modules/agency/front/card/index.html index 2b981bf29..db5881e42 100644 --- a/modules/agency/front/card/index.html +++ b/modules/agency/front/card/index.html @@ -1,7 +1,7 @@ -
+ -
+
diff --git a/modules/agency/front/location/index.html b/modules/agency/front/location/index.html index 1e2983284..27de3bc1f 100644 --- a/modules/agency/front/location/index.html +++ b/modules/agency/front/location/index.html @@ -16,8 +16,7 @@ on-selection="$ctrl.onSelection(item)"> - - + + + \ No newline at end of file diff --git a/modules/claim/front/card/index.html b/modules/claim/front/card/index.html index 82ce962cb..3a445f0b1 100644 --- a/modules/claim/front/card/index.html +++ b/modules/claim/front/card/index.html @@ -1,7 +1,7 @@ -
+ -
+
diff --git a/modules/client/front/card/index.html b/modules/client/front/card/index.html index 5c8b6f334..3732e0d07 100644 --- a/modules/client/front/card/index.html +++ b/modules/client/front/card/index.html @@ -1,7 +1,7 @@ -
+ -
+
diff --git a/modules/client/front/descriptor-popover/style.scss b/modules/client/front/descriptor-popover/style.scss index 84938dc9c..0262c4ac0 100644 --- a/modules/client/front/descriptor-popover/style.scss +++ b/modules/client/front/descriptor-popover/style.scss @@ -5,8 +5,5 @@ vn-client-descriptor-popover { & > vn-card{ margin: 0!important; } - .header > a:first-child { - display: none - } } -} \ No newline at end of file +} diff --git a/modules/client/front/search-panel/index.html b/modules/client/front/search-panel/index.html index a5553fcbf..9fb1aaf3e 100644 --- a/modules/client/front/search-panel/index.html +++ b/modules/client/front/search-panel/index.html @@ -1,75 +1,75 @@
-
- - - - - - - - - - - - - - - {{firstName}} {{name}} - - - - - - - - - - - - - - - - - - - - - -
+
+ + + + + + + + + + + + + + + {{firstName}} {{name}} + + + + + + + + + + + + + + + + + + + + + +
diff --git a/modules/item/front/card/index.html b/modules/item/front/card/index.html index d4cf5ad43..aa84532d1 100644 --- a/modules/item/front/card/index.html +++ b/modules/item/front/card/index.html @@ -1,7 +1,7 @@ -
+ -
+
diff --git a/modules/item/front/descriptor-popover/style.scss b/modules/item/front/descriptor-popover/style.scss index 839fc992f..dfc11ab9d 100644 --- a/modules/item/front/descriptor-popover/style.scss +++ b/modules/item/front/descriptor-popover/style.scss @@ -3,9 +3,5 @@ vn-item-descriptor-popover { display: block; width: 16em; min-height: 28em; - - .header > a:first-child { - display: none - } } } \ No newline at end of file diff --git a/modules/item/front/ticket-descriptor-popover/style.scss b/modules/item/front/ticket-descriptor-popover/style.scss index d41d28a87..58e65d320 100644 --- a/modules/item/front/ticket-descriptor-popover/style.scss +++ b/modules/item/front/ticket-descriptor-popover/style.scss @@ -4,12 +4,8 @@ vn-ticket-descriptor-popover { width: 16em; max-height: 28em; - &>vn-card { + & > vn-card { margin: 0!important; } - - .header > a:first-child { - display: none - } } } \ No newline at end of file diff --git a/modules/order/front/card/index.html b/modules/order/front/card/index.html index b0874ec48..96aa94f6c 100644 --- a/modules/order/front/card/index.html +++ b/modules/order/front/card/index.html @@ -1,7 +1,7 @@ -
+ -
+
diff --git a/modules/order/front/catalog/index.html b/modules/order/front/catalog/index.html index 8de456b93..819afca79 100644 --- a/modules/order/front/catalog/index.html +++ b/modules/order/front/catalog/index.html @@ -97,10 +97,9 @@ - - + + + diff --git a/modules/order/front/filter/index.js b/modules/order/front/filter/index.js index aa3f3cc3d..276f3d141 100644 --- a/modules/order/front/filter/index.js +++ b/modules/order/front/filter/index.js @@ -14,14 +14,6 @@ class Controller { this.tags = []; } - $onInit() { - this.app.rightMenu = this.$element[0]; - } - - $onDestroy() { - this.app.rightMenu = null; - } - get order() { return this._order; } @@ -174,8 +166,7 @@ ngModule.component('vnCatalogFilter', { template: require('./index.html'), controller: Controller, require: { - catalog: '^vnOrderCatalog', - app: '^vnApp' + catalog: '^vnOrderCatalog' }, bindings: { order: '<', diff --git a/modules/ticket/front/card/index.html b/modules/ticket/front/card/index.html index ca8c7d88b..72df32b68 100644 --- a/modules/ticket/front/card/index.html +++ b/modules/ticket/front/card/index.html @@ -1,7 +1,7 @@ -
+ -
+
diff --git a/modules/worker/front/card/index.html b/modules/worker/front/card/index.html index 79d4c7511..80f1f7a61 100644 --- a/modules/worker/front/card/index.html +++ b/modules/worker/front/card/index.html @@ -1,7 +1,7 @@ -
+ -
+
diff --git a/webpack.config.js b/webpack.config.js index 7824e2e2b..b889f9e6a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -29,7 +29,13 @@ let baseConfig = { loader: 'json-loader!yaml-loader' }, { test: /\.html$/, - loader: 'html-loader' + loader: 'html-loader', + options: { + attrs: [ + 'img:src', + 'link:href' + ] + } }, { test: /\.css$/, loader: 'style-loader!css-loader' @@ -50,6 +56,10 @@ let baseConfig = { }, { test: /\.(svg|png|ttf|woff|woff2)$/, loader: 'file-loader' + }, { + test: /manifest\.json$/, + type: 'javascript/auto', + loader: 'file-loader' } ] }, From d87e2dbbf0abe8ea49ca7484a8099dbd2853a48f Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 5 Feb 2019 09:21:29 +0100 Subject: [PATCH 11/24] fixed order item category filter #1079 --- modules/order/front/filter/index.js | 36 +++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/modules/order/front/filter/index.js b/modules/order/front/filter/index.js index e4a25eb52..1612c9451 100644 --- a/modules/order/front/filter/index.js +++ b/modules/order/front/filter/index.js @@ -26,6 +26,11 @@ class Controller { return this._order; } + /** + * Sets filter values from state params + * + * @param {Object} value - Order data + */ set order(value) { if (!value.id || this._order) return; @@ -57,20 +62,18 @@ class Controller { this.itemTypes = []; this.type = null; - if (!value || (this.category && this.category.id == value.id)) { + if (!value || (this.category && this.category.id == value.id)) this._category = null; - this.updateStateParams(); + else + this._category = value; - return; - } - - this._category = value; this.updateStateParams(); - const query = `/item/api/ItemCategories/${value.id}/itemTypes`; - this.$http.get(query).then(res => { - this.itemTypes = res.data; - }); + if (this.tags.length > 0) + this.applyFilters(); + + if (value) + this.updateItemTypes(); } get type() { @@ -91,6 +94,16 @@ class Controller { this.applyFilters(); } + /** + * Refreshes item type dropdown data + */ + updateItemTypes() { + const query = `/item/api/ItemCategories/${this.category.id}/itemTypes`; + this.$http.get(query).then(res => { + this.itemTypes = res.data; + }); + } + onSearch(event) { if (event.key !== 'Enter') return; this.tags.push({ @@ -153,6 +166,9 @@ class Controller { this.$panel = null; } + /** + * Updates url state params from filter values + */ updateStateParams() { const params = {}; From 6c2fe1d4a389711610aa1333cf3fc07696045344 Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 5 Feb 2019 09:27:01 +0100 Subject: [PATCH 12/24] #1036 order.line --- loopback/locale/es.json | 3 ++- modules/order/front/line/index.html | 2 +- modules/order/front/line/index.js | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 648989cb6..da4100a5a 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -65,5 +65,6 @@ "INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no esta permitido el uso de la letra ñ", "You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado", "You can't create a ticket for a inactive client": "No puedes crear un ticket para un cliente inactivo", - "Tag value cannot be blank": "El valor del tag no puede quedar en blanco" + "Tag value cannot be blank": "El valor del tag no puede quedar en blanco", + "ORDER_EMPTY": "Cesta vacía" } \ No newline at end of file diff --git a/modules/order/front/line/index.html b/modules/order/front/line/index.html index 4bb1dc4ce..a2e28ac2f 100644 --- a/modules/order/front/line/index.html +++ b/modules/order/front/line/index.html @@ -70,7 +70,7 @@ diff --git a/modules/order/front/line/index.js b/modules/order/front/line/index.js index e25d50532..84067b5ec 100644 --- a/modules/order/front/line/index.js +++ b/modules/order/front/line/index.js @@ -92,6 +92,7 @@ class Controller { this.$http.post(query).then(() => { this.vnApp.showSuccess(this.$translate.instant('Order confirmed')); + this.$state.go(`ticket.index`, {clientFk: this.order.clientFk}); }); } } From 8f575fbc45a58931d500b2bde6e0f9aa29c422fa Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 5 Feb 2019 09:37:01 +0100 Subject: [PATCH 13/24] strings added to the locale --- modules/order/front/line/locale/es.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/order/front/line/locale/es.yml b/modules/order/front/line/locale/es.yml index ba3a3fee6..688778561 100644 --- a/modules/order/front/line/locale/es.yml +++ b/modules/order/front/line/locale/es.yml @@ -1,2 +1,3 @@ -Remove item: Eliminar articulo -Order confirmed: Pedido confirmado \ No newline at end of file +Delete row: Eliminar linea +Order confirmed: Pedido confirmado +Are you sure you want to delete this row?: ¿Estas seguro de que quieres borrar esta línea? \ No newline at end of file From 2c9a10f27700dc5b8770bfd69d80cd4b9aaf2942 Mon Sep 17 00:00:00 2001 From: Bernat Date: Tue, 5 Feb 2019 09:49:33 +0100 Subject: [PATCH 14/24] update structure db #9764 --- back/models/user-table-configuration.json | 6 ++-- .../1.2-CHECK/23-userTableConfiguration.sql | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/back/models/user-table-configuration.json b/back/models/user-table-configuration.json index 084d64e27..4a35f66cf 100644 --- a/back/models/user-table-configuration.json +++ b/back/models/user-table-configuration.json @@ -21,10 +21,10 @@ } }, "relations": { - "worker": { + "user": { "type": "belongsTo", - "model": "Worker", - "foreignKey": "workerFk" + "model": "Account", + "foreignKey": "userFk" } } } diff --git a/services/db/install/changes/1.2-CHECK/23-userTableConfiguration.sql b/services/db/install/changes/1.2-CHECK/23-userTableConfiguration.sql index 089b38a36..c7212f7ba 100644 --- a/services/db/install/changes/1.2-CHECK/23-userTableConfiguration.sql +++ b/services/db/install/changes/1.2-CHECK/23-userTableConfiguration.sql @@ -16,3 +16,33 @@ ADD CONSTRAINT `fgn_worker` REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE; + +ALTER TABLE `salix`.`userTableConfiguration` +DROP FOREIGN KEY `fgn_worker`; +ALTER TABLE `salix`.`userTableConfiguration` +CHANGE COLUMN `workerFk` `userFk` INT(10) NOT NULL ; +ALTER TABLE `salix`.`userTableConfiguration` +ADD CONSTRAINT `fgn_worker` + FOREIGN KEY (`userFk`) + REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) + ON DELETE CASCADE + ON UPDATE CASCADE; + +ALTER TABLE `salix`.`userTableConfiguration` +DROP FOREIGN KEY `fgn_worker`; +ALTER TABLE `salix`.`userTableConfiguration` +DROP INDEX `fgn_worker_idx` ; + + + +ALTER TABLE `salix`.`userTableConfiguration` +CHANGE COLUMN `userFk` `userFk` INT(10) UNSIGNED NOT NULL ; + + ALTER TABLE `salix`.`userTableConfiguration` +ADD INDEX `fgn_user_idx` (`userFk` ASC); +ALTER TABLE `salix`.`userTableConfiguration` +ADD CONSTRAINT `fgn_user` + FOREIGN KEY (`userFk`) + REFERENCES `account`.`user` (`id`) + ON DELETE CASCADE + ON UPDATE CASCADE; From b2dc6ce8c6624025b81eb0cd14da25b14a9736fc Mon Sep 17 00:00:00 2001 From: Bernat Date: Tue, 5 Feb 2019 10:48:33 +0100 Subject: [PATCH 15/24] #9746 update structure db --- back/model-config.json | 2 +- ...nfiguration.json => user-config-view.json} | 4 +- .../changes/1.2-CHECK/23-userConfigView.sql | 9 ++++ .../1.2-CHECK/23-userTableConfiguration.sql | 48 ------------------- 4 files changed, 12 insertions(+), 51 deletions(-) rename back/models/{user-table-configuration.json => user-config-view.json} (85%) create mode 100644 services/db/install/changes/1.2-CHECK/23-userConfigView.sql delete mode 100644 services/db/install/changes/1.2-CHECK/23-userTableConfiguration.sql diff --git a/back/model-config.json b/back/model-config.json index 7a7b7af56..0a0772b04 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -38,7 +38,7 @@ "Vehicle": { "dataSource": "vn" }, - "UserTableConfiguration": { + "UserConfigView": { "dataSource": "vn" } } diff --git a/back/models/user-table-configuration.json b/back/models/user-config-view.json similarity index 85% rename from back/models/user-table-configuration.json rename to back/models/user-config-view.json index 4a35f66cf..1cb933079 100644 --- a/back/models/user-table-configuration.json +++ b/back/models/user-config-view.json @@ -1,9 +1,9 @@ { - "name": "UserTableConfiguration", + "name": "UserConfigView", "base": "VnModel", "options": { "mysql": { - "table": "salix.userTableConfiguration" + "table": "salix.userConfigView" } }, "properties": { diff --git a/services/db/install/changes/1.2-CHECK/23-userConfigView.sql b/services/db/install/changes/1.2-CHECK/23-userConfigView.sql new file mode 100644 index 000000000..855b77f0f --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/23-userConfigView.sql @@ -0,0 +1,9 @@ + +CREATE TABLE `salix`.`userConfigView` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `userFk` int(10) unsigned NOT NULL, + `tableCode` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `configuration` text COLLATE utf8_unicode_ci, + PRIMARY KEY (`id`), + UNIQUE KEY `uniqueUser_TableCode` (`userFk`,`tableCode`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; diff --git a/services/db/install/changes/1.2-CHECK/23-userTableConfiguration.sql b/services/db/install/changes/1.2-CHECK/23-userTableConfiguration.sql deleted file mode 100644 index c7212f7ba..000000000 --- a/services/db/install/changes/1.2-CHECK/23-userTableConfiguration.sql +++ /dev/null @@ -1,48 +0,0 @@ -CREATE TABLE `salix`.`userTableConfiguration` ( - `id` INT NOT NULL AUTO_INCREMENT, - `workerFk` INT(11) NOT NULL, - `tableCode` VARCHAR(255) NOT NULL, - `configuration` TEXT NULL, - PRIMARY KEY (`id`)); - - - - -ALTER TABLE `salix`.`userTableConfiguration` -ADD INDEX `fgn_worker_idx` (`workerFk` ASC); -ALTER TABLE `salix`.`userTableConfiguration` -ADD CONSTRAINT `fgn_worker` - FOREIGN KEY (`workerFk`) - REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `salix`.`userTableConfiguration` -DROP FOREIGN KEY `fgn_worker`; -ALTER TABLE `salix`.`userTableConfiguration` -CHANGE COLUMN `workerFk` `userFk` INT(10) NOT NULL ; -ALTER TABLE `salix`.`userTableConfiguration` -ADD CONSTRAINT `fgn_worker` - FOREIGN KEY (`userFk`) - REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `salix`.`userTableConfiguration` -DROP FOREIGN KEY `fgn_worker`; -ALTER TABLE `salix`.`userTableConfiguration` -DROP INDEX `fgn_worker_idx` ; - - - -ALTER TABLE `salix`.`userTableConfiguration` -CHANGE COLUMN `userFk` `userFk` INT(10) UNSIGNED NOT NULL ; - - ALTER TABLE `salix`.`userTableConfiguration` -ADD INDEX `fgn_user_idx` (`userFk` ASC); -ALTER TABLE `salix`.`userTableConfiguration` -ADD CONSTRAINT `fgn_user` - FOREIGN KEY (`userFk`) - REFERENCES `account`.`user` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE; From 4f2ca4af05721e81ef26bdae43b083e7d262c180 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 5 Feb 2019 11:11:05 +0100 Subject: [PATCH 16/24] report sample --- .../report/sample-report/assets/css/index.js | 7 ++++ .../report/sample-report/assets/css/style.css | 3 ++ print/report/sample-report/index.html | 35 +++++++++++++++++++ print/report/sample-report/index.js | 32 +++++++++++++++++ print/report/sample-report/locale.js | 11 ++++++ 5 files changed, 88 insertions(+) create mode 100644 print/report/sample-report/assets/css/index.js create mode 100644 print/report/sample-report/assets/css/style.css create mode 100644 print/report/sample-report/index.html create mode 100755 print/report/sample-report/index.js create mode 100644 print/report/sample-report/locale.js diff --git a/print/report/sample-report/assets/css/index.js b/print/report/sample-report/assets/css/index.js new file mode 100644 index 000000000..d40ab4984 --- /dev/null +++ b/print/report/sample-report/assets/css/index.js @@ -0,0 +1,7 @@ +const CssReader = require(`${appPath}/lib/cssReader`); + +module.exports = new CssReader([ + `${appPath}/common/css/layout.css`, + `${appPath}/common/css/misc.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/report/sample-report/assets/css/style.css b/print/report/sample-report/assets/css/style.css new file mode 100644 index 000000000..e621f3e23 --- /dev/null +++ b/print/report/sample-report/assets/css/style.css @@ -0,0 +1,3 @@ +table.column-oriented { + margin-top: 50px !important +} \ No newline at end of file diff --git a/print/report/sample-report/index.html b/print/report/sample-report/index.html new file mode 100644 index 000000000..f77ef0014 --- /dev/null +++ b/print/report/sample-report/index.html @@ -0,0 +1,35 @@ + + + +
+ +
+ +

{{$t('title')}}

+

{{$t('date')}} {{dated()}}

+ + + + + + + + + + + + + + + +
Id{{$t('concept')}}{{$t('quantity')}}
{{sale.id}}{{sale.concept}}{{sale.quantity}}
+ +
+ + +
+ + \ No newline at end of file diff --git a/print/report/sample-report/index.js b/print/report/sample-report/index.js new file mode 100755 index 000000000..b6894060a --- /dev/null +++ b/print/report/sample-report/index.js @@ -0,0 +1,32 @@ +const strftime = require('strftime'); + +module.exports = { + name: 'sample-report', + created() { + if (this.locale) + this.$i18n.locale = this.locale; + }, + data() { + return { + client: { + id: 10252, + name: 'Batman', + }, + sales: [ + {id: 1, concept: 'My item 1', quantity: 25}, + {id: 2, concept: 'My item 2', quantity: 50}, + {id: 3, concept: 'My item 3', quantity: 150} + ], + locale: 'es' + }; + }, + methods: { + dated: () => { + return strftime('%d-%m-%Y', new Date()); + }, + }, + components: { + 'report-header': require('../report-header'), + 'report-footer': require('../report-footer'), + }, +}; diff --git a/print/report/sample-report/locale.js b/print/report/sample-report/locale.js new file mode 100644 index 000000000..d231e10ff --- /dev/null +++ b/print/report/sample-report/locale.js @@ -0,0 +1,11 @@ +module.exports = { + messages: { + es: { + title: 'Sample report', + date: 'Fecha', + quantity: 'Cantidad', + concept: 'Concepto', + client: 'Cliente {0}', + }, + }, +}; From a32ea66a1593a2f41891dfaa5db1a537e084ac8f Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 5 Feb 2019 11:25:47 +0100 Subject: [PATCH 17/24] #913 ticket-basic data step one --- modules/ticket/front/data/step-one/index.html | 8 +++++--- modules/ticket/front/data/step-one/index.js | 1 + modules/ticket/front/data/step-one/style.scss | 13 +++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 modules/ticket/front/data/step-one/style.scss diff --git a/modules/ticket/front/data/step-one/index.html b/modules/ticket/front/data/step-one/index.html index de054ed46..44c2d0579 100644 --- a/modules/ticket/front/data/step-one/index.html +++ b/modules/ticket/front/data/step-one/index.html @@ -16,9 +16,11 @@ label="Address" show-field="nickname" value-field="id" - field="$ctrl.ticket.addressFk"> - {{::nickname}} - - {{::street}} - {{::city}} - {{::province.name}} - {{::agencyMode.name}} + field="$ctrl.ticket.addressFk" + order="isActive DESC"> + + {{::isActive ? '' : 'INACTIVE'}} {{::nickname}} + - {{::street}} - {{::city}} - {{::province.name}} - {{::agencyMode.name}} .inactive { + text-transform: uppercase; + } +} From fa47c15d7add0c8923f6c74d76608d12f170c3d5 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 5 Feb 2019 11:31:30 +0100 Subject: [PATCH 18/24] catalog item type dropdown show limit #1041 --- modules/order/back/methods/order/catalogFilter.js | 2 +- modules/order/front/filter/index.html | 4 +--- modules/order/front/filter/style.scss | 4 ++++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/order/back/methods/order/catalogFilter.js b/modules/order/back/methods/order/catalogFilter.js index 519c96267..7c609ec8d 100644 --- a/modules/order/back/methods/order/catalogFilter.js +++ b/modules/order/back/methods/order/catalogFilter.js @@ -37,7 +37,7 @@ module.exports = Self => { }, }); - Self.catalogFilter = async (orderFk, orderBy, filter, tags) => { + Self.catalogFilter = async(orderFk, orderBy, filter, tags) => { let conn = Self.dataSource.connector; const stmts = []; let stmt; diff --git a/modules/order/front/filter/index.html b/modules/order/front/filter/index.html index f4949c88a..f4c1c6390 100644 --- a/modules/order/front/filter/index.html +++ b/modules/order/front/filter/index.html @@ -19,9 +19,7 @@ - Date: Tue, 5 Feb 2019 11:44:08 +0100 Subject: [PATCH 19/24] bug fixed --- modules/ticket/front/data/step-one/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/data/step-one/index.html b/modules/ticket/front/data/step-one/index.html index 44c2d0579..20ddc1a69 100644 --- a/modules/ticket/front/data/step-one/index.html +++ b/modules/ticket/front/data/step-one/index.html @@ -20,7 +20,7 @@ order="isActive DESC"> {{::isActive ? '' : 'INACTIVE'}} {{::nickname}} - - {{::street}} - {{::city}} - {{::province.name}} - {{::agencyMode.name}} + - {{::street}} - {{::city}} - {{::province.name}} - {{::agencyMode.name}} Date: Tue, 5 Feb 2019 12:20:03 +0100 Subject: [PATCH 20/24] tracking edit not showing hotfix --- modules/ticket/front/tracking/index/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/tracking/index/index.html b/modules/ticket/front/tracking/index/index.html index 21ef5c176..c5a8c993b 100644 --- a/modules/ticket/front/tracking/index/index.html +++ b/modules/ticket/front/tracking/index/index.html @@ -34,6 +34,6 @@ - + \ No newline at end of file From 44893b57e73fdae198edaeecdad7665622b1aa7c Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 5 Feb 2019 16:41:36 +0100 Subject: [PATCH 21/24] #1012 claim.action --- e2e/helpers/selectors.js | 2 +- front/core/components/dialog/dialog.js | 3 - front/salix/styles/index.js | 1 + .../salix/styles/modal-form.scss | 4 +- modules/client/front/risk/create/index.html | 85 ++++++++++--------- modules/client/front/risk/create/index.js | 70 +++++++++------ modules/client/front/risk/create/style.scss | 3 + modules/client/front/risk/index/index.html | 19 +++-- modules/client/front/risk/index/index.js | 11 +++ modules/item/front/ticket-descriptor/index.js | 1 - 10 files changed, 116 insertions(+), 83 deletions(-) rename modules/item/front/ticket-descriptor/style.scss => front/salix/styles/modal-form.scss (90%) create mode 100644 modules/client/front/risk/create/style.scss diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index b3b937f48..bc0135e40 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -164,7 +164,7 @@ export default { newPaymentButton: `${components.vnFloatButton}`, newPaymentBankInut: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.bankFk"] input`, newPaymentAmountInput: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.amountPaid"] input`, - saveButton: `${components.vnSubmit}`, + saveButton: `vn-client-risk-create vn-button[label="Save"]`, firstRiskLineBalance: 'vn-client-risk-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)' }, diff --git a/front/core/components/dialog/dialog.js b/front/core/components/dialog/dialog.js index fb904f2f0..7ea588a27 100644 --- a/front/core/components/dialog/dialog.js +++ b/front/core/components/dialog/dialog.js @@ -47,9 +47,6 @@ export default class Dialog extends Component { if (this.onOpen) this.onOpen(); - - let firstFocusable = this.element.querySelector('input, textarea'); - if (firstFocusable) firstFocusable.focus(); } /** diff --git a/front/salix/styles/index.js b/front/salix/styles/index.js index 6149668b8..7f919436a 100644 --- a/front/salix/styles/index.js +++ b/front/salix/styles/index.js @@ -13,3 +13,4 @@ import './effects.scss'; import './order-product.scss'; import './summary.scss'; import './descriptor.scss'; +import './modal-form.scss'; diff --git a/modules/item/front/ticket-descriptor/style.scss b/front/salix/styles/modal-form.scss similarity index 90% rename from modules/item/front/ticket-descriptor/style.scss rename to front/salix/styles/modal-form.scss index 7c1a448d0..e353833e6 100644 --- a/modules/item/front/ticket-descriptor/style.scss +++ b/front/salix/styles/modal-form.scss @@ -1,7 +1,9 @@ @import 'colors'; +@import "./padding"; vn-dialog.modal-form { vn-horizontal.header{ + @extend .pad-small; background-color: $main-01; h5{ color: white; @@ -14,7 +16,7 @@ vn-dialog.modal-form { table { width: 100% } - &>div{ + & > div{ padding: 0!important; } vn-textfield { diff --git a/modules/client/front/risk/create/index.html b/modules/client/front/risk/create/index.html index 095d16986..950d54a52 100644 --- a/modules/client/front/risk/create/index.html +++ b/modules/client/front/risk/create/index.html @@ -1,44 +1,45 @@ - - - -
- - - - - - + + + + +
New payment
- - - - - +
+ + + + + + + + + + + + +
+ + + -
- - - - -
\ No newline at end of file + + \ No newline at end of file diff --git a/modules/client/front/risk/create/index.js b/modules/client/front/risk/create/index.js index a828d7264..11e701791 100644 --- a/modules/client/front/risk/create/index.js +++ b/modules/client/front/risk/create/index.js @@ -1,11 +1,13 @@ import ngModule from '../../module'; +import './style.scss'; class Controller { - constructor($scope, $state, $http, $stateParams) { + constructor($scope, $state, $http, vnApp, $translate) { this.$http = $http; this.$ = $scope; this.$state = $state; - this.$stateParams = $stateParams; + this.vnApp = vnApp; + this.$translate = $translate; this.receipt = { payed: new Date(), @@ -13,21 +15,26 @@ class Controller { companyFk: window.localStorage.defaultCompanyFk, bankFk: window.localStorage.defaultBankFk }; - - if (this.$stateParams.payed) - this.receipt.payed = this.$stateParams.payed; - - if (this.$stateParams.bankFk) - this.receipt.bankFk = this.$stateParams.bankFk; - - if (this.$stateParams.amountPaid) - this.receipt.amountPaid = this.$stateParams.amountPaid; - - if (this.$stateParams.companyFk) - this.receipt.companyFk = this.$stateParams.companyFk; } - $onInit() { + set payed(value) { + this.receipt.payed = value; + } + + set bankFk(value) { + this.receipt.bankFk = value; + } + + set amountPaid(value) { + this.receipt.amountPaid = value; + } + + set companyFk(value) { + this.receipt.companyFk = value; + this.getAmountPaid(); + } + + getAmountPaid() { let filter = { where: { clientFk: this.$state.params.id, @@ -41,25 +48,34 @@ class Controller { }); } - cancel() { - this.goToIndex(); + show() { + this.$.dialog.show(); } - goToIndex() { - this.$state.go('client.card.risk.index'); + hide() { + this.$.dialog.hide(); } - onSubmit() { - this.$.watcher.submit().then( - () => { - this.goToIndex(); - } - ); + save() { + let query = `/client/api/receipts`; + this.$http.post(query, this.receipt).then(() => { + this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.hide(); + if (this.onResponse) + this.onResponse(); + }); } } -Controller.$inject = ['$scope', '$state', '$http', '$stateParams']; +Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate']; ngModule.component('vnClientRiskCreate', { template: require('./index.html'), - controller: Controller + controller: Controller, + bindings: { + payed: ' - - - - + fixed-bottom-right + ng-click="$ctrl.openCreateDialog()"> + + + + \ No newline at end of file diff --git a/modules/client/front/risk/index/index.js b/modules/client/front/risk/index/index.js index 14c1be3b7..6feea8b96 100644 --- a/modules/client/front/risk/index/index.js +++ b/modules/client/front/risk/index/index.js @@ -31,6 +31,9 @@ class Controller { setOrder(value) { this.params.params.companyFk = value; this.filter.where.companyFk = value; + } + + refresh() { this.$.model.refresh(); this.$.riskModel.refresh(); } @@ -55,6 +58,14 @@ class Controller { return this._risks; } + openCreateDialog() { + this.$.riskCreateDialog.companyFk = this.companyFk; + this.$.riskCreateDialog.onResponse = () => { + this.refresh(); + }; + this.$.riskCreateDialog.show(); + } + onDownload() { alert('Not implemented yet'); } diff --git a/modules/item/front/ticket-descriptor/index.js b/modules/item/front/ticket-descriptor/index.js index 948994701..53f13eb1a 100644 --- a/modules/item/front/ticket-descriptor/index.js +++ b/modules/item/front/ticket-descriptor/index.js @@ -1,5 +1,4 @@ import ngModule from '../module'; -import './style.scss'; class Controller { constructor($state, $scope, $http, vnApp, $translate) { From 48bb876beaedf3c9af3cc8386563d3fd6159b7c8 Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 5 Feb 2019 16:42:28 +0100 Subject: [PATCH 22/24] Revert "#1012 claim.action" This reverts commit 44893b57e73fdae198edaeecdad7665622b1aa7c. --- e2e/helpers/selectors.js | 2 +- front/core/components/dialog/dialog.js | 3 + front/salix/styles/index.js | 1 - modules/client/front/risk/create/index.html | 85 +++++++++---------- modules/client/front/risk/create/index.js | 70 ++++++--------- modules/client/front/risk/create/style.scss | 3 - modules/client/front/risk/index/index.html | 19 ++--- modules/client/front/risk/index/index.js | 11 --- modules/item/front/ticket-descriptor/index.js | 1 + .../item/front/ticket-descriptor/style.scss | 4 +- 10 files changed, 83 insertions(+), 116 deletions(-) delete mode 100644 modules/client/front/risk/create/style.scss rename front/salix/styles/modal-form.scss => modules/item/front/ticket-descriptor/style.scss (90%) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index bc0135e40..b3b937f48 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -164,7 +164,7 @@ export default { newPaymentButton: `${components.vnFloatButton}`, newPaymentBankInut: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.bankFk"] input`, newPaymentAmountInput: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.amountPaid"] input`, - saveButton: `vn-client-risk-create vn-button[label="Save"]`, + saveButton: `${components.vnSubmit}`, firstRiskLineBalance: 'vn-client-risk-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)' }, diff --git a/front/core/components/dialog/dialog.js b/front/core/components/dialog/dialog.js index 7ea588a27..fb904f2f0 100644 --- a/front/core/components/dialog/dialog.js +++ b/front/core/components/dialog/dialog.js @@ -47,6 +47,9 @@ export default class Dialog extends Component { if (this.onOpen) this.onOpen(); + + let firstFocusable = this.element.querySelector('input, textarea'); + if (firstFocusable) firstFocusable.focus(); } /** diff --git a/front/salix/styles/index.js b/front/salix/styles/index.js index 7f919436a..6149668b8 100644 --- a/front/salix/styles/index.js +++ b/front/salix/styles/index.js @@ -13,4 +13,3 @@ import './effects.scss'; import './order-product.scss'; import './summary.scss'; import './descriptor.scss'; -import './modal-form.scss'; diff --git a/modules/client/front/risk/create/index.html b/modules/client/front/risk/create/index.html index 950d54a52..095d16986 100644 --- a/modules/client/front/risk/create/index.html +++ b/modules/client/front/risk/create/index.html @@ -1,45 +1,44 @@ - - - - -
New payment
+ + + +
+ + + + + + -
- - - - - - - - - - - - -
- - - + + + + + - - \ No newline at end of file +
+ + + + +
\ No newline at end of file diff --git a/modules/client/front/risk/create/index.js b/modules/client/front/risk/create/index.js index 11e701791..a828d7264 100644 --- a/modules/client/front/risk/create/index.js +++ b/modules/client/front/risk/create/index.js @@ -1,13 +1,11 @@ import ngModule from '../../module'; -import './style.scss'; class Controller { - constructor($scope, $state, $http, vnApp, $translate) { + constructor($scope, $state, $http, $stateParams) { this.$http = $http; this.$ = $scope; this.$state = $state; - this.vnApp = vnApp; - this.$translate = $translate; + this.$stateParams = $stateParams; this.receipt = { payed: new Date(), @@ -15,26 +13,21 @@ class Controller { companyFk: window.localStorage.defaultCompanyFk, bankFk: window.localStorage.defaultBankFk }; + + if (this.$stateParams.payed) + this.receipt.payed = this.$stateParams.payed; + + if (this.$stateParams.bankFk) + this.receipt.bankFk = this.$stateParams.bankFk; + + if (this.$stateParams.amountPaid) + this.receipt.amountPaid = this.$stateParams.amountPaid; + + if (this.$stateParams.companyFk) + this.receipt.companyFk = this.$stateParams.companyFk; } - set payed(value) { - this.receipt.payed = value; - } - - set bankFk(value) { - this.receipt.bankFk = value; - } - - set amountPaid(value) { - this.receipt.amountPaid = value; - } - - set companyFk(value) { - this.receipt.companyFk = value; - this.getAmountPaid(); - } - - getAmountPaid() { + $onInit() { let filter = { where: { clientFk: this.$state.params.id, @@ -48,34 +41,25 @@ class Controller { }); } - show() { - this.$.dialog.show(); + cancel() { + this.goToIndex(); } - hide() { - this.$.dialog.hide(); + goToIndex() { + this.$state.go('client.card.risk.index'); } - save() { - let query = `/client/api/receipts`; - this.$http.post(query, this.receipt).then(() => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); - this.hide(); - if (this.onResponse) - this.onResponse(); - }); + onSubmit() { + this.$.watcher.submit().then( + () => { + this.goToIndex(); + } + ); } } -Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate']; +Controller.$inject = ['$scope', '$state', '$http', '$stateParams']; ngModule.component('vnClientRiskCreate', { template: require('./index.html'), - controller: Controller, - bindings: { - payed: ' - - - - - - \ No newline at end of file + fixed-bottom-right> + + + diff --git a/modules/client/front/risk/index/index.js b/modules/client/front/risk/index/index.js index 6feea8b96..14c1be3b7 100644 --- a/modules/client/front/risk/index/index.js +++ b/modules/client/front/risk/index/index.js @@ -31,9 +31,6 @@ class Controller { setOrder(value) { this.params.params.companyFk = value; this.filter.where.companyFk = value; - } - - refresh() { this.$.model.refresh(); this.$.riskModel.refresh(); } @@ -58,14 +55,6 @@ class Controller { return this._risks; } - openCreateDialog() { - this.$.riskCreateDialog.companyFk = this.companyFk; - this.$.riskCreateDialog.onResponse = () => { - this.refresh(); - }; - this.$.riskCreateDialog.show(); - } - onDownload() { alert('Not implemented yet'); } diff --git a/modules/item/front/ticket-descriptor/index.js b/modules/item/front/ticket-descriptor/index.js index 53f13eb1a..948994701 100644 --- a/modules/item/front/ticket-descriptor/index.js +++ b/modules/item/front/ticket-descriptor/index.js @@ -1,4 +1,5 @@ import ngModule from '../module'; +import './style.scss'; class Controller { constructor($state, $scope, $http, vnApp, $translate) { diff --git a/front/salix/styles/modal-form.scss b/modules/item/front/ticket-descriptor/style.scss similarity index 90% rename from front/salix/styles/modal-form.scss rename to modules/item/front/ticket-descriptor/style.scss index e353833e6..7c1a448d0 100644 --- a/front/salix/styles/modal-form.scss +++ b/modules/item/front/ticket-descriptor/style.scss @@ -1,9 +1,7 @@ @import 'colors'; -@import "./padding"; vn-dialog.modal-form { vn-horizontal.header{ - @extend .pad-small; background-color: $main-01; h5{ color: white; @@ -16,7 +14,7 @@ vn-dialog.modal-form { table { width: 100% } - & > div{ + &>div{ padding: 0!important; } vn-textfield { From f59d022da889acafd6f6ca8c19a43779c678c24e Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 5 Feb 2019 16:46:02 +0100 Subject: [PATCH 23/24] #1078 risk.create --- e2e/helpers/selectors.js | 2 +- front/core/components/dialog/dialog.js | 3 - front/salix/styles/index.js | 1 + front/salix/styles/modal-form.scss | 38 +++++++++ modules/client/front/risk/create/index.html | 85 ++++++++++--------- modules/client/front/risk/create/index.js | 70 +++++++++------ modules/client/front/risk/create/style.scss | 3 + modules/client/front/risk/index/index.html | 19 +++-- modules/client/front/risk/index/index.js | 11 +++ modules/item/front/ticket-descriptor/index.js | 1 - 10 files changed, 151 insertions(+), 82 deletions(-) create mode 100644 front/salix/styles/modal-form.scss create mode 100644 modules/client/front/risk/create/style.scss diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index b3b937f48..bc0135e40 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -164,7 +164,7 @@ export default { newPaymentButton: `${components.vnFloatButton}`, newPaymentBankInut: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.bankFk"] input`, newPaymentAmountInput: `vn-client-risk-create vn-textfield[field="$ctrl.receipt.amountPaid"] input`, - saveButton: `${components.vnSubmit}`, + saveButton: `vn-client-risk-create vn-button[label="Save"]`, firstRiskLineBalance: 'vn-client-risk-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)' }, diff --git a/front/core/components/dialog/dialog.js b/front/core/components/dialog/dialog.js index fb904f2f0..7ea588a27 100644 --- a/front/core/components/dialog/dialog.js +++ b/front/core/components/dialog/dialog.js @@ -47,9 +47,6 @@ export default class Dialog extends Component { if (this.onOpen) this.onOpen(); - - let firstFocusable = this.element.querySelector('input, textarea'); - if (firstFocusable) firstFocusable.focus(); } /** diff --git a/front/salix/styles/index.js b/front/salix/styles/index.js index 6149668b8..7f919436a 100644 --- a/front/salix/styles/index.js +++ b/front/salix/styles/index.js @@ -13,3 +13,4 @@ import './effects.scss'; import './order-product.scss'; import './summary.scss'; import './descriptor.scss'; +import './modal-form.scss'; diff --git a/front/salix/styles/modal-form.scss b/front/salix/styles/modal-form.scss new file mode 100644 index 000000000..e353833e6 --- /dev/null +++ b/front/salix/styles/modal-form.scss @@ -0,0 +1,38 @@ +@import 'colors'; +@import "./padding"; + +vn-dialog.modal-form { + vn-horizontal.header{ + @extend .pad-small; + background-color: $main-01; + h5{ + color: white; + margin: 0 auto; + } + } + tpl-body { + width: 100%; + } + table { + width: 100% + } + & > div{ + padding: 0!important; + } + vn-textfield { + width: 100%; + } + .buttons{ + margin-top: 0!important; + } + + p{ + display: none; + } + button.close > vn-icon{ + color: white!important; + } + vn-ticket-sale-edit-discount > div { + padding-bottom: 0!important; + } +} \ No newline at end of file diff --git a/modules/client/front/risk/create/index.html b/modules/client/front/risk/create/index.html index 095d16986..950d54a52 100644 --- a/modules/client/front/risk/create/index.html +++ b/modules/client/front/risk/create/index.html @@ -1,44 +1,45 @@ - - - -
- - - - - - + + + + +
New payment
- - - - - +
+ + + + + + + + + + + + +
+ + + -
- - - - -
\ No newline at end of file +
+
\ No newline at end of file diff --git a/modules/client/front/risk/create/index.js b/modules/client/front/risk/create/index.js index a828d7264..11e701791 100644 --- a/modules/client/front/risk/create/index.js +++ b/modules/client/front/risk/create/index.js @@ -1,11 +1,13 @@ import ngModule from '../../module'; +import './style.scss'; class Controller { - constructor($scope, $state, $http, $stateParams) { + constructor($scope, $state, $http, vnApp, $translate) { this.$http = $http; this.$ = $scope; this.$state = $state; - this.$stateParams = $stateParams; + this.vnApp = vnApp; + this.$translate = $translate; this.receipt = { payed: new Date(), @@ -13,21 +15,26 @@ class Controller { companyFk: window.localStorage.defaultCompanyFk, bankFk: window.localStorage.defaultBankFk }; - - if (this.$stateParams.payed) - this.receipt.payed = this.$stateParams.payed; - - if (this.$stateParams.bankFk) - this.receipt.bankFk = this.$stateParams.bankFk; - - if (this.$stateParams.amountPaid) - this.receipt.amountPaid = this.$stateParams.amountPaid; - - if (this.$stateParams.companyFk) - this.receipt.companyFk = this.$stateParams.companyFk; } - $onInit() { + set payed(value) { + this.receipt.payed = value; + } + + set bankFk(value) { + this.receipt.bankFk = value; + } + + set amountPaid(value) { + this.receipt.amountPaid = value; + } + + set companyFk(value) { + this.receipt.companyFk = value; + this.getAmountPaid(); + } + + getAmountPaid() { let filter = { where: { clientFk: this.$state.params.id, @@ -41,25 +48,34 @@ class Controller { }); } - cancel() { - this.goToIndex(); + show() { + this.$.dialog.show(); } - goToIndex() { - this.$state.go('client.card.risk.index'); + hide() { + this.$.dialog.hide(); } - onSubmit() { - this.$.watcher.submit().then( - () => { - this.goToIndex(); - } - ); + save() { + let query = `/client/api/receipts`; + this.$http.post(query, this.receipt).then(() => { + this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.hide(); + if (this.onResponse) + this.onResponse(); + }); } } -Controller.$inject = ['$scope', '$state', '$http', '$stateParams']; +Controller.$inject = ['$scope', '$state', '$http', 'vnApp', '$translate']; ngModule.component('vnClientRiskCreate', { template: require('./index.html'), - controller: Controller + controller: Controller, + bindings: { + payed: ' - - - - + fixed-bottom-right + ng-click="$ctrl.openCreateDialog()"> + + + + \ No newline at end of file diff --git a/modules/client/front/risk/index/index.js b/modules/client/front/risk/index/index.js index 14c1be3b7..6feea8b96 100644 --- a/modules/client/front/risk/index/index.js +++ b/modules/client/front/risk/index/index.js @@ -31,6 +31,9 @@ class Controller { setOrder(value) { this.params.params.companyFk = value; this.filter.where.companyFk = value; + } + + refresh() { this.$.model.refresh(); this.$.riskModel.refresh(); } @@ -55,6 +58,14 @@ class Controller { return this._risks; } + openCreateDialog() { + this.$.riskCreateDialog.companyFk = this.companyFk; + this.$.riskCreateDialog.onResponse = () => { + this.refresh(); + }; + this.$.riskCreateDialog.show(); + } + onDownload() { alert('Not implemented yet'); } diff --git a/modules/item/front/ticket-descriptor/index.js b/modules/item/front/ticket-descriptor/index.js index 948994701..53f13eb1a 100644 --- a/modules/item/front/ticket-descriptor/index.js +++ b/modules/item/front/ticket-descriptor/index.js @@ -1,5 +1,4 @@ import ngModule from '../module'; -import './style.scss'; class Controller { constructor($state, $scope, $http, vnApp, $translate) { From a605b8f9b7176932e6402d47b2bce7f282cf502b Mon Sep 17 00:00:00 2001 From: Gerard Date: Tue, 5 Feb 2019 16:53:55 +0100 Subject: [PATCH 24/24] #1065 item.last-entries --- modules/item/front/last-entries/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/front/last-entries/index.html b/modules/item/front/last-entries/index.html index 210bb88b1..bca5b8177 100644 --- a/modules/item/front/last-entries/index.html +++ b/modules/item/front/last-entries/index.html @@ -39,7 +39,7 @@