pukaad-ui-lib 1.331.0 → 1.333.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.
Files changed (68) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/button.vue +10 -10
  3. package/dist/runtime/components/carousel.vue +31 -31
  4. package/dist/runtime/components/chart/chart-approval-activity.d.vue.ts +35 -0
  5. package/dist/runtime/components/chart/chart-approval-activity.vue +152 -0
  6. package/dist/runtime/components/chart/chart-approval-activity.vue.d.ts +35 -0
  7. package/dist/runtime/components/display/display-image-place.vue +98 -98
  8. package/dist/runtime/components/drawer/drawer-suggest-place/drawer-suggest-place.vue +1 -0
  9. package/dist/runtime/components/drawer/drawer-suggest-place/suggest-place-form.d.vue.ts +1 -0
  10. package/dist/runtime/components/drawer/drawer-suggest-place/suggest-place-form.vue +3 -2
  11. package/dist/runtime/components/drawer/drawer-suggest-place/suggest-place-form.vue.d.ts +1 -0
  12. package/dist/runtime/components/input/input-autocomplete.d.vue.ts +2 -2
  13. package/dist/runtime/components/input/input-autocomplete.vue.d.ts +2 -2
  14. package/dist/runtime/components/input/input-birth-date.d.vue.ts +1 -1
  15. package/dist/runtime/components/input/input-birth-date.vue.d.ts +1 -1
  16. package/dist/runtime/components/input/input-combobox.d.vue.ts +1 -1
  17. package/dist/runtime/components/input/input-combobox.vue.d.ts +1 -1
  18. package/dist/runtime/components/input/input-date-picker.d.vue.ts +1 -1
  19. package/dist/runtime/components/input/input-date-picker.vue.d.ts +1 -1
  20. package/dist/runtime/components/input/input-localized-name.d.vue.ts +1 -1
  21. package/dist/runtime/components/input/input-localized-name.vue.d.ts +1 -1
  22. package/dist/runtime/components/input/input-rating.vue +6 -6
  23. package/dist/runtime/components/input/input-suggest.d.vue.ts +2 -2
  24. package/dist/runtime/components/input/input-suggest.vue.d.ts +2 -2
  25. package/dist/runtime/components/input/input-tag.d.vue.ts +1 -1
  26. package/dist/runtime/components/input/input-tag.vue.d.ts +1 -1
  27. package/dist/runtime/components/input/input-textarea.d.vue.ts +1 -1
  28. package/dist/runtime/components/input/input-textarea.vue.d.ts +1 -1
  29. package/dist/runtime/components/modal/modal-media-view.vue +136 -136
  30. package/dist/runtime/components/ui/alert-dialog/AlertDialog.vue +2 -1
  31. package/dist/runtime/components/ui/calendar/Calendar.d.vue.ts +1 -1
  32. package/dist/runtime/components/ui/calendar/Calendar.vue.d.ts +1 -1
  33. package/dist/runtime/components/ui/chart/ChartContainer.d.vue.ts +25 -0
  34. package/dist/runtime/components/ui/chart/ChartContainer.vue +49 -0
  35. package/dist/runtime/components/ui/chart/ChartContainer.vue.d.ts +25 -0
  36. package/dist/runtime/components/ui/chart/ChartLegendContent.d.vue.ts +12 -0
  37. package/dist/runtime/components/ui/chart/ChartLegendContent.vue +52 -0
  38. package/dist/runtime/components/ui/chart/ChartLegendContent.vue.d.ts +12 -0
  39. package/dist/runtime/components/ui/chart/ChartStyle.d.vue.ts +7 -0
  40. package/dist/runtime/components/ui/chart/ChartStyle.vue +32 -0
  41. package/dist/runtime/components/ui/chart/ChartStyle.vue.d.ts +7 -0
  42. package/dist/runtime/components/ui/chart/ChartTooltipContent.d.vue.ts +32 -0
  43. package/dist/runtime/components/ui/chart/ChartTooltipContent.vue +93 -0
  44. package/dist/runtime/components/ui/chart/ChartTooltipContent.vue.d.ts +32 -0
  45. package/dist/runtime/components/ui/chart/index.d.ts +27 -0
  46. package/dist/runtime/components/ui/chart/index.js +8 -0
  47. package/dist/runtime/components/ui/chart/utils.d.ts +11 -0
  48. package/dist/runtime/components/ui/chart/utils.js +24 -0
  49. package/dist/runtime/components/ui/checkbox/Checkbox.vue +4 -2
  50. package/dist/runtime/components/ui/command/CommandDialog.vue +1 -0
  51. package/dist/runtime/components/ui/dialog/Dialog.vue +2 -1
  52. package/dist/runtime/components/ui/dropdown-menu/DropdownMenuContent.vue +1 -0
  53. package/dist/runtime/components/ui/dropdown-menu/DropdownMenuSubContent.vue +1 -0
  54. package/dist/runtime/components/ui/native-select/NativeSelectOptGroup.d.vue.ts +2 -2
  55. package/dist/runtime/components/ui/native-select/NativeSelectOptGroup.vue.d.ts +2 -2
  56. package/dist/runtime/components/ui/native-select/NativeSelectOption.d.vue.ts +2 -2
  57. package/dist/runtime/components/ui/native-select/NativeSelectOption.vue.d.ts +2 -2
  58. package/dist/runtime/components/ui/popover/PopoverContent.vue +2 -0
  59. package/dist/runtime/components/ui/select/Select.vue +1 -0
  60. package/dist/runtime/components/ui/select/SelectContent.vue +2 -0
  61. package/dist/runtime/components/ui/separator/Separator.d.vue.ts +1 -1
  62. package/dist/runtime/components/ui/separator/Separator.vue.d.ts +1 -1
  63. package/dist/runtime/components/ui/sheet/Sheet.vue +2 -1
  64. package/dist/runtime/components/ui/tabs/Tabs.d.vue.ts +2 -2
  65. package/dist/runtime/components/ui/tabs/Tabs.vue.d.ts +2 -2
  66. package/dist/runtime/components/ui/tooltip/TooltipProvider.vue +2 -1
  67. package/package.json +5 -3
  68. /package/dist/runtime/assets/svg/socials/{WhatsApp.svg → Whatsapp.svg} +0 -0
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.331.0",
4
+ "version": "1.333.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -4,16 +4,16 @@
4
4
  props.variant === 'text' || props.variant === 'link' ? '!p-0 !h-auto' : '',
5
5
  props.circle && 'rounded-full aspect-square',
6
6
  props.class
7
- ]" :variant="props.variant" :color="props.color" :size="resolvedSize" :type="props.type"
8
- :disabled="props.loading || props.disabled">
9
- <span class="inline-grid place-items-center">
10
- <span class="inline-flex items-center justify-center gap-[8px] [grid-area:1/1]"
11
- :class="{ invisible: props.loading }">
12
- <slot />
13
- </span>
14
- <ShadSpinner v-if="props.loading" class="[grid-area:1/1]" />
15
- </span>
16
- </ShadButton>
7
+ ]" :variant="props.variant" :color="props.color" :size="resolvedSize" :type="props.type"
8
+ :disabled="props.loading || props.disabled">
9
+ <span class="inline-grid place-items-center">
10
+ <span class="inline-flex items-center justify-center gap-[8px] [grid-area:1/1]"
11
+ :class="{ invisible: props.loading }">
12
+ <slot />
13
+ </span>
14
+ <ShadSpinner v-if="props.loading" class="[grid-area:1/1]" />
15
+ </span>
16
+ </ShadButton>
17
17
  </template>
18
18
 
19
19
  <script setup>
@@ -1,35 +1,35 @@
1
1
  <template>
2
- <div class="relative w-full h-full">
3
- <div class="absolute top-[20px] left-1/2 transform -translate-x-1/2 z-[50]">
4
- <div class="rounded-full py-[6px] px-[16px] bg-black/60 flex items-center justify-center">
5
- <span class="text-white text-sm font-medium tracking-widest">
6
- {{ currentIndex + 1 }} / {{ props.items.length }}
7
- </span>
8
- </div>
9
- </div>
10
-
11
- <ShadCarousel
12
- :opts="{ startIndex: props.selectIndex }"
13
- class="carousel-media w-full h-full"
14
- @init-api="onInitApi"
15
- >
16
- <ShadCarouselContent class="h-full">
17
- <ShadCarouselItem
18
- v-for="(item, i) in props.items"
19
- :key="i"
20
- class="h-full flex items-center justify-center"
21
- >
22
- <img
23
- :src="item.url"
24
- class="w-full h-full object-contain select-none"
25
- draggable="false"
26
- />
27
- </ShadCarouselItem>
28
- </ShadCarouselContent>
29
- <ShadCarouselPrevious v-if="props.items.length > 1" class="!left-[12px]" />
30
- <ShadCarouselNext v-if="props.items.length > 1" class="!right-[12px]" />
31
- </ShadCarousel>
32
- </div>
2
+ <div class="relative w-full h-full">
3
+ <div class="absolute top-[20px] left-1/2 transform -translate-x-1/2 z-[50]">
4
+ <div class="rounded-full py-[6px] px-[16px] bg-black/60 flex items-center justify-center">
5
+ <span class="text-white text-sm font-medium tracking-widest">
6
+ {{ currentIndex + 1 }} / {{ props.items.length }}
7
+ </span>
8
+ </div>
9
+ </div>
10
+
11
+ <ShadCarousel
12
+ :opts="{ startIndex: props.selectIndex }"
13
+ class="carousel-media w-full h-full"
14
+ @init-api="onInitApi"
15
+ >
16
+ <ShadCarouselContent class="h-full">
17
+ <ShadCarouselItem
18
+ v-for="(item, i) in props.items"
19
+ :key="i"
20
+ class="h-full flex items-center justify-center"
21
+ >
22
+ <img
23
+ :src="item.url"
24
+ class="w-full h-full object-contain select-none"
25
+ draggable="false"
26
+ />
27
+ </ShadCarouselItem>
28
+ </ShadCarouselContent>
29
+ <ShadCarouselPrevious v-if="props.items.length > 1" class="!left-[12px]" />
30
+ <ShadCarouselNext v-if="props.items.length > 1" class="!right-[12px]" />
31
+ </ShadCarousel>
32
+ </div>
33
33
  </template>
34
34
 
35
35
  <script setup>
@@ -0,0 +1,35 @@
1
+ export type ApprovalStatusKey = "pending" | "approved" | "rejected";
2
+ export interface ApprovalSeriesPoint {
3
+ date: string | Date;
4
+ value: number;
5
+ }
6
+ export interface ApprovalSeries {
7
+ /** เดือนที่โฟกัสของแถวนี้ (controlled โดย parent) */
8
+ month?: string | Date;
9
+ /** ข้อมูลรายวันของแถวนี้ */
10
+ data?: ApprovalSeriesPoint[];
11
+ /** ตัวเลขสรุปของแถว — ถ้าไม่ส่งจะรวมจาก data ให้ */
12
+ summary?: number;
13
+ }
14
+ type __VLS_Props = {
15
+ pending?: ApprovalSeries;
16
+ approved?: ApprovalSeries;
17
+ rejected?: ApprovalSeries;
18
+ /** locale ของชื่อเดือน (default en-US ตาม Figma) */
19
+ locale?: string;
20
+ /** ความสูง component เช่น "600px" หรือ 600 — ไม่ส่ง = เต็ม parent */
21
+ height?: string | number;
22
+ };
23
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
24
+ change: (key: ApprovalStatusKey, month: Date) => any;
25
+ prev: (key: ApprovalStatusKey, month: Date) => any;
26
+ next: (key: ApprovalStatusKey, month: Date) => any;
27
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
28
+ onChange?: ((key: ApprovalStatusKey, month: Date) => any) | undefined;
29
+ onPrev?: ((key: ApprovalStatusKey, month: Date) => any) | undefined;
30
+ onNext?: ((key: ApprovalStatusKey, month: Date) => any) | undefined;
31
+ }>, {
32
+ locale: string;
33
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
+ declare const _default: typeof __VLS_export;
35
+ export default _default;
@@ -0,0 +1,152 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { VisAxis, VisGroupedBar, VisXYContainer } from "@unovis/vue";
4
+ import { ChartContainer } from "#pukaad-ui/runtime/components/ui/chart";
5
+ const props = defineProps({
6
+ pending: { type: Object, required: false },
7
+ approved: { type: Object, required: false },
8
+ rejected: { type: Object, required: false },
9
+ locale: { type: String, required: false, default: "en-US" },
10
+ height: { type: [String, Number], required: false }
11
+ });
12
+ const emit = defineEmits(["change", "prev", "next"]);
13
+ const rows = [
14
+ { key: "pending", title: "\u0E23\u0E2D\u0E01\u0E32\u0E23\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19", color: "#FEF3C7" },
15
+ { key: "approved", title: "\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E41\u0E25\u0E49\u0E27", color: "#E3F5E3" },
16
+ { key: "rejected", title: "\u0E1B\u0E0F\u0E34\u0E40\u0E2A\u0E18", color: "#FDE3E3" }
17
+ ];
18
+ const summaryMeta = [
19
+ { key: "pending", label: "\u0E23\u0E2D\u0E01\u0E32\u0E23\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19", color: "#F9A825" },
20
+ { key: "approved", label: "\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E41\u0E25\u0E49\u0E27", color: "#43A047" },
21
+ { key: "rejected", label: "\u0E1B\u0E0F\u0E34\u0E40\u0E2A\u0E18", color: "#D32F2F" }
22
+ ];
23
+ const chartConfig = {};
24
+ const seriesByKey = computed(() => ({
25
+ pending: props.pending ?? {},
26
+ approved: props.approved ?? {},
27
+ rejected: props.rejected ?? {}
28
+ }));
29
+ const normalizedByKey = computed(() => {
30
+ const out = { pending: [], approved: [], rejected: [] };
31
+ for (const r of rows) {
32
+ out[r.key] = (seriesByKey.value[r.key].data ?? []).map((d) => ({
33
+ _date: d.date instanceof Date ? d.date : new Date(d.date),
34
+ value: d.value ?? 0
35
+ }));
36
+ }
37
+ return out;
38
+ });
39
+ const monthByKey = computed(() => {
40
+ const out = {};
41
+ for (const r of rows) {
42
+ const m = seriesByKey.value[r.key].month;
43
+ out[r.key] = m ? m instanceof Date ? m : new Date(m) : /* @__PURE__ */ new Date();
44
+ }
45
+ return out;
46
+ });
47
+ const summaryByKey = computed(() => {
48
+ const out = {};
49
+ for (const r of rows) {
50
+ const s = seriesByKey.value[r.key].summary;
51
+ out[r.key] = s ?? normalizedByKey.value[r.key].reduce((a, p) => a + p.value, 0);
52
+ }
53
+ return out;
54
+ });
55
+ const rootHeight = computed(
56
+ () => props.height == null ? void 0 : typeof props.height === "number" ? `${props.height}px` : props.height
57
+ );
58
+ const addMonths = (d, delta) => new Date(d.getFullYear(), d.getMonth() + delta, 1);
59
+ const fmtMonth = (d, withYear) => d.toLocaleDateString(props.locale, {
60
+ month: "long",
61
+ ...withYear ? { year: "numeric" } : {}
62
+ });
63
+ const monthLabelOf = (k) => fmtMonth(monthByKey.value[k], true);
64
+ const prevLabelOf = (k) => fmtMonth(addMonths(monthByKey.value[k], -1), false);
65
+ const nextLabelOf = (k) => fmtMonth(addMonths(monthByKey.value[k], 1), false);
66
+ const goPrev = (k) => {
67
+ const m = addMonths(monthByKey.value[k], -1);
68
+ emit("prev", k, m);
69
+ emit("change", k, m);
70
+ };
71
+ const goNext = (k) => {
72
+ const m = addMonths(monthByKey.value[k], 1);
73
+ emit("next", k, m);
74
+ emit("change", k, m);
75
+ };
76
+ const indicesOf = (k) => normalizedByKey.value[k].map((_, i) => i);
77
+ const dayLabelOf = (k, i) => {
78
+ const d = normalizedByKey.value[k][i]?._date;
79
+ return d ? String(d.getDate()) : "";
80
+ };
81
+ </script>
82
+
83
+ <template>
84
+ <div
85
+ class="flex flex-col gap-[16px] w-full"
86
+ :class="rootHeight ? '' : 'h-full'"
87
+ :style="rootHeight ? { height: rootHeight } : void 0"
88
+ >
89
+ <div
90
+ v-for="(row, ri) in rows"
91
+ :key="row.key"
92
+ class="flex flex-col gap-[16px] flex-1 min-h-0"
93
+ >
94
+ <div class="flex items-end justify-between gap-[16px]">
95
+ <div class="font-title-small-prominent">{{ row.title }}</div>
96
+ <div v-if="ri === 0" class="flex gap-[17px]">
97
+ <div
98
+ v-for="m in summaryMeta"
99
+ :key="m.key"
100
+ class="flex flex-col items-center border rounded-[8px] py-[8px] px-[16px] min-w-[114px]"
101
+ >
102
+ <div
103
+ class="font-title-medium-prominent"
104
+ :style="{ color: m.color }"
105
+ >
106
+ {{ summaryByKey[m.key] }}
107
+ </div>
108
+ <div class="font-body-large-prominent text-gray">{{ m.label }}</div>
109
+ </div>
110
+ </div>
111
+ </div>
112
+
113
+ <ChartContainer
114
+ :config="chartConfig"
115
+ class="flex-1 min-h-0 w-full aspect-auto"
116
+ >
117
+ <VisXYContainer :data="normalizedByKey[row.key]">
118
+ <VisGroupedBar
119
+ :x="(_d, i) => i"
120
+ :y="[(d) => d.value]"
121
+ :color="[row.color]"
122
+ :rounded-corners="4"
123
+ bar-padding="0.25"
124
+ />
125
+ <VisAxis
126
+ type="x"
127
+ :x="(_d, i) => i"
128
+ :tick-values="indicesOf(row.key)"
129
+ :tick-format="(i) => dayLabelOf(row.key, i)"
130
+ :tick-line="false"
131
+ :domain-line="false"
132
+ :grid-line="false"
133
+ />
134
+ </VisXYContainer>
135
+ </ChartContainer>
136
+
137
+ <div
138
+ class="flex items-center justify-between font-label-sans-serif-small-prominent text-gray uppercase"
139
+ >
140
+ <div class="flex items-center cursor-pointer" @click="goPrev(row.key)">
141
+ <Icon name="lucide:chevrons-left" size="16" />
142
+ {{ prevLabelOf(row.key) }}
143
+ </div>
144
+ <div>{{ monthLabelOf(row.key) }}</div>
145
+ <div class="flex items-center cursor-pointer" @click="goNext(row.key)">
146
+ {{ nextLabelOf(row.key) }}
147
+ <Icon name="lucide:chevrons-right" size="16" />
148
+ </div>
149
+ </div>
150
+ </div>
151
+ </div>
152
+ </template>
@@ -0,0 +1,35 @@
1
+ export type ApprovalStatusKey = "pending" | "approved" | "rejected";
2
+ export interface ApprovalSeriesPoint {
3
+ date: string | Date;
4
+ value: number;
5
+ }
6
+ export interface ApprovalSeries {
7
+ /** เดือนที่โฟกัสของแถวนี้ (controlled โดย parent) */
8
+ month?: string | Date;
9
+ /** ข้อมูลรายวันของแถวนี้ */
10
+ data?: ApprovalSeriesPoint[];
11
+ /** ตัวเลขสรุปของแถว — ถ้าไม่ส่งจะรวมจาก data ให้ */
12
+ summary?: number;
13
+ }
14
+ type __VLS_Props = {
15
+ pending?: ApprovalSeries;
16
+ approved?: ApprovalSeries;
17
+ rejected?: ApprovalSeries;
18
+ /** locale ของชื่อเดือน (default en-US ตาม Figma) */
19
+ locale?: string;
20
+ /** ความสูง component เช่น "600px" หรือ 600 — ไม่ส่ง = เต็ม parent */
21
+ height?: string | number;
22
+ };
23
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
24
+ change: (key: ApprovalStatusKey, month: Date) => any;
25
+ prev: (key: ApprovalStatusKey, month: Date) => any;
26
+ next: (key: ApprovalStatusKey, month: Date) => any;
27
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
28
+ onChange?: ((key: ApprovalStatusKey, month: Date) => any) | undefined;
29
+ onPrev?: ((key: ApprovalStatusKey, month: Date) => any) | undefined;
30
+ onNext?: ((key: ApprovalStatusKey, month: Date) => any) | undefined;
31
+ }>, {
32
+ locale: string;
33
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
+ declare const _default: typeof __VLS_export;
35
+ export default _default;
@@ -1,102 +1,102 @@
1
1
  <template>
2
- <!-- Personal state → Featured layout — 1 รูป: w-full -->
3
- <div v-if="layoutMode === 'featured' && photos.length === 1" class="h-[360px]">
4
- <div class="w-full h-full rounded-[8px] overflow-hidden cursor-pointer" @click="openLightbox('photo', 0)">
5
- <Image :src="photos[0].url" class="w-full h-full object-cover" width="auto" height="auto" />
6
- </div>
7
- </div>
8
-
9
- <!-- Personal state → Featured layout — 2 รูป: แบ่งครึ่ง w-full -->
10
- <div v-else-if="layoutMode === 'featured' && photos.length === 2" class="flex gap-[8px] h-[360px]">
11
- <div class="flex-1 rounded-[8px] overflow-hidden cursor-pointer" @click="openLightbox('photo', 0)">
12
- <Image :src="photos[0].url" class="w-full h-full object-cover" width="auto" height="auto" />
13
- </div>
14
- <div class="flex-1 rounded-[8px] overflow-hidden cursor-pointer" @click="openLightbox('photo', 1)">
15
- <Image :src="photos[1].url" class="w-full h-full object-cover" width="auto" height="auto" />
16
- </div>
17
- </div>
18
-
19
- <!-- Personal state → Featured layout — 3+ รูป: layout เดิม -->
20
- <div v-else-if="layoutMode === 'featured'" class="flex gap-[8px] h-[360px]">
21
- <div v-if="photos[0]" class="w-[620px] shrink-0 rounded-[8px] overflow-hidden cursor-pointer"
22
- @click="openLightbox('photo', 0)">
23
- <Image :src="photos[0].url" class="w-full h-full object-cover" width="auto" height="auto" />
24
- </div>
25
-
26
- <div v-if="photos[1]" class="flex-1 rounded-[8px] overflow-hidden cursor-pointer" @click="openLightbox('photo', 1)">
27
- <Image :src="photos[1].url" class="w-full h-full object-cover" width="auto" height="auto" />
28
- </div>
29
-
30
- <div class="w-[306px] shrink-0 flex flex-col gap-[8px]">
31
- <div v-if="photos[2]" class="flex-1 min-h-0 relative rounded-[8px] overflow-hidden cursor-pointer"
32
- @click="openLightbox('photo', 2)">
33
- <Image :src="photos[2].url" class="w-full h-full object-cover" width="auto" height="auto" />
34
- <div v-if="featuredPhoto2Overflow > 0"
35
- class="absolute inset-0 bg-black/50 flex flex-col items-center justify-center text-white gap-[6px]">
36
- <Icon name="fa6-solid:image" :size="42" />
37
- <span class="font-body-large">รูปภาพ ({{ convertNumber(featuredPhoto2Overflow) }})</span>
38
- </div>
39
- </div>
40
-
41
- <div v-if="videos[0]" class="flex-1 min-h-0 relative rounded-[8px] overflow-hidden cursor-pointer"
42
- @click="openLightbox('video', 0)">
43
- <Image :src="videos[0].url" class="w-full h-full object-cover" width="auto" height="auto" />
44
- <div class="absolute inset-0 bg-black/50 flex flex-col items-center justify-center text-white gap-[6px]">
45
- <Icon name="fa6-solid:video" :size="42" />
46
- <span class="font-body-large">วิดีโอ ({{ videos.length }})</span>
47
- </div>
48
- </div>
49
- <div v-else-if="photos[3]" class="flex-1 min-h-0 relative rounded-[8px] overflow-hidden cursor-pointer"
50
- @click="openLightbox('photo', 3)">
51
- <Image :src="photos[3].url" class="w-full h-full object-cover" width="auto" height="auto" />
52
- <div v-if="featuredPhoto3Overflow > 0"
53
- class="absolute inset-0 bg-black/50 flex flex-col items-center justify-center text-white gap-[6px]">
54
- <Icon name="fa6-solid:image" :size="42" />
55
- <span class="font-body-large">รูปภาพ ({{ convertNumber(featuredPhoto3Overflow) }})</span>
56
- </div>
57
- </div>
58
- </div>
59
- </div>
60
-
61
- <!-- Office / Business state → Album layout -->
62
- <div v-else-if="layoutMode === 'album'" class="grid grid-cols-5 gap-[10px]">
63
- <!-- Row 1: photos[0..3] -->
64
- <div v-for="(photo, i) in galleryRow1" :key="`g1-${i}`"
65
- class="w-[132px] h-[132px] rounded-[8px] overflow-hidden cursor-pointer" @click="openLightbox('photo', i)">
66
- <Image :src="photo.url" class="w-full h-full object-cover" width="auto" height="auto" />
67
- </div>
68
-
69
- <!-- Row 1 col 5: image count overlay -->
70
- <div v-show="galleryCountPhoto != null"
71
- class="w-[132px] h-[132px] relative rounded-[8px] overflow-hidden cursor-pointer"
72
- @click="openLightbox('photo', 8)">
73
- <Image v-if="galleryCountPhoto" :src="galleryCountPhoto.url" class="w-full h-full object-cover" width="auto"
74
- height="auto" />
75
- <div class="absolute inset-0 bg-black/50 flex flex-col items-center justify-center text-white gap-[6px]">
76
- <Icon name="fa6-solid:image" :size="35" />
77
- <span class="font-label-medium">รูปภาพ ({{ convertNumber(photos.length - 8) }})</span>
78
- </div>
79
- </div>
80
-
81
- <!-- Row 2: photos[4..7] -->
82
- <div v-for="(photo, i) in galleryRow2" :key="`g2-${i}`"
83
- class="w-[132px] h-[132px] rounded-[8px] overflow-hidden cursor-pointer" @click="openLightbox('photo', 4 + i)">
84
- <Image :src="photo.url" class="w-full h-full object-cover" width="auto" height="auto" />
85
- </div>
86
-
87
- <!-- Row 2 col 5: video overlay -->
88
- <div v-if="videos[0]" class="w-[132px] h-[132px] relative rounded-[8px] overflow-hidden cursor-pointer"
89
- @click="openLightbox('video', 0)">
90
- <Image :src="videos[0].url" class="w-full h-full object-cover" width="auto" height="auto" />
91
- <div class="absolute inset-0 bg-black/50 flex flex-col items-center justify-center text-white gap-[6px]">
92
- <Icon name="fa6-solid:video" :size="35" />
93
- <span class="font-label-medium">วิดีโอ ({{ videos.length }})</span>
94
- </div>
95
- </div>
96
- </div>
97
-
98
- <!-- Lightbox modal -->
99
- <ModalMediaView v-model="isMediaOpen" :items="mediaItems" :title="props.title" :start-index="mediaStartIndex" />
2
+ <!-- Personal state → Featured layout — 1 รูป: w-full -->
3
+ <div v-if="layoutMode === 'featured' && photos.length === 1" class="h-[360px]">
4
+ <div class="w-full h-full rounded-[8px] overflow-hidden cursor-pointer" @click="openLightbox('photo', 0)">
5
+ <Image :src="photos[0].url" class="w-full h-full object-cover" width="auto" height="auto" />
6
+ </div>
7
+ </div>
8
+
9
+ <!-- Personal state → Featured layout — 2 รูป: แบ่งครึ่ง w-full -->
10
+ <div v-else-if="layoutMode === 'featured' && photos.length === 2" class="flex gap-[8px] h-[360px]">
11
+ <div class="flex-1 rounded-[8px] overflow-hidden cursor-pointer" @click="openLightbox('photo', 0)">
12
+ <Image :src="photos[0].url" class="w-full h-full object-cover" width="auto" height="auto" />
13
+ </div>
14
+ <div class="flex-1 rounded-[8px] overflow-hidden cursor-pointer" @click="openLightbox('photo', 1)">
15
+ <Image :src="photos[1].url" class="w-full h-full object-cover" width="auto" height="auto" />
16
+ </div>
17
+ </div>
18
+
19
+ <!-- Personal state → Featured layout — 3+ รูป: layout เดิม -->
20
+ <div v-else-if="layoutMode === 'featured'" class="flex gap-[8px] h-[360px]">
21
+ <div v-if="photos[0]" class="w-[620px] shrink-0 rounded-[8px] overflow-hidden cursor-pointer"
22
+ @click="openLightbox('photo', 0)">
23
+ <Image :src="photos[0].url" class="w-full h-full object-cover" width="auto" height="auto" />
24
+ </div>
25
+
26
+ <div v-if="photos[1]" class="flex-1 rounded-[8px] overflow-hidden cursor-pointer" @click="openLightbox('photo', 1)">
27
+ <Image :src="photos[1].url" class="w-full h-full object-cover" width="auto" height="auto" />
28
+ </div>
29
+
30
+ <div class="w-[306px] shrink-0 flex flex-col gap-[8px]">
31
+ <div v-if="photos[2]" class="flex-1 min-h-0 relative rounded-[8px] overflow-hidden cursor-pointer"
32
+ @click="openLightbox('photo', 2)">
33
+ <Image :src="photos[2].url" class="w-full h-full object-cover" width="auto" height="auto" />
34
+ <div v-if="featuredPhoto2Overflow > 0"
35
+ class="absolute inset-0 bg-black/50 flex flex-col items-center justify-center text-white gap-[6px]">
36
+ <Icon name="fa6-solid:image" :size="42" />
37
+ <span class="font-body-large">รูปภาพ ({{ convertNumber(featuredPhoto2Overflow) }})</span>
38
+ </div>
39
+ </div>
40
+
41
+ <div v-if="videos[0]" class="flex-1 min-h-0 relative rounded-[8px] overflow-hidden cursor-pointer"
42
+ @click="openLightbox('video', 0)">
43
+ <Image :src="videos[0].url" class="w-full h-full object-cover" width="auto" height="auto" />
44
+ <div class="absolute inset-0 bg-black/50 flex flex-col items-center justify-center text-white gap-[6px]">
45
+ <Icon name="fa6-solid:video" :size="42" />
46
+ <span class="font-body-large">วิดีโอ ({{ videos.length }})</span>
47
+ </div>
48
+ </div>
49
+ <div v-else-if="photos[3]" class="flex-1 min-h-0 relative rounded-[8px] overflow-hidden cursor-pointer"
50
+ @click="openLightbox('photo', 3)">
51
+ <Image :src="photos[3].url" class="w-full h-full object-cover" width="auto" height="auto" />
52
+ <div v-if="featuredPhoto3Overflow > 0"
53
+ class="absolute inset-0 bg-black/50 flex flex-col items-center justify-center text-white gap-[6px]">
54
+ <Icon name="fa6-solid:image" :size="42" />
55
+ <span class="font-body-large">รูปภาพ ({{ convertNumber(featuredPhoto3Overflow) }})</span>
56
+ </div>
57
+ </div>
58
+ </div>
59
+ </div>
60
+
61
+ <!-- Office / Business state → Album layout -->
62
+ <div v-else-if="layoutMode === 'album'" class="grid grid-cols-5 gap-[10px]">
63
+ <!-- Row 1: photos[0..3] -->
64
+ <div v-for="(photo, i) in galleryRow1" :key="`g1-${i}`"
65
+ class="w-[132px] h-[132px] rounded-[8px] overflow-hidden cursor-pointer" @click="openLightbox('photo', i)">
66
+ <Image :src="photo.url" class="w-full h-full object-cover" width="auto" height="auto" />
67
+ </div>
68
+
69
+ <!-- Row 1 col 5: image count overlay -->
70
+ <div v-show="galleryCountPhoto != null"
71
+ class="w-[132px] h-[132px] relative rounded-[8px] overflow-hidden cursor-pointer"
72
+ @click="openLightbox('photo', 8)">
73
+ <Image v-if="galleryCountPhoto" :src="galleryCountPhoto.url" class="w-full h-full object-cover" width="auto"
74
+ height="auto" />
75
+ <div class="absolute inset-0 bg-black/50 flex flex-col items-center justify-center text-white gap-[6px]">
76
+ <Icon name="fa6-solid:image" :size="35" />
77
+ <span class="font-label-medium">รูปภาพ ({{ convertNumber(photos.length - 8) }})</span>
78
+ </div>
79
+ </div>
80
+
81
+ <!-- Row 2: photos[4..7] -->
82
+ <div v-for="(photo, i) in galleryRow2" :key="`g2-${i}`"
83
+ class="w-[132px] h-[132px] rounded-[8px] overflow-hidden cursor-pointer" @click="openLightbox('photo', 4 + i)">
84
+ <Image :src="photo.url" class="w-full h-full object-cover" width="auto" height="auto" />
85
+ </div>
86
+
87
+ <!-- Row 2 col 5: video overlay -->
88
+ <div v-if="videos[0]" class="w-[132px] h-[132px] relative rounded-[8px] overflow-hidden cursor-pointer"
89
+ @click="openLightbox('video', 0)">
90
+ <Image :src="videos[0].url" class="w-full h-full object-cover" width="auto" height="auto" />
91
+ <div class="absolute inset-0 bg-black/50 flex flex-col items-center justify-center text-white gap-[6px]">
92
+ <Icon name="fa6-solid:video" :size="35" />
93
+ <span class="font-label-medium">วิดีโอ ({{ videos.length }})</span>
94
+ </div>
95
+ </div>
96
+ </div>
97
+
98
+ <!-- Lightbox modal -->
99
+ <ModalMediaView v-model="isMediaOpen" :items="mediaItems" :title="props.title" :start-index="mediaStartIndex" />
100
100
  </template>
101
101
 
102
102
  <script setup>
@@ -114,6 +114,7 @@
114
114
  v-model="formData"
115
115
  :state="props.state"
116
116
  :fixed-province-id="fixedProvinceId"
117
+ :edit-id="props.editId"
117
118
  />
118
119
  </div>
119
120
  <template #footer>
@@ -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;
@@ -50,15 +50,15 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
50
50
  required: boolean;
51
51
  options: AutocompleteOption[] | string[] | number[];
52
52
  description: string;
53
- limit: number;
53
+ labelKey: string;
54
54
  placeholder: string;
55
+ limit: number;
55
56
  disabledErrorMessage: boolean;
56
57
  disabledBorder: boolean;
57
58
  showCounter: boolean;
58
59
  returnObject: boolean;
59
60
  freeText: boolean;
60
61
  valueKey: string;
61
- labelKey: string;
62
62
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
63
63
  declare const _default: typeof __VLS_export;
64
64
  export default _default;
@@ -50,15 +50,15 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
50
50
  required: boolean;
51
51
  options: AutocompleteOption[] | string[] | number[];
52
52
  description: string;
53
- limit: number;
53
+ labelKey: string;
54
54
  placeholder: string;
55
+ limit: number;
55
56
  disabledErrorMessage: boolean;
56
57
  disabledBorder: boolean;
57
58
  showCounter: boolean;
58
59
  returnObject: boolean;
59
60
  freeText: boolean;
60
61
  valueKey: string;
61
- labelKey: string;
62
62
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
63
63
  declare const _default: typeof __VLS_export;
64
64
  export default _default;
@@ -30,9 +30,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
30
30
  id: string;
31
31
  name: string;
32
32
  required: boolean;
33
+ locale: string;
33
34
  placeholder: string;
34
35
  disabledErrorMessage: boolean;
35
- locale: string;
36
36
  layout: "month-and-year" | "month-only" | "year-only";
37
37
  dateFormat: string;
38
38
  minAge: number;
@@ -30,9 +30,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
30
30
  id: string;
31
31
  name: string;
32
32
  required: boolean;
33
+ locale: string;
33
34
  placeholder: string;
34
35
  disabledErrorMessage: boolean;
35
- locale: string;
36
36
  layout: "month-and-year" | "month-only" | "year-only";
37
37
  dateFormat: string;
38
38
  minAge: number;