From d8159487954243c1595447f5beb14a588c7f0e75 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 3 Jan 2020 13:52:42 +0100 Subject: [PATCH 1/8] Added buyer week-waste email #1972 --- .../buyer-week-waste/assets/css/import.js | 8 +++ .../buyer-week-waste/buyer-week-waste.html | 69 +++++++++++++++++++ .../buyer-week-waste/buyer-week-waste.js | 31 +++++++++ .../email/buyer-week-waste/locale/es.yml | 8 +++ 4 files changed, 116 insertions(+) create mode 100644 print/templates/email/buyer-week-waste/assets/css/import.js create mode 100644 print/templates/email/buyer-week-waste/buyer-week-waste.html create mode 100755 print/templates/email/buyer-week-waste/buyer-week-waste.js create mode 100644 print/templates/email/buyer-week-waste/locale/es.yml diff --git a/print/templates/email/buyer-week-waste/assets/css/import.js b/print/templates/email/buyer-week-waste/assets/css/import.js new file mode 100644 index 000000000..b44d6bd37 --- /dev/null +++ b/print/templates/email/buyer-week-waste/assets/css/import.js @@ -0,0 +1,8 @@ +const Stylesheet = require(`${appPath}/core/stylesheet`); + +module.exports = new Stylesheet([ + `${appPath}/common/css/spacing.css`, + `${appPath}/common/css/misc.css`, + `${appPath}/common/css/layout.css`, + `${appPath}/common/css/email.css`]) + .mergeStyles(); diff --git a/print/templates/email/buyer-week-waste/buyer-week-waste.html b/print/templates/email/buyer-week-waste/buyer-week-waste.html new file mode 100644 index 000000000..a0405e5f2 --- /dev/null +++ b/print/templates/email/buyer-week-waste/buyer-week-waste.html @@ -0,0 +1,69 @@ + + + + + + {{ $t('subject') }} + + + + + + + + +
+ +
+
+
+ +
+
+ +
+
+ +
+
+

{{ $t('title') }}

+

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

+

+
+
+ +
+
+ + + + + + + + + + + + + + + + + +
{{$t('buyer')}}{{$t('percentage')}}{{$t('dwindle')}}{{$t('total')}}
{{waste.buyer}}{{waste.porcentaje | percentage(2, 2, locale)}}{{waste.mermas | currency('EUR', locale)}}{{waste.total | currency('EUR', locale)}}
+
+
+ +
+
+ +
+
+ +
+
+
+
+ + \ No newline at end of file diff --git a/print/templates/email/buyer-week-waste/buyer-week-waste.js b/print/templates/email/buyer-week-waste/buyer-week-waste.js new file mode 100755 index 000000000..4639e7d5b --- /dev/null +++ b/print/templates/email/buyer-week-waste/buyer-week-waste.js @@ -0,0 +1,31 @@ +const Component = require(`${appPath}/core/component`); +const db = require(`${appPath}/core/database`); +const emailHeader = new Component('email-header'); +const emailFooter = new Component('email-footer'); + +module.exports = { + name: 'buyer-week-waste', + async serverPrefetch() { + this.wastes = await this.fetchWastes(); + + if (!this.wastes) + throw new Error('Something went wrong'); + }, + computed: { + dated: function() { + const filters = this.$options.filters; + + return filters.date(new Date(), '%d-%m-%Y'); + } + }, + methods: { + fetchWastes() { + return db.findOne(`CALL bs.weekWaste()`); + } + }, + components: { + 'email-header': emailHeader.build(), + 'email-footer': emailFooter.build() + }, + props: {} +}; diff --git a/print/templates/email/buyer-week-waste/locale/es.yml b/print/templates/email/buyer-week-waste/locale/es.yml new file mode 100644 index 000000000..1bf0e0938 --- /dev/null +++ b/print/templates/email/buyer-week-waste/locale/es.yml @@ -0,0 +1,8 @@ +subject: Resumen semanal +title: Resumen semanal +dear: Hola +description: A continuación se muestra el resumen semanal a fecha de {0}. +buyer: Comprador +percentage: Porcentaje +dwindle: Mermas +total: Total \ No newline at end of file From e7433fab2470ad30265d93c1c55b94ad4a699ef6 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 8 Jan 2020 08:53:07 +0100 Subject: [PATCH 2/8] some fixes --- .../templates/email/buyer-week-waste/buyer-week-waste.html | 2 +- print/templates/email/buyer-week-waste/locale/es.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/print/templates/email/buyer-week-waste/buyer-week-waste.html b/print/templates/email/buyer-week-waste/buyer-week-waste.html index a0405e5f2..9cf3aeefb 100644 --- a/print/templates/email/buyer-week-waste/buyer-week-waste.html +++ b/print/templates/email/buyer-week-waste/buyer-week-waste.html @@ -43,7 +43,7 @@ {{waste.buyer}} - {{waste.porcentaje | percentage(2, 2, locale)}} + {{(waste.porcentaje / 100) | percentage(4, 4, locale)}} {{waste.mermas | currency('EUR', locale)}} {{waste.total | currency('EUR', locale)}} diff --git a/print/templates/email/buyer-week-waste/locale/es.yml b/print/templates/email/buyer-week-waste/locale/es.yml index 1bf0e0938..b0595a1b4 100644 --- a/print/templates/email/buyer-week-waste/locale/es.yml +++ b/print/templates/email/buyer-week-waste/locale/es.yml @@ -1,7 +1,7 @@ -subject: Resumen semanal -title: Resumen semanal +subject: Merma semanal +title: Merma semanal dear: Hola -description: A continuación se muestra el resumen semanal a fecha de {0}. +description: A continuación se muestra la merma semanal a fecha de {0}. buyer: Comprador percentage: Porcentaje dwindle: Mermas From 6c9def9c6cfaa7fb5d1bd788d3fdb5df8384fb65 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 8 Jan 2020 09:06:19 +0100 Subject: [PATCH 3/8] changed translation --- .../templates/email/buyer-week-waste/buyer-week-waste.html | 6 +++--- print/templates/email/buyer-week-waste/locale/es.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/print/templates/email/buyer-week-waste/buyer-week-waste.html b/print/templates/email/buyer-week-waste/buyer-week-waste.html index 9cf3aeefb..99dbd92af 100644 --- a/print/templates/email/buyer-week-waste/buyer-week-waste.html +++ b/print/templates/email/buyer-week-waste/buyer-week-waste.html @@ -36,15 +36,15 @@ {{$t('buyer')}} {{$t('percentage')}} - {{$t('dwindle')}} + {{$t('weakening')}} {{$t('total')}} {{waste.buyer}} - {{(waste.porcentaje / 100) | percentage(4, 4, locale)}} - {{waste.mermas | currency('EUR', locale)}} + {{(waste.percentage / 100) | percentage(4, 4, locale)}} + {{waste.weakening | currency('EUR', locale)}} {{waste.total | currency('EUR', locale)}} diff --git a/print/templates/email/buyer-week-waste/locale/es.yml b/print/templates/email/buyer-week-waste/locale/es.yml index b0595a1b4..96e49d9eb 100644 --- a/print/templates/email/buyer-week-waste/locale/es.yml +++ b/print/templates/email/buyer-week-waste/locale/es.yml @@ -4,5 +4,5 @@ dear: Hola description: A continuación se muestra la merma semanal a fecha de {0}. buyer: Comprador percentage: Porcentaje -dwindle: Mermas +weakening: Mermas total: Total \ No newline at end of file From f362963dbb02d120418fe7b1ce973a10ac2c4952 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 8 Jan 2020 13:52:04 +0100 Subject: [PATCH 4/8] Added total by column --- modules/travel/front/summary/index.html | 33 ++++++++++++++++------ modules/travel/front/summary/index.js | 10 +++++++ modules/travel/front/summary/index.spec.js | 14 +++++++++ 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/modules/travel/front/summary/index.html b/modules/travel/front/summary/index.html index 0ce4517f2..8ef0d00a1 100644 --- a/modules/travel/front/summary/index.html +++ b/modules/travel/front/summary/index.html @@ -43,7 +43,7 @@

Entries

- + Confirmed @@ -61,16 +61,18 @@ - - + + + + {{entry.id}} {{entry.supplierName}} {{entry.ref}} {{entry.hb}} - {{entry.freightValue}} - {{entry.packageValue}} + {{entry.freightValue | currency: 'EUR': 2}} + {{entry.packageValue | currency: 'EUR': 2}} {{entry.cc}} {{entry.pallet}} {{entry.m3}} @@ -81,13 +83,28 @@ icon="insert_drive_file"> + + + + + + + {{$ctrl.total('hb')}} + {{$ctrl.total('freightValue') | currency: 'EUR': 2}} + {{$ctrl.total('packageValue') | currency: 'EUR': 2}} + {{$ctrl.total('cc')}} + {{$ctrl.total('pallet')}} + {{$ctrl.total('m3')}} + + +
diff --git a/modules/travel/front/summary/index.js b/modules/travel/front/summary/index.js index 20946ed3b..670adbd9d 100644 --- a/modules/travel/front/summary/index.js +++ b/modules/travel/front/summary/index.js @@ -5,6 +5,7 @@ class Controller { constructor($scope, $http) { this.$ = $scope; this.$http = $http; + this.entries = []; } get travel() { @@ -31,6 +32,15 @@ class Controller { this.entries = response.data; }); } + + total(field) { + let total = 0; + + for (let entry of this.entries) + total += entry[field]; + + return total; + } } Controller.$inject = ['$scope', '$http']; diff --git a/modules/travel/front/summary/index.spec.js b/modules/travel/front/summary/index.spec.js index dc6e4b23a..ec5beb053 100644 --- a/modules/travel/front/summary/index.spec.js +++ b/modules/travel/front/summary/index.spec.js @@ -58,4 +58,18 @@ describe('component vnTravelSummary', () => { expect(controller.entries).toEqual('I am the entries'); }); }); + + describe('total()', () => { + it('should calculate the total amount of a given property for every row', () => { + controller.entries = [ + {id: 1, freightValue: 1, packageValue: 2, cc: 0.01}, + {id: 2, freightValue: 1, packageValue: 2, cc: 0.01}, + {id: 3, freightValue: 1, packageValue: 2, cc: 0.01} + ]; + + expect(controller.total('freightValue')).toEqual(3); + expect(controller.total('packageValue')).toEqual(6); + expect(controller.total('cc')).toEqual(0.03); + }); + }); }); From 0a9eaa406dc2f93d4e9068844d8bece57a639988 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 8 Jan 2020 13:55:26 +0100 Subject: [PATCH 5/8] changed translations --- modules/travel/front/summary/index.html | 4 ++-- modules/travel/front/summary/locale/es.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/travel/front/summary/index.html b/modules/travel/front/summary/index.html index 8ef0d00a1..51b73ac06 100644 --- a/modules/travel/front/summary/index.html +++ b/modules/travel/front/summary/index.html @@ -51,8 +51,8 @@ Supplier Reference HB - Freight cost - Package cost + Freight + Package CC Pallet m3 diff --git a/modules/travel/front/summary/locale/es.yml b/modules/travel/front/summary/locale/es.yml index 16f21fdde..c82508dfc 100644 --- a/modules/travel/front/summary/locale/es.yml +++ b/modules/travel/front/summary/locale/es.yml @@ -12,6 +12,6 @@ Confirmed: Confirmada Entry Id: Entrada Id Supplier: Proveedor Pallet: Pallet -Freight cost: Coste porte -Package cost: Coste embalaje +Freight: Porte +Package: Embalaje Half box: Media caja From df7493ff14f91208e38a18f7785e6b7e7bed7a18 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 8 Jan 2020 17:03:08 +0100 Subject: [PATCH 6/8] Updated styles --- front/core/directives/droppable.scss | 4 +- front/salix/components/app/style.scss | 2 +- front/salix/components/layout/style.scss | 2 + modules/claim/front/dms/index/index.html | 53 +++++++++++++----------- modules/claim/front/dms/index/index.js | 13 ++++++ modules/claim/front/dms/index/style.scss | 9 ++-- modules/claim/front/dms/locale/en.yml | 2 - modules/claim/front/dms/locale/es.yml | 5 ++- 8 files changed, 54 insertions(+), 36 deletions(-) delete mode 100644 modules/claim/front/dms/locale/en.yml diff --git a/front/core/directives/droppable.scss b/front/core/directives/droppable.scss index 97e6f8a19..f2e18a3ad 100644 --- a/front/core/directives/droppable.scss +++ b/front/core/directives/droppable.scss @@ -11,11 +11,9 @@ .vn-droppable, [vn-droppable] { - display: block; - &.dropping { background-color: $color-hover-cd; - border-color: $color-bg-dark; + border-color: $color-font-secondary; } } diff --git a/front/salix/components/app/style.scss b/front/salix/components/app/style.scss index aab37c8a3..96d6a6193 100644 --- a/front/salix/components/app/style.scss +++ b/front/salix/components/app/style.scss @@ -7,7 +7,7 @@ vn-app { ui-view { display: block; box-sizing: border-box; - height: inherit; + height: 100%; &.ng-enter { animation-name: nothing, slideIn; diff --git a/front/salix/components/layout/style.scss b/front/salix/components/layout/style.scss index 9a9d903a6..b66c620ad 100644 --- a/front/salix/components/layout/style.scss +++ b/front/salix/components/layout/style.scss @@ -87,6 +87,8 @@ vn-layout { & > * { display: block; padding: $spacing-md; + box-sizing: border-box; + height: 100% } &.ng-enter { vn-side-menu { diff --git a/modules/claim/front/dms/index/index.html b/modules/claim/front/dms/index/index.html index bd6b9a21d..88d7931cf 100644 --- a/modules/claim/front/dms/index/index.html +++ b/modules/claim/front/dms/index/index.html @@ -5,31 +5,28 @@ data="$ctrl.photos"> -
-
-
Drag & Drop files here...
-
- - -
-
-
-
- - -
+ +
+
+
Drag & Drop photos here...
+
+
+
- - +
+ + +
+
+
+ @@ -38,4 +35,10 @@ message="This file will be deleted" question="Are you sure you want to continue?" on-response="$ctrl.deleteDms($response)"> - \ No newline at end of file + + + diff --git a/modules/claim/front/dms/index/index.js b/modules/claim/front/dms/index/index.js index 20eba62a3..e83204000 100644 --- a/modules/claim/front/dms/index/index.js +++ b/modules/claim/front/dms/index/index.js @@ -68,6 +68,19 @@ class Controller { }); } + openUploadDialog() { + const element = document.createElement('input'); + element.setAttribute('type', 'file'); + element.setAttribute('multiple', true); + element.click(); + + element.addEventListener('change', () => + this.setDefaultParams().then(() => { + this.dms.files = element.files; + this.create(); + }) + ); + } create() { const query = `claims/${this.claim.id}/uploadFile`; diff --git a/modules/claim/front/dms/index/style.scss b/modules/claim/front/dms/index/style.scss index e7e957cd8..28f9db6fc 100644 --- a/modules/claim/front/dms/index/style.scss +++ b/modules/claim/front/dms/index/style.scss @@ -2,13 +2,16 @@ vn-claim-dms-index { .drop-zone { - border: 2px dashed $color-font-secondary; color: $color-font-secondary; box-sizing: border-box; - padding: 2em $spacing-md; border-radius: 0.5em; text-align: center; - font-size: 1.4em; + min-height: 100%; + + .empty-rows { + padding: 5em $spacing-md; + font-size: 1.4em + } vn-icon { font-size: 3em diff --git a/modules/claim/front/dms/locale/en.yml b/modules/claim/front/dms/locale/en.yml deleted file mode 100644 index a202e8bf2..000000000 --- a/modules/claim/front/dms/locale/en.yml +++ /dev/null @@ -1,2 +0,0 @@ -FileDescription: Ticket id {{ticketId}} from client {{clientName}} id {{clientId}} -ContentTypesInfo: Allowed file types {{allowedContentTypes}} \ No newline at end of file diff --git a/modules/claim/front/dms/locale/es.yml b/modules/claim/front/dms/locale/es.yml index 3e765ae78..8ccc1dba4 100644 --- a/modules/claim/front/dms/locale/es.yml +++ b/modules/claim/front/dms/locale/es.yml @@ -1,4 +1,5 @@ Are you sure you want to continue?: ¿Seguro que quieres continuar? -Drag & Drop files here...: Arrastra y suelta archivos aquí... +Drag & Drop photos here...: Arrastra y suelta fotos aquí... Photo deleted: Foto eliminada -Photo uploaded!: Foto subida! \ No newline at end of file +Photo uploaded!: Foto subida! +Select photo: Seleccionar foto \ No newline at end of file From 0999c7e2ca90a10a310f70fbdd7d00ac3b8764ae Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 9 Jan 2020 07:54:34 +0100 Subject: [PATCH 7/8] renamed field --- print/templates/email/buyer-week-waste/buyer-week-waste.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/print/templates/email/buyer-week-waste/buyer-week-waste.html b/print/templates/email/buyer-week-waste/buyer-week-waste.html index 99dbd92af..47d162a6f 100644 --- a/print/templates/email/buyer-week-waste/buyer-week-waste.html +++ b/print/templates/email/buyer-week-waste/buyer-week-waste.html @@ -36,7 +36,7 @@ {{$t('buyer')}} {{$t('percentage')}} - {{$t('weakening')}} + {{$t('dwindle')}} {{$t('total')}} @@ -44,7 +44,7 @@ {{waste.buyer}} {{(waste.percentage / 100) | percentage(4, 4, locale)}} - {{waste.weakening | currency('EUR', locale)}} + {{waste.dwindle | currency('EUR', locale)}} {{waste.total | currency('EUR', locale)}} From e637f32aaac66fdf41a580393a0ae95160c48f70 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 9 Jan 2020 08:18:13 +0100 Subject: [PATCH 8/8] removed opacity effects --- front/salix/styles/photo-list.scss | 6 +++--- modules/claim/front/dms/index/index.html | 2 +- modules/claim/front/summary/style.scss | 10 ++++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/front/salix/styles/photo-list.scss b/front/salix/styles/photo-list.scss index 3737c508a..b0c926def 100644 --- a/front/salix/styles/photo-list.scss +++ b/front/salix/styles/photo-list.scss @@ -11,7 +11,6 @@ transition: all 0.5s; padding: $spacing-sm; position: relative; - opacity: 0.7; width: 28em; .image { @@ -20,6 +19,7 @@ 0 1px 5px 0 rgba(0,0,0,.12); background: no-repeat center center fixed; background-size: cover !important; + border: 2px solid transparent; overflow: hidden; cursor: zoom-in; height: 100%; @@ -34,7 +34,7 @@ top: 1em } } - .photo:hover { - opacity: 1 + .photo:hover .image { + border: 2px solid $color-primary } } \ No newline at end of file diff --git a/modules/claim/front/dms/index/index.html b/modules/claim/front/dms/index/index.html index 88d7931cf..447538bd1 100644 --- a/modules/claim/front/dms/index/index.html +++ b/modules/claim/front/dms/index/index.html @@ -7,7 +7,7 @@
-
+
Drag & Drop photos here...
diff --git a/modules/claim/front/summary/style.scss b/modules/claim/front/summary/style.scss index 38136f24a..afd3838be 100644 --- a/modules/claim/front/summary/style.scss +++ b/modules/claim/front/summary/style.scss @@ -1,12 +1,10 @@ @import "./variables"; vn-claim-summary { - .photo { - height: 15.5em; + section.photo { + height: 15.5em } - .photo .image { - border: 2px solid $color-bg-dark; - border-radius: 0.2em; + .photo .image { + border-radius: 0.2em } - } \ No newline at end of file