@7365admin1/layer-common 1.10.5 → 1.10.7

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 (44) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/components/AccessCardDetailsDialog.vue +144 -0
  3. package/components/AccessCardPreviewDialog.vue +7 -2
  4. package/components/AccessCardQrTagging.vue +314 -34
  5. package/components/AccessCardQrTaggingPrintQr.vue +75 -0
  6. package/components/AccessManagement.vue +5 -1
  7. package/components/AreaChecklistHistoryLogs.vue +9 -0
  8. package/components/BuildingForm.vue +36 -5
  9. package/components/BuildingManagement/buildings.vue +18 -9
  10. package/components/BuildingManagement/units.vue +12 -114
  11. package/components/BuildingUnitFormAdd.vue +39 -30
  12. package/components/BuildingUnitFormEdit.vue +265 -116
  13. package/components/CleaningScheduleMain.vue +60 -13
  14. package/components/Dialog/DeleteConfirmation.vue +2 -2
  15. package/components/Dialog/UpdateMoreAction.vue +2 -2
  16. package/components/EntryPassInformation.vue +215 -0
  17. package/components/Input/InputPhoneNumberV2.vue +11 -0
  18. package/components/ManageChecklistMain.vue +29 -3
  19. package/components/PlateNumberDisplay.vue +9 -1
  20. package/components/ScheduleAreaMain.vue +56 -0
  21. package/components/TableHygiene.vue +265 -113
  22. package/components/UnitPersonCard.vue +63 -0
  23. package/components/VehicleAddSelection.vue +2 -2
  24. package/components/VehicleForm.vue +169 -47
  25. package/components/VehicleManagement.vue +169 -43
  26. package/components/VisitorForm.vue +19 -0
  27. package/components/VisitorManagement.vue +1 -1
  28. package/components/WorkOrder/Main.vue +2 -1
  29. package/composables/useAccessManagement.ts +63 -0
  30. package/composables/useFeedback.ts +2 -2
  31. package/composables/usePeople.ts +14 -3
  32. package/composables/useVehicle.ts +15 -1
  33. package/composables/useWorkOrder.ts +2 -2
  34. package/package.json +3 -2
  35. package/types/cleaner-schedule.d.ts +1 -0
  36. package/types/html2pdf.d.ts +19 -0
  37. package/types/people.d.ts +4 -0
  38. package/types/site.d.ts +8 -0
  39. package/types/vehicle.d.ts +3 -4
  40. package/.playground/app.vue +0 -41
  41. package/.playground/eslint.config.mjs +0 -6
  42. package/.playground/nuxt.config.ts +0 -22
  43. package/.playground/pages/feedback.vue +0 -30
  44. package/components/AccessCardHistoryDialog.vue +0 -133
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <v-container ref="printContent" fluid style="overflow-y: auto">
3
+ <v-row no-gutters class="main-container">
4
+ <v-col v-for="(card, idx) in accessCards" :key="idx" cols="auto">
5
+ <div class="qr-box">
6
+ <p><strong>Access Level:</strong> {{ card.accessLevel }}</p>
7
+ <p><strong>HID NO:</strong> {{ card.cardNumber }}</p>
8
+ <img :src="card.qrDataImage" alt="QR Code" />
9
+ <p><strong>Card No.:</strong> C{{ card.qrTagCardNo }}</p>
10
+ </div>
11
+ </v-col>
12
+ </v-row>
13
+ </v-container>
14
+ </template>
15
+
16
+ <script setup lang="ts">
17
+ import type { ComponentPublicInstance } from "vue";
18
+
19
+ defineProps<{ accessCards?: any[] }>();
20
+ defineEmits(["close"]);
21
+
22
+ const printContent = ref<HTMLElement | null>(null);
23
+
24
+ async function downloadPDF() {
25
+ const html2pdf = (await import("html2pdf.js")).default;
26
+ const component = printContent.value as unknown as ComponentPublicInstance;
27
+ const el = component.$el ?? printContent.value;
28
+
29
+ if (!el || !(el instanceof HTMLElement)) return;
30
+
31
+ const opt = {
32
+ margin: 0.1,
33
+ filename: `Access-cards-qr.pdf`,
34
+ image: { type: "jpeg", quality: 0.98 },
35
+ html2canvas: { scale: 2, useCORS: true },
36
+ jsPDF: { unit: "in", format: "a4", orientation: "portrait" },
37
+ };
38
+
39
+ await html2pdf().set(opt).from(el).save();
40
+ }
41
+
42
+ defineExpose({ downloadPDF });
43
+ </script>
44
+
45
+ <style scoped>
46
+ .main-container {
47
+ background-color: #fff;
48
+ padding: 8px;
49
+ display: grid;
50
+ grid-template-columns: repeat(6, 1fr);
51
+ gap: 4px;
52
+ width: 100%;
53
+ }
54
+ .qr-box {
55
+ height: 3cm;
56
+ width: 2.7cm;
57
+ border: 1px solid #ccc;
58
+ padding: 8px;
59
+ text-align: center;
60
+ page-break-inside: avoid;
61
+ margin: 0 auto;
62
+ display: flex;
63
+ flex-direction: column;
64
+ align-items: center;
65
+ gap: 6px;
66
+ }
67
+ .qr-box p {
68
+ font-size: 8px;
69
+ line-height: 1.2;
70
+ }
71
+ img {
72
+ width: 1cm;
73
+ height: 1cm;
74
+ }
75
+ </style>
@@ -112,6 +112,7 @@
112
112
  :can-delete-access-card="canDeleteAccessCard"
113
113
  :is-selected-card-assigned-physical="isSelectedCardAssignedPhysical"
114
114
  :is-selected-card-physical="isSelectedCardPhysical"
115
+ :site-id="siteId"
115
116
  @replace="openReplaceDialog()"
116
117
  @delete="openDeleteDialog()"
117
118
  />
@@ -354,8 +355,11 @@ async function handleDeleteCard(remarks: string) {
354
355
  selectedCardId.value = null;
355
356
  confirmDialog.value = false;
356
357
  previewDialog.value = false;
358
+ showMessage("Access card deleted successfully!", "success");
357
359
  } catch (error: any) {
358
- deleteError.value = error?.response?._data?.message || "Failed to delete card";
360
+ const msg = error?.response?._data?.message || "Failed to delete card";
361
+ deleteError.value = msg;
362
+ showMessage(msg, "error");
359
363
  } finally {
360
364
  deleteLoading.value = false;
361
365
  }
@@ -119,6 +119,15 @@
119
119
  class="text-subtitle-2 font-weight-bold px-0"
120
120
  >
121
121
  Set {{ checklistSet.set }}
122
+ <v-chip
123
+ v-if="checklistSet.isScheduleTask"
124
+ size="x-small"
125
+ color="info"
126
+ variant="tonal"
127
+ class="text-none ml-2"
128
+ >
129
+ Schedule Task
130
+ </v-chip>
122
131
  </v-list-subheader>
123
132
 
124
133
  <v-list-item
@@ -3,7 +3,7 @@
3
3
  <v-toolbar>
4
4
  <v-row no-gutters class="fill-height px-6" align="center">
5
5
  <span class="font-weight-bold text-h5 text-capitalize">
6
- {{ prop.mode }} Building
6
+ {{ prop.mode }} Block
7
7
  </span>
8
8
  </v-row>
9
9
  </v-toolbar>
@@ -40,7 +40,10 @@
40
40
  <v-select
41
41
  v-model.number="building.block"
42
42
  :items="blocks"
43
+ item-title="label"
44
+ item-value="value"
43
45
  density="comfortable"
46
+ :disabled="prop.mode === 'edit'"
44
47
  :rules="[
45
48
  requiredRule,
46
49
  () =>
@@ -48,7 +51,12 @@
48
51
  'Block is required',
49
52
  ]"
50
53
  type="number"
51
- ></v-select>
54
+ >
55
+ <template v-slot:item="{ props: itemProps, item}">
56
+ <v-list-item v-bind="itemProps" :disabled="item?.raw?.disabled" ></v-list-item>
57
+ </template>
58
+
59
+ </v-select>
52
60
  </v-col>
53
61
  </v-row>
54
62
  </v-col>
@@ -114,10 +122,10 @@
114
122
  </v-row>
115
123
  </v-expand-transition>
116
124
 
117
- <v-col cols="12" class="px-6">
125
+ <!-- <v-col cols="12" class="px-6">
118
126
  <InputLabel class="text-capitalize" title="Building Floor plan" />
119
127
  <InputFileV2 v-model="building.buildingFloorPlan" :multiple="true" :max-length="10" title="Upload Images" />
120
- </v-col>
128
+ </v-col> -->
121
129
 
122
130
  <v-col cols="12" class="mt-2">
123
131
  <v-checkbox v-model="createMore" density="comfortable" hide-details>
@@ -199,6 +207,10 @@ const prop = defineProps({
199
207
  buildingFloorPlan: []
200
208
  }),
201
209
  },
210
+ blocks: {
211
+ type: Array as PropType<TBuilding[]>,
212
+ default: () => [],
213
+ },
202
214
  });
203
215
 
204
216
  const { getSiteById } = useSite();
@@ -218,7 +230,20 @@ watchEffect(() => {
218
230
 
219
231
  const blocks = computed(() => {
220
232
  if (!site.value) return [];
221
- return Array.from({ length: site.value?.metadata?.block || 0 }, (_, i) => i + 1);
233
+ // return
234
+ // return [ { label: "1", value: 1, disabled: true }, { label: "2", value: 2 }, { label: "3", value: 3 } ];
235
+ const array = Array.from({ length: site.value?.metadata?.block || 0 }, (_, i) => i + 1);
236
+
237
+ const formattedArray = array.map((num) => {
238
+ const isDisabled = prop.blocks.some((block) => block.block === num)
239
+ return {
240
+ label: num.toString(),
241
+ value: num,
242
+ disabled: isDisabled
243
+ };
244
+ });
245
+
246
+ return formattedArray;
222
247
  });
223
248
 
224
249
  const emit = defineEmits(["cancel", "success", "success:create-more"]);
@@ -295,6 +320,12 @@ async function submit() {
295
320
  }
296
321
  }
297
322
 
323
+ watch(buildingLevels, (newVal) => {
324
+ setTimeout(() => {
325
+ show.value = newVal > 0 && !!newVal;
326
+ }, 500);
327
+ });
328
+
298
329
  function cancel() {
299
330
  createMore.value = false;
300
331
  message.value = "";
@@ -4,7 +4,7 @@
4
4
  <v-row no-gutters>
5
5
  <v-btn class="text-none" rounded="pill" variant="tonal" @click="setBuilding()" size="large"
6
6
  v-if="canCreate && canCreateBuilding">
7
- Add Building
7
+ Add Block
8
8
  </v-btn>
9
9
  </v-row>
10
10
  </v-col>
@@ -33,19 +33,22 @@
33
33
  <template #item.createdAt="{ value }">
34
34
  {{ new Date(value).toLocaleDateString() }}
35
35
  </template>
36
+ <template #item.levels="{ item }">
37
+ {{ item.levels.length }}
38
+ </template>
36
39
  </v-data-table>
37
40
  </v-card>
38
41
  </v-col>
39
42
 
40
43
  <!-- Create Dialog -->
41
44
  <v-dialog v-model="createDialog" width="450" persistent>
42
- <BuildingForm :site="site" @cancel="createDialog = false" @success="successCreate()"
45
+ <BuildingForm :site="site" :blocks="items" @cancel="createDialog = false" @success="successCreate()"
43
46
  @success:create-more="getBuildings()" />
44
47
  </v-dialog>
45
48
 
46
49
  <!-- Edit Dialog -->
47
50
  <v-dialog v-model="editDialog" width="450" persistent>
48
- <BuildingForm :site="site" mode="edit" @cancel="editDialog = false" @success="successUpdate()"
51
+ <BuildingForm :site="site" :blocks="items" mode="edit" @cancel="editDialog = false" @success="successUpdate()"
49
52
  :building="selectedBuilding" />
50
53
  </v-dialog>
51
54
 
@@ -67,14 +70,14 @@
67
70
  <strong>Levels:</strong>
68
71
  {{ selectedBuilding?.levels.length ?? "N/A" }}
69
72
  </v-col>
70
- <template v-if="selectedBuilding?.buildingFloorPlan.length > 0">
73
+ <!-- <template v-if="selectedBuilding?.buildingFloorPlan.length > 0">
71
74
  <v-col cols="12">
72
75
  <strong>Building Floor Plan:</strong>
73
76
  </v-col>
74
77
  <v-col cols="12">
75
78
  <InputFileV2 :model-value="selectedBuilding?.buildingFloorPlan" view-mode />
76
79
  </v-col>
77
- </template>
80
+ </template> -->
78
81
  </v-row>
79
82
  </v-card-text>
80
83
 
@@ -171,10 +174,16 @@ const props = defineProps({
171
174
  title: "Name",
172
175
  value: "name",
173
176
  },
174
- // {
175
- // title: "Director",
176
- // value: "directorName",
177
- // },
177
+ {
178
+ title: "Block",
179
+ value: "block",
180
+ align: "center",
181
+ },
182
+ {
183
+ title: "Levels",
184
+ value: "levels",
185
+ align: "center",
186
+ },
178
187
  // { title: "Action", value: "action-table" },
179
188
  ],
180
189
  },
@@ -30,121 +30,22 @@
30
30
  <v-data-table :headers="props.headers" :items="items" item-value="_id" items-per-page="20" fixed-header
31
31
  hide-default-footer @click:row="tableRowClickHandler"
32
32
  style="max-height: calc(100vh - (200px))">
33
- <template #item.block="{ value }">
34
- {{ value ? `blk ${value}` : "" }}
33
+ <template #item.block="{ value, item }">
34
+ {{ value ? `Block ${value}` : "" }}
35
35
  </template>
36
36
  </v-data-table>
37
37
  </v-card>
38
38
  </v-col>
39
39
 
40
40
  <!-- Create Dialog -->
41
- <v-dialog v-model="createDialog" :width="smAndUp ? '70svw' : '100%'" persistent>
41
+ <v-dialog v-model="createDialog" :width="smAndUp ? '50svw' : '100%'" persistent>
42
42
  <BuildingUnitFormAdd :site="site" @cancel="createDialog = false" @success="successCreate()"
43
43
  @success:create-more="getBuildingUnit()" />
44
44
  </v-dialog>
45
-
46
- <!-- Edit Dialog -->
47
- <v-dialog v-model="dialogEdit" :width="smAndUp ? '70svw' : '100%'" persistent>
48
- <BuildingUnitFormEdit v-if="selectedBuildingUnit" @cancel="dialogEdit = false" @success="successUpdate()"
49
- :roomFacility="selectedBuildingUnit" />
50
- </v-dialog>
51
-
52
- <!-- Preview Dialog -->
53
-
54
45
 
55
- <v-dialog v-if="canViewUnitDetails" v-model="dialogPreview" width="450" persistent>
56
- <v-card width="100%">
57
- <v-card-text style="max-height: 100vh; overflow-y: auto" class="pb-0">
58
- <v-row no-gutters v-if="selectedBuildingUnit" class="mb-4">
59
- <v-col cols="12">
60
- <strong>Name:</strong> {{ selectedBuildingUnit.name }}
61
- </v-col>
62
-
63
- <v-col cols="12">
64
- <strong>Block:</strong>
65
- {{ selectedBuildingUnit.block }}
66
- </v-col>
67
-
68
- <v-col cols="12">
69
- <strong>Floors:</strong>
70
- {{ selectedBuildingUnit.level }}
71
- </v-col>
72
-
73
- <v-col cols="12">
74
- <strong>Category:</strong>
75
- {{ selectedBuildingUnit.category }}
76
- </v-col>
77
-
78
- <v-col cols="12">
79
- <strong>Company Name:</strong>
80
- {{ selectedBuildingUnit.companyName || "" }}
81
- </v-col>
82
-
83
- <v-col cols="12">
84
- <strong>Company Registration Number:</strong>
85
- {{ selectedBuildingUnit.companyRegistrationNumber || "" }}
86
- </v-col>
87
-
88
- <v-col cols="12">
89
- <strong>Lease Start:</strong>
90
- {{ formatDateDDMMYYYYLocal(selectedBuildingUnit.leaseStart) || "" }}
91
- </v-col>
92
- <v-col cols="12">
93
- <strong>Lease End:</strong>
94
- {{ formatDateDDMMYYYYLocal(selectedBuildingUnit.leaseEnd) || "" }}
95
- </v-col>
96
-
97
- <v-col cols="12">
98
- <strong>Owner Name:</strong>
99
- {{ selectedBuildingUnit.ownerName || "" }}
100
- </v-col>
101
-
102
- <template v-if="selectedBuildingUnit?.buildingUnitFiles.length > 0">
103
- <v-col cols="12">
104
- <strong>Uploaded Files:</strong>
105
- </v-col>
106
- <v-col cols="12">
107
- <InputFileV2 :model-value="selectedBuildingUnit?.buildingUnitFiles" view-mode />
108
- </v-col>
109
- </template>
110
- </v-row>
111
- </v-card-text>
112
-
113
- <v-toolbar class="pa-0" density="compact">
114
- <v-row no-gutters>
115
- <v-col cols="6" class="pa-0">
116
- <v-btn block variant="text" class="text-none" size="large" @click="dialogPreview = false" height="48">
117
- Close
118
- </v-btn>
119
- </v-col>
120
-
121
- <v-col cols="6" class="pa-0" v-if="canUpdate">
122
- <v-menu>
123
- <template #activator="{ props }">
124
- <v-btn block variant="flat" color="black" class="text-none" height="48" v-bind="props" tile
125
- :disabled="!canUpdateUnit && !canDeleteUnit">
126
- More actions
127
- </v-btn>
128
- </template>
129
-
130
- <v-list class="pa-0">
131
- <v-list-item v-if="canUpdateUnit" @click="openEditDialog()">
132
- <v-list-item-title class="text-subtitle-2">
133
- Edit Unit
134
- </v-list-item-title>
135
- </v-list-item>
136
-
137
- <v-list-item v-if="canDeleteUnit" @click="openDeleteDialog()" class="text-red">
138
- <v-list-item-title class="text-subtitle-2">
139
- Delete Unit
140
- </v-list-item-title>
141
- </v-list-item>
142
- </v-list>
143
- </v-menu>
144
- </v-col>
145
- </v-row>
146
- </v-toolbar>
147
- </v-card>
46
+ <v-dialog v-if="canViewUnitDetails" v-model="dialogPreview":width="smAndUp ? '70svw' : '100%'" persistent>
47
+ <BuildingUnitFormEdit v-if="selectedBuildingUnit" @cancel="dialogPreview = false" @success="successUpdate()" @delete-unit="openDeleteDialog()"
48
+ :roomFacility="selectedBuildingUnit" />
148
49
  </v-dialog>
149
50
 
150
51
  <v-dialog v-model="dialogDelete" :loading="deleteLoading" width="450" persistent>
@@ -200,22 +101,19 @@ const props = defineProps({
200
101
  title: "Name",
201
102
  value: "name",
202
103
  },
203
- {
204
- title: "Building",
205
- value: "buildingName",
104
+ {
105
+ title: "Floor",
106
+ value: "level",
206
107
  },
207
108
  {
208
109
  title: "Block",
209
110
  value: "block",
210
111
  },
211
112
  {
212
- title: "Floor",
213
- value: "level",
214
- },
215
- {
216
- title: "Category",
217
- value: "category",
113
+ title: "Block Name",
114
+ value: "buildingName",
218
115
  },
116
+
219
117
  // {
220
118
  // title: "Type",
221
119
  // value: "type",
@@ -25,11 +25,40 @@
25
25
  <v-row>
26
26
  <v-col cols="12" md="6" class="mt-2">
27
27
  <v-row no-gutters>
28
- <InputLabel class="text-capitalize" title="Building" required />
28
+ <InputLabel class="text-capitalize" title="Block" required />
29
29
  <v-col cols="12">
30
30
  <v-autocomplete v-model="buildingUnit.building" :items="buildings" item-title="name"
31
31
  item-value="_id" v-model:search="searchBuilding" :hide-no-data="false" density="comfortable"
32
- :rules="[requiredRule]" variant="outlined"></v-autocomplete>
32
+ :rules="[requiredRule]" variant="outlined">
33
+ <template v-slot:item="{ props: itemProps, item }">
34
+ <v-list-item v-bind="itemProps" :title="`Block ${item?.raw?.block} (${item?.raw?.name})`">
35
+
36
+ </v-list-item>
37
+ </template>
38
+ <template v-slot:selection="{ item }">
39
+ {{ buildingUnit.building && `Block ${item?.raw?.block} (${item?.raw?.name})` }}
40
+ </template>
41
+ </v-autocomplete>
42
+ </v-col>
43
+ </v-row>
44
+ </v-col>
45
+
46
+ <v-col cols="12" md="6" class="mt-2">
47
+ <v-row no-gutters>
48
+ <InputLabel class="text-capitalize" title="Level" required />
49
+ <v-col cols="12">
50
+ <v-select v-model="buildingUnit.level" :items="buildingLevels" density="comfortable"
51
+ :rules="[requiredRule]"></v-select>
52
+ </v-col>
53
+ </v-row>
54
+ </v-col>
55
+
56
+ <v-col cols="12" md="6" class="mt-2">
57
+ <v-row no-gutters>
58
+ <InputLabel class="text-capitalize" title="No. of Units to be added" required />
59
+ <v-col cols="12">
60
+ <v-text-field v-model.number="buildingUnitQty" density="comfortable" :rules="[requiredRule]"
61
+ type="number" @update:model-value="setBuildingLevels()"></v-text-field>
33
62
  </v-col>
34
63
  </v-row>
35
64
  </v-col>
@@ -128,33 +157,6 @@
128
157
  </v-col>
129
158
  </v-row>
130
159
  </v-col> -->
131
-
132
-
133
-
134
- <v-col cols="12">
135
- <v-row>
136
- <v-col cols="6" class="mt-2">
137
- <v-row no-gutters>
138
- <InputLabel class="text-capitalize" title="Level" required />
139
- <v-col cols="12">
140
- <v-select v-model="buildingUnit.level" :items="buildingLevels" density="comfortable"
141
- :rules="[requiredRule]"></v-select>
142
- </v-col>
143
- </v-row>
144
- </v-col>
145
-
146
- <v-col cols="6" class="mt-2">
147
- <v-row no-gutters>
148
- <InputLabel class="text-capitalize" title="No. of Units" required />
149
- <v-col cols="12">
150
- <v-text-field v-model.number="buildingUnitQty" density="comfortable" :rules="[requiredRule]"
151
- type="number" @update:model-value="setBuildingLevels()"></v-text-field>
152
- </v-col>
153
- </v-row>
154
- </v-col>
155
- </v-row>
156
- </v-col>
157
-
158
160
  <v-col v-if="buildingLevels" cols="12">
159
161
  <v-row justify="center">
160
162
  <v-col cols="6">
@@ -167,7 +169,7 @@
167
169
  <v-expand-transition>
168
170
  <v-row v-show="show" no-gutters>
169
171
  <v-row>
170
- <template v-for="(unitLabel, unitLabelIndex) in unitLabels" :key="levelIndex">
172
+ <template v-for="(unitLabel, unitLabelIndex) in unitLabels" :key="unitLabelIndex">
171
173
  <v-col cols="12" md="4">
172
174
  <v-row>
173
175
  <v-col cols="12">
@@ -379,6 +381,13 @@ async function submit() {
379
381
  }
380
382
  }
381
383
 
384
+ watch(buildingUnitQty, (newVal) => {
385
+ setTimeout(() => {
386
+ show.value = newVal > 0 && !!newVal;
387
+ }, 500);
388
+ });
389
+
390
+
382
391
  function cancel() {
383
392
  name.value = "";
384
393
  directorName.value = "";