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/), 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). 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 ## [2306.01] - 2023-02-23
### Added ### Added

View File

@ -20,10 +20,9 @@
"type": "date" "type": "date"
} }
}, },
"scope": { "scope": {
"where" :{ "where" :{
"expired": null "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 validPriorities varchar(50) DEFAULT '[1,2,3]' NOT NULL;
ALTER TABLE `vn`.`itemConfig` ADD defaultPriority INT DEFAULT 2 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'; 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 validPriorities varchar(50) DEFAULT '[1,2,3]' NOT NULL;
ALTER TABLE `vn`.`itemConfig` ADD defaultPriority INT DEFAULT 2 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'; 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 VALUES
(3, util.VN_NOW(), 1107, 5, NULL, 0, 0, 1, NULL, NULL); (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 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`) INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `level`, `wagon`, `smartTagFk`, `usedShelves`, `itemCount`, `liters`)
VALUES 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) { module.exports = function(Self) {
require('../methods/application/status')(Self); require('../methods/application/status')(Self);
require('../methods/application/post')(Self);
}; };

View File

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

View File

@ -98,9 +98,8 @@ module.exports = Self => {
summary.tags = res[1]; summary.tags = res[1];
[summary.botanical] = res[2]; [summary.botanical] = res[2];
const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions); const itemConfig = await models.ItemConfig.findOne(null, myOptions);
res = await models.Item.getVisibleAvailable(summary.item.id, itemConfig.warehouseFk, undefined, myOptions);
res = await models.Item.getVisibleAvailable(summary.item.id, userConfig.warehouseFk, null, myOptions);
summary.available = res.available; summary.available = res.available;
summary.visible = res.visible; summary.visible = res.visible;

View File

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

View File

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

View File

@ -19,7 +19,7 @@
<slot-before> <slot-before>
<div class="photo" text-center> <div class="photo" text-center>
<img vn-id="photo" <img vn-id="photo"
ng-src="{{$root.imagePath('catalog', '200x200', $ctrl.item.id)}}" ng-src="{{$root.imagePath('catalog', '200x200', $ctrl.item.id)}}"
zoom-image="{{$root.imagePath('catalog', '1600x900', $ctrl.item.id)}}" zoom-image="{{$root.imagePath('catalog', '1600x900', $ctrl.item.id)}}"
on-error-src/> on-error-src/>
<vn-float-button ng-click="uploadPhoto.show('catalog', $ctrl.item.id)" <vn-float-button ng-click="uploadPhoto.show('catalog', $ctrl.item.id)"
@ -36,13 +36,23 @@
<p translate>Available</p> <p translate>Available</p>
<p>{{$ctrl.available | dashIfEmpty}}</p> <p>{{$ctrl.available | dashIfEmpty}}</p>
</vn-one> </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> </vn-horizontal>
</slot-before> </slot-before>
<slot-body> <slot-body>
<div class="attributes"> <div class="attributes">
<vn-label-value <vn-label-value
label="Buyer"> label="Buyer">
<span <span
ng-click="workerDescriptor.show($event, $ctrl.item.itemType.worker.userFk)" ng-click="workerDescriptor.show($event, $ctrl.item.itemType.worker.userFk)"
class="link"> class="link">
{{$ctrl.item.itemType.worker.user.name}} {{$ctrl.item.itemType.worker.user.name}}
@ -50,22 +60,22 @@
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="{{$ctrl.item.tag5}}" label="{{$ctrl.item.tag5}}"
ng-if="$ctrl.item.value5" ng-if="$ctrl.item.value5"
value="{{$ctrl.item.value5}}"> value="{{$ctrl.item.value5}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="{{$ctrl.item.tag6}}" label="{{$ctrl.item.tag6}}"
ng-if="$ctrl.item.value6" ng-if="$ctrl.item.value6"
value="{{$ctrl.item.value6}}"> value="{{$ctrl.item.value6}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="{{$ctrl.item.tag7}}" label="{{$ctrl.item.tag7}}"
ng-if="$ctrl.item.value7" ng-if="$ctrl.item.value7"
value="{{$ctrl.item.value7}}"> value="{{$ctrl.item.value7}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="{{$ctrl.item.tag8}}" label="{{$ctrl.item.tag8}}"
ng-if="$ctrl.item.value8" ng-if="$ctrl.item.value8"
value="{{$ctrl.item.value8}}"> value="{{$ctrl.item.value8}}">
</vn-label-value> </vn-label-value>
</div> </div>
@ -112,7 +122,7 @@
question="Do you want to clone this item?" question="Do you want to clone this item?"
message="All it's properties will be copied"> message="All it's properties will be copied">
</vn-confirm> </vn-confirm>
<vn-worker-descriptor-popover <vn-worker-descriptor-popover
vn-id="workerDescriptor"> vn-id="workerDescriptor">
</vn-worker-descriptor-popover> </vn-worker-descriptor-popover>
<vn-popup vn-id="summary"> <vn-popup vn-id="summary">
@ -120,7 +130,7 @@
</vn-popup> </vn-popup>
<!-- Upload photo dialog --> <!-- Upload photo dialog -->
<vn-upload-photo <vn-upload-photo
vn-id="uploadPhoto" vn-id="uploadPhoto"
on-response="$ctrl.onUploadResponse()"> on-response="$ctrl.onUploadResponse()">
</vn-upload-photo> </vn-upload-photo>

View File

@ -30,7 +30,10 @@ class Controller extends Descriptor {
set warehouseFk(value) { set warehouseFk(value) {
this._warehouseFk = value; this._warehouseFk = value;
if (value) this.updateStock(); if (value) {
this.updateStock();
this.getWarehouseName(value);
}
} }
loadData() { loadData() {
@ -89,6 +92,22 @@ class Controller extends Descriptor {
this.$.photo.setAttribute('src', newSrc); this.$.photo.setAttribute('src', newSrc);
this.$.photo.setAttribute('zoom-image', newZoomSrc); 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']; Controller.$inject = ['$element', '$scope', '$rootScope'];
@ -100,6 +119,6 @@ ngModule.vnComponent('vnItemDescriptor', {
item: '<', item: '<',
dated: '<', dated: '<',
cardReload: '&', cardReload: '&',
warehouseFk: '<?' warehouseFk: '<'
} }
}); });

View File

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

View File

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

View File

@ -11,7 +11,7 @@
<vn-horizontal> <vn-horizontal>
<vn-one> <vn-one>
<img style="width: 100%; display: block;" <img style="width: 100%; display: block;"
ng-src="{{$root.imagePath('catalog', '200x200', $ctrl.item.id)}}" ng-src="{{$root.imagePath('catalog', '200x200', $ctrl.item.id)}}"
zoom-image="{{$root.imagePath('catalog', '1600x900', $ctrl.item.id)}}" on-error-src/> zoom-image="{{$root.imagePath('catalog', '1600x900', $ctrl.item.id)}}" on-error-src/>
<vn-horizontal class="item-state"> <vn-horizontal class="item-state">
<vn-one> <vn-one>
@ -22,44 +22,54 @@
<p translate>Available</p> <p translate>Available</p>
<p>{{$ctrl.summary.available}}</p> <p>{{$ctrl.summary.available}}</p>
</vn-one> </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-horizontal>
</vn-one> </vn-one>
<vn-one name="basicData"> <vn-one name="basicData">
<h4 ng-show="$ctrl.isBuyer"> <h4 ng-show="$ctrl.isBuyer">
<a <a
ui-sref="item.card.basicData({id:$ctrl.item.id})" ui-sref="item.card.basicData({id:$ctrl.item.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Basic data</span> <span translate vn-tooltip="Go to">Basic data</span>
</a> </a>
</h4> </h4>
<h4 <h4
translate translate
ng-show="!$ctrl.isBuyer"> ng-show="!$ctrl.isBuyer">
Basic data Basic data
</h4> </h4>
<vn-label-value label="Name" <vn-label-value label="Name"
value="{{$ctrl.summary.item.name}}"> value="{{$ctrl.summary.item.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Full name" <vn-label-value label="Full name"
value="{{$ctrl.summary.item.longName}}"> value="{{$ctrl.summary.item.longName}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Item family" <vn-label-value label="Item family"
value="{{$ctrl.summary.item.itemType.name}}"> value="{{$ctrl.summary.item.itemType.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Size" <vn-label-value label="Size"
value="{{$ctrl.summary.item.size}}"> value="{{$ctrl.summary.item.size}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Origin" <vn-label-value label="Origin"
value="{{$ctrl.summary.item.origin.name}}"> value="{{$ctrl.summary.item.origin.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="stems" <vn-label-value label="stems"
value="{{$ctrl.summary.item.stems}}"> value="{{$ctrl.summary.item.stems}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Multiplier" <vn-label-value label="Multiplier"
value="{{$ctrl.summary.item.stemMultiplier}}"> value="{{$ctrl.summary.item.stemMultiplier}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Buyer"> <vn-label-value label="Buyer">
<span <span
ng-click="workerDescriptor.show($event, $ctrl.summary.item.itemType.worker.userFk)" ng-click="workerDescriptor.show($event, $ctrl.summary.item.itemType.worker.userFk)"
class="link"> class="link">
{{$ctrl.summary.item.itemType.worker.user.name}} {{$ctrl.summary.item.itemType.worker.user.name}}
@ -68,45 +78,45 @@
</vn-one> </vn-one>
<vn-one name="otherData"> <vn-one name="otherData">
<h4 ng-show="$ctrl.isBuyer"> <h4 ng-show="$ctrl.isBuyer">
<a <a
ui-sref="item.card.basicData({id:$ctrl.item.id})" ui-sref="item.card.basicData({id:$ctrl.item.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Other data</span> <span translate vn-tooltip="Go to">Other data</span>
</a> </a>
</h4> </h4>
<h4 <h4
translate translate
ng-show="!$ctrl.isBuyer"> ng-show="!$ctrl.isBuyer">
Other data Other data
</h4> </h4>
<vn-label-value label="Intrastat code" <vn-label-value label="Intrastat code"
value="{{$ctrl.summary.item.intrastat.id}}"> value="{{$ctrl.summary.item.intrastat.id}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Intrastat" <vn-label-value label="Intrastat"
value="{{$ctrl.summary.item.intrastat.description}}"> value="{{$ctrl.summary.item.intrastat.description}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Reference" <vn-label-value label="Reference"
value="{{$ctrl.summary.item.comment}}"> value="{{$ctrl.summary.item.comment}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Relevancy" <vn-label-value label="Relevancy"
value="{{$ctrl.summary.item.relevancy}}"> value="{{$ctrl.summary.item.relevancy}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Weight/Piece" <vn-label-value label="Weight/Piece"
value="{{$ctrl.summary.item.weightByPiece}}"> value="{{$ctrl.summary.item.weightByPiece}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Expense" <vn-label-value label="Expense"
value="{{$ctrl.summary.item.expense.name}}"> value="{{$ctrl.summary.item.expense.name}}">
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
<vn-one name="tags"> <vn-one name="tags">
<h4 ng-show="$ctrl.isBuyer || $ctrl.isReplenisher"> <h4 ng-show="$ctrl.isBuyer || $ctrl.isReplenisher">
<a <a
ui-sref="item.card.tags({id:$ctrl.item.id})" ui-sref="item.card.tags({id:$ctrl.item.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Tags</span> <span translate vn-tooltip="Go to">Tags</span>
</a> </a>
</h4> </h4>
<h4 <h4
translate translate
ng-show="!$ctrl.isBuyer && !$ctrl.isReplenisher"> ng-show="!$ctrl.isBuyer && !$ctrl.isReplenisher">
Tags Tags
@ -119,14 +129,14 @@
</vn-one> </vn-one>
<vn-one name="description" ng-if="$ctrl.summary.item.description"> <vn-one name="description" ng-if="$ctrl.summary.item.description">
<h4 ng-show="$ctrl.isBuyer"> <h4 ng-show="$ctrl.isBuyer">
<a <a
ui-sref="item.card.basicData({id:$ctrl.item.id})" ui-sref="item.card.basicData({id:$ctrl.item.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Description</span> <span translate vn-tooltip="Go to">Description</span>
</a> </a>
</h4> </h4>
<h4 <h4
translate translate
ng-show="!$ctrl.isBuyer"> ng-show="!$ctrl.isBuyer">
Description Description
</h4> </h4>
@ -136,13 +146,13 @@
</vn-one> </vn-one>
<vn-one name="tax"> <vn-one name="tax">
<h4 ng-show="$ctrl.isBuyer || $ctrl.isAdministrative"> <h4 ng-show="$ctrl.isBuyer || $ctrl.isAdministrative">
<a <a
ui-sref="item.card.tax({id:$ctrl.item.id})" ui-sref="item.card.tax({id:$ctrl.item.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Tax</span> <span translate vn-tooltip="Go to">Tax</span>
</a> </a>
</h4> </h4>
<h4 <h4
translate translate
ng-show="!$ctrl.isBuyer && !$ctrl.isAdministrative"> ng-show="!$ctrl.isBuyer && !$ctrl.isAdministrative">
Tax Tax
@ -154,33 +164,33 @@
</vn-one> </vn-one>
<vn-one name="botanical"> <vn-one name="botanical">
<h4 ng-show="$ctrl.isBuyer"> <h4 ng-show="$ctrl.isBuyer">
<a <a
ui-sref="item.card.botanical({id:$ctrl.item.id})" ui-sref="item.card.botanical({id:$ctrl.item.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Botanical</span> <span translate vn-tooltip="Go to">Botanical</span>
</a> </a>
</h4> </h4>
<h4 <h4
translate translate
ng-show="!$ctrl.isBuyer"> ng-show="!$ctrl.isBuyer">
Botanical Botanical
</h4> </h4>
<vn-label-value label="Genus" <vn-label-value label="Genus"
value="{{$ctrl.summary.botanical.genus.name}}"> value="{{$ctrl.summary.botanical.genus.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Specie" <vn-label-value label="Specie"
value="{{$ctrl.summary.botanical.specie.name}}"> value="{{$ctrl.summary.botanical.specie.name}}">
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
<vn-one name="barcode"> <vn-one name="barcode">
<h4 ng-show="$ctrl.isBuyer || $ctrl.isReplenisher"> <h4 ng-show="$ctrl.isBuyer || $ctrl.isReplenisher">
<a <a
ui-sref="item.card.itemBarcode({id:$ctrl.item.id})" ui-sref="item.card.itemBarcode({id:$ctrl.item.id})"
target="_self"> target="_self">
<span translate vn-tooltip="Go to">Barcode</span> <span translate vn-tooltip="Go to">Barcode</span>
</a> </a>
</h4> </h4>
<h4 <h4
translate translate
ng-show="!$ctrl.isBuyer && !$ctrl.isReplenisher"> ng-show="!$ctrl.isBuyer && !$ctrl.isReplenisher">
Barcode Barcode
@ -191,6 +201,6 @@
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>
<vn-worker-descriptor-popover <vn-worker-descriptor-popover
vn-id="workerDescriptor"> vn-id="workerDescriptor">
</vn-worker-descriptor-popover> </vn-worker-descriptor-popover>

View File

@ -7,6 +7,24 @@ class Controller extends Summary {
this.$http.get(`Items/${this.item.id}/getSummary`).then(response => { this.$http.get(`Items/${this.item.id}/getSummary`).then(response => {
this.summary = response.data; 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() { $onChanges() {
@ -37,4 +55,7 @@ ngModule.vnComponent('vnItemSummary', {
bindings: { bindings: {
item: '<', item: '<',
}, },
require: {
card: '?^vnItemCard'
}
}); });

View File

@ -14,12 +14,15 @@ describe('Item', () => {
const $element = angular.element('<vn-item-summary></vn-item-summary>'); const $element = angular.element('<vn-item-summary></vn-item-summary>');
controller = $componentController('vnItemSummary', {$element, $scope}); controller = $componentController('vnItemSummary', {$element, $scope});
controller.item = {id: 1}; controller.item = {id: 1};
controller.card = {};
})); }));
describe('getSummary()', () => { describe('getSummary()', () => {
it('should perform a query to set summary', () => { it('should perform a query to set summary', () => {
let data = {id: 1, name: 'Gem of mind'}; let data = {id: 1, name: 'Gem of mind'};
$httpBackend.expect('GET', `Items/1/getSummary`).respond(200, data); $httpBackend.expect('GET', `Items/1/getSummary`).respond(200, data);
$httpBackend.expect('GET', `ItemConfigs/findOne`).respond({});
$httpBackend.expect('GET', `Warehouses/findOne`).respond({});
controller.getSummary(); controller.getSummary();
$httpBackend.flush(); $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 Barcode: Códigos de barras
Other data: Otros datos Other data: Otros datos
Go to the item: Ir al artículo Go to the item: Ir al artículo
WarehouseFk: Calculado sobre el almacén de {{ warehouseName }}

View File

@ -29,7 +29,11 @@ vn-item-summary {
padding: 0; padding: 0;
&:nth-child(1) { &:nth-child(1) {
border-right: 1px solid white; border-right: 1px solid white;
}
&:nth-child(2) {
border-right: 1px solid white;
} }
} }
} }

View File

@ -131,7 +131,7 @@
</vn-td> </vn-td>
<vn-td> <vn-td>
<span class="link" ng-if="sale.id" <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}} {{sale.itemFk}}
</span> </span>
<vn-autocomplete ng-if="!sale.id" class="dense" <vn-autocomplete ng-if="!sale.id" class="dense"

View File

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