@7365admin1/layer-common 1.11.46 → 1.11.48

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.
@@ -17,13 +17,9 @@
17
17
  <template #item.block="{ value }">
18
18
  {{ value ? `Blk ${value}` : "" }}
19
19
  </template>
20
- <!-- <template #item.status="{ value }">
21
- <v-chip :color="formatVehicleStatus(value).color" size="x-small" dark>
22
- {{ formatVehicleStatus(value).label }}
23
- </v-chip>
24
-
25
-
26
- </template> -->
20
+ <template #item.nric="{ value }">
21
+ {{ maskNRIC(value) }}
22
+ </template>
27
23
 
28
24
  <template #item.plates="{ value, item }">
29
25
  <PlateNumberDisplay :plate-numbers="value" :default-value="item.plateNumber" />
@@ -61,7 +57,12 @@
61
57
  <v-row no-gutters class="ga-1 mb-5">
62
58
 
63
59
  <template v-for="(label, key) in formattedFields" :key="key">
64
- <v-col v-if="key === 'plates'" class="d-flex flex-column ga-2">
60
+
61
+ <v-col v-if="key === 'nric' && selectedVehicleObject['nric']" cols="12">
62
+ <span class="d-flex ga-3 align-center"><strong>{{ label }}:</strong> {{ maskNRIC(selectedVehicleObject[key]) }}</span>
63
+ </v-col>
64
+
65
+ <v-col v-else-if="key === 'plates'" class="d-flex flex-column ga-2">
65
66
  <span class="d-flex ga-3 align-center"><strong>{{ label }}:</strong></span>
66
67
  <!-- <PlateNumberDisplay :plate-numbers="selectedVehicleObject[key]" show-all :default-value="selectedVehicleObject.plateNumber" /> -->
67
68
  <v-col cols="12">
@@ -186,7 +187,7 @@ const plateHeaders = [
186
187
 
187
188
 
188
189
 
189
- const { formatCamelCaseToWords, formatDate, debounce } = useUtils();
190
+ const { formatCamelCaseToWords, formatDate, debounce, maskNRIC } = useUtils();
190
191
  const { getVehicles, deleteVehicle, formatVehicleStatus, approveVehicle, updateVehicle, getSpecificVehicleById } = useVehicle();
191
192
 
192
193
  const items = ref<Array<Record<string, any>>>([]);
@@ -340,6 +340,11 @@
340
340
  :disabled="loading.checkingOut" @click="handleCheckout(selectedVisitorId as string)" />
341
341
  </span>
342
342
 
343
+ <span v-else-if="
344
+ key === 'nric' && selectedVisitorObject['nric']" class="d-flex align-center">
345
+ <strong>{{ label }}:</strong>
346
+ <span class="ml-2">{{ maskNRIC(selectedVisitorObject[key]) }}</span>
347
+ </span>
343
348
  <span v-else-if="key === 'attachments' && selectedVisitorObject?.[key]?.length > 0"
344
349
  class="d-flex flex-column">
345
350
  <strong class="w-full">{{ label }}:</strong>
@@ -349,7 +354,7 @@
349
354
  </div>
350
355
  </span>
351
356
 
352
- <span v-else-if="selectedVisitorObject[key]" class="d-flex ga-3 align-center"><strong>{{ label
357
+ <span v-else-if="selectedVisitorObject[key]" class="d-flex ga-3 align-start"><strong>{{ label
353
358
  }}:</strong>
354
359
  {{ formatValues(key, selectedVisitorObject[key]) }}
355
360
  <TooltipInfo v-if="key === 'checkOut'" text="Manual Checkout" density="compact" size="x-small" />
@@ -602,6 +607,7 @@ const {
602
607
  formatDate,
603
608
  UTCToLocalTIme,
604
609
  standardFormatDate,
610
+ maskNRIC,
605
611
  } = useUtils();
606
612
  const { formatLocation } = useSecurityUtils();
607
613
  const { getFileUrlAnpr } = useFile();
@@ -0,0 +1,27 @@
1
+ export default function () {
2
+ async function getANPRSettingBySite(data: any) {
3
+ return await useNuxtApp().$api<Record<string, any>>(
4
+ `/api/anpr-settings/get/v1`,
5
+ {
6
+ method: "POST",
7
+ body: data,
8
+ }
9
+ );
10
+ }
11
+ async function createUpdateANPRSettings(
12
+ data: any
13
+ ) {
14
+ return await useNuxtApp().$api<Record<string, any>>(
15
+ `/api/anpr-settings/v1`,
16
+ {
17
+ method: "POST",
18
+ body: data,
19
+ }
20
+ );
21
+ }
22
+
23
+ return {
24
+ getANPRSettingBySite,
25
+ createUpdateANPRSettings,
26
+ };
27
+ }
@@ -306,8 +306,16 @@ export default function useAccessManagement() {
306
306
  );
307
307
  }
308
308
 
309
+ function assignUser(payload: { assignees: string[]; unit: string; type: string; acm_url: string }) {
310
+ return useNuxtApp().$api<Record<string, any>>(
311
+ `/api/access-management/assign-user`,
312
+ { method: "POST", body: payload }
313
+ );
314
+ }
315
+
309
316
  return {
310
317
  getResidents,
318
+ assignUser,
311
319
  getDoorAccessLevels,
312
320
  getLiftAccessLevels,
313
321
  getAccessGroups,
@@ -3,18 +3,28 @@ export default function useDocument() {
3
3
  page = 1,
4
4
  search = "",
5
5
  limit = 10,
6
- status = "active",
6
+ type = "all",
7
7
  site = "",
8
+ parentId = "",
9
+ }: {
10
+ page?: number;
11
+ search?: string;
12
+ limit?: number;
13
+ type?: string;
14
+ site?: string;
15
+ parentId?: string;
8
16
  } = {}) {
17
+ const query: Record<string, any> = {
18
+ page,
19
+ search,
20
+ limit,
21
+ site,
22
+ parentId,
23
+ };
24
+
9
25
  return useNuxtApp().$api<Record<string, any>>(`/api/documents`, {
10
26
  method: "GET",
11
- query: {
12
- page,
13
- search,
14
- limit,
15
- status,
16
- site,
17
- },
27
+ query,
18
28
  });
19
29
  }
20
30
 
@@ -26,10 +36,13 @@ export default function useDocument() {
26
36
  }
27
37
 
28
38
  function deleteById(id: string) {
29
- return useNuxtApp().$api<Record<string, any>>(`/api/documents/deleted/document`, {
30
- method: "PUT",
31
- query: { id },
32
- });
39
+ return useNuxtApp().$api<Record<string, any>>(
40
+ `/api/documents/deleted/document`,
41
+ {
42
+ method: "PUT",
43
+ query: { id },
44
+ }
45
+ );
33
46
  }
34
47
 
35
48
  function updateById(id: string, value: any) {
@@ -39,6 +52,12 @@ export default function useDocument() {
39
52
  });
40
53
  }
41
54
 
55
+ function getById(id: string) {
56
+ return useNuxtApp().$api<Record<string, any>>(`/api/documents/${id}`, {
57
+ method: "GET",
58
+ });
59
+ }
60
+
42
61
  function getDocumentsBySiteId(siteId: string, type?: string) {
43
62
  return useNuxtApp().$api<Record<string, any>>(
44
63
  `/api/documents/site/${siteId}/type/${type}`,
@@ -48,11 +67,22 @@ export default function useDocument() {
48
67
  );
49
68
  }
50
69
 
70
+ function create(value: any) {
71
+ return add(value);
72
+ }
73
+
74
+ function createFolder(value: any) {
75
+ return add({ ...value, type: "folder" });
76
+ }
77
+
51
78
  return {
52
79
  getAll,
80
+ getById,
53
81
  add,
54
82
  deleteById,
55
83
  updateById,
56
84
  getDocumentsBySiteId,
85
+ create,
86
+ createFolder,
57
87
  };
58
88
  }
@@ -50,6 +50,23 @@ export default function useLocal() {
50
50
  { title: "Pool Maintenance Services", value: "pool_maintenance_services" },
51
51
  ];
52
52
 
53
+ const natureOfBusinessV2 = [
54
+ {
55
+ title: "Property Management Services",
56
+ value: "property_management_agency",
57
+ },
58
+ { title: "Security Agency", value: "security_agency" },
59
+ { title: "Cleaning Services", value: "cleaning_services" },
60
+ {
61
+ title: "M&E Services",
62
+ value: "mechanical_electrical_services",
63
+ },
64
+ { title: "Landscaping Services", value: "landscaping_services" },
65
+ { title: "Pest Control Services", value: "pest_control_services" },
66
+ { title: "Pool Maintenance Services", value: "pool_maintenance_services" },
67
+ ];
68
+
69
+
53
70
  const landingPage = useCookie("landing-page", cookieConfig);
54
71
 
55
72
  const subjects = [
@@ -125,6 +142,7 @@ export default function useLocal() {
125
142
  apps,
126
143
  headerSearch,
127
144
  natureOfBusiness,
145
+ natureOfBusinessV2,
128
146
  landingPage,
129
147
  subjects,
130
148
  };
@@ -107,31 +107,6 @@ export default function useOrg() {
107
107
  });
108
108
  }
109
109
 
110
- /** Super Admin client list, etc.: filter by `organizations.status` (v1 API ignores status). */
111
- function getAllV2({
112
- page = 1,
113
- search = "",
114
- limit = 20,
115
- nature = "",
116
- status = "active",
117
- }: {
118
- page?: number;
119
- search?: string;
120
- limit?: number;
121
- nature?: string;
122
- status?: "active" | "suspended" | "deleted";
123
- } = {}) {
124
- return useNuxtApp().$api<Record<string, any>>("/api/organizations/v2", {
125
- method: "GET",
126
- query: {
127
- page,
128
- search,
129
- limit,
130
- nature,
131
- status,
132
- },
133
- });
134
- }
135
110
 
136
111
  function add(
137
112
  value: Partial<Pick<TOrg, "name" | "email" | "nature" | "contact">>
@@ -179,6 +154,64 @@ export default function useOrg() {
179
154
  }
180
155
  );
181
156
  }
157
+ function getAllV2({
158
+ page = 1,
159
+ search = "",
160
+ limit = 20,
161
+ nature = "",
162
+ status = "active",
163
+
164
+ }: {
165
+ page?: number;
166
+ search?: string;
167
+ limit?: number;
168
+ nature?: string;
169
+ status?: "active" | "suspended" | "deleted";
170
+ } = {}) {
171
+ return useNuxtApp().$api<Record<string, any>>("/api/organizations/v2", {
172
+ method: "GET",
173
+ query: {
174
+ page,
175
+ search,
176
+ limit,
177
+ nature,
178
+ status,
179
+ },
180
+ });
181
+ }
182
+
183
+ function getOrganizationsWithSubscription({
184
+ page = 1,
185
+ search = "",
186
+ limit = 20,
187
+ status = "active",
188
+ type = "",
189
+ billingCycle = "",
190
+ }: {
191
+ page?: number
192
+ search?: string
193
+ limit?: number
194
+ status?: "active" | "suspended" | "deleted"
195
+ type?: string
196
+ billingCycle?: string
197
+ } = {}) {
198
+ return useNuxtApp().$api<Record<string, any>>(
199
+ "/api/organizations/v2/orgs/subscriptions",
200
+ {
201
+ method: "GET",
202
+
203
+ query: {
204
+ page,
205
+ search,
206
+ limit,
207
+ status,
208
+ type,
209
+ billingCycle,
210
+ },
211
+ }
212
+ )
213
+ }
214
+
182
215
 
183
216
  return {
184
217
  org,
@@ -196,6 +229,7 @@ export default function useOrg() {
196
229
  add,
197
230
  addOnboardingOrg,
198
231
  updateOrg,
199
- getOrgsByEmail
232
+ getOrgsByEmail,
233
+ getOrganizationsWithSubscription
200
234
  };
201
235
  }
@@ -506,6 +506,19 @@ export default function useUtils() {
506
506
  return word[0].toUpperCase() + word.substring(1);
507
507
  }
508
508
 
509
+
510
+ function maskNRIC(value?: string) {
511
+ if(!value) return "";
512
+ if (value.length <= 4) {
513
+ return value;
514
+ }
515
+
516
+ const visiblePart = value.slice(-4);
517
+ const maskedPart = "*".repeat(value.length - 4);
518
+
519
+ return `${maskedPart}${visiblePart}`;
520
+ }
521
+
509
522
  return {
510
523
  requiredRule,
511
524
  emailRule,
@@ -552,5 +565,6 @@ export default function useUtils() {
552
565
  getImage,
553
566
  standardFormatDate,
554
567
  getCapitalized,
568
+ maskNRIC
555
569
  };
556
570
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.11.46",
5
+ "version": "1.11.48",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {
@@ -35,4 +35,10 @@ declare type TCustomerSite = {
35
35
  }
36
36
  };
37
37
 
38
- declare type TSiteCategory = "residential" | "commercial" | "industrial" | "institutional" | "mixed_development" | "infrastructure" | "hospitality"
38
+ type TSiteCategory =
39
+ | "residential"
40
+ | "commercial"
41
+ | "shopping_mall"
42
+ | "mix_development"
43
+ | "industrial"
44
+ | "co_working_co_living";