Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
This commit is contained in:
commit
8aa0497524
|
@ -70,8 +70,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<vn-confirm
|
||||
vn-id="confirm-dialog"
|
||||
on-response="$ctrl.returnDialog(response)"
|
||||
question="Pickup order"
|
||||
message="Do you want to send it directly?">
|
||||
vn-id="confirm-pickup-order"
|
||||
on-response="$ctrl.sendPickupOrder(response)"
|
||||
question="Send Pickup order"
|
||||
message="Are you sure you want to send it?">
|
||||
</vn-confirm>
|
|
@ -8,7 +8,8 @@ class Controller {
|
|||
this.$translate = $translate;
|
||||
this.vnApp = vnApp;
|
||||
this.moreOptions = [
|
||||
{callback: this.showConfirmDialog, name: 'Pickup order'}
|
||||
{callback: this.showPickupOrder, name: 'Show Pickup order'},
|
||||
{callback: this.confirmPickupOrder, name: 'Send Pickup order'}
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -47,15 +48,17 @@ class Controller {
|
|||
callback.call(this);
|
||||
}
|
||||
|
||||
showConfirmDialog() {
|
||||
this.$scope.confirmDialog.show();
|
||||
}
|
||||
|
||||
returnDialog(response) {
|
||||
if (response === 'CANCEL') {
|
||||
showPickupOrder() {
|
||||
let url = `/api/report/rpt-claim-pickup-order?claimFk=${this.claim.id}`;
|
||||
window.open(url);
|
||||
} else if (response === 'ACCEPT') {
|
||||
}
|
||||
|
||||
confirmPickupOrder() {
|
||||
this.$scope.confirmPickupOrder.show();
|
||||
}
|
||||
|
||||
sendPickupOrder(response) {
|
||||
if (response === 'ACCEPT') {
|
||||
this.$http.post(`/api/email/claim-pickup-order`, {claimFk: this.claim.id}).then(
|
||||
() => this.vnApp.showMessage(this.$translate.instant('Notification sent!'))
|
||||
);
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
import './index.js';
|
||||
|
||||
describe('Item Component vnClaimDescriptor', () => {
|
||||
let $httpBackend;
|
||||
let controller;
|
||||
|
||||
beforeEach(() => {
|
||||
ngModule('claim');
|
||||
});
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
controller = $componentController('vnClaimDescriptor');
|
||||
controller.claim = {id: 2};
|
||||
}));
|
||||
|
||||
describe('showPickupOrder()', () => {
|
||||
it('should open a new window showing a pickup order PDF document', () => {
|
||||
let expectedPath = '/api/report/rpt-claim-pickup-order?claimFk=2';
|
||||
spyOn(window, 'open');
|
||||
controller.showPickupOrder();
|
||||
|
||||
expect(window.open).toHaveBeenCalledWith(expectedPath);
|
||||
});
|
||||
});
|
||||
|
||||
describe('confirmPickupOrder()', () => {
|
||||
it('should call confirmPickupOrder.show()', () => {
|
||||
controller.$scope.confirmPickupOrder = {
|
||||
show: jasmine.createSpy('show')
|
||||
};
|
||||
controller.claim = {id: 2};
|
||||
controller.confirmPickupOrder();
|
||||
|
||||
expect(controller.$scope.confirmPickupOrder.show).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('sendPickupOrder(response)', () => {
|
||||
it('should make a query and call vnApp.showMessage() if the response is ACCEPT', () => {
|
||||
spyOn(controller.vnApp, 'showMessage');
|
||||
|
||||
$httpBackend.when('POST', `/api/email/claim-pickup-order`, {claimFk: 2}).respond();
|
||||
$httpBackend.expect('POST', `/api/email/claim-pickup-order`, {claimFk: 2}).respond();
|
||||
controller.sendPickupOrder('ACCEPT');
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.vnApp.showMessage).toHaveBeenCalledWith('Notification sent!');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
#Ordenar alfabeticamente
|
||||
Add sale: Añadir linea
|
||||
Are you sure you want to send it?: ¿Seguro que quieres enviarlo?
|
||||
Client Id: Id cliente
|
||||
Claimed ticket: Ticket reclamado
|
||||
Observation: Observación
|
||||
|
@ -7,5 +8,6 @@ Responsible: Responsable
|
|||
Remove sale: Borrar linea
|
||||
Claim Id: Id reclamación
|
||||
Created: Creado
|
||||
Pickup order: Orden de recogida
|
||||
Do you want to send it directly?: ¿Quieres enviarlo directamente?
|
||||
Send Pickup order: Enviar orden de recogida
|
||||
Show Pickup order: Ver orden de recogida
|
||||
|
||||
|
|
Loading…
Reference in New Issue