From ed9e0cf757e61227b1a742250457aea079e56b12 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 10 Mar 2025 15:02:28 +0700 Subject: [PATCH 01/17] feat: set directories of property --- src/pages/04_property-managment/MainPage.vue | 3 +++ src/pages/04_property-managment/PropertyDialog.vue | 3 +++ src/router/routes.ts | 5 +++++ 3 files changed, 11 insertions(+) create mode 100644 src/pages/04_property-managment/MainPage.vue create mode 100644 src/pages/04_property-managment/PropertyDialog.vue diff --git a/src/pages/04_property-managment/MainPage.vue b/src/pages/04_property-managment/MainPage.vue new file mode 100644 index 00000000..aab4caa5 --- /dev/null +++ b/src/pages/04_property-managment/MainPage.vue @@ -0,0 +1,3 @@ + + + diff --git a/src/pages/04_property-managment/PropertyDialog.vue b/src/pages/04_property-managment/PropertyDialog.vue new file mode 100644 index 00000000..aab4caa5 --- /dev/null +++ b/src/pages/04_property-managment/PropertyDialog.vue @@ -0,0 +1,3 @@ + + + diff --git a/src/router/routes.ts b/src/router/routes.ts index 2f7405d1..c4573313 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -80,6 +80,11 @@ const routes: RouteRecordRaw[] = [ name: 'Workflow', component: () => import('pages/04_flow-managment/MainPage.vue'), }, + { + path: '/property', + name: 'Property', + component: () => import('pages/04_property-managment/MainPage.vue'), + }, { path: '/quotation', name: 'Quotation', From 841f1157b1871f5d395b06bdbd401020c960d5c6 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 10 Mar 2025 15:47:24 +0700 Subject: [PATCH 02/17] feat: up code test --- src/i18n/tha.ts | 6 + src/layouts/DrawerComponent.vue | 1 + src/pages/04_property-managment/MainPage.vue | 511 ++++++++++++++++++- src/stores/property/index.ts | 71 +++ src/stores/property/types.ts | 5 + 5 files changed, 592 insertions(+), 2 deletions(-) create mode 100644 src/stores/property/index.ts create mode 100644 src/stores/property/types.ts diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index 06a21d9c..ea4066d6 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -194,6 +194,7 @@ export default { personnel: 'บุคลากร', productService: 'สินค้าและบริการ', workflow: 'ขั้นตอนการทำงาน', + property: 'คุณสมบัติ', customer: 'ลูกค้า', mainData: 'ข้อมูลหลัก', agencies: 'หน่วยงาน', @@ -1431,4 +1432,9 @@ export default { 11: 'พฤศจิกายน', 12: 'ธันวาคม', }, + + property: { + title: 'คุณสมบัติ', + caption: 'จัดการคุณสมบัติ', + }, }; diff --git a/src/layouts/DrawerComponent.vue b/src/layouts/DrawerComponent.vue index 5e07ca3a..6d9f0e06 100644 --- a/src/layouts/DrawerComponent.vue +++ b/src/layouts/DrawerComponent.vue @@ -120,6 +120,7 @@ onMounted(async () => { ), }, { label: 'workflow', route: '/workflow' }, + { label: 'property', route: '/property' }, { label: 'productService', route: '/product-service' }, { label: 'customer', route: '/customer-management' }, { label: 'agencies', route: '/agencies-management' }, diff --git a/src/pages/04_property-managment/MainPage.vue b/src/pages/04_property-managment/MainPage.vue index aab4caa5..60c0c329 100644 --- a/src/pages/04_property-managment/MainPage.vue +++ b/src/pages/04_property-managment/MainPage.vue @@ -1,3 +1,510 @@ - - + + diff --git a/src/stores/property/index.ts b/src/stores/property/index.ts new file mode 100644 index 00000000..93109146 --- /dev/null +++ b/src/stores/property/index.ts @@ -0,0 +1,71 @@ +import { ref } from 'vue'; +import { defineStore } from 'pinia'; +import { api } from 'src/boot/axios'; +import { PaginationResult } from 'src/types'; +import { Status } from '../types'; +import { Property } from './types'; + +export const useProperty = defineStore('property-store', () => { + const data = ref([]); + const page = ref(1); + const pageMax = ref(1); + const pageSize = ref(30); + + async function getProperty(id: string) { + const res = await api.get(`/property/${id}`); + + if (res.status >= 400) return null; + + return res.data; + } + + async function getPropertyList(params?: { + page?: number; + pageSize?: number; + query?: string; + status?: Status; + activeOnly?: boolean; + }) { + const res = await api.get>('/property', { + params, + }); + + if (res.status >= 400) return null; + + return res.data; + } + + async function creatProperty(data: Property) { + const res = await api.post('/property', data); + if (res.status >= 400) return null; + return res; + } + + async function editProperty(data: Property & { id: string }) { + const res = await api.put(`/property/${data.id}`, { + ...data, + id: undefined, + }); + if (res.status >= 400) return null; + return res; + } + + async function deleteProperty(id: string) { + const res = await api.delete(`/property/${id}`); + if (res.status >= 400) return null; + return res; + } + + return { + data, + page, + pageSize, + pageMax, + + getProperty, + getPropertyList, + creatProperty, + editProperty, + deleteProperty, + }; +}); diff --git a/src/stores/property/types.ts b/src/stores/property/types.ts new file mode 100644 index 00000000..778b6504 --- /dev/null +++ b/src/stores/property/types.ts @@ -0,0 +1,5 @@ +export type Property = { + name: string; + nameEn: string; + type: Record; +}; From da5cec3638b8897f9469d3d912f1c077b98ba1ef Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Mon, 10 Mar 2025 15:51:19 +0700 Subject: [PATCH 03/17] fix: code error --- src/pages/04_property-managment/MainPage.vue | 27 +++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/pages/04_property-managment/MainPage.vue b/src/pages/04_property-managment/MainPage.vue index 60c0c329..7bc13852 100644 --- a/src/pages/04_property-managment/MainPage.vue +++ b/src/pages/04_property-managment/MainPage.vue @@ -1,7 +1,7 @@