@7365admin1/layer-common 1.11.45 → 1.11.46

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 1.11.46
4
+
5
+ ### Patch Changes
6
+
7
+ - 1e4f7b6: update latest version add prop for invitation form
8
+ - 2e14129: update latest layer common
9
+
3
10
  ## 1.11.45
4
11
 
5
12
  ### Patch Changes
@@ -20,7 +20,7 @@
20
20
  </div>
21
21
 
22
22
  <!-- Person Type Filter -->
23
- <div class="text-caption font-weight-bold mb-1 text-uppercase text-grey-darken-1">Person Type</div>
23
+ <!-- <div class="text-caption font-weight-bold mb-1 text-uppercase text-grey-darken-1">Person Type</div>
24
24
  <v-btn-toggle
25
25
  v-model="assignPersonType"
26
26
  color="primary"
@@ -33,7 +33,7 @@
33
33
  <v-btn value="owner" size="small" class="text-none px-3">Unit Owner</v-btn>
34
34
  <v-btn value="resident" size="small" class="text-none px-3">Resident</v-btn>
35
35
  <v-btn value="tenant" size="small" class="text-none px-3">Tenant</v-btn>
36
- </v-btn-toggle>
36
+ </v-btn-toggle> -->
37
37
 
38
38
  <!-- Person Selector -->
39
39
  <div class="text-caption font-weight-bold mb-1 text-uppercase text-grey-darken-1">
@@ -384,6 +384,10 @@ const props = defineProps({
384
384
  type: String,
385
385
  default: "",
386
386
  },
387
+ orgId: {
388
+ type: String,
389
+ default: "",
390
+ },
387
391
  });
388
392
 
389
393
  const emit = defineEmits<{
@@ -394,7 +398,7 @@ const emit = defineEmits<{
394
398
  "assign-to-person": [{ card: Record<string, any> | null; person: Record<string, any> | null }];
395
399
  }>();
396
400
 
397
- const { getPeopleByUnit: _getPeopleByUnit } = usePeople();
401
+ const { getResidents } = useAccessManagement();
398
402
 
399
403
  const historyDialog = ref(false);
400
404
  const showAssignForm = ref(false);
@@ -442,10 +446,10 @@ async function openAssignForm() {
442
446
  assignPersonType.value = "";
443
447
  peopleItems.value = [];
444
448
 
445
- if (!props.unit?._id) return;
449
+ if (!props.unit?._id || !props.orgId || !props.siteId) return;
446
450
  peopleLoading.value = true;
447
451
  try {
448
- const res = await _getPeopleByUnit(props.unit._id);
452
+ const res = await getResidents({ orgId: props.orgId, siteId: props.siteId, unitId: props.unit._id });
449
453
  peopleItems.value = res?.data ?? [];
450
454
  } catch {
451
455
  peopleItems.value = [];
@@ -113,6 +113,7 @@
113
113
  :is-selected-card-assigned-physical="isSelectedCardAssignedPhysical"
114
114
  :is-selected-card-physical="isSelectedCardPhysical"
115
115
  :site-id="siteId"
116
+ :org-id="orgId"
116
117
  @replace="openReplaceDialog()"
117
118
  @delete="openDeleteDialog()"
118
119
  />
@@ -74,7 +74,7 @@
74
74
  </v-row>
75
75
  </v-col>
76
76
 
77
- <v-col cols="12" class="mt-2">
77
+ <v-col v-if="!props.hideCreateMore" cols="12" class="mt-2">
78
78
  <v-checkbox v-model="createMore" density="comfortable" hide-details>
79
79
  <template #label>
80
80
  <span class="text-subtitle-2 font-weight-bold">
@@ -194,7 +194,11 @@ const props = defineProps({
194
194
  inviteMember: {
195
195
  type: Boolean,
196
196
  default: false
197
- }
197
+ },
198
+ hideCreateMore: {
199
+ type: Boolean,
200
+ default: false
201
+ }
198
202
  });
199
203
 
200
204
  const emit = defineEmits(["cancel", "success", "success:create-more"]);
@@ -299,7 +299,15 @@ export default function useAccessManagement() {
299
299
  );
300
300
  }
301
301
 
302
+ function getResidents(params: { orgId: string; siteId: string; unitId: string }) {
303
+ return useNuxtApp().$api<{ data: Record<string, any>[] }>(
304
+ `/api/access-management/residents`,
305
+ { method: "GET", query: params }
306
+ );
307
+ }
308
+
302
309
  return {
310
+ getResidents,
303
311
  getDoorAccessLevels,
304
312
  getLiftAccessLevels,
305
313
  getAccessGroups,
@@ -14,7 +14,18 @@ export default function () {
14
14
  } = {}) {
15
15
  return await useNuxtApp().$api<Record<string, any>>("/api/people", {
16
16
  method: "GET",
17
- query: { page, limit, sort, search, org, site, dateTo, dateFrom, type, status },
17
+ query: {
18
+ page,
19
+ limit,
20
+ sort,
21
+ search,
22
+ org,
23
+ site,
24
+ dateTo,
25
+ dateFrom,
26
+ type,
27
+ status,
28
+ },
18
29
  });
19
30
  }
20
31
 
@@ -26,12 +37,10 @@ export default function () {
26
37
  });
27
38
  }
28
39
 
29
- async function findPersonByNRICMultipleResult(
30
- nric: string, site: string
31
- ){
40
+ async function findPersonByNRICMultipleResult(nric: string, site: string) {
32
41
  return await $fetch<Record<any, any>>(`/api/people/all-nric`, {
33
42
  method: "GET",
34
- query: { nric, site }
43
+ query: { nric, site },
35
44
  });
36
45
  }
37
46
 
@@ -98,6 +107,15 @@ export default function () {
98
107
  }
99
108
  );
100
109
  }
110
+ async function reviewResidentPerson(
111
+ _id: string,
112
+ payload: Partial<TPeoplePayload>
113
+ ) {
114
+ return await useNuxtApp().$api<Record<string, any>>(`/api/people/${_id}`, {
115
+ method: "PATCH",
116
+ body: payload,
117
+ });
118
+ }
101
119
 
102
120
  return {
103
121
  create,
@@ -110,5 +128,6 @@ export default function () {
110
128
  getPeopleByUnit,
111
129
  searchCompanyList,
112
130
  findUsersByPlateNumber,
131
+ reviewResidentPerson,
113
132
  };
114
133
  }
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.45",
5
+ "version": "1.11.46",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {
package/types/people.d.ts CHANGED
@@ -25,6 +25,6 @@ declare type TPeople = {
25
25
  declare type TPlateNumber = { plateNumber: string, recNo: string, _id?: string, status: "active" | "deleted" | "pending", type: TVehicleType };
26
26
 
27
27
 
28
- declare type TPeoplePayload = Pick<TGuest, "name" | "block" | "level" | "unit" | "unitName" | "contact" | "plateNumber" | "nric" | "contact" | "remarks" | "org" | "site" | "start" | "end" | "type" | "isOwner">
28
+ declare type TPeoplePayload = Pick<TGuest, "name" | "block" | "level" | "unit" | "unitName" | "contact" | "plateNumber" | "nric" | "contact" | "remarks" | "org" | "site" | "start" | "end" | "type" | "isOwner"> & { status?: string }
29
29
 
30
30
  declare type TPeopleType = "guest" | "resident" | "tenant"