Merge branch 'dev' into 4658-createWorker
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
ce06274d0a
|
@ -0,0 +1,9 @@
|
|||
ALTER TABLE `vn`.`itemConfig` ADD defaultTag INT DEFAULT 56 NOT NULL;
|
||||
ALTER TABLE `vn`.`itemConfig` ADD CONSTRAINT itemConfig_FK FOREIGN KEY (defaultTag) REFERENCES vn.tag(id);
|
||||
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');
|
|
@ -2719,6 +2719,10 @@ 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`)
|
||||
VALUES
|
||||
(0, 0, 24, '', '[1,2,3]', 2, 56);
|
||||
|
||||
INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `level`, `wagon`, `smartTagFk`, `usedShelves`, `itemCount`, `liters`)
|
||||
VALUES
|
||||
(9, 3, util.VN_NOW(), NULL, 0, NULL, NULL, NULL, NULL);
|
||||
|
|
|
@ -429,6 +429,7 @@ export default {
|
|||
},
|
||||
itemCreateView: {
|
||||
temporalName: 'vn-item-create vn-textfield[ng-model="$ctrl.item.provisionalName"]',
|
||||
priority: 'vn-autocomplete[ng-model="$ctrl.item.priority"]',
|
||||
type: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]',
|
||||
intrastat: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]',
|
||||
origin: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]',
|
||||
|
@ -522,7 +523,7 @@ export default {
|
|||
},
|
||||
itemLog: {
|
||||
anyLineCreated: 'vn-item-log > vn-log vn-tbody > vn-tr',
|
||||
fifthLineCreatedProperty: 'vn-item-log > vn-log vn-tbody > vn-tr:nth-child(5) table tr:nth-child(3) td.after',
|
||||
fifthLineCreatedProperty: 'vn-item-log > vn-log vn-tbody > vn-tr:nth-child(5) table tr:nth-child(2) td.after',
|
||||
},
|
||||
ticketSummary: {
|
||||
header: 'vn-ticket-summary > vn-card > h5',
|
||||
|
|
|
@ -36,11 +36,20 @@ describe('Item Create', () => {
|
|||
await page.waitForState('item.create');
|
||||
});
|
||||
|
||||
it('should create the Infinity Gauntlet item', async() => {
|
||||
it('should throw an error when insert an invalid priority', async() => {
|
||||
await page.write(selectors.itemCreateView.temporalName, 'Infinity Gauntlet');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.type, 'Crisantemo');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.intrastat, 'Coral y materiales similares');
|
||||
await page.autocompleteSearch(selectors.itemCreateView.origin, 'Holand');
|
||||
await page.clearInput(selectors.itemCreateView.priority);
|
||||
await page.waitToClick(selectors.itemCreateView.createButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Valid priorities');
|
||||
});
|
||||
|
||||
it('should create the Infinity Gauntlet item', async() => {
|
||||
await page.autocompleteSearch(selectors.itemCreateView.priority, '2');
|
||||
await page.waitToClick(selectors.itemCreateView.createButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@ module.exports = Self => {
|
|||
'typeFk',
|
||||
'intrastatFk',
|
||||
'originFk',
|
||||
'relevancy'
|
||||
'priority',
|
||||
'tag'
|
||||
];
|
||||
|
||||
for (const key in params) {
|
||||
|
@ -46,10 +47,14 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
try {
|
||||
const itemConfig = await models.ItemConfig.findOne({fields: ['validPriorities']}, myOptions);
|
||||
if (!itemConfig.validPriorities.includes(params.priority))
|
||||
throw new UserError(`Valid priorities: ${[...itemConfig.validPriorities]}`);
|
||||
|
||||
const provisionalName = params.provisionalName;
|
||||
delete params.provisionalName;
|
||||
|
||||
const itemType = await models.ItemType.findById(params.typeFk, myOptions);
|
||||
const itemType = await models.ItemType.findById(params.typeFk, {fields: ['isLaid']}, myOptions);
|
||||
|
||||
params.isLaid = itemType.isLaid;
|
||||
|
||||
|
@ -63,13 +68,14 @@ module.exports = Self => {
|
|||
|
||||
await Self.rawSql(query, null, myOptions);
|
||||
|
||||
let nameTag = await models.Tag.findOne({where: {name: 'Nombre temporal'}});
|
||||
const nameTag = await models.Tag.findById(params.tag, {fields: ['id']}, myOptions);
|
||||
|
||||
let newTags = [];
|
||||
|
||||
newTags.push({itemFk: item.id, tagFk: nameTag.id, value: provisionalName, priority: '2'});
|
||||
newTags.push({itemFk: item.id, tagFk: nameTag.id, value: provisionalName, priority: item.priority});
|
||||
typeTags.forEach(typeTag => {
|
||||
newTags.push({itemFk: item.id, tagFk: typeTag.tagFk, value: '', priority: typeTag.priority});
|
||||
if (nameTag.id != typeTag.tagFk)
|
||||
newTags.push({itemFk: item.id, tagFk: typeTag.tagFk, value: '', priority: typeTag.priority});
|
||||
});
|
||||
|
||||
await models.ItemTag.create(newTags, myOptions);
|
||||
|
|
|
@ -11,7 +11,8 @@ describe('item new()', () => {
|
|||
originFk: 1,
|
||||
provisionalName: 'planta',
|
||||
typeFk: 2,
|
||||
relevancy: 0
|
||||
priority: 2,
|
||||
tag: 1
|
||||
};
|
||||
|
||||
let item = await models.Item.new(itemParams, options);
|
||||
|
@ -20,7 +21,7 @@ describe('item new()', () => {
|
|||
|
||||
item.isLaid = itemType.isLaid;
|
||||
|
||||
const temporalNameTag = await models.Tag.findOne({where: {name: 'Nombre temporal'}}, options);
|
||||
const temporalNameTag = await models.Tag.findById(itemParams.tag, {fields: ['id']}, options);
|
||||
|
||||
const temporalName = await models.ItemTag.findOne({
|
||||
where: {
|
||||
|
@ -31,7 +32,7 @@ describe('item new()', () => {
|
|||
|
||||
item = await models.Item.findById(item.id, null, options);
|
||||
|
||||
itemType = await models.ItemType.findById(item.typeFk, options);
|
||||
itemType = await models.ItemType.findById(item.typeFk, {fields: ['isLaid']}, options);
|
||||
|
||||
item.isLaid = itemType.isLaid;
|
||||
|
||||
|
|
|
@ -16,6 +16,22 @@
|
|||
"wasteRecipients": {
|
||||
"type": "string",
|
||||
"description": "Buyers waste report recipients"
|
||||
},
|
||||
"validPriorities": {
|
||||
"type": "array"
|
||||
},
|
||||
"defaultPriority": {
|
||||
"type": "int"
|
||||
},
|
||||
"defaultTag": {
|
||||
"type": "int"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"tag": {
|
||||
"type": "belongsTo",
|
||||
"model": "Tag",
|
||||
"foreignKey": "defaultTag"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,10 +16,24 @@
|
|||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
label="Temporal name"
|
||||
ng-model="$ctrl.item.provisionalName"
|
||||
label="Name"
|
||||
ng-model="$ctrl.item.provisionalName"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
<vn-autocomplete
|
||||
ng-model="$ctrl.item.tag"
|
||||
url="Tags"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Tag">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
data="$ctrl.validPriorities"
|
||||
label="Priority"
|
||||
ng-model="$ctrl.item.priority"
|
||||
show-field="priority"
|
||||
value-field="priority">
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
|
|
|
@ -4,9 +4,25 @@ import Section from 'salix/components/section';
|
|||
class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.item = {
|
||||
relevancy: 0
|
||||
};
|
||||
this.fetchDefaultPriorityTag();
|
||||
}
|
||||
|
||||
fetchDefaultPriorityTag() {
|
||||
this.validPriorities = [];
|
||||
const filter = {fields: ['defaultPriority', 'defaultTag', 'validPriorities'], limit: 1};
|
||||
this.$http.get(`ItemConfigs`, {filter})
|
||||
.then(res => {
|
||||
if (res.data) {
|
||||
const dataRow = res.data[0];
|
||||
dataRow.validPriorities.forEach(priority => {
|
||||
this.validPriorities.push({priority});
|
||||
});
|
||||
this.item = {
|
||||
priority: dataRow.defaultPriority,
|
||||
tag: dataRow.defaultTag
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
|
|
|
@ -8,8 +8,8 @@ description:
|
|||
<a href='https://www.youtube.com/watch?v=qhb0kgQF3o8' title='Youtube' target='_blank'
|
||||
style='color:#8dba25'>https://www.youtube.com/watch?v=qhb0kgQF3o8</a>. También
|
||||
necesitarás el QLabel, el programa para imprimir las cintas.
|
||||
downloadFrom: Puedes descargarlo desde este enlace <a href='https://godex.s3-accelerate.amazonaws.com/gGnOPoojkP6vC1lgmrbEqQ.file?v01'
|
||||
title='Descargar QLabel' target='_blank' style='color:#8dba25'>https://godex.s3-accelerate.amazonaws.com/gGnOPoojkP6vC1lgmrbEqQ.file?v01</a>
|
||||
downloadFrom: Puedes descargarlo desde este enlace <a href='https://cdn.verdnatura.es/public/QLabel_IV_V1.37_Install_en.exe'
|
||||
title='Descargar QLabel' target='_blank' style='color:#8dba25'>https://cdn.verdnatura.es/public/QLabel_IV_V1.37_Install_en.exe</a>
|
||||
downloadDriver: En este enlace puedes descargar el driver de la impresora <a href='https://es.seagullscientific.com/support/downloads/drivers/godex/download/'
|
||||
title='Descargar driver' target='_blank' style='color:#8dba25'>https://es.seagullscientific.com/support/downloads/drivers/godex/download/</a>
|
||||
sections:
|
||||
|
|
Loading…
Reference in New Issue