This commit is contained in:
parent
2ca85394f3
commit
5bc6f5107e
|
@ -169,7 +169,7 @@
|
|||
<h5 style="text-align: center">
|
||||
<span translate>Change shipped hour</span>
|
||||
</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>
|
||||
</tpl-body>
|
||||
<tpl-buttons>
|
||||
|
|
|
@ -45,14 +45,14 @@ class Controller {
|
|||
this.vnApp.showError(this.$translate.instant('This ticket can\'t be modified'));
|
||||
return;
|
||||
}
|
||||
this.newShipped = new Date(this.ticket.shipped);
|
||||
this.newShipped = this.ticket.shipped;
|
||||
this.$scope.changeShippedDialog.show();
|
||||
}
|
||||
|
||||
changeShipped(response) {
|
||||
if (response === 'ACCEPT') {
|
||||
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.cardReload();
|
||||
});
|
||||
|
|
|
@ -10,6 +10,9 @@ describe('Ticket Component vnTicketDescriptor', () => {
|
|||
$httpBackend = _$httpBackend_;
|
||||
controller = $componentController('vnTicketDescriptor');
|
||||
controller.ticket = {id: 2, invoiceOut: {id: 1}};
|
||||
controller.cardReload = ()=> {
|
||||
return true;
|
||||
};
|
||||
}));
|
||||
|
||||
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');
|
||||
});
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -21,4 +21,5 @@ You are going to invoice this ticket: Vas a facturar este ticket
|
|||
Are you sure you want to invoice this ticket?: ¿Seguro que quieres facturar este ticket?
|
||||
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?
|
||||
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