@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
@@ -0,0 +1,166 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * This file was automatically generated by simpleapp generator during initialization.
4
+ * DO NOT MODIFY IT BY HAND.
5
+ * last change 2023-09-09
6
+ * author: Ks Tan
7
+ */
8
+ import { FilterMatchMode } from 'primevue/api';
9
+ import Column from 'primevue/column';
10
+ import {ref} from 'vue'
11
+ import _ from 'lodash'
12
+ import { SimpleAppClient } from '../simpleapp/generate/clients/SimpleAppClient' //'../SimpleAppClient';
13
+ import Dialog from 'primevue/dialog';
14
+ import {SearchBody,CellSetting} from '~/types'
15
+ const {$listen} = useNuxtApp()
16
+ const defaultlist:CellSetting[] = []
17
+ const recordlist = ref([]);
18
+
19
+ const metas = useRoute().meta
20
+ const documentName = ref(String(metas.documentName))
21
+ const tablecolumns = ref<CellSetting[]>([])
22
+ const sorts = metas.sorts as string[][]
23
+
24
+ const filters = ref({
25
+ 'global': {value: null, matchMode: FilterMatchMode.CONTAINS},
26
+ });
27
+ // onNuxtReady(()=>{
28
+ // console.log("Listen ReloadLayout")
29
+ // $listen('ReloadLayout',(screenname)=>{
30
+ // console.log("Reload layout",screenname)
31
+ // // const metas = useRoute().meta
32
+ // // renderLayout()
33
+
34
+
35
+ // })
36
+
37
+ // })
38
+ provide('refreshLayout',(docname:string)=>{
39
+ console.log("refresh layout:",docname)
40
+ })
41
+ // onMounted(()=>{
42
+ // console.log("On Mounted at layout")
43
+
44
+ // })
45
+ let obj = getDocument(documentName.value)
46
+ // console.log("obj",obj)
47
+ // const data = obj?.getReactiveData()
48
+ // const disabled=ref(false)
49
+
50
+ // const documentTitle = _.upperFirst(documentName)
51
+
52
+ // // const props = defineProps<{
53
+ // // document:SimpleAppClient<any,any>
54
+ // // listColumns:string[]
55
+ // // path:string
56
+ // // title:string
57
+ // // sorts?: any
58
+ // // }>()
59
+
60
+
61
+
62
+
63
+ // const route = useRoute()
64
+
65
+ // const popuptitle = ref("New "+documentTitle)
66
+ // const systemwindows = ref(false)
67
+ // const currentjsonschema:any = obj?.getSchema()
68
+
69
+
70
+ // const recordId = computed(()=>route.params.id)
71
+ // const setNew = computed(()=>route.query.new)
72
+
73
+ // const updateVisible = () =>{
74
+ // console.log("UpdateVisible")
75
+ // if(recordId.value || setNew.value){
76
+ // visible.value = true
77
+ // }else{
78
+ // visible.value = false
79
+ // }
80
+ // }
81
+ // watch(route,(a,b)=>{
82
+ // console.log('watch route change',a,b)
83
+ // },{deep:true})
84
+
85
+ // watch(recordId,()=>{
86
+ // updateVisible()
87
+ // })
88
+ // watch(setNew,()=>{
89
+ // updateVisible()
90
+ // })
91
+
92
+ const refresh = async() => {
93
+ tablecolumns.value= !useRoute().meta.columns ? [] : useRoute().meta.columns as CellSetting[]
94
+ documentName.value = String(useRoute().meta.documentName)
95
+ const searchbody: SearchBody = {
96
+ fields: tablecolumns.value.concat(['created']),
97
+ sorts: metas.sorts as string[][]
98
+ }
99
+ obj = getDocument(documentName.value)
100
+
101
+ obj?.search(searchbody).then((res:any) => {
102
+ recordlist.value = res;
103
+ // disabled.value=false
104
+ });
105
+ };
106
+
107
+ onNuxtReady(()=>{
108
+ refresh()
109
+ // updateVisible()
110
+ })
111
+
112
+ const renderLayout =()=>{
113
+ const metas = useRoute().meta
114
+ // console.log(obj?.getDocName(),'==',data)
115
+ // if(obj?.getDocName()==data.documentName){
116
+ // console.log("Refresh now")
117
+ // refresh()
118
+ // }
119
+ }
120
+
121
+ watch(()=> useRoute().meta ,(newvalue,oldvalue)=>{
122
+ refresh()
123
+ })
124
+
125
+
126
+
127
+
128
+ </script>
129
+ <template>
130
+ <div>
131
+
132
+ <HeaderBar />
133
+ <Invitation/>
134
+ <SimpleAppDatatable :value="recordlist" :columns="tablecolumns" :title="documentName">
135
+ <template #toolbar>
136
+ <div class="w-full text-left">
137
+ <slot>
138
+ undefine page content
139
+ </slot>
140
+ </div>
141
+ </template>
142
+ <template #additionaltoolbar>
143
+ <Button class="bg-secondary-600 hover:bg-secondary-400 text-white" @click="refresh()" type="button" >Refresh</Button>
144
+ </template>
145
+ <Column header=" ">
146
+ <template #body="{index,data}">
147
+ <NuxtLink :to="getDocumentUrl(String(useRoute().meta.documentName),data._id)">
148
+ <Button icon="pi pi-pencil" class="bg-primary-600 hover:bg-primary-400 text-white" >Edit</Button>
149
+ </NuxtLink>
150
+ </template>
151
+ </Column>
152
+ </SimpleAppDatatable>
153
+ <!--
154
+ <DebugDocumentData v-model="data"/>
155
+ -->
156
+ <!-- <Dialog v-model:visible="visible"
157
+ :pt="{root:{class:'w-full h-full'}}"
158
+ modal :header="documentName"
159
+ :autoZIndex="false"
160
+ @update:visible="exitRecord"
161
+ >
162
+ <slot></slot>
163
+ </Dialog> -->
164
+
165
+ </div>
166
+ </template>
@@ -5,11 +5,14 @@
5
5
  * Author: Ks Tan
6
6
  */
7
7
  import { getUserProfile } from './../composables/getUserStore.generate';
8
+ import {MenuData} from '~/types'
8
9
  export default defineNuxtRouteMiddleware((to, from) => {
9
10
 
10
11
  const userprofile = getUserProfile()
11
12
 
12
- if(to.fullPath=='/login'){
13
+
14
+ //is public resource
15
+ if( getPublicResource(String(to.params['xorg'])).filter((item:MenuData)=>to.fullPath === item.url)){
13
16
  return true
14
17
  }// no permission control needed yet
15
18
  else if(!to.params['xorg']){
@@ -24,7 +24,7 @@ const showbranchfrom = ref(false);
24
24
  const getBranchList = () => {
25
25
  branchdoc
26
26
  .getApi()
27
- .runSearch({ orgId: data.value.orgId })
27
+ .runSearch({ filter:{orgId: data.value.orgId }})
28
28
  .then((res) => {
29
29
  branchlist.value = res.data;
30
30
  });
@@ -117,7 +117,7 @@ const saveBranch = async () => {
117
117
  :columns="['branchId', 'branchCode', 'branchName', 'active']"
118
118
  >
119
119
  <template #header>
120
- <Button class=" btn-primary" @click="editBranch('')" type="button">
120
+ <Button class="btn-primary" @click="editBranch('')" type="button">
121
121
  <span class="font font-normal">Add Branch</span>
122
122
  </Button>
123
123
  </template>
@@ -125,7 +125,7 @@ const saveBranch = async () => {
125
125
  <template #body="{ index, data }">
126
126
  <Button
127
127
  type="button"
128
- class=" btn-primary"
128
+ class="btn-primary"
129
129
  @click="editBranch(data._id)"
130
130
  >
131
131
  Edit
@@ -157,7 +157,7 @@ const saveBranch = async () => {
157
157
  :setting="o.getField('#/properties/description')"
158
158
  />
159
159
  <!-- <SimpleAppNumber :readonly="true" v-model="branchdata.orgId" :setting="o.getField('#/properties/orgId')"/> -->
160
- <Button class=" btn-primary" type="button" @click="saveBranch">
160
+ <Button class="btn-primary" type="button" @click="saveBranch">
161
161
  Save
162
162
  </Button>
163
163
  </SimpleAppForm>
@@ -0,0 +1,6 @@
1
+ <template>
2
+ <profile></profile>
3
+ </template>
4
+ <script setup lang="ts">
5
+ import profile from '../profile.vue'
6
+ </script>
@@ -0,0 +1,6 @@
1
+ <script setup lang="ts">
2
+ import Index from './index.vue'
3
+ </script>
4
+ <template>
5
+ <index></index>
6
+ </template>