mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-08-19 04:13:58 +00:00
-Delete Modal Action (Unity)
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<div>
|
||||
<b-modal :id="'entity-delete-modal'" size="lg" scrollable>
|
||||
<template v-slot:modal-title>
|
||||
<h4 class="modal-title">Entity 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: {
|
||||
selected_entity: Object,
|
||||
},
|
||||
components: {
|
||||
|
||||
},
|
||||
data() {
|
||||
let vm = this;
|
||||
return {
|
||||
form: new Form({
|
||||
entity_id: ''
|
||||
}),
|
||||
loader: null,
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getExistDataList() {
|
||||
let vm = this;
|
||||
},
|
||||
resetData() {
|
||||
let vm = this;
|
||||
vm.form.entity_id = '';
|
||||
vm.loader = null;
|
||||
vm.loading = false;
|
||||
},
|
||||
onCancel(){
|
||||
let vm = this;
|
||||
vm.$bvModal.hide('contract-template-delete-modal');
|
||||
},
|
||||
onSubmit() {
|
||||
let vm = this;
|
||||
vm.form.entity_id = vm.selected_entity.hash_id;
|
||||
console.log(vm.selected_entity);
|
||||
|
||||
const l = vm.loader
|
||||
vm[l] = !vm[l];
|
||||
let method = 'delete';
|
||||
let url = 'entity/delete/'+vm.selected_entity.hash_id;
|
||||
General.onComplete(url, vm.form, method, true)
|
||||
.then(data => {
|
||||
vm[l] = false
|
||||
vm.loader = null;
|
||||
vm.$bvModal.hide('entity-delete-modal');
|
||||
vm.$emit('refresh');
|
||||
General.toastedMessage('edit', 'Entity', data.data.hash_id);
|
||||
})
|
||||
.catch(function (error) {
|
||||
vm[l] = false
|
||||
vm.loader = null;
|
||||
});
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user