pukaad-ui-lib 1.330.0 → 1.332.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.330.0",
4
+ "version": "1.332.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -5,15 +5,23 @@
5
5
  :loading="loading"
6
6
  v-model="isOpen"
7
7
  >
8
- <!-- backoffice: แสดงแบบมี tabs -->
9
- <ShadTabs v-if="props.state === 'backoffice'" default-value="business-info">
8
+ <!-- backoffice / business: แสดงแบบมี tabs (Figma 2778-244494) -->
9
+ <ShadTabs
10
+ v-if="props.state === 'backoffice' || props.state === 'business'"
11
+ default-value="business-info"
12
+ >
10
13
  <ShadTabsList>
11
14
  <ShadTabsTrigger value="business-info">ข้อมูลธุรกิจ</ShadTabsTrigger>
12
15
  <ShadTabsTrigger value="image">รูปภาพ</ShadTabsTrigger>
13
16
  <ShadTabsTrigger value="video">วิดีโอ</ShadTabsTrigger>
14
17
  </ShadTabsList>
15
18
  <ShadTabsContent value="business-info">
16
- <SuggestPlaceForm v-model="formData" :state="props.state" />
19
+ <SuggestPlaceForm
20
+ ref="formRef"
21
+ v-model="formData"
22
+ :state="props.state"
23
+ :fixed-province-id="fixedProvinceId"
24
+ />
17
25
  </ShadTabsContent>
18
26
  <ShadTabsContent value="image">
19
27
  <div class="flex flex-col gap-[16px] w-full">
@@ -99,18 +107,19 @@
99
107
  </ShadTabsContent>
100
108
  </ShadTabs>
101
109
 
102
- <!-- personal / business: แสดงตรงๆ ไม่มี tabs -->
110
+ <!-- personal: แสดงตรงๆ ไม่มี tabs -->
103
111
  <div v-else>
104
112
  <SuggestPlaceForm
105
113
  ref="formRef"
106
114
  v-model="formData"
107
115
  :state="props.state"
108
- :fixed-province-id="provinceIdState ?? void 0"
116
+ :fixed-province-id="fixedProvinceId"
117
+ :edit-id="props.editId"
109
118
  />
110
119
  </div>
111
120
  <template #footer>
112
121
  <div class="flex gap-[8px] justify-end">
113
- <Button variant="outline">ยกเลิก</Button>
122
+ <Button variant="outline" @click="isOpen = false">ยกเลิก</Button>
114
123
  <Button color="primary" :disabled="!isFormValid" @click="onSubmit">{{
115
124
  props.state === "personal" ? "\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01" : "\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E41\u0E25\u0E30\u0E40\u0E1C\u0E22\u0E41\u0E1E\u0E23\u0E48"
116
125
  }}</Button>
@@ -161,6 +170,9 @@ watch(isOpen, (val) => {
161
170
  }, 300);
162
171
  }
163
172
  });
173
+ const fixedProvinceId = computed(
174
+ () => props.state === "personal" ? provinceIdState.value ?? void 0 : void 0
175
+ );
164
176
  const isFormValid = computed(() => {
165
177
  const d = formData.value;
166
178
  const addressComplete = !!(d.address?.province_id && d.address?.amphur_id && d.address?.tambon_id && d.address?.zipcode);
@@ -197,7 +209,10 @@ const onSubmit = async () => {
197
209
  method,
198
210
  body: {
199
211
  business_name: d.businessName ?? "",
200
- localized_names: (d.localizedNames ?? []).map((ln) => ({ language: ln.language, name: ln.name })),
212
+ localized_names: (d.localizedNames ?? []).map((ln) => ({
213
+ language: ln.language,
214
+ name: ln.name
215
+ })),
201
216
  description: d.description ?? "",
202
217
  address: {
203
218
  province_id: d.address?.province_id,
@@ -236,10 +251,13 @@ const onSubmit = async () => {
236
251
  }
237
252
  };
238
253
  const drawerTitle = computed(() => {
254
+ if (props.state === "business") {
255
+ return props.editId ? "\u0E41\u0E01\u0E49\u0E44\u0E02\u0E18\u0E38\u0E23\u0E01\u0E34\u0E08\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13" : "\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E18\u0E38\u0E23\u0E01\u0E34\u0E08\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13";
256
+ }
239
257
  if (props.editId) {
240
258
  return "\u0E41\u0E01\u0E49\u0E44\u0E02\u0E2A\u0E16\u0E32\u0E19\u0E17\u0E35\u0E48";
241
259
  }
242
- if (props.state === "personal" || props.state === "business") {
260
+ if (props.state === "personal") {
243
261
  return "\u0E41\u0E19\u0E30\u0E19\u0E33\u0E2A\u0E16\u0E32\u0E19\u0E17\u0E35\u0E48\u0E17\u0E35\u0E48\u0E02\u0E32\u0E14\u0E44\u0E1B";
244
262
  }
245
263
  if (props.state === "backoffice") {
@@ -36,6 +36,7 @@ export interface SuggestPlaceData {
36
36
  type __VLS_Props = {
37
37
  state?: "personal" | "business" | "backoffice";
38
38
  fixedProvinceId?: number;
39
+ editId?: string;
39
40
  };
40
41
  type __VLS_ModelProps = {
41
42
  modelValue?: SuggestPlaceData;
@@ -155,7 +155,8 @@ import SuggestPlaceMap from "./suggest-place-map.vue";
155
155
  import InputLocalizedName from "../../input/input-localized-name.vue";
156
156
  const props = defineProps({
157
157
  state: { type: String, required: false, default: "personal" },
158
- fixedProvinceId: { type: Number, required: false }
158
+ fixedProvinceId: { type: Number, required: false },
159
+ editId: { type: String, required: false }
159
160
  });
160
161
  const api = useApi();
161
162
  const { $alert } = useNuxtApp();
@@ -262,7 +263,7 @@ const checkDuplicate = async () => {
262
263
  }
263
264
  });
264
265
  const match = (res.data ?? []).find(
265
- (p) => p.business_name.trim().toLowerCase() === name.toLowerCase() && p.address?.tambon_id === modelValue.address?.tambon_id
266
+ (p) => p.id !== props.editId && p.business_name.trim().toLowerCase() === name.toLowerCase() && p.address?.tambon_id === modelValue.address?.tambon_id
266
267
  );
267
268
  if (match) {
268
269
  await showDuplicateAlert(match);
@@ -36,6 +36,7 @@ export interface SuggestPlaceData {
36
36
  type __VLS_Props = {
37
37
  state?: "personal" | "business" | "backoffice";
38
38
  fixedProvinceId?: number;
39
+ editId?: string;
39
40
  };
40
41
  type __VLS_ModelProps = {
41
42
  modelValue?: SuggestPlaceData;
@@ -64,15 +64,15 @@ declare const __VLS_export: import("vue").DefineComponent<ImageCropperProps, {
64
64
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ImageCropperProps> & Readonly<{}>, {
65
65
  src: string;
66
66
  center: boolean;
67
+ background: boolean;
68
+ modal: boolean;
67
69
  responsive: boolean;
68
70
  restore: boolean;
69
71
  checkCrossOrigin: boolean;
70
72
  checkOrientation: boolean;
71
73
  crossorigin: "" | "anonymous" | "use-credentials";
72
- modal: boolean;
73
74
  guides: boolean;
74
75
  highlight: boolean;
75
- background: boolean;
76
76
  autoCrop: boolean;
77
77
  movable: boolean;
78
78
  rotatable: boolean;
@@ -64,15 +64,15 @@ declare const __VLS_export: import("vue").DefineComponent<ImageCropperProps, {
64
64
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ImageCropperProps> & Readonly<{}>, {
65
65
  src: string;
66
66
  center: boolean;
67
+ background: boolean;
68
+ modal: boolean;
67
69
  responsive: boolean;
68
70
  restore: boolean;
69
71
  checkCrossOrigin: boolean;
70
72
  checkOrientation: boolean;
71
73
  crossorigin: "" | "anonymous" | "use-credentials";
72
- modal: boolean;
73
74
  guides: boolean;
74
75
  highlight: boolean;
75
- background: boolean;
76
76
  autoCrop: boolean;
77
77
  movable: boolean;
78
78
  rotatable: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.330.0",
3
+ "version": "1.332.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",