Merge pull request '3070_deprecate_item_niches' (#718) from 3070_deprecate_item_niches into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #718
Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
Joan Sanchez 2021-08-30 13:05:56 +00:00
commit 4be6dce1e0
32 changed files with 24 additions and 307 deletions

View File

@ -0,0 +1,4 @@
DELETE FROM `salix`.`ACL` WHERE id = 48;
DELETE FROM `salix`.`ACL` WHERE id = 49;
DELETE FROM `salix`.`ACL` WHERE id = 50;
DELETE FROM `salix`.`ACL` WHERE id = 107;

View File

@ -323,7 +323,6 @@ export default {
idCheckbox: '.vn-popover.shown vn-horizontal:nth-child(1) > vn-check', idCheckbox: '.vn-popover.shown vn-horizontal:nth-child(1) > vn-check',
stemsCheckbox: '.vn-popover.shown vn-horizontal:nth-child(2) > vn-check', stemsCheckbox: '.vn-popover.shown vn-horizontal:nth-child(2) > vn-check',
sizeCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check', sizeCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check',
nicheCheckbox: '.vn-popover.shown vn-horizontal:nth-child(4) > vn-check',
typeCheckbox: '.vn-popover.shown vn-horizontal:nth-child(5) > vn-check', typeCheckbox: '.vn-popover.shown vn-horizontal:nth-child(5) > vn-check',
categoryCheckbox: '.vn-popover.shown vn-horizontal:nth-child(6) > vn-check', categoryCheckbox: '.vn-popover.shown vn-horizontal:nth-child(6) > vn-check',
intrastadCheckbox: '.vn-popover.shown vn-horizontal:nth-child(7) > vn-check', intrastadCheckbox: '.vn-popover.shown vn-horizontal:nth-child(7) > vn-check',
@ -420,17 +419,6 @@ export default {
submitBarcodesButton: 'vn-item-barcode button[type=submit]', submitBarcodesButton: 'vn-item-barcode button[type=submit]',
firstCodeRemoveButton: 'vn-item-barcode vn-horizontal:nth-child(1) vn-icon[icon="delete"]' firstCodeRemoveButton: 'vn-item-barcode vn-horizontal:nth-child(1) vn-icon[icon="delete"]'
}, },
itemNiches: {
addNicheButton: 'vn-item-niche vn-icon[icon="add_circle"]',
firstWarehouse: 'vn-item-niche vn-autocomplete[ng-model="niche.warehouseFk"]',
firstCode: 'vn-item-niche vn-horizontal:nth-child(1) vn-textfield[ng-model="niche.code"]',
secondWarehouse: 'vn-item-niche vn-horizontal:nth-child(2) > vn-autocomplete[ng-model="niche.warehouseFk"]',
secondCode: 'vn-item-niche vn-horizontal:nth-child(2) vn-textfield[ng-model="niche.code"]',
secondNicheRemoveButton: 'vn-item-niche vn-horizontal:nth-child(2) > vn-none > vn-icon-button[icon="delete"]',
thirdWarehouse: 'vn-item-niche vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="niche.warehouseFk"]',
thirdCode: 'vn-item-niche vn-horizontal:nth-child(3) vn-textfield[ng-model="niche.code"]',
submitNichesButton: 'vn-item-niche button[type=submit]'
},
itemBotanical: { itemBotanical: {
genus: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.genusFk"]', genus: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.genusFk"]',
species: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.specieFk"]', species: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.specieFk"]',
@ -440,7 +428,6 @@ export default {
basicData: 'vn-item-summary [name="basicData"]', basicData: 'vn-item-summary [name="basicData"]',
vat: 'vn-item-summary [name="tax"]', vat: 'vn-item-summary [name="tax"]',
tags: 'vn-item-summary [name="tags"]', tags: 'vn-item-summary [name="tags"]',
niche: 'vn-item-summary [name="niche"]',
botanical: 'vn-item-summary [name="botanical"]', botanical: 'vn-item-summary [name="botanical"]',
barcode: 'vn-item-summary [name="barcode"]' barcode: 'vn-item-summary [name="barcode"]'
}, },

View File

@ -40,13 +40,6 @@ describe('Item summary path', () => {
expect(result).toContain('Brown'); expect(result).toContain('Brown');
}); });
it(`should check the item summary preview shows fields from niche`, async() => {
await page.waitForTextInElement(selectors.itemSummary.niche, 'A1');
const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
expect(result).toContain('A1');
});
it(`should check the item summary preview shows fields from botanical`, async() => { it(`should check the item summary preview shows fields from botanical`, async() => {
await page.waitForTextInElement(selectors.itemSummary.botanical, 'Abelia'); await page.waitForTextInElement(selectors.itemSummary.botanical, 'Abelia');
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
@ -126,12 +119,6 @@ describe('Item summary path', () => {
expect(result).toContain('Silver'); expect(result).toContain('Silver');
}); });
it(`should check the item summary shows fields from niches section`, async() => {
const result = await page.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
expect(result).toContain('One A4');
});
it(`should check the item summary shows fields from botanical section`, async() => { it(`should check the item summary shows fields from botanical section`, async() => {
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');

View File

@ -1,66 +0,0 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Item create niche path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Ranged weapon longbow 2m');
await page.accessToSection('item.card.niche');
});
afterAll(async() => {
await browser.close();
});
it(`should click create a new niche and delete a former one`, async() => {
await page.waitForTextInField(selectors.itemNiches.firstWarehouse, 'Warehouse One');
await page.waitToClick(selectors.itemNiches.addNicheButton);
await page.waitToClick(selectors.itemNiches.secondNicheRemoveButton);
await page.autocompleteSearch(selectors.itemNiches.thirdWarehouse, 'Warehouse Two');
await page.write(selectors.itemNiches.thirdCode, 'A44');
await page.waitToClick(selectors.itemNiches.submitNichesButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should confirm the first niche is the expected one`, async() => {
await page.reloadSection('item.card.niche');
await page.waitForTextInField(selectors.itemNiches.firstWarehouse, 'Warehouse One');
let result = await page
.waitToGetProperty(selectors.itemNiches.firstWarehouse, 'value');
expect(result).toEqual('Warehouse One');
result = await page
.waitToGetProperty(selectors.itemNiches.firstCode, 'value');
expect(result).toEqual('A11');
});
it(`should confirm the second niche is the expected one`, async() => {
let result = await page
.waitToGetProperty(selectors.itemNiches.secondWarehouse, 'value');
expect(result).toEqual('Warehouse Three');
result = await page
.waitToGetProperty(selectors.itemNiches.secondCode, 'value');
expect(result).toEqual('A33');
});
it(`should confirm the third niche is the expected one`, async() => {
let result = await page
.waitToGetProperty(selectors.itemNiches.thirdWarehouse, 'value');
expect(result).toEqual('Warehouse Two');
result = await page
.waitToGetProperty(selectors.itemNiches.thirdCode, 'value');
expect(result).toEqual('A44');
});
});

View File

@ -26,7 +26,6 @@ describe('Item index path', () => {
await page.waitToClick(selectors.itemsIndex.idCheckbox); await page.waitToClick(selectors.itemsIndex.idCheckbox);
await page.waitToClick(selectors.itemsIndex.stemsCheckbox); await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
await page.waitToClick(selectors.itemsIndex.sizeCheckbox); await page.waitToClick(selectors.itemsIndex.sizeCheckbox);
await page.waitToClick(selectors.itemsIndex.nicheCheckbox);
await page.waitToClick(selectors.itemsIndex.typeCheckbox); await page.waitToClick(selectors.itemsIndex.typeCheckbox);
await page.waitToClick(selectors.itemsIndex.categoryCheckbox); await page.waitToClick(selectors.itemsIndex.categoryCheckbox);
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox); await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
@ -59,7 +58,6 @@ describe('Item index path', () => {
await page.waitToClick(selectors.itemsIndex.idCheckbox); await page.waitToClick(selectors.itemsIndex.idCheckbox);
await page.waitToClick(selectors.itemsIndex.stemsCheckbox); await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
await page.waitToClick(selectors.itemsIndex.sizeCheckbox); await page.waitToClick(selectors.itemsIndex.sizeCheckbox);
await page.waitToClick(selectors.itemsIndex.nicheCheckbox);
await page.waitToClick(selectors.itemsIndex.typeCheckbox); await page.waitToClick(selectors.itemsIndex.typeCheckbox);
await page.waitToClick(selectors.itemsIndex.categoryCheckbox); await page.waitToClick(selectors.itemsIndex.categoryCheckbox);
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox); await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);

View File

@ -239,9 +239,6 @@
.icon-mandatory:before { .icon-mandatory:before {
content: "\e921"; content: "\e921";
} }
.icon-niche:before {
content: "\e922";
}
.icon-no036:before { .icon-no036:before {
content: "\e923"; content: "\e923";
} }

View File

@ -41,7 +41,6 @@
<glyph unicode="&#xe91f;" glyph-name="logout" d="M405.333 243.2l81.067-81.067 281.6 285.867-285.867 285.867-76.8-81.067 145.067-149.333h-550.4v-115.2h550.4l-145.067-145.067zM908.8 960h-793.6c-64 0-115.2-51.2-115.2-115.2v-226.133h115.2v226.133h797.867v-797.867h-797.867v230.4h-115.2v-226.133c0-64 51.2-115.2 115.2-115.2h797.867c64 0 115.2 51.2 115.2 115.2v793.6c-4.267 64-55.467 115.2-119.467 115.2z" /> <glyph unicode="&#xe91f;" glyph-name="logout" d="M405.333 243.2l81.067-81.067 281.6 285.867-285.867 285.867-76.8-81.067 145.067-149.333h-550.4v-115.2h550.4l-145.067-145.067zM908.8 960h-793.6c-64 0-115.2-51.2-115.2-115.2v-226.133h115.2v226.133h797.867v-797.867h-797.867v230.4h-115.2v-226.133c0-64 51.2-115.2 115.2-115.2h797.867c64 0 115.2 51.2 115.2 115.2v793.6c-4.267 64-55.467 115.2-119.467 115.2z" />
<glyph unicode="&#xe920;" glyph-name="mana" d="M529.067 494.933c0 17.067 12.8 29.867 29.867 29.867s29.867-12.8 29.867-29.867c0-17.067-12.8-29.867-29.867-29.867s-29.867 12.8-29.867 29.867zM614.4 324.267c21.333 0 38.4 17.067 38.4 38.4s-17.067 38.4-38.4 38.4c-21.333 0-38.4-17.067-38.4-38.4 0-17.067 17.067-38.4 38.4-38.4zM473.6 614.4c12.8 0 25.6 12.8 25.6 25.6s-12.8 25.6-25.6 25.6-25.6-12.8-25.6-25.6c0-17.067 12.8-25.6 25.6-25.6zM802.133 302.933v-4.267c-4.267-157.867-132.267-285.867-290.133-285.867s-285.867 128-290.133 285.867v4.267h580.267zM584.533 238.933c0 17.067-12.8 29.867-29.867 29.867s-29.867-12.8-29.867-29.867 12.8-29.867 29.867-29.867c17.067 0 29.867 12.8 29.867 29.867zM401.067 264.533c-25.6 0-46.933-21.333-46.933-46.933s21.333-46.933 46.933-46.933c25.6 0 46.933 21.333 46.933 46.933s-21.333 46.933-46.933 46.933zM456.533 354.133c25.6 0 46.933 21.333 46.933 46.933s-21.333 46.933-46.933 46.933c-25.6 0-46.933-21.333-46.933-46.933s21.333-46.933 46.933-46.933zM878.933 302.933c0-200.533-162.133-366.933-366.933-366.933s-366.933 162.133-366.933 366.933c0 136.533 72.533 260.267 192 324.267v187.733c-21.333 4.267-38.4 21.333-38.4 42.667v59.733c0 25.6 21.333 42.667 42.667 42.667h332.8c25.6 0 42.667-21.333 42.667-42.667v-55.467c0-21.333-17.067-42.667-38.4-42.667v-192c123.733-68.267 200.533-192 200.533-324.267zM840.533 302.933c0 128-76.8 243.2-192 298.667h-4.267v256h34.133c4.267 0 4.267 4.267 4.267 4.267v55.467c0 4.267-4.267 4.267-4.267 4.267h-332.8c-4.267 0-8.533-4.267-8.533-4.267v-55.467c0-4.267 4.267-4.267 4.267-4.267h34.133v-256h-4.267c-115.2-51.2-192-170.667-192-298.667 0-179.2 145.067-328.533 328.533-328.533s332.8 145.067 332.8 328.533z" /> <glyph unicode="&#xe920;" glyph-name="mana" d="M529.067 494.933c0 17.067 12.8 29.867 29.867 29.867s29.867-12.8 29.867-29.867c0-17.067-12.8-29.867-29.867-29.867s-29.867 12.8-29.867 29.867zM614.4 324.267c21.333 0 38.4 17.067 38.4 38.4s-17.067 38.4-38.4 38.4c-21.333 0-38.4-17.067-38.4-38.4 0-17.067 17.067-38.4 38.4-38.4zM473.6 614.4c12.8 0 25.6 12.8 25.6 25.6s-12.8 25.6-25.6 25.6-25.6-12.8-25.6-25.6c0-17.067 12.8-25.6 25.6-25.6zM802.133 302.933v-4.267c-4.267-157.867-132.267-285.867-290.133-285.867s-285.867 128-290.133 285.867v4.267h580.267zM584.533 238.933c0 17.067-12.8 29.867-29.867 29.867s-29.867-12.8-29.867-29.867 12.8-29.867 29.867-29.867c17.067 0 29.867 12.8 29.867 29.867zM401.067 264.533c-25.6 0-46.933-21.333-46.933-46.933s21.333-46.933 46.933-46.933c25.6 0 46.933 21.333 46.933 46.933s-21.333 46.933-46.933 46.933zM456.533 354.133c25.6 0 46.933 21.333 46.933 46.933s-21.333 46.933-46.933 46.933c-25.6 0-46.933-21.333-46.933-46.933s21.333-46.933 46.933-46.933zM878.933 302.933c0-200.533-162.133-366.933-366.933-366.933s-366.933 162.133-366.933 366.933c0 136.533 72.533 260.267 192 324.267v187.733c-21.333 4.267-38.4 21.333-38.4 42.667v59.733c0 25.6 21.333 42.667 42.667 42.667h332.8c25.6 0 42.667-21.333 42.667-42.667v-55.467c0-21.333-17.067-42.667-38.4-42.667v-192c123.733-68.267 200.533-192 200.533-324.267zM840.533 302.933c0 128-76.8 243.2-192 298.667h-4.267v256h34.133c4.267 0 4.267 4.267 4.267 4.267v55.467c0 4.267-4.267 4.267-4.267 4.267h-332.8c-4.267 0-8.533-4.267-8.533-4.267v-55.467c0-4.267 4.267-4.267 4.267-4.267h34.133v-256h-4.267c-115.2-51.2-192-170.667-192-298.667 0-179.2 145.067-328.533 328.533-328.533s332.8 145.067 332.8 328.533z" />
<glyph unicode="&#xe921;" glyph-name="mandatory" d="M981.333 725.333v-618.667c0-93.867-76.8-170.667-170.667-170.667h-311.467c-46.933 0-89.6 17.067-119.467 51.2l-337.067 341.333c0 0 55.467 51.2 55.467 55.467 8.533 8.533 21.333 12.8 34.133 12.8 8.533 0 17.067-4.267 25.6-8.533 0 0 183.467-106.667 183.467-106.667v507.733c0 34.133 29.867 64 64 64s64-29.867 64-64v-298.667h42.667v405.333c0 34.133 29.867 64 64 64s64-29.867 64-64v-405.333h42.667v362.667c0 34.133 29.867 64 64 64s64-29.867 64-64v-362.667h42.667v234.667c0 34.133 29.867 64 64 64s64-29.867 64-64z" /> <glyph unicode="&#xe921;" glyph-name="mandatory" d="M981.333 725.333v-618.667c0-93.867-76.8-170.667-170.667-170.667h-311.467c-46.933 0-89.6 17.067-119.467 51.2l-337.067 341.333c0 0 55.467 51.2 55.467 55.467 8.533 8.533 21.333 12.8 34.133 12.8 8.533 0 17.067-4.267 25.6-8.533 0 0 183.467-106.667 183.467-106.667v507.733c0 34.133 29.867 64 64 64s64-29.867 64-64v-298.667h42.667v405.333c0 34.133 29.867 64 64 64s64-29.867 64-64v-405.333h42.667v362.667c0 34.133 29.867 64 64 64s64-29.867 64-64v-362.667h42.667v234.667c0 34.133 29.867 64 64 64s64-29.867 64-64z" />
<glyph unicode="&#xe922;" glyph-name="niche" d="M512 960c-196.267 0-358.4-162.133-358.4-358.4 0-268.8 358.4-665.6 358.4-665.6s358.4 396.8 358.4 665.6c0 196.267-162.133 358.4-358.4 358.4zM512 473.6c-72.533 0-128 55.467-128 128s55.467 128 128 128 128-55.467 128-128-55.467-128-128-128z" />
<glyph unicode="&#xe923;" glyph-name="no036" d="M89.6 145.067v627.2c0 46.933 29.867 85.333 72.533 98.133v-46.933c-17.067-12.8-29.867-29.867-29.867-51.2v-584.533l-42.667-42.667zM409.6 465.067h-46.933v85.333h132.267l123.733 123.733h-46.933v226.133l136.533-136.533 51.2 51.2-149.333 145.067h-332.8c-42.667 0-81.067-38.4-81.067-81.067v-627.2l213.333 213.333zM686.933 51.2h-452.267l-42.667-42.667c0 0 0 0 0 0h494.933c51.2 0 93.867 38.4 102.4 85.333h-42.667c-8.533-25.6-34.133-42.667-59.733-42.667zM691.2 507.733v-42.667h-42.667l-81.067-81.067h123.733v-81.067h-204.8l-166.4-166.4h452.267c42.667 0 81.067 38.4 81.067 81.067v452.267l-162.133-162.133zM59.733-64l-59.733 59.733 964.267 964.267 59.733-59.733-964.267-964.267z" /> <glyph unicode="&#xe923;" glyph-name="no036" d="M89.6 145.067v627.2c0 46.933 29.867 85.333 72.533 98.133v-46.933c-17.067-12.8-29.867-29.867-29.867-51.2v-584.533l-42.667-42.667zM409.6 465.067h-46.933v85.333h132.267l123.733 123.733h-46.933v226.133l136.533-136.533 51.2 51.2-149.333 145.067h-332.8c-42.667 0-81.067-38.4-81.067-81.067v-627.2l213.333 213.333zM686.933 51.2h-452.267l-42.667-42.667c0 0 0 0 0 0h494.933c51.2 0 93.867 38.4 102.4 85.333h-42.667c-8.533-25.6-34.133-42.667-59.733-42.667zM691.2 507.733v-42.667h-42.667l-81.067-81.067h123.733v-81.067h-204.8l-166.4-166.4h452.267c42.667 0 81.067 38.4 81.067 81.067v452.267l-162.133-162.133zM59.733-64l-59.733 59.733 964.267 964.267 59.733-59.733-964.267-964.267z" />
<glyph unicode="&#xe924;" glyph-name="notes" d="M614.4 960h-413.867c-59.733 0-106.667-46.933-106.667-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h627.2c55.467 0 102.4 46.933 102.4 102.4v614.4l-311.467 307.2zM563.2 601.6v281.6l290.133-281.6h-290.133z" /> <glyph unicode="&#xe924;" glyph-name="notes" d="M614.4 960h-413.867c-59.733 0-106.667-46.933-106.667-102.4v-819.2c0-55.467 46.933-102.4 102.4-102.4h627.2c55.467 0 102.4 46.933 102.4 102.4v614.4l-311.467 307.2zM563.2 601.6v281.6l290.133-281.6h-290.133z" />
<glyph unicode="&#xe925;" glyph-name="noweb" d="M0 362.667c0 132.267 98.133 238.933 226.133 256 55.467 102.4 162.133 170.667 285.867 170.667 64 0 119.467-17.067 170.667-51.2l-580.267-580.267c-64 46.933-102.4 123.733-102.4 204.8zM823.467 533.333c-4.267 29.867-17.067 55.467-25.6 81.067l-507.733-507.733h520.533c119.467 0 213.333 93.867 213.333 213.333 0 110.933-85.333 204.8-200.533 213.333zM1024 900.267l-59.733 59.733-964.267-964.267 59.733-59.733 964.267 964.267z" /> <glyph unicode="&#xe925;" glyph-name="noweb" d="M0 362.667c0 132.267 98.133 238.933 226.133 256 55.467 102.4 162.133 170.667 285.867 170.667 64 0 119.467-17.067 170.667-51.2l-580.267-580.267c-64 46.933-102.4 123.733-102.4 204.8zM823.467 533.333c-4.267 29.867-17.067 55.467-25.6 81.067l-507.733-507.733h520.533c119.467 0 213.333 93.867 213.333 213.333 0 110.933-85.333 204.8-200.533 213.333zM1024 900.267l-59.733 59.733-964.267-964.267 59.733-59.733 964.267 964.267z" />

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 112 KiB

View File

@ -1,19 +1,29 @@
const app = require('vn-loopback/server/server'); const models = require('vn-loopback/server/server').models;
describe('Model rewriteDbError()', () => { describe('Model rewriteDbError()', () => {
it('should extend rewriteDbError properties to any model passed', () => { it('should extend rewriteDbError properties to any model passed', () => {
let exampleModel = app.models.ItemNiche; const exampleModel = models.ItemTag;
expect(exampleModel.rewriteDbError).toBeDefined(); expect(exampleModel.rewriteDbError).toBeDefined();
}); });
it('should handle a duplicated warehouse error', async() => { it('should handle a duplicated warehouse error', async() => {
let itemNiche = {itemFk: 1, warehouseFK: 1, code: 'A11'}; const tx = await models.Ticket.beginTransaction({});
let error; let error;
await app.models.ItemNiche.create(itemNiche).catch(e => {
try {
const options = {transaction: tx};
const itemTag = {itemFk: 1, tagFk: 56, value: 'Ranged weapon', priority: 1};
await models.ItemTag.create(itemTag, options);
await tx.rollback();
} catch (e) {
await tx.rollback();
error = e; error = e;
}).finally(() => { }
expect(error.message).toEqual(`The warehouse can't be repeated`);
}); expect(error.message).toEqual(`The tag can't be repeated`);
}); });
}); });

View File

@ -112,8 +112,6 @@ module.exports = Self => {
return {'it.workerFk': value}; return {'it.workerFk': value};
case 'origin': case 'origin':
return {'ori.code': value}; return {'ori.code': value};
case 'niche':
return {'ip.code': value};
case 'intrastat': case 'intrastat':
return {'intr.description': value}; return {'intr.description': value};
} }
@ -148,8 +146,7 @@ module.exports = Self => {
ic.name AS category, ic.name AS category,
intr.description AS intrastat, intr.description AS intrastat,
b.grouping, b.grouping,
b.packing, b.packing
ip.code AS niche, @visibleCalc
FROM item i FROM item i
LEFT JOIN itemType it ON it.id = i.typeFk LEFT JOIN itemType it ON it.id = i.typeFk
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
@ -159,8 +156,7 @@ module.exports = Self => {
LEFT JOIN producer pr ON pr.id = i.producerFk LEFT JOIN producer pr ON pr.id = i.producerFk
LEFT JOIN origin ori ON ori.id = i.originFk LEFT JOIN origin ori ON ori.id = i.originFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = it.warehouseFk LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = it.warehouseFk
LEFT JOIN vn.buy b ON b.id = lb.buy_id LEFT JOIN vn.buy b ON b.id = lb.buy_id`
LEFT JOIN itemPlacement ip ON ip.itemFk = i.id AND ip.warehouseFk = it.warehouseFk`
); );
if (ctx.args.tags) { if (ctx.args.tags) {

View File

@ -92,19 +92,11 @@ module.exports = Self => {
}; };
promises.push(models.ItemBotanical.find(filter, myOptions)); promises.push(models.ItemBotanical.find(filter, myOptions));
// Niches
filter = {
where: {itemFk: id},
include: {relation: 'warehouse'}
};
promises.push(models.ItemNiche.find(filter, myOptions));
let res = await Promise.all(promises); let res = await Promise.all(promises);
summary.item = res[0]; summary.item = res[0];
summary.tags = res[1]; summary.tags = res[1];
[summary.botanical] = res[2]; [summary.botanical] = res[2];
summary.niches = res[3];
const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions); const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions);

View File

@ -1,7 +1,7 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
describe('item getSummary()', () => { describe('item getSummary()', () => {
it('should return summary with item, tags, botanical, niches, available and visible defined ', async() => { it('should return summary with item, tags, botanical, available and visible defined ', async() => {
const tx = await models.Item.beginTransaction({}); const tx = await models.Item.beginTransaction({});
const options = {transaction: tx}; const options = {transaction: tx};
@ -14,7 +14,6 @@ describe('item getSummary()', () => {
expect(keys).toContain('item'); expect(keys).toContain('item');
expect(keys).toContain('tags'); expect(keys).toContain('tags');
expect(keys).toContain('botanical'); expect(keys).toContain('botanical');
expect(keys).toContain('niches');
expect(keys).toContain('available'); expect(keys).toContain('available');
expect(keys).toContain('visible'); expect(keys).toContain('visible');

View File

@ -26,9 +26,6 @@
"ItemLog": { "ItemLog": {
"dataSource": "vn" "dataSource": "vn"
}, },
"ItemNiche": {
"dataSource": "vn"
},
"ItemPlacement": { "ItemPlacement": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -1,9 +0,0 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.rewriteDbError(function(err) {
if (err.code === 'ER_DUP_ENTRY')
return new UserError(`The warehouse can't be repeated`);
return err;
});
};

View File

@ -1,42 +0,0 @@
{
"name": "ItemNiche",
"base": "Loggable",
"log": {
"model": "ItemLog",
"relation": "item",
"showField": "code"
},
"options": {
"mysql": {
"table": "itemPlacement"
}
},
"properties": {
"id": {
"type": "Number",
"id": 1,
"description": "Identifier"
},
"warehouseFk": {
"type": "Number",
"description": "Identifier"
},
"code": {
"type": "String",
"required": true
}
},
"relations": {
"item": {
"type": "belongsTo",
"model": "Item",
"foreignKey": "itemFk"
},
"warehouse": {
"type": "belongsTo",
"model": "Warehouse",
"foreignKey": "warehouseFk",
"required": true
}
}
}

View File

@ -196,11 +196,6 @@
"model": "ItemTaxCountry", "model": "ItemTaxCountry",
"foreignKey": "itemFk" "foreignKey": "itemFk"
}, },
"itemNiche": {
"type": "hasMany",
"model": "ItemNiche",
"foreignKey": "itemFk"
},
"packaging": { "packaging": {
"type": "hasOne", "type": "hasOne",
"model": "Packaging", "model": "Packaging",

View File

@ -16,7 +16,6 @@ import './log';
import './request'; import './request';
import './request-search-panel'; import './request-search-panel';
import './last-entries'; import './last-entries';
import './niche';
import './botanical'; import './botanical';
import './barcode'; import './barcode';
import './summary'; import './summary';

View File

@ -18,7 +18,6 @@
<vn-th field="name">Description</vn-th> <vn-th field="name">Description</vn-th>
<vn-th field="stems" shrink>Stems</vn-th> <vn-th field="stems" shrink>Stems</vn-th>
<vn-th field="size" shrink>Size</vn-th> <vn-th field="size" shrink>Size</vn-th>
<vn-th field="niche" shrink>Niche</vn-th>
<vn-th field="typeFk" shrink>Type</vn-th> <vn-th field="typeFk" shrink>Type</vn-th>
<vn-th field="category" shrink>Category</vn-th> <vn-th field="category" shrink>Category</vn-th>
<vn-th field="intrastat" shrink>Intrastat</vn-th> <vn-th field="intrastat" shrink>Intrastat</vn-th>
@ -63,7 +62,6 @@
</vn-td> </vn-td>
<vn-td shrink>{{::item.stems}}</vn-td> <vn-td shrink>{{::item.stems}}</vn-td>
<vn-td shrink>{{::item.size}}</vn-td> <vn-td shrink>{{::item.size}}</vn-td>
<vn-td shrink>{{::item.niche}}</vn-td>
<vn-td shrink title="{{::item.typeName}}"> <vn-td shrink title="{{::item.typeName}}">
{{::item.typeName}} {{::item.typeName}}
</vn-td> </vn-td>

View File

@ -23,8 +23,6 @@ class Controller extends Section {
return {'b.packing': value}; return {'b.packing': value};
case 'origin': case 'origin':
return {'ori.code': value}; return {'ori.code': value};
case 'niche':
return {'ip.code': value};
case 'typeFk': case 'typeFk':
return {'i.typeFk': value}; return {'i.typeFk': value};
case 'intrastat': case 'intrastat':

View File

@ -30,8 +30,6 @@ New species: Nueva especie
New genus: Nuevo genus New genus: Nuevo genus
Add tag: Añadir etiqueta Add tag: Añadir etiqueta
Remove tag: Quitar etiqueta Remove tag: Quitar etiqueta
Add niche: Añadir nicho
Remove niche: Quitar nicho
Add barcode: Añadir código de barras Add barcode: Añadir código de barras
Remove barcode: Quitar código de barras Remove barcode: Quitar código de barras
Buyer: Comprador Buyer: Comprador
@ -56,7 +54,6 @@ Summary: Vista previa
Basic data: Datos básicos Basic data: Datos básicos
Tax: IVA Tax: IVA
History: Historial History: Historial
Niches: Nichos
Botanical: Botánico Botanical: Botánico
Barcodes: Códigos de barras Barcodes: Códigos de barras
Diary: Histórico Diary: Histórico

View File

@ -1,72 +0,0 @@
<vn-crud-model
vn-id="model"
url="ItemNiches"
fields="['id', 'itemFk', 'warehouseFk', 'code']"
link="{itemFk: $ctrl.$params.id}"
data="niches"
auto-load="true">
</vn-crud-model>
<vn-watcher
vn-id="watcher"
data="niches"
form="form">
</vn-watcher>
<vn-crud-model
auto-load="true"
url="Warehouses"
data="warehouses"
order="name"
vn-id="warehouse-model">
</vn-crud-model>
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
<vn-card class="vn-pa-lg">
<vn-horizontal ng-repeat="niche in niches track by $index">
<vn-autocomplete vn-one vn-focus
data="warehouses"
label="Warehouse"
show-field="name"
value-field="id"
ng-model="niche.warehouseFk"
vn-acl="buyer,replenisher">
</vn-autocomplete>
<vn-textfield
vn-three
label="Code"
ng-model="niche.code"
rule="ItemNiche"
vn-acl="buyer,replenisher">
</vn-textfield>
<vn-none>
<vn-icon-button
vn-acl="buyer,replenisher"
pointer
vn-tooltip="Remove niche"
icon="delete"
ng-click="model.remove($index)">
</vn-icon-button>
</vn-none>
</vn-horizontal>
<vn-one>
<vn-icon-button
vn-acl="buyer, replenisher"
vn-tooltip="Add niche"
vn-bind="+"
icon="add_circle"
ng-click="model.insert()">
</vn-icon-button>
</vn-one>
</vn-card>
<vn-button-bar>
<vn-submit
disabled="!watcher.dataChanged()"
label="Save">
</vn-submit>
<!-- # #2680 Undo changes button bugs -->
<!-- <vn-button
class="cancel"
label="Undo changes"
disabled="!watcher.dataChanged()"
ng-click="watcher.loadOriginalData()">
</vn-button> -->
</vn-button-bar>
</form>

View File

@ -1,17 +0,0 @@
import ngModule from '../module';
import Section from 'salix/components/section';
export default class Controller extends Section {
onSubmit() {
this.$.watcher.check();
this.$.model.save().then(() => {
this.$.watcher.notifySaved();
this.$.watcher.updateOriginalData();
});
}
}
ngModule.vnComponent('vnItemNiche', {
template: require('./index.html'),
controller: Controller
});

View File

@ -15,7 +15,6 @@
{"state": "item.card.basicData", "icon": "settings"}, {"state": "item.card.basicData", "icon": "settings"},
{"state": "item.card.tags", "icon": "icon-tags"}, {"state": "item.card.tags", "icon": "icon-tags"},
{"state": "item.card.tax", "icon": "icon-tax"}, {"state": "item.card.tax", "icon": "icon-tax"},
{"state": "item.card.niche", "icon": "place"},
{"state": "item.card.botanical", "icon": "local_florist"}, {"state": "item.card.botanical", "icon": "local_florist"},
{"state": "item.card.itemBarcode", "icon": "icon-barcode"}, {"state": "item.card.itemBarcode", "icon": "icon-barcode"},
{"state": "item.card.diary", "icon": "icon-transaction"}, {"state": "item.card.diary", "icon": "icon-transaction"},
@ -79,16 +78,6 @@
"description": "Tax", "description": "Tax",
"acl": ["administrative","buyer"] "acl": ["administrative","buyer"]
}, },
{
"url" : "/niche",
"state": "item.card.niche",
"component": "vn-item-niche",
"description": "Niches",
"params": {
"item": "$ctrl.item"
},
"acl": ["buyer","replenisher"]
},
{ {
"url" : "/botanical", "url" : "/botanical",
"state": "item.card.botanical", "state": "item.card.botanical",

View File

@ -138,24 +138,6 @@
value="{{tax.taxClass.description}}"> value="{{tax.taxClass.description}}">
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
<vn-one name="niche">
<h4 ng-show="$ctrl.isBuyer || $ctrl.isReplenisher">
<a
ui-sref="item.card.niche({id:$ctrl.item.id})"
target="_self">
<span translate vn-tooltip="Go to">Niche</span>
</a>
</h4>
<h4
translate
ng-show="!$ctrl.isBuyer && !$ctrl.isReplenisher">
Niche
</h4>
<vn-label-value label="{{niche.warehouse.name}}"
ng-repeat="niche in $ctrl.summary.niches"
value="{{niche.code}}">
</vn-label-value>
</vn-one>
<vn-one name="botanical"> <vn-one name="botanical">
<h4 ng-show="$ctrl.isBuyer"> <h4 ng-show="$ctrl.isBuyer">
<a <a

View File

@ -1,4 +1,3 @@
Niche: Nichos
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