2744-invoiceIn-module_rdy_n_summary #602

Merged
joan merged 10 commits from 2744-invoiceIn-module_rdy_n_summary into dev 2021-04-15 10:06:35 +00:00
6 changed files with 126 additions and 0 deletions
Showing only changes of commit 69069d5e28 - Show all commits

View File

@ -6,3 +6,5 @@ import './search-panel';
import './card'; import './card';
import './descriptor'; import './descriptor';
import './descriptor-popover'; import './descriptor-popover';
import './summary';
import './basic-data';

View File

@ -0,0 +1,52 @@
<vn-card class="summary">
<h5>
<a
ng-if="::$ctrl.summary.id"
vn-tooltip="Go to the Invoice In"
ui-sref="invoiceIn.card.summary({id: {{::$ctrl.summary.id}}})"
name="goToSummary">
<vn-icon-button icon="launch"></vn-icon-button>
</a>
<span>{{$ctrl.summary.id}} - {{$ctrl.summary.supplier.name}}</span>
</h5>
<vn-horizontal>
<vn-auto>
<h4 translate>Basic data</h4>
<vn-horizontal>
<vn-one>
<vn-label-value label="Supplier" value="{{$ctrl.summary.supplier.name}}">
</vn-label-value>
<vn-label-value label="Supplier ref" value="{{$ctrl.summary.supplierRef}}">
</vn-label-value>
<vn-label-value label="Doc number" value="{{$ctrl.summary.serial}}/{{$ctrl.summary.serialNumber}}">
</vn-label-value>
</vn-one>
<vn-one>
<vn-label-value label="Expedition date" value="{{$ctrl.summary.issued | date: 'dd/MM/yyyy'}}">
</vn-label-value>
<vn-label-value label="Operation date" value="{{$ctrl.summary.operated | date: 'dd/MM/yyyy'}}">
</vn-label-value>
<vn-label-value label="Entry date" value="{{$ctrl.summary.bookEntried | date: 'dd/MM/yyyy'}}">
</vn-label-value>
<vn-label-value label="Booked date" value="{{$ctrl.summary.booked | date: 'dd/MM/yyyy'}}">
</vn-label-value>
</vn-one>
<vn-one>
<vn-label-value label="Sage withholding" value="{{$ctrl.summary.withholdingSageFk}}">
</vn-label-value>
<vn-label-value label="Company" value="{{$ctrl.summary.company.code}}">
</vn-label-value>
<vn-vertical>
<vn-check label="Deductible" ng-model="$ctrl.summary.isVatDeductible" disabled="true">
</vn-check>
<vn-check label="Booked" ng-model="$ctrl.summary.isBooked" disabled="true">
</vn-check>
</vn-vertical>
</vn-one>
</vn-horizontal>
</vn-auto>
</vn-horizontal>
</vn-card>
<vn-supplier-descriptor-popover
vn-id="supplierDescriptor">
</vn-supplier-descriptor-popover>

View File

@ -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: '<'
}
});

View File

@ -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('<vn-invoice-in-summary></vn-invoice-in-summary>');
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');
});
});
});
});

View File

@ -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

View File

@ -0,0 +1,5 @@
@import "variables";
vn-invoice-in-summary .summary {
width: $width-lg;
}