@iservice365/layer-common 1.3.1 → 1.3.2

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,11 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 1.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 34a35ff: Update dependencies
8
+
3
9
  ## 1.3.1
4
10
 
5
11
  ### Patch Changes
@@ -8,7 +8,7 @@
8
8
  variant="tonal"
9
9
  @click="setBuilding()"
10
10
  size="large"
11
- v-if="canCreate"
11
+ v-if="canCreate && canCreateUnit"
12
12
  >
13
13
  Add Unit
14
14
  </v-btn>
@@ -82,7 +82,7 @@
82
82
  </v-dialog>
83
83
 
84
84
  <!-- Preview Dialog -->
85
- <v-dialog v-model="dialogPreview" width="450" persistent>
85
+ <v-dialog v-if="canViewUnitDetails" v-model="dialogPreview" width="450" persistent>
86
86
  <v-card width="100%">
87
87
  <v-card-text style="max-height: 100vh; overflow-y: auto" class="pb-0">
88
88
  <v-row no-gutters v-if="selectedBuildingUnit" class="mb-4">
@@ -133,19 +133,24 @@
133
133
  height="48"
134
134
  v-bind="props"
135
135
  tile
136
+ :disabled="!canUpdateUnit && !canDeleteUnit"
136
137
  >
137
138
  More actions
138
139
  </v-btn>
139
140
  </template>
140
141
 
141
142
  <v-list class="pa-0">
142
- <v-list-item @click="openEditDialog()">
143
+ <v-list-item v-if="canUpdateUnit" @click="openEditDialog()">
143
144
  <v-list-item-title class="text-subtitle-2">
144
145
  Edit Unit
145
146
  </v-list-item-title>
146
147
  </v-list-item>
147
148
 
148
- <v-list-item @click="openDeleteDialog()" class="text-red">
149
+ <v-list-item
150
+ v-if="canDeleteUnit"
151
+ @click="openDeleteDialog()"
152
+ class="text-red"
153
+ >
149
154
  <v-list-item-title class="text-subtitle-2">
150
155
  Delete Unit
151
156
  </v-list-item-title>
@@ -264,6 +269,22 @@ const props = defineProps({
264
269
  type: Boolean,
265
270
  default: true,
266
271
  },
272
+ canCreateUnit: {
273
+ type: Boolean,
274
+ default: true,
275
+ },
276
+ canUpdateUnit: {
277
+ type: Boolean,
278
+ default: true,
279
+ },
280
+ canDeleteUnit: {
281
+ type: Boolean,
282
+ default: true,
283
+ },
284
+ canViewUnitDetails: {
285
+ type: Boolean,
286
+ default: true,
287
+ },
267
288
  });
268
289
 
269
290
  const site = (useRoute().params.site as string) ?? "";
@@ -48,6 +48,89 @@
48
48
  </v-row>
49
49
  </v-col>
50
50
 
51
+ <v-col cols="12">
52
+ <v-row>
53
+ <v-col cols="12" class="mt-2">
54
+ <v-row no-gutters>
55
+ <InputLabel
56
+ class="text-capitalize"
57
+ title="Company Name"
58
+ required
59
+ />
60
+ <v-col cols="12">
61
+ <v-text-field
62
+ v-model="buildingUnit.companyName"
63
+ density="comfortable"
64
+ :rules="[requiredRule]"
65
+ ></v-text-field>
66
+ </v-col>
67
+ </v-row>
68
+ </v-col>
69
+ </v-row>
70
+ </v-col>
71
+
72
+ <v-col cols="12">
73
+ <v-row>
74
+ <v-col cols="12" class="mt-2">
75
+ <v-row no-gutters>
76
+ <InputLabel
77
+ class="text-capitalize"
78
+ title="Company Registration Number"
79
+ />
80
+ <v-col cols="12">
81
+ <v-text-field
82
+ v-model="buildingUnit.companyRegistrationNumber"
83
+ density="comfortable"
84
+ :rules="[]"
85
+ ></v-text-field>
86
+ </v-col>
87
+ </v-row>
88
+ </v-col>
89
+ </v-row>
90
+ </v-col>
91
+
92
+ <v-col cols="12">
93
+ <v-row>
94
+ <v-col cols="12" class="mt-2">
95
+ <v-row no-gutters>
96
+ <InputLabel
97
+ class="text-capitalize"
98
+ title="Lease Start"
99
+ required
100
+ />
101
+ <v-col cols="12">
102
+ <InputDateTimePicker
103
+ ref="startDateRef"
104
+ v-model="buildingUnit.leaseStart"
105
+ :rules="[requiredRule]"
106
+ />
107
+ </v-col>
108
+ </v-row>
109
+ </v-col>
110
+ </v-row>
111
+ </v-col>
112
+
113
+ <v-col cols="12">
114
+ <v-row>
115
+ <v-col cols="12" class="mt-2">
116
+ <v-row no-gutters>
117
+ <InputLabel
118
+ class="text-capitalize"
119
+ title="Lease End"
120
+ required
121
+ />
122
+ <v-col cols="12">
123
+ <InputDateTimePicker
124
+ ref="endDateRef"
125
+ v-model="buildingUnit.leaseEnd"
126
+ :rules="[requiredRule]"
127
+ />
128
+ </v-col>
129
+ </v-row>
130
+ </v-col>
131
+ </v-row>
132
+ </v-col>
133
+
51
134
  <v-col cols="12" class="mt-2">
52
135
  <v-row no-gutters>
53
136
  <InputLabel class="text-capitalize" title="Category" required />
@@ -139,8 +222,17 @@
139
222
  </v-expand-transition>
140
223
 
141
224
  <v-col cols="12" class="mt-5">
142
- <InputLabel class="text-capitalize" title="Upload Files (Lease of Contract, Cert. of Occupancy)" />
143
- <InputFileV2 v-model="buildingUnit.buildingUnitFiles" :multiple="false" :max-length="10" title="Upload PDF Files" accept="application/pdf" />
225
+ <InputLabel
226
+ class="text-capitalize"
227
+ title="Upload Files (Lease of Contract, Cert. of Occupancy)"
228
+ />
229
+ <InputFileV2
230
+ v-model="buildingUnit.buildingUnitFiles"
231
+ :multiple="false"
232
+ :max-length="10"
233
+ title="Upload PDF Files"
234
+ accept="application/pdf"
235
+ />
144
236
  </v-col>
145
237
 
146
238
  <v-col cols="12" class="mt-2">
@@ -244,9 +336,16 @@ const buildingUnit = ref<TBuildingUnit>({
244
336
  level: "",
245
337
  category: "",
246
338
  status: "active",
247
- buildingUnitFiles: []
339
+ buildingUnitFiles: [],
340
+ companyName: "",
341
+ companyRegistrationNumber: "",
342
+ leaseStart: "",
343
+ leaseEnd: "",
248
344
  });
249
345
 
346
+ const startDateRef = ref<HTMLInputElement | null>(null);
347
+ const expiryDateRef = ref<HTMLInputElement | null>(null);
348
+
250
349
  buildingUnit.value.site = prop.site;
251
350
 
252
351
  const selectedBuilding = computed(() => {
@@ -284,7 +383,7 @@ const directorName = ref("");
284
383
  const createMore = ref(false);
285
384
  const disable = ref(false);
286
385
 
287
- const { requiredRule } = useUtils();
386
+ const { requiredRule, validateDate } = useUtils();
288
387
 
289
388
  const message = ref("");
290
389
 
@@ -298,9 +397,13 @@ function setBuildingUnit() {
298
397
  buildingUnit.value.level = "";
299
398
  buildingUnit.value.category = "";
300
399
  buildingUnit.value.status = "active";
301
- buildingUnit.value.buildingUnitFiles = []
400
+ buildingUnit.value.buildingUnitFiles = [];
302
401
  buildingUnitQty.value = 1;
303
402
  message.value = "";
403
+ buildingUnit.value.companyName = "";
404
+ buildingUnit.value.companyRegistrationNumber = "";
405
+ buildingUnit.value.leaseStart = "";
406
+ buildingUnit.value.leaseEnd = "";
304
407
  }
305
408
 
306
409
  async function submit() {
@@ -60,6 +60,88 @@
60
60
  </v-row>
61
61
  </v-col>
62
62
 
63
+ <v-col cols="12">
64
+ <v-row>
65
+ <v-col cols="12" class="mt-2">
66
+ <v-row no-gutters>
67
+ <InputLabel
68
+ class="text-capitalize"
69
+ title="Company Name"
70
+ required
71
+ />
72
+ <v-col cols="12">
73
+ <v-text-field
74
+ v-model="buildingUnit.companyName"
75
+ density="comfortable"
76
+ :rules="[requiredRule]"
77
+ ></v-text-field>
78
+ </v-col>
79
+ </v-row>
80
+ </v-col>
81
+ </v-row>
82
+ </v-col>
83
+
84
+ <v-col cols="12">
85
+ <v-row>
86
+ <v-col cols="12" class="mt-2">
87
+ <v-row no-gutters>
88
+ <InputLabel
89
+ class="text-capitalize"
90
+ title="Company Registration Number"
91
+ />
92
+ <v-col cols="12">
93
+ <v-text-field
94
+ v-model="buildingUnit.companyRegistrationNumber"
95
+ density="comfortable"
96
+ ></v-text-field>
97
+ </v-col>
98
+ </v-row>
99
+ </v-col>
100
+ </v-row>
101
+ </v-col>
102
+
103
+ <v-col cols="12">
104
+ <v-row>
105
+ <v-col cols="12" class="mt-2">
106
+ <v-row no-gutters>
107
+ <InputLabel
108
+ class="text-capitalize"
109
+ title="Lease Start"
110
+ required
111
+ />
112
+ <v-col cols="12">
113
+ <InputDateTimePicker
114
+ ref="startDateRef"
115
+ v-model="buildingUnit.leaseStart"
116
+ :rules="[requiredRule]"
117
+ />
118
+ </v-col>
119
+ </v-row>
120
+ </v-col>
121
+ </v-row>
122
+ </v-col>
123
+
124
+ <v-col cols="12">
125
+ <v-row>
126
+ <v-col cols="12" class="mt-2">
127
+ <v-row no-gutters>
128
+ <InputLabel
129
+ class="text-capitalize"
130
+ title="Lease End"
131
+ required
132
+ />
133
+ <v-col cols="12">
134
+ <InputDateTimePicker
135
+ ref="endDateRef"
136
+ v-model="buildingUnit.leaseEnd"
137
+ :rules="[requiredRule]"
138
+ />
139
+ </v-col>
140
+ </v-row>
141
+ </v-col>
142
+ </v-row>
143
+ </v-col>
144
+
63
145
  <v-col cols="12" class="mt-2">
64
146
  <v-row no-gutters>
65
147
  <InputLabel
@@ -101,8 +183,17 @@
101
183
  </v-col>
102
184
 
103
185
  <v-col cols="12" class="mt-5">
104
- <InputLabel class="text-capitalize" title="Upload Files (Lease of Contract, Cert. of Occupancy)" />
105
- <InputFileV2 v-model="buildingUnit.buildingUnitFiles" :multiple="false" :max-length="10" title="Upload PDF Files" accept="application/pdf" />
186
+ <InputLabel
187
+ class="text-capitalize"
188
+ title="Upload Files (Lease of Contract, Cert. of Occupancy)"
189
+ />
190
+ <InputFileV2
191
+ v-model="buildingUnit.buildingUnitFiles"
192
+ :multiple="false"
193
+ :max-length="10"
194
+ title="Upload PDF Files"
195
+ accept="application/pdf"
196
+ />
106
197
  </v-col>
107
198
 
108
199
  <v-col cols="12" class="my-2">
@@ -143,7 +234,7 @@
143
234
  color="black"
144
235
  class="text-none"
145
236
  size="48"
146
- :disabled="!validForm || !hasChanges || disable"
237
+ :disabled="!validForm || disable"
147
238
  @click="submit"
148
239
  :loading="disable"
149
240
  >
@@ -173,7 +264,11 @@ const prop = defineProps({
173
264
  block: null,
174
265
  level: 0,
175
266
  status: "active",
176
- buildingUnitFiles: []
267
+ buildingUnitFiles: [],
268
+ companyName: "",
269
+ companyRegistrationNumber: "",
270
+ leaseStart: "",
271
+ leaseEnd: "",
177
272
  }),
178
273
  },
179
274
  });
@@ -188,7 +283,11 @@ const buildingUnit = ref({
188
283
  category: "",
189
284
  block: null,
190
285
  status: "active",
191
- buildingUnitFiles: []
286
+ buildingUnitFiles: [],
287
+ companyName: "",
288
+ companyRegistrationNumber: "",
289
+ leaseStart: "",
290
+ leaseEnd: "",
192
291
  });
193
292
 
194
293
  buildingUnit.value = JSON.parse(JSON.stringify(prop.roomFacility));
@@ -241,14 +340,15 @@ function arraysAreEqual(a: any[], b: any[]): boolean {
241
340
  return a.length === b.length && a.every((val, index) => val === b[index]);
242
341
  }
243
342
 
244
-
245
-
246
343
  const hasChanges = computed(() => {
247
344
  return (
248
345
  prop.roomFacility.name !== buildingUnit.value.name ||
249
346
  prop.roomFacility.category !== buildingUnit.value.category ||
250
- prop.roomFacility.level !== buildingUnit.value.level ||
251
- !arraysAreEqual(prop.roomFacility.buildingUnitFiles, buildingUnit.value.buildingUnitFiles)
347
+ prop.roomFacility.level !== buildingUnit.value.level ||
348
+ !arraysAreEqual(
349
+ prop.roomFacility.buildingUnitFiles,
350
+ buildingUnit.value.buildingUnitFiles
351
+ )
252
352
  );
253
353
  });
254
354
 
@@ -259,7 +359,11 @@ async function submit() {
259
359
  name: buildingUnit.value.name,
260
360
  level: buildingUnit.value.level,
261
361
  category: buildingUnit.value.category,
262
- buildingUnitFiles: buildingUnit.value.buildingUnitFiles || []
362
+ buildingUnitFiles: buildingUnit.value.buildingUnitFiles || [],
363
+ companyName: buildingUnit.value.companyName,
364
+ companyRegistrationNumber: buildingUnit.value.companyRegistrationNumber || "",
365
+ leaseStart: buildingUnit.value.leaseStart,
366
+ leaseEnd: buildingUnit.value.leaseEnd,
263
367
  });
264
368
 
265
369
  emit("success");
@@ -120,11 +120,88 @@ export function useCommonPermissions() {
120
120
  },
121
121
  };
122
122
 
123
+ const visitorManagementPermissions: Record<string, TPermission> = {
124
+ "add-visitor": {
125
+ check: true,
126
+ description: "Allows the user to add a new visitor to the system.",
127
+ },
128
+ "see-all-visitor": {
129
+ check: true,
130
+ description: "Allows the user to view the list of all visitors.",
131
+ },
132
+ "see-visitor-details": {
133
+ check: true,
134
+ description: "Allows the user to view the details of a specific visitor.",
135
+ },
136
+ "update-visitor": {
137
+ check: true,
138
+ description: "Allows the user to update visitor details.",
139
+ },
140
+ "delete-visitor": {
141
+ check: true,
142
+ description:
143
+ "Allows the user to remove a visitor from the system permanently.",
144
+ },
145
+ };
146
+
147
+ const buildingManagementPermissions: Record<string, TPermission> = {
148
+ "add-building": {
149
+ check: true,
150
+ description: "Allows the user to add a new building to the system.",
151
+ },
152
+ "see-all-buildings": {
153
+ check: true,
154
+ description: "Allows the user to view the list of all buildings.",
155
+ },
156
+ "see-building-details": {
157
+ check: true,
158
+ description:
159
+ "Allows the user to view the details of a specific building.",
160
+ },
161
+ "update-building": {
162
+ check: true,
163
+ description: "Allows the user to update building details.",
164
+ },
165
+ "delete-building": {
166
+ check: true,
167
+ description:
168
+ "Allows the user to remove a building from the system permanently.",
169
+ },
170
+ };
171
+
172
+ const buildingUnitManagementPermissions: Record<string, TPermission> = {
173
+ "add-building-unit": {
174
+ check: true,
175
+ description: "Allows the user to add a new building unit to the system.",
176
+ },
177
+ "see-all-building-units": {
178
+ check: true,
179
+ description: "Allows the user to view the list of all building units.",
180
+ },
181
+ "see-building-unit-details": {
182
+ check: true,
183
+ description:
184
+ "Allows the user to view the details of a specific building unit.",
185
+ },
186
+ "update-building-unit": {
187
+ check: true,
188
+ description: "Allows the user to update building unit details.",
189
+ },
190
+ "delete-building-unit": {
191
+ check: true,
192
+ description:
193
+ "Allows the user to remove a building unit from the system permanently.",
194
+ },
195
+ };
196
+
123
197
  return {
124
198
  invitationPermissions,
125
199
  memberPermissions,
126
200
  rolePermissions,
127
201
  feedbackPermissions,
128
202
  workOrderPermissions,
203
+ visitorManagementPermissions,
204
+ buildingManagementPermissions,
205
+ buildingUnitManagementPermissions
129
206
  };
130
207
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@iservice365/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.3.1",
5
+ "version": "1.3.2",
6
6
  "main": "./nuxt.config.ts",
7
7
  "scripts": {
8
8
  "dev": "nuxi dev .playground",
@@ -17,5 +17,9 @@ declare type TBuildingUnit = {
17
17
  level: string | null;
18
18
  category: string;
19
19
  status: string;
20
- buildingUnitFiles: string[]
20
+ buildingUnitFiles: string[];
21
+ companyName: string;
22
+ companyRegistrationNumber: number | string;
23
+ leaseStart: string;
24
+ leaseEnd: string;
21
25
  };