From d74a04a881438698210321716fae90a131530da5 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 30 Jul 2024 11:37:41 +0200 Subject: [PATCH] feat: deleted code and redirect to Lilium --- modules/invoiceOut/front/card/index.html | 8 - modules/invoiceOut/front/card/index.js | 41 --- modules/invoiceOut/front/card/index.spec.js | 27 -- .../front/descriptor-menu/index.html | 252 ------------------ .../invoiceOut/front/descriptor-menu/index.js | 191 ------------- .../front/descriptor-menu/index.spec.js | 121 --------- .../front/descriptor-menu/locale/en.yml | 7 - .../front/descriptor-menu/locale/es.yml | 30 --- .../front/descriptor-menu/style.scss | 30 --- .../front/descriptor-popover/index.html | 4 - .../front/descriptor-popover/index.js | 9 - .../invoiceOut/front/descriptor/index.html | 59 ---- modules/invoiceOut/front/descriptor/index.js | 52 ---- .../invoiceOut/front/descriptor/index.spec.js | 26 -- .../invoiceOut/front/descriptor/locale/es.yml | 2 - .../front/global-invoicing/index.html | 158 ----------- .../front/global-invoicing/index.js | 174 ------------ .../front/global-invoicing/index.spec.js | 74 ----- .../front/global-invoicing/locale/es.yml | 22 -- .../front/global-invoicing/style.scss | 21 -- modules/invoiceOut/front/index.js | 10 - modules/invoiceOut/front/index/index.html | 89 ------- modules/invoiceOut/front/index/index.js | 47 ---- modules/invoiceOut/front/index/locale/es.yml | 9 - .../invoiceOut/front/index/manual/index.html | 86 ------ .../invoiceOut/front/index/manual/index.js | 51 ---- .../front/index/manual/index.spec.js | 66 ----- .../front/index/manual/locale/es.yml | 6 - .../invoiceOut/front/index/manual/style.scss | 17 -- modules/invoiceOut/front/main/index.html | 18 -- modules/invoiceOut/front/main/index.js | 10 +- .../invoiceOut/front/{ => main}/locale/es.yml | 0 .../front/negative-bases/index.html | 134 ---------- .../invoiceOut/front/negative-bases/index.js | 74 ----- .../front/negative-bases/locale/es.yml | 2 - .../front/negative-bases/style.scss | 10 - modules/invoiceOut/front/routes.json | 30 --- .../invoiceOut/front/search-panel/index.html | 68 ----- .../invoiceOut/front/search-panel/index.js | 7 - modules/invoiceOut/front/summary/index.html | 104 -------- modules/invoiceOut/front/summary/index.js | 34 --- .../invoiceOut/front/summary/index.spec.js | 31 --- .../invoiceOut/front/summary/locale/es.yml | 13 - modules/invoiceOut/front/summary/style.scss | 6 - 44 files changed, 9 insertions(+), 2221 deletions(-) delete mode 100644 modules/invoiceOut/front/card/index.html delete mode 100644 modules/invoiceOut/front/card/index.js delete mode 100644 modules/invoiceOut/front/card/index.spec.js delete mode 100644 modules/invoiceOut/front/descriptor-menu/index.html delete mode 100644 modules/invoiceOut/front/descriptor-menu/index.js delete mode 100644 modules/invoiceOut/front/descriptor-menu/index.spec.js delete mode 100644 modules/invoiceOut/front/descriptor-menu/locale/en.yml delete mode 100644 modules/invoiceOut/front/descriptor-menu/locale/es.yml delete mode 100644 modules/invoiceOut/front/descriptor-menu/style.scss delete mode 100644 modules/invoiceOut/front/descriptor-popover/index.html delete mode 100644 modules/invoiceOut/front/descriptor-popover/index.js delete mode 100644 modules/invoiceOut/front/descriptor/index.html delete mode 100644 modules/invoiceOut/front/descriptor/index.js delete mode 100644 modules/invoiceOut/front/descriptor/index.spec.js delete mode 100644 modules/invoiceOut/front/descriptor/locale/es.yml delete mode 100644 modules/invoiceOut/front/global-invoicing/index.html delete mode 100644 modules/invoiceOut/front/global-invoicing/index.js delete mode 100644 modules/invoiceOut/front/global-invoicing/index.spec.js delete mode 100644 modules/invoiceOut/front/global-invoicing/locale/es.yml delete mode 100644 modules/invoiceOut/front/global-invoicing/style.scss delete mode 100644 modules/invoiceOut/front/index/index.html delete mode 100644 modules/invoiceOut/front/index/index.js delete mode 100644 modules/invoiceOut/front/index/locale/es.yml delete mode 100644 modules/invoiceOut/front/index/manual/index.html delete mode 100644 modules/invoiceOut/front/index/manual/index.js delete mode 100644 modules/invoiceOut/front/index/manual/index.spec.js delete mode 100644 modules/invoiceOut/front/index/manual/locale/es.yml delete mode 100644 modules/invoiceOut/front/index/manual/style.scss rename modules/invoiceOut/front/{ => main}/locale/es.yml (100%) delete mode 100644 modules/invoiceOut/front/negative-bases/index.html delete mode 100644 modules/invoiceOut/front/negative-bases/index.js delete mode 100644 modules/invoiceOut/front/negative-bases/locale/es.yml delete mode 100644 modules/invoiceOut/front/negative-bases/style.scss delete mode 100644 modules/invoiceOut/front/search-panel/index.html delete mode 100644 modules/invoiceOut/front/search-panel/index.js delete mode 100644 modules/invoiceOut/front/summary/index.html delete mode 100644 modules/invoiceOut/front/summary/index.js delete mode 100644 modules/invoiceOut/front/summary/index.spec.js delete mode 100644 modules/invoiceOut/front/summary/locale/es.yml delete mode 100644 modules/invoiceOut/front/summary/style.scss diff --git a/modules/invoiceOut/front/card/index.html b/modules/invoiceOut/front/card/index.html deleted file mode 100644 index a6f56f775..000000000 --- a/modules/invoiceOut/front/card/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/modules/invoiceOut/front/card/index.js b/modules/invoiceOut/front/card/index.js deleted file mode 100644 index c443912d9..000000000 --- a/modules/invoiceOut/front/card/index.js +++ /dev/null @@ -1,41 +0,0 @@ -import ngModule from '../module'; -import ModuleCard from 'salix/components/module-card'; - -class Controller extends ModuleCard { - reload() { - const filter = { - fields: [ - 'id', - 'ref', - 'issued', - 'serial', - 'amount', - 'clientFk', - 'companyFk', - 'hasPdf' - ], - include: [ - { - relation: 'company', - scope: { - fields: ['id', 'code'] - } - }, { - relation: 'client', - scope: { - fields: ['id', 'socialName', 'name', 'email'] - } - } - ] - }; - - this.$http.get(`InvoiceOuts/${this.$params.id}`, {filter}) - .then(res => this.invoiceOut = res.data); - } -} - -ngModule.vnComponent('vnInvoiceOutCard', { - template: require('./index.html'), - controller: Controller -}); - diff --git a/modules/invoiceOut/front/card/index.spec.js b/modules/invoiceOut/front/card/index.spec.js deleted file mode 100644 index 2a8d576dc..000000000 --- a/modules/invoiceOut/front/card/index.spec.js +++ /dev/null @@ -1,27 +0,0 @@ -import './index.js'; - -describe('vnInvoiceOut', () => { - let controller; - let $httpBackend; - let data = {id: 1, name: 'fooName'}; - - beforeEach(ngModule('invoiceOut')); - - beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => { - $httpBackend = _$httpBackend_; - - let $element = angular.element('
'); - controller = $componentController('vnInvoiceOutCard', {$element}); - - $stateParams.id = data.id; - $httpBackend.whenRoute('GET', 'InvoiceOuts/:id').respond(data); - })); - - it('should request data and set it on the controller', () => { - controller.reload(); - $httpBackend.flush(); - - expect(controller.invoiceOut).toEqual(data); - }); -}); - diff --git a/modules/invoiceOut/front/descriptor-menu/index.html b/modules/invoiceOut/front/descriptor-menu/index.html deleted file mode 100644 index da04c8e72..000000000 --- a/modules/invoiceOut/front/descriptor-menu/index.html +++ /dev/null @@ -1,252 +0,0 @@ - - - - - - - - - Transfer invoice to... - - - Show invoice... - - - - as PDF - - - as CSV - - - - - - Send invoice... - - - - Send PDF - - - Send CSV - - - - - - Delete Invoice - - - Book invoice - - - {{!$ctrl.invoiceOut.hasPdf ? 'Generate PDF invoice': 'Regenerate PDF invoice'}} - - - Show CITES letter - - - Refund... - - - - with warehouse - - - without warehouse - - - - - - - - - - - - - - - - - - - - - Are you sure you want to send it? - - - - - - - - - - - - - Are you sure you want to send it? - - - - - - - - - - - - transferInvoice - - -
- - - - #{{id}} - {{::name}} - - - - - {{ ::description}} - - - - - - - {{::code}} - {{::description}} - - - - - - - - - -
-
- - - -
diff --git a/modules/invoiceOut/front/descriptor-menu/index.js b/modules/invoiceOut/front/descriptor-menu/index.js deleted file mode 100644 index 8ea4507ec..000000000 --- a/modules/invoiceOut/front/descriptor-menu/index.js +++ /dev/null @@ -1,191 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -class Controller extends Section { - constructor($element, $, vnReport, vnEmail) { - super($element, $); - this.vnReport = vnReport; - this.vnEmail = vnEmail; - this.checked = true; - } - - get invoiceOut() { - return this._invoiceOut; - } - - set invoiceOut(value) { - this._invoiceOut = value; - if (value) - this.id = value.id; - } - - get hasInvoicing() { - return this.aclService.hasAny(['invoicing']); - } - - get isChecked() { - return this.checked; - } - - set isChecked(value) { - this.checked = value; - } - - $onInit() { - this.$http.get(`CplusRectificationTypes`, {filter: {order: 'description'}}) - .then(res => { - this.cplusRectificationTypes = res.data; - this.cplusRectificationType = res.data.filter(type => type.description == 'I – Por diferencias')[0].id; - }); - this.$http.get(`SiiTypeInvoiceOuts`, {filter: {where: {code: {like: 'R%'}}}}) - .then(res => { - this.siiTypeInvoiceOuts = res.data; - this.siiTypeInvoiceOut = res.data.filter(type => type.code == 'R4')[0].id; - }); - } - loadData() { - const filter = { - include: [ - { - relation: 'company', - scope: { - fields: ['id', 'code'] - } - }, { - relation: 'client', - scope: { - fields: ['id', 'name', 'email', 'hasToInvoiceByAddress'] - } - } - ] - }; - return this.$http.get(`InvoiceOuts/${this.invoiceOut.id}`, {filter}) - .then(res => this.invoiceOut = res.data); - } - reload() { - return this.loadData().then(() => { - if (this.parentReload) - this.parentReload(); - }); - } - - cardReload() { - // Prevents error when not defined - } - - deleteInvoiceOut() { - return this.$http.post(`InvoiceOuts/${this.invoiceOut.id}/delete`) - .then(() => { - const isInsideInvoiceOut = this.$state.current.name.startsWith('invoiceOut'); - if (isInsideInvoiceOut) - this.$state.go('invoiceOut.index'); - else - this.$state.reload(); - }) - .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'))); - } - - createPdfInvoice() { - return this.$http.post(`InvoiceOuts/${this.id}/createPdf`) - .then(() => this.reload()) - .then(() => { - const snackbarMessage = this.$t( - `The invoice PDF document has been regenerated`); - this.vnApp.showSuccess(snackbarMessage); - }); - } - - sendPdfInvoice($data) { - if (!$data.email) - return this.vnApp.showError(this.$t(`The email can't be empty`)); - - return this.vnEmail.send(`InvoiceOuts/${this.invoiceOut.ref}/invoice-email`, { - recipientId: this.invoiceOut.client.id, - recipient: $data.email - }); - } - - showCsvInvoice() { - this.vnReport.show(`InvoiceOuts/${this.invoiceOut.ref}/invoice-csv`, { - recipientId: this.invoiceOut.client.id - }); - } - - sendCsvInvoice($data) { - if (!$data.email) - return this.vnApp.showError(this.$t(`The email can't be empty`)); - - return this.vnEmail.send(`InvoiceOuts/${this.invoiceOut.ref}/invoice-csv-email`, { - recipientId: this.invoiceOut.client.id, - recipient: $data.email - }); - } - - showExportationLetter() { - this.vnReport.show(`InvoiceOuts/${this.invoiceOut.ref}/exportation-pdf`, { - recipientId: this.invoiceOut.client.id, - refFk: this.invoiceOut.ref - }); - } - - refundInvoiceOut(withWarehouse) { - const query = 'InvoiceOuts/refund'; - const params = {ref: this.invoiceOut.ref, withWarehouse: withWarehouse}; - this.$http.post(query, params).then(res => { - const tickets = res.data; - const refundTickets = tickets.map(ticket => ticket.id); - - this.vnApp.showSuccess(this.$t('The following refund tickets have been created', { - ticketId: refundTickets.join(',') - })); - if (refundTickets.length == 1) - this.$state.go('ticket.card.sale', {id: refundTickets[0]}); - }); - } - - transferInvoice() { - const params = { - id: this.invoiceOut.id, - refFk: this.invoiceOut.ref, - newClientFk: this.clientId, - cplusRectificationTypeFk: this.cplusRectificationType, - siiTypeInvoiceOutFk: this.siiTypeInvoiceOut, - invoiceCorrectionTypeFk: this.invoiceCorrectionType, - makeInvoice: this.checked - }; - - this.$http.get(`Clients/${this.clientId}`).then(response => { - const clientData = response.data; - const hasToInvoiceByAddress = clientData.hasToInvoiceByAddress; - - if (this.checked && hasToInvoiceByAddress) { - if (!window.confirm(this.$t('confirmTransferInvoice'))) - return; - } - - this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => { - const invoiceId = res.data; - this.vnApp.showSuccess(this.$t('Transferred invoice')); - this.$state.go('invoiceOut.card.summary', {id: invoiceId}); - }); - }); - } -} - -Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail']; - -ngModule.vnComponent('vnInvoiceOutDescriptorMenu', { - template: require('./index.html'), - controller: Controller, - bindings: { - invoiceOut: '<', - parentReload: '&' - } -}); diff --git a/modules/invoiceOut/front/descriptor-menu/index.spec.js b/modules/invoiceOut/front/descriptor-menu/index.spec.js deleted file mode 100644 index d2ccfa117..000000000 --- a/modules/invoiceOut/front/descriptor-menu/index.spec.js +++ /dev/null @@ -1,121 +0,0 @@ -import './index'; - -describe('vnInvoiceOutDescriptorMenu', () => { - let controller; - let $httpBackend; - let $httpParamSerializer; - const invoiceOut = { - id: 1, - client: {id: 1101}, - ref: 'T1111111' - }; - - beforeEach(ngModule('invoiceOut')); - - beforeEach(inject(($componentController, _$httpParamSerializer_, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - $httpParamSerializer = _$httpParamSerializer_; - controller = $componentController('vnInvoiceOutDescriptorMenu', {$element: null}); - controller.invoiceOut = { - id: 1, - ref: 'T1111111', - client: {id: 1101} - }; - })); - - describe('createPdfInvoice()', () => { - it('should make a query to the createPdf() endpoint and show a success snackbar', () => { - jest.spyOn(controller.vnApp, 'showSuccess'); - - $httpBackend.whenGET(`InvoiceOuts/${invoiceOut.id}`).respond(); - $httpBackend.expectPOST(`InvoiceOuts/${invoiceOut.id}/createPdf`).respond(); - controller.createPdfInvoice(); - $httpBackend.flush(); - - expect(controller.vnApp.showSuccess).toHaveBeenCalled(); - }); - }); - - describe('showCsvInvoice()', () => { - it('should make a query to the csv invoice download endpoint and show a message snackbar', () => { - jest.spyOn(window, 'open').mockReturnThis(); - - const expectedParams = { - recipientId: invoiceOut.client.id - }; - const serializedParams = $httpParamSerializer(expectedParams); - const expectedPath = `api/InvoiceOuts/${invoiceOut.ref}/invoice-csv?${serializedParams}`; - controller.showCsvInvoice(); - - expect(window.open).toHaveBeenCalledWith(expectedPath); - }); - }); - - describe('deleteInvoiceOut()', () => { - it(`should make a query and call showSuccess()`, () => { - controller.$state.reload = jest.fn(); - jest.spyOn(controller.vnApp, 'showSuccess'); - - $httpBackend.expectPOST(`InvoiceOuts/${invoiceOut.id}/delete`).respond(); - controller.deleteInvoiceOut(); - $httpBackend.flush(); - - expect(controller.$state.reload).toHaveBeenCalled(); - expect(controller.vnApp.showSuccess).toHaveBeenCalled(); - }); - - it(`should make a query and call showSuccess() after state.go if the state wasn't in invoiceOut module`, () => { - jest.spyOn(controller.$state, 'go').mockReturnValue('ok'); - jest.spyOn(controller.vnApp, 'showSuccess'); - controller.$state.current.name = 'invoiceOut.card.something'; - - $httpBackend.expectPOST(`InvoiceOuts/${invoiceOut.id}/delete`).respond(); - controller.deleteInvoiceOut(); - $httpBackend.flush(); - - expect(controller.$state.go).toHaveBeenCalledWith('invoiceOut.index'); - expect(controller.vnApp.showSuccess).toHaveBeenCalled(); - }); - }); - - describe('sendPdfInvoice()', () => { - it('should make a query to the email invoice endpoint and show a message snackbar', () => { - jest.spyOn(controller.vnApp, 'showMessage'); - - const $data = {email: 'brucebanner@gothamcity.com'}; - - $httpBackend.expectPOST(`InvoiceOuts/${invoiceOut.ref}/invoice-email`).respond(); - controller.sendPdfInvoice($data); - $httpBackend.flush(); - - expect(controller.vnApp.showMessage).toHaveBeenCalled(); - }); - }); - - describe('sendCsvInvoice()', () => { - it('should make a query to the csv invoice send endpoint and show a message snackbar', () => { - jest.spyOn(controller.vnApp, 'showMessage'); - - const $data = {email: 'brucebanner@gothamcity.com'}; - - $httpBackend.expectPOST(`InvoiceOuts/${invoiceOut.ref}/invoice-csv-email`).respond(); - controller.sendCsvInvoice($data); - $httpBackend.flush(); - - expect(controller.vnApp.showMessage).toHaveBeenCalled(); - }); - }); - - describe('refundInvoiceOut()', () => { - it('should make a query and show a success message', () => { - jest.spyOn(controller.vnApp, 'showSuccess'); - const params = {ref: controller.invoiceOut.ref}; - - $httpBackend.expectPOST(`InvoiceOuts/refund`, params).respond([{id: 1}, {id: 2}]); - controller.refundInvoiceOut(); - $httpBackend.flush(); - - expect(controller.vnApp.showSuccess).toHaveBeenCalled(); - }); - }); -}); diff --git a/modules/invoiceOut/front/descriptor-menu/locale/en.yml b/modules/invoiceOut/front/descriptor-menu/locale/en.yml deleted file mode 100644 index 32ea03442..000000000 --- a/modules/invoiceOut/front/descriptor-menu/locale/en.yml +++ /dev/null @@ -1,7 +0,0 @@ -The following refund tickets have been created: "The following refund tickets have been created: {{ticketIds}}" -Transfer invoice to...: Transfer invoice to... -Cplus Type: Cplus Type -transferInvoice: Transfer Invoice -destinationClient: Bill destination client -transferInvoiceInfo: New tickets from the destination customer will be generated in the default consignee. -confirmTransferInvoice: Destination customer has marked to bill by consignee, do you want to continue? \ No newline at end of file diff --git a/modules/invoiceOut/front/descriptor-menu/locale/es.yml b/modules/invoiceOut/front/descriptor-menu/locale/es.yml deleted file mode 100644 index 92c109878..000000000 --- a/modules/invoiceOut/front/descriptor-menu/locale/es.yml +++ /dev/null @@ -1,30 +0,0 @@ -Show invoice...: Ver factura... -Send invoice...: Enviar factura... -Send PDF invoice: Enviar factura en PDF -Send CSV invoice: Enviar factura en CSV -as PDF: como PDF -as CSV: como CSV -Delete Invoice: Eliminar factura -Clone Invoice: Clonar factura -Book invoice: Asentar factura -Generate PDF invoice: Generar PDF factura -Show CITES letter: Ver carta CITES -InvoiceOut deleted: Factura eliminada -Are you sure you want to delete this invoice?: Estas seguro de eliminar esta factura? -Are you sure you want to clone this invoice?: Estas seguro de clonar esta factura? -InvoiceOut booked: Factura asentada -Are you sure you want to book this invoice?: Estas seguro de querer asentar esta factura? -Are you sure you want to refund this invoice?: Estas seguro de querer abonar esta factura? -Create a refund ticket for each ticket on the current invoice: Crear un ticket abono por cada ticket de la factura actual -Regenerate PDF invoice: Regenerar PDF factura -The invoice PDF document has been regenerated: El documento PDF de la factura ha sido regenerado -The email can't be empty: El correo no puede estar vacío -The following refund tickets have been created: "Se han creado los siguientes tickets de abono: {{ticketIds}}" -Refund...: Abono... -Transfer invoice to...: Transferir factura a... -Rectificative type: Tipo rectificativa -Transferred invoice: Factura transferida -transferInvoice: Transferir factura -destinationClient: Facturar cliente destino -transferInvoiceInfo: Los nuevos tickets del cliente destino serán generados en el consignatario por defecto. -confirmTransferInvoice: El cliente destino tiene marcado facturar por consignatario, ¿desea continuar? \ No newline at end of file diff --git a/modules/invoiceOut/front/descriptor-menu/style.scss b/modules/invoiceOut/front/descriptor-menu/style.scss deleted file mode 100644 index 9e4cf4297..000000000 --- a/modules/invoiceOut/front/descriptor-menu/style.scss +++ /dev/null @@ -1,30 +0,0 @@ -@import "./effects"; -@import "variables"; - -vn-invoice-out-descriptor-menu { - & > vn-icon-button[icon="more_vert"] { - display: flex; - min-width: 45px; - height: 45px; - box-sizing: border-box; - align-items: center; - justify-content: center; - } - & > vn-icon-button[icon="more_vert"] { - @extend %clickable; - color: inherit; - - & > vn-icon { - padding: 10px; - } - vn-icon { - font-size: 1.75rem; - } - } - -} -@media screen and (min-width: 1000px) { - .transferInvoice { - min-width: $width-md; - } -} diff --git a/modules/invoiceOut/front/descriptor-popover/index.html b/modules/invoiceOut/front/descriptor-popover/index.html deleted file mode 100644 index 2bd912133..000000000 --- a/modules/invoiceOut/front/descriptor-popover/index.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/modules/invoiceOut/front/descriptor-popover/index.js b/modules/invoiceOut/front/descriptor-popover/index.js deleted file mode 100644 index fc9899da0..000000000 --- a/modules/invoiceOut/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('vnInvoiceOutDescriptorPopover', { - slotTemplate: require('./index.html'), - controller: Controller -}); diff --git a/modules/invoiceOut/front/descriptor/index.html b/modules/invoiceOut/front/descriptor/index.html deleted file mode 100644 index e1dc579ab..000000000 --- a/modules/invoiceOut/front/descriptor/index.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - -
- - - - - - - {{$ctrl.invoiceOut.client.name}} - - - - -
- -
-
- - - - - diff --git a/modules/invoiceOut/front/descriptor/index.js b/modules/invoiceOut/front/descriptor/index.js deleted file mode 100644 index 7eeb85ea6..000000000 --- a/modules/invoiceOut/front/descriptor/index.js +++ /dev/null @@ -1,52 +0,0 @@ -import ngModule from '../module'; -import Descriptor from 'salix/components/descriptor'; - -class Controller extends Descriptor { - get invoiceOut() { - return this.entity; - } - - set invoiceOut(value) { - this.entity = value; - } - - get hasInvoicing() { - return this.aclService.hasAny(['invoicing']); - } - - get filter() { - if (this.invoiceOut) - return JSON.stringify({refFk: this.invoiceOut.ref}); - - return null; - } - - loadData() { - const filter = { - include: [ - { - relation: 'company', - scope: { - fields: ['id', 'code'] - } - }, { - relation: 'client', - scope: { - fields: ['id', 'name', 'email'] - } - } - ] - }; - - return this.getData(`InvoiceOuts/${this.id}`, {filter}) - .then(res => this.entity = res.data); - } -} - -ngModule.vnComponent('vnInvoiceOutDescriptor', { - template: require('./index.html'), - controller: Controller, - bindings: { - invoiceOut: '<', - } -}); diff --git a/modules/invoiceOut/front/descriptor/index.spec.js b/modules/invoiceOut/front/descriptor/index.spec.js deleted file mode 100644 index 987763b0a..000000000 --- a/modules/invoiceOut/front/descriptor/index.spec.js +++ /dev/null @@ -1,26 +0,0 @@ -import './index'; - -describe('vnInvoiceOutDescriptor', () => { - let controller; - let $httpBackend; - - beforeEach(ngModule('invoiceOut')); - - beforeEach(inject(($componentController, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - controller = $componentController('vnInvoiceOutDescriptor', {$element: null}); - })); - - describe('loadData()', () => { - it(`should perform a get query to store the invoice in data into the controller`, () => { - const id = 1; - const response = {id: 1}; - - $httpBackend.expectGET(`InvoiceOuts/${id}`).respond(response); - controller.id = id; - $httpBackend.flush(); - - expect(controller.invoiceOut).toEqual(response); - }); - }); -}); diff --git a/modules/invoiceOut/front/descriptor/locale/es.yml b/modules/invoiceOut/front/descriptor/locale/es.yml deleted file mode 100644 index 0e88a7dc7..000000000 --- a/modules/invoiceOut/front/descriptor/locale/es.yml +++ /dev/null @@ -1,2 +0,0 @@ -Client card: Ficha del cliente -Invoice ticket list: Listado de tickets de la factura \ No newline at end of file diff --git a/modules/invoiceOut/front/global-invoicing/index.html b/modules/invoiceOut/front/global-invoicing/index.html deleted file mode 100644 index 3ece30862..000000000 --- a/modules/invoiceOut/front/global-invoicing/index.html +++ /dev/null @@ -1,158 +0,0 @@ - - - -
-
- - Build packaging tickets - - - {{'Invoicing client' | translate}} {{$ctrl.currentAddress.clientId}} - - - Stopping process - - - Ended process - -
-
-
- {{$ctrl.percentage | percentage: 0}} - ({{$ctrl.addressNumber}} of {{$ctrl.nAddresses}}) -
-
- {{$ctrl.nPdfs}} of {{$ctrl.totalPdfs}} - PDFs -
-
-
-
- - - - - Id - Client - Address id - Street - Error - - - - - - - {{::error.address.clientId}} - - - - {{::error.address.clientName}} - - - {{::error.address.id}} - - - {{::error.address.nickname}} - - - - {{::error.message}} - - - - - - - - - - - -
- - - - - - - - - -
{{::name}}
-
#{{::id}}
-
-
- - - - - - - - - - - - -
-
-
- - - diff --git a/modules/invoiceOut/front/global-invoicing/index.js b/modules/invoiceOut/front/global-invoicing/index.js deleted file mode 100644 index 9a936611a..000000000 --- a/modules/invoiceOut/front/global-invoicing/index.js +++ /dev/null @@ -1,174 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; -import UserError from 'core/lib/user-error'; -import './style.scss'; - -class Controller extends Section { - $onInit() { - const date = Date.vnNew(); - Object.assign(this, { - maxShipped: new Date(date.getFullYear(), date.getMonth(), 0), - clientsToInvoice: 'all', - companyFk: this.vnConfig.companyFk, - parallelism: 1 - }); - - const params = {companyFk: this.companyFk}; - this.$http.get('InvoiceOuts/getInvoiceDate', {params}) - .then(res => { - this.minInvoicingDate = res.data.issued ? new Date(res.data.issued) : null; - this.invoiceDate = this.minInvoicingDate; - }); - - const filter = {fields: ['parallelism']}; - this.$http.get('InvoiceOutConfigs/findOne', {filter}) - .then(res => { - if (res.data.parallelism) - this.parallelism = res.data.parallelism; - }) - .catch(res => { - if (res.status == 404) return; - throw res; - }); - } - - makeInvoice() { - this.invoicing = true; - this.status = 'packageInvoicing'; - this.errors = []; - this.addresses = null; - - try { - if (this.clientsToInvoice == 'one' && !this.clientId) - throw new UserError('Choose a valid client'); - if (!this.invoiceDate || !this.maxShipped) - throw new UserError('Invoice date and the max date should be filled'); - if (this.invoiceDate < this.maxShipped) - throw new UserError('Invoice date can\'t be less than max date'); - if (this.minInvoicingDate && this.invoiceDate.getTime() < this.minInvoicingDate.getTime()) - throw new UserError('Exists an invoice with a future date'); - if (!this.companyFk) - throw new UserError('Choose a valid company'); - if (!this.printerFk) - throw new UserError('Choose a valid printer'); - - if (this.clientsToInvoice == 'all') - this.clientId = undefined; - - const params = { - invoiceDate: this.invoiceDate, - maxShipped: this.maxShipped, - clientId: this.clientId, - companyFk: this.companyFk - }; - this.$http.post(`InvoiceOuts/clientsToInvoice`, params) - .then(res => { - this.addresses = res.data; - if (!this.addresses.length) - throw new UserError(`There aren't tickets to invoice`); - - this.nRequests = 0; - this.nPdfs = 0; - this.totalPdfs = 0; - this.addressIndex = 0; - this.invoiceClient(); - }) - .catch(err => this.handleError(err)); - } catch (err) { - this.handleError(err); - } - } - - handleError(err) { - this.invoicing = false; - this.status = null; - throw err; - } - - invoiceClient() { - if (this.nRequests == this.parallelism || this.isInvoicing) return; - - if (this.addressIndex >= this.addresses.length || this.status == 'stopping') { - if (this.nRequests) return; - this.invoicing = false; - this.status = 'done'; - return; - } - - this.status = 'invoicing'; - const address = this.addresses[this.addressIndex]; - this.currentAddress = address; - this.isInvoicing = true; - - const params = { - clientId: address.clientId, - addressId: address.id, - invoiceDate: this.invoiceDate, - maxShipped: this.maxShipped, - companyFk: this.companyFk - }; - - this.$http.post(`InvoiceOuts/invoiceClient`, params) - .then(res => { - this.isInvoicing = false; - if (res.data) - this.makePdfAndNotify(res.data, address); - this.invoiceNext(); - }) - .catch(res => { - this.isInvoicing = false; - if (res.status >= 400 && res.status < 500) { - this.invoiceError(address, res); - this.invoiceNext(); - } else { - this.invoicing = false; - this.status = 'done'; - throw new UserError(`Critical invoicing error, proccess stopped`); - } - }); - } - - invoiceNext() { - this.addressIndex++; - this.invoiceClient(); - } - - makePdfAndNotify(invoiceId, address) { - this.nRequests++; - this.totalPdfs++; - const params = {printerFk: this.printerFk}; - this.$http.post(`InvoiceOuts/${invoiceId}/makePdfAndNotify`, params) - .catch(res => { - this.invoiceError(address, res, true); - }) - .finally(() => { - this.nPdfs++; - this.nRequests--; - this.invoiceClient(); - }); - } - - invoiceError(address, res, isWarning) { - const message = res.data?.error?.message || res.message; - this.errors.unshift({address, message, isWarning}); - } - - get nAddresses() { - if (!this.addresses) return 0; - return this.addresses.length; - } - - get addressNumber() { - return Math.min(this.addressIndex + 1, this.nAddresses); - } - - get percentage() { - const len = this.nAddresses; - return Math.min(this.addressIndex, len) / len; - } -} - -ngModule.vnComponent('vnInvoiceOutGlobalInvoicing', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/invoiceOut/front/global-invoicing/index.spec.js b/modules/invoiceOut/front/global-invoicing/index.spec.js deleted file mode 100644 index 056839b20..000000000 --- a/modules/invoiceOut/front/global-invoicing/index.spec.js +++ /dev/null @@ -1,74 +0,0 @@ -import './index'; - -describe('InvoiceOut', () => { - describe('Component vnInvoiceOutGlobalInvoicing', () => { - let controller; - let $httpBackend; - - beforeEach(ngModule('invoiceOut')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - const $scope = $rootScope.$new(); - const $element = angular.element(''); - - controller = $componentController('vnInvoiceOutGlobalInvoicing', {$element, $scope}); - })); - - describe('makeInvoice()', () => { - it('should throw an error when invoiceDate or maxShipped properties are not filled in', () => { - jest.spyOn(controller.vnApp, 'showError'); - controller.clientsToInvoice = 'all'; - - let error; - try { - controller.makeInvoice(); - } catch (e) { - error = e.message; - } - - const expectedError = 'Invoice date and the max date should be filled'; - - expect(error).toBe(expectedError); - }); - - it('should throw an error when select one client and clientId is not filled in', () => { - jest.spyOn(controller.vnApp, 'showError'); - controller.clientsToInvoice = 'one'; - - let error; - try { - controller.makeInvoice(); - } catch (e) { - error = e.message; - } - - const expectedError = 'Choose a valid client'; - - expect(error).toBe(expectedError); - }); - - it('should make an http POST query and then call to the showSuccess() method', () => { - const date = Date.vnNew(); - Object.assign(controller, { - invoiceDate: date, - maxShipped: date, - minInvoicingDate: date, - clientsToInvoice: 'one', - clientId: 1101, - companyFk: 442, - printerFk: 1 - }); - $httpBackend.expectPOST(`InvoiceOuts/clientsToInvoice`).respond([{ - clientId: 1101, - id: 121 - }]); - $httpBackend.expectPOST(`InvoiceOuts/invoiceClient`).respond(); - controller.makeInvoice(); - $httpBackend.flush(); - - expect(controller.status).toEqual('done'); - }); - }); - }); -}); diff --git a/modules/invoiceOut/front/global-invoicing/locale/es.yml b/modules/invoiceOut/front/global-invoicing/locale/es.yml deleted file mode 100644 index f1a411ba1..000000000 --- a/modules/invoiceOut/front/global-invoicing/locale/es.yml +++ /dev/null @@ -1,22 +0,0 @@ -There aren't tickets to invoice: No existen tickets para facturar -Max date: Fecha límite -Invoice date: Fecha de factura -Invoice date can't be less than max date: La fecha de factura no puede ser inferior a la fecha límite -Invoice date and the max date should be filled: La fecha de factura y la fecha límite deben rellenarse -Choose a valid company: Selecciona un empresa válida -Choose a valid printer: Selecciona una impresora válida -All clients: Todos los clientes -Build packaging tickets: Generando tickets de embalajes -Address id: Id dirección -Printer: Impresora -of: de -PDFs: PDFs -Client: Cliente -Current client id: Id cliente actual -Invoicing client: Facturando cliente -Ended process: Proceso finalizado -Invoice out: Facturar -One client: Un solo cliente -Choose a valid client: Selecciona un cliente válido -Stop: Parar -Critical invoicing error, proccess stopped: Error crítico al facturar, proceso detenido diff --git a/modules/invoiceOut/front/global-invoicing/style.scss b/modules/invoiceOut/front/global-invoicing/style.scss deleted file mode 100644 index 3ad767aba..000000000 --- a/modules/invoiceOut/front/global-invoicing/style.scss +++ /dev/null @@ -1,21 +0,0 @@ -@import "variables"; - -vn-invoice-out-global-invoicing { - h5 { - color: $color-primary; - } - .status { - height: 80px; - display: flex; - align-items: center; - justify-content: center; - gap: 20px; - } - #error { - line-break: normal; - overflow-wrap: break-word; - white-space: normal; - } -} - - diff --git a/modules/invoiceOut/front/index.js b/modules/invoiceOut/front/index.js index 723e3be5a..a7209a0bd 100644 --- a/modules/invoiceOut/front/index.js +++ b/modules/invoiceOut/front/index.js @@ -1,13 +1,3 @@ export * from './module'; import './main'; -import './index/'; -import './search-panel'; -import './summary'; -import './card'; -import './descriptor'; -import './descriptor-popover'; -import './descriptor-menu'; -import './index/manual'; -import './global-invoicing'; -import './negative-bases'; diff --git a/modules/invoiceOut/front/index/index.html b/modules/invoiceOut/front/index/index.html deleted file mode 100644 index dc4d5d8a9..000000000 --- a/modules/invoiceOut/front/index/index.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - Reference - Issued - Amount - Client - Created - Company - Due date - - - - - - - - - - {{::invoiceOut.ref | dashIfEmpty}} - {{::invoiceOut.issued | date:'dd/MM/yyyy' | dashIfEmpty}} - {{::invoiceOut.amount | currency: 'EUR': 2 | dashIfEmpty}} - - - {{::invoiceOut.clientSocialName | dashIfEmpty}} - - - {{::invoiceOut.created | date:'dd/MM/yyyy' | dashIfEmpty}} - {{::invoiceOut.companyCode | dashIfEmpty}} - {{::invoiceOut.dued | date:'dd/MM/yyyy' | dashIfEmpty}} - - - - - - - - - -
- - -
- - - - - - - - diff --git a/modules/invoiceOut/front/index/index.js b/modules/invoiceOut/front/index/index.js deleted file mode 100644 index f109cd5b0..000000000 --- a/modules/invoiceOut/front/index/index.js +++ /dev/null @@ -1,47 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; - -export default class Controller extends Section { - get checked() { - const rows = this.$.model.data || []; - const checkedRows = []; - for (let row of rows) { - if (row.checked) - checkedRows.push(row.id); - } - - return checkedRows; - } - - get totalChecked() { - return this.checked.length; - } - - preview(invoiceOut) { - this.selectedInvoiceOut = invoiceOut; - this.$.summary.show(); - } - - openPdf() { - const access_token = this.vnToken.tokenMultimedia; - if (this.checked.length <= 1) { - const [invoiceOutId] = this.checked; - const url = `api/InvoiceOuts/${invoiceOutId}/download?access_token=${access_token}`; - window.open(url, '_blank'); - } else { - const invoiceOutIds = this.checked; - const invoicesIds = invoiceOutIds.join(','); - const serializedParams = this.$httpParamSerializer({ - access_token, - ids: invoicesIds - }); - const url = `api/InvoiceOuts/downloadZip?${serializedParams}`; - window.open(url, '_blank'); - } - } -} - -ngModule.vnComponent('vnInvoiceOutIndex', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/invoiceOut/front/index/locale/es.yml b/modules/invoiceOut/front/index/locale/es.yml deleted file mode 100644 index 74572da49..000000000 --- a/modules/invoiceOut/front/index/locale/es.yml +++ /dev/null @@ -1,9 +0,0 @@ -Created: Fecha creacion -Issued: Fecha factura -Due date: Fecha vencimiento -Has PDF: PDF disponible -Minimum: Minimo -Maximum: Máximo -Global invoicing: Facturación global -Manual invoicing: Facturación manual -Files are too large: Los archivos son demasiado grandes \ No newline at end of file diff --git a/modules/invoiceOut/front/index/manual/index.html b/modules/invoiceOut/front/index/manual/index.html deleted file mode 100644 index 3b991618d..000000000 --- a/modules/invoiceOut/front/index/manual/index.html +++ /dev/null @@ -1,86 +0,0 @@ - - Create manual invoice - - - - - - -
- - - Invoicing in progress... - -
- - - -
#{{::id}}
-
{{::nickname}}
-
-
- Or - - - - -
- - - - - - - - - - -
- - - - diff --git a/modules/invoiceOut/front/index/manual/index.js b/modules/invoiceOut/front/index/manual/index.js deleted file mode 100644 index 3abe4b825..000000000 --- a/modules/invoiceOut/front/index/manual/index.js +++ /dev/null @@ -1,51 +0,0 @@ -import ngModule from '../../module'; -import Dialog from 'core/components/dialog'; -import './style.scss'; - -class Controller extends Dialog { - constructor($element, $, $transclude) { - super($element, $, $transclude); - - this.isInvoicing = false; - this.invoice = { - maxShipped: Date.vnNew() - }; - } - - responseHandler(response) { - try { - if (response !== 'accept') - return super.responseHandler(response); - - if (this.invoice.clientFk && !this.invoice.maxShipped) - throw new Error('Client and the max shipped should be filled'); - - if (!this.invoice.serial || !this.invoice.taxArea) - throw new Error('Some fields are required'); - - this.isInvoicing = true; - return this.$http.post(`InvoiceOuts/createManualInvoice`, this.invoice) - .then(res => { - this.$state.go('invoiceOut.card.summary', {id: res.data.id}); - super.responseHandler(response); - }) - .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))) - .finally(() => this.isInvoicing = false); - } catch (e) { - this.vnApp.showError(this.$t(e.message)); - this.isInvoicing = false; - return false; - } - } -} - -Controller.$inject = ['$element', '$scope', '$transclude']; - -ngModule.vnComponent('vnInvoiceOutManual', { - slotTemplate: require('./index.html'), - controller: Controller, - bindings: { - ticketFk: ' { - describe('Component vnInvoiceOutManual', () => { - let controller; - let $httpBackend; - - beforeEach(ngModule('invoiceOut')); - - beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { - $httpBackend = _$httpBackend_; - let $scope = $rootScope.$new(); - const $element = angular.element(''); - const $transclude = { - $$boundTransclude: { - $$slots: [] - } - }; - controller = $componentController('vnInvoiceOutManual', {$element, $scope, $transclude}); - })); - - describe('responseHandler()', () => { - it('should throw an error when clientFk property is set and the maxShipped is not filled', () => { - jest.spyOn(controller.vnApp, 'showError'); - - controller.invoice = { - clientFk: 1101, - serial: 'T', - taxArea: 'B' - }; - - controller.responseHandler('accept'); - - expect(controller.vnApp.showError).toHaveBeenCalledWith(`Client and the max shipped should be filled`); - }); - - it('should throw an error when some required fields are not filled in', () => { - jest.spyOn(controller.vnApp, 'showError'); - - controller.invoice = { - ticketFk: 1101 - }; - - controller.responseHandler('accept'); - - expect(controller.vnApp.showError).toHaveBeenCalledWith(`Some fields are required`); - }); - - it('should make an http POST query and then call to the parent showSuccess() method', () => { - jest.spyOn(controller.vnApp, 'showSuccess'); - - controller.invoice = { - ticketFk: 1101, - serial: 'T', - taxArea: 'B' - }; - - $httpBackend.expect('POST', `InvoiceOuts/createManualInvoice`).respond({id: 1}); - controller.responseHandler('accept'); - $httpBackend.flush(); - - expect(controller.vnApp.showSuccess).toHaveBeenCalled(); - }); - }); - }); -}); diff --git a/modules/invoiceOut/front/index/manual/locale/es.yml b/modules/invoiceOut/front/index/manual/locale/es.yml deleted file mode 100644 index 370e823d0..000000000 --- a/modules/invoiceOut/front/index/manual/locale/es.yml +++ /dev/null @@ -1,6 +0,0 @@ -Create manual invoice: Crear factura manual -Some fields are required: Algunos campos son obligatorios -Client and max shipped fields should be filled: Los campos de cliente y fecha límite deben rellenarse -Max date: Fecha límite -Serial: Serie -Invoicing in progress...: Facturación en progreso... \ No newline at end of file diff --git a/modules/invoiceOut/front/index/manual/style.scss b/modules/invoiceOut/front/index/manual/style.scss deleted file mode 100644 index 820c07756..000000000 --- a/modules/invoiceOut/front/index/manual/style.scss +++ /dev/null @@ -1,17 +0,0 @@ -@import "variables"; - -.vn-invoice-out-manual { - tpl-body { - width: 500px; - - .progress { - font-weight: bold; - text-align: center; - font-size: 1.5rem; - color: $color-primary; - vn-horizontal { - justify-content: center - } - } - } -} diff --git a/modules/invoiceOut/front/main/index.html b/modules/invoiceOut/front/main/index.html index ab3fce9ea..e69de29bb 100644 --- a/modules/invoiceOut/front/main/index.html +++ b/modules/invoiceOut/front/main/index.html @@ -1,18 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/modules/invoiceOut/front/main/index.js b/modules/invoiceOut/front/main/index.js index ad37e9c4b..f7e21a126 100644 --- a/modules/invoiceOut/front/main/index.js +++ b/modules/invoiceOut/front/main/index.js @@ -1,7 +1,15 @@ import ngModule from '../module'; import ModuleMain from 'salix/components/module-main'; -export default class InvoiceOut extends ModuleMain {} +export default class InvoiceOut extends ModuleMain { + constructor($element, $) { + super($element, $); + } + async $onInit() { + this.$state.go('home'); + window.location.href = await this.vnApp.getUrl(`invoice-out/`); + } +} ngModule.vnComponent('vnInvoiceOut', { controller: InvoiceOut, diff --git a/modules/invoiceOut/front/locale/es.yml b/modules/invoiceOut/front/main/locale/es.yml similarity index 100% rename from modules/invoiceOut/front/locale/es.yml rename to modules/invoiceOut/front/main/locale/es.yml diff --git a/modules/invoiceOut/front/negative-bases/index.html b/modules/invoiceOut/front/negative-bases/index.html deleted file mode 100644 index 499b6bfe0..000000000 --- a/modules/invoiceOut/front/negative-bases/index.html +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Company - - Country - - Client id - - Client - - Amount - - Base - - Ticket id - - Active - - Has To Invoice - - Verified data - - Comercial -
{{client.company | dashIfEmpty}}{{client.country | dashIfEmpty}} - - {{::client.clientId | dashIfEmpty}} - - {{client.clientSocialName | dashIfEmpty}}{{client.amount | currency: 'EUR':2 | dashIfEmpty}}{{client.taxableBase | dashIfEmpty}} - - {{::client.ticketFk | dashIfEmpty}} - - - - - - - - - - - - - {{::client.workerName | dashIfEmpty}} - -
-
-
-
- - - - - - diff --git a/modules/invoiceOut/front/negative-bases/index.js b/modules/invoiceOut/front/negative-bases/index.js deleted file mode 100644 index 7ce610513..000000000 --- a/modules/invoiceOut/front/negative-bases/index.js +++ /dev/null @@ -1,74 +0,0 @@ -import ngModule from '../module'; -import Section from 'salix/components/section'; -import './style.scss'; - -export default class Controller extends Section { - constructor($element, $, vnReport) { - super($element, $); - - this.vnReport = vnReport; - const now = Date.vnNew(); - const firstDayOfMonth = new Date(now.getFullYear(), now.getMonth(), 1); - const lastDayOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0); - this.params = { - from: firstDayOfMonth, - to: lastDayOfMonth - }; - this.$checkAll = false; - - this.smartTableOptions = { - activeButtons: { - search: true, - }, - columns: [ - { - field: 'isActive', - searchable: false - }, - { - field: 'hasToInvoice', - searchable: false - }, - { - field: 'isTaxDataChecked', - searchable: false - }, - ] - }; - } - - exprBuilder(param, value) { - switch (param) { - case 'company': - return {'company': value}; - case 'country': - return {'country': value}; - case 'clientId': - return {'clientId': value}; - case 'clientSocialName': - return {'clientSocialName': value}; - case 'amount': - return {'amount': value}; - case 'taxableBase': - return {'taxableBase': value}; - case 'ticketFk': - return {'ticketFk': value}; - case 'comercialName': - return {'comercialName': value}; - } - } - - downloadCSV() { - this.vnReport.show('InvoiceOuts/negativeBasesCsv', { - from: this.params.from, - to: this.params.to - }); - } -} - -Controller.$inject = ['$element', '$scope', 'vnReport']; - -ngModule.vnComponent('vnNegativeBases', { - template: require('./index.html'), - controller: Controller -}); diff --git a/modules/invoiceOut/front/negative-bases/locale/es.yml b/modules/invoiceOut/front/negative-bases/locale/es.yml deleted file mode 100644 index dd3432592..000000000 --- a/modules/invoiceOut/front/negative-bases/locale/es.yml +++ /dev/null @@ -1,2 +0,0 @@ -Has To Invoice: Facturar -Download as CSV: Descargar como CSV diff --git a/modules/invoiceOut/front/negative-bases/style.scss b/modules/invoiceOut/front/negative-bases/style.scss deleted file mode 100644 index 2d628cb94..000000000 --- a/modules/invoiceOut/front/negative-bases/style.scss +++ /dev/null @@ -1,10 +0,0 @@ -@import "./variables"; - -vn-negative-bases { - vn-date-picker{ - padding-right: 5%; - } - slot-actions{ - align-items: center; - } -} diff --git a/modules/invoiceOut/front/routes.json b/modules/invoiceOut/front/routes.json index f7f589b01..26dd2da03 100644 --- a/modules/invoiceOut/front/routes.json +++ b/modules/invoiceOut/front/routes.json @@ -25,36 +25,6 @@ "state": "invoiceOut.index", "component": "vn-invoice-out-index", "description": "InvoiceOut" - }, - { - "url": "/global-invoicing?q", - "state": "invoiceOut.global-invoicing", - "component": "vn-invoice-out-global-invoicing", - "description": "Global invoicing" - }, - { - "url": "/summary", - "state": "invoiceOut.card.summary", - "component": "vn-invoice-out-summary", - "description": "Summary", - "params": { - "invoice-out": "$ctrl.invoiceOut" - } - }, - { - "url": "/:id", - "state": "invoiceOut.card", - "abstract": true, - "component": "vn-invoice-out-card" - }, - { - "url": "/negative-bases", - "state": "invoiceOut.negative-bases", - "component": "vn-negative-bases", - "description": "Negative bases", - "acl": [ - "administrative" - ] } ] } diff --git a/modules/invoiceOut/front/search-panel/index.html b/modules/invoiceOut/front/search-panel/index.html deleted file mode 100644 index f49002cca..000000000 --- a/modules/invoiceOut/front/search-panel/index.html +++ /dev/null @@ -1,68 +0,0 @@ -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
diff --git a/modules/invoiceOut/front/search-panel/index.js b/modules/invoiceOut/front/search-panel/index.js deleted file mode 100644 index a77d479ca..000000000 --- a/modules/invoiceOut/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('vnInvoiceSearchPanel', { - template: require('./index.html'), - controller: SearchPanel -}); diff --git a/modules/invoiceOut/front/summary/index.html b/modules/invoiceOut/front/summary/index.html deleted file mode 100644 index b83775158..000000000 --- a/modules/invoiceOut/front/summary/index.html +++ /dev/null @@ -1,104 +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.totalWithVat | currency: 'EUR': 2}} - - - - - -
-
-
- - - - \ No newline at end of file diff --git a/modules/invoiceOut/front/summary/index.js b/modules/invoiceOut/front/summary/index.js deleted file mode 100644 index 131f9ba8f..000000000 --- a/modules/invoiceOut/front/summary/index.js +++ /dev/null @@ -1,34 +0,0 @@ -import ngModule from '../module'; -import Summary from 'salix/components/summary'; -import './style.scss'; - -class Controller extends Summary { - get invoiceOut() { - return this._invoiceOut; - } - - set invoiceOut(value) { - this._invoiceOut = value; - if (value && value.id) { - this.loadData(); - this.loadTickets(); - } - } - - loadData() { - this.$http.get(`InvoiceOuts/${this.invoiceOut.id}/summary`) - .then(res => this.summary = res.data); - } - - loadTickets() { - this.$.$applyAsync(() => this.$.ticketsModel.refresh()); - } -} - -ngModule.vnComponent('vnInvoiceOutSummary', { - template: require('./index.html'), - controller: Controller, - bindings: { - invoiceOut: '<' - } -}); diff --git a/modules/invoiceOut/front/summary/index.spec.js b/modules/invoiceOut/front/summary/index.spec.js deleted file mode 100644 index 44e3094ae..000000000 --- a/modules/invoiceOut/front/summary/index.spec.js +++ /dev/null @@ -1,31 +0,0 @@ -import './index.js'; -import crudModel from 'core/mocks/crud-model'; - -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}; - controller.$.ticketsModel = crudModel; - })); - - describe('loadData()', () => { - it('should perform a query to set summary', () => { - $httpBackend.expect('GET', `InvoiceOuts/1/summary`).respond(200, 'the data you are looking for'); - controller.loadData(); - $httpBackend.flush(); - - expect(controller.summary).toEqual('the data you are looking for'); - }); - }); - }); -}); diff --git a/modules/invoiceOut/front/summary/locale/es.yml b/modules/invoiceOut/front/summary/locale/es.yml deleted file mode 100644 index caff7ce99..000000000 --- a/modules/invoiceOut/front/summary/locale/es.yml +++ /dev/null @@ -1,13 +0,0 @@ -Date: Fecha -Created: Creada -Due: Vencimiento -Booked: Asentado -General VAT: IVA general -Reduced VAT: IVA reducido -Shipped: F. envío -Type: Tipo -Rate: Tasa -Fee: Cuota -Taxable base: Base imp. -Tax breakdown: Desglose impositivo -Go to the Invoice Out: Ir a la factura emitida \ No newline at end of file diff --git a/modules/invoiceOut/front/summary/style.scss b/modules/invoiceOut/front/summary/style.scss deleted file mode 100644 index e6e31fd94..000000000 --- a/modules/invoiceOut/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