@7365admin1/layer-common 3.0.11 → 3.0.13
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 +13 -0
- package/components/DashboardMain.vue +620 -133
- package/components/IncidentReport/IncidentInformation.vue +1 -1
- package/components/IncidentReport/IncidentInformationDownload.vue +1 -1
- package/components/Input/InputPhoneNumberV2.vue +33 -29
- package/components/Input/Password.vue +1 -0
- package/components/VehicleForm.vue +6 -4
- package/components/VehicleManagement.vue +16 -1
- package/composables/useAreaPermission.ts +6 -6
- package/composables/useAttendancePermission.ts +5 -5
- package/composables/useBulletinBoardPermission.ts +5 -5
- package/composables/useCleaningPermission.ts +2 -0
- package/composables/useCleaningSchedulePermission.ts +7 -7
- package/composables/useCommonPermission.ts +41 -1
- package/composables/useEquipmentItemPermission.ts +6 -6
- package/composables/useEquipmentManagementPermission.ts +7 -7
- package/composables/useEquipmentPermission.ts +7 -7
- package/composables/useScheduleTaskPermission.ts +5 -5
- package/composables/useSettingsPermission.ts +11 -11
- package/composables/useUnitPermission.ts +6 -6
- package/package.json +1 -1
|
@@ -5,17 +5,21 @@
|
|
|
5
5
|
v-model="selectedCode"
|
|
6
6
|
:variant="variant"
|
|
7
7
|
:items="countries"
|
|
8
|
-
item-title="
|
|
8
|
+
item-title="dial_code"
|
|
9
9
|
item-value="code"
|
|
10
10
|
hide-details
|
|
11
11
|
class="px-0"
|
|
12
12
|
:density="density"
|
|
13
|
-
style="max-width:
|
|
13
|
+
style="max-width: 110px"
|
|
14
14
|
:rules="[...props.rules]"
|
|
15
15
|
:readonly="props.readOnly"
|
|
16
16
|
:disabled="props.disabled"
|
|
17
17
|
@update:model-value="handleUpdateCountry"
|
|
18
18
|
>
|
|
19
|
+
<template v-slot:selection="{ item }">
|
|
20
|
+
<span>{{ item.raw.dial_code }}</span>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
19
23
|
<template v-slot:item="{ props: itemProps, item }">
|
|
20
24
|
<v-list-item
|
|
21
25
|
v-bind="itemProps"
|
|
@@ -38,7 +42,6 @@
|
|
|
38
42
|
hide-details
|
|
39
43
|
persistent-hint
|
|
40
44
|
return-masked-value
|
|
41
|
-
:prefix="phonePrefix || ''"
|
|
42
45
|
persistent-placeholder
|
|
43
46
|
:density="density"
|
|
44
47
|
:disabled="props.disabled"
|
|
@@ -52,7 +55,7 @@
|
|
|
52
55
|
</template>
|
|
53
56
|
|
|
54
57
|
<script setup lang="ts">
|
|
55
|
-
import { ref, computed, watch,
|
|
58
|
+
import { ref, computed, watch, type PropType } from 'vue'
|
|
56
59
|
//@ts-ignore
|
|
57
60
|
import phoneMasks from '~/utils/phoneMasks'
|
|
58
61
|
import type { ValidationRule } from 'vuetify/lib/types.mjs'
|
|
@@ -101,6 +104,10 @@ const phonePrefix = computed(() => {
|
|
|
101
104
|
return country?.dial_code || ''
|
|
102
105
|
})
|
|
103
106
|
|
|
107
|
+
const countriesByLongestDialCode = computed(() => {
|
|
108
|
+
return [...countries].sort((a: TPhoneMask, b: TPhoneMask) => b.dial_code.length - a.dial_code.length)
|
|
109
|
+
})
|
|
110
|
+
|
|
104
111
|
function generateMaskFromRegex(regex: string): string {
|
|
105
112
|
let pattern = regex.replace(/^\^|\$$/g, '')
|
|
106
113
|
pattern = pattern.replace(/\(\?:\+?\d+\)\?/g, '')
|
|
@@ -125,13 +132,19 @@ const validatePhone = (): boolean | string => {
|
|
|
125
132
|
return isValid
|
|
126
133
|
}
|
|
127
134
|
|
|
135
|
+
function findCountryFromPhone(value: string): TPhoneMask | undefined {
|
|
136
|
+
return countriesByLongestDialCode.value.find((c: TPhoneMask) => value.startsWith(c.dial_code))
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function syncInputFromPhone(value: string) {
|
|
140
|
+
const prefix = phonePrefix.value
|
|
141
|
+
if (!value) input.value = ''
|
|
142
|
+
else input.value = value.startsWith(prefix) ? value.slice(prefix.length) : value
|
|
143
|
+
}
|
|
144
|
+
|
|
128
145
|
function handleUpdateCountry() {
|
|
129
146
|
const prefix = phonePrefix.value
|
|
130
|
-
|
|
131
|
-
input.value = phone.value.slice(prefix.length)
|
|
132
|
-
} else {
|
|
133
|
-
input.value = ''
|
|
134
|
-
}
|
|
147
|
+
phone.value = input.value ? prefix + input.value : ''
|
|
135
148
|
}
|
|
136
149
|
|
|
137
150
|
|
|
@@ -150,28 +163,19 @@ watch(
|
|
|
150
163
|
)
|
|
151
164
|
|
|
152
165
|
|
|
153
|
-
watch(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
166
|
+
watch(
|
|
167
|
+
phone,
|
|
168
|
+
(newVal) => {
|
|
169
|
+
const country = newVal ? findCountryFromPhone(newVal) : undefined
|
|
170
|
+
if (country && country.code !== selectedCode.value) selectedCode.value = country.code
|
|
171
|
+
syncInputFromPhone(newVal)
|
|
172
|
+
emit('update:modelValue', newVal)
|
|
173
|
+
},
|
|
174
|
+
{ immediate: true }
|
|
175
|
+
)
|
|
159
176
|
|
|
160
177
|
|
|
161
178
|
watch(selectedCode, () => {
|
|
162
|
-
|
|
163
|
-
if (phone.value?.startsWith(prefix)) input.value = phone.value.slice(prefix.length)
|
|
164
|
-
else input.value = phone.value || ''
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
onMounted(() => {
|
|
169
|
-
if (phone.value) {
|
|
170
|
-
const found = countries.find((c: TPhoneMask) => phone.value.startsWith(c.dial_code))
|
|
171
|
-
if (found) selectedCode.value = found.code
|
|
172
|
-
const prefix = phonePrefix.value
|
|
173
|
-
input.value = phone.value.startsWith(prefix) ? phone.value.slice(prefix.length) : phone.value
|
|
174
|
-
maskKey.value++
|
|
175
|
-
}
|
|
179
|
+
maskKey.value++
|
|
176
180
|
})
|
|
177
181
|
</script>
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
</v-col>
|
|
57
57
|
|
|
58
58
|
<v-col v-if="shouldShowField('nric')" cols="12">
|
|
59
|
-
<InputLabel class="text-capitalize" title="NRIC"
|
|
60
|
-
<InputNRICNumber v-model="vehicle.nric" density="comfortable"
|
|
59
|
+
<InputLabel class="text-capitalize" title="NRIC"/>
|
|
60
|
+
<InputNRICNumber v-model="vehicle.nric" density="comfortable"
|
|
61
61
|
:disabled="disablePrefilledInputs && type !== 'blocklist' && prop.mode !== 'edit'" />
|
|
62
62
|
</v-col>
|
|
63
63
|
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
<v-col v-if="shouldShowField('phone')" cols="12">
|
|
77
|
-
<InputLabel class="text-capitalize" title="Phone Number"
|
|
78
|
-
<InputPhoneNumberV2 v-model="vehicle.phoneNumber" density="comfortable"
|
|
77
|
+
<InputLabel class="text-capitalize" title="Phone Number"/>
|
|
78
|
+
<InputPhoneNumberV2 v-model="vehicle.phoneNumber" density="comfortable" />
|
|
79
79
|
</v-col>
|
|
80
80
|
|
|
81
81
|
<v-col v-if="shouldShowField('plateNumber')" cols="12">
|
|
@@ -770,6 +770,8 @@ watch(
|
|
|
770
770
|
async (newUnit) => {
|
|
771
771
|
if (prefillingRecords.value) return;
|
|
772
772
|
|
|
773
|
+
if(prop.mode === 'edit') return;
|
|
774
|
+
|
|
773
775
|
resetVehicleDetails();
|
|
774
776
|
matchingPeople.value = [];
|
|
775
777
|
if (!newUnit) return;
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
</v-chip>
|
|
79
79
|
</template>
|
|
80
80
|
<template #item.action="{ item: plateNumberItem, value }">
|
|
81
|
-
<v-menu>
|
|
81
|
+
<v-menu v-if="hasVehicleActions(plateNumberItem as TPlateNumber)">
|
|
82
82
|
<template #activator="{ props: menuProps }">
|
|
83
83
|
<v-btn icon="mdi-dots-vertical" v-bind="menuProps" flat size="x-small" />
|
|
84
84
|
</template>
|
|
@@ -382,6 +382,21 @@ function handleUpdateType(item: TPlateNumber) {
|
|
|
382
382
|
dialog.updateVehicleType = true;
|
|
383
383
|
}
|
|
384
384
|
|
|
385
|
+
function hasVehicleActions(item: TPlateNumber) {
|
|
386
|
+
const isActive = item?.status === "active";
|
|
387
|
+
const isPending = item?.status === "pending";
|
|
388
|
+
const isDeleted = item?.status === "deleted";
|
|
389
|
+
const canUpdateType = item?.type === "whitelist" || item?.type === "blocklist";
|
|
390
|
+
|
|
391
|
+
return (
|
|
392
|
+
isActive ||
|
|
393
|
+
(props.app === "property_management_agency" && isPending) ||
|
|
394
|
+
isDeleted ||
|
|
395
|
+
(canUpdateType && isActive) ||
|
|
396
|
+
(props.canDeleteVehicle && isActive)
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
|
|
385
400
|
function handleSelectVehicleStatus(value: TVehicleType) {
|
|
386
401
|
vehicleType.value = value;
|
|
387
402
|
dialog.showSelection = false;
|
|
@@ -5,37 +5,37 @@ export function useAreaPermission() {
|
|
|
5
5
|
const { userAppRole } = useLocalSetup();
|
|
6
6
|
|
|
7
7
|
const canViewAreas = computed(() => {
|
|
8
|
-
if (!userAppRole.value) return
|
|
8
|
+
if (!userAppRole.value) return false;
|
|
9
9
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
10
10
|
return hasPermission(userAppRole.value, permissions, "area-mgmt", "see-all-areas");
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
const canCreateArea = computed(() => {
|
|
14
|
-
if (!userAppRole.value) return
|
|
14
|
+
if (!userAppRole.value) return false;
|
|
15
15
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
16
16
|
return hasPermission(userAppRole.value, permissions, "area-mgmt", "add-area");
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
const canUpdateArea = computed(() => {
|
|
20
|
-
if (!userAppRole.value) return
|
|
20
|
+
if (!userAppRole.value) return false;
|
|
21
21
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
22
22
|
return hasPermission(userAppRole.value, permissions, "area-mgmt", "update-area");
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
const canViewAreaDetails = computed(() => {
|
|
26
|
-
if (!userAppRole.value) return
|
|
26
|
+
if (!userAppRole.value) return false;
|
|
27
27
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
28
28
|
return hasPermission(userAppRole.value, permissions, "area-mgmt", "see-area-details");
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
const canImportArea = computed(() => {
|
|
32
|
-
if (!userAppRole.value) return
|
|
32
|
+
if (!userAppRole.value) return false;
|
|
33
33
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
34
34
|
return hasPermission(userAppRole.value, permissions, "area-mgmt", "import-areas");
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
const canDeleteArea = computed(() => {
|
|
38
|
-
if (!userAppRole.value) return
|
|
38
|
+
if (!userAppRole.value) return false;
|
|
39
39
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
40
40
|
return hasPermission(userAppRole.value, permissions, "area-mgmt", "delete-area");
|
|
41
41
|
});
|
|
@@ -4,7 +4,7 @@ export function useAttendancePermission() {
|
|
|
4
4
|
const { userAppRole } = useLocalSetup();
|
|
5
5
|
|
|
6
6
|
const canViewAllAttendance = computed(() => {
|
|
7
|
-
if (!userAppRole.value) return
|
|
7
|
+
if (!userAppRole.value) return false;
|
|
8
8
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
9
9
|
return hasPermission(
|
|
10
10
|
userAppRole.value,
|
|
@@ -15,7 +15,7 @@ export function useAttendancePermission() {
|
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
const canViewAttendanceDetails = computed(() => {
|
|
18
|
-
if (!userAppRole.value) return
|
|
18
|
+
if (!userAppRole.value) return false;
|
|
19
19
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
20
20
|
return hasPermission(
|
|
21
21
|
userAppRole.value,
|
|
@@ -26,7 +26,7 @@ export function useAttendancePermission() {
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const canManageAttendanceSettings = computed(() => {
|
|
29
|
-
if (!userAppRole.value) return
|
|
29
|
+
if (!userAppRole.value) return false;
|
|
30
30
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
31
31
|
return hasPermission(
|
|
32
32
|
userAppRole.value,
|
|
@@ -37,7 +37,7 @@ export function useAttendancePermission() {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
const canViewOwnAttendance = computed(() => {
|
|
40
|
-
if (!userAppRole.value) return
|
|
40
|
+
if (!userAppRole.value) return false;
|
|
41
41
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
42
42
|
return hasPermission(
|
|
43
43
|
userAppRole.value,
|
|
@@ -48,7 +48,7 @@ export function useAttendancePermission() {
|
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
const canCheckInOut = computed(() => {
|
|
51
|
-
if (!userAppRole.value) return
|
|
51
|
+
if (!userAppRole.value) return false;
|
|
52
52
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
53
53
|
return hasPermission(
|
|
54
54
|
userAppRole.value,
|
|
@@ -7,25 +7,25 @@ export function useBulletinBoardPermission() {
|
|
|
7
7
|
const { userAppRole } = useLocalSetup();
|
|
8
8
|
|
|
9
9
|
const canViewBulletinBoard = computed(() => {
|
|
10
|
-
if (!userAppRole.value) return
|
|
10
|
+
if (!userAppRole.value) return false;
|
|
11
11
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
12
12
|
return hasPermission(userAppRole.value, permissions, "bulletin-board", "see-all-bulletin-boards");
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
const canCreateBulletinBoard = computed(() => {
|
|
16
|
-
if (!userAppRole.value) return
|
|
16
|
+
if (!userAppRole.value) return false;
|
|
17
17
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
18
18
|
return hasPermission(userAppRole.value, permissions, "bulletin-board", "add-bulletin-board");
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
const canUpdateBulletinBoard = computed(() => {
|
|
22
|
-
if (!userAppRole.value) return
|
|
22
|
+
if (!userAppRole.value) return false;
|
|
23
23
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
24
24
|
return hasPermission(userAppRole.value, permissions, "bulletin-board", "update-bulletin-board");
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
const canViewBulletinBoardDetails = computed(() => {
|
|
28
|
-
if (!userAppRole.value) return
|
|
28
|
+
if (!userAppRole.value) return false;
|
|
29
29
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
30
30
|
return hasPermission(userAppRole.value, permissions, "bulletin-board", "see-bulletin-board-details");
|
|
31
31
|
});
|
|
@@ -33,7 +33,7 @@ export function useBulletinBoardPermission() {
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
const canDeleteBulletinBoard = computed(() => {
|
|
36
|
-
if (!userAppRole.value) return
|
|
36
|
+
if (!userAppRole.value) return false;
|
|
37
37
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
38
38
|
return hasPermission(userAppRole.value, permissions, "bulletin-board", "delete-bulletin-board");
|
|
39
39
|
});
|
|
@@ -6,6 +6,7 @@ export default function useCleaningPermission() {
|
|
|
6
6
|
workOrderPermissions,
|
|
7
7
|
invitationPermissions,
|
|
8
8
|
bulletinBoardPermissions,
|
|
9
|
+
dashboardPermissions,
|
|
9
10
|
} = useCommonPermissions();
|
|
10
11
|
const permissions: TPermissions = {
|
|
11
12
|
members: memberPermissions,
|
|
@@ -14,6 +15,7 @@ export default function useCleaningPermission() {
|
|
|
14
15
|
roles: rolePermissions,
|
|
15
16
|
invitations: invitationPermissions,
|
|
16
17
|
"bulletin-board": bulletinBoardPermissions,
|
|
18
|
+
dashboard: dashboardPermissions,
|
|
17
19
|
inventory: {
|
|
18
20
|
"view-inventory": {
|
|
19
21
|
check: true,
|
|
@@ -5,43 +5,43 @@ export function useCleaningSchedulePermission() {
|
|
|
5
5
|
const { userAppRole } = useLocalSetup();
|
|
6
6
|
|
|
7
7
|
const canViewSchedules = computed(() => {
|
|
8
|
-
if (!userAppRole.value) return
|
|
8
|
+
if (!userAppRole.value) return false;
|
|
9
9
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
10
10
|
return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "see-all-schedules");
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
const canViewScheduleDetails = computed(() => {
|
|
14
|
-
if (!userAppRole.value) return
|
|
14
|
+
if (!userAppRole.value) return false;
|
|
15
15
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
16
16
|
return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "see-schedule-details");
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
const canDownloadSchedule = computed(() => {
|
|
20
|
-
if (!userAppRole.value) return
|
|
20
|
+
if (!userAppRole.value) return false;
|
|
21
21
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
22
22
|
return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "download-schedule");
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
const canManageScheduleTasks = computed(() => {
|
|
26
|
-
if (!userAppRole.value) return
|
|
26
|
+
if (!userAppRole.value) return false;
|
|
27
27
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
28
28
|
return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "manage-schedule-tasks");
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
const canGenerateChecklist = computed(() => {
|
|
32
|
-
if (!userAppRole.value) return
|
|
32
|
+
if (!userAppRole.value) return false;
|
|
33
33
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
34
34
|
return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "generate-checklist");
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
const canViewHistory = computed(() => {
|
|
38
|
-
if (!userAppRole.value) return
|
|
38
|
+
if (!userAppRole.value) return false;
|
|
39
39
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
40
40
|
return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "view-history");
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
const canAddRemarks = computed(() => {
|
|
44
|
-
if (!userAppRole.value) return
|
|
44
|
+
if (!userAppRole.value) return false;
|
|
45
45
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
46
46
|
return hasPermission(userAppRole.value, permissions, "cleaning-schedule-mgmt", "add-remarks");
|
|
47
47
|
});
|
|
@@ -278,6 +278,45 @@ export function useCommonPermissions() {
|
|
|
278
278
|
},
|
|
279
279
|
|
|
280
280
|
}
|
|
281
|
+
|
|
282
|
+
const dashboardPermissions: Record<string, TPermission> = {
|
|
283
|
+
"view-activity": {
|
|
284
|
+
check: true,
|
|
285
|
+
description: "Allows the user to view the activity chart widget.",
|
|
286
|
+
},
|
|
287
|
+
"view-task-schedule": {
|
|
288
|
+
check: true,
|
|
289
|
+
description: "Allows the user to view the task schedule widget.",
|
|
290
|
+
},
|
|
291
|
+
"view-attendance-widget": {
|
|
292
|
+
check: true,
|
|
293
|
+
description: "Allows the user to view the attendance/staff status widget.",
|
|
294
|
+
},
|
|
295
|
+
"view-feedbacks-widget": {
|
|
296
|
+
check: true,
|
|
297
|
+
description: "Allows the user to view the feedbacks widget.",
|
|
298
|
+
},
|
|
299
|
+
"view-upcoming-events": {
|
|
300
|
+
check: true,
|
|
301
|
+
description: "Allows the user to view the upcoming events widget.",
|
|
302
|
+
},
|
|
303
|
+
"view-today-reminders": {
|
|
304
|
+
check: true,
|
|
305
|
+
description: "Allows the user to view the today's reminders widget.",
|
|
306
|
+
},
|
|
307
|
+
"view-today-attentions": {
|
|
308
|
+
check: true,
|
|
309
|
+
description: "Allows the user to view the today's attentions widget.",
|
|
310
|
+
},
|
|
311
|
+
"view-work-order-status": {
|
|
312
|
+
check: true,
|
|
313
|
+
description: "Allows the user to view the work order status widget.",
|
|
314
|
+
},
|
|
315
|
+
"view-active-patrol": {
|
|
316
|
+
check: true,
|
|
317
|
+
description: "Allows the user to view the active patrol widget.",
|
|
318
|
+
},
|
|
319
|
+
}
|
|
281
320
|
|
|
282
321
|
return {
|
|
283
322
|
invitationPermissions,
|
|
@@ -289,6 +328,7 @@ export function useCommonPermissions() {
|
|
|
289
328
|
buildingManagementPermissions,
|
|
290
329
|
buildingUnitManagementPermissions,
|
|
291
330
|
bulletinBoardPermissions,
|
|
292
|
-
siteSettingsPermissions
|
|
331
|
+
siteSettingsPermissions,
|
|
332
|
+
dashboardPermissions
|
|
293
333
|
};
|
|
294
334
|
}
|
|
@@ -4,7 +4,7 @@ export function useEquipmentItemPermission() {
|
|
|
4
4
|
const { userAppRole } = useLocalSetup();
|
|
5
5
|
|
|
6
6
|
const canViewAllEquipmentItems = computed(() => {
|
|
7
|
-
if (!userAppRole.value) return
|
|
7
|
+
if (!userAppRole.value) return false;
|
|
8
8
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
9
9
|
return hasPermission(
|
|
10
10
|
userAppRole.value,
|
|
@@ -15,7 +15,7 @@ export function useEquipmentItemPermission() {
|
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
const canCreateEquipmentItem = computed(() => {
|
|
18
|
-
if (!userAppRole.value) return
|
|
18
|
+
if (!userAppRole.value) return false;
|
|
19
19
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
20
20
|
return hasPermission(
|
|
21
21
|
userAppRole.value,
|
|
@@ -26,7 +26,7 @@ export function useEquipmentItemPermission() {
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const canUpdateEquipmentItem = computed(() => {
|
|
29
|
-
if (!userAppRole.value) return
|
|
29
|
+
if (!userAppRole.value) return false;
|
|
30
30
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
31
31
|
return hasPermission(
|
|
32
32
|
userAppRole.value,
|
|
@@ -37,7 +37,7 @@ export function useEquipmentItemPermission() {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
const canApproveEquipmentItem = computed(() => {
|
|
40
|
-
if (!userAppRole.value) return
|
|
40
|
+
if (!userAppRole.value) return false;
|
|
41
41
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
42
42
|
return hasPermission(
|
|
43
43
|
userAppRole.value,
|
|
@@ -48,7 +48,7 @@ export function useEquipmentItemPermission() {
|
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
const canDisapproveEquipmentItem = computed(() => {
|
|
51
|
-
if (!userAppRole.value) return
|
|
51
|
+
if (!userAppRole.value) return false;
|
|
52
52
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
53
53
|
return hasPermission(
|
|
54
54
|
userAppRole.value,
|
|
@@ -59,7 +59,7 @@ export function useEquipmentItemPermission() {
|
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
const canViewEquipmentItemDetails = computed(() => {
|
|
62
|
-
if (!userAppRole.value) return
|
|
62
|
+
if (!userAppRole.value) return false;
|
|
63
63
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
64
64
|
return hasPermission(
|
|
65
65
|
userAppRole.value,
|
|
@@ -8,7 +8,7 @@ export function useEquipmentManagementPermission() {
|
|
|
8
8
|
const { userAppRole } = useLocalSetup();
|
|
9
9
|
|
|
10
10
|
const canViewEquipments = computed(() => {
|
|
11
|
-
if (!userAppRole.value) return
|
|
11
|
+
if (!userAppRole.value) return false;
|
|
12
12
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
13
13
|
return hasPermission(
|
|
14
14
|
userAppRole.value,
|
|
@@ -19,7 +19,7 @@ export function useEquipmentManagementPermission() {
|
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
const canAddEquipment = computed(() => {
|
|
22
|
-
if (!userAppRole.value) return
|
|
22
|
+
if (!userAppRole.value) return false;
|
|
23
23
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
24
24
|
return hasPermission(
|
|
25
25
|
userAppRole.value,
|
|
@@ -30,7 +30,7 @@ export function useEquipmentManagementPermission() {
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
const canUpdateEquipment = computed(() => {
|
|
33
|
-
if (!userAppRole.value) return
|
|
33
|
+
if (!userAppRole.value) return false;
|
|
34
34
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
35
35
|
return hasPermission(
|
|
36
36
|
userAppRole.value,
|
|
@@ -41,7 +41,7 @@ export function useEquipmentManagementPermission() {
|
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
const canDeleteEquipment = computed(() => {
|
|
44
|
-
if (!userAppRole.value) return
|
|
44
|
+
if (!userAppRole.value) return false;
|
|
45
45
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
46
46
|
return hasPermission(
|
|
47
47
|
userAppRole.value,
|
|
@@ -52,7 +52,7 @@ export function useEquipmentManagementPermission() {
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
const canAddStock = computed(() => {
|
|
55
|
-
if (!userAppRole.value) return
|
|
55
|
+
if (!userAppRole.value) return false;
|
|
56
56
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
57
57
|
return hasPermission(
|
|
58
58
|
userAppRole.value,
|
|
@@ -63,7 +63,7 @@ export function useEquipmentManagementPermission() {
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
const canViewStock = computed(() => {
|
|
66
|
-
if (!userAppRole.value) return
|
|
66
|
+
if (!userAppRole.value) return false;
|
|
67
67
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
68
68
|
return hasPermission(
|
|
69
69
|
userAppRole.value,
|
|
@@ -74,7 +74,7 @@ export function useEquipmentManagementPermission() {
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
const canRequestItem = computed(() => {
|
|
77
|
-
if (!userAppRole.value) return
|
|
77
|
+
if (!userAppRole.value) return false;
|
|
78
78
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
79
79
|
return hasPermission(
|
|
80
80
|
userAppRole.value,
|
|
@@ -4,7 +4,7 @@ export function useEquipmentPermission() {
|
|
|
4
4
|
const { userAppRole } = useLocalSetup();
|
|
5
5
|
|
|
6
6
|
const canViewEquipments = computed(() => {
|
|
7
|
-
if (!userAppRole.value) return
|
|
7
|
+
if (!userAppRole.value) return false;
|
|
8
8
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
9
9
|
return hasPermission(
|
|
10
10
|
userAppRole.value,
|
|
@@ -15,7 +15,7 @@ export function useEquipmentPermission() {
|
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
const canAddEquipment = computed(() => {
|
|
18
|
-
if (!userAppRole.value) return
|
|
18
|
+
if (!userAppRole.value) return false;
|
|
19
19
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
20
20
|
return hasPermission(
|
|
21
21
|
userAppRole.value,
|
|
@@ -26,7 +26,7 @@ export function useEquipmentPermission() {
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const canUpdateEquipment = computed(() => {
|
|
29
|
-
if (!userAppRole.value) return
|
|
29
|
+
if (!userAppRole.value) return false;
|
|
30
30
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
31
31
|
return hasPermission(
|
|
32
32
|
userAppRole.value,
|
|
@@ -37,7 +37,7 @@ export function useEquipmentPermission() {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
const canDeleteEquipment = computed(() => {
|
|
40
|
-
if (!userAppRole.value) return
|
|
40
|
+
if (!userAppRole.value) return false;
|
|
41
41
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
42
42
|
return hasPermission(
|
|
43
43
|
userAppRole.value,
|
|
@@ -48,7 +48,7 @@ export function useEquipmentPermission() {
|
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
const canAddStock = computed(() => {
|
|
51
|
-
if (!userAppRole.value) return
|
|
51
|
+
if (!userAppRole.value) return false;
|
|
52
52
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
53
53
|
return hasPermission(
|
|
54
54
|
userAppRole.value,
|
|
@@ -59,7 +59,7 @@ export function useEquipmentPermission() {
|
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
const canViewStock = computed(() => {
|
|
62
|
-
if (!userAppRole.value) return
|
|
62
|
+
if (!userAppRole.value) return false;
|
|
63
63
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
64
64
|
return hasPermission(
|
|
65
65
|
userAppRole.value,
|
|
@@ -70,7 +70,7 @@ export function useEquipmentPermission() {
|
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
const canRequestItem = computed(() => {
|
|
73
|
-
if (!userAppRole.value) return
|
|
73
|
+
if (!userAppRole.value) return false;
|
|
74
74
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
75
75
|
return hasPermission(
|
|
76
76
|
userAppRole.value,
|