From 69069d5e2817295bfbcecc77f237119a63bce9bd Mon Sep 17 00:00:00 2001 From: carlosjr Date: Thu, 15 Apr 2021 10:46:23 +0200 Subject: [PATCH] invoiceIn summary frontend --- modules/invoiceIn/front/index.js | 2 + modules/invoiceIn/front/summary/index.html | 52 +++++++++++++++++++ modules/invoiceIn/front/summary/index.js | 28 ++++++++++ modules/invoiceIn/front/summary/index.spec.js | 29 +++++++++++ modules/invoiceIn/front/summary/locale/es.yml | 10 ++++ modules/invoiceIn/front/summary/style.scss | 5 ++ 6 files changed, 126 insertions(+) create mode 100644 modules/invoiceIn/front/summary/index.html create mode 100644 modules/invoiceIn/front/summary/index.js create mode 100644 modules/invoiceIn/front/summary/index.spec.js create mode 100644 modules/invoiceIn/front/summary/locale/es.yml create mode 100644 modules/invoiceIn/front/summary/style.scss diff --git a/modules/invoiceIn/front/index.js b/modules/invoiceIn/front/index.js index acb341c50..6c175d9a0 100644 --- a/modules/invoiceIn/front/index.js +++ b/modules/invoiceIn/front/index.js @@ -6,3 +6,5 @@ import './search-panel'; import './card'; import './descriptor'; import './descriptor-popover'; +import './summary'; +import './basic-data'; diff --git a/modules/invoiceIn/front/summary/index.html b/modules/invoiceIn/front/summary/index.html new file mode 100644 index 000000000..c097ec8cf --- /dev/null +++ b/modules/invoiceIn/front/summary/index.html @@ -0,0 +1,52 @@ + +
+ + + + {{$ctrl.summary.id}} - {{$ctrl.summary.supplier.name}} +
+ + +

Basic data

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + \ No newline at end of file diff --git a/modules/invoiceIn/front/summary/index.js b/modules/invoiceIn/front/summary/index.js new file mode 100644 index 000000000..54b5bcd00 --- /dev/null +++ b/modules/invoiceIn/front/summary/index.js @@ -0,0 +1,28 @@ +import ngModule from '../module'; +import Summary from 'salix/components/summary'; +import './style.scss'; + +class Controller extends Summary { + set invoiceIn(value) { + this._invoiceIn = value; + if (value && value.id) + this.getSummary(); + } + + get invoiceIn() { + return this._invoiceIn; + } + + getSummary() { + return this.$http.get(`InvoiceIns/${this.invoiceIn.id}/summary`) + .then(res => this.summary = res.data); + } +} + +ngModule.vnComponent('vnInvoiceInSummary', { + template: require('./index.html'), + controller: Controller, + bindings: { + invoiceIn: '<' + } +}); diff --git a/modules/invoiceIn/front/summary/index.spec.js b/modules/invoiceIn/front/summary/index.spec.js new file mode 100644 index 000000000..56bfe9f4a --- /dev/null +++ b/modules/invoiceIn/front/summary/index.spec.js @@ -0,0 +1,29 @@ +import './index.js'; + +describe('InvoiceIn', () => { + describe('Component summary', () => { + let controller; + let $httpBackend; + let $scope; + + beforeEach(ngModule('invoiceIn')); + + beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => { + $httpBackend = _$httpBackend_; + $scope = $rootScope.$new(); + const $element = angular.element(''); + controller = $componentController('vnInvoiceInSummary', {$element, $scope}); + controller.invoiceIn = {id: 1}; + })); + + describe('getSummary()', () => { + it('should perform a query to set summary', () => { + $httpBackend.when('GET', `InvoiceIns/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/locale/es.yml b/modules/invoiceIn/front/summary/locale/es.yml new file mode 100644 index 000000000..29bed3f9c --- /dev/null +++ b/modules/invoiceIn/front/summary/locale/es.yml @@ -0,0 +1,10 @@ +Go to the Invoice In: Ir a la factura recibida +Expedition date: Fecha expedición +Operation date: Fecha operación +Supplier ref: Ref. proveedor +Entry date: Fecha asiento +Booked date: Fecha contable +Accounted date: Fecha contable +Doc number: Numero documento +Sage withholding: Retención sage +Deductible: Deducible \ No newline at end of file diff --git a/modules/invoiceIn/front/summary/style.scss b/modules/invoiceIn/front/summary/style.scss new file mode 100644 index 000000000..f7ddb2cb7 --- /dev/null +++ b/modules/invoiceIn/front/summary/style.scss @@ -0,0 +1,5 @@ +@import "variables"; + +vn-invoice-in-summary .summary { + width: $width-lg; +} \ No newline at end of file