Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
This commit is contained in:
commit
774d8524cc
|
@ -169,7 +169,7 @@
|
||||||
<h5 style="text-align: center">
|
<h5 style="text-align: center">
|
||||||
<span translate>Change shipped hour</span>
|
<span translate>Change shipped hour</span>
|
||||||
</h5>
|
</h5>
|
||||||
<vn-input-time vn-one model="$ctrl.ticket.shipped" label="Shipped hour"></vn-input-time>
|
<vn-input-time vn-one model="$ctrl.newShipped" label="Shipped hour"></vn-input-time>
|
||||||
</div>
|
</div>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
<tpl-buttons>
|
<tpl-buttons>
|
||||||
|
|
|
@ -45,14 +45,14 @@ class Controller {
|
||||||
this.vnApp.showError(this.$translate.instant('This ticket can\'t be modified'));
|
this.vnApp.showError(this.$translate.instant('This ticket can\'t be modified'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.newShipped = new Date(this.ticket.shipped);
|
this.newShipped = this.ticket.shipped;
|
||||||
this.$scope.changeShippedDialog.show();
|
this.$scope.changeShippedDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
changeShipped(response) {
|
changeShipped(response) {
|
||||||
if (response === 'ACCEPT') {
|
if (response === 'ACCEPT') {
|
||||||
let params = {shipped: this.newShipped};
|
let params = {shipped: this.newShipped};
|
||||||
this.$http.patch(`/ticket/api/Tickets/${this.ticket.id}/`, params).then(() => {
|
this.$http.patch(`/ticket/api/Tickets/${this.ticket.id}`, params).then(() => {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Shipped hour updated'));
|
this.vnApp.showSuccess(this.$translate.instant('Shipped hour updated'));
|
||||||
this.cardReload();
|
this.cardReload();
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,6 +10,9 @@ describe('Ticket Component vnTicketDescriptor', () => {
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
controller = $componentController('vnTicketDescriptor');
|
controller = $componentController('vnTicketDescriptor');
|
||||||
controller.ticket = {id: 2, invoiceOut: {id: 1}};
|
controller.ticket = {id: 2, invoiceOut: {id: 1}};
|
||||||
|
controller.cardReload = ()=> {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('showAddTurnDialog()', () => {
|
describe('showAddTurnDialog()', () => {
|
||||||
|
@ -105,5 +108,19 @@ describe('Ticket Component vnTicketDescriptor', () => {
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Invoice sent for a regeneration, will be available in a few minutes');
|
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Invoice sent for a regeneration, will be available in a few minutes');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('changeShipped(response)', () => {
|
||||||
|
it('should make a query and change the shipped hour if the response is ACCEPT', () => {
|
||||||
|
spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
spyOn(controller, 'cardReload');
|
||||||
|
$httpBackend.when('PATCH', `/ticket/api/Tickets/2`,).respond();
|
||||||
|
$httpBackend.expect('PATCH', `/ticket/api/Tickets/2`).respond();
|
||||||
|
controller.changeShipped('ACCEPT');
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Shipped hour updated');
|
||||||
|
expect(controller.cardReload).toHaveBeenCalledWith();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -22,3 +22,4 @@ Are you sure you want to invoice this ticket?: ¿Seguro que quieres facturar est
|
||||||
You are going to regenerate the invoice: Vas a regenerar la factura
|
You are going to regenerate the invoice: Vas a regenerar la factura
|
||||||
Are you sure you want to regenerate the invoice?: ¿Seguro que quieres regenerar la factura?
|
Are you sure you want to regenerate the invoice?: ¿Seguro que quieres regenerar la factura?
|
||||||
Invoice sent for a regeneration, will be available in a few minutes: La factura ha sido enviada para ser regenerada, estará disponible en unos minutos
|
Invoice sent for a regeneration, will be available in a few minutes: La factura ha sido enviada para ser regenerada, estará disponible en unos minutos
|
||||||
|
Shipped hour updated: Hora de envio modificada
|
Loading…
Reference in New Issue