-Delete Modal Action (Unity)

This commit is contained in:
weiken.intex
2021-07-21 16:57:22 +08:00
parent b6cc5889e1
commit 430efa7f6f
@@ -0,0 +1,95 @@
<template>
<div>
<b-modal :id="'contract-template-delete-modal'" size="lg" scrollable>
<template v-slot:modal-title>
<h4 class="modal-title">Contract Template Delete</h4>
</template>
Are you sure want to delete?
<template v-slot:modal-footer>
<form @submit.prevent="onSubmit">
<v-btn
:loading="loading"
:disabled="loading"
color="primary"
class="white--text"
@click="onCancel"
>
Cancel
</v-btn>
<v-btn
:loading="loading"
:disabled="loading"
type="submit"
color="primary"
class="white--text"
@click="loader = 'loading'"
>
Submit
</v-btn>
</form>
</template>
</b-modal>
</div>
</template>
<script type="text/javascript">
export default {
props: {
this_contract_template: Object,
},
components: {
},
data() {
let vm = this;
return {
form: new Form({
contract_template_id: ''
}),
loader: null,
loading: false
}
},
methods: {
getExistDataList() {
let vm = this;
},
resetData() {
let vm = this;
vm.form.contract_template_id = '';
vm.loader = null;
vm.loading = false;
},
onCancel(){
let vm = this;
vm.$bvModal.hide('contract-template-delete-modal');
},
onSubmit() {
let vm = this;
vm.form.contract_template_id = vm.this_contract_template.hash_id;
const l = vm.loader
vm[l] = !vm[l];
let method = 'delete';
let url = 'contract-template/delete/'+vm.this_contract_template.hash_id;
General.onComplete(url, vm.form, method, true)
.then(data => {
vm[l] = false
vm.loader = null;
vm.$bvModal.hide('contract-template-delete-modal');
vm.$emit('refresh');
General.toastedMessage('edit', 'Contract Template', data.data.hash_id);
})
.catch(function (error) {
vm[l] = false
vm.loader = null;
});
},
}
}
</script>