@simitgroup/simpleapp-generator 1.0.59 → 1.0.60

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.
Files changed (96) hide show
  1. package/dist/buildinschemas/branch.d.ts.map +1 -1
  2. package/dist/buildinschemas/branch.js +1 -0
  3. package/dist/buildinschemas/branch.js.map +1 -1
  4. package/dist/buildinschemas/organization.d.ts.map +1 -1
  5. package/dist/buildinschemas/organization.js +1 -0
  6. package/dist/buildinschemas/organization.js.map +1 -1
  7. package/dist/buildinschemas/permission.js +1 -1
  8. package/dist/buildinschemas/permission.js.map +1 -1
  9. package/dist/buildinschemas/user.d.ts.map +1 -1
  10. package/dist/buildinschemas/user.js +4 -1
  11. package/dist/buildinschemas/user.js.map +1 -1
  12. package/dist/framework.js +1 -1
  13. package/dist/framework.js.map +1 -1
  14. package/dist/generate.js +6 -1
  15. package/dist/generate.js.map +1 -1
  16. package/dist/type.d.ts +1 -0
  17. package/dist/type.d.ts.map +1 -1
  18. package/docs/jsonschema.md +1 -0
  19. package/package.json +1 -1
  20. package/src/buildinschemas/branch.ts +1 -0
  21. package/src/buildinschemas/organization.ts +1 -0
  22. package/src/buildinschemas/permission.ts +1 -1
  23. package/src/buildinschemas/user.ts +4 -1
  24. package/src/framework.ts +1 -1
  25. package/src/generate.ts +6 -1
  26. package/src/type.ts +1 -0
  27. package/templates/basic/nest/controller.ts.eta +5 -3
  28. package/templates/basic/nest/model.ts.eta +32 -7
  29. package/templates/basic/nuxt/pages.crud.vue.eta +59 -163
  30. package/templates/basic/nuxt/pages.index.vue.eta +225 -0
  31. package/templates/nest/.env._eta +1 -0
  32. package/templates/nest/src/simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta +1 -1
  33. package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +1 -1
  34. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +127 -22
  35. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +1 -1
  36. package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +25 -2
  37. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +20 -2
  38. package/templates/nest/src/simpleapp/services/branch.service.ts.eta +41 -40
  39. package/templates/nest/src/simpleapp/services/user.service.ts.eta +10 -9
  40. package/templates/nuxt/app.vue.eta +2 -1
  41. package/templates/nuxt/assets/css/style.css._eta +3 -12
  42. package/templates/nuxt/assets/primevue/passthrough.ts._eta +24 -20
  43. package/templates/nuxt/components/ButtonCreateTenant.vue.eta +30 -23
  44. package/templates/nuxt/components/ButtonHome.vue.eta +15 -2
  45. package/templates/nuxt/components/ButtonMenuPicker.vue.eta +5 -20
  46. package/templates/nuxt/components/ButtonPermissionInfo.vue.eta +5 -7
  47. package/templates/nuxt/components/ButtonProfile.vue.eta +42 -25
  48. package/templates/nuxt/components/CrudSimple.vue.eta +1 -1
  49. package/templates/nuxt/components/EventDecision.vue.eta +115 -0
  50. package/templates/nuxt/components/EventNotification.vue.eta +157 -0
  51. package/templates/nuxt/components/HeaderBar.vue.eta +2 -2
  52. package/templates/nuxt/components/Invitation.vue.eta +3 -3
  53. package/templates/nuxt/components/SelectBranch.vue.eta +5 -2
  54. package/templates/nuxt/components/SimpleAppDatatable.vue.eta +151 -5
  55. package/templates/nuxt/components/TenantPicker.vue.eta +75 -0
  56. package/templates/nuxt/components/UserProfileListItem.vue.eta +65 -0
  57. package/templates/nuxt/components/renderers/BooleanRender.vue.eta +7 -0
  58. package/templates/nuxt/components/renderers/DateRender.vue.eta +6 -0
  59. package/templates/nuxt/components/renderers/ForeignKeyRender.vue.eta +10 -0
  60. package/templates/nuxt/components/renderers/MoneyRender.vue.eta +7 -0
  61. package/templates/nuxt/components/renderers/MultiTextRender.vue.eta +11 -0
  62. package/templates/nuxt/composables/getDocument.generate.ts.eta +4 -0
  63. package/templates/nuxt/composables/getMenus.generate.ts.eta +35 -31
  64. package/templates/nuxt/composables/getUserStore.generate.ts.eta +6 -1
  65. package/templates/nuxt/composables/goTo.generate.ts.eta +15 -0
  66. package/templates/nuxt/composables/notifications.generate.ts.eta +21 -0
  67. package/templates/nuxt/composables/stringHelper.generate.ts.eta +11 -1
  68. package/templates/nuxt/error.vue._eta +20 -5
  69. package/templates/nuxt/layouts/documentlist.vue.eta +166 -0
  70. package/templates/nuxt/middleware/30.acl.global.ts.eta +4 -1
  71. package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +4 -4
  72. package/templates/nuxt/pages/[xorg]/profile.vue.eta +6 -0
  73. package/templates/nuxt/pages/[xorg]/user/[id].vue.eta +6 -0
  74. package/templates/nuxt/pages/[xorg]/user/index.vue.eta +211 -377
  75. package/templates/nuxt/pages/[xorg]/user.vue.eta +197 -0
  76. package/templates/nuxt/pages/index.vue._eta +101 -0
  77. package/templates/nuxt/pages/profile.vue.eta +94 -0
  78. package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +4 -4
  79. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +11 -10
  80. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +69 -17
  81. package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +6 -3
  82. package/templates/nuxt/tailwind.config.ts._eta +10 -0
  83. package/templates/nuxt/types/documentlist.ts.eta +9 -0
  84. package/templates/nuxt/types/events.ts.eta +20 -0
  85. package/templates/nuxt/types/index.ts.eta +6 -79
  86. package/templates/nuxt/types/notifications.ts.eta +16 -0
  87. package/templates/nuxt/types/others.ts.eta +42 -0
  88. package/templates/nuxt/types/user.ts.eta +44 -0
  89. package/tsconfig.tsbuildinfo +1 -1
  90. package/templates/nest/src/simpleapp/generate/models/perm.model.ts.eta +0 -52
  91. package/templates/nest/src/simpleapp/generate/models/tenant.model.ts.eta +0 -43
  92. package/templates/nest/src/simpleapp/generate/models/user.model.ts.eta +0 -56
  93. package/templates/nuxt/components/EventMonitor.vue.eta +0 -85
  94. package/templates/nuxt/pages/[xorg]/tenant/index.vue.eta +0 -89
  95. package/templates/nuxt/pages/index.vue.eta +0 -116
  96. package/templates/nuxt/simpleapp/generate/commons/events.ts.eta +0 -11
@@ -1,97 +1,215 @@
1
+ <template>
2
+ <div class="grid grid-cols-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
+ <SimpleAppText
11
+ autofocus
12
+ :setting="o.getField('#/properties/fullname')"
13
+ v-model="userdata.fullname"
14
+ />
15
+
16
+ <SimpleAppText
17
+ autofocus
18
+ type="string"
19
+ :setting="o.getField('#/properties/email')"
20
+ v-model="userdata.email"
21
+ />
22
+
23
+ <SimpleAppCheckbox
24
+ autofocus
25
+ :setting="o.getField('#/properties/active')"
26
+ v-model="userdata.active"
27
+ />
28
+ <SimpleAppTextarea
29
+ autofocus
30
+ :setting="o.getField('#/properties/description')"
31
+ v-model="userdata.description"
32
+ />
33
+ <div>
34
+ <Button
35
+ @click="saveUser"
36
+ class="text-white hover:bg-primary-400 bg-primary-600"
37
+ >Save</Button
38
+ >
39
+ <Button
40
+ v-if="canPerform('user', 'delete')"
41
+ @click="deleteUser"
42
+ class="text-white hover:bg-danger-400 bg-danger-600"
43
+ >Delete</Button
44
+ >
45
+ </div>
46
+ </div>
47
+ </SimpleAppForm>
48
+ </template>
49
+ </Card>
50
+
51
+ <Card class="m-2">
52
+ <template #header>
53
+ <div class="relative w-full ...">
54
+ <h1 class="font-bold">{{ permissiontitle }}</h1>
55
+ <div class="absolute top-0 right-0 h-16 w-16 ...">
56
+ <ButtonPermissionInfo></ButtonPermissionInfo>
57
+ </div>
58
+ </div>
59
+ </template>
60
+ <template #content>
61
+ <BlockUI :blocked="blockscreen">
62
+ <!-- <div class="text-right m mr-2">
63
+
64
+ </div> -->
65
+
66
+ <div class="">
67
+ <Card v-for="o in orglist" class="m-2">
68
+ <template #title>{{ o.orgName }}</template>
69
+ <template #content>
70
+ <table class="w w-full">
71
+ <!-- <thead class="">
72
+ <tr>
73
+ <th class="text-center font-normal">Branch</th>
74
+ <th class="text-left font-normal">Access Right</th>
75
+ </tr>
76
+ </thead> -->
77
+ <tr v-for="(b, index) in branchlist">
78
+ <td v-if="checkBranchInOrg(o, b)" class="text-center">
79
+ {{ b.branchCode }}
80
+ </td>
81
+ <td
82
+ v-if="checkBranchInOrg(o, b)"
83
+ class="text-center flex flex-row"
84
+ >
85
+ <div>
86
+ <SelectButton
87
+ v-model="currentpermissions[index]['group']"
88
+ :options="grouplist"
89
+ option-label="label"
90
+ option-value="value"
91
+ @change="applyPermission(currentpermissions[index])"
92
+ ></SelectButton>
93
+ </div>
94
+ </td>
95
+ </tr>
96
+ </table>
97
+ </template>
98
+ </Card>
99
+ </div>
100
+ </BlockUI>
101
+ </template>
102
+ </Card>
103
+ </div>
104
+ </template>
1
105
  <script setup lang="ts">
2
- /**
3
- * invite user into current tenant (put user into user catalogue)
4
- * 1. user accept then have uid
5
- * 2. no uid user will put at invite place
6
- *
7
- */
8
- import Menu from "primevue/menu";
9
- import Dialog from "primevue/dialog";
10
- import { SearchBody } from "~/types";
106
+ import Card from "primevue/card";
107
+ import { Permission, User } from "../../../simpleapp/generate/openapi/api";
11
108
  import _ from "lodash";
12
- import Panel from "primevue/panel";
13
- import { ref } from "vue";
109
+ import SelectButton from "primevue/selectbutton";
110
+ import { SearchBody, EventType } from "~/types";
111
+
14
112
  import {
15
113
  UserListItem,
114
+ NotificationStatus,
115
+ Notification,
16
116
  BranchListItem,
17
117
  OrgListItem,
18
118
  PermissionListItem,
19
- } from "../../../types";
20
- import SelectButton from "primevue/selectbutton";
21
- import Button from "primevue/button";
22
- import InputText from "primevue/inputtext";
23
- import Card from "primevue/card";
24
- import TabView from "primevue/tabview";
25
- import TabPanel from "primevue/tabpanel";
26
- import { Permission, User } from "../../../simpleapp/generate/openapi/api";
27
- import BlockUI from "primevue/blockui";
28
-
29
- //initialize api
119
+ } from "~/types";
30
120
  const {
121
+ $event,
31
122
  $PermissionDoc,
32
123
  $OrganizationDoc,
33
124
  $BranchDoc,
34
125
  $UserDoc,
35
126
  // $InvitationDoc,
36
127
  } = useNuxtApp();
37
- const permdoc = $PermissionDoc();
38
- const orgdoc = $OrganizationDoc();
39
- const branchdoc = $BranchDoc();
40
- // const invitedoc = $InvitationDoc();
41
128
  const userdoc = $UserDoc();
42
129
  const userdata = userdoc.getReactiveData();
43
- //initialize require list in UI
130
+ const currentpermissions = ref<Permission[]>([]);
131
+ currentpermissions.value = [];
132
+ const blockscreen = ref(false);
44
133
  const permlist = ref<PermissionListItem[]>([]);
45
- const userlist = ref<UserListItem[]>([]);
46
-
134
+ // const userlist = ref<UserListItem[]>([]);
47
135
  const orglist = ref<OrgListItem[]>([]);
48
136
  const branchlist = ref<BranchListItem[]>([]);
49
- const currentpermissions = ref<Permission[]>([]);
137
+ const permdoc = $PermissionDoc();
138
+ const orgdoc = $OrganizationDoc();
139
+ const branchdoc = $BranchDoc();
140
+ const permissiontitle = "Permission Information";
141
+ const usertitle = "User Information";
50
142
  const grouplist = getAllGroups().map((item) => {
51
143
  return { value: item, label: _.capitalize(item) };
52
144
  });
53
145
 
54
- //initialize some runtime variable
55
- const blockscreen = ref(false);
56
- const inviteemail = ref("");
57
- const selected = ref("");
58
- const activeuser = ref("");
59
- const showpermissioninfo = ref(false);
60
- const permissionselected = ref();
61
- const usertitle = "User Information";
62
- const permissiontitle = "Permission Information";
146
+ /**
147
+ * delete user
148
+ * @param user:User object
149
+ */
150
+ const deleteUser = async (user: any) => {
151
+ await userdoc.delete(String(userdata.value._id));
152
+ //NotificationEvent
153
+ $event("RefreshUser", "");
154
+ goTo("user");
155
+ };
63
156
 
157
+ /**********applPermission ******/
64
158
  /**
65
- * 1. get all users from this tenant
66
- * @param resetpage after reload, will it reset user interface or remain as current
159
+ * apply permission:
160
+ * _id:'', group:'' => skip
161
+ * _id: '', group:'something' => create
162
+ * _id:'something', 'group':'something' => update
163
+ * _id:'something', group:'' => remove
67
164
  */
68
- const refreshList = async (resetpage: boolean = true) => {
69
- const items: any[] = [];
70
- const searchbody: SearchBody = {
71
- fields: ["uid", "email", "created", "fullname", "active"],
165
+ const applyPermission = async (d: Permission) => {
166
+ let result;
167
+ // console.log("apply permission", d);
168
+ blockscreen.value = true;
169
+ d._id = String(d._id ?? "");
170
+ d.group = String(d.group ?? "");
171
+ permdoc.setNew();
172
+ const data = permdoc.getReactiveData();
173
+ data.value = {
174
+ orgId: d.orgId,
175
+ branchId: d.branchId,
176
+ group: d.group,
177
+ userId: d.userId,
72
178
  };
73
- userlist.value = await userdoc.search(searchbody);
74
- //listUser();
75
- // userlist.value = _.uniqBy(permlist.value, "uid");
76
- if (resetpage) {
77
- selected.value = "";
78
- activeuser.value = "";
179
+ // console.log("apply permission", data.value);
180
+ if (!d._id && !d.group) {
181
+ //no changes
182
+ } else if (!d._id && d.group) {
183
+ result = await permdoc.create();
184
+ } else if (d._id && d.group) {
185
+ data.value = d;
186
+ result = await permdoc.update();
187
+ } else if (d._id && !d.group) {
188
+ d.group = "";
189
+ data.value = d;
190
+ result = await permdoc.delete(d._id);
191
+ } else {
192
+ console.warn("unknown apply permission", result);
79
193
  }
194
+ // refreshList(false);
195
+ onSelectUser(String(d.userId));
80
196
  blockscreen.value = false;
81
- // console.log("userlist", userlist.value);
82
197
  };
83
198
 
84
- /**
85
- * 2. select specific user
86
- * - get list of
87
- * a. orglist
88
- * b. branch list
89
- * c. permission for that user
90
- * - render organization and branch ui
91
- * @param user
92
- */
93
- const onSelectUser = async (menuitem: any) => {
94
- const user: UserListItem = { ...menuitem };
199
+ const checkBranchInOrg = (org: OrgListItem, branch: BranchListItem) => {
200
+ return org.orgId === branch.orgId;
201
+ };
202
+
203
+ const saveUser = async () => {
204
+ await userdoc.update();
205
+ $event("RefreshUser", "");
206
+ onSelectUser(String(userdata.value._id));
207
+ };
208
+
209
+ const onSelectUser = async (userId: string) => {
210
+ console.log('onSelectUser',userId)
211
+ // .addRoute()
212
+ // const user: UserListItem = { ...menuitem };
95
213
  const orgsearchbody: SearchBody = {
96
214
  fields: ["orgId", "orgCode", "orgName", "active"],
97
215
  };
@@ -99,9 +217,10 @@ const onSelectUser = async (menuitem: any) => {
99
217
  fields: ["orgId", "branchId", "branchCode", "branchName", "active"],
100
218
  };
101
219
  const permsearchbody: SearchBody = {
102
- filter: { $or: [{ uid: user.uid }, { user_id: user._id }] },
220
+ filter: { userId: userId },
103
221
  fields: [
104
222
  "uid",
223
+ "userId",
105
224
  "branchId",
106
225
  "tenantId",
107
226
  "orgId",
@@ -114,26 +233,25 @@ const onSelectUser = async (menuitem: any) => {
114
233
  orglist.value = await orgdoc.search(orgsearchbody);
115
234
  branchlist.value = await branchdoc.search(branchsearchbody);
116
235
  permlist.value = await permdoc.search(permsearchbody);
117
- userdoc.getById(menuitem._id);
236
+ await userdoc.getById(userId);
118
237
  // console.log("orglist.value", orglist.value);
119
238
  // console.log("branchlist.value", branchlist.value);
120
239
  // console.log("permlist.value", permlist.value);
121
- selected.value = String(user._id);
240
+ // selected.value = String(user._id);
122
241
 
123
- activeuser.value = user.fullName;
242
+ // activeuser.value = user.fullName;
124
243
  //sso id from keycloak
125
- const uid = String(user.uid);
244
+ // const uid = String(user.uid);
126
245
  //_id from mongodb
127
- const user_id = String(user._id);
246
+
128
247
  currentpermissions.value = [];
129
248
 
130
249
  for (let i = 0; i < branchlist.value.length; i++) {
131
250
  const b = branchlist.value[i];
132
- const permdata = getPermssionData(uid, b.branchId);
251
+ const permdata = getPermssionData(userId, b.branchId);
133
252
  const tmp: Permission = {
134
253
  _id: permdata?._id,
135
- uid: uid,
136
- user_id: user_id,
254
+ userId: userId,
137
255
  tenantId: b.tenantId,
138
256
  orgId: b.orgId,
139
257
  branchId: b.branchId,
@@ -141,328 +259,44 @@ const onSelectUser = async (menuitem: any) => {
141
259
  };
142
260
  currentpermissions.value.push(tmp);
143
261
  }
262
+ // console.log("currentpermissions", currentpermissions);
144
263
  blockscreen.value = false;
145
264
  };
146
-
147
265
  /**
148
266
  * prepare dataobj (existing or empty dummy data) for each branch permission
149
267
  * @param uid
150
268
  * @param branchId
151
269
  */
152
- const getPermssionData = (uid: string, branchId: number) => {
153
- const result = permlist.value.find(
154
- (el) => el.uid == uid && el.branchId == branchId,
155
- );
270
+ const getPermssionData = (userId: string, branchId: number) => {
271
+ // console.log("getPermssionData", userId, branchId);
272
+ const result = permlist.value.find((item: any) => {
273
+ // console.log(
274
+ // item.userId,
275
+ // "== ",
276
+ // userId,
277
+ // " &&",
278
+ // item.branchId,
279
+ // "==",
280
+ // branchId,
281
+ // );
282
+ return item.userId == userId && item.branchId == branchId;
283
+ });
284
+
285
+ // console.log("permlist.value.",permlist.value,result)
156
286
  let pm: Permission = {
157
287
  _id: result?._id ?? "",
158
288
  orgId: result?.orgId ?? 0,
159
289
  tenantId: result?.tenantId ?? 0,
160
290
  branchId: branchId,
161
- uid: uid,
291
+ userId: userId,
162
292
  group: result?.group ?? "",
163
293
  };
164
294
  return pm;
165
295
  };
166
296
 
167
- /**
168
- * identity branch object under org
169
- * @param org object of org
170
- * @param branch object of branch
171
- */
172
- const checkBranchInOrg = (org: OrgListItem, branch: BranchListItem) => {
173
- return org.orgId === branch.orgId;
174
- };
175
-
176
- /**
177
- * generate dialog for view each user group have what permission
178
- */
179
- const previewPermission = () => {
180
- showpermissioninfo.value = true;
181
- };
182
-
183
- /***** send or remove invitation ******/
184
- const saveUser = async () => {
185
- await userdoc.update();
186
- refreshList(false);
187
- };
188
- const invite = async () => {
189
- // const invitedata:User = {}
190
- const currentuser = getUserProfile();
191
- const inviteuserdoc = $UserDoc();
192
- inviteuserdoc.setNew();
193
- const newuserdata = inviteuserdoc.getReactiveData();
194
- newuserdata.value.email = inviteemail.value;
195
- newuserdata.value.fullname = inviteemail.value.split("@")[0];
196
- newuserdata.value.active = true;
197
- newuserdata.value.tenantId = currentuser.tenantId;
198
- newuserdata.value.orgId = currentuser.orgId;
199
- newuserdata.value.branchId = currentuser.branchId;
200
-
201
- const invitedata = await inviteuserdoc.create();
202
- inviteemail.value = "";
203
- await refreshList();
204
- onSelectUser(invitedata);
205
- };
206
-
207
- /**
208
- * delete user
209
- * @param user:User object
210
- */
211
- const deleteUser = async (user: any) => {
212
- await userdoc.delete(String(user._id));
213
- refreshList();
214
- };
215
-
216
- /**********applPermission ******/
217
- /**
218
- * apply permission:
219
- * _id:'', group:'' => skip
220
- * _id: '', group:'something' => create
221
- * _id:'something', 'group':'something' => update
222
- * _id:'something', group:'' => remove
223
- */
224
- const applPermission = async (d: Permission) => {
225
- let result;
226
- blockscreen.value = true;
227
- d._id = String(d._id ?? "");
228
- d.group = String(d.group ?? "");
229
- const data = permdoc.getReactiveData();
230
- data.value = d;
231
- // console.log("apply permission", data.value);
232
- if (!d._id && !d.group) {
233
- //no changes
234
- } else if (!d._id && d.group) {
235
- result = await permdoc.create();
236
- } else if (d._id && d.group) {
237
- data.value = d;
238
- result = await permdoc.update();
239
- } else if (d._id && !d.group) {
240
- d.group = "";
241
- data.value = d;
242
- result = await permdoc.delete(d._id);
243
- } else {
244
- console.warn("unknown apply permission", result);
245
- }
246
- refreshList(false);
247
- blockscreen.value = false;
248
- };
249
- //init ui
250
297
  onMounted(() => {
251
- refreshList();
298
+ const id = String(useRoute().params.id);
299
+ console.log("id",id)
300
+ onSelectUser(id);
252
301
  });
253
302
  </script>
254
- <template>
255
- <Button
256
- @click="refreshList()"
257
- v-if="useRuntimeConfig().public.DEBUGDATA"
258
- class="pi pi-refresh"
259
- ></Button>
260
- <div class="grid grid-cols-4">
261
- <div v-if="userlist">
262
- <TabView>
263
- <TabPanel header="Active">
264
- <Menu
265
- :model="userlist"
266
- class="w w-auto border border-solid border-1"
267
- :pt="{ root: { class: 'w-auto ' } }"
268
- >
269
- <template #start>
270
- <div class="flex flex-column align">
271
- <h1>Users</h1>
272
- </div>
273
- </template>
274
- <template #item="{ item, label, props }">
275
- <a
276
- v-if="item.uid && item.active"
277
- class="flex m-2 p-2 flex-row border border-b-2 cursor cursor-pointer"
278
- @click="onSelectUser(item)"
279
- >
280
- <div class="flex-col basis-5/6">
281
- <div class="text text-left text-base text-black">
282
- {{ item.fullname }}
283
- </div>
284
- <div class="text text-sm text-right">{{ item.email }}</div>
285
- </div>
286
- <div class="basis-1/6 m-2">
287
- <!-- only debug mode can delete user -->
288
- <Button
289
- v-if="useRuntimeConfig().public.DEBUGDATA"
290
- class="pi pi-times btn-danger"
291
- @click="deleteUser(item)"
292
- ></Button>
293
- </div>
294
- </a>
295
- </template>
296
- </Menu>
297
- </TabPanel>
298
- <TabPanel header="Inactive">
299
- <Menu
300
- :model="userlist"
301
- class="w w-auto border border-solid border-1"
302
- :pt="{ root: { class: 'w-auto ' } }"
303
- >
304
- <template #start>
305
- <div class="flex flex-column align">
306
- <h1>Users</h1>
307
- </div>
308
- </template>
309
- <template #item="{ item, label, props }">
310
- <a
311
- v-if="item.uid && !item.active"
312
- class="flex m-2 p-2 flex-row border border-b-2 cursor cursor-pointer"
313
- @click="onSelectUser(item)"
314
- >
315
- <div class="flex-col basis-5/6">
316
- <div class="text text-left text-base text-black">
317
- {{ item.fullname }}
318
- </div>
319
- <div class="text text-sm text-right">{{ item.email }}</div>
320
- </div>
321
- <div class="basis-1/6 m-2">
322
- <!-- only debug mode can delete user -->
323
- <Button
324
- v-if="useRuntimeConfig().public.DEBUGDATA"
325
- class="pi pi-times btn-danger"
326
- @click="deleteUser(item)"
327
- ></Button>
328
- </div>
329
- </a>
330
- </template>
331
- </Menu>
332
- </TabPanel>
333
- <TabPanel header="Invite">
334
- <div class="padding p-2">
335
- <form @submit.prevent="true" class="w-full">
336
- <div class="p-inputgroup flex-1">
337
- <InputText
338
- type="email"
339
- placeholder="email"
340
- v-model="inviteemail"
341
- />
342
- <Button label="Search" class="btn btn-primary" @click="invite">
343
- Invite
344
- </Button>
345
- </div>
346
- </form>
347
- </div>
348
- <Menu
349
- :model="userlist"
350
- class="w w-auto border border-solid border-1"
351
- :pt="{ root: { class: 'w-auto ' } }"
352
- >
353
- <template #start>
354
- <div class="flex flex-column align">
355
- <h1>Users</h1>
356
- </div>
357
- </template>
358
- <template #item="{ item, label, props }">
359
- <a
360
- v-if="item.uid == ''"
361
- class="flex m-2 p-2 flex-row border border-b-2 cursor cursor-pointer"
362
- @click="onSelectUser(item)"
363
- >
364
- <div class="flex-col basis-5/6">
365
- <div class="text text-left text-base text-black">
366
- {{ item.fullname }}
367
- </div>
368
- <div class="text text-sm text-right">{{ item.email }}</div>
369
- </div>
370
- <div class="basis-1/6 m-2">
371
- <Button
372
- class="pi pi-times btn-danger"
373
- @click="deleteUser(item)"
374
- ></Button>
375
- </div>
376
- </a>
377
- </template>
378
- </Menu>
379
- </TabPanel>
380
- </TabView>
381
- </div>
382
- <div class="col-span-3" v-if="selected">
383
- <Panel
384
- :pt="{ content: { class: 'bg-sky-50' } }"
385
- class="m-2"
386
- :header="usertitle"
387
- >
388
- <SimpleAppForm :document="userdoc" #default="o">
389
- <div class="grid grid-cols-4 gap-4 p">
390
- <SimpleAppText
391
- autofocus
392
- :setting="o.getField('#/properties/fullname')"
393
- v-model="userdata.fullname"
394
- />
395
-
396
- <SimpleAppText
397
- autofocus
398
- type="string"
399
- :setting="o.getField('#/properties/email')"
400
- v-model="userdata.email"
401
- />
402
-
403
- <SimpleAppCheckbox
404
- autofocus
405
- :setting="o.getField('#/properties/active')"
406
- v-model="userdata.active"
407
- />
408
- <div>
409
- <Button @click="saveUser" class="btn-primary pi pi-save"></Button>
410
- </div>
411
- </div>
412
- </SimpleAppForm>
413
- </Panel>
414
-
415
- <Panel
416
- :pt="{ content: { class: 'bg-sky-50' } }"
417
- class="m-2"
418
- :header="permissiontitle"
419
- >
420
- <BlockUI :blocked="blockscreen">
421
- <div class="text-right m mr-2">
422
- <ButtonPermissionInfo></ButtonPermissionInfo>
423
- </div>
424
-
425
- <div class="grid grid-cols-2">
426
- <Card v-for="o in orglist" class="m-2">
427
- <template #title>{{ o.orgName }}</template>
428
- <template #content>
429
- <table class="w w-full">
430
- <thead class="">
431
- <tr>
432
- <th>Branch Code</th>
433
- <th>Access Right</th>
434
- </tr>
435
- </thead>
436
- <tr v-for="(b, index) in branchlist">
437
- <td v-if="checkBranchInOrg(o, b)">{{ b.branchCode }}</td>
438
- <td v-if="checkBranchInOrg(o, b)" clas="flex flex-row">
439
- <div>
440
- <SelectButton
441
- :pt="{
442
- button: {
443
- class: 'text-xs border border-1 bg-sky-primary',
444
- },
445
- }"
446
- v-model="currentpermissions[index].group"
447
- :options="grouplist"
448
- option-label="label"
449
- option-value="value"
450
- @change="applPermission(currentpermissions[index])"
451
- ></SelectButton>
452
- </div>
453
- </td>
454
- </tr>
455
- </table>
456
- </template>
457
- </Card>
458
- </div>
459
- </BlockUI>
460
- </Panel>
461
- </div>
462
- </div>
463
- </template>
464
- <style scoped>
465
- td {
466
- text-align: center;
467
- }
468
- </style>