Merge fixes
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2020-05-19 10:51:50 +02:00
parent d7f2e686b1
commit e7cf060e12
9 changed files with 58 additions and 58 deletions

View File

@ -479,7 +479,7 @@ export default {
secondSaleIdInput: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete', secondSaleIdInput: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete',
secondSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete', secondSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete',
secondSaleQuantity: 'vn-ticket-sale vn-table vn-tr:nth-child(2) vn-input-number', secondSaleQuantity: 'vn-ticket-sale vn-table vn-tr:nth-child(2) vn-input-number',
secondSaleConceptCell: 'vn-ticket-sale > vn-vertical > vn-card > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td-editable:nth-child(6)', secondSaleConceptCell: 'vn-ticket-sale vn-tbody > :nth-child(2) > :nth-child(6)',
secondSaleConceptInput: 'vn-ticket-sale vn-table vn-tr:nth-child(2) > vn-td-editable.ng-isolate-scope.selected vn-textfield', secondSaleConceptInput: 'vn-ticket-sale vn-table vn-tr:nth-child(2) > vn-td-editable.ng-isolate-scope.selected vn-textfield',
totalImport: 'vn-ticket-sale > vn-vertical > vn-card > vn-vertical > vn-horizontal > vn-one > p:nth-child(3) > strong', totalImport: 'vn-ticket-sale > vn-vertical > vn-card > vn-vertical > vn-horizontal > vn-one > p:nth-child(3) > strong',
selectAllSalesCheckbox: 'vn-ticket-sale vn-thead vn-check', selectAllSalesCheckbox: 'vn-ticket-sale vn-thead vn-check',

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
describe('Order lines', () => { fdescribe('Order lines', () => {
let browser; let browser;
let page; let page;
beforeAll(async() => { beforeAll(async() => {

View File

@ -14,7 +14,6 @@ function vnAcl(aclService) {
let action = $attrs.vnAclAction || 'disable'; let action = $attrs.vnAclAction || 'disable';
if (aclService.hasAny(acls)) return; if (aclService.hasAny(acls)) return;
console.log('acls', acls, action);
if (action === 'disable') { if (action === 'disable') {
let element = $element[0]; let element = $element[0];

View File

@ -0,0 +1,21 @@
describe('Id filter', () => {
let idFilter;
beforeEach(ngModule('vnCore'));
beforeEach(inject(_idFilter_ => {
idFilter = _idFilter_;
}));
it('should return empty string for input null', () => {
expect(idFilter(null)).toBe('');
});
it('should return empty stringfor input empty', () => {
expect(idFilter('')).toBe('');
});
it('should prefix a pad character', () => {
expect(idFilter('123')).toBe('#123');
});
});

View File

@ -167,5 +167,5 @@
vn-id="update-greuge" vn-id="update-greuge"
question="Insert greuges on client card" question="Insert greuges on client card"
message="Do you want to insert greuges?" message="Do you want to insert greuges?"
on-response="$ctrl.onUpdateGreugeResponse($response)"> on-accept="$ctrl.onUpdateGreugeAccept()">
</vn-confirm> </vn-confirm>

View File

@ -76,8 +76,7 @@ export default class Controller extends Section {
}; };
this.$.lastTicketsModel.filter = filter; this.$.lastTicketsModel.filter = filter;
this.$.lastTicketsModel.refresh(); this.$.lastTicketsModel.refresh();
this.$.lastTicketsPopover.parent = event.target; this.$.lastTicketsPopover.show(event);
this.$.lastTicketsPopover.show();
} }
importTicketLines(ticketFk) { importTicketLines(ticketFk) {
@ -122,29 +121,26 @@ export default class Controller extends Section {
}); });
} }
onUpdateGreugeResponse(response) { onUpdateGreugeAccept() {
if (response == 'accept') { const promises = [];
const promises = []; promises.push(this.getGreugeTypeId());
promises.push(this.getGreugeTypeId()); promises.push(this.getGreugeConfig());
promises.push(this.getGreugeConfig());
return Promise.all(promises).then(() => { return Promise.all(promises).then(() => {
const data = { const data = {
clientFk: this.claim.clientFk, clientFk: this.claim.clientFk,
description: this.$t('ClaimGreugeDescription', { description: this.$t('ClaimGreugeDescription', {
claimId: this.claim.id claimId: this.claim.id
}).toUpperCase(), }).toUpperCase(),
amount: this.freightPickUpPrice, amount: this.freightPickUpPrice,
greugeTypeFk: this.greugeTypeFreightId, greugeTypeFk: this.greugeTypeFreightId,
ticketFk: this.claim.ticketFk ticketFk: this.claim.ticketFk
}; };
return this.$http.post(`Greuges/`, data).then(() => { return this.$http.post(`Greuges`, data).then(() => {
this.vnApp.showSuccess(this.$t('Data saved!')); this.vnApp.showSuccess(this.$t('Data saved!'));
this.vnApp.showMessage(this.$t('Greuge inserted')); this.vnApp.showMessage(this.$t('Greuge inserted'));
});
}); });
} else });
this.vnApp.showSuccess(this.$t('Data saved!'));
} }
save(data) { save(data) {

View File

@ -6,20 +6,15 @@ describe('claim', () => {
let controller; let controller;
let $httpBackend; let $httpBackend;
let $state; let $state;
let $httpParamSerializer;
let $scope;
beforeEach(ngModule('claim')); beforeEach(ngModule('claim'));
beforeEach(angular.mock.inject(($rootScope, $componentController, _$state_, _$httpBackend_, _$httpParamSerializer_) => { beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => {
$scope = $rootScope.$new();
$httpBackend = _$httpBackend_; $httpBackend = _$httpBackend_;
$httpParamSerializer = _$httpParamSerializer_;
$state = _$state_; $state = _$state_;
$state.params.id = 1; $state.params.id = 1;
const $element = angular.element('<vn-claim-action></vn-claim-action>'); controller = $componentController('vnClaimAction', {$element: null});
controller = $componentController('vnClaimAction', {$element, $scope});
controller.claim = {ticketFk: 1}; controller.claim = {ticketFk: 1};
controller.$.model = {refresh: () => {}}; controller.$.model = {refresh: () => {}};
controller.$.addSales = { controller.$.addSales = {
@ -67,8 +62,8 @@ describe('claim', () => {
controller.importToNewRefundTicket(); controller.importToNewRefundTicket();
$httpBackend.flush(); $httpBackend.flush();
expect(controller.$.model.refresh).toHaveBeenCalledWith(); expect(controller.$.model.refresh).toHaveBeenCalled();
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); expect(controller.vnApp.showSuccess).toHaveBeenCalled();
}); });
}); });
@ -79,8 +74,8 @@ describe('claim', () => {
controller.showLastTickets({}); controller.showLastTickets({});
expect(controller.$.lastTicketsModel.refresh).toHaveBeenCalledWith(); expect(controller.$.lastTicketsModel.refresh).toHaveBeenCalled();
expect(controller.$.lastTicketsPopover.show).toHaveBeenCalledWith(); expect(controller.$.lastTicketsPopover.show).toHaveBeenCalled();
}); });
}); });
@ -124,33 +119,21 @@ describe('claim', () => {
controller.save(data); controller.save(data);
$httpBackend.flush(); $httpBackend.flush();
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); expect(controller.vnApp.showSuccess).toHaveBeenCalled();
}); });
}); });
describe('onUpdateGreugeResponse()', () => { describe('onUpdateGreugeAccept()', () => {
const greugeTypeId = 7; const greugeTypeId = 7;
const freightPickUpPrice = 11; const freightPickUpPrice = 11;
it('should do nothing', () => {
jest.spyOn(controller.$http, 'post');
jest.spyOn(controller.card, 'reload');
jest.spyOn(controller.vnApp, 'showSuccess');
controller.onUpdateGreugeResponse('cancel');
expect(controller.$http.post).not.toHaveBeenCalledWith();
expect(controller.card.reload).not.toHaveBeenCalledWith();
expect(controller.vnApp.showSuccess).not.toHaveBeenCalledWith('Greuge inserted!');
});
it('should make a query and get the greugeTypeId and greuge config', () => { it('should make a query and get the greugeTypeId and greuge config', () => {
jest.spyOn(controller.card, 'reload'); jest.spyOn(controller.card, 'reload');
jest.spyOn(controller.vnApp, 'showSuccess'); jest.spyOn(controller.vnApp, 'showSuccess');
const greugeTypeParams = $httpParamSerializer({filter: {where: {code: 'freightPickUp'}}}); $httpBackend.expectRoute('GET', `GreugeTypes/findOne`).respond({id: greugeTypeId});
$httpBackend.expect('GET', `GreugeTypes/findOne?${greugeTypeParams}`).respond({id: greugeTypeId}); $httpBackend.expectGET(`GreugeConfigs/findOne`).respond({freightPickUpPrice});
$httpBackend.expect('GET', `GreugeConfigs/findOne`).respond({freightPickUpPrice}); controller.onUpdateGreugeAccept();
controller.onUpdateGreugeResponse('accept');
$httpBackend.flush(); $httpBackend.flush();
expect(controller.greugeTypeFreightId).toEqual(greugeTypeId); expect(controller.greugeTypeFreightId).toEqual(greugeTypeId);
@ -181,7 +164,7 @@ describe('claim', () => {
$httpBackend.expect('POST', `Greuges/`, data).respond(new Promise(resolve => { $httpBackend.expect('POST', `Greuges/`, data).respond(new Promise(resolve => {
return resolve({id: freightPickUpPrice}); return resolve({id: freightPickUpPrice});
})); }));
controller.onUpdateGreugeResponse('accept').then(res => { controller.onUpdateGreugeAccept().then(res => {
}).catch(error => { }).catch(error => {

View File

@ -39,7 +39,8 @@
ng-class="{alert: $ctrl.client.debt > $ctrl.client.credit}" ng-class="{alert: $ctrl.client.debt > $ctrl.client.credit}"
info="Invoices minus payments plus orders not yet invoiced"> info="Invoices minus payments plus orders not yet invoiced">
</vn-label-value> </vn-label-value>
<vn-label-value label="Sales person" <vn-label-value
label="Sales person"
value="{{$ctrl.client.salesPerson.user.nickname}}"> value="{{$ctrl.client.salesPerson.user.nickname}}">
</vn-label-value> </vn-label-value>
</div> </div>

2
package-lock.json generated
View File

@ -17888,7 +17888,7 @@
}, },
"xmlbuilder": { "xmlbuilder": {
"version": "9.0.7", "version": "9.0.7",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", "resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",
"integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0="
}, },
"xmlcreate": { "xmlcreate": {