@simitgroup/simpleapp-generator 1.2.8 → 1.3.0-alpha
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/dist/buildinschemas/organization.d.ts.map +1 -1
- package/dist/buildinschemas/organization.js +3 -1
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +3 -8
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +14 -14
- package/dist/generate.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/organization.ts +3 -1
- package/src/framework.ts +4 -8
- package/src/generate.ts +17 -16
- package/templates/basic/nest/controller.ts.eta +17 -0
- package/templates/basic/nest/default.ts.eta +6 -2
- package/templates/basic/nuxt/default.ts.eta +10 -6
- package/templates/basic/nuxt/pages.[id].vue.eta +9 -7
- package/templates/basic/nuxt/pages.form.vue.eta +16 -36
- package/templates/basic/nuxt/pages.landing.vue.eta +42 -35
- package/templates/basic/nuxt/pages.viewer.vue.eta +4 -6
- package/templates/nest/.env._eta +0 -1
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +14 -2
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +32 -18
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +76 -13
- package/templates/nuxt/assets/css/style.css._eta +19 -7
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +20 -9
- package/templates/nuxt/components/button/ButtonDefault.vue._eta +1 -2
- package/templates/nuxt/components/button/ButtonMultiple.vue._eta +21 -0
- package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +3 -4
- package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +75 -65
- package/templates/nuxt/components/form/FormBranch.vue.eta +83 -0
- package/templates/nuxt/components/form/readme.md.eta +1 -0
- package/templates/nuxt/components/header/button/HeaderButtonMenuPicker.vue._eta +13 -11
- package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +11 -17
- package/templates/nuxt/components/list/ListDocument.vue.eta +25 -0
- package/templates/nuxt/components/list/ListDocumentTable.vue.eta +77 -0
- package/templates/nuxt/components/list/ListView.vue.eta +129 -60
- package/templates/nuxt/components/mobile/MobileToolbar.vue.eta +10 -0
- package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +21 -0
- package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +20 -0
- package/templates/nuxt/components/page/PageDocList.vue.eta +170 -0
- package/templates/nuxt/components/renderer/RendererBoolean.vue.eta +8 -4
- package/templates/nuxt/components/renderer/RendererDate.vue.eta +4 -4
- package/templates/nuxt/components/renderer/RendererLink.vue.eta +12 -20
- package/templates/nuxt/components/renderer/RendererViewer.vue.eta +27 -21
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +201 -174
- package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +115 -111
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue.eta +183 -91
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +383 -263
- package/templates/nuxt/components/table/TableDocuments.vue.eta +3 -3
- package/templates/nuxt/components/text/TextDanger.vue._eta +5 -0
- package/templates/nuxt/components/text/TextSubtitle.vue._eta +5 -0
- package/templates/nuxt/components/text/TextTitle.vue._eta +5 -0
- package/templates/nuxt/composables/date.generate.ts.eta +14 -9
- package/templates/nuxt/i18n.config.ts.eta +1 -1
- package/templates/nuxt/lang/en.ts.eta +16 -0
- package/templates/nuxt/layouts/default.vue._eta +32 -17
- package/templates/nuxt/layouts/mobile.vue._eta +35 -12
- package/templates/nuxt/nuxt.config.ts._eta +3 -7
- package/templates/nuxt/pages/[xorg]/organization/[id].vue.eta +39 -0
- package/templates/nuxt/pages/[xorg]/organization/new.vue.eta +30 -143
- package/templates/nuxt/pages/[xorg]/organization/viewer.vue.eta +3 -0
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +81 -127
- package/templates/nuxt/pages/[xorg]/user/[id].vue.eta +38 -4
- package/templates/nuxt/pages/[xorg]/user/form.vue.eta +329 -0
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +29 -292
- package/templates/nuxt/pages/[xorg]/{organization/[id]/branches/[bid].vue → user/new.vue.eta} +10 -4
- package/templates/nuxt/pages/[xorg]/user/viewer.vue.eta +30 -0
- package/templates/nuxt/pages/[xorg]/user.vue.eta +88 -78
- package/templates/nuxt/pages/profile.vue.eta +12 -3
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +2 -3
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +41 -2
- package/templates/nuxt/types/documentlist.ts.eta +0 -9
- package/templates/nuxt/types/events.ts.eta +1 -0
- package/templates/nuxt/types/simpleappinput.ts.eta +12 -2
- package/templates/nuxt/types/user.ts.eta +2 -0
- package/templates/project/lang/default._json +5 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/components/docPage/DocPageList.vue.eta +0 -125
- package/templates/nuxt/lang/en.ts._eta +0 -6
- package/templates/nuxt/pages/[xorg]/organization/[bid].vue.eta +0 -14
- package/templates/nuxt/pages/[xorg]/organization/[id]/branches/new.vue +0 -149
- package/templates/nuxt/pages/[xorg]/organization/[id]/index.vue.eta +0 -1
- /package/templates/nuxt/lang/{df.ts.eta → df.ts.etaxxxx} +0 -0
|
@@ -1,300 +1,37 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<Card>
|
|
4
|
-
<template #header>
|
|
5
|
-
<h1 class="font-bold">{{ usertitle }}</h1>
|
|
6
|
-
</template>
|
|
7
|
-
<template #content>
|
|
8
|
-
<SimpleAppForm :document="userdoc" #default="o">
|
|
9
|
-
<div class="flex flex-col gap-2">
|
|
10
|
-
<SimpleAppInput
|
|
11
|
-
:input-type="SimpleAppInputType.text"
|
|
12
|
-
autofocus
|
|
13
|
-
:setting="o.getField('#/properties/fullName')"
|
|
14
|
-
v-model="userdata.fullName"
|
|
15
|
-
/>
|
|
16
|
-
|
|
17
|
-
<SimpleAppInput
|
|
18
|
-
:input-type="SimpleAppInputType.text"
|
|
19
|
-
type="email"
|
|
20
|
-
:setting="o.getField('#/properties/email')"
|
|
21
|
-
v-model="userdata.email"
|
|
22
|
-
/>
|
|
23
|
-
|
|
24
|
-
<SimpleAppInput
|
|
25
|
-
:input-type="SimpleAppInputType.checkbox"
|
|
26
|
-
:setting="o.getField('#/properties/active')"
|
|
27
|
-
v-model="userdata.active"
|
|
28
|
-
/>
|
|
29
|
-
<SimpleAppInput
|
|
30
|
-
:input-type="SimpleAppInputType.textarea"
|
|
31
|
-
:setting="o.getField('#/properties/description')"
|
|
32
|
-
v-model="userdata.description"
|
|
33
|
-
/>
|
|
34
|
-
<div>
|
|
35
|
-
<Button @click="saveUser" class="btn btn-primary">Save</Button>
|
|
36
|
-
<Button
|
|
37
|
-
v-if="canPerform('user', 'delete')"
|
|
38
|
-
@click="deleteUser"
|
|
39
|
-
class="btn btn-danger"
|
|
40
|
-
>Delete</Button
|
|
41
|
-
>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</SimpleAppForm>
|
|
45
|
-
</template>
|
|
46
|
-
</Card>
|
|
47
|
-
|
|
48
|
-
<Card class="m-2">
|
|
49
|
-
<template #header>
|
|
50
|
-
<div class="relative w-full ...">
|
|
51
|
-
<h1 class="font-bold">{{ permissiontitle }}</h1>
|
|
52
|
-
<div class="absolute top-0 right-0 h-16 w-16 ...">
|
|
53
|
-
<UserButtonPermissionInfo></UserButtonPermissionInfo>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
</template>
|
|
57
|
-
<template #content>
|
|
58
|
-
<BlockUI :blocked="blockscreen">
|
|
59
|
-
<!-- <div class="text-right m mr-2">
|
|
60
|
-
|
|
61
|
-
</div> -->
|
|
62
|
-
|
|
63
|
-
<div class="">
|
|
64
|
-
<Card
|
|
65
|
-
v-if="currentpermissions.length > 0"
|
|
66
|
-
v-for="o in orglist"
|
|
67
|
-
class="m-2"
|
|
68
|
-
>
|
|
69
|
-
<template #title>{{ o.orgName }}</template>
|
|
70
|
-
<template #content>
|
|
71
|
-
<table class="w w-full">
|
|
72
|
-
<tr v-for="(b, index) in branchlist">
|
|
73
|
-
<td v-if="checkBranchInOrg(o, b)" class="text-center">
|
|
74
|
-
{{ b.branchCode }}
|
|
75
|
-
</td>
|
|
76
|
-
<td
|
|
77
|
-
v-if="checkBranchInOrg(o, b)"
|
|
78
|
-
class="text-center flex flex-row"
|
|
79
|
-
>
|
|
80
|
-
<div>
|
|
81
|
-
<SelectButton
|
|
82
|
-
v-model="currentpermissions[index]['group']"
|
|
83
|
-
:options="grouplist"
|
|
84
|
-
option-label="label"
|
|
85
|
-
option-value="value"
|
|
86
|
-
@change="applyPermission(currentpermissions[index])"
|
|
87
|
-
></SelectButton>
|
|
88
|
-
</div>
|
|
89
|
-
</td>
|
|
90
|
-
</tr>
|
|
91
|
-
</table>
|
|
92
|
-
</template>
|
|
93
|
-
</Card>
|
|
94
|
-
</div>
|
|
95
|
-
</BlockUI>
|
|
96
|
-
</template>
|
|
97
|
-
</Card>
|
|
98
|
-
</div>
|
|
2
|
+
<Crud _id="" @after="after" />
|
|
99
3
|
</template>
|
|
100
|
-
<script setup lang="ts">
|
|
101
|
-
// import Card from "primevue/card";
|
|
102
|
-
import { SimpleAppInputType } from "~/types";
|
|
103
|
-
import { Permission, User } from "../../../simpleapp/generate/openapi/api";
|
|
104
|
-
import _ from "lodash";
|
|
105
|
-
import SelectButton from "primevue/selectbutton";
|
|
106
|
-
import { SearchBody, EventType } from "~/types";
|
|
107
|
-
|
|
108
|
-
import {
|
|
109
|
-
UserListItem,
|
|
110
|
-
NotificationStatus,
|
|
111
|
-
Notification,
|
|
112
|
-
BranchListItem,
|
|
113
|
-
OrgListItem,
|
|
114
|
-
PermissionListItem,
|
|
115
|
-
} from "~/types";
|
|
116
|
-
const {
|
|
117
|
-
$event,
|
|
118
|
-
$PermissionDoc,
|
|
119
|
-
$OrganizationDoc,
|
|
120
|
-
$BranchDoc,
|
|
121
|
-
$UserDoc,
|
|
122
|
-
// $InvitationDoc,
|
|
123
|
-
} = useNuxtApp();
|
|
124
|
-
const userdoc = $UserDoc();
|
|
125
|
-
const userdata = userdoc.getReactiveData();
|
|
126
|
-
const currentpermissions = ref<Permission[]>([]);
|
|
127
|
-
currentpermissions.value = [];
|
|
128
|
-
const blockscreen = ref(false);
|
|
129
|
-
const permlist = ref<PermissionListItem[]>([]);
|
|
130
|
-
// const userlist = ref<UserListItem[]>([]);
|
|
131
|
-
const orglist = ref<OrgListItem[]>([]);
|
|
132
|
-
const branchlist = ref<BranchListItem[]>([]);
|
|
133
|
-
const permdoc = $PermissionDoc();
|
|
134
|
-
const orgdoc = $OrganizationDoc();
|
|
135
|
-
const branchdoc = $BranchDoc();
|
|
136
|
-
const permissiontitle = "Permission Information";
|
|
137
|
-
const usertitle = "User Information";
|
|
138
|
-
const grouplist = getAllGroups().map((item) => {
|
|
139
|
-
return { value: item, label: _.capitalize(item) };
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* delete user
|
|
144
|
-
* @param user:User object
|
|
145
|
-
*/
|
|
146
|
-
const deleteUser = async (user: any) => {
|
|
147
|
-
await userdoc.delete(String(userdata.value._id));
|
|
148
|
-
//NotificationEvent
|
|
149
|
-
$event("RefreshUser", "");
|
|
150
|
-
goTo("user");
|
|
151
|
-
};
|
|
152
4
|
|
|
153
|
-
|
|
5
|
+
<script setup lang="ts">
|
|
154
6
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
7
|
+
* This file was automatically generated by simpleapp everytime regenerate code.
|
|
8
|
+
* delete file "delete-me-for-avoid-override" if you want to modify this file and
|
|
9
|
+
* prevent regenerate code override it.
|
|
10
|
+
* last change 2023-09-09
|
|
11
|
+
* author: Ks Tan
|
|
160
12
|
*/
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
} else if (d._id && !d.group) {
|
|
184
|
-
d.group = "";
|
|
185
|
-
data.value = d;
|
|
186
|
-
result = await permdoc.delete(d._id);
|
|
187
|
-
} else {
|
|
188
|
-
console.warn("unknown apply permission", result);
|
|
189
|
-
}
|
|
190
|
-
// refreshList(false);
|
|
191
|
-
onSelectUser(String(d.userId));
|
|
192
|
-
blockscreen.value = false;
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
const checkBranchInOrg = (org: OrgListItem, branch: BranchListItem) => {
|
|
196
|
-
return org.orgId === branch.orgId;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
const saveUser = async () => {
|
|
200
|
-
await userdoc.update();
|
|
201
|
-
$event("RefreshUser", "");
|
|
202
|
-
onSelectUser(String(userdata.value._id));
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
const onSelectUser = async (userId: string) => {
|
|
206
|
-
console.log("onSelectUser", userId);
|
|
207
|
-
// .addRoute()
|
|
208
|
-
// const user: UserListItem = { ...menuitem };
|
|
209
|
-
const orgsearchbody: SearchBody = {
|
|
210
|
-
fields: ["orgId", "orgCode", "orgName", "active"],
|
|
211
|
-
};
|
|
212
|
-
const branchsearchbody: SearchBody = {
|
|
213
|
-
fields: ["orgId", "branchId", "branchCode", "branchName", "active"],
|
|
214
|
-
};
|
|
215
|
-
const permsearchbody: SearchBody = {
|
|
216
|
-
filter: { userId: userId },
|
|
217
|
-
fields: [
|
|
218
|
-
"uid",
|
|
219
|
-
"userId",
|
|
220
|
-
"branchId",
|
|
221
|
-
"tenantId",
|
|
222
|
-
"orgId",
|
|
223
|
-
"active",
|
|
224
|
-
"group",
|
|
225
|
-
"created",
|
|
226
|
-
],
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
orglist.value = await orgdoc.search(orgsearchbody);
|
|
230
|
-
branchlist.value = await branchdoc.search(branchsearchbody);
|
|
231
|
-
permlist.value = await permdoc.search(permsearchbody);
|
|
232
|
-
await userdoc.getById(userId);
|
|
233
|
-
// console.log("orglist.value", orglist.value);
|
|
234
|
-
// console.log("branchlist.value", branchlist.value);
|
|
235
|
-
// console.log("permlist.value", permlist.value);
|
|
236
|
-
// selected.value = String(user._id);
|
|
237
|
-
|
|
238
|
-
// activeuser.value = user.fullName;
|
|
239
|
-
//sso id from keycloak
|
|
240
|
-
// const uid = String(user.uid);
|
|
241
|
-
//_id from mongodb
|
|
242
|
-
|
|
243
|
-
currentpermissions.value = [];
|
|
244
|
-
|
|
245
|
-
for (let i = 0; i < branchlist.value.length; i++) {
|
|
246
|
-
const b = branchlist.value[i];
|
|
247
|
-
const permdata = getPermssionData(userId, b.branchId);
|
|
248
|
-
const tmp: Permission = {
|
|
249
|
-
_id: permdata?._id,
|
|
250
|
-
userId: userId,
|
|
251
|
-
tenantId: b.tenantId,
|
|
252
|
-
orgId: b.orgId,
|
|
253
|
-
branchId: b.branchId,
|
|
254
|
-
group: permdata.group,
|
|
255
|
-
};
|
|
256
|
-
currentpermissions.value.push(tmp);
|
|
13
|
+
import Crud from "./form.vue";
|
|
14
|
+
import { User } from "~/simpleapp/generate/types";
|
|
15
|
+
|
|
16
|
+
const doc = useNuxtApp().$UserDoc();
|
|
17
|
+
|
|
18
|
+
const props = defineProps<{ _id: string }>();
|
|
19
|
+
const after = (actionName: string, data: User, result: any) => {
|
|
20
|
+
switch (actionName) {
|
|
21
|
+
case "new":
|
|
22
|
+
goTo(doc.getDocName(), "new");
|
|
23
|
+
break;
|
|
24
|
+
case "create":
|
|
25
|
+
goTo(doc.getDocName(), data._id);
|
|
26
|
+
refreshDocumentList(doc.getDocName());
|
|
27
|
+
break;
|
|
28
|
+
case "update":
|
|
29
|
+
refreshDocumentList(doc.getDocName());
|
|
30
|
+
break;
|
|
31
|
+
case "delete":
|
|
32
|
+
goTo(doc.getDocName(), "new");
|
|
33
|
+
refreshDocumentList(doc.getDocName());
|
|
34
|
+
break;
|
|
257
35
|
}
|
|
258
|
-
// console.log("currentpermissions", currentpermissions);
|
|
259
|
-
blockscreen.value = false;
|
|
260
36
|
};
|
|
261
|
-
/**
|
|
262
|
-
* prepare dataobj (existing or empty dummy data) for each branch permission
|
|
263
|
-
* @param uid
|
|
264
|
-
* @param branchId
|
|
265
|
-
*/
|
|
266
|
-
const getPermssionData = (userId: string, branchId: number) => {
|
|
267
|
-
// console.log("getPermssionData", userId, branchId);
|
|
268
|
-
const result = permlist.value.find((item: any) => {
|
|
269
|
-
// console.log(
|
|
270
|
-
// item.userId,
|
|
271
|
-
// "== ",
|
|
272
|
-
// userId,
|
|
273
|
-
// " &&",
|
|
274
|
-
// item.branchId,
|
|
275
|
-
// "==",
|
|
276
|
-
// branchId,
|
|
277
|
-
// );
|
|
278
|
-
return item.userId == userId && item.branchId == branchId;
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
// console.log("permlist.value.",permlist.value,result)
|
|
282
|
-
let pm: Permission = {
|
|
283
|
-
_id: result?._id ?? "",
|
|
284
|
-
orgId: result?.orgId ?? 0,
|
|
285
|
-
tenantId: result?.tenantId ?? 0,
|
|
286
|
-
branchId: branchId,
|
|
287
|
-
userId: userId,
|
|
288
|
-
group: result?.group ?? "",
|
|
289
|
-
};
|
|
290
|
-
return pm;
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
onMounted(async () => {
|
|
294
|
-
const id = getPathPara('id')
|
|
295
|
-
if(id){
|
|
296
|
-
await onSelectUser(id);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
});
|
|
300
37
|
</script>
|
package/templates/nuxt/pages/[xorg]/{organization/[id]/branches/[bid].vue → user/new.vue.eta}
RENAMED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Crud _id="new" @after-create="redirect" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
1
5
|
<script setup lang="ts">
|
|
2
6
|
/**
|
|
3
7
|
* This file was automatically generated by simpleapp everytime regenerate code.
|
|
@@ -6,8 +10,10 @@
|
|
|
6
10
|
* last change 2023-09-09
|
|
7
11
|
* author: Ks Tan
|
|
8
12
|
*/
|
|
9
|
-
|
|
13
|
+
|
|
14
|
+
import Crud from "./form.vue";const { $UserDoc } = useNuxtApp();
|
|
15
|
+
const doc = $UserDoc();
|
|
16
|
+
const redirect = (data: any) => {
|
|
17
|
+
goTo(doc.getDocName(), data._id);
|
|
18
|
+
};
|
|
10
19
|
</script>
|
|
11
|
-
<template>
|
|
12
|
-
<Crud />
|
|
13
|
-
</template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Crud :_id="_id" @after="after" :paras="paras" />
|
|
3
|
+
</template>
|
|
4
|
+
<script setup lang="ts">
|
|
5
|
+
/**
|
|
6
|
+
* This file was automatically generated by simpleapp everytime regenerate code.
|
|
7
|
+
* delete file "delete-me-for-avoid-override" if you want to modify this file and
|
|
8
|
+
* prevent regenerate code override it.
|
|
9
|
+
* last change 2023-09-09
|
|
10
|
+
* author: Ks Tan
|
|
11
|
+
*/
|
|
12
|
+
import Crud from "./form.vue";import { User } from "~/simpleapp/generate/types";
|
|
13
|
+
const props = defineProps<{ _id: string; paras?: User }>();
|
|
14
|
+
const emits = defineEmits(["afterCreate", "after"]);
|
|
15
|
+
|
|
16
|
+
const after = (actionName: string, data: User, result: any) => {
|
|
17
|
+
switch (actionName) {
|
|
18
|
+
case "new":
|
|
19
|
+
break;
|
|
20
|
+
case "create":
|
|
21
|
+
emits("afterCreate", data);
|
|
22
|
+
break;
|
|
23
|
+
case "update":
|
|
24
|
+
break;
|
|
25
|
+
case "delete":
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
emits("after", actionName, data, result);
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
@@ -1,3 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<title>{{ t("user") }}</title>
|
|
3
|
+
<div class="flex flex-row gap-4">
|
|
4
|
+
|
|
5
|
+
<div v-if="!useDevice().isMobile || (useDevice().isMobile && !userid)"
|
|
6
|
+
class="w-full md:w-1/2 xl:w-1/3 p-4"
|
|
7
|
+
>
|
|
8
|
+
<TabView>
|
|
9
|
+
<TabPanel header="Active">
|
|
10
|
+
<ul role="list" class="divide-y divide-gray-100">
|
|
11
|
+
<li v-for="item in userlist" :key="item.email">
|
|
12
|
+
<NuxtLink
|
|
13
|
+
v-if="item.uid && item.active"
|
|
14
|
+
:to="getDocumentUrl('user',item._id)"
|
|
15
|
+
>
|
|
16
|
+
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
17
|
+
</NuxtLink>
|
|
18
|
+
</li>
|
|
19
|
+
</ul>
|
|
20
|
+
</TabPanel>
|
|
21
|
+
<TabPanel header="Inactive">
|
|
22
|
+
<ul role="list" class="divide-y divide-gray-100">
|
|
23
|
+
<li v-for="item in userlist" :key="item.email">
|
|
24
|
+
<NuxtLink
|
|
25
|
+
v-if="item.uid && !item.active"
|
|
26
|
+
:to="getDocumentUrl('user',item._id)"
|
|
27
|
+
>
|
|
28
|
+
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
29
|
+
</NuxtLink>
|
|
30
|
+
</li>
|
|
31
|
+
</ul>
|
|
32
|
+
</TabPanel>
|
|
33
|
+
<TabPanel header="Invite">
|
|
34
|
+
<div class="padding p-2">
|
|
35
|
+
<form @submit.prevent="true" class="w-full">
|
|
36
|
+
<div class="p-inputgroup flex flex-row">
|
|
37
|
+
<InputText
|
|
38
|
+
class="flex-1"
|
|
39
|
+
type="email"
|
|
40
|
+
placeholder="email"
|
|
41
|
+
v-model="inviteemail"
|
|
42
|
+
/>
|
|
43
|
+
<div class="p-inputgroup-addon p p-0">
|
|
44
|
+
<button
|
|
45
|
+
label="Search"
|
|
46
|
+
class="border rounded-tl-none rounded-bl-none btn btn-primary -ml-1 h-full p-3 rounded-r-md"
|
|
47
|
+
@click="invite"
|
|
48
|
+
>
|
|
49
|
+
Invite
|
|
50
|
+
</button>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</form>
|
|
54
|
+
</div>
|
|
55
|
+
<ul role="list" class="divide-y divide-gray-100">
|
|
56
|
+
<li v-for="item in userlist" :key="item.email">
|
|
57
|
+
<NuxtLink
|
|
58
|
+
v-if="!item.uid"
|
|
59
|
+
:to="getDocumentUrl('user',item._id)"
|
|
60
|
+
>
|
|
61
|
+
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
62
|
+
</NuxtLink>
|
|
63
|
+
</li>
|
|
64
|
+
</ul>
|
|
65
|
+
</TabPanel>
|
|
66
|
+
</TabView>
|
|
67
|
+
</div>
|
|
68
|
+
<div v-if="userid || !isMobile()" class="flex-1">
|
|
69
|
+
<NuxtPage :_id="userid" />
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
1
74
|
<script setup lang="ts">
|
|
2
75
|
/**
|
|
3
76
|
* invite user into current tenant (put user into user catalogue)
|
|
@@ -8,7 +81,7 @@
|
|
|
8
81
|
// import userchild from './userchild.vue'
|
|
9
82
|
import Menu from "primevue/menu";
|
|
10
83
|
import Dialog from "primevue/dialog";
|
|
11
|
-
import { SearchBody, EventType } from "~/types";
|
|
84
|
+
import { SearchBody, EventType,UserProfile } from "~/types";
|
|
12
85
|
import _ from "lodash";
|
|
13
86
|
import Panel from "primevue/panel";
|
|
14
87
|
import { ref } from "vue";
|
|
@@ -36,7 +109,7 @@ const {
|
|
|
36
109
|
$UserDoc,
|
|
37
110
|
// $InvitationDoc,
|
|
38
111
|
} = useNuxtApp();
|
|
39
|
-
|
|
112
|
+
const userid = computed(() => getPathPara("id"));
|
|
40
113
|
const permdoc = $PermissionDoc();
|
|
41
114
|
const orgdoc = $OrganizationDoc();
|
|
42
115
|
const branchdoc = $BranchDoc();
|
|
@@ -61,6 +134,11 @@ const activeuser = ref("");
|
|
|
61
134
|
const showpermissioninfo = ref(false);
|
|
62
135
|
const permissionselected = ref();
|
|
63
136
|
|
|
137
|
+
|
|
138
|
+
const selectUser = (user:any) =>{
|
|
139
|
+
// goTo('user',user._id)
|
|
140
|
+
}
|
|
141
|
+
|
|
64
142
|
/**
|
|
65
143
|
* 1. get all users from this tenant
|
|
66
144
|
* @param resetpage after reload, will it reset user interface or remain as current
|
|
@@ -113,9 +191,9 @@ const invite = async () => {
|
|
|
113
191
|
newuserdata.value.email = inviteemail.value;
|
|
114
192
|
newuserdata.value.fullName = inviteemail.value.split("@")[0];
|
|
115
193
|
newuserdata.value.active = true;
|
|
116
|
-
newuserdata.value.tenantId = currentuser
|
|
117
|
-
newuserdata.value.orgId = currentuser
|
|
118
|
-
newuserdata.value.branchId = currentuser
|
|
194
|
+
newuserdata.value.tenantId = currentuser?.tenantId;
|
|
195
|
+
newuserdata.value.orgId = currentuser?.orgId;
|
|
196
|
+
newuserdata.value.branchId = currentuser?.branchId;
|
|
119
197
|
|
|
120
198
|
const invitedata = await inviteuserdoc.create();
|
|
121
199
|
inviteemail.value = "";
|
|
@@ -123,82 +201,14 @@ const invite = async () => {
|
|
|
123
201
|
// onSelectUser(invitedata);
|
|
124
202
|
};
|
|
125
203
|
|
|
126
|
-
$listen("
|
|
127
|
-
refreshList();
|
|
204
|
+
$listen("RefreshDocumentList", async() => {
|
|
205
|
+
await refreshList();
|
|
128
206
|
});
|
|
129
|
-
onMounted(() => {
|
|
130
|
-
refreshList();
|
|
207
|
+
onMounted(async () => {
|
|
208
|
+
await refreshList();
|
|
131
209
|
});
|
|
132
210
|
|
|
133
211
|
definePageMeta({
|
|
134
212
|
menuPath: "setting/user",
|
|
135
|
-
|
|
213
|
+
});
|
|
136
214
|
</script>
|
|
137
|
-
<template>
|
|
138
|
-
<div class="grid grid-cols-4">
|
|
139
|
-
<title>{{ t('user')}} </title>
|
|
140
|
-
<div v-if="userlist" class="m-2 p-2 border-r-2">
|
|
141
|
-
<TabView>
|
|
142
|
-
<TabPanel header="Active">
|
|
143
|
-
<ul role="list" class="divide-y divide-gray-100">
|
|
144
|
-
<li v-for="item in userlist" :key="item.email">
|
|
145
|
-
<NuxtLink
|
|
146
|
-
v-if="item.uid && item.active"
|
|
147
|
-
:to="`${getPageBaseUrl('user')}/${item._id}`"
|
|
148
|
-
>
|
|
149
|
-
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
150
|
-
</NuxtLink>
|
|
151
|
-
</li>
|
|
152
|
-
</ul>
|
|
153
|
-
</TabPanel>
|
|
154
|
-
<TabPanel header="Inactive">
|
|
155
|
-
<ul role="list" class="divide-y divide-gray-100">
|
|
156
|
-
<li v-for="item in userlist" :key="item.email">
|
|
157
|
-
<NuxtLink
|
|
158
|
-
v-if="item.uid && !item.active"
|
|
159
|
-
:to="`${getPageBaseUrl('user')}/${item._id}`"
|
|
160
|
-
>
|
|
161
|
-
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
162
|
-
</NuxtLink>
|
|
163
|
-
</li>
|
|
164
|
-
</ul>
|
|
165
|
-
</TabPanel>
|
|
166
|
-
<TabPanel header="Invite">
|
|
167
|
-
<div class="padding p-2">
|
|
168
|
-
<form @submit.prevent="true" class="w-full">
|
|
169
|
-
<div class="p-inputgroup flex flex-row ">
|
|
170
|
-
<InputText
|
|
171
|
-
class="flex-1"
|
|
172
|
-
type="email"
|
|
173
|
-
placeholder="email"
|
|
174
|
-
v-model="inviteemail"
|
|
175
|
-
/>
|
|
176
|
-
<div class="p-inputgroup-addon p p-0">
|
|
177
|
-
<button label="Search"
|
|
178
|
-
class="border rounded-tl-none rounded-bl-none btn btn-primary -ml-1 h-full p-3 rounded-r-md"
|
|
179
|
-
@click="invite">
|
|
180
|
-
Invite
|
|
181
|
-
</button>
|
|
182
|
-
</div>
|
|
183
|
-
|
|
184
|
-
</div>
|
|
185
|
-
</form>
|
|
186
|
-
</div>
|
|
187
|
-
<ul role="list" class="divide-y divide-gray-100">
|
|
188
|
-
<li v-for="item in userlist" :key="item.email">
|
|
189
|
-
<NuxtLink
|
|
190
|
-
v-if="!item.uid"
|
|
191
|
-
:to="`${getPageBaseUrl('user')}/${item._id}`"
|
|
192
|
-
>
|
|
193
|
-
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
194
|
-
</NuxtLink>
|
|
195
|
-
</li>
|
|
196
|
-
</ul>
|
|
197
|
-
</TabPanel>
|
|
198
|
-
</TabView>
|
|
199
|
-
</div>
|
|
200
|
-
<div class="col-span-3 p-2">
|
|
201
|
-
<NuxtPage />
|
|
202
|
-
</div>
|
|
203
|
-
</div>
|
|
204
|
-
</template>
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
<dt
|
|
53
53
|
class="text-sm font-medium leading-6 text-gray-900 dark:text-gray-400"
|
|
54
54
|
>
|
|
55
|
-
{{t(
|
|
55
|
+
{{ t("branches") }}
|
|
56
56
|
</dt>
|
|
57
57
|
<dd class="mt-2 text-sm text-gray-900 sm:col-span-2 sm:mt-0">
|
|
58
58
|
<ul
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
</ul>
|
|
89
89
|
</dd>
|
|
90
90
|
</div>
|
|
91
|
+
|
|
91
92
|
|
|
92
93
|
<div
|
|
93
94
|
v-if="useRuntimeConfig().public.DEBUGDATA == '1'"
|
|
@@ -96,14 +97,22 @@
|
|
|
96
97
|
<dt
|
|
97
98
|
class="text-sm font-medium leading-6 text-gray-900 dark:text-gray-400"
|
|
98
99
|
>
|
|
99
|
-
{{t(
|
|
100
|
+
{{ t("more") }}
|
|
100
101
|
<p class="text-danger-600">{{ t("onlyAppearInDebugMode") }}</p>
|
|
101
102
|
<p class="text-danger-600">{{ getUserProfile().sessionId }}</p>
|
|
102
103
|
</dt>
|
|
103
104
|
<dd
|
|
104
105
|
class="mt-1 text-sm leading-6 text-gray-700 dark:text-gray-300 sm:col-span-2 sm:mt-0"
|
|
105
106
|
>
|
|
106
|
-
|
|
107
|
+
<div>
|
|
108
|
+
<p>{{t('accessRights')}}</p>
|
|
109
|
+
{{ getUserProfile().roles }}
|
|
110
|
+
</div>
|
|
111
|
+
<div>
|
|
112
|
+
<p>{{ t('others') }}</p>
|
|
113
|
+
{{ getUserProfile()?.country }} / {{ getUserProfile()?.currency }} / {{ getUserProfile()?.offsetMinute }}
|
|
114
|
+
</div>
|
|
115
|
+
|
|
107
116
|
</dd>
|
|
108
117
|
</div>
|
|
109
118
|
</dl>
|
|
@@ -10,6 +10,7 @@ import axios, { Axios, AxiosResponse } from 'axios'
|
|
|
10
10
|
import {Notification,EventType} from '~/types'
|
|
11
11
|
// import PrimeVue from "primevue/config";
|
|
12
12
|
import mitt from 'mitt'
|
|
13
|
+
|
|
13
14
|
// import ToastService from 'primevue/toastservice';
|
|
14
15
|
// import ConfirmationService from 'primevue/confirmationservice';
|
|
15
16
|
// import Tooltip from 'primevue/tooltip';
|
|
@@ -58,11 +59,9 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
58
59
|
console.error("unknown error")
|
|
59
60
|
throw createError({statusCode:500,statusMessage:"Internal server error"})
|
|
60
61
|
}
|
|
61
|
-
});
|
|
62
|
-
|
|
62
|
+
});
|
|
63
63
|
return {
|
|
64
64
|
provide: {
|
|
65
|
-
|
|
66
65
|
event: emitter.emit, // Will emit an event
|
|
67
66
|
listen: emitter.on, // Will register a listener for an event
|
|
68
67
|
axios: myaxios,
|
|
@@ -27,6 +27,8 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
27
27
|
orgName:ref(''),
|
|
28
28
|
timeZone:ref(''),
|
|
29
29
|
currency:ref(''),
|
|
30
|
+
country: ref(''),
|
|
31
|
+
offsetMinute: ref(0),
|
|
30
32
|
uid: ref(''),
|
|
31
33
|
email: ref(''),
|
|
32
34
|
fullName: ref(''),
|
|
@@ -70,6 +72,8 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
70
72
|
this.orgName = res.data.orgName
|
|
71
73
|
this.timeZone = res.data.timeZone
|
|
72
74
|
this.currency = res.data.currency
|
|
75
|
+
this.country = res.data.country
|
|
76
|
+
this.offsetMinute = res.data.offsetMinute
|
|
73
77
|
this.uid = res.data.uid
|
|
74
78
|
this.email = res.data.email
|
|
75
79
|
this.fullName = res.data.fullName
|
|
@@ -173,6 +177,8 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
173
177
|
orgName: this.orgName,
|
|
174
178
|
currency: this.currency,
|
|
175
179
|
timeZone: this.timeZone,
|
|
180
|
+
country: this.country,
|
|
181
|
+
offsetMinute: this.offsetMinute,
|
|
176
182
|
fullName : this.fullName,
|
|
177
183
|
branches:this.branches??[],
|
|
178
184
|
invites: this.invites ?? [],
|