@7365admin1/layer-common 1.8.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 (198) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +11 -0
  3. package/.editorconfig +12 -0
  4. package/.github/workflows/main.yml +17 -0
  5. package/.github/workflows/publish.yml +39 -0
  6. package/.nuxtrc +1 -0
  7. package/.playground/app.vue +41 -0
  8. package/.playground/eslint.config.mjs +6 -0
  9. package/.playground/nuxt.config.ts +22 -0
  10. package/.playground/pages/feedback.vue +30 -0
  11. package/CHANGELOG.md +263 -0
  12. package/README.md +73 -0
  13. package/app.vue +3 -0
  14. package/components/AccessCardAddForm.vue +363 -0
  15. package/components/AccessManagement.vue +420 -0
  16. package/components/Avatar/Main.vue +68 -0
  17. package/components/BillingMain.vue +66 -0
  18. package/components/BtnUploadFile.vue +139 -0
  19. package/components/BuildingForm.vue +303 -0
  20. package/components/BuildingManagement/buildings.vue +335 -0
  21. package/components/BuildingManagement/units.vue +350 -0
  22. package/components/BuildingUnitFormAdd.vue +441 -0
  23. package/components/BuildingUnitFormEdit.vue +429 -0
  24. package/components/CameraForm.vue +264 -0
  25. package/components/CameraMain.vue +352 -0
  26. package/components/Card/DeleteConfirmation.vue +51 -0
  27. package/components/Card/MemberInfoSummary.vue +44 -0
  28. package/components/Card/Toggle.vue +25 -0
  29. package/components/Chat/Bubbles.vue +53 -0
  30. package/components/Chat/Information.vue +416 -0
  31. package/components/Chat/ListCard.vue +62 -0
  32. package/components/Chat/Message.vue +158 -0
  33. package/components/Chat/Navigation.vue +150 -0
  34. package/components/ConfirmDialog.vue +66 -0
  35. package/components/Container/Standard.vue +33 -0
  36. package/components/DashboardPlaceholder.vue +1524 -0
  37. package/components/Dialog/DeleteConfirmation.vue +51 -0
  38. package/components/Dialog/ReplaceAutofillPrompt.vue +49 -0
  39. package/components/Dialog/UpdateMoreAction.vue +103 -0
  40. package/components/DocumentForm.vue +187 -0
  41. package/components/DocumentManagement.vue +376 -0
  42. package/components/Editor.vue +95 -0
  43. package/components/EntryPassMain.vue +518 -0
  44. package/components/Feedback/Form.vue +173 -0
  45. package/components/FeedbackDetail.vue +599 -0
  46. package/components/FeedbackMain.vue +588 -0
  47. package/components/FormDialog.vue +65 -0
  48. package/components/ImageCarousel.vue +138 -0
  49. package/components/Input/Date.vue +177 -0
  50. package/components/Input/DateTimePicker.vue +131 -0
  51. package/components/Input/File.vue +236 -0
  52. package/components/Input/FileV2.vue +234 -0
  53. package/components/Input/InputPhoneNumberV2.vue +164 -0
  54. package/components/Input/ListGroupSelection.vue +96 -0
  55. package/components/Input/NRICNumber.vue +53 -0
  56. package/components/Input/NewDate.vue +123 -0
  57. package/components/Input/Number.vue +124 -0
  58. package/components/Input/Password.vue +22 -0
  59. package/components/Input/PhoneNumber.vue +188 -0
  60. package/components/Input/VehicleNumber.vue +49 -0
  61. package/components/InputLabel.vue +22 -0
  62. package/components/InvitationForm.vue +359 -0
  63. package/components/InvitationMain.vue +310 -0
  64. package/components/Layout/Header.vue +129 -0
  65. package/components/Layout/NavigationDrawer.vue +44 -0
  66. package/components/ListItem.vue +35 -0
  67. package/components/ListView.vue +87 -0
  68. package/components/LocalPagination.vue +31 -0
  69. package/components/MemberMain.vue +459 -0
  70. package/components/NFC/NFCPatrolReportMain.vue +591 -0
  71. package/components/NFC/NFCPatrolRouteForm.vue +596 -0
  72. package/components/NFC/NFCPatrolRouteMain.vue +539 -0
  73. package/components/NFC/NFCTagForm.vue +236 -0
  74. package/components/NFC/NFCTagMain.vue +337 -0
  75. package/components/NFC/PatrolSettings.vue +130 -0
  76. package/components/NavigationItem.vue +83 -0
  77. package/components/NumberSettingField.vue +107 -0
  78. package/components/OnlineFormConfigurationForm.vue +290 -0
  79. package/components/OnlineFormsConfiguration.vue +429 -0
  80. package/components/PeopleForm.vue +452 -0
  81. package/components/PlaceholderComponent.vue +34 -0
  82. package/components/RolePermissionFormCreate.vue +161 -0
  83. package/components/RolePermissionFormPreviewUpdate.vue +183 -0
  84. package/components/RolePermissionMain.vue +361 -0
  85. package/components/SearchVehicleNumberUser.vue +91 -0
  86. package/components/ServiceProviderFormCreate.vue +154 -0
  87. package/components/ServiceProviderMain.vue +547 -0
  88. package/components/SignaturePad.vue +73 -0
  89. package/components/Snackbar.vue +23 -0
  90. package/components/SpecificAttr.vue +53 -0
  91. package/components/SupplyManagement.vue +292 -0
  92. package/components/SwitchContext.vue +108 -0
  93. package/components/TableList.vue +150 -0
  94. package/components/TableListSecondary.vue +164 -0
  95. package/components/TableMain.vue +142 -0
  96. package/components/TableWithButton.vue +94 -0
  97. package/components/VehicleUpdateMoreAction.vue +84 -0
  98. package/components/VideoPlayer.vue +125 -0
  99. package/components/VisitorForm.vue +659 -0
  100. package/components/VisitorFormSelection.vue +53 -0
  101. package/components/VisitorManagement.vue +490 -0
  102. package/components/WorkOrder/Create.vue +284 -0
  103. package/components/WorkOrder/Detail.vue +71 -0
  104. package/components/WorkOrder/ListView.vue +96 -0
  105. package/components/WorkOrder/Main.vue +489 -0
  106. package/components/Workorder.vue +1 -0
  107. package/composables/useAddress.ts +107 -0
  108. package/composables/useBuilding.ts +250 -0
  109. package/composables/useBuildingUnit.ts +116 -0
  110. package/composables/useCard.ts +46 -0
  111. package/composables/useCommonPermission.ts +207 -0
  112. package/composables/useCustomer.ts +113 -0
  113. package/composables/useCustomerSite.ts +56 -0
  114. package/composables/useDashboard.ts +31 -0
  115. package/composables/useDashboardData.ts +425 -0
  116. package/composables/useDocument.ts +57 -0
  117. package/composables/useFacility.ts +246 -0
  118. package/composables/useFeedback.ts +119 -0
  119. package/composables/useFile.ts +55 -0
  120. package/composables/useInvoice.ts +18 -0
  121. package/composables/useLocal.ts +131 -0
  122. package/composables/useLocalAuth.ts +137 -0
  123. package/composables/useLocalSetup.ts +13 -0
  124. package/composables/useMember.ts +111 -0
  125. package/composables/useNFCPatrolRoute.ts +77 -0
  126. package/composables/useNFCPatrolSettings.ts +19 -0
  127. package/composables/useNFCPatrolTag.ts +53 -0
  128. package/composables/useOnlineForm.ts +67 -0
  129. package/composables/useOrg.ts +129 -0
  130. package/composables/usePDFDownload.ts +25 -0
  131. package/composables/usePaymentMethod.ts +101 -0
  132. package/composables/usePeople.ts +81 -0
  133. package/composables/usePermission.ts +54 -0
  134. package/composables/usePhoneCountries.ts +561 -0
  135. package/composables/usePrice.ts +15 -0
  136. package/composables/usePromoCode.ts +36 -0
  137. package/composables/useRecapPermission.ts +26 -0
  138. package/composables/useRole.ts +104 -0
  139. package/composables/useSecurityUtils.ts +18 -0
  140. package/composables/useServiceProvider.ts +224 -0
  141. package/composables/useSite.ts +109 -0
  142. package/composables/useSiteEntryPassSettings.ts +46 -0
  143. package/composables/useSiteSettings.ts +123 -0
  144. package/composables/useSubscription.ts +150 -0
  145. package/composables/useUser.ts +132 -0
  146. package/composables/useUtils.ts +445 -0
  147. package/composables/useVerification.ts +34 -0
  148. package/composables/useVisitor.ts +120 -0
  149. package/composables/useWorkOrder.ts +85 -0
  150. package/error.vue +41 -0
  151. package/layouts/plain.vue +7 -0
  152. package/middleware/01.auth.ts +20 -0
  153. package/middleware/02.org.ts +21 -0
  154. package/middleware/03.customer.ts +13 -0
  155. package/middleware/member.ts +4 -0
  156. package/nuxt.config.ts +54 -0
  157. package/package.json +39 -0
  158. package/pages/index.vue +3 -0
  159. package/pages/payment-method-linked.vue +31 -0
  160. package/pages/require-customer.vue +56 -0
  161. package/pages/require-organization-membership.vue +47 -0
  162. package/pages/unauthorized.vue +29 -0
  163. package/plugins/API.ts +21 -0
  164. package/plugins/iconify.client.ts +5 -0
  165. package/plugins/secure-member.client.ts +86 -0
  166. package/plugins/vuetify.ts +62 -0
  167. package/public/bg-camera.jpg +0 -0
  168. package/public/bg-city.jpg +0 -0
  169. package/public/bg-condo.jpg +0 -0
  170. package/public/images/icons/delete-icon.png +0 -0
  171. package/public/sprite.svg +1 -0
  172. package/tsconfig.json +3 -0
  173. package/types/address.d.ts +13 -0
  174. package/types/building.d.ts +27 -0
  175. package/types/camera.d.ts +31 -0
  176. package/types/card.d.ts +22 -0
  177. package/types/customer.d.ts +27 -0
  178. package/types/document.d.ts +6 -0
  179. package/types/feedback.d.ts +68 -0
  180. package/types/local.d.ts +74 -0
  181. package/types/member.d.ts +21 -0
  182. package/types/online-form.d.ts +15 -0
  183. package/types/org.d.ts +13 -0
  184. package/types/people.d.ts +24 -0
  185. package/types/permission.d.ts +25 -0
  186. package/types/phone-number.d.ts +10 -0
  187. package/types/price.d.ts +17 -0
  188. package/types/promo-code.d.ts +19 -0
  189. package/types/role.d.ts +11 -0
  190. package/types/select.d.ts +4 -0
  191. package/types/service-provider.d.ts +15 -0
  192. package/types/site.d.ts +20 -0
  193. package/types/subscription.d.ts +23 -0
  194. package/types/user.d.ts +19 -0
  195. package/types/verification.d.ts +20 -0
  196. package/types/visitor.d.ts +42 -0
  197. package/types/work-order.d.ts +42 -0
  198. package/utils/phoneMasks.ts +1703 -0
@@ -0,0 +1,113 @@
1
+ export default function useCustomer() {
2
+ const customers = ref<Array<TCustomer>>([]);
3
+ const page = ref(1);
4
+ const pages = ref(0);
5
+ const pageRange = ref("-- - -- of --");
6
+ const search = ref("");
7
+
8
+ const customer = useState(
9
+ "customer",
10
+ (): TCustomer => ({
11
+ _id: "",
12
+ name: "",
13
+ orgId: "",
14
+ customerOrgId: "",
15
+ createdAt: "",
16
+ updatedAt: "",
17
+ })
18
+ );
19
+
20
+ async function getCustomers({
21
+ page = 1,
22
+ search = "",
23
+ limit = 10,
24
+ organization,
25
+ status = "active",
26
+ sort = "",
27
+ order = "asc",
28
+ }: {
29
+ page?: number;
30
+ search?: string;
31
+ limit?: number;
32
+ organization?: string;
33
+ status?: string;
34
+ sort?: string;
35
+ order?: string;
36
+ } = {}) {
37
+ const { currentUser } = useLocalAuth();
38
+
39
+ const orgId = organization || currentUser.value?.defaultOrg;
40
+
41
+ try {
42
+ const response = await useNuxtApp().$api<TCustomerPaginatedResponse>(
43
+ `/api/customers/organization/${orgId}/status/${status}`,
44
+ {
45
+ method: "GET",
46
+ query: { page, search, limit, sort, order },
47
+ }
48
+ );
49
+
50
+ customers.value = response.items;
51
+ pages.value = response.pages;
52
+ pageRange.value = response.pageRange;
53
+ } catch (err) {
54
+ console.error("Error fetching customers:", err);
55
+ }
56
+ }
57
+
58
+ function createCustomer(payload: TCustomerCreate) {
59
+ return useNuxtApp().$api<Record<string, any>>(`/api/customers`, {
60
+ method: "POST",
61
+ body: payload,
62
+ });
63
+ }
64
+
65
+ function deleteCustomer(id: string) {
66
+ return useNuxtApp().$api<Record<string, any>>(`/api/customers/${id}`, {
67
+ method: "DELETE",
68
+ });
69
+ }
70
+
71
+ function getCustomerById(id: string) {
72
+ return useNuxtApp().$api<TCustomer>(`/api/customers/${id}`, {
73
+ method: "GET",
74
+ });
75
+ }
76
+
77
+ async function getAll({
78
+ page = 1,
79
+ search = "",
80
+ limit = 10,
81
+ org = "",
82
+ status = "active",
83
+ sort = "",
84
+ order = "asc",
85
+ }: {
86
+ page?: number;
87
+ search?: string;
88
+ limit?: number;
89
+ org?: string;
90
+ status?: string;
91
+ sort?: string;
92
+ order?: string;
93
+ } = {}) {
94
+ return useNuxtApp().$api<Record<string, any>>("/api/customers", {
95
+ method: "GET",
96
+ query: { page, search, limit, sort, order, status, org },
97
+ });
98
+ }
99
+
100
+ return {
101
+ customers,
102
+ customer,
103
+ page,
104
+ pages,
105
+ pageRange,
106
+ search,
107
+ getCustomers,
108
+ deleteCustomer,
109
+ createCustomer,
110
+ getCustomerById,
111
+ getAll,
112
+ };
113
+ }
@@ -0,0 +1,56 @@
1
+ export default function useCustomerSite() {
2
+ function add(payload: TCustomerSite) {
3
+ return useNuxtApp().$api<Record<string, any>>("/api/customer-sites", {
4
+ method: "POST",
5
+ body: payload,
6
+ });
7
+ }
8
+
9
+ function addViaInvite(invite: string) {
10
+ return useNuxtApp().$api<Record<string, any>>(
11
+ `/api/customer-sites/invite/${invite}`,
12
+ {
13
+ method: "POST",
14
+ }
15
+ );
16
+ }
17
+
18
+ async function getAll({
19
+ page = 1,
20
+ search = "",
21
+ limit = 10,
22
+ org = "",
23
+ status = "active",
24
+ sort = "",
25
+ order = "asc",
26
+ }: {
27
+ page?: number;
28
+ search?: string;
29
+ limit?: number;
30
+ org?: string;
31
+ status?: string;
32
+ sort?: string;
33
+ order?: string;
34
+ } = {}) {
35
+ return useNuxtApp().$api<Record<string, any>>("/api/customer-sites", {
36
+ method: "GET",
37
+ query: { page, search, limit, sort, order, status, org },
38
+ });
39
+ }
40
+
41
+ function getBySiteAsServiceProvider(site: string) {
42
+ return useNuxtApp().$api<Record<string, any>>(
43
+ `/api/customer-sites/service-provider/${site}`,
44
+ {
45
+ method: "GET",
46
+ }
47
+ );
48
+ }
49
+
50
+ return {
51
+ add,
52
+ getAll,
53
+ addViaInvite,
54
+ getBySiteAsServiceProvider,
55
+ };
56
+ }
@@ -0,0 +1,31 @@
1
+ export default function(){
2
+
3
+
4
+ type TGetAllParams = {
5
+ site?: string;
6
+ }
7
+
8
+
9
+
10
+ async function getDashboardData({
11
+ site
12
+ } : TGetAllParams) {
13
+ return await useNuxtApp().$api<Record<string, any>>(
14
+ "/api/dashboard",
15
+ {
16
+ method: "GET",
17
+ query: {
18
+
19
+ },
20
+ }
21
+ );
22
+ }
23
+
24
+
25
+
26
+
27
+ return {
28
+ getDashboardData,
29
+
30
+ }
31
+ }
@@ -0,0 +1,425 @@
1
+ export interface DashboardCard {
2
+ title: string;
3
+ value: number;
4
+ percentage: number;
5
+ isPositive: boolean;
6
+ icon: string;
7
+ color: string;
8
+ }
9
+
10
+ export interface ModuleData {
11
+ name: string;
12
+ cards: DashboardCard[];
13
+ modules: string[];
14
+ }
15
+
16
+ export interface FeedbackData {
17
+ _id: string;
18
+ name: string;
19
+ }
20
+
21
+ export interface FeedbackChartData {
22
+ "This Week": any[];
23
+ "This Month": any[];
24
+ "This Year": any[];
25
+ }
26
+
27
+ export interface PeriodMultiplier {
28
+ "This Week": number;
29
+ "This Month": number;
30
+ "This Year": number;
31
+ }
32
+
33
+ const dashboardDataMap: Record<string, ModuleData> = {
34
+ security: {
35
+ name: 'Security',
36
+ cards: [
37
+ {
38
+ title: 'Feedback',
39
+ value: 45,
40
+ percentage: 12.5,
41
+ isPositive: true,
42
+ icon: 'mdi-comment-multiple',
43
+ color: '#1E88E5',
44
+ },
45
+ {
46
+ title: 'Work Orders',
47
+ value: 28,
48
+ percentage: 8.3,
49
+ isPositive: true,
50
+ icon: 'mdi-clipboard-list',
51
+ color: '#D32F2F',
52
+ },
53
+ {
54
+ title: 'Vehicle Management',
55
+ value: 12,
56
+ percentage: 5.2,
57
+ isPositive: true,
58
+ icon: 'mdi-truck',
59
+ color: '#FFA726',
60
+ },
61
+ {
62
+ title: 'Building Management',
63
+ value: 35,
64
+ percentage: 15.4,
65
+ isPositive: true,
66
+ icon: 'mdi-building',
67
+ color: '#43A047',
68
+ },
69
+ {
70
+ title: 'Visitor Management',
71
+ value: 22,
72
+ percentage: 6.8,
73
+ isPositive: true,
74
+ icon: 'mdi-account-multiple',
75
+ color: '#7E57C2',
76
+ },
77
+ {
78
+ title: 'Incident Reports',
79
+ value: 9,
80
+ percentage: -3.5,
81
+ isPositive: false,
82
+ icon: 'mdi-alert-circle',
83
+ color: '#EF5350',
84
+ },
85
+ {
86
+ title: 'Guest Management',
87
+ value: 18,
88
+ percentage: 4.2,
89
+ isPositive: true,
90
+ icon: 'mdi-account-badge',
91
+ color: '#AB47BC',
92
+ },
93
+ ],
94
+ modules: [
95
+ 'Feedback',
96
+ 'Work Orders',
97
+ 'Vehicle Management',
98
+ 'Building Management',
99
+ 'Visitor Management',
100
+ 'Incident Reports',
101
+ 'Guest Management',
102
+ ],
103
+ },
104
+ hygiene: {
105
+ name: 'Hygiene',
106
+ cards: [
107
+ {
108
+ title: 'Feedback',
109
+ value: 52,
110
+ percentage: 14.2,
111
+ isPositive: true,
112
+ icon: 'mdi-comment-multiple',
113
+ color: '#1E88E5',
114
+ },
115
+ {
116
+ title: 'Work Orders',
117
+ value: 38,
118
+ percentage: 11.3,
119
+ isPositive: true,
120
+ icon: 'mdi-clipboard-list',
121
+ color: '#D32F2F',
122
+ },
123
+ {
124
+ title: 'Schedule Task Ticket',
125
+ value: 25,
126
+ percentage: 7.8,
127
+ isPositive: true,
128
+ icon: 'mdi-calendar-check',
129
+ color: '#FFA726',
130
+ },
131
+ {
132
+ title: 'Attendance',
133
+ value: 64,
134
+ percentage: 18.9,
135
+ isPositive: true,
136
+ icon: 'mdi-clock-check',
137
+ color: '#43A047',
138
+ },
139
+ {
140
+ title: 'Supply Management',
141
+ value: 42,
142
+ percentage: 12.5,
143
+ isPositive: true,
144
+ icon: 'mdi-warehouse',
145
+ color: '#7E57C2',
146
+ },
147
+ {
148
+ title: 'Request Items',
149
+ value: 19,
150
+ percentage: 5.1,
151
+ isPositive: true,
152
+ icon: 'mdi-cart-plus',
153
+ color: '#29B6F6',
154
+ },
155
+ {
156
+ title: 'Cleaning Schedule',
157
+ value: 31,
158
+ percentage: 9.4,
159
+ isPositive: true,
160
+ icon: 'mdi-broom',
161
+ color: '#66BB6A',
162
+ },
163
+ ],
164
+ modules: [
165
+ 'Feedback',
166
+ 'Work Orders',
167
+ 'Schedule Task Ticket',
168
+ 'Attendance',
169
+ 'Supply Management',
170
+ 'Request Items',
171
+ 'Cleaning Schedule - Checklist, Area, Unit',
172
+ ],
173
+ },
174
+ landscaping: {
175
+ name: 'Landscaping',
176
+ cards: [
177
+ {
178
+ title: 'Feedback',
179
+ value: 33,
180
+ percentage: 10.5,
181
+ isPositive: true,
182
+ icon: 'mdi-comment-multiple',
183
+ color: '#1E88E5',
184
+ },
185
+ {
186
+ title: 'Work Orders',
187
+ value: 47,
188
+ percentage: 13.2,
189
+ isPositive: true,
190
+ icon: 'mdi-clipboard-list',
191
+ color: '#D32F2F',
192
+ },
193
+ ],
194
+ modules: [
195
+ 'Feedback',
196
+ 'Work Orders',
197
+ ],
198
+ },
199
+ mechanical_electrical: {
200
+ name: 'Mechanical & Electrical',
201
+ cards: [
202
+ {
203
+ title: 'Feedback',
204
+ value: 38,
205
+ percentage: 11.8,
206
+ isPositive: true,
207
+ icon: 'mdi-comment-multiple',
208
+ color: '#1E88E5',
209
+ },
210
+ {
211
+ title: 'Work Orders',
212
+ value: 52,
213
+ percentage: 15.7,
214
+ isPositive: true,
215
+ icon: 'mdi-clipboard-list',
216
+ color: '#D32F2F',
217
+ },
218
+ ],
219
+ modules: [
220
+ 'Feedback',
221
+ 'Work Orders',
222
+ ],
223
+ },
224
+ pool: {
225
+ name: 'Pool',
226
+ cards: [
227
+ {
228
+ title: 'Feedback',
229
+ value: 29,
230
+ percentage: 9.3,
231
+ isPositive: true,
232
+ icon: 'mdi-comment-multiple',
233
+ color: '#1E88E5',
234
+ },
235
+ {
236
+ title: 'Work Orders',
237
+ value: 41,
238
+ percentage: 12.1,
239
+ isPositive: true,
240
+ icon: 'mdi-clipboard-list',
241
+ color: '#D32F2F',
242
+ },
243
+ ],
244
+ modules: [
245
+ 'Feedback',
246
+ 'Work Orders',
247
+ ],
248
+ },
249
+ pest: {
250
+ name: 'Pest',
251
+ cards: [
252
+ {
253
+ title: 'Feedback',
254
+ value: 26,
255
+ percentage: 8.6,
256
+ isPositive: true,
257
+ icon: 'mdi-comment-multiple',
258
+ color: '#1E88E5',
259
+ },
260
+ {
261
+ title: 'Work Orders',
262
+ value: 35,
263
+ percentage: 10.2,
264
+ isPositive: true,
265
+ icon: 'mdi-clipboard-list',
266
+ color: '#D32F2F',
267
+ },
268
+ ],
269
+ modules: [
270
+ 'Feedback',
271
+ 'Work Orders',
272
+ ],
273
+ },
274
+ };
275
+
276
+ // Feedback items data for dropdowns
277
+ const feedbackItemsMap: Record<string, FeedbackData[]> = {
278
+ security: [
279
+ { _id: "sec-1", name: "Perimeter Security" },
280
+ { _id: "sec-2", name: "Access Control" },
281
+ { _id: "sec-3", name: "CCTV Monitoring" },
282
+ { _id: "sec-4", name: "Guard Services" },
283
+ ],
284
+ hygiene: [
285
+ { _id: "hyg-1", name: "Cleaning Services" },
286
+ { _id: "hyg-2", name: "Disinfection" },
287
+ { _id: "hyg-3", name: "Waste Management" },
288
+ { _id: "hyg-4", name: "Sanitation" },
289
+ ],
290
+ landscaping: [
291
+ { _id: "land-1", name: "Lawn Care" },
292
+ { _id: "land-2", name: "Garden Maintenance" },
293
+ { _id: "land-3", name: "Landscaping Design" },
294
+ { _id: "land-4", name: "Tree Service" },
295
+ ],
296
+ mechanical_electrical: [
297
+ { _id: "me-1", name: "Electrical Services" },
298
+ { _id: "me-2", name: "HVAC Maintenance" },
299
+ { _id: "me-3", name: "Equipment Repair" },
300
+ { _id: "me-4", name: "System Inspection" },
301
+ ],
302
+ pool: [
303
+ { _id: "pool-1", name: "Water Treatment" },
304
+ { _id: "pool-2", name: "Equipment Maintenance" },
305
+ { _id: "pool-3", name: "Cleaning Services" },
306
+ { _id: "pool-4", name: "Safety Inspection" },
307
+ ],
308
+ pest: [
309
+ { _id: "pest-1", name: "Pest Control" },
310
+ { _id: "pest-2", name: "Fumigation" },
311
+ { _id: "pest-3", name: "Prevention Services" },
312
+ { _id: "pest-4", name: "Inspection" },
313
+ ],
314
+ };
315
+
316
+ // Feedback chart data based on selected service
317
+ const feedbackChartDataMap: Record<string, FeedbackChartData> = {
318
+ "sec-1": {
319
+ "This Week": [
320
+ { x: 100, y: 260, width: 60, height: 30, value: 5, label: "1", color: "#2196F3" },
321
+ { x: 200, y: 194, width: 60, height: 96, value: 16, label: "2", color: "#2196F3" },
322
+ { x: 300, y: 230, width: 60, height: 60, value: 10, label: "3", color: "#2196F3" },
323
+ { x: 400, y: 248, width: 60, height: 42, value: 7, label: "4", color: "#2196F3" },
324
+ { x: 500, y: 272, width: 60, height: 18, value: 3, label: "5", color: "#2196F3" },
325
+ { x: 600, y: 260, width: 60, height: 30, value: 5, label: "6", color: "#2196F3" },
326
+ { x: 700, y: 212, width: 60, height: 78, value: 13, label: "7", color: "#2196F3" },
327
+ { x: 800, y: 200, width: 60, height: 90, value: 15, label: "8", color: "#2196F3" },
328
+ { x: 900, y: 80, width: 60, height: 210, value: 70, label: "9", color: "#2196F3" },
329
+ ],
330
+ "This Month": [
331
+ { x: 100, y: 254, width: 60, height: 36, value: 6, label: "1", color: "#2196F3" },
332
+ { x: 200, y: 140, width: 60, height: 150, value: 25, label: "2", color: "#2196F3" },
333
+ { x: 300, y: 194, width: 60, height: 96, value: 16, label: "3", color: "#2196F3" },
334
+ { x: 400, y: 212, width: 60, height: 78, value: 13, label: "4", color: "#2196F3" },
335
+ { x: 500, y: 230, width: 60, height: 60, value: 10, label: "5", color: "#2196F3" },
336
+ { x: 600, y: 248, width: 60, height: 42, value: 7, label: "6", color: "#2196F3" },
337
+ { x: 700, y: 158, width: 60, height: 132, value: 22, label: "7", color: "#2196F3" },
338
+ { x: 800, y: 176, width: 60, height: 114, value: 19, label: "8", color: "#2196F3" },
339
+ { x: 900, y: 50, width: 60, height: 240, value: 80, label: "9", color: "#2196F3" },
340
+ ],
341
+ "This Year": [
342
+ { x: 100, y: 236, width: 60, height: 54, value: 9, label: "1", color: "#2196F3" },
343
+ { x: 200, y: 104, width: 60, height: 186, value: 31, label: "2", color: "#2196F3" },
344
+ { x: 300, y: 176, width: 60, height: 114, value: 19, label: "3", color: "#2196F3" },
345
+ { x: 400, y: 194, width: 60, height: 96, value: 16, label: "4", color: "#2196F3" },
346
+ { x: 500, y: 212, width: 60, height: 78, value: 13, label: "5", color: "#2196F3" },
347
+ { x: 600, y: 230, width: 60, height: 60, value: 10, label: "6", color: "#2196F3" },
348
+ { x: 700, y: 122, width: 60, height: 168, value: 28, label: "7", color: "#2196F3" },
349
+ { x: 800, y: 158, width: 60, height: 132, value: 22, label: "8", color: "#2196F3" },
350
+ { x: 900, y: 20, width: 60, height: 270, value: 90, label: "9", color: "#2196F3" },
351
+ ],
352
+ },
353
+ "sec-2": {
354
+ "This Week": [
355
+ { x: 100, y: 272, width: 60, height: 18, value: 3, label: "1", color: "#4CAF50" },
356
+ { x: 200, y: 176, width: 60, height: 114, value: 19, label: "2", color: "#4CAF50" },
357
+ { x: 300, y: 230, width: 60, height: 60, value: 10, label: "3", color: "#4CAF50" },
358
+ { x: 400, y: 248, width: 60, height: 42, value: 7, label: "4", color: "#4CAF50" },
359
+ { x: 500, y: 260, width: 60, height: 30, value: 5, label: "5", color: "#4CAF50" },
360
+ { x: 600, y: 272, width: 60, height: 18, value: 3, label: "6", color: "#4CAF50" },
361
+ { x: 700, y: 194, width: 60, height: 96, value: 16, label: "7", color: "#4CAF50" },
362
+ { x: 800, y: 188, width: 60, height: 102, value: 17, label: "8", color: "#4CAF50" },
363
+ { x: 900, y: 32, width: 60, height: 258, value: 86, label: "9", color: "#4CAF50" },
364
+ ],
365
+ "This Month": [
366
+ { x: 100, y: 254, width: 60, height: 36, value: 6, label: "1", color: "#4CAF50" },
367
+ { x: 200, y: 140, width: 60, height: 150, value: 25, label: "2", color: "#4CAF50" },
368
+ { x: 300, y: 194, width: 60, height: 96, value: 16, label: "3", color: "#4CAF50" },
369
+ { x: 400, y: 212, width: 60, height: 78, value: 13, label: "4", color: "#4CAF50" },
370
+ { x: 500, y: 230, width: 60, height: 60, value: 10, label: "5", color: "#4CAF50" },
371
+ { x: 600, y: 248, width: 60, height: 42, value: 7, label: "6", color: "#4CAF50" },
372
+ { x: 700, y: 158, width: 60, height: 132, value: 22, label: "7", color: "#4CAF50" },
373
+ { x: 800, y: 176, width: 60, height: 114, value: 19, label: "8", color: "#4CAF50" },
374
+ { x: 900, y: 50, width: 60, height: 240, value: 80, label: "9", color: "#4CAF50" },
375
+ ],
376
+ "This Year": [
377
+ { x: 100, y: 236, width: 60, height: 54, value: 9, label: "1", color: "#4CAF50" },
378
+ { x: 200, y: 104, width: 60, height: 186, value: 31, label: "2", color: "#4CAF50" },
379
+ { x: 300, y: 176, width: 60, height: 114, value: 19, label: "3", color: "#4CAF50" },
380
+ { x: 400, y: 194, width: 60, height: 96, value: 16, label: "4", color: "#4CAF50" },
381
+ { x: 500, y: 212, width: 60, height: 78, value: 13, label: "5", color: "#4CAF50" },
382
+ { x: 600, y: 230, width: 60, height: 60, value: 10, label: "6", color: "#4CAF50" },
383
+ { x: 700, y: 122, width: 60, height: 168, value: 28, label: "7", color: "#4CAF50" },
384
+ { x: 800, y: 158, width: 60, height: 132, value: 22, label: "8", color: "#4CAF50" },
385
+ { x: 900, y: 20, width: 60, height: 270, value: 90, label: "9", color: "#4CAF50" },
386
+ ],
387
+ },
388
+ };
389
+
390
+ // Period multipliers for card data
391
+ const periodMultipliers: PeriodMultiplier = {
392
+ "This Week": 1.0,
393
+ "This Month": 4.3, // approx. weeks in a month
394
+ "This Year": 52.0, // weeks in a year
395
+ };
396
+
397
+ export const useDashboardData = (appName: string) => {
398
+ const normalizedName = appName.toLowerCase();
399
+
400
+ // Try exact match first
401
+ let moduleKey = normalizedName;
402
+
403
+ // If exact match not found, try partial matching
404
+ if (!dashboardDataMap[moduleKey]) {
405
+ if (normalizedName.includes('landscaping')) moduleKey = 'landscaping';
406
+ else if (normalizedName.includes('mechanical') || normalizedName.includes('electrical')) moduleKey = 'mechanical_electrical';
407
+ else if (normalizedName.includes('pool')) moduleKey = 'pool';
408
+ else if (normalizedName.includes('pest')) moduleKey = 'pest';
409
+ else if (normalizedName.includes('hygiene')) moduleKey = 'hygiene';
410
+ else if (normalizedName.includes('security')) moduleKey = 'security';
411
+ else moduleKey = 'security'; // default fallback
412
+ }
413
+
414
+ const moduleData = dashboardDataMap[moduleKey] || dashboardDataMap.security;
415
+ const feedbackItems = feedbackItemsMap[moduleKey] || feedbackItemsMap.security;
416
+
417
+ return {
418
+ moduleData,
419
+ cards: moduleData.cards,
420
+ modules: moduleData.modules,
421
+ feedbackItems,
422
+ feedbackChartDataMap,
423
+ periodMultipliers,
424
+ };
425
+ };
@@ -0,0 +1,57 @@
1
+ export default function useDocument() {
2
+ function getAll({
3
+ page = 1,
4
+ search = "",
5
+ limit = 10,
6
+ status = "active",
7
+ site = "",
8
+ } = {}) {
9
+ return useNuxtApp().$api<Record<string, any>>(`/api/documents`, {
10
+ method: "GET",
11
+ query: {
12
+ page,
13
+ search,
14
+ limit,
15
+ status,
16
+ site,
17
+ },
18
+ });
19
+ }
20
+
21
+ function add(value: any) {
22
+ return useNuxtApp().$api<Record<string, any>>("/api/documents", {
23
+ method: "POST",
24
+ body: value,
25
+ });
26
+ }
27
+
28
+ function deleteById(id: string) {
29
+ return useNuxtApp().$api(`/api/documents/${id}`, {
30
+ method: "DELETE",
31
+ });
32
+ }
33
+
34
+ function updateById(id: string, value: any) {
35
+ return useNuxtApp().$api(`/api/documents/${id}`, {
36
+ method: "PUT",
37
+ body: value,
38
+ });
39
+ }
40
+
41
+ function getDocumentsBySiteId(siteId: string, type?: string) {
42
+ return useNuxtApp().$api<Record<string, any>>(
43
+ `/api/documents/site/${siteId}/type/${type}`,
44
+ {
45
+ method: "GET",
46
+ }
47
+ );
48
+ }
49
+
50
+ return {
51
+ getAll,
52
+ add,
53
+ deleteById,
54
+ updateById,
55
+ getDocumentsBySiteId,
56
+ };
57
+ }