@simitgroup/simpleapp-generator 1.6.3-alpha → 1.6.4-b-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 (152) 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/changehistories.d.ts +3 -0
  5. package/dist/buildinschemas/changehistories.d.ts.map +1 -0
  6. package/dist/buildinschemas/changehistories.js +36 -0
  7. package/dist/buildinschemas/changehistories.js.map +1 -0
  8. package/dist/buildinschemas/index.d.ts +1 -0
  9. package/dist/buildinschemas/index.d.ts.map +1 -1
  10. package/dist/buildinschemas/index.js +3 -1
  11. package/dist/buildinschemas/index.js.map +1 -1
  12. package/dist/buildinschemas/organization.js +2 -2
  13. package/dist/buildinschemas/organization.js.map +1 -1
  14. package/dist/buildinschemas/user.d.ts.map +1 -1
  15. package/dist/buildinschemas/user.js +5 -1
  16. package/dist/buildinschemas/user.js.map +1 -1
  17. package/dist/buildinschemas/webhook.d.ts +3 -0
  18. package/dist/buildinschemas/webhook.d.ts.map +1 -0
  19. package/dist/buildinschemas/webhook.js +33 -0
  20. package/dist/buildinschemas/webhook.js.map +1 -0
  21. package/dist/framework.d.ts.map +1 -1
  22. package/dist/framework.js +3 -2
  23. package/dist/framework.js.map +1 -1
  24. package/dist/generate.js +30 -11
  25. package/dist/generate.js.map +1 -1
  26. package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
  27. package/dist/processors/jsonschemabuilder.js +10 -2
  28. package/dist/processors/jsonschemabuilder.js.map +1 -1
  29. package/dist/type.d.ts +2 -0
  30. package/dist/type.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/buildinschemas/branch.ts +1 -0
  33. package/src/buildinschemas/changehistories.ts +33 -0
  34. package/src/buildinschemas/index.ts +2 -1
  35. package/src/buildinschemas/organization.ts +2 -2
  36. package/src/buildinschemas/user.ts +5 -1
  37. package/src/buildinschemas/webhook.ts +31 -0
  38. package/src/framework.ts +3 -2
  39. package/src/generate.ts +35 -15
  40. package/src/processors/jsonschemabuilder.ts +10 -2
  41. package/src/type.ts +2 -0
  42. package/templates/basic/nest/controller.ts.eta +24 -3
  43. package/templates/basic/nest/model.ts.eta +9 -1
  44. package/templates/basic/nest/resolver.ts.eta +2 -2
  45. package/templates/basic/nuxt/pages.[id].vue.eta +7 -7
  46. package/templates/basic/nuxt/pages.form.vue.eta +1 -4
  47. package/templates/basic/nuxt/pages.landing.vue.eta +1 -20
  48. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +8 -1
  49. package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +2 -0
  50. package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +9 -2
  51. package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +21 -8
  52. package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +5 -10
  53. package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +1 -0
  54. package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +50 -0
  55. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +22 -8
  56. package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +9 -1
  57. package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +12 -6
  58. package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +7 -12
  59. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +133 -28
  60. package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +3 -1
  61. package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +1 -0
  62. package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +19 -0
  63. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +33 -8
  64. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +15 -9
  65. package/templates/nuxt/assets/css/calendar.css._eta +3 -0
  66. package/templates/nuxt/assets/css/style.css._eta +1 -1
  67. package/templates/nuxt/assets/images/unknown.png.eta +0 -0
  68. package/templates/nuxt/assets/primevue/passthrough.ts._eta +6 -1
  69. package/templates/nuxt/components/button/ButtonAction.vue._eta +40 -39
  70. package/templates/nuxt/components/button/ButtonDanger.vue._eta +11 -3
  71. package/templates/nuxt/components/button/ButtonDefault.vue._eta +11 -3
  72. package/templates/nuxt/components/button/ButtonPrimary.vue._eta +9 -3
  73. package/templates/nuxt/components/button/ButtonSecondary.vue._eta +33 -0
  74. package/templates/nuxt/components/button/ButtonText.vue._eta +9 -5
  75. package/templates/nuxt/components/button/ButtonWarning.vue._eta +11 -3
  76. package/templates/nuxt/components/calendar/CalendarInput.vue.eta +4 -3
  77. package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +76 -52
  78. package/templates/nuxt/components/chart/card.vue._eta +1 -1
  79. package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +36 -26
  80. package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +35 -13
  81. package/templates/nuxt/components/form/FormBranch.vue._eta +52 -5
  82. package/templates/nuxt/components/form/FormDocnoformat.vue.eta +14 -10
  83. package/templates/nuxt/components/form/FormUser.vue._eta +2 -4
  84. package/templates/nuxt/components/form/user/FormUserPermission.vue.eta +77 -59
  85. package/templates/nuxt/components/header/HeaderSelectBranch.vue.eta +42 -35
  86. package/templates/nuxt/components/image/ImageAvatar.vue.eta._vue +30 -0
  87. package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +34 -14
  88. package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +67 -50
  89. package/templates/nuxt/components/list/ListDocumentTable.vue.eta +20 -12
  90. package/templates/nuxt/components/list/ListView.vue.eta +64 -35
  91. package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +5 -4
  92. package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +8 -8
  93. package/templates/nuxt/components/page/PageDocList.vue.eta +36 -13
  94. package/templates/nuxt/components/renderer/RendererDate.vue.eta +8 -2
  95. package/templates/nuxt/components/renderer/RendererDateTime.vue.eta +7 -1
  96. package/templates/nuxt/components/renderer/RendererDocHistories.vue.eta +56 -0
  97. package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +14 -8
  98. package/templates/nuxt/components/renderer/RendererLink.vue.eta +7 -4
  99. package/templates/nuxt/components/renderer/RendererMoney.vue.eta +25 -17
  100. package/templates/nuxt/components/renderer/RendererTime.vue.eta +7 -1
  101. package/templates/nuxt/components/renderer/RendererViewer.vue.eta +19 -9
  102. package/templates/nuxt/components/select/SelectTemplate.vue.eta +53 -22
  103. package/templates/nuxt/components/session/SessionBlock.vue.eta +44 -46
  104. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +25 -16
  105. package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +60 -0
  106. package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +16 -8
  107. package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +8 -8
  108. package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +1 -1
  109. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +114 -38
  110. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +89 -168
  111. package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +44 -40
  112. package/templates/nuxt/components/simpleApp/SimpleAppUserPicker.vue.eta +387 -0
  113. package/templates/nuxt/components/text/TextDocStatus.vue._eta +22 -0
  114. package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +13 -15
  115. package/templates/nuxt/components/user/UserButtonPermissionInfo.vue.eta +138 -95
  116. package/templates/nuxt/components/user/UserInvitation.vue.eta +53 -45
  117. package/templates/nuxt/components/user/UserTenantPicker.vue.eta +32 -71
  118. package/templates/nuxt/composables/date.generate.ts.eta +105 -8
  119. package/templates/nuxt/composables/getDocument.generate.ts.eta +8 -6
  120. package/templates/nuxt/composables/getOpenApi.generate.ts.eta +58 -10
  121. package/templates/nuxt/composables/getUserStore.generate.ts.eta +39 -6
  122. package/templates/nuxt/composables/goTo.generate.ts.eta +14 -1
  123. package/templates/nuxt/composables/graphquery.generate.ts.eta +20 -2
  124. package/templates/nuxt/composables/recently.generate.ts.eta +16 -0
  125. package/templates/nuxt/composables/roles.generate.ts.eta +9 -13
  126. package/templates/nuxt/composables/stringHelper.generate.ts.eta +52 -0
  127. package/templates/nuxt/composables/sysmessage.generate.ts.eta +1 -1
  128. package/templates/nuxt/error.vue._eta +4 -2
  129. package/templates/nuxt/pages/[xorg]/{organization.vue.eta → organization.vue._eta} +38 -9
  130. package/templates/nuxt/pages/[xorg]/user.vue.eta +12 -9
  131. package/templates/nuxt/pages/login.vue._eta +4 -1
  132. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +54 -26
  133. package/templates/nuxt/plugins/70.recently.ts.eta +55 -0
  134. package/templates/nuxt/providers/my-provider.ts.eta +22 -0
  135. package/templates/nuxt/server/api/[xorg]/{[...].ts.eta → [...].ts._eta} +47 -21
  136. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +44 -3
  137. package/templates/nuxt/types/events.ts.eta +3 -2
  138. package/templates/nuxt/types/others.ts.eta +11 -1
  139. package/templates/nuxt/types/schema.ts.eta +3 -1
  140. package/templates/nuxt/types/simpleappinput.ts.eta +1 -1
  141. package/templates/nuxt/types/user.ts.eta +8 -7
  142. package/templates/project/jsonschemas/branch.json._eta +1 -0
  143. package/templates/project/jsonschemas/invoice.json._eta +4 -3
  144. package/templates/project/jsonschemas/organization.json._eta +2 -2
  145. package/templates/project/lang/default._json +6 -2
  146. package/tsconfig.tsbuildinfo +1 -1
  147. package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +0 -38
  148. /package/templates/nuxt/pages/[xorg]/mobile/docnoformat/{index.vue.eta → index.vue.etaxxx} +0 -0
  149. /package/templates/nuxt/pages/[xorg]/mobile/{index.vue._eta → index.vue._etaxxx} +0 -0
  150. /package/templates/nuxt/pages/[xorg]/mobile/organization/{[id].vue._eta → [id].vue._etaxxx} +0 -0
  151. /package/templates/nuxt/pages/[xorg]/mobile/{pickgroup.vue._eta → pickgroup.vue._etaxxx} +0 -0
  152. /package/templates/nuxt/pages/[xorg]/mobile/user/{index.vue.eta → index.vue.etaxxx} +0 -0
@@ -11,7 +11,7 @@ export const getDocument = (docname:SimpleAppDocumentType) =>{
11
11
  }
12
12
 
13
13
  // (appuser: UserContext, filter: any) => Promise<void>;
14
- export const onScreenAddDocument = <T>(docname:SimpleAppDocumentType,paras?:T,after?:(eventType:FormCrudEvent, data:T)=>Promise<void>)=>{
14
+ export const onScreenAddDocument = <T>(docname:SimpleAppDocumentType,paras?:T,after?:(eventType:FormCrudEvent, data:T,visible:Ref<boolean>)=>Promise<void>)=>{
15
15
  useNuxtApp().$event('ViewRecord',{
16
16
  documentName: docname,
17
17
  eventId:randomUUID(),
@@ -19,24 +19,26 @@ export const onScreenAddDocument = <T>(docname:SimpleAppDocumentType,paras?:T,af
19
19
  paras:paras,
20
20
  document: getDocument(docname)?.docClass,
21
21
  viewer: getDocument(docname)?.viewer,
22
- after: (eventType:FormCrudEvent, data: any) => {
22
+ after: (eventType:FormCrudEvent, data: any,visible:Ref<boolean>) => {
23
23
  //do nothing
24
- if(after)after(eventType,data as T)
24
+ if(after)after(eventType,data as T,visible)
25
25
  },
26
26
  label:t(docname)
27
27
 
28
28
  })
29
29
  }
30
- export const onScreenEditDocument = <T>(docname:SimpleAppDocumentType,_id:string,after?:(eventType:FormCrudEvent, data:T)=>Promise<void>)=>{
30
+ export const onScreenEditDocument = <T>(docname:SimpleAppDocumentType,_id:string,after?:(eventType:FormCrudEvent, data:T,visible:Ref<boolean>)=>Promise<void>,autoclose:number=1)=>{
31
+
31
32
  useNuxtApp().$event('ViewRecord',{
32
33
  documentName: docname,
33
34
  eventId:randomUUID(),
34
35
  _id:_id,
36
+ autoclose:autoclose,
35
37
  document: getDocument(docname)?.docClass,
36
38
  viewer: getDocument(docname)?.viewer,
37
- after: async (eventType:FormCrudEvent, data: any) => {
39
+ after: async (eventType:FormCrudEvent, data: any,visible:Ref<boolean>) => {
38
40
  //do nothing
39
- if(after)after(eventType,data as T)
41
+ if(after)after(eventType,data as T,visible)
40
42
  },
41
43
  label:t(docname)
42
44
  })
@@ -9,8 +9,11 @@ import * as o from "../simpleapp/generate/openapi";
9
9
  import axios from 'axios'
10
10
 
11
11
 
12
- const getAxiosConfig = () => {
13
- const suffix = getCurrentXorg() ? '/'+getCurrentXorg() : ''
12
+ export const getAxiosConfig = () => {
13
+ const xorg = getCurrentXorg()
14
+ const xorgdecode = xorg!==undefined ? atob(<string>xorg) :''
15
+
16
+ const suffix = xorgdecode.includes('-') ? '/'+getCurrentXorg() : ''
14
17
  const config: o.Configuration = {
15
18
  basePath: `${useRuntimeConfig().public.APP_URL}/api${suffix}`,
16
19
  isJsonMime: () => true,
@@ -18,10 +21,14 @@ const getAxiosConfig = () => {
18
21
  return config
19
22
  }
20
23
 
21
-
24
+ //get apisession exclude from shared axios to separate handle session
22
25
  export const getApiSession = async ()=> {
23
- const res = await (new o.PROFILEApi(getAxiosConfig(),undefined,useNuxtApp().$axios)).getSession()
24
- return res
26
+ console.log("getApiSession from computable")
27
+ return getUserStore().pingSession()
28
+ //,useNuxtApp().$axios)
29
+ // const profileapi = new o.PROFILEApi(getAxiosConfig(),undefined)
30
+ // const res = await profileapi.getSession()
31
+ // return res
25
32
  }
26
33
 
27
34
  export const getDocumentApi = (documentName: string): any => {
@@ -31,10 +38,51 @@ export const getDocumentApi = (documentName: string): any => {
31
38
 
32
39
  const config = getAxiosConfig()
33
40
  const docsOpenapi: any = {
34
- <%for(let i=0; i<it.modules.length;i++){ %>
35
- <% const d = it.modules[i] %>
36
- '<%= d['docname'].toLowerCase() %>': new o.<%= d['doctype'].toUpperCase() %>Api(config),
37
- <%}%>
41
+ 'tenant': new o.TENANTApi(config),
42
+ 'organization': new o.ORGApi(config),
43
+ 'branch': new o.BRANCHApi(config),
44
+ 'permission': new o.PERMApi(config),
45
+ 'autoincreament': new o.AUTOINCApi(config),
46
+ 'docnoformat': new o.DOCNOApi(config),
47
+ 'systemmessage': new o.SYSMSGApi(config),
48
+ 'keyvaluepair': new o.KVPAIRApi(config),
49
+ 'webhook': new o.WEBHOOKApi(config),
50
+ 'academysession': new o.ACADEMYSESSIONApi(config),
51
+ 'accounttransaction': new o.ACCTRANSApi(config),
52
+ 'agent': new o.AGENTApi(config),
53
+ 'area': new o.AREAApi(config),
54
+ 'attendance': new o.ATTApi(config),
55
+ 'category': new o.CATApi(config),
56
+ 'creditnote': new o.CNApi(config),
57
+ 'enrollment': new o.ENROLLApi(config),
58
+ 'enrollmenttransaction': new o.ENROLLTRANSApi(config),
59
+ 'holiday': new o.HOLIDAYApi(config),
60
+ 'invoice': new o.INVApi(config),
61
+ 'level': new o.LVLApi(config),
62
+ 'parent': new o.PARENTApi(config),
63
+ 'payment': new o.PAYApi(config),
64
+ 'paymentmethod': new o.PAYMETHODApi(config),
65
+ 'product': new o.PRDApi(config),
66
+ 'productpackage': new o.PRDPKGApi(config),
67
+ 'race': new o.RACEApi(config),
68
+ 'refund': new o.REFUNDApi(config),
69
+ 'refundtype': new o.REFUNDTYPEApi(config),
70
+ 'religion': new o.RELIGIONApi(config),
71
+ 'room': new o.ROOMApi(config),
72
+ 'roomtype': new o.ROOMTYPEApi(config),
73
+ 'schedule': new o.SCHEDULEApi(config),
74
+ 'school': new o.SCHOOLApi(config),
75
+ 'stopenrollment': new o.STOPENROLLApi(config),
76
+ 'stopreason': new o.STOPREASONApi(config),
77
+ 'student': new o.STUApi(config),
78
+ 'studentgroup': new o.STUGROUPApi(config),
79
+ 'studentsource': new o.STUDENTSRCApi(config),
80
+ 'studentsummary': new o.STUSUMApi(config),
81
+ 'teacher': new o.TEACHERApi(config),
82
+ 'teachergroup': new o.TEACHERGROUPApi(config),
83
+ 'tuitionclass': new o.TUITIONApi(config),
84
+ 'user': new o.USERApi(config),
85
+
38
86
  };
39
87
 
40
88
  if (!docsOpenapi[documentName]) {
@@ -57,6 +105,6 @@ export const getWorkflowApi = () => {
57
105
 
58
106
  }
59
107
 
60
- export const getPorfileApi = () => {
108
+ export const getProfileApi = () => {
61
109
  return new o.PROFILEApi(getAxiosConfig())
62
110
  }
@@ -1,3 +1,4 @@
1
+ import { getUserProfile } from './getUserStore.generate';
1
2
  /**
2
3
  * This file was automatically generated by simpleapp generator. Every
3
4
  * MODIFICATION OVERRIDE BY GENERATEOR
@@ -15,12 +16,25 @@ export const reloadUserStore = async () =>{
15
16
  await $userstore.loadRemoteUserInfo()
16
17
  }
17
18
  export const getCurrency = () =>getUserStore()?.currency ?? '$$'
18
- export const getUserProfile = () =>{
19
- const userstore = getUserStore()
20
-
21
- return !userstore ? undefined :userstore.getUserInfo()
22
- }
19
+ export const getUserProfile = () => getUserStore()?.getUserInfo()
20
+
23
21
 
22
+ export const isGuideComplete=(guidename: string):boolean=>{
23
+ if(useNuxtApp().$userstore.moreProps.completedTours!==undefined){
24
+ return useNuxtApp().$userstore.moreProps.completedTours.includes(guidename)
25
+ }
26
+ else return false
27
+ }
28
+ export const setGuideComplete= async(guidename:string)=>{
29
+ const userstore =useNuxtApp().$userstore
30
+ await getProfileApi().runTourComplete(guidename);
31
+ if(getUserProfile()!==undefined){
32
+ if(!Array.isArray(getUserProfile()?.moreProps.completedTours))
33
+ userstore.moreProps.completedTours=[guidename]
34
+ else
35
+ userstore.moreProps.completedTours.push(guidename)
36
+ }
37
+ }
24
38
  export const getCurrentXorg = () =>{
25
39
  return (useRoute().params.xorg) ? String(useRoute().params.xorg) : undefined
26
40
  }
@@ -34,9 +48,15 @@ export const getPageBaseUrl = (resourcename:string) =>{
34
48
  * @return boolean
35
49
  */
36
50
  export const canPerform = (resource:string,action:string):boolean =>{
37
- return getUserStore().canPerform(resource,action)
51
+
52
+ return getUserStore().canPerform(upperFirst(resource),action)
53
+ }
54
+ export const haveAccess = (resource:string):boolean =>{
55
+ return getUserStore().haveAccess(upperFirst(resource))
38
56
  }
39
57
 
58
+
59
+
40
60
  export const getProfileEmail = () => getUserProfile()?.email
41
61
  export const getProfileFullName = () => getUserProfile()?.fullName
42
62
 
@@ -46,3 +66,16 @@ export const refreshOrgLogo = async () => {
46
66
  }
47
67
  export const getOrgLogo = ()=> orgLogo
48
68
  export const setOrgLogo = (str:string) => orgLogo = str
69
+ export const getCurrentBranch = ()=>{
70
+ const branchId= getUserStore().branchId
71
+ const branchinfo = getUserStore().branches.find(item=>item.branch.branchId==branchId)
72
+ return branchinfo
73
+ }
74
+
75
+ export const getMySimpleAppUserPicker=()=>{
76
+ return {
77
+ _id: getUserProfile()?._id,
78
+ uid:getUserProfile()?.uid,
79
+ fullName:getUserProfile()?.fullName
80
+ }
81
+ }
@@ -18,6 +18,9 @@ export const getDocumentUrl = (document:string,id?:string,querystr?:string)=>{
18
18
  return path
19
19
  }
20
20
 
21
+ export const getPathResource=()=>{
22
+ return useRoute().path.toString().replace('/'+getCurrentXorg(),'')
23
+ }
21
24
 
22
25
  export const goTo = (document:string,id?:string,querystr?:string)=>{
23
26
  navigateTo(getDocumentUrl(document,id,querystr))
@@ -38,5 +41,15 @@ export const getPathPara = (paraname:string,emptyvalue:string=''):string=>{
38
41
  return emptyvalue
39
42
  }
40
43
  }
41
-
44
+ export const getPathQuery = (paraname:string,emptyvalue:string|string[]=''):string|string[]=>{
45
+ const paravalue = useRoute().query[paraname]
46
+ if( paraname.includes('[')){
47
+ return (typeof paravalue == 'string'? [paravalue] : paravalue) as string[]
48
+ }else if(typeof paravalue == 'string'){
49
+ return paravalue.toString()
50
+ }
51
+ else{
52
+ return emptyvalue
53
+ }
54
+ }
42
55
  export const setCurrentUrl = (path:string)=>useRouter().push({path:path})
@@ -4,7 +4,7 @@
4
4
  * last change 2024-03-13
5
5
  * Author: Ks Tan
6
6
  */
7
-
7
+ import {NotificationStatus} from "~/types"
8
8
  import { createHttpLink, } from '@apollo/client/core';
9
9
 
10
10
  export const setGraphqlServer=()=>{
@@ -23,4 +23,22 @@ export const setGraphqlServer=()=>{
23
23
 
24
24
  }
25
25
 
26
- export const graphquery=async<T>(qqlstr: typeof gql) =>(await useAsyncQuery<T>(qqlstr)).data
26
+ // export const graphquery=async<T>(qqlstr: typeof gql) =>(await useAsyncQuery<T>(qqlstr))
27
+
28
+
29
+ export const gqlQuery=async<T>(gqlstr:string):Promise<T|undefined>=>{
30
+ const query = gql(gqlstr);
31
+ try{
32
+ const result = await useAsyncQuery<T>(query);
33
+ return result.data.value as T
34
+ }catch(e){
35
+ useNuxtApp().$event('Notification',{
36
+ documentName:'report',
37
+ summary:t('reportQueryFailed'),
38
+ status:NotificationStatus.error,
39
+ data:e
40
+ })
41
+ // return e
42
+ }
43
+
44
+ }
@@ -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,19 @@ 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"] %>
16
+ {resource: '<%=m.docname%>', action:'access'},
15
17
  {resource: '<%=m.docname%>', action:'create'},
16
18
  {resource: '<%=m.docname%>', action:'update'},
17
19
  {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
- <%}%>
20
+ {resource: '<%=m.docname%>', action:'search'},
21
+ <% if(Array.isArray(appconfig?.allStatus) && appconfig.allStatus.length>0){%>
22
+ <% for(let sindex=0;sindex<appconfig.allStatus.length;sindex++){%>
23
+ {resource: '<%=m.docname%>', action:'<%=appconfig.allStatus[sindex].status%>'},
24
+ <%}%>
25
+ <%}%>
30
26
  <%}%>
31
27
  ]
32
28
 
@@ -21,6 +21,58 @@ export const getAvatarLink = (email:string, size:number):string=>{
21
21
  return `https://gravatar.com/avatar/${md5(email)}?size=${size}`;
22
22
  //return `https://api.simbiz.cloud/cloudapi/avatar/${md5(email)}?size=${size}`
23
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
+
28
+ }
24
29
 
30
+ export const getDefaultLocale =()=> useNuxtApp().$i18n.defaultLocale
25
31
  export const t = (txt:string,options?:any):string => !txt || txt.trim()=='' ? '' : useNuxtApp().$i18n.t(txt,options)
26
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
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="w w-full items-center justify-center py-12 bg bg-gray-500">
2
+ <div class="w w-full items-center justify-center py-12 bg bg-gray-500 flex flex-row">
3
3
  <div class="bg-white dark:bg-gray-600 p-1 border rounded-md flex items-center justify-center mx-4 w-7/8 md:w-2/3">
4
4
  <div class="flex flex-col items-center py-16">
5
5
 
@@ -11,7 +11,9 @@
11
11
  <h1 class="px-4 pt-2 pb-4 text-left text-5xl font-bold leading-10 text-gray-800">OOPS!</h1>
12
12
  <p class="px-4 mt mb-4 text-4xl text-left font font-bold">{{isNaN(error?.statusCode) ? t('server'): error?.statusCode}} Error</p>
13
13
  <p class="px-4 pb-10 text-base leading-none text-left text-red-400">{{t(error?.statusMessage)}}</p>
14
- <p> <Button @click="handleError" class="btn-primary">{{ t('backToHome') }}</Button></p>
14
+ <p>
15
+ <ButtonPrimary @click="handleError" class="bg-secondary-600 text-white p-2 rounded">{{ t('backToHome') }}</ButtonPrimary>
16
+ </p>
15
17
  </div>
16
18
  </div>
17
19
 
@@ -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
 
@@ -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
  };
@@ -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>
@@ -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>