pukaad-ui-lib 1.318.0 → 1.320.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 +1 -1
- package/dist/runtime/components/drawer/drawer-suggest-place/suggest-place-form.vue +57 -0
- package/dist/runtime/components/image/image-cropper.d.vue.ts +2 -2
- package/dist/runtime/components/image/image-cropper.vue.d.ts +2 -2
- package/dist/runtime/components/input/input-address.d.vue.ts +1 -1
- package/dist/runtime/components/input/input-address.vue.d.ts +1 -1
- package/dist/runtime/components/input/input-file.d.vue.ts +1 -1
- package/dist/runtime/components/input/input-file.vue.d.ts +1 -1
- package/dist/runtime/components/input/input-password.d.vue.ts +1 -1
- package/dist/runtime/components/input/input-password.vue.d.ts +1 -1
- package/dist/runtime/components/modal/modal-password-confirmed.d.vue.ts +1 -1
- package/dist/runtime/components/modal/modal-password-confirmed.vue.d.ts +1 -1
- package/dist/runtime/components/modal/modal-password-verify.d.vue.ts +1 -1
- package/dist/runtime/components/modal/modal-password-verify.vue.d.ts +1 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
:fetch-fn="fetchApprovedPlaces"
|
|
22
22
|
value-key="business_name"
|
|
23
23
|
label-key="business_name"
|
|
24
|
+
@select="onSelectSuggestedPlace"
|
|
24
25
|
/>
|
|
25
26
|
<InputLocalizedName
|
|
26
27
|
name="localizedNames"
|
|
@@ -148,6 +149,8 @@
|
|
|
148
149
|
|
|
149
150
|
<script setup>
|
|
150
151
|
import { computed, onMounted, watch, reactive, ref } from "vue";
|
|
152
|
+
import { useNuxtApp } from "nuxt/app";
|
|
153
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
151
154
|
import { useApi } from "#pukaad-ui/runtime/composables/useApi";
|
|
152
155
|
import SuggestPlaceMap from "./suggest-place-map.vue";
|
|
153
156
|
import InputLocalizedName from "../../input/input-localized-name.vue";
|
|
@@ -156,6 +159,7 @@ const props = defineProps({
|
|
|
156
159
|
fixedProvinceId: { type: Number, required: false }
|
|
157
160
|
});
|
|
158
161
|
const api = useApi();
|
|
162
|
+
const { $alert } = useNuxtApp();
|
|
159
163
|
const _model = defineModel({ type: Object, ...{ default: () => ({}) } });
|
|
160
164
|
const modelValue = reactive({
|
|
161
165
|
address: {},
|
|
@@ -224,6 +228,59 @@ const fetchApprovedPlaces = async (page, pageSize, search) => {
|
|
|
224
228
|
meta: { total_pages: res.meta?.total_pages ?? 1 }
|
|
225
229
|
};
|
|
226
230
|
};
|
|
231
|
+
const lastCheckedDuplicateName = ref("");
|
|
232
|
+
const showDuplicateAlert = async (item) => {
|
|
233
|
+
const result = await $alert.show({
|
|
234
|
+
type: "warning",
|
|
235
|
+
title: "\u0E21\u0E35\u0E2A\u0E16\u0E32\u0E19\u0E17\u0E35\u0E48\u0E19\u0E35\u0E49\u0E43\u0E19\u0E23\u0E30\u0E1A\u0E1A\u0E41\u0E25\u0E49\u0E27",
|
|
236
|
+
description: `"${item.business_name}" \u0E21\u0E35\u0E2D\u0E22\u0E39\u0E48\u0E41\u0E25\u0E49\u0E27\u0E17\u0E35\u0E48 ${item.address?.full_address ?? ""}`,
|
|
237
|
+
confirmText: "\u0E14\u0E39\u0E2A\u0E16\u0E32\u0E19\u0E17\u0E35\u0E48\u0E19\u0E35\u0E49",
|
|
238
|
+
cancelText: "\u0E1B\u0E34\u0E14",
|
|
239
|
+
showCancelBtn: true
|
|
240
|
+
});
|
|
241
|
+
if (result.isConfirmed && item.id) {
|
|
242
|
+
window.open(`/place/${item.id}`, "_blank");
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
const onSelectSuggestedPlace = async (item) => {
|
|
246
|
+
if (props.state === "backoffice") return;
|
|
247
|
+
await showDuplicateAlert(item);
|
|
248
|
+
};
|
|
249
|
+
const checkDuplicate = async () => {
|
|
250
|
+
if (props.state === "backoffice") return;
|
|
251
|
+
if (!isAddressCompleted.value) return;
|
|
252
|
+
const name = modelValue.businessName?.trim();
|
|
253
|
+
if (!name || name === lastCheckedDuplicateName.value) return;
|
|
254
|
+
try {
|
|
255
|
+
const base = listEndpointMap[props.state] ?? "/personal/suggest-places";
|
|
256
|
+
const res = await api(base, {
|
|
257
|
+
query: {
|
|
258
|
+
q: name,
|
|
259
|
+
status: "PENDING,APPROVED",
|
|
260
|
+
page: 1,
|
|
261
|
+
page_size: 10,
|
|
262
|
+
amphur_id: modelValue.address?.amphur_id,
|
|
263
|
+
tambon_id: modelValue.address?.tambon_id
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
const match = (res.data ?? []).find(
|
|
267
|
+
(p) => p.business_name.trim().toLowerCase() === name.toLowerCase() && p.address?.tambon_id === modelValue.address?.tambon_id
|
|
268
|
+
);
|
|
269
|
+
if (match) {
|
|
270
|
+
lastCheckedDuplicateName.value = name;
|
|
271
|
+
await showDuplicateAlert(match);
|
|
272
|
+
}
|
|
273
|
+
} catch {
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
const debouncedCheckDuplicate = useDebounceFn(checkDuplicate, 600);
|
|
277
|
+
watch(
|
|
278
|
+
() => [modelValue.businessName, modelValue.address?.tambon_id],
|
|
279
|
+
([name]) => {
|
|
280
|
+
if (!name || !isAddressCompleted.value || props.state === "backoffice") return;
|
|
281
|
+
debouncedCheckDuplicate();
|
|
282
|
+
}
|
|
283
|
+
);
|
|
227
284
|
const categoryOptions = ref([]);
|
|
228
285
|
onMounted(async () => {
|
|
229
286
|
try {
|
|
@@ -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;
|
|
@@ -49,11 +49,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
49
49
|
label: string;
|
|
50
50
|
name: string;
|
|
51
51
|
required: boolean;
|
|
52
|
-
gap: string;
|
|
53
52
|
placeholder: string;
|
|
54
53
|
labelDetail: string;
|
|
55
54
|
placeholderDetail: string;
|
|
56
55
|
requiredDetail: boolean;
|
|
56
|
+
gap: string;
|
|
57
57
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
58
58
|
declare const _default: typeof __VLS_export;
|
|
59
59
|
export default _default;
|
|
@@ -49,11 +49,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
49
49
|
label: string;
|
|
50
50
|
name: string;
|
|
51
51
|
required: boolean;
|
|
52
|
-
gap: string;
|
|
53
52
|
placeholder: string;
|
|
54
53
|
labelDetail: string;
|
|
55
54
|
placeholderDetail: string;
|
|
56
55
|
requiredDetail: boolean;
|
|
56
|
+
gap: string;
|
|
57
57
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
58
58
|
declare const _default: typeof __VLS_export;
|
|
59
59
|
export default _default;
|
|
@@ -35,8 +35,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
35
35
|
fullHeight: boolean;
|
|
36
36
|
fullWidth: boolean;
|
|
37
37
|
limit: number;
|
|
38
|
-
accept: string;
|
|
39
38
|
disabledErrorMessage: boolean;
|
|
39
|
+
accept: string;
|
|
40
40
|
labelIcon: string;
|
|
41
41
|
disabledDrop: boolean;
|
|
42
42
|
column: boolean;
|
|
@@ -35,8 +35,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
35
35
|
fullHeight: boolean;
|
|
36
36
|
fullWidth: boolean;
|
|
37
37
|
limit: number;
|
|
38
|
-
accept: string;
|
|
39
38
|
disabledErrorMessage: boolean;
|
|
39
|
+
accept: string;
|
|
40
40
|
labelIcon: string;
|
|
41
41
|
disabledDrop: boolean;
|
|
42
42
|
column: boolean;
|
|
@@ -22,8 +22,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
22
22
|
}>, {
|
|
23
23
|
id: string;
|
|
24
24
|
name: string;
|
|
25
|
-
disabledForgotPassword: boolean;
|
|
26
25
|
new: boolean;
|
|
26
|
+
disabledForgotPassword: boolean;
|
|
27
27
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
28
|
declare const _default: typeof __VLS_export;
|
|
29
29
|
export default _default;
|
|
@@ -22,8 +22,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
22
22
|
}>, {
|
|
23
23
|
id: string;
|
|
24
24
|
name: string;
|
|
25
|
-
disabledForgotPassword: boolean;
|
|
26
25
|
new: boolean;
|
|
26
|
+
disabledForgotPassword: boolean;
|
|
27
27
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
28
|
declare const _default: typeof __VLS_export;
|
|
29
29
|
export default _default;
|
|
@@ -24,8 +24,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
24
24
|
}) => any) | undefined;
|
|
25
25
|
}>, {
|
|
26
26
|
title: string;
|
|
27
|
-
confirmText: string;
|
|
28
27
|
disabledForgotPassword: boolean;
|
|
28
|
+
confirmText: string;
|
|
29
29
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
30
|
declare const _default: typeof __VLS_export;
|
|
31
31
|
export default _default;
|
|
@@ -24,8 +24,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
24
24
|
}) => any) | undefined;
|
|
25
25
|
}>, {
|
|
26
26
|
title: string;
|
|
27
|
-
confirmText: string;
|
|
28
27
|
disabledForgotPassword: boolean;
|
|
28
|
+
confirmText: string;
|
|
29
29
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
30
|
declare const _default: typeof __VLS_export;
|
|
31
31
|
export default _default;
|
|
@@ -32,8 +32,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
32
32
|
}>, {
|
|
33
33
|
title: string;
|
|
34
34
|
mode: "login" | "secure";
|
|
35
|
-
confirmText: string;
|
|
36
35
|
disabledForgotPassword: boolean;
|
|
36
|
+
confirmText: string;
|
|
37
37
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
38
|
declare const _default: typeof __VLS_export;
|
|
39
39
|
export default _default;
|
|
@@ -32,8 +32,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
32
32
|
}>, {
|
|
33
33
|
title: string;
|
|
34
34
|
mode: "login" | "secure";
|
|
35
|
-
confirmText: string;
|
|
36
35
|
disabledForgotPassword: boolean;
|
|
36
|
+
confirmText: string;
|
|
37
37
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
38
|
declare const _default: typeof __VLS_export;
|
|
39
39
|
export default _default;
|