This commit is contained in:
Viet An
2026-05-14 15:37:58 +07:00
parent 4d37397ee4
commit 1f44f9e6bf
17 changed files with 670 additions and 324 deletions

View File

@@ -0,0 +1,50 @@
<script setup>
import Modal from "@/components/Modal.vue";
const props = defineProps({
variant: Object,
});
const emit = defineEmits(["dynamicCompEvent"]);
const { $deleteapi } = useNuxtApp();
const showConfirmModal = ref(null);
function displayModal() {
showConfirmModal.value = {
component: "dialog/Confirm",
title: "Xoá phiên bản",
width: "500px",
height: "auto",
vbind: {
content: `Bạn xác nhận xoá phiên bản <code>${props.variant.code}</code>?`,
onModalevent: deleteVariant,
},
};
}
async function deleteVariant() {
const res = await $deleteapi("Product_Variant", props.variant.id);
if (res !== "error") {
// emit to parent, which is DataTable
emit("dynamicCompEvent", { type: "refresh" });
}
}
</script>
<template>
<a
class="has-text-danger"
@click="displayModal"
>
<span class="icon">
<Icon
name="material-symbols:delete-outline-rounded"
:size="18"
/>
</span>
<Modal
v-bind="showConfirmModal"
@close="showConfirmModal = null"
/>
</a>
</template>