diff --git a/CHANGELOG.md b/CHANGELOG.md index ea4725448..80fa1fb95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2308.01] - 2023-03-09 + +### Added +- + +### Changed +- + +### Fixed +- + ## [2306.01] - 2023-02-23 ### Added diff --git a/back/models/company.json b/back/models/company.json index a36b43b69..f16c5762f 100644 --- a/back/models/company.json +++ b/back/models/company.json @@ -20,10 +20,9 @@ "type": "date" } }, - "scope": { "where" :{ "expired": null } } -} \ No newline at end of file +} diff --git a/db/changes/230201/00-validPriorities_ItemConfig.sql b/db/changes/230201/00-validPriorities_ItemConfig.sql index a793997d0..0b32d5de8 100644 --- a/db/changes/230201/00-validPriorities_ItemConfig.sql +++ b/db/changes/230201/00-validPriorities_ItemConfig.sql @@ -3,7 +3,3 @@ ALTER TABLE `vn`.`itemConfig` ADD CONSTRAINT itemConfig_FK FOREIGN KEY (defaultT ALTER TABLE `vn`.`itemConfig` ADD validPriorities varchar(50) DEFAULT '[1,2,3]' NOT NULL; ALTER TABLE `vn`.`itemConfig` ADD defaultPriority INT DEFAULT 2 NOT NULL; ALTER TABLE `vn`.`item` MODIFY COLUMN relevancy tinyint(1) DEFAULT 0 NOT NULL COMMENT 'La web ordena de forma descendiente por este campo para mostrar los artículos'; - -INSERT INTO `salix`.`ACL` -(model, property, accessType, permission, principalType, principalId) -VALUES('ItemConfig', '*', 'READ', 'ALLOW', 'ROLE', 'buyer'); diff --git a/db/changes/230202/00-itemConfig.sql b/db/changes/230202/00-itemConfig.sql index a793997d0..0b32d5de8 100644 --- a/db/changes/230202/00-itemConfig.sql +++ b/db/changes/230202/00-itemConfig.sql @@ -3,7 +3,3 @@ ALTER TABLE `vn`.`itemConfig` ADD CONSTRAINT itemConfig_FK FOREIGN KEY (defaultT ALTER TABLE `vn`.`itemConfig` ADD validPriorities varchar(50) DEFAULT '[1,2,3]' NOT NULL; ALTER TABLE `vn`.`itemConfig` ADD defaultPriority INT DEFAULT 2 NOT NULL; ALTER TABLE `vn`.`item` MODIFY COLUMN relevancy tinyint(1) DEFAULT 0 NOT NULL COMMENT 'La web ordena de forma descendiente por este campo para mostrar los artículos'; - -INSERT INTO `salix`.`ACL` -(model, property, accessType, permission, principalType, principalId) -VALUES('ItemConfig', '*', 'READ', 'ALLOW', 'ROLE', 'buyer'); diff --git a/db/changes/230401/00-acl_notifications.sql b/db/changes/230601/00-acl_notifications.sql similarity index 100% rename from db/changes/230401/00-acl_notifications.sql rename to db/changes/230601/00-acl_notifications.sql diff --git a/db/changes/230601/00-itemConfig_warehouseFk.sql b/db/changes/230601/00-itemConfig_warehouseFk.sql new file mode 100644 index 000000000..84987d512 --- /dev/null +++ b/db/changes/230601/00-itemConfig_warehouseFk.sql @@ -0,0 +1,6 @@ +ALTER TABLE `vn`.`itemConfig` ADD warehouseFk smallint(6) unsigned NULL; +UPDATE `vn`.`itemConfig` + SET warehouseFk=60 +WHERE id=0; +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES('ItemConfig', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/changes/230401/00-uniqueKeyNotificationSubscription.sql b/db/changes/230601/00-uniqueKeyNotificationSubscription.sql similarity index 100% rename from db/changes/230401/00-uniqueKeyNotificationSubscription.sql rename to db/changes/230601/00-uniqueKeyNotificationSubscription.sql diff --git a/db/changes/230401/01-alter_notSubs.sql b/db/changes/230601/01-alter_notSubs.sql similarity index 100% rename from db/changes/230401/01-alter_notSubs.sql rename to db/changes/230601/01-alter_notSubs.sql diff --git a/db/changes/230801/.gitkeep b/db/changes/230801/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 5c7bbf192..e8cd5c1b8 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2744,9 +2744,9 @@ INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPack VALUES (3, util.VN_NOW(), 1107, 5, NULL, 0, 0, 1, NULL, NULL); -INSERT INTO `vn`.`itemConfig` (`id`, `isItemTagTriggerDisabled`, `monthToDeactivate`, `wasteRecipients`, `validPriorities`, `defaultPriority`, `defaultTag`) +INSERT INTO `vn`.`itemConfig` (`id`, `isItemTagTriggerDisabled`, `monthToDeactivate`, `wasteRecipients`, `validPriorities`, `defaultPriority`, `defaultTag`, `warehouseFk`) VALUES - (0, 0, 24, '', '[1,2,3]', 2, 56); + (0, 0, 24, '', '[1,2,3]', 2, 56, 60); INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `level`, `wagon`, `smartTagFk`, `usedShelves`, `itemCount`, `liters`) VALUES diff --git a/loopback/common/methods/application/post.js b/loopback/common/methods/application/post.js new file mode 100644 index 000000000..9ea9a7f71 --- /dev/null +++ b/loopback/common/methods/application/post.js @@ -0,0 +1,17 @@ +module.exports = Self => { + Self.remoteMethodCtx('post', { + description: 'Returns the sent parameters', + returns: { + type: 'object', + root: true + }, + http: { + path: `/post`, + verb: 'POST' + } + }); + + Self.post = async ctx => { + return ctx.req.body; + }; +}; diff --git a/loopback/common/models/application.js b/loopback/common/models/application.js index ff7599fac..5e767fdc1 100644 --- a/loopback/common/models/application.js +++ b/loopback/common/models/application.js @@ -1,4 +1,5 @@ module.exports = function(Self) { require('../methods/application/status')(Self); + require('../methods/application/post')(Self); }; diff --git a/loopback/common/models/application.json b/loopback/common/models/application.json index 0bb489720..bc72df315 100644 --- a/loopback/common/models/application.json +++ b/loopback/common/models/application.json @@ -7,6 +7,12 @@ "principalType": "ROLE", "principalId": "$everyone", "permission": "ALLOW" - } + }, + { + "property": "post", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } ] } diff --git a/modules/item/back/methods/item/getSummary.js b/modules/item/back/methods/item/getSummary.js index 738976e60..6cd9d9511 100644 --- a/modules/item/back/methods/item/getSummary.js +++ b/modules/item/back/methods/item/getSummary.js @@ -98,9 +98,8 @@ module.exports = Self => { summary.tags = res[1]; [summary.botanical] = res[2]; - const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions); - - res = await models.Item.getVisibleAvailable(summary.item.id, userConfig.warehouseFk, null, myOptions); + const itemConfig = await models.ItemConfig.findOne(null, myOptions); + res = await models.Item.getVisibleAvailable(summary.item.id, itemConfig.warehouseFk, undefined, myOptions); summary.available = res.available; summary.visible = res.visible; diff --git a/modules/item/back/models/item-config.json b/modules/item/back/models/item-config.json index 36d25e0bb..c7a0b2644 100644 --- a/modules/item/back/models/item-config.json +++ b/modules/item/back/models/item-config.json @@ -25,6 +25,9 @@ }, "defaultTag": { "type": "int" + }, + "warehouseFk": { + "type": "int" } }, "relations": { diff --git a/modules/item/front/card/index.html b/modules/item/front/card/index.html index e92e1696d..330d274c0 100644 --- a/modules/item/front/card/index.html +++ b/modules/item/front/card/index.html @@ -1,6 +1,6 @@ - diff --git a/modules/item/front/descriptor/index.html b/modules/item/front/descriptor/index.html index 321545b38..8e85e043f 100644 --- a/modules/item/front/descriptor/index.html +++ b/modules/item/front/descriptor/index.html @@ -19,7 +19,7 @@
Available

{{$ctrl.available | dashIfEmpty}}

+ +

+ + +

+
- {{$ctrl.item.itemType.worker.user.name}} @@ -50,22 +60,22 @@
@@ -112,7 +122,7 @@ question="Do you want to clone this item?" message="All it's properties will be copied"> - @@ -120,7 +130,7 @@ - - \ No newline at end of file + diff --git a/modules/item/front/descriptor/index.js b/modules/item/front/descriptor/index.js index b88f24456..972c89ae0 100644 --- a/modules/item/front/descriptor/index.js +++ b/modules/item/front/descriptor/index.js @@ -30,7 +30,10 @@ class Controller extends Descriptor { set warehouseFk(value) { this._warehouseFk = value; - if (value) this.updateStock(); + if (value) { + this.updateStock(); + this.getWarehouseName(value); + } } loadData() { @@ -89,6 +92,22 @@ class Controller extends Descriptor { this.$.photo.setAttribute('src', newSrc); this.$.photo.setAttribute('zoom-image', newZoomSrc); } + + getWarehouseName(warehouseFk) { + this.showIcon = false; + + const filter = { + where: {id: warehouseFk} + }; + this.$http.get('Warehouses/findOne', {filter}) + .then(res => { + this.warehouseText = this.$t('WarehouseFk', { + warehouseName: res.data.name + }); + + this.showIcon = true; + }); + } } Controller.$inject = ['$element', '$scope', '$rootScope']; @@ -100,6 +119,6 @@ ngModule.vnComponent('vnItemDescriptor', { item: '<', dated: '<', cardReload: '&', - warehouseFk: ' { controller = $componentController('vnItemDiary', {$element, $scope}); controller.$.model = crudModel; controller.$params = {id: 1}; + controller.card = {}; })); describe('set item()', () => { diff --git a/modules/item/front/summary/index.html b/modules/item/front/summary/index.html index a4d40c829..40e9c5aa7 100644 --- a/modules/item/front/summary/index.html +++ b/modules/item/front/summary/index.html @@ -11,7 +11,7 @@ @@ -22,44 +22,54 @@

Available

{{$ctrl.summary.available}}

+ +

+ + +

+

- Basic data

Basic data

- - - - - - - {{$ctrl.summary.item.itemType.worker.user.name}} @@ -68,45 +78,45 @@

- Other data

Other data

- - - - - -

- Tags

-

Tags @@ -119,14 +129,14 @@

- Description

Description

@@ -136,13 +146,13 @@

- Tax

-

Tax @@ -154,33 +164,33 @@

- Botanical

-

Botanical

- -

- Barcode

-

Barcode @@ -191,6 +201,6 @@ - - \ No newline at end of file + diff --git a/modules/item/front/summary/index.js b/modules/item/front/summary/index.js index 52753ff65..e17a6a8c4 100644 --- a/modules/item/front/summary/index.js +++ b/modules/item/front/summary/index.js @@ -7,6 +7,24 @@ class Controller extends Summary { this.$http.get(`Items/${this.item.id}/getSummary`).then(response => { this.summary = response.data; }); + + this.$http.get('ItemConfigs/findOne') + .then(res => { + if (this.card) this.card.warehouseFk = res.data.warehouseFk; + this.getWarehouseName(res.data.warehouseFk); + }); + } + + getWarehouseName(warehouseFk) { + const filter = { + where: {id: warehouseFk} + }; + this.$http.get('Warehouses/findOne', {filter}) + .then(res => { + this.warehouseText = this.$t('WarehouseFk', { + warehouseName: res.data.name + }); + }); } $onChanges() { @@ -37,4 +55,7 @@ ngModule.vnComponent('vnItemSummary', { bindings: { item: '<', }, + require: { + card: '?^vnItemCard' + } }); diff --git a/modules/item/front/summary/index.spec.js b/modules/item/front/summary/index.spec.js index 0b349194c..d7821bea0 100644 --- a/modules/item/front/summary/index.spec.js +++ b/modules/item/front/summary/index.spec.js @@ -14,12 +14,15 @@ describe('Item', () => { const $element = angular.element(''); controller = $componentController('vnItemSummary', {$element, $scope}); controller.item = {id: 1}; + controller.card = {}; })); describe('getSummary()', () => { it('should perform a query to set summary', () => { let data = {id: 1, name: 'Gem of mind'}; $httpBackend.expect('GET', `Items/1/getSummary`).respond(200, data); + $httpBackend.expect('GET', `ItemConfigs/findOne`).respond({}); + $httpBackend.expect('GET', `Warehouses/findOne`).respond({}); controller.getSummary(); $httpBackend.flush(); diff --git a/modules/item/front/summary/locale/en.yml b/modules/item/front/summary/locale/en.yml new file mode 100644 index 000000000..0ec208720 --- /dev/null +++ b/modules/item/front/summary/locale/en.yml @@ -0,0 +1 @@ +WarehouseFk: Calculated on the warehouse of {{ warehouseName }} diff --git a/modules/item/front/summary/locale/es.yml b/modules/item/front/summary/locale/es.yml index a87a04857..2e78841ae 100644 --- a/modules/item/front/summary/locale/es.yml +++ b/modules/item/front/summary/locale/es.yml @@ -1,3 +1,4 @@ Barcode: Códigos de barras Other data: Otros datos -Go to the item: Ir al artículo \ No newline at end of file +Go to the item: Ir al artículo +WarehouseFk: Calculado sobre el almacén de {{ warehouseName }} diff --git a/modules/item/front/summary/style.scss b/modules/item/front/summary/style.scss index 7d5e3b609..d047f3e36 100644 --- a/modules/item/front/summary/style.scss +++ b/modules/item/front/summary/style.scss @@ -29,7 +29,11 @@ vn-item-summary { padding: 0; &:nth-child(1) { - border-right: 1px solid white; + border-right: 1px solid white; + } + + &:nth-child(2) { + border-right: 1px solid white; } } -} \ No newline at end of file +} diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index fe259cf87..1b05529ad 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -131,7 +131,7 @@ + ng-click="itemDescriptor.show($event, sale.itemFk, sale.id, $ctrl.ticket.shipped)"> {{sale.itemFk}}