Files
admin-erahn/resources/js/components/util/Deletemodal.vue
T
2022-01-29 13:35:08 +08:00

73 lines
3.6 KiB
Vue

<template>
<div>
<transition name="modal-fade">
<!-- Delete Product Modal -->
<div v-if="showDelete" class="overflow-x-hidden overflow-y-auto fixed inset-0 z-50 outline-none focus:outline-none justify-center items-center flex" id="popup-modal">
<div class="relative px-4 w-full max-w-xl h-full md:h-auto">
<!-- Modal content -->
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
<!-- Modal header -->
<div class="flex justify-end p-2">
<button v-on:click="showDelete = false" type="button" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-800 dark:hover:text-white">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</button>
</div>
<!-- Modal body -->
<div class="p-6 pt-0 text-center">
<svg class="mx-auto mb-4 w-14 h-14 text-gray-400 dark:text-gray-200" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
<h3 class="mb-3 text-lg font-normal text-gray-500 dark:text-gray-400">Padam nama ini dalam senarai hitam?</h3>
<h3 class=" text-lg font-bold text-blue-500 dark:text-red-400">{{ this.nama }}</h3>
<h3 class="mb-5 text-lg font-bold text-blue-500 dark:text-red-400">{{ this.nokp }}</h3>
<button v-on:click="deleteBlacklist()" type="button" class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
Setuju
</button>
<button v-on:click="showDelete = false" type="button" class="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:ring-gray-300 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600">Batal</button>
</div>
</div>
</div>
</div>
</transition>
<div v-if="showDelete" class="opacity-25 fixed inset-0 z-40 bg-black"></div>
</div>
</template>
<script>
export default {
name: "delmodal",
data() {
return {
showDelete: false,
deleteid: 0,
nama:'',
nokp:''
}
},
methods: {
async deleteBlacklist(){
let response = await this.EngineDelete(this.deleteid)
if(response.data === 1)
{
this.showDelete = !this.showDelete;
this.$toast.success('Berjaya! nama tersebut berjaya disenarai putih.')
setTimeout(()=>{
this.$emit('clickDelete_', 1)
},1000);
}else{
this.$toast.danger('Tidak Berjaya! memadamkan nama tersebut.')
}
},
EngineDelete(id){
return this.axios.post(this.$api1 + '/admin/DeleteBlacklist',
{
id: id
});
}
}
}
</script>