@goweekdays/layer-common 1.0.1 → 1.0.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/.playground/nuxt.config.ts +0 -1
- package/CHANGELOG.md +6 -0
- package/components/InvitationMain.vue +195 -0
- package/components/Layout/Header.vue +13 -4
- package/components/MemberMain.vue +452 -0
- package/components/RolePermissionMain.vue +1 -1
- package/composables/useCommonPermission.ts +61 -2
- package/composables/useLocal.ts +3 -28
- package/composables/useLocalAuth.ts +4 -0
- package/composables/useLocalSetup.ts +38 -0
- package/composables/useMember.ts +78 -60
- package/composables/useOrg.ts +12 -1
- package/composables/useUser.ts +9 -2
- package/composables/useUtils.ts +27 -0
- package/composables/useVerification.ts +3 -2
- package/nuxt.config.ts +1 -4
- package/package.json +1 -1
- package/types/role.d.ts +1 -1
- package/composables/useAdminPermission.ts +0 -127
|
@@ -15,7 +15,6 @@ export default defineNuxtConfig({
|
|
|
15
15
|
APP_ACCOUNT: (process.env.APP_ACCOUNT as string) ?? "",
|
|
16
16
|
S3_BUCKET_ENDPOINT: (process.env.S3_BUCKET_ENDPOINT as string) ?? "",
|
|
17
17
|
APP_ADMIN: (process.env.APP_ADMIN as string) ?? "",
|
|
18
|
-
APP_CBA_RECAP: (process.env.APP_CBA_RECAP as string) ?? "",
|
|
19
18
|
},
|
|
20
19
|
},
|
|
21
20
|
});
|
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row no-gutters>
|
|
3
|
+
<v-col cols="12" class="mb-2">
|
|
4
|
+
<v-row no-gutters>
|
|
5
|
+
<v-btn
|
|
6
|
+
class="text-none mr-2"
|
|
7
|
+
rounded="pill"
|
|
8
|
+
variant="tonal"
|
|
9
|
+
:to="props.inviteRoute"
|
|
10
|
+
size="large"
|
|
11
|
+
v-if="props.inviteMember"
|
|
12
|
+
>
|
|
13
|
+
Invite member
|
|
14
|
+
</v-btn>
|
|
15
|
+
</v-row>
|
|
16
|
+
</v-col>
|
|
17
|
+
|
|
18
|
+
<v-col cols="12">
|
|
19
|
+
<v-card
|
|
20
|
+
width="100%"
|
|
21
|
+
variant="outlined"
|
|
22
|
+
border="thin"
|
|
23
|
+
rounded="lg"
|
|
24
|
+
:loading="loading"
|
|
25
|
+
>
|
|
26
|
+
<v-toolbar density="compact" color="grey-lighten-4">
|
|
27
|
+
<template #prepend>
|
|
28
|
+
<v-btn fab icon density="comfortable" @click="getInvitations()">
|
|
29
|
+
<v-icon>mdi-refresh</v-icon>
|
|
30
|
+
</v-btn>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<template #append>
|
|
34
|
+
<v-row no-gutters justify="end" align="center">
|
|
35
|
+
<span class="mr-2 text-caption text-fontgray">
|
|
36
|
+
{{ pageRange }}
|
|
37
|
+
</span>
|
|
38
|
+
<local-pagination
|
|
39
|
+
v-model="page"
|
|
40
|
+
:length="pages"
|
|
41
|
+
@update:value="getInvitations()"
|
|
42
|
+
/>
|
|
43
|
+
</v-row>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<template #extension>
|
|
47
|
+
<v-tabs>
|
|
48
|
+
<v-tab
|
|
49
|
+
:to="{
|
|
50
|
+
name: 'org-organization-invitations-status-status',
|
|
51
|
+
params: { status: 'pending', organization },
|
|
52
|
+
}"
|
|
53
|
+
>
|
|
54
|
+
Pending
|
|
55
|
+
</v-tab>
|
|
56
|
+
<v-tab
|
|
57
|
+
:to="{
|
|
58
|
+
name: 'org-organization-invitations-status-status',
|
|
59
|
+
params: { status: 'expired', organization },
|
|
60
|
+
}"
|
|
61
|
+
>
|
|
62
|
+
Expired
|
|
63
|
+
</v-tab>
|
|
64
|
+
</v-tabs>
|
|
65
|
+
</template>
|
|
66
|
+
</v-toolbar>
|
|
67
|
+
|
|
68
|
+
<v-data-table
|
|
69
|
+
:headers="headers"
|
|
70
|
+
:items="items"
|
|
71
|
+
item-value="_id"
|
|
72
|
+
items-per-page="20"
|
|
73
|
+
fixed-header
|
|
74
|
+
hide-default-footer
|
|
75
|
+
hide-default-header
|
|
76
|
+
class="table-height"
|
|
77
|
+
:loading="loading"
|
|
78
|
+
@click:row="tableRowClickHandler"
|
|
79
|
+
>
|
|
80
|
+
<template #item.permissions="{ value }">
|
|
81
|
+
<span class="text-caption font-weight-bold text-capitalize">
|
|
82
|
+
permissions
|
|
83
|
+
</span>
|
|
84
|
+
<v-chip>{{ value.length }}</v-chip>
|
|
85
|
+
</template>
|
|
86
|
+
</v-data-table>
|
|
87
|
+
</v-card>
|
|
88
|
+
</v-col>
|
|
89
|
+
</v-row>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<script setup lang="ts">
|
|
93
|
+
const props = defineProps({
|
|
94
|
+
status: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: "active",
|
|
97
|
+
},
|
|
98
|
+
app: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: "organization",
|
|
101
|
+
},
|
|
102
|
+
inviteMember: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: false,
|
|
105
|
+
},
|
|
106
|
+
inviteRoute: {
|
|
107
|
+
type: Object as PropType<Record<string, any>>,
|
|
108
|
+
default: () => ({
|
|
109
|
+
name: "index",
|
|
110
|
+
params: {},
|
|
111
|
+
}),
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const organization = (useRoute().params.organization as string) ?? "";
|
|
116
|
+
|
|
117
|
+
const headers = [
|
|
118
|
+
{
|
|
119
|
+
title: "Date",
|
|
120
|
+
value: "createdAt",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
title: "E-mail",
|
|
124
|
+
value: "email",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
title: "App",
|
|
128
|
+
value: "metadata.app",
|
|
129
|
+
},
|
|
130
|
+
];
|
|
131
|
+
|
|
132
|
+
const { getVerifications } = useVerification();
|
|
133
|
+
|
|
134
|
+
const page = ref(1);
|
|
135
|
+
const pages = ref(0);
|
|
136
|
+
const pageRange = ref("-- - -- of --");
|
|
137
|
+
|
|
138
|
+
const items = ref<Array<Record<string, any>>>([]);
|
|
139
|
+
const { headerSearch } = useLocal();
|
|
140
|
+
|
|
141
|
+
const {
|
|
142
|
+
data: getInviteReq,
|
|
143
|
+
refresh: getInvitations,
|
|
144
|
+
status: getInviteReqStatus,
|
|
145
|
+
} = await useLazyAsyncData("get-invitations", () =>
|
|
146
|
+
getVerifications({
|
|
147
|
+
page: page.value,
|
|
148
|
+
search: headerSearch.value,
|
|
149
|
+
status: props.status,
|
|
150
|
+
type: "user-invite,member-invite",
|
|
151
|
+
app: props.app,
|
|
152
|
+
})
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
const loading = computed(() => getInviteReqStatus.value === "pending");
|
|
156
|
+
|
|
157
|
+
watchEffect(() => {
|
|
158
|
+
if (getInviteReq.value) {
|
|
159
|
+
const _items = getInviteReq.value.items;
|
|
160
|
+
items.value = _items.length
|
|
161
|
+
? _items.map((i: Record<string, any>) => ({
|
|
162
|
+
...i,
|
|
163
|
+
createdAt: new Date(i.createdAt).toLocaleString(),
|
|
164
|
+
}))
|
|
165
|
+
: [];
|
|
166
|
+
pages.value = getInviteReq.value.pages;
|
|
167
|
+
pageRange.value = getInviteReq.value.pageRange;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
function tableRowClickHandler(_: any, row: any) {
|
|
172
|
+
const item = items.value[row.index];
|
|
173
|
+
useRouter().push({
|
|
174
|
+
name: "roles-permissions-id",
|
|
175
|
+
params: { id: item._id },
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const selected = ref<Array<string>>([]);
|
|
180
|
+
const selectAll = ref(false);
|
|
181
|
+
|
|
182
|
+
watch(selectAll, (curr) => {
|
|
183
|
+
selected.value.splice(0, selected.value.length);
|
|
184
|
+
if (curr) {
|
|
185
|
+
const ids = items.value.map((i) => i._id as string);
|
|
186
|
+
selected.value.push(...ids);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
</script>
|
|
190
|
+
|
|
191
|
+
<style scoped>
|
|
192
|
+
.table-height {
|
|
193
|
+
max-height: calc(100vh - (220px));
|
|
194
|
+
}
|
|
195
|
+
</style>
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
</div>
|
|
12
12
|
|
|
13
13
|
<v-row no-gutters>
|
|
14
|
-
<v-col cols="6">
|
|
14
|
+
<v-col cols="12" lg="6" md="9">
|
|
15
15
|
<v-text-field
|
|
16
|
-
v-model="
|
|
16
|
+
v-model="_search"
|
|
17
17
|
width="100%"
|
|
18
18
|
prepend-inner-icon="mdi-magnify"
|
|
19
19
|
variant="solo-filled"
|
|
@@ -171,8 +171,19 @@
|
|
|
171
171
|
<script setup lang="ts">
|
|
172
172
|
import { useTheme } from "vuetify";
|
|
173
173
|
|
|
174
|
+
const { getNameInitials, debounce } = useUtils();
|
|
175
|
+
|
|
176
|
+
const _search = ref("");
|
|
177
|
+
|
|
174
178
|
const search = defineModel("search", { type: String });
|
|
175
179
|
|
|
180
|
+
watch(
|
|
181
|
+
_search,
|
|
182
|
+
debounce((value) => {
|
|
183
|
+
search.value = value;
|
|
184
|
+
}, 1000)
|
|
185
|
+
);
|
|
186
|
+
|
|
176
187
|
const { redirect, apps, drawer } = useLocal();
|
|
177
188
|
|
|
178
189
|
const {
|
|
@@ -219,8 +230,6 @@ const name = computed(() => {
|
|
|
219
230
|
return name;
|
|
220
231
|
});
|
|
221
232
|
|
|
222
|
-
const { getNameInitials } = useUtils();
|
|
223
|
-
|
|
224
233
|
const defaultApps = computed(() => [
|
|
225
234
|
{
|
|
226
235
|
title: "Account",
|
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row no-gutters>
|
|
3
|
+
<v-col v-if="props.seatManagement !== 'index'" cols="12" class="mb-2">
|
|
4
|
+
<v-row no-gutters>
|
|
5
|
+
<v-btn
|
|
6
|
+
class="text-none"
|
|
7
|
+
rounded="pill"
|
|
8
|
+
variant="tonal"
|
|
9
|
+
:to="{
|
|
10
|
+
name: props.seatManagement,
|
|
11
|
+
params: { organization: props.orgId },
|
|
12
|
+
}"
|
|
13
|
+
size="large"
|
|
14
|
+
>
|
|
15
|
+
Manage seats
|
|
16
|
+
</v-btn>
|
|
17
|
+
</v-row>
|
|
18
|
+
</v-col>
|
|
19
|
+
|
|
20
|
+
<v-col cols="12">
|
|
21
|
+
<v-card width="100%" variant="outlined" border="thin" rounded="lg">
|
|
22
|
+
<v-toolbar density="compact" color="grey-lighten-4">
|
|
23
|
+
<template #prepend>
|
|
24
|
+
<v-btn fab icon density="comfortable" @click="getAll()">
|
|
25
|
+
<v-icon>mdi-refresh</v-icon>
|
|
26
|
+
</v-btn>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<template #append>
|
|
30
|
+
<v-row no-gutters justify="end" align="center">
|
|
31
|
+
<span class="mr-2 text-caption text-font gray">
|
|
32
|
+
{{ pageRange }}
|
|
33
|
+
</span>
|
|
34
|
+
<local-pagination
|
|
35
|
+
v-model="page"
|
|
36
|
+
:length="pages"
|
|
37
|
+
@update:value="getAll()"
|
|
38
|
+
/>
|
|
39
|
+
</v-row>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<template #extension>
|
|
43
|
+
<v-tabs>
|
|
44
|
+
<v-tab
|
|
45
|
+
v-for="tab in [
|
|
46
|
+
{ name: 'Active', status: 'active' },
|
|
47
|
+
{ name: 'Suspended', status: 'suspended' },
|
|
48
|
+
]"
|
|
49
|
+
:key="tab.status"
|
|
50
|
+
:to="{
|
|
51
|
+
name: props.route,
|
|
52
|
+
params: setRouteParams({
|
|
53
|
+
status: tab.status,
|
|
54
|
+
organization: props.orgId,
|
|
55
|
+
}),
|
|
56
|
+
}"
|
|
57
|
+
>
|
|
58
|
+
{{ tab.name }}
|
|
59
|
+
</v-tab>
|
|
60
|
+
</v-tabs>
|
|
61
|
+
</template>
|
|
62
|
+
</v-toolbar>
|
|
63
|
+
|
|
64
|
+
<v-data-table
|
|
65
|
+
:headers="props.headers"
|
|
66
|
+
:items="items"
|
|
67
|
+
item-value="_id"
|
|
68
|
+
items-per-page="20"
|
|
69
|
+
fixed-header
|
|
70
|
+
hide-default-footer
|
|
71
|
+
style="max-height: calc(100vh - (126px))"
|
|
72
|
+
:loading="loading"
|
|
73
|
+
>
|
|
74
|
+
<template #item.nature="{ item }">
|
|
75
|
+
{{ replaceMatch(item.nature, "_", " ") }}
|
|
76
|
+
</template>
|
|
77
|
+
<template #item.action-table="{ item }">
|
|
78
|
+
<v-menu
|
|
79
|
+
v-if="
|
|
80
|
+
(status === 'active' &&
|
|
81
|
+
(canSuspendMembers || canDeleteMembers)) ||
|
|
82
|
+
(status === 'suspended' &&
|
|
83
|
+
(canActivateMembers || canDeleteMembers))
|
|
84
|
+
"
|
|
85
|
+
v-model="item.menuOpen"
|
|
86
|
+
offset-y
|
|
87
|
+
width="150"
|
|
88
|
+
>
|
|
89
|
+
<template v-slot:activator="{ props }">
|
|
90
|
+
<v-icon v-bind="props">mdi-dots-horizontal</v-icon>
|
|
91
|
+
</template>
|
|
92
|
+
<v-list>
|
|
93
|
+
<v-list-item
|
|
94
|
+
v-if="props.assignRole"
|
|
95
|
+
@click="
|
|
96
|
+
setMember({
|
|
97
|
+
dialog: true,
|
|
98
|
+
mode: 'assign-role',
|
|
99
|
+
role: item,
|
|
100
|
+
})
|
|
101
|
+
"
|
|
102
|
+
>
|
|
103
|
+
Assign Role
|
|
104
|
+
</v-list-item>
|
|
105
|
+
|
|
106
|
+
<v-list-item
|
|
107
|
+
v-if="status === 'active' && canSuspendMembers"
|
|
108
|
+
@click="openUpdateDialog(item.user, 'suspended')"
|
|
109
|
+
>
|
|
110
|
+
Suspend
|
|
111
|
+
</v-list-item>
|
|
112
|
+
<v-list-item
|
|
113
|
+
v-if="status === 'suspended' && canActivateMembers"
|
|
114
|
+
@click="openUpdateDialog(item.user, 'active')"
|
|
115
|
+
>
|
|
116
|
+
Activate
|
|
117
|
+
</v-list-item>
|
|
118
|
+
<v-list-item
|
|
119
|
+
v-if="canDeleteMembers"
|
|
120
|
+
@click="openUpdateDialog(item.user, 'deleted')"
|
|
121
|
+
>
|
|
122
|
+
Delete
|
|
123
|
+
</v-list-item>
|
|
124
|
+
</v-list>
|
|
125
|
+
</v-menu>
|
|
126
|
+
</template>
|
|
127
|
+
</v-data-table>
|
|
128
|
+
</v-card>
|
|
129
|
+
</v-col>
|
|
130
|
+
<ConfirmDialog
|
|
131
|
+
v-model="confirmDialog"
|
|
132
|
+
:loading="updateLoading"
|
|
133
|
+
@submit="handleUpdateMemberStatus"
|
|
134
|
+
>
|
|
135
|
+
<template #title>
|
|
136
|
+
<span class="font-weight-medium text-h5">
|
|
137
|
+
{{ updateActionText }} Member</span
|
|
138
|
+
>
|
|
139
|
+
</template>
|
|
140
|
+
|
|
141
|
+
<template #description>
|
|
142
|
+
<p class="text-subtitle-2">
|
|
143
|
+
Are you sure you want to {{ updateActionText }} this Member? This
|
|
144
|
+
action cannot be undone.
|
|
145
|
+
</p>
|
|
146
|
+
</template>
|
|
147
|
+
|
|
148
|
+
<template #footer>
|
|
149
|
+
<v-btn
|
|
150
|
+
variant="text"
|
|
151
|
+
@click="confirmDialog = false"
|
|
152
|
+
:disabled="updateLoading"
|
|
153
|
+
>
|
|
154
|
+
Close
|
|
155
|
+
</v-btn>
|
|
156
|
+
<v-btn
|
|
157
|
+
color="primary"
|
|
158
|
+
variant="flat"
|
|
159
|
+
@click="handleUpdateMemberStatus"
|
|
160
|
+
:loading="updateLoading"
|
|
161
|
+
>
|
|
162
|
+
{{ updateActionText }} Member
|
|
163
|
+
</v-btn>
|
|
164
|
+
</template>
|
|
165
|
+
</ConfirmDialog>
|
|
166
|
+
|
|
167
|
+
<Snackbar v-model="messageSnackbar" :text="message" :color="messageColor" />
|
|
168
|
+
|
|
169
|
+
<v-dialog v-model="assignRoleDialog" max-width="400px">
|
|
170
|
+
<v-card>
|
|
171
|
+
<v-card-title class="text-h5">Assign Role</v-card-title>
|
|
172
|
+
<v-card-text>
|
|
173
|
+
<v-form v-model="memberRoleForm" @submit.prevent="updateMemberRole()">
|
|
174
|
+
<v-row no-gutters>
|
|
175
|
+
<v-col cols="12" class="mb-2">
|
|
176
|
+
<v-row no-gutters>
|
|
177
|
+
<InputLabel class="text-capitalize" title="Name" required />
|
|
178
|
+
<v-col cols="12">
|
|
179
|
+
<v-select
|
|
180
|
+
v-model="selectedRole"
|
|
181
|
+
:items="roles"
|
|
182
|
+
item-value="_id"
|
|
183
|
+
item-title="name"
|
|
184
|
+
density="comfortable"
|
|
185
|
+
:rules="[requiredRule]"
|
|
186
|
+
:error-messages="
|
|
187
|
+
selectedRole === selectedMemberRole
|
|
188
|
+
? 'Role already assigned'
|
|
189
|
+
: ''
|
|
190
|
+
"
|
|
191
|
+
persistent-hint
|
|
192
|
+
></v-select>
|
|
193
|
+
</v-col>
|
|
194
|
+
|
|
195
|
+
<v-col cols="12" class="text-error text-center">
|
|
196
|
+
{{ message }}
|
|
197
|
+
</v-col>
|
|
198
|
+
</v-row>
|
|
199
|
+
</v-col>
|
|
200
|
+
|
|
201
|
+
<v-col cols="12">
|
|
202
|
+
<v-row>
|
|
203
|
+
<v-col cols="6">
|
|
204
|
+
<v-btn
|
|
205
|
+
block
|
|
206
|
+
variant="text"
|
|
207
|
+
@click="setMember({ mode: 'assign-role' })"
|
|
208
|
+
>
|
|
209
|
+
Cancel
|
|
210
|
+
</v-btn>
|
|
211
|
+
</v-col>
|
|
212
|
+
<v-col cols="6">
|
|
213
|
+
<v-btn
|
|
214
|
+
block
|
|
215
|
+
variant="flat"
|
|
216
|
+
color="black"
|
|
217
|
+
:disabled="!memberRoleForm"
|
|
218
|
+
type="submit"
|
|
219
|
+
>
|
|
220
|
+
Submit
|
|
221
|
+
</v-btn>
|
|
222
|
+
</v-col>
|
|
223
|
+
</v-row>
|
|
224
|
+
</v-col>
|
|
225
|
+
</v-row>
|
|
226
|
+
</v-form>
|
|
227
|
+
</v-card-text>
|
|
228
|
+
</v-card>
|
|
229
|
+
</v-dialog>
|
|
230
|
+
</v-row>
|
|
231
|
+
</template>
|
|
232
|
+
|
|
233
|
+
<script setup lang="ts">
|
|
234
|
+
const props = defineProps({
|
|
235
|
+
orgId: {
|
|
236
|
+
type: String,
|
|
237
|
+
default: "",
|
|
238
|
+
},
|
|
239
|
+
customerId: {
|
|
240
|
+
type: String,
|
|
241
|
+
default: "",
|
|
242
|
+
},
|
|
243
|
+
siteId: {
|
|
244
|
+
type: String,
|
|
245
|
+
default: "",
|
|
246
|
+
},
|
|
247
|
+
status: {
|
|
248
|
+
type: String,
|
|
249
|
+
default: "active",
|
|
250
|
+
},
|
|
251
|
+
type: {
|
|
252
|
+
type: String,
|
|
253
|
+
default: "organization",
|
|
254
|
+
},
|
|
255
|
+
seatManagement: {
|
|
256
|
+
type: String,
|
|
257
|
+
default: "index",
|
|
258
|
+
},
|
|
259
|
+
inviteMember: {
|
|
260
|
+
type: String,
|
|
261
|
+
default: "index",
|
|
262
|
+
},
|
|
263
|
+
route: {
|
|
264
|
+
type: String,
|
|
265
|
+
default: "index",
|
|
266
|
+
},
|
|
267
|
+
canActivateMembers: {
|
|
268
|
+
type: Boolean,
|
|
269
|
+
default: false,
|
|
270
|
+
},
|
|
271
|
+
canSuspendMembers: {
|
|
272
|
+
type: Boolean,
|
|
273
|
+
default: false,
|
|
274
|
+
},
|
|
275
|
+
canDeleteMembers: {
|
|
276
|
+
type: Boolean,
|
|
277
|
+
default: false,
|
|
278
|
+
},
|
|
279
|
+
assignRole: {
|
|
280
|
+
type: Boolean,
|
|
281
|
+
default: false,
|
|
282
|
+
},
|
|
283
|
+
headers: {
|
|
284
|
+
type: Array as PropType<Array<Record<string, string>>>,
|
|
285
|
+
default: () => [
|
|
286
|
+
{
|
|
287
|
+
title: "Name",
|
|
288
|
+
|
|
289
|
+
value: "name",
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
title: "Role",
|
|
293
|
+
|
|
294
|
+
value: "roleName",
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
title: "Organization",
|
|
298
|
+
|
|
299
|
+
value: "orgName",
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
title: "Action",
|
|
303
|
+
value: "action-table",
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
},
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
const items = ref<Array<Record<string, any>>>([]);
|
|
310
|
+
const page = ref(1);
|
|
311
|
+
const pages = ref(10);
|
|
312
|
+
const pageRange = ref("-- - -- of --");
|
|
313
|
+
|
|
314
|
+
const message = ref("");
|
|
315
|
+
const messageSnackbar = ref(false);
|
|
316
|
+
const messageColor = ref("");
|
|
317
|
+
|
|
318
|
+
const {
|
|
319
|
+
getAll: _getAll,
|
|
320
|
+
updateMemberStatus: _updateMemberStatus,
|
|
321
|
+
updateMemberRole: _updateMemberRole,
|
|
322
|
+
} = useMember();
|
|
323
|
+
|
|
324
|
+
const { headerSearch } = useLocal();
|
|
325
|
+
const { replaceMatch, setRouteParams, requiredRule } = useUtils();
|
|
326
|
+
|
|
327
|
+
const {
|
|
328
|
+
data: getAllReq,
|
|
329
|
+
refresh: getAll,
|
|
330
|
+
status: getAllReqStatus,
|
|
331
|
+
} = useLazyAsyncData("get-all-members-by-status" + props.status, () =>
|
|
332
|
+
_getAll({
|
|
333
|
+
status: props.status,
|
|
334
|
+
org: props.orgId,
|
|
335
|
+
search: headerSearch.value,
|
|
336
|
+
page: page.value,
|
|
337
|
+
type: props.type,
|
|
338
|
+
})
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
const loading = computed(() => getAllReqStatus.value === "pending");
|
|
342
|
+
|
|
343
|
+
watchEffect(() => {
|
|
344
|
+
if (getAllReq.value) {
|
|
345
|
+
items.value = getAllReq.value.items;
|
|
346
|
+
pages.value = getAllReq.value.pages;
|
|
347
|
+
pageRange.value = getAllReq.value.pageRange;
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
watch(headerSearch, () => {
|
|
352
|
+
getAll();
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
const confirmDialog = ref(false);
|
|
356
|
+
const selectedMemberId = ref<string | null>(null);
|
|
357
|
+
const updateLoading = ref(false);
|
|
358
|
+
const updateAction = ref("");
|
|
359
|
+
|
|
360
|
+
const memberRoleForm = ref(false);
|
|
361
|
+
const assignRoleDialog = ref(false);
|
|
362
|
+
const selectedRole = ref<string | null>(null);
|
|
363
|
+
const selectedMemberRole = ref("");
|
|
364
|
+
|
|
365
|
+
function setMember({
|
|
366
|
+
dialog = false,
|
|
367
|
+
mode = "",
|
|
368
|
+
role = {} as Record<string, any>,
|
|
369
|
+
} = {}) {
|
|
370
|
+
if (mode === "assign-role") {
|
|
371
|
+
assignRoleDialog.value = dialog;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
selectedMemberId.value = role._id;
|
|
375
|
+
selectedRole.value = role.role;
|
|
376
|
+
selectedMemberRole.value = role.role;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
const roles = ref<Array<Record<string, any>>>([]);
|
|
380
|
+
const { getRoles } = useRole();
|
|
381
|
+
const { data: getAllRoleReq } = useLazyAsyncData("get-roles", () =>
|
|
382
|
+
getRoles({ org: props.orgId, type: props.type, limit: 20 })
|
|
383
|
+
);
|
|
384
|
+
|
|
385
|
+
watchEffect(() => {
|
|
386
|
+
if (getAllRoleReq.value) {
|
|
387
|
+
roles.value = getAllRoleReq.value.items;
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
watchEffect(() => {
|
|
392
|
+
if (selectedRole.value) {
|
|
393
|
+
message.value = "";
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
async function updateMemberRole() {
|
|
398
|
+
try {
|
|
399
|
+
await _updateMemberRole(
|
|
400
|
+
selectedMemberId.value ?? "",
|
|
401
|
+
selectedRole.value ?? "",
|
|
402
|
+
props.type,
|
|
403
|
+
props.orgId
|
|
404
|
+
);
|
|
405
|
+
await setMember({ mode: "assign-role" });
|
|
406
|
+
await getAll();
|
|
407
|
+
} catch (error: any) {
|
|
408
|
+
message.value = error?.response?._data?.message || "Failed to update role";
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
function openUpdateDialog(id: string, action: string) {
|
|
413
|
+
updateAction.value = action;
|
|
414
|
+
selectedMemberId.value = id;
|
|
415
|
+
confirmDialog.value = true;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
function showMessage(msg: string, color: string) {
|
|
419
|
+
message.value = msg;
|
|
420
|
+
messageColor.value = color;
|
|
421
|
+
messageSnackbar.value = true;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
async function handleUpdateMemberStatus() {
|
|
425
|
+
if (!selectedMemberId.value) return;
|
|
426
|
+
updateLoading.value = true;
|
|
427
|
+
try {
|
|
428
|
+
const res = await _updateMemberStatus(
|
|
429
|
+
selectedMemberId.value,
|
|
430
|
+
updateAction.value
|
|
431
|
+
);
|
|
432
|
+
|
|
433
|
+
confirmDialog.value = false;
|
|
434
|
+
showMessage(res.message, "success");
|
|
435
|
+
getAll();
|
|
436
|
+
} catch (error: any) {
|
|
437
|
+
const errorMessage = error?.response?._data?.message;
|
|
438
|
+
showMessage(errorMessage, "error");
|
|
439
|
+
} finally {
|
|
440
|
+
updateLoading.value = false;
|
|
441
|
+
selectedMemberId.value = null;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
const updateActionText = computed(() => {
|
|
445
|
+
const map: Record<string, string> = {
|
|
446
|
+
active: "Activate",
|
|
447
|
+
suspended: "Suspend",
|
|
448
|
+
deleted: "Delete",
|
|
449
|
+
};
|
|
450
|
+
return map[updateAction.value] || updateAction.value;
|
|
451
|
+
});
|
|
452
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function useCommonPermissions() {
|
|
2
|
-
const
|
|
2
|
+
const invitationPermissions: Record<string, TPermission> = {
|
|
3
3
|
"create-invitation": {
|
|
4
4
|
check: true,
|
|
5
5
|
description:
|
|
@@ -23,6 +23,11 @@ export function useCommonPermissions() {
|
|
|
23
23
|
description:
|
|
24
24
|
"Allows the user to view the list of all members in the organization.",
|
|
25
25
|
},
|
|
26
|
+
"assign-member-role": {
|
|
27
|
+
check: true,
|
|
28
|
+
description:
|
|
29
|
+
"Allows the user to assign a specific role to a member in the organization.",
|
|
30
|
+
},
|
|
26
31
|
"suspend-member": {
|
|
27
32
|
check: true,
|
|
28
33
|
description: "Allows the user to suspend a member's account temporarily.",
|
|
@@ -63,9 +68,63 @@ export function useCommonPermissions() {
|
|
|
63
68
|
},
|
|
64
69
|
};
|
|
65
70
|
|
|
71
|
+
const feedbackPermissions: Record<string, TPermission> = {
|
|
72
|
+
"add-feedback": {
|
|
73
|
+
check: true,
|
|
74
|
+
description: "Allows the user to create a new feedback.",
|
|
75
|
+
},
|
|
76
|
+
"see-all-feedback": {
|
|
77
|
+
check: true,
|
|
78
|
+
description: "Allows the user to view the list of all feedback.",
|
|
79
|
+
},
|
|
80
|
+
"see-feedback-details": {
|
|
81
|
+
check: true,
|
|
82
|
+
description:
|
|
83
|
+
"Allows the user to view the details of a specific feedback.",
|
|
84
|
+
},
|
|
85
|
+
"delete-feedback": {
|
|
86
|
+
check: true,
|
|
87
|
+
description:
|
|
88
|
+
"Allows the user to remove a feedback from the system permanently.",
|
|
89
|
+
},
|
|
90
|
+
"update-feedback": {
|
|
91
|
+
check: true,
|
|
92
|
+
description:
|
|
93
|
+
"Allows the user to update the details of an existing feedback.",
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const workOrderPermissions: Record<string, TPermission> = {
|
|
98
|
+
"create-work-order": {
|
|
99
|
+
check: true,
|
|
100
|
+
description: "Allows the user to create a new work order.",
|
|
101
|
+
},
|
|
102
|
+
"see-all-work-orders": {
|
|
103
|
+
check: true,
|
|
104
|
+
description: "Allows the user to view the list of all work orders.",
|
|
105
|
+
},
|
|
106
|
+
"see-work-order-details": {
|
|
107
|
+
check: true,
|
|
108
|
+
description:
|
|
109
|
+
"Allows the user to view the details of a specific work order.",
|
|
110
|
+
},
|
|
111
|
+
"delete-work-order": {
|
|
112
|
+
check: true,
|
|
113
|
+
description:
|
|
114
|
+
"Allows the user to remove a work order from the system permanently.",
|
|
115
|
+
},
|
|
116
|
+
"update-work-order": {
|
|
117
|
+
check: true,
|
|
118
|
+
description:
|
|
119
|
+
"Allows the user to update the details of an existing work order.",
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
66
123
|
return {
|
|
67
|
-
|
|
124
|
+
invitationPermissions,
|
|
68
125
|
memberPermissions,
|
|
69
126
|
rolePermissions,
|
|
127
|
+
feedbackPermissions,
|
|
128
|
+
workOrderPermissions,
|
|
70
129
|
};
|
|
71
130
|
}
|
package/composables/useLocal.ts
CHANGED
|
@@ -9,28 +9,15 @@ export default function useLocal() {
|
|
|
9
9
|
|
|
10
10
|
const drawer = useState("drawer", () => true);
|
|
11
11
|
|
|
12
|
-
const {
|
|
13
|
-
APP_INVENTORY,
|
|
14
|
-
APP_ASSET,
|
|
15
|
-
APP_BOOK_KEEPING,
|
|
16
|
-
APP_ACCOUNTING,
|
|
17
|
-
APP_ZONAL,
|
|
18
|
-
APP_SCHOOL,
|
|
19
|
-
} = appConfig;
|
|
12
|
+
const { APP_INVENTORY, APP_ASSET, APP_FINANCE } = appConfig;
|
|
20
13
|
const { currentOrg } = useOrg();
|
|
21
14
|
|
|
22
15
|
const apps = computed(() => {
|
|
23
16
|
return [
|
|
24
17
|
{
|
|
25
|
-
title: "
|
|
18
|
+
title: "Finance",
|
|
26
19
|
icon: "mdi-file-document-multiple",
|
|
27
|
-
link:
|
|
28
|
-
landingPage: `org/${currentOrg.value ?? ""}`,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
title: "Bookkeeping",
|
|
32
|
-
icon: "mdi-file-document-edit-outline",
|
|
33
|
-
link: APP_BOOK_KEEPING as string,
|
|
20
|
+
link: APP_FINANCE as string,
|
|
34
21
|
landingPage: `org/${currentOrg.value ?? ""}`,
|
|
35
22
|
},
|
|
36
23
|
{
|
|
@@ -45,18 +32,6 @@ export default function useLocal() {
|
|
|
45
32
|
link: APP_ASSET as string,
|
|
46
33
|
landingPage: `org/${currentOrg.value ?? ""}`,
|
|
47
34
|
},
|
|
48
|
-
{
|
|
49
|
-
title: "Zonal",
|
|
50
|
-
icon: "mdi-hospital-marker",
|
|
51
|
-
link: APP_ZONAL as string,
|
|
52
|
-
landingPage: `org/${currentOrg.value ?? ""}`,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
title: "School",
|
|
56
|
-
icon: "mdi-school",
|
|
57
|
-
link: APP_SCHOOL as string,
|
|
58
|
-
landingPage: `org/${currentOrg.value ?? ""}`,
|
|
59
|
-
},
|
|
60
35
|
];
|
|
61
36
|
});
|
|
62
37
|
|
|
@@ -4,6 +4,10 @@ export default function useLocalAuth() {
|
|
|
4
4
|
const currentUser = useState<TUser | null>("currentUser", () => null);
|
|
5
5
|
|
|
6
6
|
function authenticate() {
|
|
7
|
+
if (currentUser.value) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
// Get access token from cookies
|
|
8
12
|
const accessToken = useCookie("accessToken", cookieConfig).value;
|
|
9
13
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export function useLocalSetup(type: string) {
|
|
2
|
+
const { currentUser } = useLocalAuth();
|
|
3
|
+
|
|
4
|
+
const userId = computed(() => currentUser.value?._id ?? "");
|
|
5
|
+
|
|
6
|
+
const { getByUserIdType } = useMember();
|
|
7
|
+
|
|
8
|
+
const { data: userMemberData } = useLazyAsyncData(
|
|
9
|
+
"get-member-by-id",
|
|
10
|
+
() => getByUserIdType(userId.value, type),
|
|
11
|
+
{ watch: [userId], immediate: false }
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const { getRoleById } = useRole();
|
|
15
|
+
|
|
16
|
+
const roleId = computed(() => userMemberData.value?.role ?? "");
|
|
17
|
+
|
|
18
|
+
const userAppRole = useState<Record<string, any> | null>(
|
|
19
|
+
"userAppRole",
|
|
20
|
+
() => null
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const { data: getRoleByIdReq } = useLazyAsyncData(
|
|
24
|
+
"get-role-by-id",
|
|
25
|
+
() => getRoleById(roleId.value),
|
|
26
|
+
{ watch: [roleId], immediate: false }
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
watchEffect(() => {
|
|
30
|
+
if (getRoleByIdReq.value) {
|
|
31
|
+
userAppRole.value = getRoleByIdReq.value;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
userAppRole,
|
|
37
|
+
};
|
|
38
|
+
}
|
package/composables/useMember.ts
CHANGED
|
@@ -1,86 +1,104 @@
|
|
|
1
1
|
export default function useMember() {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
user: "",
|
|
7
|
-
role: "",
|
|
8
|
-
status: "",
|
|
9
|
-
createdAt: "",
|
|
10
|
-
updatedAt: "",
|
|
11
|
-
deletedAt: "",
|
|
12
|
-
};
|
|
13
|
-
});
|
|
2
|
+
const members = useState<Array<TMember>>("members", () => []);
|
|
3
|
+
const page = useState("page", () => 1);
|
|
4
|
+
const pages = useState("pages", () => 0);
|
|
5
|
+
const pageRange = useState("pageRange", () => "-- - -- of --");
|
|
14
6
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
const member = useState<TMember>("member", () => ({
|
|
8
|
+
_id: "",
|
|
9
|
+
org: "",
|
|
10
|
+
orgName: "",
|
|
11
|
+
roleName: "",
|
|
12
|
+
name: "",
|
|
13
|
+
user: "",
|
|
14
|
+
role: "",
|
|
15
|
+
type: "",
|
|
16
|
+
customerOrgId: "",
|
|
17
|
+
customerSiteId: "",
|
|
18
|
+
status: "",
|
|
19
|
+
createdAt: "",
|
|
20
|
+
updatedAt: "",
|
|
21
|
+
deletedAt: "",
|
|
22
|
+
}));
|
|
24
23
|
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
delete value._id;
|
|
29
|
-
delete value.status;
|
|
24
|
+
function getByUserId(user: string) {
|
|
25
|
+
return useNuxtApp().$api<TMember>(`/api/members/user/${user}`);
|
|
26
|
+
}
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
body: JSON.stringify(value),
|
|
34
|
-
});
|
|
28
|
+
function getByUserIdType(user: string, type: string) {
|
|
29
|
+
return useNuxtApp().$api<TMember>(`/api/members/user/${user}/app/${type}`);
|
|
35
30
|
}
|
|
36
31
|
|
|
37
|
-
function getAll({
|
|
38
|
-
search = "",
|
|
32
|
+
async function getAll({
|
|
39
33
|
page = 1,
|
|
40
|
-
|
|
41
|
-
user = "",
|
|
42
|
-
type = "main",
|
|
34
|
+
search = "",
|
|
43
35
|
limit = 10,
|
|
36
|
+
user = "",
|
|
37
|
+
org = "",
|
|
38
|
+
type = "",
|
|
44
39
|
status = "active",
|
|
45
40
|
} = {}) {
|
|
46
|
-
return useNuxtApp().$api<
|
|
41
|
+
return useNuxtApp().$api<Record<string, any>>("/api/members", {
|
|
47
42
|
method: "GET",
|
|
48
|
-
query: {
|
|
43
|
+
query: { page, limit, search, user, org, type, status },
|
|
49
44
|
});
|
|
50
45
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
function createUserByVerification(
|
|
47
|
+
verificationId: string,
|
|
48
|
+
payload: Record<string, any>
|
|
49
|
+
) {
|
|
50
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
51
|
+
`/api/users/invite/${verificationId}`,
|
|
52
|
+
{
|
|
53
|
+
method: "POST",
|
|
54
|
+
body: payload,
|
|
55
|
+
}
|
|
56
|
+
);
|
|
60
57
|
}
|
|
61
58
|
|
|
62
|
-
function
|
|
63
|
-
return useNuxtApp().$api<TMember>(
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
function createMemberInvite(verificatonId: string) {
|
|
60
|
+
return useNuxtApp().$api<TMember>(
|
|
61
|
+
`/api/members/verification/${verificatonId}`,
|
|
62
|
+
{
|
|
63
|
+
method: "POST",
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
function updateMemberStatus(id: string, status: string) {
|
|
68
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
69
|
+
`/api/members/status/${status}/id/${id}`,
|
|
70
|
+
{
|
|
71
|
+
method: "PUT",
|
|
72
|
+
}
|
|
73
|
+
);
|
|
72
74
|
}
|
|
73
75
|
|
|
76
|
+
function updateMemberRole(
|
|
77
|
+
id: string,
|
|
78
|
+
role: string,
|
|
79
|
+
type: string,
|
|
80
|
+
org: string
|
|
81
|
+
) {
|
|
82
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
83
|
+
`/api/members/id/${id}/role/${role}/type/${type}/org/${org}`,
|
|
84
|
+
{
|
|
85
|
+
method: "PUT",
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
74
89
|
return {
|
|
90
|
+
members,
|
|
75
91
|
member,
|
|
76
|
-
setMember,
|
|
77
|
-
inviteMember,
|
|
78
|
-
getAll,
|
|
79
92
|
page,
|
|
80
93
|
pages,
|
|
81
94
|
pageRange,
|
|
82
|
-
|
|
83
|
-
|
|
95
|
+
|
|
96
|
+
getAll,
|
|
84
97
|
getByUserId,
|
|
98
|
+
createUserByVerification,
|
|
99
|
+
createMemberInvite,
|
|
100
|
+
getByUserIdType,
|
|
101
|
+
updateMemberStatus,
|
|
102
|
+
updateMemberRole,
|
|
85
103
|
};
|
|
86
104
|
}
|
package/composables/useOrg.ts
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
export default function useOrg() {
|
|
2
|
-
function getAll({ page = 1, search = "", limit = 20 } = {}) {
|
|
2
|
+
function getAll({ page = 1, search = "", limit = 20, status = "" } = {}) {
|
|
3
3
|
return useNuxtApp().$api<Record<string, any>>("/api/organizations", {
|
|
4
4
|
method: "GET",
|
|
5
5
|
query: {
|
|
6
6
|
page,
|
|
7
7
|
search,
|
|
8
8
|
limit,
|
|
9
|
+
status,
|
|
9
10
|
},
|
|
10
11
|
});
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
function getById(id = "") {
|
|
15
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
16
|
+
`/api/organizations/id/${id}`,
|
|
17
|
+
{
|
|
18
|
+
method: "GET",
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
13
23
|
function getByUserId({ page = 1, search = "", user = "", limit = 20 } = {}) {
|
|
14
24
|
return useNuxtApp().$api<Record<string, any>>(
|
|
15
25
|
`/api/organizations/user/${user}`,
|
|
@@ -91,5 +101,6 @@ export default function useOrg() {
|
|
|
91
101
|
total,
|
|
92
102
|
getByName,
|
|
93
103
|
currentOrg,
|
|
104
|
+
getById,
|
|
94
105
|
};
|
|
95
106
|
}
|
package/composables/useUser.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
export default function useUser() {
|
|
2
|
-
function inviteUser({
|
|
2
|
+
function inviteUser({
|
|
3
|
+
email = "",
|
|
4
|
+
app = "",
|
|
5
|
+
role = "",
|
|
6
|
+
roleName = "",
|
|
7
|
+
org = "",
|
|
8
|
+
orgName = "",
|
|
9
|
+
} = {}) {
|
|
3
10
|
return useNuxtApp().$api<Record<string, any>>("/api/auth/invite", {
|
|
4
11
|
method: "POST",
|
|
5
|
-
body: { email, app, role,
|
|
12
|
+
body: { email, app, role, roleName, org, orgName },
|
|
6
13
|
});
|
|
7
14
|
}
|
|
8
15
|
|
package/composables/useUtils.ts
CHANGED
|
@@ -241,6 +241,30 @@ export default function useUtils() {
|
|
|
241
241
|
};
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
function getRouteParam(field = "") {
|
|
245
|
+
if (!field) return "";
|
|
246
|
+
|
|
247
|
+
return (useRoute().params[field] as string) ?? "";
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function replaceMatch(str: string, match: string, replace: string) {
|
|
251
|
+
return str.replace(new RegExp(match, "g"), replace);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function setRouteParams(...args: Array<Record<string, string>>) {
|
|
255
|
+
const params: Record<string, string> = {};
|
|
256
|
+
|
|
257
|
+
args.forEach((arg) => {
|
|
258
|
+
Object.entries(arg).forEach(([key, value]) => {
|
|
259
|
+
if (value !== undefined && value !== null && value !== "") {
|
|
260
|
+
params[key] = value;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
return params;
|
|
266
|
+
}
|
|
267
|
+
|
|
244
268
|
return {
|
|
245
269
|
requiredRule,
|
|
246
270
|
emailRule,
|
|
@@ -263,5 +287,8 @@ export default function useUtils() {
|
|
|
263
287
|
requireListRule,
|
|
264
288
|
convertPermissionsToArray,
|
|
265
289
|
extractMonthYear,
|
|
290
|
+
getRouteParam,
|
|
291
|
+
replaceMatch,
|
|
292
|
+
setRouteParams,
|
|
266
293
|
};
|
|
267
294
|
}
|
|
@@ -5,10 +5,11 @@ export default function useUser() {
|
|
|
5
5
|
search = "",
|
|
6
6
|
page = 1,
|
|
7
7
|
email = "",
|
|
8
|
+
app = "",
|
|
8
9
|
} = {}) {
|
|
9
|
-
return useNuxtApp().$api<
|
|
10
|
+
return useNuxtApp().$api<Record<string, any>>("/api/verifications", {
|
|
10
11
|
method: "GET",
|
|
11
|
-
query: { status, search, page, type, email },
|
|
12
|
+
query: { status, search, page, type, email, app },
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
15
|
|
package/nuxt.config.ts
CHANGED
|
@@ -25,10 +25,7 @@ export default defineNuxtConfig({
|
|
|
25
25
|
APP_AFFILIATE: (process.env.APP_AFFILIATE as string) ?? "",
|
|
26
26
|
APP_INVENTORY: (process.env.APP_INVENTORY as string) ?? "",
|
|
27
27
|
APP_ASSET: (process.env.APP_ASSET as string) ?? "",
|
|
28
|
-
|
|
29
|
-
APP_BOOK_KEEPING: (process.env.APP_BOOK_KEEPING as string) ?? "",
|
|
30
|
-
APP_ZONAL: (process.env.APP_ZONAL as string) ?? "",
|
|
31
|
-
APP_SCHOOL: (process.env.APP_SCHOOL as string) ?? "",
|
|
28
|
+
APP_FINANCE: (process.env.APP_FINANCE as string) ?? "",
|
|
32
29
|
},
|
|
33
30
|
},
|
|
34
31
|
|
package/package.json
CHANGED
package/types/role.d.ts
CHANGED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
export default function useAdminPermission() {
|
|
2
|
-
const permissions: TPermissions = {
|
|
3
|
-
organizations: {
|
|
4
|
-
"see-all-organizations": {
|
|
5
|
-
check: true,
|
|
6
|
-
description: "Allows the user to view the list of all organizations.",
|
|
7
|
-
},
|
|
8
|
-
"see-organization-details": {
|
|
9
|
-
check: true,
|
|
10
|
-
description:
|
|
11
|
-
"Allows the user to view the details of a specific organization.",
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
"promo-codes": {
|
|
15
|
-
"create-promo-code": {
|
|
16
|
-
check: true,
|
|
17
|
-
description: "Allows the user to add new promo codes to the system.",
|
|
18
|
-
},
|
|
19
|
-
"see-promo-code-details": {
|
|
20
|
-
check: true,
|
|
21
|
-
description:
|
|
22
|
-
"Allows the user to view the details of a specific promo code.",
|
|
23
|
-
},
|
|
24
|
-
"edit-promo-code-details": {
|
|
25
|
-
check: true,
|
|
26
|
-
description:
|
|
27
|
-
"Allows the user to update the promo code’s name, discount value, and other settings.",
|
|
28
|
-
},
|
|
29
|
-
"change-promo-code-status": {
|
|
30
|
-
check: true,
|
|
31
|
-
description:
|
|
32
|
-
"Allows the user to activate, deactivate, or expire a promo code.",
|
|
33
|
-
},
|
|
34
|
-
"delete-promo-code": {
|
|
35
|
-
check: true,
|
|
36
|
-
description:
|
|
37
|
-
"Allows the user to remove a promo code from the system permanently.",
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
users: {
|
|
41
|
-
"see-all-users": {
|
|
42
|
-
check: true,
|
|
43
|
-
description: "Allows the user to view the list of all users.",
|
|
44
|
-
},
|
|
45
|
-
"see-user-details": {
|
|
46
|
-
check: true,
|
|
47
|
-
description: "Allows the user to view the details of a specific user.",
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
invitations: {
|
|
51
|
-
"see-all-invitations": {
|
|
52
|
-
check: true,
|
|
53
|
-
description: "Allows the user to view the list of all invitations.",
|
|
54
|
-
},
|
|
55
|
-
"see-invitation-details": {
|
|
56
|
-
check: true,
|
|
57
|
-
description:
|
|
58
|
-
"Allows the user to view the details of a specific invitation.",
|
|
59
|
-
},
|
|
60
|
-
"edit-invitation-details": {
|
|
61
|
-
check: true,
|
|
62
|
-
description:
|
|
63
|
-
"Allows the user to update the details of a specific invitation.",
|
|
64
|
-
},
|
|
65
|
-
"change-invitation-status": {
|
|
66
|
-
check: true,
|
|
67
|
-
description: "Allows the user to update the status of an invitation.",
|
|
68
|
-
},
|
|
69
|
-
"delete-invitation": {
|
|
70
|
-
check: true,
|
|
71
|
-
description:
|
|
72
|
-
"Allows the user to remove an invitation from the system permanently.",
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
members: {
|
|
76
|
-
"see-all-members": {
|
|
77
|
-
check: true,
|
|
78
|
-
description: "Allows the user to view the list of all members.",
|
|
79
|
-
},
|
|
80
|
-
"see-member-details": {
|
|
81
|
-
check: true,
|
|
82
|
-
description:
|
|
83
|
-
"Allows the user to view the details of a specific member.",
|
|
84
|
-
},
|
|
85
|
-
"change-member-status": {
|
|
86
|
-
check: true,
|
|
87
|
-
description: "Allows the user to update the status of a member.",
|
|
88
|
-
},
|
|
89
|
-
"remove-member": {
|
|
90
|
-
check: true,
|
|
91
|
-
description: "Allows the user to remove a member from the system.",
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
"roles-and-permissions": {
|
|
95
|
-
"view-all-roles": {
|
|
96
|
-
check: true,
|
|
97
|
-
description: "Allows the user to view the list of all roles.",
|
|
98
|
-
},
|
|
99
|
-
"view-role-details": {
|
|
100
|
-
check: true,
|
|
101
|
-
description: "Allows the user to view the details of a specific role.",
|
|
102
|
-
},
|
|
103
|
-
"update-role-name": {
|
|
104
|
-
check: true,
|
|
105
|
-
description: "Allows the user to edit the name of an existing role.",
|
|
106
|
-
},
|
|
107
|
-
"update-role-permissions": {
|
|
108
|
-
check: true,
|
|
109
|
-
description:
|
|
110
|
-
"Allows the user to modify permissions assigned to a role.",
|
|
111
|
-
},
|
|
112
|
-
"update-role-status": {
|
|
113
|
-
check: true,
|
|
114
|
-
description: "Allows the user to activate or deactivate a role.",
|
|
115
|
-
},
|
|
116
|
-
"delete-role": {
|
|
117
|
-
check: true,
|
|
118
|
-
description:
|
|
119
|
-
"Allows the user to remove a role from the system permanently.",
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
return {
|
|
125
|
-
permissions,
|
|
126
|
-
};
|
|
127
|
-
}
|