From b7d4178d63c3c2f03ae3b98c17b2cd119f87717a Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Mon, 10 Jun 2024 15:57:12 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20emit=20Customer=20=E0=B9=80=E0=B8=81?= =?UTF-8?q?=E0=B9=87=E0=B8=9A=E0=B9=83=E0=B8=99=20form?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomerInfoComponent.vue | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/components/03_customer-management/CustomerInfoComponent.vue b/src/components/03_customer-management/CustomerInfoComponent.vue index 1c95e05b..8d39392d 100644 --- a/src/components/03_customer-management/CustomerInfoComponent.vue +++ b/src/components/03_customer-management/CustomerInfoComponent.vue @@ -4,7 +4,7 @@ import AppBox from 'components/app/AppBox.vue'; import BranchCardCustomer from 'components/03_customer-management/BranchCardCustomer.vue'; import { onMounted } from 'vue'; import useCustomerStore from 'src/stores/customer'; -import { CustomerBranch } from 'src/stores/customer/types'; +import { CustomerBranch, Customer } from 'src/stores/customer/types'; const userCustomer = useCustomerStore(); const { fetchListById } = userCustomer; @@ -13,8 +13,9 @@ const inputSearch = ref(''); const branch = defineModel('branch'); const currentCustomerName = defineModel('currentCustomerName'); -const currentCustomerUrlImage = defineModel('currentCustomerUrlImage'); +const currentCustomerUrlImage = ref(); +const returnCustomer = ref(); const prop = withDefaults( defineProps<{ color?: 'purple' | 'green'; @@ -25,15 +26,20 @@ const prop = withDefaults( }, ); -defineEmits<{ +const emit = defineEmits<{ (e: 'back'): void; - (e: 'viewDetail'): void; + ( + e: 'viewDetail', + returnCustomer: Customer & { branch: CustomerBranch[] }, + ): void; + (e: 'dialog'): void; }>(); onMounted(async () => { const result = await fetchListById(prop.customerId); if (result) { + returnCustomer.value = result; currentCustomerName.value = result.customerName; currentCustomerUrlImage.value = result.imageUrl; branch.value = result.branch; @@ -140,9 +146,12 @@ onMounted(async () => { -
+
- +