@simitgroup/simpleapp-generator 1.3.5-alpha → 1.4.1-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.
Files changed (74) hide show
  1. package/dist/buildinschemas/permission.d.ts.map +1 -1
  2. package/dist/buildinschemas/permission.js +10 -6
  3. package/dist/buildinschemas/permission.js.map +1 -1
  4. package/dist/buildinschemas/user.d.ts.map +1 -1
  5. package/dist/buildinschemas/user.js +22 -2
  6. package/dist/buildinschemas/user.js.map +1 -1
  7. package/dist/generate.js +20 -6
  8. package/dist/generate.js.map +1 -1
  9. package/dist/type.d.ts +2 -0
  10. package/dist/type.d.ts.map +1 -1
  11. package/dist/type.js.map +1 -1
  12. package/package.json +1 -1
  13. package/src/buildinschemas/permission.ts +10 -6
  14. package/src/buildinschemas/user.ts +23 -3
  15. package/src/generate.ts +19 -6
  16. package/src/type.ts +3 -1
  17. package/templates/basic/nest/service.ts.eta +7 -3
  18. package/templates/basic/nuxt/pages.[id].vue.eta +4 -4
  19. package/templates/basic/nuxt/pages.mobile.[id].vue.eta +39 -0
  20. package/templates/basic/nuxt/pages.mobile.landing.vue.eta +69 -0
  21. package/templates/nest/src/simpleapp/apischemas/index.ts._eta +29 -0
  22. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +22 -12
  23. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +26 -1
  24. package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +2 -1
  25. package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +1 -1
  26. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +1 -1
  27. package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +1 -1
  28. package/templates/nest/src/simpleapp/services/perm.service.ts.eta +5 -7
  29. package/templates/nest/src/simpleapp/services/user.service.ts.eta.old +118 -0
  30. package/templates/nest/src/simpleapp/types/index.ts._eta +8 -0
  31. package/templates/nuxt/app.vue._eta +31 -17
  32. package/templates/nuxt/assets/primevue/passthrough.ts._eta +1 -1
  33. package/templates/nuxt/components/calendar/CalendarByResource.vue.eta +181 -163
  34. package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +8 -6
  35. package/templates/nuxt/components/form/FormDocnoformat.vue.eta +174 -0
  36. package/templates/nuxt/components/form/FormUser.vue._eta +91 -0
  37. package/templates/nuxt/components/form/user/FormUserPermission.vue.eta +83 -0
  38. package/templates/nuxt/components/header/HeaderBar.vue._eta +43 -39
  39. package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +7 -9
  40. package/templates/nuxt/components/page/PageDocList.vue.eta +6 -4
  41. package/templates/nuxt/components/renderer/RendererDateTime.vue.eta +13 -0
  42. package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +6 -3
  43. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +3 -4
  44. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +48 -4
  45. package/templates/nuxt/composables/date.generate.ts.eta +3 -1
  46. package/templates/nuxt/composables/goTo.generate.ts.eta +4 -1
  47. package/templates/nuxt/layouts/mobile.vue._eta +26 -12
  48. package/templates/nuxt/nuxt.config.ts._eta +27 -20
  49. package/templates/nuxt/pages/[xorg]/{user/index.vue.eta → docnoformat/[id].vue.eta} +11 -9
  50. package/templates/nuxt/pages/[xorg]/docnoformat.vue.eta +51 -20
  51. package/templates/nuxt/pages/[xorg]/mobile/docnoformat/index.vue.eta +59 -0
  52. package/templates/nuxt/pages/[xorg]/mobile/index.vue._eta +19 -0
  53. package/templates/nuxt/pages/[xorg]/mobile/organization/index.vue.eta +138 -0
  54. package/templates/nuxt/pages/[xorg]/mobile/pickgroup.vue._eta +35 -0
  55. package/templates/nuxt/pages/[xorg]/mobile/user/index.vue.eta +231 -0
  56. package/templates/nuxt/pages/[xorg]/pickgroup.vue._eta +35 -0
  57. package/templates/nuxt/pages/[xorg]/user.vue.eta +91 -74
  58. package/templates/nuxt/pages/profile.vue.eta +7 -7
  59. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +14 -3
  60. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +18 -16
  61. package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +1 -1
  62. package/templates/nuxt/types/events.ts.eta +1 -0
  63. package/templates/nuxt/types/simpleappinput.ts.eta +3 -2
  64. package/templates/nuxt/types/user.ts.eta +2 -1
  65. package/tsconfig.tsbuildinfo +1 -1
  66. package/templates/nest/src/simpleapp/services/user.service.ts.etax +0 -66
  67. package/templates/nuxt/pages/[xorg]/docnoformat/[doctype]/[id].vue.eta +0 -13
  68. package/templates/nuxt/pages/[xorg]/docnoformat/[doctype]/new.vue.eta +0 -229
  69. package/templates/nuxt/pages/[xorg]/docnoformat/[doctype].vue.eta +0 -38
  70. package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +0 -11
  71. package/templates/nuxt/pages/[xorg]/user/[id].vue.eta +0 -39
  72. package/templates/nuxt/pages/[xorg]/user/form.vue.eta +0 -334
  73. package/templates/nuxt/pages/[xorg]/user/new.vue.eta +0 -18
  74. package/templates/nuxt/pages/[xorg]/user/viewer.vue.eta +0 -29
@@ -0,0 +1,231 @@
1
+ <template>
2
+ <div class="w-full flex flex-col p-3">
3
+
4
+
5
+ <div><TextTitle>{{ t('user') }}</TextTitle></div>
6
+ <div class="flex flex-row w-full ">
7
+ <title>{{ t("user") }}</title>
8
+
9
+ <div class="w-full md:w-1/2 xl:w-1/3">
10
+ <TabView>
11
+ <TabPanel header="Active">
12
+ <ul role="list" class="divide-y divide-gray-100">
13
+ <li v-for="item in userlist" :key="item.email">
14
+ <NuxtLink
15
+ v-if="item.uid && item.active"
16
+ :to="getDocumentUrl('user', item._id)"
17
+ >
18
+ <UserProfileListItem :data="item"></UserProfileListItem>
19
+ </NuxtLink>
20
+ </li>
21
+ </ul>
22
+ </TabPanel>
23
+ <TabPanel header="Inactive">
24
+ <ul role="list" class="divide-y divide-gray-100">
25
+ <li v-for="item in userlist" :key="item.email">
26
+ <NuxtLink
27
+ v-if="item.uid && !item.active"
28
+ :to="getDocumentUrl('user', item._id)"
29
+ >
30
+ <UserProfileListItem :data="item"></UserProfileListItem>
31
+ </NuxtLink>
32
+ </li>
33
+ </ul>
34
+ </TabPanel>
35
+ <TabPanel header="Invite">
36
+ <div class="padding p-2">
37
+ <form @submit.prevent="true" class="w-full">
38
+ <div class="p-inputgroup flex flex-row">
39
+ <InputText
40
+ class="flex-1"
41
+ type="email"
42
+ placeholder="email"
43
+ v-model="inviteemail"
44
+ />
45
+ <div class="p-inputgroup-addon p p-0">
46
+ <button
47
+ label="Search"
48
+ class="border rounded-tl-none rounded-bl-none btn btn-primary -ml-1 h-full p-3 rounded-r-md"
49
+ @click="invite"
50
+ >
51
+ Invite
52
+ </button>
53
+ </div>
54
+ </div>
55
+ </form>
56
+ </div>
57
+ <ul role="list" class="divide-y divide-gray-100">
58
+ <li v-for="item in userlist" :key="item.email">
59
+ <NuxtLink v-if="!item.uid" :to="getDocumentUrl('user', item._id)">
60
+ <UserProfileListItem :data="item"></UserProfileListItem>
61
+ </NuxtLink>
62
+ </li>
63
+ </ul>
64
+ </TabPanel>
65
+ </TabView>
66
+ </div>
67
+ <div v-if="!isMobile()" class="flex-1">
68
+ <NuxtPage :_id="userid" />
69
+ </div>
70
+ <OverlaySideBarCrud
71
+ v-if="dialogvisible"
72
+ v-model="dialogvisible"
73
+ closeEventName="user"
74
+ >
75
+ <NuxtPage :_id="userid" />
76
+ </OverlaySideBarCrud>
77
+ </div>
78
+ </div>
79
+ </template>
80
+
81
+ <script setup lang="ts">
82
+ /**
83
+ * This file was automatically generated by simpleapp generator. Every
84
+ * MODIFICATION OVERRIDE BY GENERATEOR
85
+ * last change 2023-10-28
86
+ * Author: Ks Tan
87
+ */
88
+ // import userchild from './userchild.vue'
89
+ import Menu from "primevue/menu";
90
+ import Dialog from "primevue/dialog";
91
+ import { SearchBody, EventType, UserProfile } from "~/types";
92
+ import _ from "lodash";
93
+ import Panel from "primevue/panel";
94
+ import { ref } from "vue";
95
+ import {
96
+ UserListItem,
97
+ BranchListItem,
98
+ OrgListItem,
99
+ PermissionListItem,
100
+ } from "~/types";
101
+ import SelectButton from "primevue/selectbutton";
102
+ import Button from "primevue/button";
103
+ import InputText from "primevue/inputtext";
104
+ import Card from "primevue/card";
105
+ import TabView from "primevue/tabview";
106
+ import TabPanel from "primevue/tabpanel";
107
+ import { Permission, User } from "~/simpleapp/generate/openapi/api";
108
+ import BlockUI from "primevue/blockui";
109
+ const dialogvisible = ref(false);
110
+ //initialize api
111
+ const {
112
+ $listen,
113
+ $PermissionDoc,
114
+ $OrganizationDoc,
115
+ $BranchDoc,
116
+ $UserDoc,
117
+ // $InvitationDoc,
118
+ } = useNuxtApp();
119
+ const userid = computed(() => getPathPara("id"));
120
+ const permdoc = $PermissionDoc();
121
+ const orgdoc = $OrganizationDoc();
122
+ const branchdoc = $BranchDoc();
123
+ // const invitedoc = $InvitationDoc();
124
+ const userdoc = $UserDoc();
125
+ const userdata = userdoc.getReactiveData();
126
+ //initialize require list in UI
127
+ const permlist = ref<PermissionListItem[]>([]);
128
+ const userlist = ref<UserListItem[]>([]);
129
+ const orglist = ref<OrgListItem[]>([]);
130
+ const branchlist = ref<BranchListItem[]>([]);
131
+ const currentpermissions = ref<Permission[]>([]);
132
+ const grouplist = getAllGroups().map((item) => {
133
+ return { value: item, label: _.capitalize(item) };
134
+ });
135
+
136
+ //initialize some runtime variable
137
+ const blockscreen = ref(false);
138
+ const inviteemail = ref("");
139
+ const selected = ref("");
140
+ const activeuser = ref("");
141
+ const showpermissioninfo = ref(false);
142
+ const permissionselected = ref();
143
+
144
+ const selectUser = (user: any) => {
145
+ // goTo('user',user._id)
146
+ };
147
+
148
+ /**
149
+ * 1. get all users from this tenant
150
+ * @param resetpage after reload, will it reset user interface or remain as current
151
+ */
152
+ const refreshList = async (resetpage: boolean = true) => {
153
+ const items: any[] = [];
154
+ const searchbody: SearchBody = {
155
+ fields: [
156
+ "uid",
157
+ "email",
158
+ "created",
159
+ "fullName",
160
+ "active",
161
+ "lastActivity",
162
+ "description",
163
+ ],
164
+ };
165
+ userlist.value = await userdoc.search(searchbody);
166
+ //listUser();
167
+ // userlist.value = _.uniqBy(permlist.value, "uid");
168
+ if (resetpage) {
169
+ selected.value = "";
170
+ activeuser.value = "";
171
+ }
172
+ blockscreen.value = false;
173
+ // console.log("userlist", userlist.value);
174
+ };
175
+
176
+ /**
177
+ * identity branch object under org
178
+ * @param org object of org
179
+ * @param branch object of branch
180
+ */
181
+
182
+ /**
183
+ * generate dialog for view each user group have what permission
184
+ */
185
+ const previewPermission = () => {
186
+ showpermissioninfo.value = true;
187
+ };
188
+
189
+ /***** send or remove invitation ******/
190
+
191
+ const invite = async () => {
192
+ // const invitedata:User = {}
193
+ const currentuser = getUserProfile();
194
+ const inviteuserdoc = $UserDoc();
195
+ inviteuserdoc.setNew();
196
+ const newuserdata = inviteuserdoc.getReactiveData();
197
+ newuserdata.value.email = inviteemail.value;
198
+ newuserdata.value.fullName = inviteemail.value.split("@")[0];
199
+ newuserdata.value.active = true;
200
+ newuserdata.value.tenantId = currentuser?.tenantId;
201
+ newuserdata.value.orgId = currentuser?.orgId;
202
+ newuserdata.value.branchId = currentuser?.branchId;
203
+
204
+ const invitedata = await inviteuserdoc.create();
205
+ inviteemail.value = "";
206
+ await refreshList();
207
+ // onSelectUser(invitedata);
208
+ };
209
+
210
+ const showDialogIfNeeded = () => {
211
+ if (isMobile()) {
212
+ if (userid.value != "") dialogvisible.value = true;
213
+ else dialogvisible.value = false;
214
+ }
215
+ };
216
+ watch(
217
+ () => useRoute().path,
218
+ () => showDialogIfNeeded(),
219
+ );
220
+ $listen("RefreshDocumentList", async () => {
221
+ await refreshList();
222
+ });
223
+ onMounted(async () => {
224
+ await refreshList();
225
+ showDialogIfNeeded();
226
+ });
227
+
228
+ definePageMeta({
229
+ menuPath: "setting/user",
230
+ });
231
+ </script>
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <div class="flex flex-col w-full gap-4 p-4">
3
+ <TextTitle class="text-center">{{ t("pickGroup") }}</TextTitle>
4
+ <div v-for="(groupName, index) in getUserProfile()?.groups" :key="index">
5
+ <div
6
+ class="border rounded-lg bg-primary-500 text-white p-4 text-center"
7
+ @click="pickGroup(groupName)"
8
+ >
9
+ {{ t(groupName) }}
10
+ </div>
11
+ </div>
12
+ </div>
13
+ </template>
14
+ <script lang="ts" setup>
15
+ /**
16
+ * This file was automatically generated by simpleapp generator during initialization. It is changable.
17
+ * --remove-this-line-to-prevent-override--
18
+ * last change 2024-04-09
19
+ * author: Ks Tan
20
+ */
21
+ const pickGroup = async (groupName: string) => {
22
+ try{
23
+ useCookie('currentGroup').value= groupName
24
+ localStorage.setItem('currentGroup',groupName)
25
+ useNuxtApp().$userstore.currentGroup = groupName;
26
+ useNuxtApp().$event("pickGroup", groupName);
27
+ goTo("");
28
+ }catch(e){
29
+ alert("something wrong")
30
+ console.error(e)
31
+ }
32
+
33
+ };
34
+ </script>
35
+
@@ -1,72 +1,79 @@
1
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>
2
+ <div class="w-full flex flex-col p-3">
3
+
4
+
5
+ <div><TextTitle>{{ t('user') }}</TextTitle></div>
6
+ <div class="flex flex-row w-full ">
7
+ <title>{{ t("user") }}</title>
8
+
9
+ <div class="w-full md:w-1/2 xl:w-1/3">
10
+ <TabView>
11
+ <TabPanel header="Active">
12
+ <ul role="list" class="divide-y divide-gray-100">
13
+ <li v-for="item in userlist" :key="item.email">
14
+ <NuxtLink
15
+ v-if="item.uid && item.active"
16
+ :to="getDocumentUrl('user', item._id)"
17
+ >
18
+ <UserProfileListItem :data="item"></UserProfileListItem>
19
+ </NuxtLink>
20
+ </li>
21
+ </ul>
22
+ </TabPanel>
23
+ <TabPanel header="Inactive">
24
+ <ul role="list" class="divide-y divide-gray-100">
25
+ <li v-for="item in userlist" :key="item.email">
26
+ <NuxtLink
27
+ v-if="item.uid && !item.active"
28
+ :to="getDocumentUrl('user', item._id)"
29
+ >
30
+ <UserProfileListItem :data="item"></UserProfileListItem>
31
+ </NuxtLink>
32
+ </li>
33
+ </ul>
34
+ </TabPanel>
35
+ <TabPanel header="Invite">
36
+ <div class="padding p-2">
37
+ <form @submit.prevent="true" class="w-full">
38
+ <div class="p-inputgroup flex flex-row">
39
+ <InputText
40
+ class="flex-1"
41
+ type="email"
42
+ placeholder="email"
43
+ v-model="inviteemail"
44
+ />
45
+ <div class="p-inputgroup-addon p p-0">
46
+ <button
47
+ label="Search"
48
+ class="border rounded-tl-none rounded-bl-none btn btn-primary -ml-1 h-full p-3 rounded-r-md"
49
+ @click="invite"
50
+ >
51
+ Invite
52
+ </button>
53
+ </div>
51
54
  </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" />
55
+ </form>
56
+ </div>
57
+ <ul role="list" class="divide-y divide-gray-100">
58
+ <li v-for="item in userlist" :key="item.email">
59
+ <NuxtLink v-if="!item.uid" :to="getDocumentUrl('user', item._id)">
60
+ <UserProfileListItem :data="item"></UserProfileListItem>
61
+ </NuxtLink>
62
+ </li>
63
+ </ul>
64
+ </TabPanel>
65
+ </TabView>
66
+ </div>
67
+ <div v-if="!isMobile()" class="flex-1">
68
+ <NuxtPage :_id="userid" />
69
+ </div>
70
+ <OverlaySideBarCrud
71
+ v-if="dialogvisible"
72
+ v-model="dialogvisible"
73
+ closeEventName="user"
74
+ >
75
+ <NuxtPage :_id="userid" />
76
+ </OverlaySideBarCrud>
70
77
  </div>
71
78
  </div>
72
79
  </template>
@@ -81,7 +88,7 @@
81
88
  // import userchild from './userchild.vue'
82
89
  import Menu from "primevue/menu";
83
90
  import Dialog from "primevue/dialog";
84
- import { SearchBody, EventType,UserProfile } from "~/types";
91
+ import { SearchBody, EventType, UserProfile } from "~/types";
85
92
  import _ from "lodash";
86
93
  import Panel from "primevue/panel";
87
94
  import { ref } from "vue";
@@ -99,7 +106,7 @@ import TabView from "primevue/tabview";
99
106
  import TabPanel from "primevue/tabpanel";
100
107
  import { Permission, User } from "~/simpleapp/generate/openapi/api";
101
108
  import BlockUI from "primevue/blockui";
102
-
109
+ const dialogvisible = ref(false);
103
110
  //initialize api
104
111
  const {
105
112
  $listen,
@@ -134,10 +141,9 @@ const activeuser = ref("");
134
141
  const showpermissioninfo = ref(false);
135
142
  const permissionselected = ref();
136
143
 
137
-
138
- const selectUser = (user:any) =>{
139
- // goTo('user',user._id)
140
- }
144
+ const selectUser = (user: any) => {
145
+ // goTo('user',user._id)
146
+ };
141
147
 
142
148
  /**
143
149
  * 1. get all users from this tenant
@@ -201,11 +207,22 @@ const invite = async () => {
201
207
  // onSelectUser(invitedata);
202
208
  };
203
209
 
204
- $listen("RefreshDocumentList", async() => {
210
+ const showDialogIfNeeded = () => {
211
+ if (isMobile()) {
212
+ if (userid.value != "") dialogvisible.value = true;
213
+ else dialogvisible.value = false;
214
+ }
215
+ };
216
+ watch(
217
+ () => useRoute().path,
218
+ () => showDialogIfNeeded(),
219
+ );
220
+ $listen("RefreshDocumentList", async () => {
205
221
  await refreshList();
206
222
  });
207
223
  onMounted(async () => {
208
224
  await refreshList();
225
+ showDialogIfNeeded();
209
226
  });
210
227
 
211
228
  definePageMeta({
@@ -27,12 +27,12 @@
27
27
  <dt
28
28
  class="text-sm font-medium leading-6 text-gray-900 dark:text-gray-400"
29
29
  >
30
- {{ t("group") }}
30
+ {{ t("groups") }}
31
31
  </dt>
32
32
  <dd
33
33
  class="mt-1 text-sm leading-6 text-gray-700 dark:text-gray-300 sm:col-span-2 sm:mt-0"
34
34
  >
35
- {{ getUserProfile().group }}
35
+ {{ getUserProfile()?.groups }}
36
36
  </dd>
37
37
  </div>
38
38
  <div class="px-4 py-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0">
@@ -88,7 +88,6 @@
88
88
  </ul>
89
89
  </dd>
90
90
  </div>
91
-
92
91
 
93
92
  <div
94
93
  v-if="useRuntimeConfig().public.DEBUGDATA == '1'"
@@ -105,14 +104,15 @@
105
104
  class="mt-1 text-sm leading-6 text-gray-700 dark:text-gray-300 sm:col-span-2 sm:mt-0"
106
105
  >
107
106
  <div>
108
- <p>{{t('accessRights')}}</p>
107
+ <p>{{ t("accessRights") }}</p>
109
108
  {{ getUserProfile().roles }}
110
109
  </div>
111
110
  <div>
112
- <p>{{ t('others') }}</p>
113
- {{ getUserProfile()?.country }} / {{ getUserProfile()?.currency }} / {{ getUserProfile()?.offsetMinute }}
111
+ <p>{{ t("others") }}</p>
112
+ {{ getUserProfile()?.country }} /
113
+ {{ getUserProfile()?.currency }} /
114
+ {{ getUserProfile()?.offsetMinute }}
114
115
  </div>
115
-
116
116
  </dd>
117
117
  </div>
118
118
  </dl>
@@ -9,6 +9,7 @@ import {PROFILEApi} from '../simpleapp/generate/openapi'
9
9
  import {UserProfile} from '~/types'
10
10
  import axios, { Axios, AxiosResponse } from 'axios'
11
11
  import _ from 'lodash'
12
+ import { group } from "console";
12
13
 
13
14
 
14
15
  export default defineNuxtPlugin( async(nuxtApp) => {
@@ -33,7 +34,8 @@ export default defineNuxtPlugin( async(nuxtApp) => {
33
34
  email: ref(''),
34
35
  fullName: ref(''),
35
36
  roles:ref<string[]>([]),
36
- group:ref(''),
37
+ groups:ref<string[]>([]),
38
+ currentGroup:ref(''),
37
39
  branches:ref([]),
38
40
  invites : ref([]),
39
41
  time:ref(''),
@@ -78,11 +80,19 @@ export default defineNuxtPlugin( async(nuxtApp) => {
78
80
  this.email = res.data.email
79
81
  this.fullName = res.data.fullName
80
82
  this.branches = res.data.branches
81
- this.group = res.data.group
83
+ this.groups = res.data.groups
82
84
  this.roles = res.data.roles
83
85
  this.time = res.data.time
84
86
  this.invites = res.data.invites
85
87
  this.moreProps = res.data.moreProps
88
+
89
+ let cachegroup = useCookie('currentGroup').value ?? ''
90
+ if(!this.groups || !this.groups.includes(cachegroup)){
91
+ cachegroup=''
92
+ }
93
+ this.currentGroup = cachegroup
94
+ useNuxtApp().$event('pickGroup',cachegroup)
95
+
86
96
  return Promise.resolve(true)
87
97
  // return true
88
98
  }).catch((err:any)=>{
@@ -183,7 +193,8 @@ export default defineNuxtPlugin( async(nuxtApp) => {
183
193
  branches:this.branches??[],
184
194
  invites: this.invites ?? [],
185
195
  roles:this.roles,
186
- group:this.group,
196
+ groups:this.groups,
197
+ currentGroup:this.currentGroup,
187
198
  time:this.time,
188
199
  moreProps: this.moreProps
189
200