'Delete function code refactor'
This commit is contained in:
parent
dbbad60b6e
commit
fc12930471
12
resources/assets/js/mixins/spa-global.js
vendored
12
resources/assets/js/mixins/spa-global.js
vendored
@ -155,6 +155,18 @@ export default {
|
|||||||
this.onFailError(error)
|
this.onFailError(error)
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
onDeleteEvent(event, form_list, event_id) {
|
||||||
|
form_list.forEach(function (item, index) {
|
||||||
|
if (item.id == event_id) {
|
||||||
|
form_list.splice(index, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
this.component = "";
|
||||||
|
|
||||||
|
this.onSuccessDelete(event);
|
||||||
|
},
|
||||||
onFailError(error) {
|
onFailError(error) {
|
||||||
this.error_field_name = error.response.data.errors;
|
this.error_field_name = error.response.data.errors;
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,6 @@ export default {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
debugger;
|
|
||||||
data.rate = response.data.rate;
|
data.rate = response.data.rate;
|
||||||
data.precision = response.data.precision;
|
data.precision = response.data.precision;
|
||||||
data.symbol = response.data.symbol;
|
data.symbol = response.data.symbol;
|
||||||
@ -402,16 +401,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
deleteCurrency(event) {
|
deleteCurrency(event) {
|
||||||
this.currencies.forEach(function (currency, index) {
|
this.onDeleteEvent(event, this.currencies, event.currency_id);
|
||||||
if (currency.id == event.currency_id) {
|
|
||||||
this.currencies.splice(index, 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
this.component = "";
|
|
||||||
|
|
||||||
this.onSuccessDelete(event);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -285,16 +285,7 @@ export default {
|
|||||||
this.onSubmitEvent("POST", url + "/wizard/taxes", "type", this.taxes);
|
this.onSubmitEvent("POST", url + "/wizard/taxes", "type", this.taxes);
|
||||||
},
|
},
|
||||||
deleteCurrency(event) {
|
deleteCurrency(event) {
|
||||||
this.taxes.forEach(function (tax, index) {
|
this.onDeleteEvent(event, this.taxes, event.tax_id);
|
||||||
if (tax.id == event.tax_id) {
|
|
||||||
this.taxes.splice(index, 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
this.component = "";
|
|
||||||
|
|
||||||
this.onSuccessDelete(event);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user