From 7004ad5ade8bff9ef7b9f77eb975a210404c2a59 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Tue, 15 Jun 2021 12:47:40 +0200 Subject: [PATCH 1/6] removed several columns from bulk edit and added packingOut --- .../back/methods/entry/editLatestBuys.js | 8 +---- .../back/methods/entry/latestBuysFilter.js | 33 +++++++++++-------- modules/entry/front/latest-buys/index.html | 2 ++ modules/entry/front/latest-buys/index.js | 10 ++---- modules/entry/front/latest-buys/locale/es.yml | 3 +- modules/item/back/models/item.json | 3 ++ 6 files changed, 30 insertions(+), 29 deletions(-) diff --git a/modules/entry/back/methods/entry/editLatestBuys.js b/modules/entry/back/methods/entry/editLatestBuys.js index be379b0a3..7e6a8a22f 100644 --- a/modules/entry/back/methods/entry/editLatestBuys.js +++ b/modules/entry/back/methods/entry/editLatestBuys.js @@ -48,21 +48,15 @@ module.exports = Self => { switch (field) { case 'size': case 'density': - case 'minPrice': case 'description': + case 'packingOut': modelName = 'Item'; identifier = 'itemFk'; break; - case 'quantity': - case 'buyingValue': - case 'freightValue': case 'packing': case 'grouping': case 'groupingMode': - case 'comissionValue': case 'packageValue': - case 'price2': - case 'price3': case 'weight': modelName = 'Buy'; identifier = 'id'; diff --git a/modules/entry/back/methods/entry/latestBuysFilter.js b/modules/entry/back/methods/entry/latestBuysFilter.js index 68abc9c03..d59e34e64 100644 --- a/modules/entry/back/methods/entry/latestBuysFilter.js +++ b/modules/entry/back/methods/entry/latestBuysFilter.js @@ -10,54 +10,59 @@ module.exports = Self => { accepts: [ { arg: 'filter', - type: 'Object', + type: 'object', description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', }, { arg: 'search', - type: 'String', + type: 'string', description: `If it's and integer searchs by id, otherwise it searchs by name`, }, { arg: 'id', - type: 'Integer', + type: 'integer', description: 'Item id', }, { arg: 'tags', - type: ['Object'], + type: ['object'], description: 'List of tags to filter with', http: {source: 'query'} }, { arg: 'description', - type: 'String', + type: 'string', description: 'The item description', }, { arg: 'salesPersonFk', - type: 'Integer', + type: 'integer', description: 'The buyer of the item', }, { arg: 'active', - type: 'Boolean', + type: 'boolean', description: 'Whether the item is or not active', }, { arg: 'visible', - type: 'Boolean', + type: 'boolean', description: 'Whether the item is or not visible', }, { arg: 'typeFk', - type: 'Integer', + type: 'integer', description: 'Type id', }, { arg: 'categoryFk', - type: 'Integer', + type: 'integer', description: 'Category id', + }, + { + arg: 'packingOut', + type: 'integer', + description: 'the packingOut', } ], returns: { @@ -84,7 +89,10 @@ module.exports = Self => { ? {'i.id': value} : {'i.name': {like: `%${value}%`}}; case 'id': - return {'i.id': value}; + case 'packingOut': + case 'typeFk': + param = `i.${param}`; + return {[param]: value}; case 'description': return {'i.description': {like: `%${value}%`}}; case 'categoryFk': @@ -93,8 +101,6 @@ module.exports = Self => { return {'it.workerFk': value}; case 'code': return {'it.code': value}; - case 'typeFk': - return {'i.typeFk': value}; case 'active': return {'i.isActive': value}; case 'visible': @@ -126,6 +132,7 @@ module.exports = Self => { i.description, i.name, i.subName, + i.packingOut, i.tag5, i.value5, i.tag6, diff --git a/modules/entry/front/latest-buys/index.html b/modules/entry/front/latest-buys/index.html index 88799c816..055756876 100644 --- a/modules/entry/front/latest-buys/index.html +++ b/modules/entry/front/latest-buys/index.html @@ -57,6 +57,7 @@ Ekt Weight PackageName + PackingOut @@ -147,6 +148,7 @@ {{::buy.ektFk | dashIfEmpty}} {{::buy.weight}} {{::buy.packageFk}} + {{::buy.packingOut}} diff --git a/modules/entry/front/latest-buys/index.js b/modules/entry/front/latest-buys/index.js index e81b916d1..2e69598be 100644 --- a/modules/entry/front/latest-buys/index.js +++ b/modules/entry/front/latest-buys/index.js @@ -16,20 +16,14 @@ export default class Controller extends Section { if (this._columns) return this._columns; this._columns = [ - {field: 'quantity', displayName: this.$t('Quantity')}, - {field: 'buyingValue', displayName: this.$t('Buying value')}, - {field: 'freightValue', displayName: this.$t('Freight value')}, {field: 'packing', displayName: this.$t('Packing')}, {field: 'grouping', displayName: this.$t('Grouping')}, - {field: 'comissionValue', displayName: this.$t('Commission value')}, {field: 'packageValue', displayName: this.$t('Package value')}, - {field: 'price2', displayName: this.$t('Grouping price')}, - {field: 'price3', displayName: this.$t('Packing price')}, {field: 'weight', displayName: this.$t('Weight')}, {field: 'description', displayName: this.$t('Description')}, - {field: 'minPrice', displayName: this.$t('Min price')}, {field: 'size', displayName: this.$t('Size')}, - {field: 'density', displayName: this.$t('Density')} + {field: 'density', displayName: this.$t('Density')}, + {field: 'packingOut', displayName: this.$t('PackingOut')} ]; return this._columns; diff --git a/modules/entry/front/latest-buys/locale/es.yml b/modules/entry/front/latest-buys/locale/es.yml index 16ed8acfa..cb45724f8 100644 --- a/modules/entry/front/latest-buys/locale/es.yml +++ b/modules/entry/front/latest-buys/locale/es.yml @@ -13,4 +13,5 @@ Minimun amount: Cantidad mínima de compra Field to edit: Campo a editar PackageName: Cubo Edit: Editar -buy(s): compra(s) \ No newline at end of file +buy(s): compra(s) +PackingOut: Packing envíos \ No newline at end of file diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json index 0091ac888..ee1f46e64 100644 --- a/modules/item/back/models/item.json +++ b/modules/item/back/models/item.json @@ -137,6 +137,9 @@ "minPrice": { "type": "number" }, + "packingOut": { + "type": "number" + }, "hasMinPrice": { "type": "boolean" }, From 2469409068b923be0218249b594930463f6c8c2e Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 15 Jun 2021 13:48:42 +0200 Subject: [PATCH 2/6] 2941 - Monitor changes --- front/core/components/contextmenu/index.js | 6 +- modules/client/front/web-payment/index.html | 2 +- .../monitor/front/index/clients/index.html | 13 ++- modules/monitor/front/index/clients/index.js | 5 +- modules/monitor/front/index/index.html | 14 +--- modules/monitor/front/index/index.js | 18 ++++- modules/monitor/front/index/locale/es.yml | 3 +- modules/monitor/front/index/orders/index.html | 68 +++++++++++----- modules/monitor/front/index/orders/index.js | 44 ++++++++++- modules/monitor/front/index/orders/style.scss | 3 +- .../front/index/search-panel/index.html | 41 +++------- modules/monitor/front/index/style.scss | 79 +++++++++++++------ .../monitor/front/index/tickets/index.html | 4 + 13 files changed, 200 insertions(+), 100 deletions(-) diff --git a/front/core/components/contextmenu/index.js b/front/core/components/contextmenu/index.js index aa2d1a16b..646df1a0a 100755 --- a/front/core/components/contextmenu/index.js +++ b/front/core/components/contextmenu/index.js @@ -43,14 +43,14 @@ export default class Contextmenu { get row() { if (!this.target) return null; - return this.target.closest('vn-tr, .vn-tr'); + return this.target.closest('[ng-repeat]'); } get rowIndex() { if (!this.row) return null; + const table = this.row.closest('vn-table, .vn-table'); - const tBody = table.querySelector('vn-tbody, .vn-tbody'); - const rows = tBody.querySelectorAll('vn-tr, .vn-tr'); + const rows = table.querySelectorAll('[ng-repeat]'); return Array.from(rows).findIndex( rowItem => rowItem == this.row diff --git a/modules/client/front/web-payment/index.html b/modules/client/front/web-payment/index.html index 7caa44881..5e0903622 100644 --- a/modules/client/front/web-payment/index.html +++ b/modules/client/front/web-payment/index.html @@ -25,7 +25,7 @@ diff --git a/modules/monitor/front/index/clients/index.html b/modules/monitor/front/index/clients/index.html index f0c1b8f93..9786404fd 100644 --- a/modules/monitor/front/index/clients/index.html +++ b/modules/monitor/front/index/clients/index.html @@ -10,6 +10,11 @@ Clients on website + + - + @@ -52,12 +57,6 @@ -
- No results -
- - - - - - - - - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/modules/monitor/front/index/index.js b/modules/monitor/front/index/index.js index 4807cf1c9..fabe1f82a 100644 --- a/modules/monitor/front/index/index.js +++ b/modules/monitor/front/index/index.js @@ -2,7 +2,23 @@ import ngModule from '../module'; import Section from 'salix/components/section'; import './style.scss'; +export default class Controller extends Section { + toggle() { + const monitor = this.element.querySelector('vn-horizontal'); + const isHidden = monitor.classList.contains('hidden'); + console.log(monitor); + + if (!isHidden) + monitor.classList.add('hidden'); + else + monitor.classList.remove('hidden'); + } +} + ngModule.vnComponent('vnMonitorIndex', { template: require('./index.html'), - controller: Section + controller: Controller, + require: { + main: '^vnMonitorIndex' + } }); diff --git a/modules/monitor/front/index/locale/es.yml b/modules/monitor/front/index/locale/es.yml index cb94d41a7..41d29064d 100644 --- a/modules/monitor/front/index/locale/es.yml +++ b/modules/monitor/front/index/locale/es.yml @@ -4,4 +4,5 @@ Recent order actions: Acciones recientes en pedidos Search tickets: Buscar tickets Delete selected elements: Eliminar los elementos seleccionados All the selected elements will be deleted. Are you sure you want to continue?: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar? -Component lack: Faltan componentes \ No newline at end of file +Component lack: Faltan componentes +Minimize/Maximize: Minimizar/Maximizar \ No newline at end of file diff --git a/modules/monitor/front/index/orders/index.html b/modules/monitor/front/index/orders/index.html index 3dd510dc8..6126e23ef 100644 --- a/modules/monitor/front/index/orders/index.html +++ b/modules/monitor/front/index/orders/index.html @@ -1,4 +1,4 @@ - + + - Date + Date Client - Import + SalesPerson
@@ -47,7 +52,7 @@ - + {{::order.date_send | date: 'dd/MM/yyyy'}} @@ -59,11 +64,18 @@ {{::order.clientName}} - {{::order.import | currency: 'EUR':2}} + + + {{::order.salesPerson | dashIfEmpty}} + + - + {{::order.date_make | date: 'dd/MM/yyyy HH:mm'}} @@ -74,22 +86,11 @@ - - {{::order.salesPerson | dashIfEmpty}} - + {{::order.import | currency: 'EUR':2}} -
- No results -
+ + + + Filter by selection + + + Exclude selection + + + Remove filter + + + Remove all filters + + + Copy value + + + this.$.model.refresh()); } + + chipColor(date) { + const today = new Date(); + today.setHours(0, 0, 0, 0); + + const orderLanded = new Date(date); + orderLanded.setHours(0, 0, 0, 0); + + const difference = today - orderLanded; + + if (difference == 0) + return 'warning'; + if (difference < 0) + return 'success'; + if (difference > 0) + return 'alert'; + } + + exprBuilder(param, value) { + switch (param) { + case 'date_send': + return {[`o.date_send`]: { + between: this.dateRange(value)} + }; + case 'clientFk': + return {[`c.id`]: value}; + case 'salesPersonFk': + return {[`c.${param}`]: value}; + } + } + + dateRange(value) { + const minHour = new Date(value); + minHour.setHours(0, 0, 0, 0); + const maxHour = new Date(value); + maxHour.setHours(23, 59, 59, 59); + + return [minHour, maxHour]; + } } ngModule.vnComponent('vnMonitorSalesOrders', { template: require('./index.html'), - controller: Controller + controller: Controller, + require: { + main: '^vnMonitorIndex' + } }); diff --git a/modules/monitor/front/index/orders/style.scss b/modules/monitor/front/index/orders/style.scss index 8a1c86032..102712eaf 100644 --- a/modules/monitor/front/index/orders/style.scss +++ b/modules/monitor/front/index/orders/style.scss @@ -2,7 +2,8 @@ vn-monitor-sales-orders { vn-table.scrollable { - max-height: 350px + max-height: 350px; + overflow-x: hidden } vn-table a.vn-tbody { diff --git a/modules/monitor/front/index/search-panel/index.html b/modules/monitor/front/index/search-panel/index.html index d0b77b9de..dc24c778b 100644 --- a/modules/monitor/front/index/search-panel/index.html +++ b/modules/monitor/front/index/search-panel/index.html @@ -21,36 +21,17 @@ ng-model="filter.orderFk"> -
- - - - - - Or - - - - - -
+ + + + vn-none > vn-icon { @extend %clickable-light; color: $color-button; font-size: 1.4rem; } - } - .empty-rows { - color: $color-font-secondary; - text-align: center; + + vn-none > .arrow { + transition: transform 200ms; + } } - vn-vertical { - position: fixed; - width: 400px + vn-monitor-sales-clients { + vn-card { + margin-right: 15px; + } + + .header { + padding-right: 15px; + + & > vn-none > .arrow { + display: none + } + } + } + + vn-table.scrollable { + height: 300px } vn-horizontal { flex-wrap: wrap } + + .hidden { + vn-card { + display: none + } + + .header > vn-none > .arrow { + transform: rotate(180deg); + } + } } -@media (max-width:1500px) { +@media (max-width:1150px) { vn-monitor-index { & > vn-horizontal { - flex-direction: column-reverse; + flex-direction: column; + + vn-monitor-sales-clients, + vn-monitor-sales-orders { + width: 100% + } + + vn-monitor-sales-clients { + margin-bottom: 15px + } } - & > vn-horizontal > vn-one { - flex: none; - width: 100%; + vn-monitor-sales-clients { + vn-card { + margin-right: 0 + } - & > vn-vertical { - position: initial; - flex-direction: row; - width: 100%; - - vn-monitor-sales-clients { - margin-right: 15px - } - - vn-table.scrollable { - height: 300px + .header { + padding-right: 0; + + & > vn-none > .arrow { + display: inline-block } } } - } + } } \ No newline at end of file diff --git a/modules/monitor/front/index/tickets/index.html b/modules/monitor/front/index/tickets/index.html index cb7b4f235..2d4add27a 100644 --- a/modules/monitor/front/index/tickets/index.html +++ b/modules/monitor/front/index/tickets/index.html @@ -42,6 +42,7 @@ Province State Zone + Debt Total @@ -134,6 +135,9 @@ {{::ticket.zoneName | dashIfEmpty}} + + {{::ticket.debt | currency: 'EUR': 2}} + {{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}} From 8aa3d269eabf67212469f5d895c7edf98b338876 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Tue, 15 Jun 2021 16:41:01 +0200 Subject: [PATCH 3/6] Travel descriptor now shows delete option if there are no entries --- modules/travel/front/descriptor-menu/index.html | 15 +++++++++++++++ modules/travel/front/descriptor-menu/index.js | 11 ++++++++++- .../travel/front/descriptor-menu/index.spec.js | 15 +++++++++++++++ .../travel/front/descriptor-menu/locale/es.yml | 3 +++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/modules/travel/front/descriptor-menu/index.html b/modules/travel/front/descriptor-menu/index.html index c7edcd59e..9b408994f 100644 --- a/modules/travel/front/descriptor-menu/index.html +++ b/modules/travel/front/descriptor-menu/index.html @@ -18,6 +18,13 @@ translate> Clone travel and his entries + + Delete travel +
+ + + + this.travel = res.data); + + this.$http.get(`Travels/${this.travelId}/getEntries`) + .then(res => this.entries = res.data); } get isBuyer() { return this.aclService.hasAny(['buyer']); } + onDeleteAccept() { + this.$http.delete(`Travels/${this.travelId}`) + .then(() => this.$state.go('travel.index')) + .then(() => this.vnApp.showSuccess(this.$t('Travel deleted'))); + } + onCloneAccept() { const params = JSON.stringify({ ref: this.travel.ref, diff --git a/modules/travel/front/descriptor-menu/index.spec.js b/modules/travel/front/descriptor-menu/index.spec.js index 3d94a0963..4ca93a6d6 100644 --- a/modules/travel/front/descriptor-menu/index.spec.js +++ b/modules/travel/front/descriptor-menu/index.spec.js @@ -40,6 +40,21 @@ describe('Travel Component vnTravelDescriptorMenu', () => { }); }); + describe('onDeleteAccept()', () => { + it('should perform a delete query', () => { + jest.spyOn(controller.$state, 'go').mockReturnValue('ok'); + controller.travelId = 1; + + $httpBackend.when('GET', `Travels/${controller.travelId}`).respond(200); + $httpBackend.when('GET', `Travels/${controller.travelId}/getEntries`).respond(200); + $httpBackend.expect('DELETE', `Travels/${controller.travelId}`).respond(200); + controller.onDeleteAccept(); + $httpBackend.flush(); + + expect(controller.$state.go).toHaveBeenCalledWith('travel.index'); + }); + }); + describe('onCloneWithEntriesAccept()', () => { it('should make an HTTP query and then call to the $state.go method with the returned id', () => { jest.spyOn(controller.$state, 'go').mockReturnValue('ok'); diff --git a/modules/travel/front/descriptor-menu/locale/es.yml b/modules/travel/front/descriptor-menu/locale/es.yml index b764ba0cd..1ab68cca5 100644 --- a/modules/travel/front/descriptor-menu/locale/es.yml +++ b/modules/travel/front/descriptor-menu/locale/es.yml @@ -2,3 +2,6 @@ Clone travel: Clonar envío Add entry: Añadir entrada Clone travel and his entries: Clonar travel y sus entradas Do you want to clone this travel and all containing entries?: ¿Quieres clonar este travel y todas las entradas que contiene? +Delete travel: Borrar envío +The travel will be deleted: El envío será borrado +Do you want to delete this travel?: ¿Quieres borrar este envío? \ No newline at end of file From 34e0d0b7cf0414cae473fe61a8a89e28d09cb6a1 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Wed, 16 Jun 2021 09:50:32 +0200 Subject: [PATCH 4/6] translations update --- modules/travel/front/descriptor-menu/locale/es.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/travel/front/descriptor-menu/locale/es.yml b/modules/travel/front/descriptor-menu/locale/es.yml index 1ab68cca5..e019d1769 100644 --- a/modules/travel/front/descriptor-menu/locale/es.yml +++ b/modules/travel/front/descriptor-menu/locale/es.yml @@ -2,6 +2,7 @@ Clone travel: Clonar envío Add entry: Añadir entrada Clone travel and his entries: Clonar travel y sus entradas Do you want to clone this travel and all containing entries?: ¿Quieres clonar este travel y todas las entradas que contiene? -Delete travel: Borrar envío -The travel will be deleted: El envío será borrado -Do you want to delete this travel?: ¿Quieres borrar este envío? \ No newline at end of file +Delete travel: Eliminar envío +The travel will be deleted: El envío será eliminado +Do you want to delete this travel?: ¿Quieres eliminar este envío? +Travel deleted: Envío eliminado \ No newline at end of file From efc9edb3848d4b33d223260d4296b9025a4362ae Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 16 Jun 2021 10:13:06 +0200 Subject: [PATCH 5/6] Fixes --- modules/monitor/front/index/index.js | 1 - modules/monitor/front/index/tickets/index.html | 4 ---- 2 files changed, 5 deletions(-) diff --git a/modules/monitor/front/index/index.js b/modules/monitor/front/index/index.js index fabe1f82a..2e1b3b1a1 100644 --- a/modules/monitor/front/index/index.js +++ b/modules/monitor/front/index/index.js @@ -6,7 +6,6 @@ export default class Controller extends Section { toggle() { const monitor = this.element.querySelector('vn-horizontal'); const isHidden = monitor.classList.contains('hidden'); - console.log(monitor); if (!isHidden) monitor.classList.add('hidden'); diff --git a/modules/monitor/front/index/tickets/index.html b/modules/monitor/front/index/tickets/index.html index 2d4add27a..cb7b4f235 100644 --- a/modules/monitor/front/index/tickets/index.html +++ b/modules/monitor/front/index/tickets/index.html @@ -42,7 +42,6 @@ Province State Zone - Debt Total @@ -135,9 +134,6 @@ {{::ticket.zoneName | dashIfEmpty}} - - {{::ticket.debt | currency: 'EUR': 2}} - {{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}} From 3e938fa9fb348c242102559f217e53102e875a85 Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 16 Jun 2021 11:15:17 +0200 Subject: [PATCH 6/6] Updated unit tests --- modules/monitor/front/index/tickets/index.spec.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/monitor/front/index/tickets/index.spec.js b/modules/monitor/front/index/tickets/index.spec.js index fc689140a..8d06b8d7d 100644 --- a/modules/monitor/front/index/tickets/index.spec.js +++ b/modules/monitor/front/index/tickets/index.spec.js @@ -115,6 +115,14 @@ describe('Component vnMonitorSalesTickets', () => { }); }); + describe('totalPriceColor()', () => { + it('should return "warning" when the ticket amount is less than 50€', () => { + const result = controller.totalPriceColor({totalWithVat: '8.50'}); + + expect(result).toEqual('warning'); + }); + }); + describe('preview()', () => { it('should show the dialog summary', () => { controller.$.summary = {show: () => {}};