@simitgroup/simpleapp-generator 1.6.2-alpha → 1.6.4-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 (161) hide show
  1. package/README.md +6 -5
  2. package/dist/buildinschemas/branch.d.ts.map +1 -1
  3. package/dist/buildinschemas/branch.js +1 -2
  4. package/dist/buildinschemas/branch.js.map +1 -1
  5. package/dist/buildinschemas/changehistories.d.ts +3 -0
  6. package/dist/buildinschemas/changehistories.d.ts.map +1 -0
  7. package/dist/buildinschemas/changehistories.js +36 -0
  8. package/dist/buildinschemas/changehistories.js.map +1 -0
  9. package/dist/buildinschemas/index.d.ts +1 -0
  10. package/dist/buildinschemas/index.d.ts.map +1 -1
  11. package/dist/buildinschemas/index.js +3 -1
  12. package/dist/buildinschemas/index.js.map +1 -1
  13. package/dist/buildinschemas/organization.js +2 -2
  14. package/dist/buildinschemas/organization.js.map +1 -1
  15. package/dist/buildinschemas/user.d.ts.map +1 -1
  16. package/dist/buildinschemas/user.js +5 -1
  17. package/dist/buildinschemas/user.js.map +1 -1
  18. package/dist/buildinschemas/webhook.d.ts +3 -0
  19. package/dist/buildinschemas/webhook.d.ts.map +1 -0
  20. package/dist/buildinschemas/webhook.js +33 -0
  21. package/dist/buildinschemas/webhook.js.map +1 -0
  22. package/dist/framework.d.ts.map +1 -1
  23. package/dist/framework.js +3 -2
  24. package/dist/framework.js.map +1 -1
  25. package/dist/generate.js +30 -11
  26. package/dist/generate.js.map +1 -1
  27. package/dist/index.js +4 -1
  28. package/dist/index.js.map +1 -1
  29. package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
  30. package/dist/processors/jsonschemabuilder.js +10 -2
  31. package/dist/processors/jsonschemabuilder.js.map +1 -1
  32. package/dist/type.d.ts +2 -0
  33. package/dist/type.d.ts.map +1 -1
  34. package/package.json +1 -1
  35. package/src/buildinschemas/branch.ts +1 -2
  36. package/src/buildinschemas/changehistories.ts +33 -0
  37. package/src/buildinschemas/index.ts +2 -1
  38. package/src/buildinschemas/organization.ts +2 -2
  39. package/src/buildinschemas/user.ts +5 -1
  40. package/src/buildinschemas/webhook.ts +31 -0
  41. package/src/framework.ts +3 -2
  42. package/src/generate.ts +35 -15
  43. package/src/index.ts +8 -3
  44. package/src/processors/jsonschemabuilder.ts +10 -2
  45. package/src/type.ts +2 -0
  46. package/templates/basic/nest/controller.ts.eta +23 -2
  47. package/templates/basic/nest/model.ts.eta +9 -1
  48. package/templates/basic/nest/resolver.ts.eta +2 -2
  49. package/templates/basic/nuxt/pages.[id].vue.eta +7 -7
  50. package/templates/basic/nuxt/pages.form.vue.eta +3 -6
  51. package/templates/basic/nuxt/pages.landing.vue.eta +2 -21
  52. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +8 -1
  53. package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +2 -0
  54. package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +9 -2
  55. package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +36 -30
  56. package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +5 -10
  57. package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +1 -0
  58. package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +50 -0
  59. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +13 -3
  60. package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +9 -1
  61. package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +12 -6
  62. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +128 -14
  63. package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +3 -1
  64. package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +1 -0
  65. package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +19 -0
  66. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +30 -8
  67. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +2 -1
  68. package/templates/nuxt/{app.vue._eta → app.vue.eta} +3 -1
  69. package/templates/nuxt/assets/css/calendar.css._eta +3 -0
  70. package/templates/nuxt/assets/css/style.css._eta +1 -1
  71. package/templates/nuxt/assets/images/unknown.png.eta +0 -0
  72. package/templates/nuxt/assets/primevue/passthrough.ts._eta +6 -1
  73. package/templates/nuxt/components/button/ButtonAction.vue._eta +49 -7
  74. package/templates/nuxt/components/button/ButtonDanger.vue._eta +11 -3
  75. package/templates/nuxt/components/button/ButtonDefault.vue._eta +11 -3
  76. package/templates/nuxt/components/button/ButtonPrimary.vue._eta +9 -3
  77. package/templates/nuxt/components/button/ButtonSecondary.vue._eta +33 -0
  78. package/templates/nuxt/components/button/ButtonText.vue._eta +9 -5
  79. package/templates/nuxt/components/button/ButtonWarning.vue._eta +11 -3
  80. package/templates/nuxt/components/calendar/CalendarInput.vue.eta +17 -14
  81. package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +33 -16
  82. package/templates/nuxt/components/chart/card.vue._eta +1 -1
  83. package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +36 -26
  84. package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +62 -22
  85. package/templates/nuxt/components/form/FormBranch.vue._eta +52 -5
  86. package/templates/nuxt/components/form/FormDocnoformat.vue.eta +14 -10
  87. package/templates/nuxt/components/form/FormUser.vue._eta +1 -1
  88. package/templates/nuxt/components/form/user/FormUserPermission.vue.eta +77 -59
  89. package/templates/nuxt/components/header/HeaderSelectBranch.vue.eta +42 -35
  90. package/templates/nuxt/components/image/ImageAvatar.vue.eta._vue +30 -0
  91. package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +7 -5
  92. package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +67 -50
  93. package/templates/nuxt/components/list/ListDocument.vue.eta +10 -5
  94. package/templates/nuxt/components/list/ListDocumentTable.vue.eta +21 -13
  95. package/templates/nuxt/components/list/ListMessages.vue.eta +1 -1
  96. package/templates/nuxt/components/list/ListView.vue.eta +94 -56
  97. package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +11 -4
  98. package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +17 -6
  99. package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +16 -6
  100. package/templates/nuxt/components/page/PageDocList.vue.eta +108 -31
  101. package/templates/nuxt/components/renderer/RendererDate.vue.eta +8 -2
  102. package/templates/nuxt/components/renderer/RendererDateTime.vue.eta +7 -1
  103. package/templates/nuxt/components/renderer/RendererDocHistories.vue.eta +56 -0
  104. package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +9 -8
  105. package/templates/nuxt/components/renderer/RendererLink.vue.eta +7 -4
  106. package/templates/nuxt/components/renderer/RendererMoney.vue.eta +25 -17
  107. package/templates/nuxt/components/renderer/RendererTime.vue.eta +7 -1
  108. package/templates/nuxt/components/renderer/RendererViewer.vue.eta +19 -9
  109. package/templates/nuxt/components/select/SelectTemplate.vue.eta +76 -38
  110. package/templates/nuxt/components/session/SessionBlock.vue.eta +44 -46
  111. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +61 -24
  112. package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +64 -0
  113. package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +26 -14
  114. package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +8 -8
  115. package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +1 -1
  116. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +128 -33
  117. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +89 -168
  118. package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +43 -40
  119. package/templates/nuxt/components/simpleApp/SimpleAppUserPicker.vue.eta +387 -0
  120. package/templates/nuxt/components/text/TextDocStatus.vue._eta +22 -0
  121. package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +13 -15
  122. package/templates/nuxt/components/user/UserButtonPermissionInfo.vue.eta +127 -93
  123. package/templates/nuxt/components/user/UserTenantPicker.vue.eta +1 -1
  124. package/templates/nuxt/composables/confirm.generate.ts.eta +19 -0
  125. package/templates/nuxt/composables/date.generate.ts.eta +106 -8
  126. package/templates/nuxt/composables/getDocument.generate.ts.eta +8 -6
  127. package/templates/nuxt/composables/getOpenApi.generate.ts.eta +58 -10
  128. package/templates/nuxt/composables/getUserStore.generate.ts.eta +37 -5
  129. package/templates/nuxt/composables/goTo.generate.ts.eta +14 -1
  130. package/templates/nuxt/composables/graphquery.generate.ts.eta +20 -2
  131. package/templates/nuxt/composables/recently.generate.ts.eta +16 -0
  132. package/templates/nuxt/composables/roles.generate.ts.eta +8 -13
  133. package/templates/nuxt/composables/stringHelper.generate.ts.eta +54 -1
  134. package/templates/nuxt/composables/sysmessage.generate.ts.eta +1 -1
  135. package/templates/nuxt/pages/[xorg]/docnoformat.vue.eta +1 -1
  136. package/templates/nuxt/pages/[xorg]/mobile/docnoformat/{index.vue.eta → index.vue.etaxxx} +1 -1
  137. package/templates/nuxt/pages/[xorg]/mobile/user/{index.vue.eta → index.vue.etaxxx} +1 -1
  138. package/templates/nuxt/pages/[xorg]/{organization.vue.eta → organization.vue._eta} +39 -10
  139. package/templates/nuxt/pages/[xorg]/profile.vue.eta +1 -1
  140. package/templates/nuxt/pages/[xorg]/user.vue.eta +13 -10
  141. package/templates/nuxt/pages/login.vue._eta +4 -1
  142. package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +4 -0
  143. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +45 -26
  144. package/templates/nuxt/plugins/70.recently.ts.eta +55 -0
  145. package/templates/nuxt/providers/my-provider.ts.eta +22 -0
  146. package/templates/nuxt/server/api/[xorg]/{[...].ts.eta → [...].ts._eta} +47 -21
  147. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +44 -3
  148. package/templates/nuxt/types/events.ts.eta +3 -2
  149. package/templates/nuxt/types/others.ts.eta +11 -1
  150. package/templates/nuxt/types/schema.ts.eta +3 -1
  151. package/templates/nuxt/types/simpleappinput.ts.eta +1 -1
  152. package/templates/nuxt/types/user.ts.eta +8 -7
  153. package/templates/project/jsonschemas/branch.json._eta +1 -0
  154. package/templates/project/jsonschemas/invoice.json._eta +4 -3
  155. package/templates/project/jsonschemas/organization.json._eta +2 -2
  156. package/templates/project/lang/default._json +5 -1
  157. package/tsconfig.tsbuildinfo +1 -1
  158. package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +0 -38
  159. /package/templates/nuxt/pages/[xorg]/mobile/{index.vue._eta → index.vue._etaxxx} +0 -0
  160. /package/templates/nuxt/pages/[xorg]/mobile/organization/{[id].vue._eta → [id].vue._etaxxx} +0 -0
  161. /package/templates/nuxt/pages/[xorg]/mobile/{pickgroup.vue._eta → pickgroup.vue._etaxxx} +0 -0
@@ -0,0 +1,16 @@
1
+ import {RecentlyValue} from "~/types"
2
+ export const getRecently = ()=>useNuxtApp().$recently
3
+ export const setRecentDocument = (key:string, value:RecentlyValue)=>{
4
+ const recent = getRecently()
5
+ recent.set(key,value)
6
+ const tmp:{[key:string]:RecentlyValue}={}
7
+ recent.forEach((value,key)=>{
8
+ tmp[key]=value
9
+ })
10
+ console.log("JSON.stringify(tmp)",tmp)
11
+ localStorage.setItem('recently', JSON.stringify(tmp)); // Store keys as an array
12
+
13
+ }
14
+ export const getRecentDocument = (key:string)=>{
15
+ getRecently().get(key)
16
+ }
@@ -10,23 +10,18 @@ type roletype = {resource:string, action:string}
10
10
  type grouptype = {[key:string]:roletype[]}
11
11
 
12
12
  const allroles:roletype[] = [
13
- <% for(let i=0;i<it.modules.length; i++){ %>
13
+ <% for(let i=0;i<it.modules.length; i++){ %>
14
14
  <% const m = it.modules[i] %>
15
+ <% const appconfig = m.schema["x-simpleapp-config"] %>
15
16
  {resource: '<%=m.docname%>', action:'create'},
16
17
  {resource: '<%=m.docname%>', action:'update'},
17
18
  {resource: '<%=m.docname%>', action:'delete'},
18
- {resource: '<%=m.docname%>', action:'search'},
19
-
20
-
21
- <% if(m.api && m.api.length >0) {%>
22
-
23
- <% for(let j=0;j<m.api.length; j++){ %>
24
- <%let api = m.api[j]%>
25
- {resource: '<%=m.docname%>', action:'<%=api.action%>'},
26
-
27
-
28
- <%}%>
29
- <%}%>
19
+ {resource: '<%=m.docname%>', action:'search'},
20
+ <% if(Array.isArray(appconfig?.allStatus) && appconfig.allStatus.length>0){%>
21
+ <% for(let sindex=0;sindex<appconfig.allStatus.length;sindex++){%>
22
+ {resource: '<%=m.docname%>', action:'<%=appconfig.allStatus[sindex].status%>'},
23
+ <%}%>
24
+ <%}%>
30
25
  <%}%>
31
26
  ]
32
27
 
@@ -18,8 +18,61 @@ export const randomUUID = ()=> uuidv4()
18
18
  export const md5=(s:string)=> new Md5().appendStr(s).end()
19
19
 
20
20
  export const getAvatarLink = (email:string, size:number):string=>{
21
- return `https://api.simbiz.cloud/cloudapi/avatar/${md5(email)}?size=${size}`
21
+ return `https://gravatar.com/avatar/${md5(email)}?size=${size}`;
22
+ //return `https://api.simbiz.cloud/cloudapi/avatar/${md5(email)}?size=${size}`
23
+ }
24
+ export const getAvatarByUid = (id:string, size:number):string=>{
25
+ const url = `${useRuntimeConfig().public.APP_URL}/api/${getCurrentXorg()}`
26
+ return `${url}/images/student/${id}`;
27
+
22
28
  }
23
29
 
30
+ export const getDefaultLocale =()=> useNuxtApp().$i18n.defaultLocale
24
31
  export const t = (txt:string,options?:any):string => !txt || txt.trim()=='' ? '' : useNuxtApp().$i18n.t(txt,options)
25
32
  export const upperFirst = (str:string) => _.upperFirst(str)
33
+ export const labelSorter = (a,b)=>{
34
+ const nameA = a.label.toUpperCase(); // ignore upper and lowercase
35
+ const nameB = b.label.toUpperCase(); // ignore upper and lowercase
36
+ if (nameA < nameB) {
37
+ return -1;
38
+ }
39
+ if (nameA > nameB) {
40
+ return 1;
41
+ }
42
+
43
+ // names must be equal
44
+ return 0;
45
+ }
46
+
47
+ export const valueSorter = (a,b)=>{
48
+ const vA = a.value
49
+ const vB = b.value
50
+ if (vA < vB) {
51
+ return -1;
52
+ }
53
+ if (vA > vB) {
54
+ return 1;
55
+ }
56
+
57
+ return 0;
58
+ }
59
+ export const valueSorterDesc = (a,b)=>{
60
+ const vA = a.value
61
+ const vB = b.value
62
+ if (vA < vB) {
63
+ return 1;
64
+ }
65
+ if (vA > vB) {
66
+ return -1;
67
+ }
68
+
69
+ return 0;
70
+ }
71
+ export const numberToMoneyString = (value:number)=>{
72
+ const options = {
73
+ style: "decimal", // Other options: 'currency', 'percent', etc.
74
+ minimumFractionDigits: 2,
75
+ maximumFractionDigits: 2,
76
+ };
77
+ return value.toLocaleString(useI18n().defaultLocale, options)
78
+ }
@@ -11,7 +11,7 @@ export const systemMsgQty = computed(()=>messages.value.filter(item=>!item.read)
11
11
  export const sysMessage ={
12
12
  download: async ()=> {
13
13
  messages.value = await useNuxtApp().$SystemmessageDoc().search({})
14
- console.log("Download messages",messages)
14
+ //console.log("Download messages",messages)
15
15
  return messages.value
16
16
  },
17
17
  getMessages: () => messages.value
@@ -41,7 +41,7 @@ const doc = useNuxtApp().$DocnoformatDoc()
41
41
  const docdata = doc.getReactiveData();
42
42
 
43
43
  definePageMeta({
44
- menuPath: "setting/docnoformat",
44
+ menuPath: "systemconfig/setting/docnoformat",
45
45
  });
46
46
 
47
47
  const columns = [
@@ -41,7 +41,7 @@ const doc = useNuxtApp().$DocnoformatDoc()
41
41
  const docdata = doc.getReactiveData();
42
42
 
43
43
  definePageMeta({
44
- menuPath: "setting/docnoformat",
44
+ menuPath: "systemconfig/setting/docnoformat",
45
45
  });
46
46
 
47
47
  const columns = [
@@ -226,6 +226,6 @@ onMounted(async () => {
226
226
  });
227
227
 
228
228
  definePageMeta({
229
- menuPath: "setting/user",
229
+ menuPath: "systemconfig/setting/user",
230
230
  });
231
231
  </script>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="w-full flex-col flex">
3
3
  <title>{{ t("organization") }}</title>
4
- <MobileToolbar class="bg-gray-600">
4
+ <MobileToolbar class="bg-gray-600" v-if="isMobile()">
5
5
  <template #center
6
6
  ><TextTitle class="text-white">{{
7
7
  t("organization")
@@ -18,14 +18,22 @@
18
18
  <div class="">
19
19
  <!-- -->
20
20
  <!-- <div class="border w-12 h-12 md:w-24 md:h24"> -->
21
- <ImageOrganization :changable="!doc.isReadOnly()"></ImageOrganization>
21
+ <ImageOrganization></ImageOrganization>
22
22
  <!-- </div> -->
23
23
  </div>
24
24
  <div class="flex flex-col flex-1">
25
- <TextTitle>{{ data.orgName }} / {{ data.orgCode }}</TextTitle>
25
+ <TextTitle>
26
+ {{ data.orgName }} / {{ data.orgCode }}
27
+
28
+ </TextTitle>
26
29
  <TextSubtitle>
27
30
  {{ data.description }}
28
31
  </TextSubtitle>
32
+ <div>
33
+ <ButtonDefault @click="showEditOrg = true" class="text-sm">
34
+ <i class="pi pi-pencil mr-1"/> <span>{{t('edit')}}</span>
35
+ </ButtonDefault>
36
+ </div>
29
37
  </div>
30
38
  </div>
31
39
 
@@ -41,7 +49,7 @@
41
49
  <ListView
42
50
  class="border rounded-lg border-gray-400 dark:border-gray-600"
43
51
  :list="branchlist"
44
- title-field="branchName"
52
+ title-field="branchName"
45
53
  sub-title-field="branchCode"
46
54
  :url="getDocumentUrl('organization', id)"
47
55
  #default="{ item }"
@@ -49,7 +57,9 @@
49
57
  <div class="flex flex-row">
50
58
  <div class="flex-col flex flex-1">
51
59
  <TextPrimary>{{ item.branchName }}</TextPrimary>
52
- <TextSubtitle>{{ item.description }}</TextSubtitle>
60
+ <TextSubsubtitle>{{ item.street1 }}</TextSubsubtitle>
61
+ <TextSubsubtitle>{{ item.street2 }}</TextSubsubtitle>
62
+ <TextSubsubtitle>{{ item.description }}</TextSubsubtitle>
53
63
  </div>
54
64
  <div class="flex-col flex text-right">
55
65
  <div>{{ item.branchCode }}</div>
@@ -59,16 +69,31 @@
59
69
  </ListView>
60
70
  </div>
61
71
 
62
- <OverlaySideBarCrud v-model="showEditOrg" close-event-name="organization">
72
+ <OverlayPanelWithToolBar v-model="showEditOrg" close-event-name="organization">
73
+ <template #headerLeft>
74
+ <ButtonText @click="showEditOrg = false">
75
+ <i class="pi pi-times"></i>
76
+ </ButtonText>
77
+ </template>
78
+ <template #headerCenter>{{data.orgName}}</template>
79
+ <template #headerRight></template>
63
80
  <FormOrganization
64
81
  :_id="getUserProfile()?.orgRecordId"
65
82
  @after="afterOrganization"
66
83
  ></FormOrganization>
67
- </OverlaySideBarCrud>
84
+ </OverlayPanelWithToolBar>
85
+
86
+ <OverlayPanelWithToolBar v-model="showEditBranch" close-event-name="branch">
87
+ <template #headerLeft>
88
+ <ButtonText @click="closeBranch">
89
+ <i class="pi pi-times"></i>
90
+ </ButtonText>
91
+ </template>
92
+ <template #headerCenter>{{t('branch')}}</template>
93
+ <template #headerRight></template>
68
94
 
69
- <OverlaySideBarCrud v-model="showEditBranch" close-event-name="branch">
70
95
  <NuxtPage :_id="id"></NuxtPage>
71
- </OverlaySideBarCrud>
96
+ </OverlayPanelWithToolBar>
72
97
  </div>
73
98
  </template>
74
99
 
@@ -113,7 +138,7 @@ const fetchRecord = async () => {
113
138
  const id = computed((): string => String(useRoute().params.id ?? ""));
114
139
 
115
140
  definePageMeta({
116
- menuPath: "setting/organization",
141
+ menuPath: "systemconfig/setting/organization",
117
142
  });
118
143
 
119
144
  //branch record update then reload
@@ -124,6 +149,10 @@ $listen("RefreshDocumentList", async (data) => {
124
149
  }
125
150
  });
126
151
 
152
+ const closeBranch = ()=>{
153
+ showEditBranch.value=false
154
+ goTo('organization')
155
+ }
127
156
  const showBranchDialogIfRequired = () => {
128
157
  if (useRoute().path.includes("/new") || id.value) showEditBranch.value = true;
129
158
  };
@@ -10,6 +10,6 @@
10
10
  */
11
11
  import profile from "../profile.vue";
12
12
  definePageMeta({
13
- menuPath:'setting/profile'
13
+ // menuPath:'setting/profile'
14
14
  })
15
15
  </script>
@@ -1,15 +1,15 @@
1
1
  <template>
2
2
  <div class="w-full flex flex-col p-3">
3
+ <div>
4
+ <TextTitle>{{ t("user") }}</TextTitle>
5
+ </div>
6
+ <div class="flex flex-row w-full">
7
+ <title>{{ t("user") }}</title>
3
8
 
4
-
5
- <div><TextTitle>{{ t('user') }}</TextTitle></div>
6
- <div class="flex flex-row w-full ">
7
- <title>{{ t("user") }}</title>
8
-
9
9
  <div class="w-full md:w-1/2 xl:w-1/3">
10
10
  <TabView>
11
11
  <TabPanel header="Active">
12
- <ul role="list" class="divide-y divide-gray-100">
12
+ <ul role="list" class="divide-y divide-gray-100 listview-item">
13
13
  <li v-for="item in userlist" :key="item.email">
14
14
  <NuxtLink
15
15
  v-if="item.uid && item.active"
@@ -21,7 +21,7 @@
21
21
  </ul>
22
22
  </TabPanel>
23
23
  <TabPanel header="Inactive">
24
- <ul role="list" class="divide-y divide-gray-100">
24
+ <ul role="list" class="divide-y divide-gray-100 listview-item">
25
25
  <li v-for="item in userlist" :key="item.email">
26
26
  <NuxtLink
27
27
  v-if="item.uid && !item.active"
@@ -54,9 +54,12 @@
54
54
  </div>
55
55
  </form>
56
56
  </div>
57
- <ul role="list" class="divide-y divide-gray-100">
57
+ <ul role="list" class="divide-y divide-gray-100 listview-item">
58
58
  <li v-for="item in userlist" :key="item.email">
59
- <NuxtLink v-if="!item.uid" :to="getDocumentUrl('user', item._id)">
59
+ <NuxtLink
60
+ v-if="!item.uid"
61
+ :to="getDocumentUrl('user', item._id)"
62
+ >
60
63
  <UserProfileListItem :data="item"></UserProfileListItem>
61
64
  </NuxtLink>
62
65
  </li>
@@ -226,6 +229,6 @@ onMounted(async () => {
226
229
  });
227
230
 
228
231
  definePageMeta({
229
- menuPath: "setting/user",
232
+ menuPath: "systemconfig/setting/user",
230
233
  });
231
234
  </script>
@@ -1,6 +1,9 @@
1
1
  <template>
2
2
  <div class="p-10 m-10 text-3xl border text-center dark:text-white">
3
- {{ t('redirectToLoginPage') }}
3
+ <div class="flex flex-col justify-center">
4
+ <div class="pi pi-spin pi-spinner" style="font-size: 8rem"></div>
5
+ <div>{{ t("login")+'...' }}</div>
6
+ </div>
4
7
  <!-- <NuxtPage /> -->
5
8
  </div>
6
9
  </template>
@@ -10,6 +10,8 @@ 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
+ import { useConfirm } from "primevue/useconfirm";
14
+ import { useDialog } from 'primevue/usedialog';
13
15
 
14
16
  // import ToastService from 'primevue/toastservice';
15
17
  // import ConfirmationService from 'primevue/confirmationservice';
@@ -73,6 +75,8 @@ export default defineNuxtPlugin( async(nuxtApp) => {
73
75
  event: emitter.emit, // Will emit an event
74
76
  listen: emitter.on, // Will register a listener for an event
75
77
  axios: myaxios,
78
+ confirm: useConfirm(),
79
+ dialog: useDialog
76
80
  }
77
81
  }
78
82
  //other components that you need
@@ -102,28 +102,43 @@ export default defineNuxtPlugin( async(nuxtApp) => {
102
102
  getCurrentXorg(){
103
103
  return (useRoute().params.xorg) ? <String>useRoute().params.xorg : undefined
104
104
  },
105
- async pingSession(){
105
+ async pingSession():Promise<string>{
106
106
  let xorg = this.getCurrentXorg()
107
107
  let apiurl=''
108
+
108
109
  if(!xorg){
109
110
  apiurl = `${useRuntimeConfig().public.APP_URL}/api`
110
111
  }else{
111
- apiurl = `${useRuntimeConfig().public.APP_URL}/api/${xorg}`
112
+ const xorgdecode = atob(<string>xorg)
113
+ if(xorgdecode.includes('-')){
114
+ apiurl = `${useRuntimeConfig().public.APP_URL}/api/${xorg}`
115
+ }else{
116
+ return Promise.reject('wrongxorg')
117
+ }
118
+
112
119
  }
113
120
  const {$axios} = useNuxtApp()
114
- const pingresult = await new PROFILEApi(undefined,apiurl,$axios).getSession()
115
- return pingresult
121
+ try{
122
+ const pingresult = await new PROFILEApi(undefined,apiurl).getSession()
123
+ if(pingresult.status<300)
124
+ return Promise.resolve('ok')
125
+ else
126
+ return Promise.reject('relogin')
127
+ }catch(e){
128
+ return Promise.reject('catch go relogin')
129
+ }
130
+
116
131
  },
117
132
  async decideInvitation(id:string,decision:string){
118
133
  const apiurl = `${useRuntimeConfig().public.APP_URL}/api`
119
134
  const {$axios} = useNuxtApp()
120
- console.log("decideInvitation",id,decision)
135
+ // console.log("decideInvitation",id,decision)
121
136
  const result = await new PROFILEApi(undefined,apiurl,$axios).decideInvitation(id,decision)
122
137
 
123
138
  if(result){
124
- console.log(result)
139
+ // console.log(result)
125
140
  }else{
126
- console.log(result)
141
+ // console.log(result)
127
142
  }
128
143
  //().then((res:AxiosResponse)=>{ }
129
144
  },
@@ -206,28 +221,32 @@ export default defineNuxtPlugin( async(nuxtApp) => {
206
221
 
207
222
 
208
223
  if( useRoute().meta.auth !==false){
209
-
210
- if(await useUserStore().pingSession()){
211
- await useUserStore().loadRemoteUserInfo()
212
-
213
- }else{
214
- await useUserStore().logout(useRoute().path)
215
- }
216
- }else{
217
- // if(await useUserStore().pingSession()){
224
+ console.log("pingsessionres starat")
218
225
 
219
- // }else{
226
+ try{
227
+ const pingsessionres = await useUserStore().pingSession()
228
+ console.log("pingsessionres",pingsessionres)
229
+ if(pingsessionres == 'wrongxorg'){
230
+ navigateTo('/')
231
+ }
232
+ else if(pingsessionres){
233
+ await useUserStore().loadRemoteUserInfo()
234
+ }
235
+ return {
236
+ provide: {
237
+ userstore:useUserStore()
238
+ // base64url: Base64URL
239
+ }
240
+ }
241
+ }catch(e){
220
242
 
221
- // }
243
+ await useUserStore().logout(useRoute().path)
244
+ }
245
+
246
+ }else{
247
+
222
248
  }
223
249
 
224
- return {
225
-
226
-
227
- provide: {
228
- userstore:useUserStore()
229
- // base64url: Base64URL
230
- }
231
- }
250
+
232
251
 
233
252
  });
@@ -0,0 +1,55 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2024-02-23
5
+ * Author: Ks Tan
6
+ */
7
+ import { defineNuxtPlugin } from "#app";
8
+ import { LRUCache } from 'lru-cache'
9
+ import {RecentlyValue} from "~/types"
10
+ export default defineNuxtPlugin( async(nuxtApp) => {
11
+ const options = {
12
+ max: 20,
13
+
14
+ // for use with tracking overall storage size
15
+ maxSize: 5000,
16
+ sizeCalculation: (value, key) => {
17
+ return 1
18
+ },
19
+
20
+ dispose: (value, key) => {
21
+ //freeFromMemoryOrWhatever(value)
22
+ },
23
+
24
+ // how long to live in ms
25
+ ttl: 1000 * 60 * 5,
26
+
27
+ // return stale items before removing from cache?
28
+ allowStale: false,
29
+
30
+ updateAgeOnGet: false,
31
+ updateAgeOnHas: false,
32
+
33
+ fetchMethod: async (
34
+ key,
35
+ staleValue,
36
+ { options, signal, context }
37
+ ) => {},
38
+ }
39
+
40
+ const recently = new LRUCache<string,RecentlyValue>(options)
41
+ const tmp = localStorage.getItem('recently' ); // Store keys as an array
42
+ if(tmp){
43
+ const histories = JSON.parse(tmp)
44
+ const keys=Object.keys(histories)
45
+ keys.forEach(key=>{
46
+ recently.set(key,histories[key])
47
+ })
48
+ }
49
+
50
+ return {
51
+ provide: {
52
+ recently:recently
53
+ }
54
+ }
55
+ });
@@ -0,0 +1,22 @@
1
+ import { joinURL } from 'ufo'
2
+ import type { ProviderGetImage } from '@nuxt/image'
3
+ import { createOperationsGenerator } from '#image'
4
+
5
+ const operationsGenerator = createOperationsGenerator()
6
+
7
+ export const getImage: ProviderGetImage = (
8
+ src,
9
+ { modifiers = {}, baseURL } = {}
10
+ ) => {
11
+
12
+ if (!baseURL) {
13
+ // also support runtime config
14
+ baseURL = useRuntimeConfig().public.API_URL
15
+ }
16
+
17
+ const operations = operationsGenerator(modifiers)
18
+
19
+ return {
20
+ url: joinURL(baseURL, src + (operations ? '?' + operations : '')),
21
+ }
22
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * This file was automatically generated by simpleapp generator. Every
3
- * MODIFICATION OVERRIDE BY GENERATEOR
3
+ * --remove-this-line-to-prevent-override--
4
4
  * last change 2024-02-23
5
5
  * Author: Ks Tan
6
6
  */
@@ -9,7 +9,7 @@
9
9
  import axios, { AxiosRequestConfig } from 'axios';
10
10
  import { getServerSession } from '#auth'
11
11
  import type { Session } from 'next-auth';
12
-
12
+ import * as fs from 'fs'
13
13
  export default defineEventHandler(async (event:any) => {
14
14
  type additionalprops = {accessToken?:string}
15
15
  let session:any=null
@@ -53,27 +53,44 @@ export default defineEventHandler(async (event:any) => {
53
53
  data: bodydata,
54
54
  params: querydata,
55
55
  }
56
- axios(axiosConfig).then((res) => {
56
+
57
+ try{
58
+ const res = await axios(axiosConfig)
57
59
  if (res.headers['content-type'] === 'image/png') {
58
- // Set the response headers for the image
59
60
  frontEndRes.setHeader('Content-Type', 'image/png');
60
61
  frontEndRes.setHeader('Content-Disposition', 'inline');
61
-
62
- // Send the image data as the response body
63
62
  frontEndRes.end(Buffer.from(res.data, 'binary'));
64
- } else {
65
- // For non-image responses, set the Content-Type header and send the response body
66
- // setHeader(event, 'Content-type', <string>res.headers['Content-Type']);
67
-
63
+ }else if(documentLink.includes('images/')){
64
+ // console.log(documentLink," Resdata of base64 photo",res.data.length)
65
+ let imageData
66
+ frontEndRes.setHeader('Content-Type', 'image/png');
67
+
68
+ // console.log("load image for",documentLink)
69
+ if( res.data.length){
70
+ console.log("obtain base64 from server length:",res.data.length)
71
+ imageData = base64ToBuffer(res.data);
72
+
73
+ }else{
74
+ // console.log("server no image, use default image")
75
+ const folder = 'assets/images/'
76
+ let filename = filename='unknown.png';
77
+ const fullpath = folder+filename;
78
+ if(fs.existsSync(fullpath)){
79
+ imageData = fs.readFileSync(fullpath)
80
+ }else{
81
+ console.log(fullpath,'does not exists')
82
+ }
83
+ }
84
+ frontEndRes.end(Buffer.from(imageData, 'binary'));
85
+
86
+ }else{
68
87
  frontEndRes.statusCode = res.status;
69
88
  if(res.statusText) {
70
89
  frontEndRes.statusMessage = res.statusText;
71
90
  }
72
-
73
91
  resolve(res.data);
74
92
  }
75
-
76
- }).catch((error) => {
93
+ }catch(error){
77
94
  if(!error?.response){
78
95
  console.log("backend server no response ",error.code)
79
96
  reject({
@@ -94,13 +111,22 @@ export default defineEventHandler(async (event:any) => {
94
111
  });
95
112
 
96
113
  }
97
-
98
-
99
- })
100
-
101
- // resolve({
102
- // status: 'ok'
103
- // })
114
+ }
104
115
  })
105
116
 
106
- })
117
+ })
118
+
119
+
120
+
121
+ function base64ToBuffer(base64String:string) {
122
+ // Split the base64 string into parts
123
+ const parts = base64String.split(',');
124
+ const contentType = parts[0].split(':')[1];
125
+ const base64Data = parts[1];
126
+
127
+ // Decode the base64 data
128
+ const binaryString = atob(base64Data);
129
+ const buffer = new Buffer.from(binaryString, 'binary');
130
+
131
+ return buffer
132
+ }