@iservice365/layer-common 1.3.1 → 1.4.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.
- package/CHANGELOG.md +12 -0
- package/components/BuildingManagement/units.vue +25 -4
- package/components/BuildingUnitFormAdd.vue +108 -5
- package/components/BuildingUnitFormEdit.vue +114 -10
- package/components/Input/InputPhoneNumberV2.vue +10 -1
- package/components/Input/NRICNumber.vue +1 -1
- package/components/VisitorForm.vue +34 -3
- package/components/VisitorManagement.vue +1 -1
- package/composables/useCommonPermission.ts +77 -0
- package/composables/useLocal.ts +2 -0
- package/composables/usePeople.ts +8 -1
- package/nuxt.config.ts +3 -0
- package/package.json +1 -1
- package/types/building.d.ts +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -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
|
|
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
|
|
143
|
-
|
|
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
|
|
105
|
-
|
|
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 ||
|
|
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(
|
|
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");
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<v-list-item v-bind="itemProps" :title="item.raw.name" :subtitle="item.raw.dial_code" width="300" />
|
|
9
9
|
</template>
|
|
10
10
|
</v-select>
|
|
11
|
-
<v-mask-input v-model="phone" :mask="currentMask" :rules="[...props.rules, validatePhone]"
|
|
11
|
+
<v-mask-input v-model="phone" :mask="currentMask" :rules="[...props.rules, validatePhone]" :loading="loading"
|
|
12
12
|
:variant="variant" hint="Enter a valid phone number" hide-details persistent-hint return-masked-value
|
|
13
13
|
:density="density" :placeholder="placeholder || currentMask"></v-mask-input>
|
|
14
14
|
</v-col>
|
|
@@ -41,6 +41,10 @@ const props = defineProps({
|
|
|
41
41
|
hideDetails: {
|
|
42
42
|
type: Boolean,
|
|
43
43
|
default: false
|
|
44
|
+
},
|
|
45
|
+
loading: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
44
48
|
}
|
|
45
49
|
})
|
|
46
50
|
|
|
@@ -109,6 +113,11 @@ function handleUpdateCountry() {
|
|
|
109
113
|
phone.value = ''
|
|
110
114
|
}
|
|
111
115
|
|
|
116
|
+
const emit = defineEmits(['update:modelValue'])
|
|
117
|
+
|
|
118
|
+
watch(phone, (newVal) => {
|
|
119
|
+
emit('update:modelValue', newVal)
|
|
120
|
+
})
|
|
112
121
|
|
|
113
122
|
|
|
114
123
|
</script>
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
|
|
61
61
|
<v-col v-if="shouldShowField('contact')" cols="12">
|
|
62
62
|
<InputLabel class="text-capitalize" title="Phone Number" required />
|
|
63
|
-
<InputPhoneNumberV2 v-model="visitor.contact" :rules="[requiredRule]" density="comfortable" />
|
|
63
|
+
<InputPhoneNumberV2 v-model="visitor.contact" :rules="[requiredRule]" density="comfortable" :loading="fetchPersonByContactPending" @update:model-value="handleUpdateContact" />
|
|
64
64
|
</v-col>
|
|
65
65
|
|
|
66
66
|
<v-col v-if="shouldShowField('deliveryType')" cols="12">
|
|
@@ -207,7 +207,7 @@ const prop = defineProps({
|
|
|
207
207
|
const { requiredRule, debounce } = useUtils();
|
|
208
208
|
const { getSiteById, getSiteLevels, getSiteUnits } = useSiteSettings();
|
|
209
209
|
const { createVisitor, typeFieldMap, contractorTypes } = useVisitor();
|
|
210
|
-
const { findPersonByNRIC } = usePeople()
|
|
210
|
+
const { findPersonByNRIC, findPersonByContact } = usePeople()
|
|
211
211
|
|
|
212
212
|
const emit = defineEmits([
|
|
213
213
|
"back",
|
|
@@ -307,7 +307,7 @@ const {
|
|
|
307
307
|
data: fetchPersonByNRICReq,
|
|
308
308
|
refresh: fetchPersonByNRICRefresh,
|
|
309
309
|
pending: fetchPersonByNRICPending,
|
|
310
|
-
} = useLazyAsyncData(`fetch-
|
|
310
|
+
} = useLazyAsyncData(`fetch-person`, () =>{
|
|
311
311
|
const NRIC = visitor.nric;
|
|
312
312
|
if(!NRIC) return Promise.resolve(null)
|
|
313
313
|
return findPersonByNRIC(NRIC)
|
|
@@ -329,6 +329,32 @@ watch(fetchPersonByNRICReq, (obj) => {
|
|
|
329
329
|
}
|
|
330
330
|
})
|
|
331
331
|
|
|
332
|
+
const {
|
|
333
|
+
data: fetchPersonByContactReq,
|
|
334
|
+
refresh: fetchPersonByContactRefresh,
|
|
335
|
+
pending: fetchPersonByContactPending,
|
|
336
|
+
} = useLazyAsyncData(`fetch-contact`, () =>{
|
|
337
|
+
const contact = visitor.contact;
|
|
338
|
+
if(!contact) return Promise.resolve(null)
|
|
339
|
+
return findPersonByContact(contact)
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
|
|
343
|
+
watch(fetchPersonByContactReq, (obj) => {
|
|
344
|
+
if(obj){
|
|
345
|
+
companyNames.value = obj.companyName ?? []
|
|
346
|
+
visitor.name = obj.name
|
|
347
|
+
if(!visitor.company){
|
|
348
|
+
visitor.company = companyNames.value?.[0]
|
|
349
|
+
}
|
|
350
|
+
visitor.plateNumber = obj.plateNumber ?? ""
|
|
351
|
+
visitor.block = obj.block ?? ""
|
|
352
|
+
visitor.level = obj.level ?? ""
|
|
353
|
+
visitor.unit = obj.unit ?? ""
|
|
354
|
+
visitor.nric = obj.nric
|
|
355
|
+
}
|
|
356
|
+
})
|
|
357
|
+
|
|
332
358
|
const {
|
|
333
359
|
data: siteData,
|
|
334
360
|
refresh: refreshSiteData,
|
|
@@ -428,11 +454,16 @@ function handleUpdateUnit(value: any) {
|
|
|
428
454
|
}
|
|
429
455
|
|
|
430
456
|
const debounceFetchNRIC = debounce(fetchPersonByNRICRefresh, 500)
|
|
457
|
+
const debounceFetchContact = debounce(fetchPersonByContactRefresh, 500)
|
|
431
458
|
|
|
432
459
|
function handleUpdateNRIC(){
|
|
433
460
|
debounceFetchNRIC()
|
|
434
461
|
}
|
|
435
462
|
|
|
463
|
+
function handleUpdateContact(){
|
|
464
|
+
debounceFetchContact()
|
|
465
|
+
}
|
|
466
|
+
|
|
436
467
|
function backToSelection() {
|
|
437
468
|
emit("back");
|
|
438
469
|
message.value = "";
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
</v-dialog>
|
|
119
119
|
|
|
120
120
|
<v-dialog v-model="dialog.viewVisitor" width="450" persistent>
|
|
121
|
-
<VehicleUpdateMoreAction title="Preview" :can-update="
|
|
121
|
+
<VehicleUpdateMoreAction title="Preview" :can-update="false" :can-delete="canDeleteVisitor"
|
|
122
122
|
@close="dialog.viewVisitor = false" edit-button-label="Edit Visitor" delete-button-label="Delete Visitor"
|
|
123
123
|
@delete="handleDeleteVisitor">
|
|
124
124
|
<template v-slot:content>
|
|
@@ -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/composables/useLocal.ts
CHANGED
|
@@ -45,6 +45,8 @@ export default function useLocal() {
|
|
|
45
45
|
value: "mechanical_electrical_services",
|
|
46
46
|
},
|
|
47
47
|
{ title: "Cleaning Services", value: "cleaning_services" },
|
|
48
|
+
{ title: "Pest Control Services", value: "pest_control_services" },
|
|
49
|
+
{ title: "Landscaping Services", value: "landscaping_services" },
|
|
48
50
|
];
|
|
49
51
|
|
|
50
52
|
const landingPage = useCookie("landing-page", cookieConfig);
|
package/composables/usePeople.ts
CHANGED
|
@@ -25,6 +25,12 @@ export default function(){
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
async function findPersonByContact(contact: string): Promise<null | Partial<TPeople>> {
|
|
29
|
+
return await $fetch<Record<string, any>>(`/api/people/contact/${contact}`, {
|
|
30
|
+
method: "GET",
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
async function create(payload: Partial<TPeoplePayload>){
|
|
29
35
|
return await useNuxtApp().$api<Record<string, any>>("/api/people", {
|
|
30
36
|
method: "POST",
|
|
@@ -51,6 +57,7 @@ export default function(){
|
|
|
51
57
|
getAll,
|
|
52
58
|
updateById,
|
|
53
59
|
deleteById,
|
|
54
|
-
findPersonByNRIC
|
|
60
|
+
findPersonByNRIC,
|
|
61
|
+
findPersonByContact
|
|
55
62
|
}
|
|
56
63
|
}
|
package/nuxt.config.ts
CHANGED
|
@@ -29,6 +29,9 @@ export default defineNuxtConfig({
|
|
|
29
29
|
(process.env.APP_PROPERTY_MANAGEMENT as string) ?? "",
|
|
30
30
|
APP_MECHANICAL_ELECTRICAL:
|
|
31
31
|
(process.env.APP_MECHANICAL_ELECTRICAL as string) ?? "",
|
|
32
|
+
APP_PEST_CONTROL: (process.env.APP_PEST_CONTROL as string) ?? "",
|
|
33
|
+
APP_LANDSCAPING: (process.env.APP_LANDSCAPING as string) ?? "",
|
|
34
|
+
APP_POOL_MAINTENANCE: (process.env.APP_POOL_MAINTENANCE as string) ?? "",
|
|
32
35
|
},
|
|
33
36
|
},
|
|
34
37
|
|
package/package.json
CHANGED
package/types/building.d.ts
CHANGED
|
@@ -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
|
};
|