add message before delete a line on a claim
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
765d3c7553
commit
84bacfd379
|
@ -69,7 +69,7 @@
|
|||
vn-tooltip="Remove sale"
|
||||
ng-if ="$ctrl.isRewritable"
|
||||
icon="delete"
|
||||
ng-click="$ctrl.deleteClaimedSale($index)"
|
||||
ng-click="$ctrl.showDeleteConfirm($index)"
|
||||
tabindex="-1">
|
||||
</vn-icon-button>
|
||||
</vn-td>
|
||||
|
@ -165,3 +165,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</vn-popover>
|
||||
<vn-confirm
|
||||
vn-id="confirm"
|
||||
question="Delete sale from claim?"
|
||||
on-response="$ctrl.deleteClaimedSale($response)">
|
||||
</vn-confirm>
|
|
@ -73,14 +73,20 @@ class Controller extends Section {
|
|||
});
|
||||
}
|
||||
|
||||
deleteClaimedSale(index) {
|
||||
let sale = this.salesClaimed[index];
|
||||
let query = `ClaimBeginnings/${sale.id}`;
|
||||
this.$http.delete(query).then(() => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.$.model.remove(index);
|
||||
this.calculateTotals();
|
||||
});
|
||||
showDeleteConfirm(index) {
|
||||
this.sale = this.salesClaimed[index];
|
||||
this.$.confirm.show();
|
||||
}
|
||||
|
||||
deleteClaimedSale(response) {
|
||||
if (response === 'accept') {
|
||||
let query = `ClaimBeginnings/${this.sale.id}`;
|
||||
this.$http.delete(query).then(() => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.$.model.remove(this.sale);
|
||||
this.calculateTotals();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
setClaimedQuantity(id, claimedQuantity) {
|
||||
|
|
|
@ -71,14 +71,16 @@ describe('claim', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('deleteClaimedSale(index)', () => {
|
||||
describe('deleteClaimedSale()', () => {
|
||||
it('should make a delete and call refresh and showSuccess', () => {
|
||||
controller.sale = {id: 1};
|
||||
jest.spyOn(controller.$.model, 'remove');
|
||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||
$httpBackend.expectDELETE(`ClaimBeginnings/1`).respond({});
|
||||
controller.deleteClaimedSale(0);
|
||||
controller.deleteClaimedSale('accept');
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.$.model.remove).toHaveBeenCalledWith(0);
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -8,3 +8,4 @@ Detail: Detalles
|
|||
Add sale item: Añadir artículo
|
||||
Insuficient permisos: Permisos insuficientes
|
||||
Total claimed price: Precio total reclamado
|
||||
Delete sale from claim?: ¿Borrar la linea de la reclamación?
|
Loading…
Reference in New Issue