feat: deleteProductService ของ Product Group
This commit is contained in:
parent
d38c2a09fc
commit
6d25833fba
1 changed files with 27 additions and 5 deletions
|
|
@ -21,6 +21,7 @@ const {
|
||||||
fetchStatsProductGroup,
|
fetchStatsProductGroup,
|
||||||
fetchListProductService,
|
fetchListProductService,
|
||||||
createProductService,
|
createProductService,
|
||||||
|
deleteProductService,
|
||||||
} = productServiceStore;
|
} = productServiceStore;
|
||||||
|
|
||||||
import ItemCard from 'src/components/ItemCard.vue';
|
import ItemCard from 'src/components/ItemCard.vue';
|
||||||
|
|
@ -77,6 +78,8 @@ const formData = ref<ProductGroupCreate>({
|
||||||
code: '',
|
code: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const currentId = ref<string>('');
|
||||||
|
|
||||||
async function submitType() {
|
async function submitType() {
|
||||||
console.log(formData.value);
|
console.log(formData.value);
|
||||||
}
|
}
|
||||||
|
|
@ -103,6 +106,13 @@ async function deleteProductById() {
|
||||||
persistent: true,
|
persistent: true,
|
||||||
message: t('deleteConfirmMessage'),
|
message: t('deleteConfirmMessage'),
|
||||||
action: async () => {
|
action: async () => {
|
||||||
|
if (isType.value) {
|
||||||
|
// Product Type
|
||||||
|
} else {
|
||||||
|
// Product Group
|
||||||
|
await deleteProductService(currentId.value);
|
||||||
|
await fetchListGroups();
|
||||||
|
}
|
||||||
console.log('deleted');
|
console.log('deleted');
|
||||||
drawerInfo.value = false;
|
drawerInfo.value = false;
|
||||||
},
|
},
|
||||||
|
|
@ -124,11 +134,11 @@ function clearForm() {
|
||||||
async function submitGroup() {
|
async function submitGroup() {
|
||||||
await createProductService(formData.value);
|
await createProductService(formData.value);
|
||||||
|
|
||||||
await fetchList();
|
await fetchListGroups();
|
||||||
clearForm();
|
clearForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchList() {
|
async function fetchListGroups() {
|
||||||
const res = await fetchListProductService();
|
const res = await fetchListProductService();
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
|
@ -137,7 +147,7 @@ async function fetchList() {
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fetchList();
|
await fetchListGroups();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -253,9 +263,15 @@ onMounted(async () => {
|
||||||
:date="cardTypeData.date"
|
:date="cardTypeData.date"
|
||||||
:status="v.status"
|
:status="v.status"
|
||||||
:color="cardTypeData.color"
|
:color="cardTypeData.color"
|
||||||
@view-detail="drawerInfo = true"
|
@view-detail="
|
||||||
|
() => {
|
||||||
|
currentId = v.id;
|
||||||
|
drawerInfo = true;
|
||||||
|
}
|
||||||
|
"
|
||||||
@on-click="
|
@on-click="
|
||||||
() => {
|
() => {
|
||||||
|
currentId = v.id;
|
||||||
if (isType === true) drawerInfo = true;
|
if (isType === true) drawerInfo = true;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
|
@ -267,9 +283,15 @@ onMounted(async () => {
|
||||||
:date="new Date(v.updatedAt)"
|
:date="new Date(v.updatedAt)"
|
||||||
:status="v.status"
|
:status="v.status"
|
||||||
color="var(--pink-6)"
|
color="var(--pink-6)"
|
||||||
@view-detail="drawerInfo = true"
|
@view-detail="
|
||||||
|
() => {
|
||||||
|
currentId = v.id;
|
||||||
|
drawerInfo = true;
|
||||||
|
}
|
||||||
|
"
|
||||||
@on-click="
|
@on-click="
|
||||||
() => {
|
() => {
|
||||||
|
currentId = v.id;
|
||||||
if (isType === false) isType = true;
|
if (isType === false) isType = true;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue