search and updateCustomer in customer feature

parent c056aab7
......@@ -3,6 +3,7 @@ import { defineComponent, onMounted, ref, Ref } from 'vue';
import Pagination from 'components/pagination/index.vue';
import AddNewCustomerDialogComponent from '../../components/customer/add-new-customer-dialog/index.vue';
import UpdateNewCustomerDialogComponent from '../../components/customer/update-new-customer-dialog/index.vue';
// import { API_PATHS } from 'src/assets/configurations.example';
export type ArtistInfoType = {
id: number;
userName: string | null;
......@@ -183,15 +184,16 @@ export default defineComponent({
userTableRowsCustomer.value = fakeData;
};
const filterListCustomer = () => {
// const response = (await api({
// url: API_PATHS.filterListArtist,
// method: 'GET',
// params: {
// unitName: fullNameKeyword.value,
// fieldName: fieldSelected.value,
// },
// })) as AxiosResponse<BaseResponseBody<unknown>>;
// userTableRowsArtist.value = userTableRowsArtist.value.filter((item: unknown) => item.fullName = fullNameKeyword)
// const response = (await api({
// url: API_PATHS.filterListArtist,
// method: 'GET',
// params: {
// businessName: businessName.value
// taxCode: taxCode.value
// ratings: ratings.value
// },
// })) as AxiosResponse<BaseResponseBody<Artist[]>>;
// userTableRowsArtist.value = response.data.data
};
const changePageSize = () => {
pageIndex.value = 1;
......@@ -214,42 +216,42 @@ export default defineComponent({
};
const addNewCustomer = () => {
//gọi api thêm mới
try {
} catch (error) {
}
} catch (error) {}
};
const openUpdateCustomerDialog = () => {
showDialogUpdate.value = true;
userName.value = '';
customerName.value = '';
businessName.value = '';
taxCode.value = undefined;
email.value = '';
ratings.value = undefined;
address.value = '';
businessType.value = undefined;
representative.value = '';
position.value = '';
phone.value = '';
const getDetailCustomer = (id: number) => {
// gọi api chi tiết cần có id để lấy value cho từng customer
// const response = (await api({
// url: ...,
// method: 'GET',
// params: {
// id: id
// }
// }))
// gọi api lấy chi tiết sau đấy gán giá trị api trả về gán cho các biến userName customerName businessName taxCode...
// userName.value = response.data.data.userName
// Tương tự các biến còn lại
};
const openUpdateCustomerDialog = (id: number) => {
showDialogUpdate.value = false;
console.log(id, 'iddd');
void getDetailCustomer(id);
};
const updateNewCustomer = () => {
//Bấm nút lưu ở dialog update thì gọi api cập nhật trong hàm updateCustomer
const updateCustomer = () => {
//gọi api update
try {
} catch (error) {
}
} catch (error) {}
};
onMounted(() => {
void getListCustomer();
});
return {
openUpdateCustomerDialog,
updateNewCustomer,
updateCustomer,
openAddCustomerDialog,
addNewCustomer,
showDialogUpdate,
......@@ -275,6 +277,7 @@ export default defineComponent({
pageIndex,
pageSize,
filterListCustomer,
// getDetailCustomer,
dataTest,
totalPage,
changePageSize,
......
......@@ -63,7 +63,7 @@
separator="cell"
hide-pagination
>
<template v-slot:body-cell-action="">
<template v-slot:body-cell-action="rowData">
<q-td style="padding: 0" class="flex flex-center">
<q-btn flat round color="primary" icon="mdi-information-outline">
<q-tooltip :offset="[20, 10]">{{
......@@ -75,7 +75,7 @@
round
color="primary"
icon="mdi-account-edit-outline"
@click="openUpdateCustomerDialog()"
@click="openUpdateCustomerDialog(rowData.row.id)"
>
<q-tooltip :offset="[20, 10]">{{
$t('customer.toolTipMessage.updateCustomerInfo')
......@@ -147,7 +147,7 @@
:ratings-options="ratingsOptions"
:business-type-options="businessTypeOptions"
@click:CloseBtn="showDialogUpdate = false"
@updateNewCustomer="updateNewCustomer"
@updateNewCustomer="updateCustomer"
></UpdateNewCustomerDialogComponent>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment