From e7c1dc221070ca260a347dbdba483903f3a7e994 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 12 Feb 2021 12:19:42 +0100 Subject: [PATCH] Changes --- front/core/components/contextmenu/index.js | 4 +- front/salix/locale/es.yml | 1 + jest-front.js | 1 + .../back/methods/invoice-in/download.js | 59 -------- .../back/methods/invoice-in/filter.js | 1 - .../methods/invoice-in/specs/book.spec.js | 32 ----- .../methods/invoice-in/specs/delete.spec.js | 38 ----- .../methods/invoice-in/specs/download.spec.js | 10 -- .../methods/invoice-in/specs/filter.spec.js | 132 +++++++----------- .../invoice-in/specs/regenerate.spec.js | 36 ----- .../methods/invoice-in/specs/summary.spec.js | 33 ----- .../back/methods/invoice-in/summary.js | 111 --------------- modules/invoiceIn/back/models/invoice-in.js | 1 - modules/invoiceIn/front/card/index.html | 2 +- modules/invoiceIn/front/card/index.js | 2 +- modules/invoiceIn/front/descriptor/index.js | 34 +---- modules/invoiceIn/front/index.js | 1 - modules/invoiceIn/front/index/index.js | 10 -- modules/invoiceIn/front/summary/index.html | 90 ------------ modules/invoiceIn/front/summary/index.js | 28 ---- modules/invoiceIn/front/summary/index.spec.js | 29 ---- modules/invoiceIn/front/summary/style.scss | 6 - 22 files changed, 63 insertions(+), 598 deletions(-) delete mode 100644 modules/invoiceIn/back/methods/invoice-in/download.js delete mode 100644 modules/invoiceIn/back/methods/invoice-in/specs/book.spec.js delete mode 100644 modules/invoiceIn/back/methods/invoice-in/specs/delete.spec.js delete mode 100644 modules/invoiceIn/back/methods/invoice-in/specs/download.spec.js delete mode 100644 modules/invoiceIn/back/methods/invoice-in/specs/regenerate.spec.js delete mode 100644 modules/invoiceIn/back/methods/invoice-in/specs/summary.spec.js delete mode 100644 modules/invoiceIn/back/methods/invoice-in/summary.js delete mode 100644 modules/invoiceIn/front/summary/index.html delete mode 100644 modules/invoiceIn/front/summary/index.js delete mode 100644 modules/invoiceIn/front/summary/index.spec.js delete mode 100644 modules/invoiceIn/front/summary/style.scss diff --git a/front/core/components/contextmenu/index.js b/front/core/components/contextmenu/index.js index 2f91404fe..aa2d1a16b 100755 --- a/front/core/components/contextmenu/index.js +++ b/front/core/components/contextmenu/index.js @@ -236,9 +236,9 @@ export default class Contextmenu { * value to the clipboard */ copyValue() { - console.log(this.field); + const cell = angular.element(this.cell); if (navigator && navigator.clipboard) - navigator.clipboard.writeText(this.fieldValue); + navigator.clipboard.writeText(cell.text()); } } diff --git a/front/salix/locale/es.yml b/front/salix/locale/es.yml index 98384df83..f2d81ee23 100644 --- a/front/salix/locale/es.yml +++ b/front/salix/locale/es.yml @@ -43,6 +43,7 @@ Workers: Trabajadores Routes: Rutas Locator: Localizador Invoices out: Facturas emitidas +Invoices in: Fact. recibidas Entries: Entradas Users: Usuarios Suppliers: Proveedores diff --git a/jest-front.js b/jest-front.js index 3b481ad7c..7a692f57c 100644 --- a/jest-front.js +++ b/jest-front.js @@ -6,6 +6,7 @@ import './modules/zone/front/module.js'; import './modules/claim/front/module.js'; import './modules/client/front/module.js'; import './modules/invoiceOut/front/module.js'; +import './modules/invoiceIn/front/module.js'; import './modules/item/front/module.js'; import './modules/order/front/module.js'; import './modules/route/front/module.js'; diff --git a/modules/invoiceIn/back/methods/invoice-in/download.js b/modules/invoiceIn/back/methods/invoice-in/download.js deleted file mode 100644 index 3c9924fc3..000000000 --- a/modules/invoiceIn/back/methods/invoice-in/download.js +++ /dev/null @@ -1,59 +0,0 @@ -const fs = require('fs-extra'); - -module.exports = Self => { - Self.remoteMethod('download', { - description: 'Download an invoice PDF', - accessType: 'READ', - accepts: [ - { - arg: 'id', - type: 'String', - description: 'The invoice id', - http: {source: 'path'} - } - ], - returns: [ - { - arg: 'body', - type: 'file', - root: true - }, { - arg: 'Content-Type', - type: 'String', - http: {target: 'header'} - }, { - arg: 'Content-Disposition', - type: 'String', - http: {target: 'header'} - } - ], - http: { - path: `/:id/download`, - verb: 'GET' - } - }); - - Self.download = async function(id) { - let file; - let env = process.env.NODE_ENV; - let [invoice] = await Self.rawSql(`SELECT invoiceOut_getPath(?) path`, [id]); - - if (env && env != 'development') { - file = { - path: `/var/lib/salix/pdfs/${invoice.path}`, - contentType: 'application/pdf', - name: `${id}.pdf` - }; - } else { - file = { - path: `${process.cwd()}/README.md`, - contentType: 'text/plain', - name: `README.md` - }; - } - - await fs.access(file.path); - let stream = fs.createReadStream(file.path); - return [stream, file.contentType, `filename="${file.name}"`]; - }; -}; diff --git a/modules/invoiceIn/back/methods/invoice-in/filter.js b/modules/invoiceIn/back/methods/invoice-in/filter.js index 357546225..6d578d457 100644 --- a/modules/invoiceIn/back/methods/invoice-in/filter.js +++ b/modules/invoiceIn/back/methods/invoice-in/filter.js @@ -140,7 +140,6 @@ module.exports = Self => { let itemsIndex = stmts.push(stmt) - 1; let sql = ParameterizedSQL.join(stmts, ';'); - console.log(sql.sql); let result = await conn.executeStmt(sql); return itemsIndex === 0 ? result : result[itemsIndex]; }; diff --git a/modules/invoiceIn/back/methods/invoice-in/specs/book.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/book.spec.js deleted file mode 100644 index 0f0a7bade..000000000 --- a/modules/invoiceIn/back/methods/invoice-in/specs/book.spec.js +++ /dev/null @@ -1,32 +0,0 @@ -const app = require('vn-loopback/server/server'); - -describe('invoiceOut book()', () => { - const invoiceOutId = 5; - - it('should check that invoice out booked is untainted', async() => { - const invoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); - - expect(invoiceOut.booked).toBeDefined(); - expect(invoiceOut.hasPdf).toBeTruthy(); - }); - - it('should update the booked property', async() => { - const originalInvoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); - const bookedDate = originalInvoiceOut.booked; - const invoiceOutRef = originalInvoiceOut.ref; - - await app.models.InvoiceOut.book(invoiceOutRef); - - const updatedInvoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); - - expect(updatedInvoiceOut.booked).not.toEqual(bookedDate); - expect(updatedInvoiceOut.hasPdf).toBeFalsy(); - - // restores - await updatedInvoiceOut.updateAttributes({ - booked: originalInvoiceOut.booked, - hasPdf: originalInvoiceOut.hasPdf, - amount: originalInvoiceOut.amount - }); - }); -}); diff --git a/modules/invoiceIn/back/methods/invoice-in/specs/delete.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/delete.spec.js deleted file mode 100644 index cea61eaf9..000000000 --- a/modules/invoiceIn/back/methods/invoice-in/specs/delete.spec.js +++ /dev/null @@ -1,38 +0,0 @@ -const app = require('vn-loopback/server/server'); -const LoopBackContext = require('loopback-context'); - -describe('invoiceOut delete()', () => { - const invoiceOutId = 2; - let originalInvoiceOut; - let originalTicket; - const userId = 106; - const activeCtx = { - accessToken: {userId: userId}, - }; - - it('should check that there is one ticket in the target invoiceOut', async() => { - const invoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); - const tickets = await app.models.Ticket.find({where: {refFk: invoiceOut.ref}}); - - expect(tickets.length).toEqual(1); - expect(tickets[0].id).toEqual(3); - }); - - it(`should delete the target invoiceOut then check the ticket doesn't have a refFk anymore`, async() => { - spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ - active: activeCtx - }); - originalInvoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); - await app.models.InvoiceOut.delete(invoiceOutId); - originalTicket = await app.models.Ticket.findById(3); - const deletedInvoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); - - expect(deletedInvoiceOut).toBeNull(); - expect(originalTicket.refFk).toBeNull(); - - // restores - const restoredInvoiceOut = await app.models.InvoiceOut.create(originalInvoiceOut); - await restoredInvoiceOut.updateAttribute('ref', originalInvoiceOut.ref); - await originalTicket.updateAttribute('refFk', restoredInvoiceOut.ref); - }); -}); diff --git a/modules/invoiceIn/back/methods/invoice-in/specs/download.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/download.spec.js deleted file mode 100644 index 09289896f..000000000 --- a/modules/invoiceIn/back/methods/invoice-in/specs/download.spec.js +++ /dev/null @@ -1,10 +0,0 @@ -const app = require('vn-loopback/server/server'); - -describe('InvoiceOut download()', () => { - it('should return the downloaded fine name', async() => { - let result = await app.models.InvoiceOut.download(1); - - expect(result[1]).toEqual('text/plain'); - expect(result[2]).toEqual('filename="README.md"'); - }); -}); diff --git a/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js index 09f67eced..4435365e7 100644 --- a/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js +++ b/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js @@ -1,109 +1,81 @@ const app = require('vn-loopback/server/server'); -describe('InvoiceOut filter()', () => { - let today = new Date(); - today.setHours(2, 0, 0, 0); - - it('should return the invoice out matching ref', async() => { +fdescribe('InvoiceIn filter()', () => { + it('should return the invoice in matching supplier name', async() => { let ctx = { args: { - search: 'T4444444', + search: 'Plants SL', } }; - let result = await app.models.InvoiceOut.filter(ctx); - - expect(result.length).toEqual(1); - expect(result[0].ref).toEqual('T4444444'); - }); - - it('should return the invoice out matching clientFk', async() => { - let ctx = { - args: { - clientFk: 102, - } - }; - - let result = await app.models.InvoiceOut.filter(ctx); - - expect(result.length).toEqual(1); - expect(result[0].ref).toEqual('T2222222'); - }); - - it('should return the invoice out matching hasPdf', async() => { - let ctx = { - args: { - hasPdf: true, - } - }; - - let result = await app.models.InvoiceOut.filter(ctx); - - expect(result.length).toEqual(5); - }); - - it('should return the invoice out matching amount', async() => { - let ctx = { - args: { - amount: 121.36, - } - }; - - let result = await app.models.InvoiceOut.filter(ctx); - - expect(result.length).toEqual(1); - expect(result[0].ref).toEqual('T2222222'); - }); - - it('should return the invoice out matching min and max', async() => { - let ctx = { - args: { - min: 0, - max: 100, - } - }; - - let result = await app.models.InvoiceOut.filter(ctx); + let result = await app.models.InvoiceIn.filter(ctx); expect(result.length).toEqual(3); + expect(result[0].supplierName).toEqual('Plants SL'); }); - // #1428 cuadrar formato de horas - xit('should return the invoice out matching issued', async() => { + it('should return the invoice in matching supplier reference', async() => { let ctx = { args: { - issued: today, + supplierRef: '4233', } }; - let result = await app.models.InvoiceOut.filter(ctx); + let result = await app.models.InvoiceIn.filter(ctx); expect(result.length).toEqual(1); + expect(result[0].supplierRef).toEqual('4233'); }); - // #1428 cuadrar formato de horas - xit('should return the invoice out matching created', async() => { + it('should return the invoice in matching the serial number', async() => { let ctx = { args: { - created: today, + serialNumber: '1002', } }; - let result = await app.models.InvoiceOut.filter(ctx); - - expect(result.length).toEqual(5); - }); - - // #1428 cuadrar formato de horas - xit('should return the invoice out matching dued', async() => { - let ctx = { - args: { - dued: today - } - }; - - let result = await app.models.InvoiceOut.filter(ctx); + let result = await app.models.InvoiceIn.filter(ctx); expect(result.length).toEqual(1); + expect(result[0].serialNumber).toEqual(1002); + }); + + it('should return the invoice in matching the account', async() => { + let ctx = { + args: { + account: '4000020002', + } + }; + + let result = await app.models.InvoiceIn.filter(ctx); + + expect(result.length).toEqual(4); + expect(result[0].account).toEqual('4000020002'); + }); + + it('should return the invoice in matching the amount', async() => { + let ctx = { + args: { + amount: '64.23', + } + }; + + let result = await app.models.InvoiceIn.filter(ctx); + + expect(result.length).toEqual(1); + expect(result[0].amount).toEqual(64.23); + }); + + it('should return the booked invoice in', async() => { + let ctx = { + args: { + isBooked: true, + } + }; + + let result = await app.models.InvoiceIn.filter(ctx); + + expect(result.length).toEqual(3); + expect(result[0].isBooked).toBeTruthy(); }); }); diff --git a/modules/invoiceIn/back/methods/invoice-in/specs/regenerate.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/regenerate.spec.js deleted file mode 100644 index 2d495ea0e..000000000 --- a/modules/invoiceIn/back/methods/invoice-in/specs/regenerate.spec.js +++ /dev/null @@ -1,36 +0,0 @@ -const app = require('vn-loopback/server/server'); - -describe('invoiceOut regenerate()', () => { - const invoiceReportFk = 30; - const invoiceOutId = 1; - - it('should check that the invoice has a PDF and is not in print generation queue', async() => { - const invoiceOut = await app.models.InvoiceOut.findById(invoiceOutId); - const [queue] = await app.models.InvoiceOut.rawSql(` - SELECT COUNT(*) AS total - FROM vn.printServerQueue - WHERE reportFk = ?`, [invoiceReportFk]); - - expect(invoiceOut.hasPdf).toBeTruthy(); - expect(queue.total).toEqual(0); - }); - - it(`should mark the invoice as doesn't have PDF and add it to a print queue`, async() => { - const ctx = {req: {accessToken: {userId: 5}}}; - const invoiceOut = await app.models.InvoiceOut.regenerate(ctx, invoiceOutId); - const [queue] = await app.models.InvoiceOut.rawSql(` - SELECT COUNT(*) AS total - FROM vn.printServerQueue - WHERE reportFk = ?`, [invoiceReportFk]); - - expect(invoiceOut.hasPdf).toBeFalsy(); - expect(queue.total).toEqual(1); - - // restores - const invoiceOutToRestore = await app.models.InvoiceOut.findById(invoiceOutId); - await invoiceOutToRestore.updateAttributes({hasPdf: true}); - await app.models.InvoiceOut.rawSql(` - DELETE FROM vn.printServerQueue - WHERE reportFk = ?`, [invoiceReportFk]); - }); -}); diff --git a/modules/invoiceIn/back/methods/invoice-in/specs/summary.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/summary.spec.js deleted file mode 100644 index 1b1b84d15..000000000 --- a/modules/invoiceIn/back/methods/invoice-in/specs/summary.spec.js +++ /dev/null @@ -1,33 +0,0 @@ -const app = require('vn-loopback/server/server'); - -describe('invoiceOut summary()', () => { - it('should return a summary object containing data from one invoiceOut', async() => { - const result = await app.models.InvoiceOut.summary(1); - - expect(result.invoiceOut.id).toEqual(1); - }); - - it(`should return a summary object containing data from it's tickets`, async() => { - const summary = await app.models.InvoiceOut.summary(1); - const tickets = summary.invoiceOut.tickets(); - - expect(summary.invoiceOut.ref).toEqual('T1111111'); - expect(tickets.length).toEqual(2); - }); - - it(`should return a summary object containing it's supplier country`, async() => { - const summary = await app.models.InvoiceOut.summary(1); - const supplier = summary.invoiceOut.supplier(); - - expect(summary.invoiceOut.ref).toEqual('T1111111'); - expect(supplier.id).toEqual(442); - expect(supplier.countryFk).toEqual(1); - }); - - it(`should return a summary object containing idata from it's tax types`, async() => { - const summary = await app.models.InvoiceOut.summary(1); - - expect(summary.invoiceOut.ref).toEqual('T1111111'); - expect(summary.invoiceOut.taxesBreakdown.length).toEqual(2); - }); -}); diff --git a/modules/invoiceIn/back/methods/invoice-in/summary.js b/modules/invoiceIn/back/methods/invoice-in/summary.js deleted file mode 100644 index caa2a1c06..000000000 --- a/modules/invoiceIn/back/methods/invoice-in/summary.js +++ /dev/null @@ -1,111 +0,0 @@ -const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; - -module.exports = Self => { - Self.remoteMethod('summary', { - description: 'The invoiceOut summary', - accessType: 'READ', - accepts: [{ - arg: 'id', - type: 'number', - required: true, - description: 'The invoiceOut id', - http: {source: 'path'} - }], - returns: { - type: 'object', - root: true - }, - http: { - path: `/:id/summary`, - verb: 'GET' - } - }); - - Self.summary = async id => { - const conn = Self.dataSource.connector; - let summary = {}; - - const filter = { - fields: [ - 'id', - 'ref', - 'issued', - 'dued', - 'amount', - 'created', - 'booked', - 'clientFk', - 'companyFk', - 'hasPdf' - ], - where: {id: id}, - include: [ - { - relation: 'company', - scope: { - fields: ['id', 'code'] - } - }, - { - relation: 'supplier', - scope: { - fields: ['id', 'countryFk'] - } - }, - { - relation: 'client', - scope: { - fields: ['id', 'socialName'] - } - }, - { - relation: 'tickets' - } - ] - }; - - summary.invoiceOut = await Self.app.models.InvoiceOut.findOne(filter); - - let stmts = []; - - stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.ticket'); - - stmt = new ParameterizedSQL(` - CREATE TEMPORARY TABLE tmp.ticket - (INDEX (ticketFk)) ENGINE = MEMORY - SELECT id ticketFk FROM vn.ticket WHERE refFk=?`, [summary.invoiceOut.ref]); - stmts.push(stmt); - - stmts.push('CALL ticketGetTotal()'); - - let ticketTotalsIndex = stmts.push('SELECT * FROM tmp.ticketTotal') - 1; - - stmt = new ParameterizedSQL(` - SELECT iot.* , pgc.*, IF(pe.equFk IS NULL, taxableBase, 0) AS Base, pgc.rate / 100 as vatPercent - FROM vn.invoiceOutTax iot - JOIN vn.pgc ON pgc.code = iot.pgcFk - LEFT JOIN vn.pgcEqu pe ON pe.equFk = pgc.code - WHERE invoiceOutFk = ?`, [summary.invoiceOut.id]); - let invoiceOutTaxesIndex = stmts.push(stmt) - 1; - - stmts.push( - `DROP TEMPORARY TABLE - tmp.ticket, - tmp.ticketTotal`); - - let sql = ParameterizedSQL.join(stmts, ';'); - let result = await conn.executeStmt(sql); - - totalMap = {}; - for (ticketTotal of result[ticketTotalsIndex]) - totalMap[ticketTotal.ticketFk] = ticketTotal.total; - - summary.invoiceOut.tickets().forEach(ticket => { - ticket.total = totalMap[ticket.id]; - }); - - summary.invoiceOut.taxesBreakdown = result[invoiceOutTaxesIndex]; - - return summary; - }; -}; diff --git a/modules/invoiceIn/back/models/invoice-in.js b/modules/invoiceIn/back/models/invoice-in.js index 7c5b16358..278843428 100644 --- a/modules/invoiceIn/back/models/invoice-in.js +++ b/modules/invoiceIn/back/models/invoice-in.js @@ -1,4 +1,3 @@ module.exports = Self => { require('../methods/invoice-in/filter')(Self); - require('../methods/invoice-in/summary')(Self); }; diff --git a/modules/invoiceIn/front/card/index.html b/modules/invoiceIn/front/card/index.html index c70ac06e1..22de13182 100644 --- a/modules/invoiceIn/front/card/index.html +++ b/modules/invoiceIn/front/card/index.html @@ -1,5 +1,5 @@ - + diff --git a/modules/invoiceIn/front/card/index.js b/modules/invoiceIn/front/card/index.js index f718f22ae..5db1cebd4 100644 --- a/modules/invoiceIn/front/card/index.js +++ b/modules/invoiceIn/front/card/index.js @@ -32,7 +32,7 @@ class Controller extends ModuleCard { } } -ngModule.vnComponent('vnInvoiceOutCard', { +ngModule.vnComponent('vnInvoiceInCard', { template: require('./index.html'), controller: Controller }); diff --git a/modules/invoiceIn/front/descriptor/index.js b/modules/invoiceIn/front/descriptor/index.js index cb4b131ac..6b22dd62b 100644 --- a/modules/invoiceIn/front/descriptor/index.js +++ b/modules/invoiceIn/front/descriptor/index.js @@ -2,33 +2,14 @@ import ngModule from '../module'; import Descriptor from 'salix/components/descriptor'; class Controller extends Descriptor { - get invoiceOut() { + get invoiceIn() { return this.entity; } - set invoiceOut(value) { + set invoiceIn(value) { this.entity = value; } - deleteInvoiceOut() { - return this.$http.post(`InvoiceOuts/${this.id}/delete`) - .then(() => this.$state.go('invoiceOut.index')) - .then(() => this.vnApp.showSuccess(this.$t('InvoiceOut deleted'))); - } - - bookInvoiceOut() { - return this.$http.post(`InvoiceOuts/${this.invoiceOut.ref}/book`) - .then(() => this.$state.reload()) - .then(() => this.vnApp.showSuccess(this.$t('InvoiceOut booked'))); - } - - get filter() { - if (this.invoiceOut) - return JSON.stringify({refFk: this.invoiceOut.ref}); - - return null; - } - loadData() { const filter = { include: [ @@ -37,24 +18,19 @@ class Controller extends Descriptor { scope: { fields: ['id', 'code'] } - }, { - relation: 'client', - scope: { - fields: ['id', 'name'] - } } ] }; - return this.getData(`InvoiceOuts/${this.id}`, {filter}) + return this.getData(`InvoiceIns/${this.id}`, {filter}) .then(res => this.entity = res.data); } } -ngModule.vnComponent('vnInvoiceOutDescriptor', { +ngModule.vnComponent('vnInvoiceInDescriptor', { template: require('./index.html'), controller: Controller, bindings: { - invoiceOut: '<' + invoiceIn: '<' } }); diff --git a/modules/invoiceIn/front/index.js b/modules/invoiceIn/front/index.js index 9843e188b..acb341c50 100644 --- a/modules/invoiceIn/front/index.js +++ b/modules/invoiceIn/front/index.js @@ -3,7 +3,6 @@ export * from './module'; import './main'; import './index/'; import './search-panel'; -import './summary'; import './card'; import './descriptor'; import './descriptor-popover'; diff --git a/modules/invoiceIn/front/index/index.js b/modules/invoiceIn/front/index/index.js index c8de33783..a8d5c81ca 100644 --- a/modules/invoiceIn/front/index/index.js +++ b/modules/invoiceIn/front/index/index.js @@ -2,16 +2,6 @@ import ngModule from '../module'; import Section from 'salix/components/section'; export default class Controller extends Section { -/* preview(invoiceOut) { - this.selectedInvoiceOut = invoiceOut; - this.$.summary.show(); - } - - openPdf(id) { - let url = `api/InvoiceOuts/${id}/download?access_token=${this.vnToken.token}`; - window.open(url, '_blank'); - } */ - exprBuilder(param, value) { switch (param) { case 'shipped': diff --git a/modules/invoiceIn/front/summary/index.html b/modules/invoiceIn/front/summary/index.html deleted file mode 100644 index 452ec23db..000000000 --- a/modules/invoiceIn/front/summary/index.html +++ /dev/null @@ -1,90 +0,0 @@ - -
- - - - {{$ctrl.summary.invoiceOut.ref}} - {{$ctrl.summary.invoiceOut.client.socialName}} -
- - - - - - - - - - - - - - -

Tax breakdown

- - - - Type - Taxable base - Rate - Fee - - - - - {{tax.name}} - {{tax.taxableBase | currency: 'EUR': 2}} - {{tax.rate}}% - {{tax.vat | currency: 'EUR': 2}} - - - -
- -

Ticket

- - - - Ticket id - Alias - Shipped - Amount - - - - - - - {{ticket.id}} - - - - - {{ticket.nickname}} - - - {{ticket.shipped | date: 'dd/MM/yyyy' | dashIfEmpty}} - {{ticket.total | currency: 'EUR': 2}} - - - -
-
-
- - - - \ No newline at end of file diff --git a/modules/invoiceIn/front/summary/index.js b/modules/invoiceIn/front/summary/index.js deleted file mode 100644 index c0f8b4825..000000000 --- a/modules/invoiceIn/front/summary/index.js +++ /dev/null @@ -1,28 +0,0 @@ -import ngModule from '../module'; -import Summary from 'salix/components/summary'; -import './style.scss'; - -class Controller extends Summary { - set invoiceOut(value) { - this._invoiceOut = value; - if (value && value.id) - this.getSummary(); - } - - get invoiceOut() { - return this._invoiceOut; - } - - getSummary() { - return this.$http.get(`InvoiceOuts/${this.invoiceOut.id}/summary`) - .then(res => this.summary = res.data); - } -} - -ngModule.vnComponent('vnInvoiceOutSummary', { - template: require('./index.html'), - controller: Controller, - bindings: { - invoiceOut: '<' - } -}); diff --git a/modules/invoiceIn/front/summary/index.spec.js b/modules/invoiceIn/front/summary/index.spec.js deleted file mode 100644 index fadf0ad89..000000000 --- a/modules/invoiceIn/front/summary/index.spec.js +++ /dev/null @@ -1,29 +0,0 @@ -import './index.js'; - -describe('InvoiceOut', () => { - describe('Component summary', () => { - let controller; - let $httpBackend; - let $scope; - - beforeEach(ngModule('invoiceOut')); - - beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { - $httpBackend = _$httpBackend_; - $scope = $rootScope.$new(); - const $element = angular.element(''); - controller = $componentController('vnInvoiceOutSummary', {$element, $scope}); - controller.invoiceOut = {id: 1}; - })); - - describe('getSummary()', () => { - it('should perform a query to set summary', () => { - $httpBackend.when('GET', `InvoiceOuts/1/summary`).respond(200, 'the data you are looking for'); - controller.getSummary(); - $httpBackend.flush(); - - expect(controller.summary).toEqual('the data you are looking for'); - }); - }); - }); -}); diff --git a/modules/invoiceIn/front/summary/style.scss b/modules/invoiceIn/front/summary/style.scss deleted file mode 100644 index e6e31fd94..000000000 --- a/modules/invoiceIn/front/summary/style.scss +++ /dev/null @@ -1,6 +0,0 @@ -@import "variables"; - - -vn-invoice-out-summary .summary { - max-width: $width-lg; -} \ No newline at end of file