feat: submitService/clearFormService

/fetchListOfService
This commit is contained in:
Net 2024-06-18 16:08:50 +07:00
parent 7a21247fd3
commit deeb6283ee

View file

@ -50,7 +50,9 @@ const {
fetchListProduct,
createProduct,
fetchListService,
fetchListServiceById,
createService,
} = productServiceStore;
import ItemCard from 'src/components/ItemCard.vue';
@ -93,6 +95,7 @@ const productMode = ref<'group' | 'type' | 'service' | 'product'>('group');
const productGroup = ref<ProductGroup[]>();
const productType = ref<ProductGroup[]>();
const product = ref<ProductList[]>();
const service = ref<Service[]>();
const productAndServiceTab = ref<string>('all');
const previousValue = ref();
@ -215,6 +218,14 @@ async function fetchListOfProduct(productTypeId: string) {
}
}
async function fetchListOfService() {
const res = await fetchListService({ productTypeId: currentIdType.value });
if (res) {
service.value = res.result;
}
}
async function searchType() {
const res = await await fetchListProductServiceType({
query: inputSearch.value,
@ -379,6 +390,28 @@ function clearFormProduct() {
dialogProduct.value = false;
}
function clearFormService() {
formDataProductService.value = {
code: '',
name: '',
detail: '',
attributes: {
additional: [],
},
work: [],
};
dialogService.value = false;
}
async function submitService() {
const res = await createService(formDataProductService.value);
if (res) {
await fetchListOfService();
}
clearFormService();
}
async function submitProduct() {
formDataProduct.value.productTypeId = currentIdType.value;
if (profileSubmit.value) {