fix: function name

This commit is contained in:
Methapon Metanipat 2024-10-15 16:13:00 +07:00
parent 29998081d4
commit 8ce8c9a977
3 changed files with 29 additions and 24 deletions

View file

@ -71,10 +71,10 @@ const optionStore = useOptionStore();
const {
fetchStatsProductGroup,
fetchListProductService,
createProductService,
editProductService,
deleteProductService,
fetchProductGroup,
createProductGroup,
editProductGroup,
deleteProductGroup,
fetchStatsProduct,
fetchListProduct,
@ -561,7 +561,7 @@ async function fetchListOfOptionBranch() {
}
async function fetchListGroups() {
const res = await fetchListProductService({
const res = await fetchProductGroup({
page: currentPageGroup.value,
pageSize: pageSizeGroup.value,
query: !!inputSearch.value ? inputSearch.value : undefined,
@ -688,7 +688,7 @@ async function toggleStatusService(id: string, status: Status) {
}
async function toggleStatusGroup(id: string, status: Status) {
const res = await editProductService(id, {
const res = await editProductGroup(id, {
status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE',
});
if (res) currentStatusGroupType.value = res.status;
@ -806,7 +806,7 @@ async function deleteProductById(productId?: string) {
if (editByTree.value !== undefined) {
if (editByTree.value === 'group') {
// Product Group
const res = await deleteProductService(
const res = await deleteProductGroup(
productId ?? currentIdGrop.value,
);
if (res) {
@ -821,7 +821,7 @@ async function deleteProductById(productId?: string) {
} else {
if (productMode.value === 'group') {
// Product Group
const res = await deleteProductService(
const res = await deleteProductGroup(
productId ?? currentIdGrop.value,
);
if (res) {
@ -1154,10 +1154,10 @@ async function submitProduct(notClose = false) {
async function submitGroup() {
if (drawerInfo.value) {
if (currentIdGropTree.value)
await editProductService(currentIdGropTree.value, formDataGroup.value);
else await editProductService(currentIdGrop.value, formDataGroup.value);
await editProductGroup(currentIdGropTree.value, formDataGroup.value);
else await editProductGroup(currentIdGrop.value, formDataGroup.value);
} else {
const res = await createProductService(formDataGroup.value);
const res = await createProductGroup(formDataGroup.value);
if (res) {
allStat.value[0].count = allStat.value[0].count + 1;
@ -4152,7 +4152,12 @@ watch(
v-if="!infoServiceEdit"
id="btn-info-basic-edit"
icon-only
@click="infoServiceEdit = true"
@click="
() => {
infoServiceEdit = true;
serviceTreeView = false;
}
"
type="button"
/>
<DeleteButton
@ -4416,7 +4421,7 @@ watch(
const res = await productServiceStore.addImageList(
v,
dialogProductEdit ? currentIdProduct : currentIdService,
Date.now(),
Date.now().toString(),
dialogProductEdit ? 'product' : 'service',
);
await fetchImageList(

View file

@ -208,7 +208,7 @@ const productServiceList = ref<
>([]);
async function assignToProductServiceList() {
const ret = await productServiceStore.fetchListProductService({
const ret = await productServiceStore.fetchProductGroup({
page: 1,
pageSize: 9999,
});

View file

@ -45,7 +45,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
}
}
async function fetchListProductServiceById(groupId: string) {
async function fetchProductGroupById(groupId: string) {
const res = await api.get<ProductGroup>(`/product-group/${groupId}`);
if (!res) return false;
@ -55,7 +55,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
}
}
async function fetchListProductService(opts?: {
async function fetchProductGroup(opts?: {
page?: number;
pageSize?: number;
query?: string;
@ -86,7 +86,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
return false;
}
async function createProductService(data: ProductGroupCreate) {
async function createProductGroup(data: ProductGroupCreate) {
const { code, ...payload } = data;
const res = await api.post<ProductGroupCreate>('/product-group', {
@ -102,7 +102,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
return false;
}
async function editProductService(
async function editProductGroup(
groupId: string,
data: Partial<ProductGroupUpdate>,
) {
@ -121,7 +121,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
return false;
}
async function deleteProductService(groupId: string) {
async function deleteProductGroup(groupId: string) {
const res = await api.delete(`/product-group/${groupId}`);
if (!res) return false;
@ -626,11 +626,11 @@ const useProductServiceStore = defineStore('api-product-service', () => {
workNameItems,
fetchStatsProductGroup,
fetchListProductServiceById,
fetchListProductService,
createProductService,
editProductService,
deleteProductService,
fetchProductGroupById,
fetchProductGroup,
createProductGroup,
editProductGroup,
deleteProductGroup,
fetchStatsProduct,
fetchListProduct,