Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 4849-supplier-isVies

This commit is contained in:
Vicent Llopis 2023-02-17 10:42:50 +01:00
commit 373be40986
28 changed files with 178 additions and 70 deletions

View File

@ -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

View File

@ -20,7 +20,6 @@
"type": "date"
}
},
"scope": {
"where" :{
"expired": null

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

View File

@ -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

View File

@ -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;
};
};

View File

@ -1,4 +1,5 @@
module.exports = function(Self) {
require('../methods/application/status')(Self);
require('../methods/application/post')(Self);
};

View File

@ -7,6 +7,12 @@
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
},
{
"property": "post",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -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;

View File

@ -25,6 +25,9 @@
},
"defaultTag": {
"type": "int"
},
"warehouseFk": {
"type": "int"
}
},
"relations": {

View File

@ -1,6 +1,6 @@
<vn-portal slot="menu">
<vn-item-descriptor
warehouse-fk="$ctrl.vnConfig.warehouseFk"
warehouse-fk="$ctrl.warehouseFk"
item="$ctrl.item"
card-reload="$ctrl.reload()"></vn-item-descriptor>
<vn-left-menu source="card"></vn-left-menu>

View File

@ -36,6 +36,16 @@
<p translate>Available</p>
<p>{{$ctrl.available | dashIfEmpty}}</p>
</vn-one>
<vn-one>
<p>
<vn-icon
ng-if="$ctrl.showIcon"
icon="info_outline"
vn-tooltip="{{$ctrl.warehouseText}}"
pointer>
</vn-icon>
</p>
</vn-one>
</vn-horizontal>
</slot-before>
<slot-body>

View File

@ -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: '<?'
warehouseFk: '<'
}
});

View File

@ -37,6 +37,7 @@ class Controller extends Section {
set warehouseFk(value) {
if (value && value != this._warehouseFk) {
this._warehouseFk = value;
this.card.warehouseFk = value;
this.$state.go(this.$state.current.name, {
warehouseFk: value
@ -76,5 +77,8 @@ ngModule.vnComponent('vnItemDiary', {
controller: Controller,
bindings: {
item: '<'
},
require: {
card: '?^vnItemCard'
}
});

View File

@ -14,6 +14,7 @@ describe('Item', () => {
controller = $componentController('vnItemDiary', {$element, $scope});
controller.$.model = crudModel;
controller.$params = {id: 1};
controller.card = {};
}));
describe('set item()', () => {

View File

@ -22,6 +22,16 @@
<p translate>Available</p>
<p>{{$ctrl.summary.available}}</p>
</vn-one>
<vn-one>
<p>
<vn-icon
ng-if="$ctrl.warehouseText != null"
icon="info_outline"
vn-tooltip="{{$ctrl.warehouseText}}"
pointer>
</vn-icon>
</p>
</vn-one>
</vn-horizontal>
</vn-one>
<vn-one name="basicData">

View File

@ -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'
}
});

View File

@ -14,12 +14,15 @@ describe('Item', () => {
const $element = angular.element('<vn-item-summary></vn-item-summary>');
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();

View File

@ -0,0 +1 @@
WarehouseFk: Calculated on the warehouse of {{ warehouseName }}

View File

@ -1,3 +1,4 @@
Barcode: Códigos de barras
Other data: Otros datos
Go to the item: Ir al artículo
WarehouseFk: Calculado sobre el almacén de {{ warehouseName }}

View File

@ -31,5 +31,9 @@ vn-item-summary {
&:nth-child(1) {
border-right: 1px solid white;
}
&:nth-child(2) {
border-right: 1px solid white;
}
}
}

View File

@ -131,7 +131,7 @@
</vn-td>
<vn-td>
<span class="link" ng-if="sale.id"
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id)">
ng-click="itemDescriptor.show($event, sale.itemFk, sale.id, $ctrl.ticket.shipped)">
{{sale.itemFk}}
</span>
<vn-autocomplete ng-if="!sale.id" class="dense"

View File

@ -1,6 +1,6 @@
{
"name": "salix-back",
"version": "23.06.01",
"version": "23.08.01",
"author": "Verdnatura Levante SL",
"description": "Salix backend",
"license": "GPL-3.0",