From e09a8f2eb77007e7add79d74858c44fb11d16bd2 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 31 May 2024 12:41:38 +0200 Subject: [PATCH 1/6] refs #6897 remove code redirection --- modules/entry/front/main/index.html | 20 +------------------- modules/entry/front/main/index.js | 7 ++++++- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/modules/entry/front/main/index.html b/modules/entry/front/main/index.html index f6a4c61fc..fd40910d9 100644 --- a/modules/entry/front/main/index.html +++ b/modules/entry/front/main/index.html @@ -1,22 +1,4 @@ - - - - - - - - - - + diff --git a/modules/entry/front/main/index.js b/modules/entry/front/main/index.js index 75f1d098a..cc0a8d6a3 100644 --- a/modules/entry/front/main/index.js +++ b/modules/entry/front/main/index.js @@ -1,7 +1,12 @@ import ngModule from '../module'; import ModuleMain from 'salix/components/module-main'; -export default class Entry extends ModuleMain {} +export default class Entry extends ModuleMain { + async $onInit() { + this.$state.go('home'); + window.location.href = await this.vnApp.getUrl(`entry/`); + } +} ngModule.vnComponent('vnEntry', { controller: Entry, -- 2.40.1 From cdc18ed84fdfd05d3ee070c3615c7cc77e6e5f62 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 7 Jun 2024 08:32:59 +0200 Subject: [PATCH 2/6] refs #6897 fix entry Salix --- e2e/paths/10-travel/03_descriptor.spec.js | 102 --------------- e2e/paths/12-entry/01_summary.spec.js | 47 ------- e2e/paths/12-entry/02_descriptor.spec.js | 49 -------- e2e/paths/12-entry/03_latestBuys.spec.js | 116 ------------------ e2e/paths/12-entry/04_create.spec.js | 34 ----- e2e/paths/12-entry/05_basicData.spec.js | 81 ------------ e2e/paths/12-entry/06_observations.spec.js | 65 ---------- e2e/paths/12-entry/07_buys.spec.js | 69 ----------- modules/entry/front/main/index.html | 21 ++++ modules/entry/front/main/index.js | 5 +- .../travel/front/descriptor-menu/index.html | 8 +- modules/travel/front/descriptor-menu/index.js | 5 + 12 files changed, 31 insertions(+), 571 deletions(-) delete mode 100644 e2e/paths/12-entry/01_summary.spec.js delete mode 100644 e2e/paths/12-entry/02_descriptor.spec.js delete mode 100644 e2e/paths/12-entry/03_latestBuys.spec.js delete mode 100644 e2e/paths/12-entry/04_create.spec.js delete mode 100644 e2e/paths/12-entry/05_basicData.spec.js delete mode 100644 e2e/paths/12-entry/06_observations.spec.js delete mode 100644 e2e/paths/12-entry/07_buys.spec.js diff --git a/e2e/paths/10-travel/03_descriptor.spec.js b/e2e/paths/10-travel/03_descriptor.spec.js index 4723cc4a3..f066a74ca 100644 --- a/e2e/paths/10-travel/03_descriptor.spec.js +++ b/e2e/paths/10-travel/03_descriptor.spec.js @@ -33,106 +33,4 @@ describe('Travel descriptor path', () => { expect(state).toBe('travel.card.summary'); }); - - it('should be redirected to the create entry view', async() => { - await page.waitToClick(selectors.travelDescriptor.dotMenu); - await page.waitToClick(selectors.travelDescriptor.dotMenuAddEntry); - await page.waitForState('entry.create'); - const state = await page.getState(); - - expect(state).toBe('entry.create'); - }); - - it('should check some data was imported from the travel', async() => { - const travel = await page.waitToGetProperty(selectors.entryCreate.travel, 'value'); - const campany = await page.waitToGetProperty(selectors.entryCreate.company, 'value'); - - expect(travel).toContain('Warehouse'); - expect(campany).toContain('VNL'); - }); - - it('should navigate back to the travel index', async() => { - await page.waitToClick('.cancel'); - await page.waitToClick(selectors.globalItems.homeButton); - await page.selectModule('travel'); - await page.waitForState('travel.index'); - const state = await page.getState(); - - expect(state).toBe('travel.index'); - }); - - it('should click on the add entry button of the third result to be redirected to create entry', async() => { - await page.keyboard.press('Enter'); - await page.waitToClick(selectors.travelIndex.firstTravelAddEntryButton); - await page.waitForState('entry.create'); - const state = await page.getState(); - - expect(state).toBe('entry.create'); - }); - - it('should check again some data was imported from the travel', async() => { - const travel = await page.waitToGetProperty(selectors.entryCreate.travel, 'value'); - const campany = await page.waitToGetProperty(selectors.entryCreate.company, 'value'); - - expect(travel).toContain('Warehouse'); - expect(campany).toContain('VNL'); - }); - - it('should navigate to the travel summary of a given travel', async() => { - await page.waitToClick('.cancel'); - await page.waitToClick(selectors.globalItems.homeButton); - await page.selectModule('travel'); - await page.write(selectors.travelIndex.generalSearchFilter, '3'); - await page.keyboard.press('Enter'); - await page.waitForState('travel.card.summary'); - const state = await page.getState(); - - expect(state).toBe('travel.card.summary'); - }); - - it('should be redirected to the create travel when using the clone option of the dot menu', async() => { - await page.waitToClick(selectors.travelDescriptor.dotMenu); - await page.waitToClick(selectors.travelDescriptor.dotMenuClone); - await page.respondToDialog('accept'); - await page.waitForState('travel.create'); - const state = await page.getState(); - - expect(state).toBe('travel.create'); - }); - - it('should edit the data to clone and then get redirected to the cloned travel basic data', async() => { - await page.clearInput(selectors.travelCreate.reference); - await page.write(selectors.travelCreate.reference, 'reference'); - await page.autocompleteSearch(selectors.travelCreate.agency, 'entanglement'); - await page.pickDate(selectors.travelCreate.shipped); - await page.pickDate(selectors.travelCreate.landed); - await page.autocompleteSearch(selectors.travelCreate.warehouseOut, 'warehouse one'); - await page.autocompleteSearch(selectors.travelCreate.warehouseIn, 'warehouse two'); - await page.waitToClick(selectors.travelCreate.saveButton); - await page.waitForState('travel.card.basicData'); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Data saved!'); - }); - - it('should update the landed date to a future date to enable cloneWithEntries', async() => { - const nextMonth = Date.vnNew(); - nextMonth.setMonth(nextMonth.getMonth() + 1); - await page.pickDate(selectors.travelBasicData.deliveryDate, nextMonth); - await page.waitToClick(selectors.travelBasicData.save); - await page.waitForState('travel.card.basicData'); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Data saved!'); - }); - - it('should navigate to the summary and then clone the travel and its entries using the descriptor menu to get redirected to the cloned travel basic data', async() => { - await page.waitToClick('vn-icon[icon="launch"]'); - await page.waitForState('travel.card.summary'); - await page.waitForTimeout(1000); - await page.waitToClick(selectors.travelDescriptor.dotMenu); - await page.waitToClick(selectors.travelDescriptor.dotMenuCloneWithEntries); - await page.waitToClick(selectors.travelDescriptor.acceptClonation); - await page.waitForState('travel.card.basicData'); - }); }); diff --git a/e2e/paths/12-entry/01_summary.spec.js b/e2e/paths/12-entry/01_summary.spec.js deleted file mode 100644 index b846bc4c8..000000000 --- a/e2e/paths/12-entry/01_summary.spec.js +++ /dev/null @@ -1,47 +0,0 @@ -import selectors from '../../helpers/selectors.js'; -import getBrowser from '../../helpers/puppeteer'; - -describe('Entry summary path', () => { - let browser; - let page; - - beforeAll(async() => { - browser = await getBrowser(); - page = browser.page; - await page.loginAndModule('buyer', 'entry'); - await page.accessToSearchResult('4'); - }); - - afterAll(async() => { - await browser.close(); - }); - - it('should reach the second entry summary section', async() => { - await page.waitForState('entry.card.summary'); - }); - - it(`should display details from the entry on the header`, async() => { - await page.waitForTextInElement(selectors.entrySummary.header, 'The farmer'); - const result = await page.waitToGetProperty(selectors.entrySummary.header, 'innerText'); - - expect(result).toContain('The farmer'); - }); - - it('should display some entry details like the reference', async() => { - const result = await page.waitToGetProperty(selectors.entrySummary.reference, 'innerText'); - - expect(result).toContain('Movement 4'); - }); - - it('should display other entry details like the confirmed', async() => { - const result = await page.checkboxState(selectors.entrySummary.confirmed, 'innerText'); - - expect(result).toContain('unchecked'); - }); - - it('should display all buys for the entry', async() => { - const result = await page.countElement(selectors.entrySummary.anyBuyLine); - - expect(result).toEqual(4); - }); -}); diff --git a/e2e/paths/12-entry/02_descriptor.spec.js b/e2e/paths/12-entry/02_descriptor.spec.js deleted file mode 100644 index 997a6065c..000000000 --- a/e2e/paths/12-entry/02_descriptor.spec.js +++ /dev/null @@ -1,49 +0,0 @@ -import selectors from '../../helpers/selectors.js'; -import getBrowser from '../../helpers/puppeteer'; - -describe('Entry descriptor path', () => { - let browser; - let page; - - beforeAll(async() => { - browser = await getBrowser(); - page = browser.page; - await page.loginAndModule('buyer', 'entry'); - await page.accessToSearchResult('2'); - }); - - afterAll(async() => { - await browser.close(); - }); - - it('should reach the second entry summary section', async() => { - await page.waitForState('entry.card.summary'); - }); - - it('should show some entry information', async() => { - const result = await page.waitToGetProperty(selectors.entryDescriptor.agency, 'innerText'); - - expect(result).toContain('inhouse pickup'); - }); - - it('should click the travels button to be redirected to the travels index filtered by the current agency', async() => { - await page.waitToClick(selectors.entryDescriptor.travelsQuicklink); - await page.expectURL('/travel/index'); - await page.expectURL('agencyModeFk'); - }); - - it('should go back to the entry summary', async() => { - await page.waitToClick(selectors.globalItems.homeButton); - await page.selectModule('entry'); - await page.accessToSearchResult('2'); - await page.waitForState('entry.card.summary'); - }); - - it('should click the entries button to be redirected to the entries index filtered by the current supplier', async() => { - await page.waitToClick(selectors.entryDescriptor.entriesQuicklink); - await page.expectURL('/entry/index'); - await page.expectURL('supplierFk'); - await page.expectURL('to'); - await page.expectURL('from'); - }); -}); diff --git a/e2e/paths/12-entry/03_latestBuys.spec.js b/e2e/paths/12-entry/03_latestBuys.spec.js deleted file mode 100644 index 9ec072912..000000000 --- a/e2e/paths/12-entry/03_latestBuys.spec.js +++ /dev/null @@ -1,116 +0,0 @@ -import selectors from '../../helpers/selectors.js'; -import getBrowser from '../../helpers/puppeteer'; - -describe('Entry lastest buys path', () => { - let browser; - let page; - const httpRequests = []; - - beforeAll(async() => { - browser = await getBrowser(); - page = browser.page; - page.on('request', req => { - if (req.url().includes(`Buys/latestBuysFilter`)) - httpRequests.push(req.url()); - }); - await page.loginAndModule('buyer', 'entry'); - }); - - afterAll(async() => { - await browser.close(); - }); - - it('should access the latest buys seccion and search not seeing the edit buys button yet', async() => { - await page.waitToClick(selectors.entryLatestBuys.latestBuysSectionButton); - await page.waitForSelector(selectors.entryLatestBuys.editBuysButton, {visible: false}); - }); - - it('should filter by name', async() => { - await page.write(selectors.entryLatestBuys.generalSearchInput, 'Melee'); - await page.keyboard.press('Enter'); - await page.waitToClick(selectors.entryLatestBuys.chip); - - expect(httpRequests.find(req => req.includes(('search=Melee')))).toBeDefined(); - }); - - it('should filter by reign and type', async() => { - await page.click(selectors.entryLatestBuys.firstReignIcon); - await page.autocompleteSearch(selectors.entryLatestBuys.typeInput, 'Alstroemeria'); - await page.click(selectors.entryLatestBuys.chip); - - expect(httpRequests.find(req => req.includes(('categoryFk')))).toBeDefined(); - expect(httpRequests.find(req => req.includes(('typeFk')))).toBeDefined(); - }); - - it('should filter by sales person', async() => { - await page.autocompleteSearch(selectors.entryLatestBuys.salesPersonInput, 'buyerNick'); - await page.waitToClick(selectors.entryLatestBuys.chip); - - expect(httpRequests.find(req => req.includes(('salesPersonFk')))).toBeDefined(); - }); - - it('should filter by supplier', async() => { - await page.autocompleteSearch(selectors.entryLatestBuys.supplierInput, 'Farmer King'); - await page.waitToClick(selectors.entryLatestBuys.chip); - - expect(httpRequests.find(req => req.includes(('supplierFk')))).toBeDefined(); - }); - - it('should filter by active', async() => { - await page.waitToClick(selectors.entryLatestBuys.activeCheck); - await page.waitToClick(selectors.entryLatestBuys.activeCheck); - await page.waitToClick(selectors.entryLatestBuys.chip); - - expect(httpRequests.find(req => req.includes(('active=true')))).toBeDefined(); - expect(httpRequests.find(req => req.includes(('active=false')))).toBeDefined(); - }); - - it('should filter by visible', async() => { - await page.waitToClick(selectors.entryLatestBuys.visibleCheck); - await page.waitToClick(selectors.entryLatestBuys.visibleCheck); - await page.waitToClick(selectors.entryLatestBuys.chip); - - expect(httpRequests.find(req => req.includes(('visible=true')))).toBeDefined(); - expect(httpRequests.find(req => req.includes(('visible=false')))).toBeDefined(); - }); - - it('should filter by floramondo', async() => { - await page.waitToClick(selectors.entryLatestBuys.floramondoCheck); - await page.waitToClick(selectors.entryLatestBuys.floramondoCheck); - await page.waitToClick(selectors.entryLatestBuys.chip); - - expect(httpRequests.find(req => req.includes(('floramondo=true')))).toBeDefined(); - expect(httpRequests.find(req => req.includes(('floramondo=false')))).toBeDefined(); - }); - - it('should filter by tag Color', async() => { - await page.waitToClick(selectors.entryLatestBuys.addTagButton); - await page.autocompleteSearch(selectors.entryLatestBuys.itemTagInput, 'Color'); - await page.autocompleteSearch(selectors.entryLatestBuys.itemTagValueInput, 'Brown'); - await page.waitToClick(selectors.entryLatestBuys.chip); - - expect(httpRequests.find(req => req.includes(('tags')))).toBeDefined(); - }); - - it('should select all lines but one and then check the edit buys button appears', async() => { - await page.waitToClick(selectors.entryLatestBuys.allBuysCheckBox); - await page.waitToClick(selectors.entryLatestBuys.secondBuyCheckBox); - await page.waitForSelector(selectors.entryLatestBuys.editBuysButton, {visible: true}); - }); - - it('should open the edit dialog', async() => { - await page.waitToClick(selectors.entryLatestBuys.editBuysButton); - await page.waitForSelector(selectors.entryLatestBuys.fieldAutocomplete, {visible: true}); - }); - - it('should search for the "Description" and type a new one for the items in each selected buy', async() => { - await page.autocompleteSearch(selectors.entryLatestBuys.fieldAutocomplete, 'Description'); - await page.write(selectors.entryLatestBuys.newValueInput, 'Crafted item'); - await page.waitToClick(selectors.entryLatestBuys.acceptEditBuysDialog); - }); - - it('should navigate to the entry.buy section by clicking one of the buys', async() => { - await page.waitToClick(selectors.entryLatestBuys.firstBuy); - await page.waitForState('entry.card.buy.index'); - }); -}); diff --git a/e2e/paths/12-entry/04_create.spec.js b/e2e/paths/12-entry/04_create.spec.js deleted file mode 100644 index 537637671..000000000 --- a/e2e/paths/12-entry/04_create.spec.js +++ /dev/null @@ -1,34 +0,0 @@ -import selectors from '../../helpers/selectors.js'; -import getBrowser from '../../helpers/puppeteer'; - -describe('Entry create path', () => { - let browser; - let page; - - beforeAll(async() => { - browser = await getBrowser(); - page = browser.page; - await page.loginAndModule('buyer', 'entry'); - }); - - afterAll(async() => { - await browser.close(); - }); - - it('should click the create entry button to open the form', async() => { - await page.waitToClick(selectors.entryIndex.createEntryButton); - await page.waitForState('entry.create'); - }); - - it('should fill the form to create a valid entry then redirect to basic Data', async() => { - await page.autocompleteSearch(selectors.entryIndex.newEntrySupplier, 'The farmer'); - await page.autocompleteSearch(selectors.entryIndex.newEntryTravel, 'Warehouse'); - await page.autocompleteSearch(selectors.entryIndex.newEntryCompany, 'ORN'); - - await page.waitToClick(selectors.entryIndex.saveNewEntry); - await page.waitForNavigation({ - waitUntil: 'load', - }); - await page.waitForState('entry.card.basicData'); - }); -}); diff --git a/e2e/paths/12-entry/05_basicData.spec.js b/e2e/paths/12-entry/05_basicData.spec.js deleted file mode 100644 index f1f14f8da..000000000 --- a/e2e/paths/12-entry/05_basicData.spec.js +++ /dev/null @@ -1,81 +0,0 @@ -import getBrowser from '../../helpers/puppeteer'; - -const $ = { - reference: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.reference"]', - invoiceNumber: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.invoiceNumber"]', - notes: 'vn-entry-basic-data vn-textfield[ng-model="$ctrl.entry.notes"]', - observations: 'vn-entry-basic-data vn-textarea[ng-model="$ctrl.entry.observation"]', - supplier: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.supplierFk"]', - currency: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.currencyFk"]', - commission: 'vn-entry-basic-data vn-input-number[ng-model="$ctrl.entry.commission"]', - company: 'vn-entry-basic-data vn-autocomplete[ng-model="$ctrl.entry.companyFk"]', - ordered: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isOrdered"]', - confirmed: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isConfirmed"]', - inventory: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isExcludedFromAvailable"]', - raid: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isRaid"]', - booked: 'vn-entry-basic-data vn-check[ng-model="$ctrl.entry.isBooked"]', - save: 'vn-entry-basic-data button[type=submit]', -}; - -describe('Entry basic data path', () => { - let browser; - let page; - - beforeAll(async() => { - browser = await getBrowser(); - page = browser.page; - await page.loginAndModule('buyer', 'entry'); - await page.accessToSearchResult('2'); - await page.accessToSection('entry.card.basicData'); - }); - - afterAll(async() => { - await browser.close(); - }); - - it('should edit the basic data and confirm the reference was edited', async() => { - await page.write($.reference, 'new movement 8'); - await page.write($.invoiceNumber, 'new movement 8'); - await page.write($.observations, ' edited'); - await page.autocompleteSearch($.supplier, 'Plants nick'); - await page.autocompleteSearch($.currency, 'eur'); - await page.clearInput($.commission); - await page.write($.commission, '100'); - await page.autocompleteSearch($.company, 'CCs'); - await page.waitToClick($.ordered); - await page.waitToClick($.confirmed); - await page.waitToClick($.inventory); - await page.waitToClick($.raid); - await page.waitToClick($.booked); - await page.waitToClick($.save); - const message = await page.waitForSnackbar(); - - await page.reloadSection('entry.card.basicData'); - const reference = await page.waitToGetProperty($.reference, 'value'); - const supplier = await page.waitToGetProperty($.supplier, 'value'); - const invoiceNumber = await page.waitToGetProperty($.invoiceNumber, 'value'); - const observations = await page.waitToGetProperty($.observations, 'value'); - const currency = await page.waitToGetProperty($.currency, 'value'); - const commission = await page.waitToGetProperty($.commission, 'value'); - const company = await page.waitToGetProperty($.company, 'value'); - const ordered = await page.checkboxState($.ordered); - const confirmed = await page.checkboxState($.confirmed); - const inventory = await page.checkboxState($.inventory); - const raid = await page.checkboxState($.raid); - const booked = await page.checkboxState($.booked); - - expect(message.text).toContain('Data saved!'); - expect(reference).toEqual('new movement 8'); - expect(supplier).toEqual('Plants nick'); - expect(invoiceNumber).toEqual('new movement 8'); - expect(observations).toEqual('observation two edited'); - expect(currency).toEqual('EUR'); - expect(commission).toEqual('100'); - expect(company).toEqual('CCs'); - expect(ordered).toBe('checked'); - expect(confirmed).toBe('checked'); - expect(inventory).toBe('checked'); - expect(raid).toBe('checked'); - expect(booked).toBe('unchecked'); - }); -}); diff --git a/e2e/paths/12-entry/06_observations.spec.js b/e2e/paths/12-entry/06_observations.spec.js deleted file mode 100644 index dcad44fb0..000000000 --- a/e2e/paths/12-entry/06_observations.spec.js +++ /dev/null @@ -1,65 +0,0 @@ -import selectors from '../../helpers/selectors.js'; -import getBrowser from '../../helpers/puppeteer'; - -describe('Entry observations path', () => { - let browser; - let page; - - beforeAll(async() => { - browser = await getBrowser(); - page = browser.page; - await page.loginAndModule('buyer', 'entry'); - await page.accessToSearchResult('2'); - await page.accessToSection('entry.card.observation'); - }); - - afterAll(async() => { - await browser.close(); - }); - - it(`should add two new observations of the same type then fail to save as they can't be repeated`, async() => { - await page.waitToClick(selectors.entryObservations.addNewObservation); - await page.waitToClick(selectors.entryObservations.addNewObservation); - await page.autocompleteSearch(selectors.entryObservations.firstObservationType, 'SalesPerson'); - await page.autocompleteSearch(selectors.entryObservations.secondObservationType, 'SalesPerson'); - await page.write(selectors.entryObservations.firstObservationDescription, 'first observation'); - await page.write(selectors.entryObservations.secondObservationDescription, 'second observation'); - await page.waitToClick(selectors.entryObservations.saveObservationsButton); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain(`The observation type can't be repeated`); - }); - - it('should set the 2nd observation of a different one and successfully save both', async() => { - await page.autocompleteSearch(selectors.entryObservations.secondObservationType, 'Delivery'); - await page.waitToClick(selectors.entryObservations.saveObservationsButton); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Data saved!'); - }); - - it('should reload the section and make sure the first observation type was saved correctly', async() => { - await page.reloadSection('entry.card.observation'); - const result = await page.waitToGetProperty(selectors.entryObservations.firstObservationType, 'value'); - - expect(result).toEqual('SalesPerson'); - }); - - it('should make sure the first observation description was saved correctly', async() => { - const result = await page.waitToGetProperty(selectors.entryObservations.firstObservationDescription, 'value'); - - expect(result).toEqual('first observation'); - }); - - it('should make sure the second observation type was saved correctly', async() => { - const result = await page.waitToGetProperty(selectors.entryObservations.secondObservationType, 'value'); - - expect(result).toEqual('Delivery'); - }); - - it('should make sure the second observation description was saved correctly', async() => { - const result = await page.waitToGetProperty(selectors.entryObservations.secondObservationDescription, 'value'); - - expect(result).toEqual('second observation'); - }); -}); diff --git a/e2e/paths/12-entry/07_buys.spec.js b/e2e/paths/12-entry/07_buys.spec.js deleted file mode 100644 index b960673ec..000000000 --- a/e2e/paths/12-entry/07_buys.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -import selectors from '../../helpers/selectors.js'; -import getBrowser from '../../helpers/puppeteer'; - -describe('Entry import, create and edit buys path', () => { - let browser; - let page; - - beforeAll(async() => { - browser = await getBrowser(); - page = browser.page; - await page.loginAndModule('buyer', 'entry'); - await page.accessToSearchResult('3'); - }); - - afterAll(async() => { - await browser.close(); - }); - - it('should count the summary buys and find there only one at this point', async() => { - const buysCount = await page.countElement(selectors.entrySummary.anyBuyLine); - - expect(buysCount).toEqual(2); - }); - - it('should navigate to the buy section and then click the import button opening the import form', async() => { - await page.accessToSection('entry.card.buy.index'); - await page.waitToClick(selectors.entryBuys.importButton); - await page.waitForState('entry.card.buy.import'); - }); - - it('should fill the form, import the a JSON file and select items for each import and confirm import', async() => { - let currentDir = process.cwd(); - let filePath = `${currentDir}/e2e/assets/07_import_buys.json`; - - const [fileChooser] = await Promise.all([ - page.waitForFileChooser(), - page.waitToClick(selectors.entryBuys.file) - ]); - await fileChooser.accept([filePath]); - - await page.waitForTextInField(selectors.entryBuys.ref, '200573095, 200573106, 200573117, 200573506'); - await page.waitForTextInField(selectors.entryBuys.observation, '729-6340 2846'); - - await page.autocompleteSearch(selectors.entryBuys.firstImportedItem, 'Ranged weapon longbow 200cm'); - await page.autocompleteSearch(selectors.entryBuys.secondImportedItem, 'Ranged weapon longbow 200cm'); - await page.autocompleteSearch(selectors.entryBuys.thirdImportedItem, 'Ranged weapon sniper rifle 113cm'); - await page.autocompleteSearch(selectors.entryBuys.fourthImportedItem, 'Melee weapon heavy shield 100cm'); - - await page.waitToClick(selectors.entryBuys.importBuysButton); - - const message = await page.waitForSnackbar(); - const state = await page.getState(); - - expect(message.text).toContain('Data saved!'); - expect(state).toBe('entry.card.buy.index'); - }); - - it('should count the buys to find 4 buys have been added', async() => { - await page.waitForNumberOfElements(selectors.entryBuys.anyBuyLine, 6); - }); - - it('should delete the four buys that were just added', async() => { - await page.waitToClick(selectors.entryBuys.allBuyCheckbox); - await page.waitToClick(selectors.entryBuys.firstBuyCheckbox); - await page.waitToClick(selectors.entryBuys.deleteBuysButton); - await page.waitToClick(selectors.globalItems.acceptButton); - await page.waitForNumberOfElements(selectors.entryBuys.anyBuyLine, 1); - }); -}); diff --git a/modules/entry/front/main/index.html b/modules/entry/front/main/index.html index fd40910d9..d55fbd60b 100644 --- a/modules/entry/front/main/index.html +++ b/modules/entry/front/main/index.html @@ -1,3 +1,24 @@ + + + + + + + + + + + + diff --git a/modules/entry/front/main/index.js b/modules/entry/front/main/index.js index cc0a8d6a3..69bddc7fc 100644 --- a/modules/entry/front/main/index.js +++ b/modules/entry/front/main/index.js @@ -2,10 +2,7 @@ import ngModule from '../module'; import ModuleMain from 'salix/components/module-main'; export default class Entry extends ModuleMain { - async $onInit() { - this.$state.go('home'); - window.location.href = await this.vnApp.getUrl(`entry/`); - } + } ngModule.vnComponent('vnEntry', { diff --git a/modules/travel/front/descriptor-menu/index.html b/modules/travel/front/descriptor-menu/index.html index 9b408994f..19831860b 100644 --- a/modules/travel/front/descriptor-menu/index.html +++ b/modules/travel/front/descriptor-menu/index.html @@ -26,8 +26,8 @@ Delete travel Add entry @@ -35,7 +35,7 @@ - - - this.$state.go('travel.card.basicData', {id: res.data})); -- 2.40.1 From 48550bd986f6eb72862a7489da6796de34d6051d Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 7 Jun 2024 11:35:03 +0200 Subject: [PATCH 3/6] refs #6897 fix remove --- back/nodemonConfig.json | 3 +- .../01_summary_and_descriptor.spec.js | 5 - front/module-import.js | 37 ++- modules/entry/front/basic-data/index.html | 234 --------------- modules/entry/front/basic-data/index.js | 68 ----- modules/entry/front/basic-data/style.scss | 3 - modules/entry/front/buy/import/index.html | 205 -------------- modules/entry/front/buy/import/index.js | 159 ----------- modules/entry/front/buy/import/index.spec.js | 199 ------------- modules/entry/front/buy/import/style.scss | 5 - modules/entry/front/buy/index/index.html | 243 ---------------- modules/entry/front/buy/index/index.js | 81 ------ modules/entry/front/buy/index/index.spec.js | 92 ------ modules/entry/front/buy/index/locale/es.yml | 3 - modules/entry/front/buy/index/style.scss | 42 --- modules/entry/front/buy/locale/es.yml | 8 - modules/entry/front/card/index.html | 5 - modules/entry/front/card/index.js | 59 ---- modules/entry/front/create/index.html | 69 ----- modules/entry/front/create/index.js | 43 --- modules/entry/front/create/locale/es.yml | 2 - modules/entry/front/create/style.scss | 10 - .../entry/front/descriptor-popover/index.html | 3 - .../entry/front/descriptor-popover/index.js | 9 - modules/entry/front/descriptor/index.html | 65 ----- modules/entry/front/descriptor/index.js | 99 ------- modules/entry/front/descriptor/index.spec.js | 40 --- modules/entry/front/descriptor/locale/es.yml | 7 - modules/entry/front/index.js | 14 - modules/entry/front/index/locale/es.yml | 17 -- .../front/latest-buys-search-panel/index.html | 242 ---------------- .../front/latest-buys-search-panel/index.js | 61 ---- .../latest-buys-search-panel/index.spec.js | 56 ---- .../front/latest-buys-search-panel/style.scss | 70 ----- modules/entry/front/latest-buys/index.html | 267 ------------------ modules/entry/front/latest-buys/index.js | 209 -------------- modules/entry/front/latest-buys/index.spec.js | 100 ------- modules/entry/front/latest-buys/locale/en.yml | 2 - modules/entry/front/latest-buys/locale/es.yml | 19 -- modules/entry/front/latest-buys/style.scss | 7 - modules/entry/front/locale/es.yml | 6 - modules/entry/front/log/index.html | 1 - modules/entry/front/log/index.js | 7 - modules/entry/front/log/locale/es.yml | 1 - modules/entry/front/main/index.html | 25 -- modules/entry/front/main/index.js | 11 - modules/entry/front/note/index.html | 72 ----- modules/entry/front/note/index.js | 20 -- modules/entry/front/routes.json | 92 +----- modules/entry/front/search-panel/index.html | 100 ------- modules/entry/front/search-panel/index.js | 7 - .../entry/front/search-panel/locale/es.yml | 9 - modules/entry/front/summary/index.html | 196 ------------- modules/entry/front/summary/index.js | 33 --- modules/entry/front/summary/index.spec.js | 49 ---- modules/entry/front/summary/locale/es.yml | 11 - modules/entry/front/summary/style.scss | 30 -- modules/item/front/routes.json | 8 +- modules/travel/front/routes.json | 8 +- 59 files changed, 28 insertions(+), 3520 deletions(-) delete mode 100644 modules/entry/front/basic-data/index.html delete mode 100644 modules/entry/front/basic-data/index.js delete mode 100644 modules/entry/front/basic-data/style.scss delete mode 100644 modules/entry/front/buy/import/index.html delete mode 100644 modules/entry/front/buy/import/index.js delete mode 100644 modules/entry/front/buy/import/index.spec.js delete mode 100644 modules/entry/front/buy/import/style.scss delete mode 100644 modules/entry/front/buy/index/index.html delete mode 100644 modules/entry/front/buy/index/index.js delete mode 100644 modules/entry/front/buy/index/index.spec.js delete mode 100644 modules/entry/front/buy/index/locale/es.yml delete mode 100644 modules/entry/front/buy/index/style.scss delete mode 100644 modules/entry/front/buy/locale/es.yml delete mode 100644 modules/entry/front/card/index.html delete mode 100644 modules/entry/front/card/index.js delete mode 100644 modules/entry/front/create/index.html delete mode 100644 modules/entry/front/create/index.js delete mode 100644 modules/entry/front/create/locale/es.yml delete mode 100644 modules/entry/front/create/style.scss delete mode 100644 modules/entry/front/descriptor-popover/index.html delete mode 100644 modules/entry/front/descriptor-popover/index.js delete mode 100644 modules/entry/front/descriptor/index.html delete mode 100644 modules/entry/front/descriptor/index.js delete mode 100644 modules/entry/front/descriptor/index.spec.js delete mode 100644 modules/entry/front/descriptor/locale/es.yml delete mode 100644 modules/entry/front/index/locale/es.yml delete mode 100644 modules/entry/front/latest-buys-search-panel/index.html delete mode 100644 modules/entry/front/latest-buys-search-panel/index.js delete mode 100644 modules/entry/front/latest-buys-search-panel/index.spec.js delete mode 100644 modules/entry/front/latest-buys-search-panel/style.scss delete mode 100644 modules/entry/front/latest-buys/index.html delete mode 100644 modules/entry/front/latest-buys/index.js delete mode 100644 modules/entry/front/latest-buys/index.spec.js delete mode 100644 modules/entry/front/latest-buys/locale/en.yml delete mode 100644 modules/entry/front/latest-buys/locale/es.yml delete mode 100644 modules/entry/front/latest-buys/style.scss delete mode 100644 modules/entry/front/locale/es.yml delete mode 100644 modules/entry/front/log/index.html delete mode 100644 modules/entry/front/log/index.js delete mode 100644 modules/entry/front/log/locale/es.yml delete mode 100644 modules/entry/front/main/index.html delete mode 100644 modules/entry/front/main/index.js delete mode 100644 modules/entry/front/note/index.html delete mode 100644 modules/entry/front/note/index.js delete mode 100644 modules/entry/front/search-panel/index.html delete mode 100644 modules/entry/front/search-panel/index.js delete mode 100644 modules/entry/front/search-panel/locale/es.yml delete mode 100644 modules/entry/front/summary/index.html delete mode 100644 modules/entry/front/summary/index.js delete mode 100644 modules/entry/front/summary/index.spec.js delete mode 100644 modules/entry/front/summary/locale/es.yml delete mode 100644 modules/entry/front/summary/style.scss diff --git a/back/nodemonConfig.json b/back/nodemonConfig.json index 5138bc30e..c468a2f73 100644 --- a/back/nodemonConfig.json +++ b/back/nodemonConfig.json @@ -8,7 +8,6 @@ "modules/account/front/**/*", "modules/claim/front/**/*", "modules/client/front/**/*", - "modules/entry/front/**/*", "modules/invoiceIn/front/**/*", "modules/invoiceOut/front/**/*", "modules/item/front/**/*", @@ -22,4 +21,4 @@ "modules/worker/front/**/*", "modules/zone/front/**/*" ] -} \ No newline at end of file +} diff --git a/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js b/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js index e82f851ea..a2e194e42 100644 --- a/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js +++ b/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js @@ -65,11 +65,6 @@ describe('Supplier summary & descriptor path', () => { await page.waitForState('supplier.card.summary'); }); - it(`should navigate to the supplier's entries`, async() => { - await page.waitToClick(selectors.supplierDescriptor.entriesButton); - await page.waitForState('entry.index'); - }); - it(`should navigate back to suppliers but a different one this time`, async() => { await page.waitToClick(selectors.globalItems.homeButton); await page.waitForState('home'); diff --git a/front/module-import.js b/front/module-import.js index bc547deeb..85731c72c 100755 --- a/front/module-import.js +++ b/front/module-import.js @@ -1,27 +1,26 @@ export default function moduleImport(moduleName) { // TODO: Webpack watches module backend files when using dynamic import - //return import( + // return import( // /* webpackInclude: /modules\/[a-z0-9-]+\/front\/index.js$/ */ // '../modules/'+ moduleName +'/front/index.js' - //); + // ); - switch(moduleName) { - case 'client' : return import('client/front'); - case 'item' : return import('item/front'); - case 'ticket' : return import('ticket/front'); - case 'order' : return import('order/front'); - case 'claim' : return import('claim/front'); - case 'zone' : return import('zone/front'); - case 'travel' : return import('travel/front'); - case 'worker' : return import('worker/front'); - case 'invoiceOut' : return import('invoiceOut/front'); - case 'invoiceIn' : return import('invoiceIn/front'); - case 'route' : return import('route/front'); - case 'entry' : return import('entry/front'); - case 'account' : return import('account/front'); - case 'supplier' : return import('supplier/front'); - case 'shelving' : return import('shelving/front'); - case 'monitor' : return import('monitor/front'); + switch (moduleName) { + case 'client': return import('client/front'); + case 'item': return import('item/front'); + case 'ticket': return import('ticket/front'); + case 'order': return import('order/front'); + case 'claim': return import('claim/front'); + case 'zone': return import('zone/front'); + case 'travel': return import('travel/front'); + case 'worker': return import('worker/front'); + case 'invoiceOut': return import('invoiceOut/front'); + case 'invoiceIn': return import('invoiceIn/front'); + case 'route': return import('route/front'); + case 'account': return import('account/front'); + case 'supplier': return import('supplier/front'); + case 'shelving': return import('shelving/front'); + case 'monitor': return import('monitor/front'); } } diff --git a/modules/entry/front/basic-data/index.html b/modules/entry/front/basic-data/index.html deleted file mode 100644 index 57de1c5f7..000000000 --- a/modules/entry/front/basic-data/index.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - - -
- - - - -
#{{::nickname}}
-
#{{::id}}
-
-
- - -
- {{::agencyModeName}} - {{::warehouseInName}} ({{::shipped | date: 'dd/MM/yyyy'}}) → - {{::warehouseOutName}} ({{::landed | date: 'dd/MM/yyyy'}}) -
-
#{{::id}}
-
- - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - ID - Agency - Warehouse Out - Warehouse In - Shipped - Landed - - - - - - - {{::travel.id}} - - - {{::travel.agency.name}} - {{::travel.warehouseOut.name}} - {{::travel.warehouseIn.name}} - {{::travel.shipped | date: 'dd/MM/yyyy'}} - {{::travel.landed | date: 'dd/MM/yyyy'}} - - - - - - - - diff --git a/modules/entry/front/basic-data/index.js b/modules/entry/front/basic-data/index.js deleted file mode 100644 index 564a3df5c..000000000 --- a/modules/entry/front/basic-data/index.js +++ /dev/null @@ -1,68 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -class Controller extends Section { - showFilterDialog(travel) { - this.activeTravel = travel; - this.travelFilterParams = {}; - this.travelFilter = { - include: [ - { - relation: 'agency', - scope: { - fields: ['name'] - } - }, - { - relation: 'warehouseIn', - scope: { - fields: ['name'] - } - }, - { - relation: 'warehouseOut', - scope: { - fields: ['name'] - } - } - ] - }; - - this.$.filterDialog.show(); - } - - selectTravel(id) { - this.entry.travelFk = id; - this.$.filterDialog.hide(); - } - - filter() { - const filter = this.travelFilter; - const params = this.travelFilterParams; - const where = {}; - for (let key in params) { - const value = params[key]; - if (!value) continue; - - switch (key) { - case 'agencyModeFk': - case 'warehouseInFk': - case 'warehouseOutFk': - case 'shipped': - case 'landed': - where[key] = value; - } - } - - filter.where = where; - this.$.travelsModel.applyFilter(filter); - } -} -ngModule.vnComponent('vnEntryBasicData', { - template: require('./index.html'), - bindings: { - entry: '<' - }, - controller: Controller -}); diff --git a/modules/entry/front/basic-data/style.scss b/modules/entry/front/basic-data/style.scss deleted file mode 100644 index 508aa9091..000000000 --- a/modules/entry/front/basic-data/style.scss +++ /dev/null @@ -1,3 +0,0 @@ -.travelFilter{ - width: 950px; -} diff --git a/modules/entry/front/buy/import/index.html b/modules/entry/front/buy/import/index.html deleted file mode 100644 index 28396434c..000000000 --- a/modules/entry/front/buy/import/index.html +++ /dev/null @@ -1,205 +0,0 @@ - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ItemDescriptionSizePackingGroupingBuying valueBox
- - - {{::id}} - {{::name}} - - - - - - - {{::buy.description | dashIfEmpty}}{{::buy.size | dashIfEmpty}}{{::buy.packing | dashIfEmpty}}{{::buy.grouping | dashIfEmpty}}{{::buy.buyingValue | currency: 'EUR':2}} - - -
-
-
- - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - ID - Item - Size - Producer - Color - - - - - - - {{::item.id}} - - - {{::item.name}} - {{::item.size}} - {{::item.producerName}} - {{::item.inkName}} - - - - - - - - \ No newline at end of file diff --git a/modules/entry/front/buy/import/index.js b/modules/entry/front/buy/import/index.js deleted file mode 100644 index ba0a98e62..000000000 --- a/modules/entry/front/buy/import/index.js +++ /dev/null @@ -1,159 +0,0 @@ -import ngModule from '../../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -class Controller extends Section { - constructor($element, $) { - super($element, $); - this.import = { - file: '', - invoice: null, - buys: [] - }; - } - - onFileChange($event) { - const input = $event.target; - const file = input.files[0]; - - const reader = new FileReader(); - reader.onload = event => - this.fillData(event.target.result); - reader.readAsText(file, 'UTF-8'); - } - - fillData(raw) { - const data = JSON.parse(raw); - const [invoice] = data.invoices; - - this.$.$applyAsync(() => { - this.import.observation = invoice.tx_awb; - - const companyName = invoice.tx_company; - const boxes = invoice.boxes; - const buys = []; - for (let box of boxes) { - const boxVolume = box.nu_length * box.nu_width * box.nu_height; - for (let product of box.products) { - const packing = product.nu_stems_bunch * product.nu_bunches; - buys.push({ - description: product.nm_product, - companyName: companyName, - size: product.nu_length, - packing: packing, - grouping: product.nu_stems_bunch, - buyingValue: parseFloat(product.mny_rate_stem), - volume: boxVolume, - }); - } - } - - const boxesId = boxes.map(box => box.id_box); - this.import.ref = boxesId.join(', '); - - this.fetchBuys(buys); - }); - } - - fetchBuys(buys) { - const params = {buys}; - const query = `Entries/${this.$params.id}/importBuysPreview`; - this.$http.post(query, params).then(res => { - this.import.buys = res.data; - }); - } - - onSubmit() { - try { - const params = this.import; - const hasAnyEmptyRow = params.buys.some(buy => { - return buy.itemFk == null; - }); - - if (hasAnyEmptyRow) - throw new Error(`Some of the imported buys doesn't have an item`); - - const query = `Entries/${this.$params.id}/importBuys`; - return this.$http.post(query, params) - .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))) - .then(() => this.$state.go('entry.card.buy.index')); - } catch (e) { - this.vnApp.showError(this.$t(e.message)); - return false; - } - } - - itemSearchFunc($search) { - return /^\d+$/.test($search) - ? {id: $search} - : {name: {like: '%' + $search + '%'}}; - } - - showFilterDialog(buy) { - this.activeBuy = buy; - this.itemFilterParams = {}; - this.itemFilter = { - include: [ - { - relation: 'producer', - scope: { - fields: ['name'] - } - }, - { - relation: 'ink', - scope: { - fields: ['name'] - } - } - ] - }; - - this.$.filterDialog.show(); - } - - selectItem(id) { - this.activeBuy['itemFk'] = id; - this.$.filterDialog.hide(); - } - - filter() { - const filter = this.itemFilter; - const params = this.itemFilterParams; - const where = {}; - - for (let key in params) { - const value = params[key]; - if (!value) continue; - - switch (key) { - case 'name': - where[key] = {like: `%${value}%`}; - break; - case 'producerFk': - case 'typeFk': - case 'size': - case 'inkFk': - where[key] = value; - } - } - - filter.where = where; - this.$.itemsModel.applyFilter(filter); - } - - onKeyPress($event) { - if ($event.key === 'Enter') - this.filter(); - } -} - -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnEntryBuyImport', { - template: require('./index.html'), - controller: Controller, - bindings: { - worker: '<' - } -}); diff --git a/modules/entry/front/buy/import/index.spec.js b/modules/entry/front/buy/import/index.spec.js deleted file mode 100644 index 036f52074..000000000 --- a/modules/entry/front/buy/import/index.spec.js +++ /dev/null @@ -1,199 +0,0 @@ -import './index.js'; - -describe('Entry', () => { - describe('Component vnEntryBuyImport', () => { - let controller; - let $httpParamSerializer; - let $httpBackend; - - beforeEach(ngModule('entry')); - - beforeEach(angular.mock.inject(($componentController, $compile, $rootScope, _$httpParamSerializer_, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - $httpParamSerializer = _$httpParamSerializer_; - let $element = $compile(' { - it(`should call to the fillData() method`, () => { - controller.fetchBuys = jest.fn(); - - const rawData = `{ - "invoices": [ - { - "tx_awb": "123456", - "boxes": [ - { - "id_box": 1, - "nu_length": 1, - "nu_width": 15, - "nu_height": 80, - "products": [ - { - "nm_product": "Bow", - "nu_length": 1, - "nu_stems_bunch": 1, - "nu_bunches": 1, - "mny_rate_stem": 5.77 - } - - ] - }, - { - "id_box": 2, - "nu_length": 25, - "nu_width": 1, - "nu_height": 45, - "products": [ - { - "nm_product": "Arrow", - "nu_length": 25, - "nu_stems_bunch": 1, - "nu_bunches": 1, - "mny_rate_stem": 2.16 - } - ] - } - ] - } - ]}`; - const expectedBuys = [ - { - 'buyingValue': 5.77, - 'description': 'Bow', - 'grouping': 1, - 'packing': 1, - 'size': 1, - 'volume': 1200}, - - { - 'buyingValue': 2.16, - 'description': 'Arrow', - 'grouping': 1, - 'packing': 1, - 'size': 25, - 'volume': 1125} - ]; - controller.fillData(rawData); - controller.$.$apply(); - - const importData = controller.import; - - expect(importData.observation).toEqual('123456'); - expect(importData.ref).toEqual('1, 2'); - - expect(controller.fetchBuys).toHaveBeenCalledWith(expectedBuys); - }); - }); - - describe('fetchBuys()', () => { - it(`should perform a query to fetch the buys data`, () => { - const buys = [ - { - 'buyingValue': 5.77, - 'description': 'Bow', - 'grouping': 1, - 'packing': 1, - 'size': 1, - 'volume': 1200}, - - { - 'buyingValue': 2.16, - 'description': 'Arrow', - 'grouping': 1, - 'packing': 1, - 'size': 25, - 'volume': 1125} - ]; - - const query = `Entries/1/importBuysPreview`; - $httpBackend.expectPOST(query).respond(200, buys); - controller.fetchBuys(buys); - $httpBackend.flush(); - - const importData = controller.import; - - expect(importData.buys.length).toEqual(2); - }); - }); - - describe('onSubmit()', () => { - it(`should throw an error when some of the rows doesn't have an item`, () => { - jest.spyOn(controller.vnApp, 'showError'); - - controller.import = { - observation: '123456', - ref: '1, 2', - buys: [ - { - 'buyingValue': 5.77, - 'description': 'Bow', - 'grouping': 1, - 'packing': 1, - 'size': 1, - 'volume': 1200}, - { - 'buyingValue': 2.16, - 'description': 'Arrow', - 'grouping': 1, - 'packing': 1, - 'size': 25, - 'volume': 1125} - ] - }; - - controller.onSubmit(); - - const message = `Some of the imported buys doesn't have an item`; - - expect(controller.vnApp.showError).toHaveBeenCalledWith(message); - }); - - it(`should now perform a query to update columns`, () => { - jest.spyOn(controller.vnApp, 'showSuccess'); - controller.$state.go = jest.fn(); - - controller.import = { - observation: '123456', - ref: '1, 2', - buys: [ - { - 'itemFk': 10, - 'buyingValue': 5.77, - 'description': 'Bow', - 'grouping': 1, - 'packing': 1, - 'size': 1, - 'volume': 1200}, - { - 'itemFk': 11, - 'buyingValue': 2.16, - 'description': 'Arrow', - 'grouping': 1, - 'packing': 1, - 'size': 25, - 'volume': 1125} - ] - }; - const params = controller.import; - - const query = `Entries/1/importBuys`; - $httpBackend.expectPOST(query, params).respond(200, params.buys); - controller.onSubmit(); - $httpBackend.flush(); - - const importData = controller.import; - - expect(importData.buys.length).toEqual(2); - - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); - expect(controller.$state.go).toHaveBeenCalledWith('entry.card.buy.index'); - }); - }); - }); -}); diff --git a/modules/entry/front/buy/import/style.scss b/modules/entry/front/buy/import/style.scss deleted file mode 100644 index 9b2fb7688..000000000 --- a/modules/entry/front/buy/import/style.scss +++ /dev/null @@ -1,5 +0,0 @@ -.itemFilter { - vn-table.scrollable { - height: 500px - } -} \ No newline at end of file diff --git a/modules/entry/front/buy/index/index.html b/modules/entry/front/buy/index/index.html deleted file mode 100644 index 0e0c69788..000000000 --- a/modules/entry/front/buy/index/index.html +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - -
- - - - - - -

Subtotal {{$ctrl.ticket.totalWithoutVat | currency: 'EUR':2}}

-

VAT {{$ctrl.ticket.totalWithVat - $ctrl.ticket.totalWithoutVat | currency: 'EUR':2}}

-

Total {{$ctrl.ticket.totalWithVat | currency: 'EUR':2}}

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - ItemQuantityPackageStickersWeightPackingGroupingBuying valueGrouping pricePacking priceImport
- - - - - {{::buy.item.id}} - - - -
{{::name}}
-
#{{::id}}
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{buy.quantity * buy.buyingValue | currency: 'EUR':2}} - -
- - - {{::buy.item.itemType.code}} - - - - {{::buy.item.size}} - - - - {{::buy.item.minPrice | currency: 'EUR':2}} - - -
- {{::buy.item.name}} - -

{{::buy.item.subName}}

-
-
- - -
-
-
-
-
- - - - - - -
- - - - diff --git a/modules/entry/front/buy/index/index.js b/modules/entry/front/buy/index/index.js deleted file mode 100644 index 9131c31f6..000000000 --- a/modules/entry/front/buy/index/index.js +++ /dev/null @@ -1,81 +0,0 @@ -import ngModule from '../../module'; -import './style.scss'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - saveBuy(buy) { - const missingData = !buy.itemFk || !buy.quantity || !buy.packagingFk; - if (missingData) return; - - let options; - if (buy.id) { - options = { - query: `Buys/${buy.id}`, - method: 'patch' - }; - } - this.$http[options.method](options.query, buy).then(res => { - if (!res.data) return; - - buy = Object.assign(buy, res.data); - this.vnApp.showSuccess(this.$t('Data saved!')); - }); - } - - /** - * Returns checked instances - * - * @return {Array} Checked instances - */ - selectedBuys() { - if (!this.buys) return; - - return this.buys.filter(buy => { - return buy.checked; - }); - } - - deleteBuys() { - const buys = this.selectedBuys(); - const actualInstances = buys.filter(buy => buy.id); - - const params = {buys: actualInstances}; - - if (actualInstances.length) { - this.$http.post(`Buys/deleteBuys`, params).then(() => { - this.vnApp.showSuccess(this.$t('Data saved!')); - }); - } - buys.forEach(buy => { - const index = this.buys.indexOf(buy); - this.buys.splice(index, 1); - }); - } - - toggleGroupingMode(buy, mode) { - const groupingMode = mode === 'grouping' ? mode : 'packing'; - const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode; - const params = { - groupingMode: newGroupingMode - }; - - this.$http.patch(`Buys/${buy.id}`, params).then(() => { - buy.groupingMode = newGroupingMode; - this.vnApp.showSuccess(this.$t('Data saved!')); - }); - } - - itemSearchFunc($search) { - return /^\d+$/.test($search) - ? {id: $search} - : {name: {like: '%' + $search + '%'}}; - } -} - -ngModule.vnComponent('vnEntryBuyIndex', { - template: require('./index.html'), - controller: Controller, - bindings: { - entry: '<' - } -}); diff --git a/modules/entry/front/buy/index/index.spec.js b/modules/entry/front/buy/index/index.spec.js deleted file mode 100644 index f5c6d1bdb..000000000 --- a/modules/entry/front/buy/index/index.spec.js +++ /dev/null @@ -1,92 +0,0 @@ -/* eslint max-len: ["error", { "code": 150 }]*/ -import './index.js'; - -describe('Entry buy', () => { - let controller; - let $httpBackend; - - beforeEach(ngModule('entry')); - - beforeEach(angular.mock.inject(($componentController, $compile, $rootScope, _$httpParamSerializer_, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - let $element = $compile(' { - it(`should call the buys patch route if the received buy has an ID`, () => { - const buy = {id: 1, itemFk: 1, quantity: 1, packagingFk: 1}; - - const query = `Buys/${buy.id}`; - - $httpBackend.expectPATCH(query).respond(200); - controller.saveBuy(buy); - $httpBackend.flush(); - }); - }); - - describe('deleteBuys()', () => { - it(`should perform no queries if all buys to delete were not actual instances`, () => { - controller.buys = [ - {checked: true}, - {checked: true}, - {checked: false}]; - - controller.deleteBuys(); - - expect(controller.buys.length).toEqual(1); - }); - - it(`should perform a query to delete as there's an actual instance at least`, () => { - controller.buys = [ - {checked: true, id: 1}, - {checked: true}, - {checked: false}]; - - const query = 'Buys/deleteBuys'; - - $httpBackend.expectPOST(query).respond(200); - controller.deleteBuys(); - $httpBackend.flush(); - - expect(controller.buys.length).toEqual(1); - }); - }); - - describe('toggleGroupingMode()', () => { - it(`should toggle grouping mode from grouping to packing`, () => { - const buy = {id: 999, groupingMode: 'grouping'}; - - const query = `Buys/${buy.id}`; - $httpBackend.expectPATCH(query, {groupingMode: 'packing'}).respond(200); - controller.toggleGroupingMode(buy, 'packing'); - $httpBackend.flush(); - }); - - it(`should toggle grouping mode from packing to grouping`, () => { - const buy = {id: 999, groupingMode: 'packing'}; - const query = `Buys/${buy.id}`; - $httpBackend.expectPATCH(query, {groupingMode: 'grouping'}).respond(200); - controller.toggleGroupingMode(buy, 'grouping'); - $httpBackend.flush(); - }); - - it(`should toggle off the grouping mode if it was packing to packing`, () => { - const buy = {id: 999, groupingMode: 'packing'}; - const query = `Buys/${buy.id}`; - $httpBackend.expectPATCH(query, {groupingMode: null}).respond(200); - controller.toggleGroupingMode(buy, 'packing'); - $httpBackend.flush(); - }); - - it(`should toggle off the grouping mode if it was grouping to grouping`, () => { - const buy = {id: 999, groupingMode: 'grouping'}; - const query = `Buys/${buy.id}`; - $httpBackend.expectPATCH(query, {groupingMode: null}).respond(200); - controller.toggleGroupingMode(buy, 'grouping'); - $httpBackend.flush(); - }); - }); -}); diff --git a/modules/entry/front/buy/index/locale/es.yml b/modules/entry/front/buy/index/locale/es.yml deleted file mode 100644 index 0a1ecf5b1..000000000 --- a/modules/entry/front/buy/index/locale/es.yml +++ /dev/null @@ -1,3 +0,0 @@ -Buys: Compras -Delete buy(s): Eliminar compra(s) -Add buy: Añadir compra \ No newline at end of file diff --git a/modules/entry/front/buy/index/style.scss b/modules/entry/front/buy/index/style.scss deleted file mode 100644 index 3fad252df..000000000 --- a/modules/entry/front/buy/index/style.scss +++ /dev/null @@ -1,42 +0,0 @@ -@import "variables"; - - -vn-entry-buy-index vn-card { - max-width: $width-xl; - - .dark-row { - background-color: lighten($color-marginal, 10%); - } - - thead tr { - border: 1px solid white;; - } - - tbody tr:nth-child(1), - tbody tr:nth-child(2) { - border-left: 1px solid $color-spacer; - border-right: 1px solid $color-spacer; - } - - tbody tr:nth-child(2) { - border-bottom: 1px solid $color-spacer; - } - - tbody{ - border-bottom: 1px solid $color-spacer; - } - - tbody:last-child { - border-bottom: 0; - } - - tbody tr:nth-child(3) { - height: inherit - } - - tr { - margin-bottom: 10px; - } -} - -$color-font-link-medium: lighten($color-font-link, 20%) diff --git a/modules/entry/front/buy/locale/es.yml b/modules/entry/front/buy/locale/es.yml deleted file mode 100644 index 55828a3c6..000000000 --- a/modules/entry/front/buy/locale/es.yml +++ /dev/null @@ -1,8 +0,0 @@ -reference: Referencia -Observation: Observación -Box: Embalaje -Import buys: Importar compras -Some of the imported buys doesn't have an item: Algunas de las compras importadas no tienen un artículo -JSON files only: Solo ficheros JSON -Filter item: Filtrar artículo -Filter...: Filtrar... \ No newline at end of file diff --git a/modules/entry/front/card/index.html b/modules/entry/front/card/index.html deleted file mode 100644 index d386a9ebf..000000000 --- a/modules/entry/front/card/index.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/modules/entry/front/card/index.js b/modules/entry/front/card/index.js deleted file mode 100644 index 96f4702e2..000000000 --- a/modules/entry/front/card/index.js +++ /dev/null @@ -1,59 +0,0 @@ -import ngModule from '../module'; -import ModuleCard from 'salix/components/module-card'; - -class Controller extends ModuleCard { - reload() { - let filter = { - include: [ - { - relation: 'company', - scope: { - fields: ['id', 'code'] - } - }, - { - relation: 'travel', - scope: { - fields: ['id', 'landed', 'agencyModeFk', 'warehouseOutFk'], - include: [ - { - relation: 'agency', - scope: { - fields: ['name'] - } - }, - { - relation: 'warehouseOut', - scope: { - fields: ['name'] - } - }, - { - relation: 'warehouseIn', - scope: { - fields: ['name'] - } - } - ] - } - }, - { - relation: 'supplier', - scope: { - fields: ['id', 'nickname'] - } - }, - { - relation: 'currency' - } - ] - }; - this.$http.get(`Entries/${this.$params.id}`, {filter}) - .then(response => this.entry = response.data); - } -} - -ngModule.vnComponent('vnEntryCard', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/entry/front/create/index.html b/modules/entry/front/create/index.html deleted file mode 100644 index e1e4dc064..000000000 --- a/modules/entry/front/create/index.html +++ /dev/null @@ -1,69 +0,0 @@ - - -
- - - - - - -
{{::nickname}}
-
#{{::id}}
-
-
-
- - - -
- {{::agencyModeName}} - - {{::warehouseInName}} ({{::shipped | date: 'dd/MM/yyyy'}}) - → {{::warehouseOutName}} ({{::landed | date: 'dd/MM/yyyy'}}) -
-
#{{::id}}
-
-
-
- - - - -
- - - - - - -
diff --git a/modules/entry/front/create/index.js b/modules/entry/front/create/index.js deleted file mode 100644 index 5c61730f9..000000000 --- a/modules/entry/front/create/index.js +++ /dev/null @@ -1,43 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - - this.entry = { - companyFk: this.vnConfig.companyFk - }; - - if (this.$params && this.$params.supplierFk) - this.entry.supplierFk = parseInt(this.$params.supplierFk); - if (this.$params && this.$params.travelFk) - this.entry.travelFk = parseInt(this.$params.travelFk); - if (this.$params && this.$params.companyFk) - this.entry.companyFk = parseInt(this.$params.companyFk); - } - - onSubmit() { - this.$.watcher.submit().then( - res => this.$state.go('entry.card.basicData', {id: res.data.id}) - ); - } - - searchFunction($search) { - return {or: [ - {'agencyModeName': {like: `%${$search}%`}}, - {'warehouseInName': {like: `%${$search}%`}}, - {'warehouseOutName': {like: `%${$search}%`}}, - {'shipped': new Date($search)}, - {'landed': new Date($search)} - ]}; - } -} - -Controller.$inject = ['$element', '$scope']; - -ngModule.vnComponent('vnEntryCreate', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/entry/front/create/locale/es.yml b/modules/entry/front/create/locale/es.yml deleted file mode 100644 index aa269ed15..000000000 --- a/modules/entry/front/create/locale/es.yml +++ /dev/null @@ -1,2 +0,0 @@ -New entry: Nueva entrada -Required fields (*): Campos requeridos (*) \ No newline at end of file diff --git a/modules/entry/front/create/style.scss b/modules/entry/front/create/style.scss deleted file mode 100644 index 2dc52b1ff..000000000 --- a/modules/entry/front/create/style.scss +++ /dev/null @@ -1,10 +0,0 @@ -vn-entry-create { - vn-card { - position: relative - } - vn-icon[icon="info"] { - position: absolute; - top: 16px; - right: 16px - } -} \ No newline at end of file diff --git a/modules/entry/front/descriptor-popover/index.html b/modules/entry/front/descriptor-popover/index.html deleted file mode 100644 index 465a9bf51..000000000 --- a/modules/entry/front/descriptor-popover/index.html +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/modules/entry/front/descriptor-popover/index.js b/modules/entry/front/descriptor-popover/index.js deleted file mode 100644 index d79aed03e..000000000 --- a/modules/entry/front/descriptor-popover/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import ngModule from '../module'; -import DescriptorPopover from 'salix/components/descriptor-popover'; - -class Controller extends DescriptorPopover {} - -ngModule.vnComponent('vnEntryDescriptorPopover', { - slotTemplate: require('./index.html'), - controller: Controller -}); diff --git a/modules/entry/front/descriptor/index.html b/modules/entry/front/descriptor/index.html deleted file mode 100644 index 7b61a0cf5..000000000 --- a/modules/entry/front/descriptor/index.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - Show entry report - - - -
- - - - - - -
-
- - - - -
- -
-
- - - \ No newline at end of file diff --git a/modules/entry/front/descriptor/index.js b/modules/entry/front/descriptor/index.js deleted file mode 100644 index 3452a6d34..000000000 --- a/modules/entry/front/descriptor/index.js +++ /dev/null @@ -1,99 +0,0 @@ -import ngModule from '../module'; -import Descriptor from 'salix/components/descriptor'; - -class Controller extends Descriptor { - get entry() { - return this.entity; - } - - set entry(value) { - this.entity = value; - } - - get travelFilter() { - let travelFilter; - const entryTravel = this.entry && this.entry.travel; - - if (entryTravel && entryTravel.agencyModeFk) { - travelFilter = this.entry && JSON.stringify({ - agencyModeFk: entryTravel.agencyModeFk - }); - } - return travelFilter; - } - - get entryFilter() { - let entryTravel = this.entry && this.entry.travel; - - if (!entryTravel || !entryTravel.landed) return null; - - const date = new Date(entryTravel.landed); - date.setHours(0, 0, 0, 0); - - const from = new Date(date.getTime()); - from.setDate(from.getDate() - 10); - - const to = new Date(date.getTime()); - to.setDate(to.getDate() + 10); - - return JSON.stringify({ - supplierFk: this.entry.supplierFk, - from, - to - }); - } - - loadData() { - const filter = { - include: [ - { - relation: 'travel', - scope: { - fields: ['id', 'landed', 'agencyModeFk', 'warehouseOutFk'], - include: [ - { - relation: 'agency', - scope: { - fields: ['name'] - } - }, - { - relation: 'warehouseOut', - scope: { - fields: ['name'] - } - }, - { - relation: 'warehouseIn', - scope: { - fields: ['name'] - } - } - ] - } - }, - { - relation: 'supplier', - scope: { - fields: ['id', 'nickname'] - } - } - ] - }; - - return this.getData(`Entries/${this.id}`, {filter}) - .then(res => this.entity = res.data); - } - - showEntryReport() { - this.vnReport.show(`Entries/${this.id}/entry-order-pdf`); - } -} - -ngModule.vnComponent('vnEntryDescriptor', { - template: require('./index.html'), - controller: Controller, - bindings: { - entry: '<' - } -}); diff --git a/modules/entry/front/descriptor/index.spec.js b/modules/entry/front/descriptor/index.spec.js deleted file mode 100644 index 714bb9f3c..000000000 --- a/modules/entry/front/descriptor/index.spec.js +++ /dev/null @@ -1,40 +0,0 @@ -import './index.js'; - -describe('Entry Component vnEntryDescriptor', () => { - let $httpBackend; - let controller; - const entry = {id: 2}; - - beforeEach(ngModule('entry')); - - beforeEach(inject(($componentController, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - controller = $componentController('vnEntryDescriptor', {$element: null}, {entry}); - })); - - describe('showEntryReport()', () => { - it('should open a new window showing a delivery note PDF document', () => { - jest.spyOn(controller.vnReport, 'show'); - - window.open = jasmine.createSpy('open'); - controller.showEntryReport(); - const expectedPath = `Entries/${entry.id}/entry-order-pdf`; - - expect(controller.vnReport.show).toHaveBeenCalledWith(expectedPath); - }); - }); - - describe('loadData()', () => { - it('should perform ask for the entry', () => { - let query = `Entries/${entry.id}`; - jest.spyOn(controller, 'getData'); - - $httpBackend.expectGET(query).respond(); - controller.loadData(); - $httpBackend.flush(); - - expect(controller.getData).toHaveBeenCalledTimes(1); - expect(controller.getData).toHaveBeenCalledWith(query, jasmine.any(Object)); - }); - }); -}); diff --git a/modules/entry/front/descriptor/locale/es.yml b/modules/entry/front/descriptor/locale/es.yml deleted file mode 100644 index ad2fef6f3..000000000 --- a/modules/entry/front/descriptor/locale/es.yml +++ /dev/null @@ -1,7 +0,0 @@ -Reference: Referencia -Supplier card: Ficha del proveedor -All travels with current agency: Todos los envios con la agencia actual -All entries with current supplier: Todas las entradas con el proveedor actual -Show entry report: Ver informe del pedido -Is inventory entry: Es una entrada de inventario -Is virtual entry: Es una redada \ No newline at end of file diff --git a/modules/entry/front/index.js b/modules/entry/front/index.js index 88700b166..f4cae889c 100644 --- a/modules/entry/front/index.js +++ b/modules/entry/front/index.js @@ -1,18 +1,4 @@ export * from './module'; -import './main'; import './index/'; -import './create'; -import './basic-data'; -import './latest-buys'; -import './search-panel'; -import './latest-buys-search-panel'; -import './descriptor'; -import './descriptor-popover'; -import './card'; -import './note'; -import './summary'; -import './log'; -import './buy/index'; -import './buy/import'; diff --git a/modules/entry/front/index/locale/es.yml b/modules/entry/front/index/locale/es.yml deleted file mode 100644 index cebe57a42..000000000 --- a/modules/entry/front/index/locale/es.yml +++ /dev/null @@ -1,17 +0,0 @@ -Inventory entry: Es inventario -Virtual entry: Es una redada -Supplier: Proveedor -Currency: Moneda -Company: Empresa -Confirmed: Confirmada -Ordered: Pedida -Is raid: Redada -Commission: Comisión -Landed: F. entrega -Reference: Referencia -Created: Creado -Booked: Contabilizada -Is inventory: Inventario -Status: Estado -Selection: Selección -Invoice number: Núm. factura \ No newline at end of file diff --git a/modules/entry/front/latest-buys-search-panel/index.html b/modules/entry/front/latest-buys-search-panel/index.html deleted file mode 100644 index c73bf7365..000000000 --- a/modules/entry/front/latest-buys-search-panel/index.html +++ /dev/null @@ -1,242 +0,0 @@ - - - - - - - - - - - - - - - - - - -
{{name}}
-
- {{category.name}} -
> -
-
- - - - - {{name}}: {{nickname}} - - - - - - - - - - - - - - - - - - Tags - - - - - - - - - - - - - -
- - Id/Name: {{$ctrl.filter.search}} - - - {{category.selection.name}} - - - {{type.selection.name}} - - - Sales person: {{salesPerson.selection.nickname}} - - - Supplier: {{supplier.selection.name}} - - - From: {{$ctrl.filter.from | date:'dd/MM/yyyy'}} - - - To: {{$ctrl.filter.to | date:'dd/MM/yyyy'}} - - - Active: {{$ctrl.filter.active ? '✓' : '✗'}} - - - Floramondo: {{$ctrl.filter.floramondo ? '✓' : '✗'}} - - - Visible: {{$ctrl.filter.visible ? '✓' : '✗'}} - - - {{$ctrl.showTagInfo(chipTag)}} - - -
-
diff --git a/modules/entry/front/latest-buys-search-panel/index.js b/modules/entry/front/latest-buys-search-panel/index.js deleted file mode 100644 index 4078580ea..000000000 --- a/modules/entry/front/latest-buys-search-panel/index.js +++ /dev/null @@ -1,61 +0,0 @@ -import ngModule from '../module'; -import SearchPanel from 'core/components/searchbar/search-panel'; -import './style.scss'; - -class Controller extends SearchPanel { - constructor($element, $) { - super($element, $); - } - - $onInit() { - this.filter = { - isActive: true, - tags: [] - }; - } - - changeCategory(id) { - if (this.filter.categoryFk != id) { - this.filter.categoryFk = id; - this.addFilters(); - } - } - - removeItemFilter(param) { - this.filter[param] = null; - if (param == 'categoryFk') this.filter['typeFk'] = null; - this.addFilters(); - } - - removeTag(tag) { - const index = this.filter.tags.indexOf(tag); - if (index > -1) this.filter.tags.splice(index, 1); - this.addFilters(); - } - - onKeyPress($event) { - if ($event.key === 'Enter') - this.addFilters(); - } - - addFilters() { - for (let i = 0; i < this.filter.tags.length; i++) { - if (!this.filter.tags[i].value) - this.filter.tags.splice(i, 1); - } - return this.model.addFilter({}, this.filter); - } - - showTagInfo(itemTag) { - if (!itemTag.tagFk) return itemTag.value; - return `${this.tags.find(tag => tag.id == itemTag.tagFk).name}: ${itemTag.value}`; - } -} - -ngModule.component('vnLatestBuysSearchPanel', { - template: require('./index.html'), - controller: Controller, - bindings: { - model: '<' - } -}); diff --git a/modules/entry/front/latest-buys-search-panel/index.spec.js b/modules/entry/front/latest-buys-search-panel/index.spec.js deleted file mode 100644 index c3c5acbfb..000000000 --- a/modules/entry/front/latest-buys-search-panel/index.spec.js +++ /dev/null @@ -1,56 +0,0 @@ -import './index.js'; - -describe('Entry', () => { - describe('Component vnLatestBuysSearchPanel', () => { - let $element; - let controller; - - beforeEach(ngModule('entry')); - - beforeEach(angular.mock.inject($componentController => { - $element = angular.element(``); - controller = $componentController('vnLatestBuysSearchPanel', {$element}); - controller.model = {addFilter: () => {}}; - })); - - describe('removeItemFilter()', () => { - it(`should remove param from filter`, () => { - controller.filter = {tags: [], categoryFk: 1, typeFk: 1}; - const expectFilter = {tags: [], categoryFk: null, typeFk: null}; - - controller.removeItemFilter('categoryFk'); - - expect(controller.filter).toEqual(expectFilter); - }); - }); - - describe('removeTag()', () => { - it(`should remove tag from filter`, () => { - const tag = {tagFk: 1, value: 'Value'}; - controller.filter = {tags: [tag]}; - const expectFilter = {tags: []}; - - controller.removeTag(tag); - - expect(controller.filter).toEqual(expectFilter); - }); - }); - - describe('showTagInfo()', () => { - it(`should show tag value`, () => { - const tag = {value: 'Value'}; - const result = controller.showTagInfo(tag); - - expect(result).toEqual('Value'); - }); - - it(`should show tag name and value`, () => { - const tag = {tagFk: 1, value: 'Value'}; - controller.tags = [{id: 1, name: 'tagName'}]; - const result = controller.showTagInfo(tag); - - expect(result).toEqual('tagName: Value'); - }); - }); - }); -}); diff --git a/modules/entry/front/latest-buys-search-panel/style.scss b/modules/entry/front/latest-buys-search-panel/style.scss deleted file mode 100644 index ec189c7e4..000000000 --- a/modules/entry/front/latest-buys-search-panel/style.scss +++ /dev/null @@ -1,70 +0,0 @@ -@import "variables"; - -vn-latest-buys-search-panel vn-side-menu div { - & > .input { - padding-left: $spacing-md; - padding-right: $spacing-md; - border-color: $color-spacer; - border-bottom: $border-thin; - } - & > .horizontal { - grid-auto-flow: column; - grid-column-gap: $spacing-sm; - align-items: center; - } - & > .checks { - padding: $spacing-md; - flex-wrap: wrap; - border-color: $color-spacer; - border-bottom: $border-thin; - } - & > .tags { - padding: $spacing-md; - padding-bottom: 0%; - padding-top: 0%; - align-items: center; - } - & > .chips { - display: flex; - flex-wrap: wrap; - padding: $spacing-md; - overflow: hidden; - max-width: 100%; - border-color: $color-spacer; - border-top: $border-thin; - } - & > .item-category { - padding: $spacing-sm; - justify-content: flex-start; - align-items: flex-start; - flex-wrap: wrap; - - vn-autocomplete[vn-id="category"] { - display: none; - } - - & > vn-one { - padding: $spacing-sm; - min-width: 33.33%; - text-align: center; - box-sizing: border-box; - - & > vn-icon { - padding: $spacing-sm; - background-color: $color-font-secondary; - border-radius: 50%; - cursor: pointer; - - &.active { - background-color: $color-main; - color: #fff; - } - & > i:before { - font-size: 2.6rem; - width: 16px; - height: 16px; - } - } - } - } -} diff --git a/modules/entry/front/latest-buys/index.html b/modules/entry/front/latest-buys/index.html deleted file mode 100644 index 2e6de83b9..000000000 --- a/modules/entry/front/latest-buys/index.html +++ /dev/null @@ -1,267 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - Picture - Item ID - - Packing - - Grouping - - Quantity - - Description - - Size - - Tags - - Type - - Intrastat - - Origin - - Weight/Piece - - Active - - Family - - Entry - - Buying value - - Freight value - - Commission value - - Package value - - Is ignored - - Grouping - - Packing - - Min - - Ekt - - Weight - - Package - - Package out - - Landing -
- - - - - - - {{::buy.itemFk}} - - - - {{::buy.packing | dashIfEmpty}} - - - - {{::buy.grouping | dashIfEmpty}} - - {{::buy.quantity}} - {{::buy.description | dashIfEmpty}} - {{::buy.size}} -
- {{::buy.name}} - -

{{::buy.subName}}

-
-
- - -
- {{::buy.code}} - - {{::buy.intrastat}} - {{::buy.origin}}{{::buy.weightByPiece}} - - - {{::buy.family}} - - {{::buy.entryFk}} - - {{::buy.buyingValue | currency: 'EUR':3}}{{::buy.freightValue | currency: 'EUR':3}}{{::buy.comissionValue | currency: 'EUR':3}}{{::buy.packageValue | currency: 'EUR':3}} - - - {{::buy.price2 | currency: 'EUR':3}}{{::buy.price3 | currency: 'EUR':3}}{{::buy.minPrice | currency: 'EUR':3}}{{::buy.ektFk | dashIfEmpty}}{{::buy.weight}}{{::buy.packagingFk}}{{::buy.packingOut}}{{::buy.landing | date: 'dd/MM/yyyy'}}
-
-
-
-
- - - - -
- - - Edit - - {{::$ctrl.totalChecked}} - - buy(s) - - - - - - - - - - - - - - - - diff --git a/modules/entry/front/latest-buys/index.js b/modules/entry/front/latest-buys/index.js deleted file mode 100644 index 292c5b805..000000000 --- a/modules/entry/front/latest-buys/index.js +++ /dev/null @@ -1,209 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -export default class Controller extends Section { - constructor($element, $) { - super($element, $); - this.editedColumn; - this.checkAll = false; - this.checkedBuys = []; - - this.smartTableOptions = { - activeButtons: { - search: true, - shownColumns: true, - }, - columns: [ - { - field: 'code', - autocomplete: { - url: 'ItemTypes', - showField: 'code', - valueField: 'code', - } - }, - { - field: 'origin', - autocomplete: { - url: 'Origins', - showField: 'code', - valueField: 'code' - } - }, - { - field: 'family', - autocomplete: { - url: 'ItemFamilies', - valueField: 'code', - showField: 'code' - } - }, - { - field: 'intrastat', - autocomplete: { - url: 'Intrastats', - showField: 'description', - valueField: 'description' - } - }, - { - field: 'packagingFk', - autocomplete: { - url: 'Packagings', - showField: 'id' - } - }, - { - field: 'isActive', - searchable: false - }, - { - field: 'isIgnored', - searchable: false - }, - { - field: 'landing', - searchable: false - } - ] - }; - } - - get columns() { - if (this._columns) return this._columns; - - this._columns = [ - {field: 'packing', displayName: this.$t('Packing')}, - {field: 'grouping', displayName: this.$t('Grouping')}, - {field: 'packageValue', displayName: this.$t('Package value')}, - {field: 'weight', displayName: this.$t('Weight')}, - {field: 'description', displayName: this.$t('Description')}, - {field: 'size', displayName: this.$t('Size')}, - {field: 'weightByPiece', displayName: this.$t('weight/Piece')}, - {field: 'packingOut', displayName: this.$t('PackingOut')}, - {field: 'landing', displayName: this.$t('Landing')} - ]; - - return this._columns; - } - - get checked() { - const buys = this.$.model.data || []; - const checkedBuys = []; - for (let buy of buys) { - if (buy.checked) - checkedBuys.push(buy); - } - - return checkedBuys; - } - - exprBuilder(param, value) { - switch (param) { - case 'id': - case 'size': - case 'weightByPiece': - case 'isActive': - case 'family': - case 'minPrice': - case 'packingOut': - return {[`i.${param}`]: value}; - case 'name': - case 'description': - return {[`i.${param}`]: {like: `%${value}%`}}; - case 'code': - return {'it.code': value}; - case 'intrastat': - return {'intr.description': value}; - case 'origin': - return {'ori.code': value}; - case 'landing': - return {[`lb.${param}`]: value}; - case 'packing': - case 'grouping': - case 'quantity': - case 'entryFk': - case 'buyingValue': - case 'freightValue': - case 'comissionValue': - case 'packageValue': - case 'isIgnored': - case 'price2': - case 'price3': - case 'ektFk': - case 'weight': - case 'packagingFk': - return {[`b.${param}`]: value}; - } - } - - uncheck() { - this.checkAll = false; - this.checkedBuys = []; - } - - get totalChecked() { - if (this.checkedDummyCount) - return this.checkedDummyCount; - - return this.checked.length; - } - - saveChecked(buyId) { - const index = this.checkedBuys.indexOf(buyId); - if (index !== -1) - return this.checkedBuys.splice(index, 1); - return this.checkedBuys.push(buyId); - } - - reCheck() { - if (!this.$.model.data) return; - if (!this.checkedBuys.length) return; - - this.$.model.data.forEach(buy => { - if (this.checkedBuys.includes(buy.id)) - buy.checked = true; - }); - } - - onEditAccept() { - const rowsToEdit = []; - for (let row of this.checked) - rowsToEdit.push({id: row.id, itemFk: row.itemFk}); - - const data = { - field: this.editedColumn.field, - newValue: this.editedColumn.newValue, - lines: rowsToEdit - }; - - if (this.checkedDummyCount && this.checkedDummyCount > 0) { - const params = {}; - if (this.$.model.userParams) { - const userParams = this.$.model.userParams; - for (let param in userParams) { - let newParam = this.exprBuilder(param, userParams[param]); - if (!newParam) - newParam = {[param]: userParams[param]}; - Object.assign(params, newParam); - } - } - if (this.$.model.userFilter) - Object.assign(params, this.$.model.userFilter.where); - - data.filter = params; - } - - return this.$http.post('Buys/editLatestBuys', data) - .then(() => { - this.uncheck(); - this.$.model.refresh(); - }); - } -} - -ngModule.component('vnEntryLatestBuys', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/entry/front/latest-buys/index.spec.js b/modules/entry/front/latest-buys/index.spec.js deleted file mode 100644 index 6574303fc..000000000 --- a/modules/entry/front/latest-buys/index.spec.js +++ /dev/null @@ -1,100 +0,0 @@ -import './index.js'; - -describe('Entry', () => { - describe('Component vnEntryLatestBuys', () => { - let controller; - let $httpBackend; - - beforeEach(ngModule('entry')); - - beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - const $element = angular.element(' {}}, - edit: {hide: () => {}} - }; - })); - - describe('get columns', () => { - it(`should return a set of columns`, () => { - let result = controller.columns; - - let length = result.length; - let anyColumn = Object.keys(result[Math.floor(Math.random() * Math.floor(length))]); - - expect(anyColumn).toContain('field', 'displayName'); - }); - }); - - describe('get checked', () => { - it(`should return a set of checked lines`, () => { - controller.$.model.data = [ - {checked: true, id: 1}, - {checked: true, id: 2}, - {checked: true, id: 3}, - {checked: false, id: 4}, - ]; - - let result = controller.checked; - - expect(result.length).toEqual(3); - }); - }); - - describe('onEditAccept()', () => { - it(`should perform a query to update columns`, () => { - controller.editedColumn = {field: 'my field', newValue: 'the new value'}; - const query = 'Buys/editLatestBuys'; - - $httpBackend.expectPOST(query).respond(); - controller.onEditAccept(); - $httpBackend.flush(); - - const result = controller.checked; - - expect(result.length).toEqual(0); - }); - }); - - describe('reCheck()', () => { - it(`should recheck buys`, () => { - controller.$.model.data = [ - {checked: false, id: 1}, - {checked: false, id: 2}, - {checked: false, id: 3}, - {checked: false, id: 4}, - ]; - controller.checkedBuys = [1, 2]; - - controller.reCheck(); - - expect(controller.$.model.data[0].checked).toEqual(true); - expect(controller.$.model.data[1].checked).toEqual(true); - expect(controller.$.model.data[2].checked).toEqual(false); - expect(controller.$.model.data[3].checked).toEqual(false); - }); - }); - - describe('saveChecked()', () => { - it(`should check buy`, () => { - const buyCheck = 3; - controller.checkedBuys = [1, 2]; - - controller.saveChecked(buyCheck); - - expect(controller.checkedBuys[2]).toEqual(buyCheck); - }); - - it(`should uncheck buy`, () => { - const buyUncheck = 3; - controller.checkedBuys = [1, 2, 3]; - - controller.saveChecked(buyUncheck); - - expect(controller.checkedBuys[2]).toEqual(undefined); - }); - }); - }); -}); diff --git a/modules/entry/front/latest-buys/locale/en.yml b/modules/entry/front/latest-buys/locale/en.yml deleted file mode 100644 index 48dda861b..000000000 --- a/modules/entry/front/latest-buys/locale/en.yml +++ /dev/null @@ -1,2 +0,0 @@ -Minimun amount: Minimun purchase quantity -PackageName: Package \ No newline at end of file diff --git a/modules/entry/front/latest-buys/locale/es.yml b/modules/entry/front/latest-buys/locale/es.yml deleted file mode 100644 index 795e3f5f4..000000000 --- a/modules/entry/front/latest-buys/locale/es.yml +++ /dev/null @@ -1,19 +0,0 @@ -Edit buy(s): Editar compra(s) -Buying value: Coste -Freight value: Porte -Commission value: Comisión -Package value: Embalaje -Is ignored: Ignorado -Is visible: Visible -Is floramondo: Floramondo -Grouping price: Precio grouping -Packing price: Precio packing -Min price: Precio min -Ekt: Ekt -Weight: Peso -Minimun amount: Cantidad mínima de compra -Field to edit: Campo a editar -PackageName: Cubo -Edit: Editar -buy(s): compra(s) -Package out: Embalaje envíos diff --git a/modules/entry/front/latest-buys/style.scss b/modules/entry/front/latest-buys/style.scss deleted file mode 100644 index a3c399edc..000000000 --- a/modules/entry/front/latest-buys/style.scss +++ /dev/null @@ -1,7 +0,0 @@ -.countLines { - flex: 0.15; - font-size: 24px; - color: orangered; - font-weight: bold; - max-width: 30px; -} diff --git a/modules/entry/front/locale/es.yml b/modules/entry/front/locale/es.yml deleted file mode 100644 index b28cbe735..000000000 --- a/modules/entry/front/locale/es.yml +++ /dev/null @@ -1,6 +0,0 @@ -#Ordenar alfabeticamente - -entry: entrada -Latest buys: Últimas compras - -# Sections diff --git a/modules/entry/front/log/index.html b/modules/entry/front/log/index.html deleted file mode 100644 index fd8ae7c2a..000000000 --- a/modules/entry/front/log/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/modules/entry/front/log/index.js b/modules/entry/front/log/index.js deleted file mode 100644 index 73218f4de..000000000 --- a/modules/entry/front/log/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -ngModule.vnComponent('vnEntryLog', { - template: require('./index.html'), - controller: Section, -}); diff --git a/modules/entry/front/log/locale/es.yml b/modules/entry/front/log/locale/es.yml deleted file mode 100644 index 094615b47..000000000 --- a/modules/entry/front/log/locale/es.yml +++ /dev/null @@ -1 +0,0 @@ -Date: Fecha \ No newline at end of file diff --git a/modules/entry/front/main/index.html b/modules/entry/front/main/index.html deleted file mode 100644 index d55fbd60b..000000000 --- a/modules/entry/front/main/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/modules/entry/front/main/index.js b/modules/entry/front/main/index.js deleted file mode 100644 index 69bddc7fc..000000000 --- a/modules/entry/front/main/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import ngModule from '../module'; -import ModuleMain from 'salix/components/module-main'; - -export default class Entry extends ModuleMain { - -} - -ngModule.vnComponent('vnEntry', { - controller: Entry, - template: require('./index.html') -}); diff --git a/modules/entry/front/note/index.html b/modules/entry/front/note/index.html deleted file mode 100644 index 5f3c7f77e..000000000 --- a/modules/entry/front/note/index.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/modules/entry/front/note/index.js b/modules/entry/front/note/index.js deleted file mode 100644 index fccd60913..000000000 --- a/modules/entry/front/note/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -class Controller extends Section { - onSubmit() { - this.$.watcher.check(); - this.$.model.save().then(() => { - this.$.watcher.notifySaved(); - this.$.watcher.updateOriginalData(); - }); - } -} - -ngModule.vnComponent('vnEntryObservation', { - template: require('./index.html'), - controller: Controller, - bindings: { - entry: '<' - } -}); diff --git a/modules/entry/front/routes.json b/modules/entry/front/routes.json index 3934a96ee..53c599cf1 100644 --- a/modules/entry/front/routes.json +++ b/modules/entry/front/routes.json @@ -8,12 +8,6 @@ "main": [ {"state": "entry.index", "icon": "icon-entry"}, {"state": "entry.latestBuys", "icon": "contact_support"} - ], - "card": [ - {"state": "entry.card.basicData", "icon": "settings"}, - {"state": "entry.card.buy.index", "icon": "icon-lines"}, - {"state": "entry.card.observation", "icon": "insert_drive_file"}, - {"state": "entry.card.log", "icon": "history"} ] }, "keybindings": [ @@ -33,90 +27,6 @@ "component": "vn-entry-index", "description": "Entries", "acl": ["buyer", "administrative"] - }, - { - "url": "/latest-buys?q", - "state": "entry.latestBuys", - "component": "vn-entry-latest-buys", - "description": "Latest buys", - "acl": ["buyer", "administrative"] - }, - { - "url": "/create?supplierFk&travelFk&companyFk", - "state": "entry.create", - "component": "vn-entry-create", - "description": "New entry", - "acl": ["buyer", "administrative"] - }, - { - "url": "/:id", - "state": "entry.card", - "abstract": true, - "component": "vn-entry-card" - }, - { - "url": "/summary", - "state": "entry.card.summary", - "component": "vn-entry-summary", - "description": "Summary", - "params": { - "entry": "$ctrl.entry" - }, - "acl": ["buyer", "administrative"] - }, - { - "url": "/basic-data", - "state": "entry.card.basicData", - "component": "vn-entry-basic-data", - "description": "Basic data", - "params": { - "entry": "$ctrl.entry" - }, - "acl": ["buyer", "administrative"] - }, - { - "url": "/observation", - "state": "entry.card.observation", - "component": "vn-entry-observation", - "description": "Notes", - "params": { - "entry": "$ctrl.entry" - }, - "acl": ["buyer", "administrative"] - }, - { - "url" : "/log", - "state": "entry.card.log", - "component": "vn-entry-log", - "description": "Log", - "acl": ["buyer", "administrative"] - }, - { - "url": "/buy", - "state": "entry.card.buy", - "abstract": true, - "component": "ui-view", - "acl": ["buyer"] - }, - { - "url" : "/index", - "state": "entry.card.buy.index", - "component": "vn-entry-buy-index", - "description": "Buys", - "params": { - "entry": "$ctrl.entry" - }, - "acl": ["buyer", "administrative"] - }, - { - "url" : "/import", - "state": "entry.card.buy.import", - "component": "vn-entry-buy-import", - "description": "Import buys", - "params": { - "entry": "$ctrl.entry" - }, - "acl": ["buyer"] } ] -} \ No newline at end of file +} diff --git a/modules/entry/front/search-panel/index.html b/modules/entry/front/search-panel/index.html deleted file mode 100644 index adcb9d6d4..000000000 --- a/modules/entry/front/search-panel/index.html +++ /dev/null @@ -1,100 +0,0 @@ -
-
- - - - - - - - - - - - - - - - - - - - - - - {{name}}: {{nickname}} - - - - - - - - - - - - - - - - - - - - - -
-
\ No newline at end of file diff --git a/modules/entry/front/search-panel/index.js b/modules/entry/front/search-panel/index.js deleted file mode 100644 index e87f31056..000000000 --- a/modules/entry/front/search-panel/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import ngModule from '../module'; -import SearchPanel from 'core/components/searchbar/search-panel'; - -ngModule.vnComponent('vnEntrySearchPanel', { - template: require('./index.html'), - controller: SearchPanel -}); diff --git a/modules/entry/front/search-panel/locale/es.yml b/modules/entry/front/search-panel/locale/es.yml deleted file mode 100644 index 05b71da99..000000000 --- a/modules/entry/front/search-panel/locale/es.yml +++ /dev/null @@ -1,9 +0,0 @@ -Ticket id: Id ticket -Client id: Id cliente -Nickname: Alias -From: Desde -To: Hasta -Agency: Agencia -Warehouse: Almacén -Search entry by id or a suppliers by name or alias: Buscar entrada por id o proveedores por nombre y alias -Invoice number: Núm. factura \ No newline at end of file diff --git a/modules/entry/front/summary/index.html b/modules/entry/front/summary/index.html deleted file mode 100644 index baa310bb6..000000000 --- a/modules/entry/front/summary/index.html +++ /dev/null @@ -1,196 +0,0 @@ - - - -
- - - - #{{$ctrl.entryData.id}} - {{$ctrl.entryData.supplier.nickname}} -
- - - - - - - - - - - - - - - - - {{$ctrl.entryData.travel.ref}} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Buys

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
QuantityStickersPackageWeightPackingGroupingBuying valueImportPVP
{{::line.quantity}}{{::line.stickers | dashIfEmpty}}{{::line.packagingFk | dashIfEmpty}}{{::line.weight}} - - {{::line.packing | dashIfEmpty}} - - - - {{::line.grouping | dashIfEmpty}} - - - {{::line.buyingValue | currency: 'EUR':2}}{{::line.quantity * line.buyingValue | currency: 'EUR':2}}{{::line.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::line.price3 | currency: 'EUR':2 | dashIfEmpty}}
- - {{::line.item.itemType.code}} - - - - {{::line.item.id}} - - - - {{::line.item.size}} - - - - {{::line.item.minPrice | currency: 'EUR':2}} - - -
- {{::line.item.name}} - -

{{::line.item.subName}}

-
-
- - -
- - -
-
-
- - - - - diff --git a/modules/entry/front/summary/index.js b/modules/entry/front/summary/index.js deleted file mode 100644 index 6e18bc959..000000000 --- a/modules/entry/front/summary/index.js +++ /dev/null @@ -1,33 +0,0 @@ -import ngModule from '../module'; -import './style.scss'; -import Summary from 'salix/components/summary'; - -class Controller extends Summary { - get entry() { - if (!this._entry) - return this.$params; - - return this._entry; - } - - set entry(value) { - this._entry = value; - - if (value && value.id) - this.getEntryData(); - } - - getEntryData() { - return this.$http.get(`Entries/${this.entry.id}/getEntry`).then(response => { - this.entryData = response.data; - }); - } -} - -ngModule.vnComponent('vnEntrySummary', { - template: require('./index.html'), - controller: Controller, - bindings: { - entry: '<' - } -}); diff --git a/modules/entry/front/summary/index.spec.js b/modules/entry/front/summary/index.spec.js deleted file mode 100644 index baeb43ac8..000000000 --- a/modules/entry/front/summary/index.spec.js +++ /dev/null @@ -1,49 +0,0 @@ -import './index'; - -describe('component vnEntrySummary', () => { - let controller; - let $httpBackend; - let $scope; - - beforeEach(angular.mock.module('entry', $translateProvider => { - $translateProvider.translations('en', {}); - })); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - const $element = angular.element(``); - controller = $componentController('vnEntrySummary', {$element, $scope}); - })); - - describe('entry setter/getter', () => { - it('should check if value.id is defined', () => { - jest.spyOn(controller, 'getEntryData'); - - controller.entry = {id: 1}; - - expect(controller.getEntryData).toHaveBeenCalledWith(); - }); - - it('should return the entry and then call getEntryData()', () => { - jest.spyOn(controller, 'getEntryData'); - controller.entry = {id: 99}; - - expect(controller._entry.id).toEqual(99); - expect(controller.getEntryData).toHaveBeenCalledWith(); - }); - }); - - describe('getEntryData()', () => { - it('should perform a get and then store data on the controller', () => { - controller._entry = {id: 999}; - - const query = `Entries/${controller._entry.id}/getEntry`; - $httpBackend.expectGET(query).respond('I am the entryData'); - controller.getEntryData(); - $httpBackend.flush(); - - expect(controller.entryData).toEqual('I am the entryData'); - }); - }); -}); diff --git a/modules/entry/front/summary/locale/es.yml b/modules/entry/front/summary/locale/es.yml deleted file mode 100644 index 1761561ed..000000000 --- a/modules/entry/front/summary/locale/es.yml +++ /dev/null @@ -1,11 +0,0 @@ -Inventory: Inventario -Raid: Redada -Entry: Entrada -Stickers: Etiquetas -Item size: Tamaño -Item type: Tipo -Minimum price: Precio mínimo -Buys: Compras -Travel: Envio -Go to the entry: Ir a la entrada -Invoice number: Núm. factura diff --git a/modules/entry/front/summary/style.scss b/modules/entry/front/summary/style.scss deleted file mode 100644 index 1d5b22e30..000000000 --- a/modules/entry/front/summary/style.scss +++ /dev/null @@ -1,30 +0,0 @@ -@import "variables"; - - -vn-entry-summary .summary { - max-width: $width-lg; - - .dark-row { - background-color: lighten($color-marginal, 10%); - } - - tbody tr:nth-child(1) { - border-top: $border-thin; - } - - tbody tr:nth-child(1), - tbody tr:nth-child(2) { - border-left: $border-thin; - border-right: $border-thin - } - - tbody tr:nth-child(3) { - height: inherit - } - - tr { - margin-bottom: 10px; - } -} - -$color-font-link-medium: lighten($color-font-link, 20%) \ No newline at end of file diff --git a/modules/item/front/routes.json b/modules/item/front/routes.json index 3dea69ba1..4b7cd1490 100644 --- a/modules/item/front/routes.json +++ b/modules/item/front/routes.json @@ -3,7 +3,7 @@ "name": "Items", "icon": "icon-item", "validations" : true, - "dependencies": ["worker", "client", "ticket", "entry"], + "dependencies": ["worker", "client", "ticket"], "menus": { "main": [ {"state": "item.index", "icon": "icon-item"}, @@ -19,8 +19,8 @@ {"state": "item.card.tax", "icon": "icon-tax"}, {"state": "item.card.botanical", "icon": "local_florist"}, {"state": "item.card.shelving", "icon": "icon-inventory"}, - {"state": "item.card.itemBarcode", "icon": "icon-barcode"}, - {"state": "item.card.diary", "icon": "icon-transaction"}, + {"state": "item.card.itemBarcode", "icon": "icon-barcode"}, + {"state": "item.card.diary", "icon": "icon-transaction"}, {"state": "item.card.log", "icon": "history"} ], "itemType": [ @@ -227,4 +227,4 @@ "acl": ["buyer"] } ] -} \ No newline at end of file +} diff --git a/modules/travel/front/routes.json b/modules/travel/front/routes.json index b2e438c6d..5a63620d4 100644 --- a/modules/travel/front/routes.json +++ b/modules/travel/front/routes.json @@ -3,7 +3,7 @@ "name": "Travels", "icon": "local_airport", "validations": true, - "dependencies": ["worker", "entry"], + "dependencies": ["worker"], "menus": { "main": [ {"state": "travel.index", "icon": "local_airport"}, @@ -45,7 +45,7 @@ "state": "travel.card.basicData", "component": "vn-travel-basic-data", "description": "Basic data", - "acl": ["buyer","logistic"], + "acl": ["buyer","logistic"], "params": { "travel": "$ctrl.travel" } @@ -97,10 +97,10 @@ "state": "travel.extraCommunity", "component": "vn-travel-extra-community", "description": "Extra community", - "acl": ["buyer"], + "acl": ["buyer"], "params": { "travel": "$ctrl.travel" } } ] -} \ No newline at end of file +} -- 2.40.1 From 5d7a570c3fb917590e4947738765eebf2f72ecec Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 11 Jun 2024 12:28:49 +0200 Subject: [PATCH 4/6] refs #6897 fix redirection --- back/nodemonConfig.json | 1 + front/module-import.js | 1 + modules/entry/front/index.js | 3 +- modules/entry/front/index/index.html | 85 ---------------------------- modules/entry/front/index/index.js | 14 ----- modules/entry/front/main/index.html | 0 modules/entry/front/main/index.js | 17 ++++++ 7 files changed, 20 insertions(+), 101 deletions(-) delete mode 100644 modules/entry/front/index/index.html delete mode 100644 modules/entry/front/index/index.js create mode 100644 modules/entry/front/main/index.html create mode 100644 modules/entry/front/main/index.js diff --git a/back/nodemonConfig.json b/back/nodemonConfig.json index c468a2f73..9552460bd 100644 --- a/back/nodemonConfig.json +++ b/back/nodemonConfig.json @@ -8,6 +8,7 @@ "modules/account/front/**/*", "modules/claim/front/**/*", "modules/client/front/**/*", + "modules/entry/front/**/*", "modules/invoiceIn/front/**/*", "modules/invoiceOut/front/**/*", "modules/item/front/**/*", diff --git a/front/module-import.js b/front/module-import.js index 85731c72c..22a2747d2 100755 --- a/front/module-import.js +++ b/front/module-import.js @@ -22,5 +22,6 @@ export default function moduleImport(moduleName) { case 'supplier': return import('supplier/front'); case 'shelving': return import('shelving/front'); case 'monitor': return import('monitor/front'); + case 'entry': return import('entry/front'); } } diff --git a/modules/entry/front/index.js b/modules/entry/front/index.js index f4cae889c..a7209a0bd 100644 --- a/modules/entry/front/index.js +++ b/modules/entry/front/index.js @@ -1,4 +1,3 @@ export * from './module'; -import './index/'; - +import './main'; diff --git a/modules/entry/front/index/index.html b/modules/entry/front/index/index.html deleted file mode 100644 index 42177be21..000000000 --- a/modules/entry/front/index/index.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - Id - Landed - Reference - Invoice number - Supplier - Booked - Confirmed - Ordered - - - - - - - - - - - - {{::entry.id}} - - - {{::entry.landed | date:'dd/MM/yyyy'}} - - - {{::entry.reference}} - {{::entry.invoiceNumber}} - {{::entry.supplierName}} - - - - - - - - - - - - - - - - - - -
- - - - - - -
\ No newline at end of file diff --git a/modules/entry/front/index/index.js b/modules/entry/front/index/index.js deleted file mode 100644 index 8635d3fb4..000000000 --- a/modules/entry/front/index/index.js +++ /dev/null @@ -1,14 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - preview(entry) { - this.entrySelected = entry; - this.$.summary.show(); - } -} - -ngModule.vnComponent('vnEntryIndex', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/entry/front/main/index.html b/modules/entry/front/main/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/modules/entry/front/main/index.js b/modules/entry/front/main/index.js new file mode 100644 index 000000000..de0beced4 --- /dev/null +++ b/modules/entry/front/main/index.js @@ -0,0 +1,17 @@ +import ngModule from '../module'; +import ModuleMain from 'salix/components/module-main'; + +export default class Entry extends ModuleMain { + constructor($element, $) { + super($element, $); + } + async $onInit() { + this.$state.go('home'); + window.location.href = await this.vnApp.getUrl(`entry/`); + } +} + +ngModule.vnComponent('vnEntry', { + controller: Entry, + template: require('./index.html') +}); -- 2.40.1 From b72de3570a33419345c9969ed2d9e7435480d578 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 12 Jun 2024 14:41:35 +0200 Subject: [PATCH 5/6] refs #6897 fix redirection --- modules/entry/front/main/locale/es.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 modules/entry/front/main/locale/es.yml diff --git a/modules/entry/front/main/locale/es.yml b/modules/entry/front/main/locale/es.yml new file mode 100644 index 000000000..e69de29bb -- 2.40.1 From 3c1544ac9dd79c1922599cc8232d8c024ea8e4dc Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 13 Jun 2024 09:20:43 +0200 Subject: [PATCH 6/6] refs #6897 fix es.yml --- modules/entry/front/main/locale/es.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/entry/front/main/locale/es.yml b/modules/entry/front/main/locale/es.yml index e69de29bb..de408b311 100644 --- a/modules/entry/front/main/locale/es.yml +++ b/modules/entry/front/main/locale/es.yml @@ -0,0 +1 @@ +entry: entry -- 2.40.1