@simitgroup/simpleapp-generator 1.0.46 → 1.0.48

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 (147) hide show
  1. package/README.md +35 -1
  2. package/buildinschemas copy/docnoformat.docno.jsonschema.json +2 -20
  3. package/dist/buildinschemas/autoincreament.js +1 -1
  4. package/dist/buildinschemas/autoincreament.js.map +1 -1
  5. package/dist/buildinschemas/branch.js +1 -1
  6. package/dist/buildinschemas/branch.js.map +1 -1
  7. package/dist/buildinschemas/docnoformat.d.ts.map +1 -1
  8. package/dist/buildinschemas/docnoformat.js +12 -25
  9. package/dist/buildinschemas/docnoformat.js.map +1 -1
  10. package/dist/buildinschemas/user.d.ts.map +1 -1
  11. package/dist/buildinschemas/user.js +1 -0
  12. package/dist/buildinschemas/user.js.map +1 -1
  13. package/dist/framework.d.ts.map +1 -1
  14. package/dist/framework.js +11 -3
  15. package/dist/framework.js.map +1 -1
  16. package/dist/generate.js +33 -22
  17. package/dist/generate.js.map +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
  21. package/dist/processors/jsonschemabuilder.js +10 -0
  22. package/dist/processors/jsonschemabuilder.js.map +1 -1
  23. package/dist/type.d.ts +115 -22
  24. package/dist/type.d.ts.map +1 -1
  25. package/dist/type.js.map +1 -1
  26. package/package.json +1 -1
  27. package/src/buildinschemas/autoincreament.ts +1 -1
  28. package/src/buildinschemas/branch.ts +1 -1
  29. package/src/buildinschemas/docnoformat.ts +13 -27
  30. package/src/buildinschemas/user.ts +1 -0
  31. package/src/framework.ts +11 -3
  32. package/src/generate.ts +35 -22
  33. package/src/index.ts +1 -1
  34. package/src/processors/jsonschemabuilder.ts +14 -1
  35. package/src/type.ts +137 -22
  36. package/templates/basic/nest/processor.ts.eta +5 -3
  37. package/templates/basic/nest/service.ts.eta +2 -4
  38. package/templates/basic/nuxt/pages.crud.vue.eta +3 -2
  39. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +18 -2
  40. package/templates/nest/src/app.controller.ts.eta +6 -0
  41. package/templates/nest/src/app.module.ts.eta +9 -1
  42. package/templates/nest/src/app.service.ts.eta +6 -0
  43. package/templates/nest/src/main.ts.eta +7 -0
  44. package/templates/nest/src/simpleapp/generate/apischemas/index.ts.eta +6 -2
  45. package/templates/nest/src/simpleapp/generate/commons/audittrail.service.ts.eta +17 -0
  46. package/templates/nest/src/simpleapp/generate/commons/decorators/appuser.decorator.ts.eta +6 -0
  47. package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +14 -0
  48. package/templates/nest/src/simpleapp/generate/commons/dicts/foreignkeys.ts.eta +6 -0
  49. package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +9 -3
  50. package/templates/nest/src/simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta +23 -3
  51. package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +52 -10
  52. package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +6 -0
  53. package/templates/nest/src/simpleapp/generate/commons/providers/workflow.provider.ts.etax +6 -0
  54. package/templates/nest/src/simpleapp/generate/commons/roles/roles.decorator.ts.eta +6 -1
  55. package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +6 -0
  56. package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +6 -0
  57. package/templates/nest/src/simpleapp/generate/commons/roles/roles.guard.ts.eta +6 -1
  58. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +15 -7
  59. package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +6 -0
  60. package/templates/nest/src/simpleapp/generate/models/apievent.model.ts.eta +27 -0
  61. package/templates/nest/src/simpleapp/generate/models/perm.model.ts.eta +3 -4
  62. package/templates/nest/src/simpleapp/generate/models/tenant.model.ts.eta +3 -5
  63. package/templates/nest/src/simpleapp/generate/models/user.model.ts.eta +3 -4
  64. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +54 -12
  65. package/templates/nest/src/simpleapp/generate/types/apievent.type.ts.eta +22 -0
  66. package/templates/nest/src/simpleapp/generate/types/index.ts.eta +6 -0
  67. package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +6 -0
  68. package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +6 -0
  69. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +6 -0
  70. package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +6 -0
  71. package/templates/nest/src/simpleapp/services/autoinc.service.ts.eta +5 -6
  72. package/templates/nest/src/simpleapp/services/branch.service.ts.eta +50 -10
  73. package/templates/nest/src/simpleapp/services/docno.service.ts.eta +9 -10
  74. package/templates/nest/src/simpleapp/services/org.service.ts.eta +4 -6
  75. package/templates/nest/src/simpleapp/services/perm.service.ts.eta +6 -7
  76. package/templates/nest/src/simpleapp/services/tenant.service.ts.eta +5 -6
  77. package/templates/nest/src/simpleapp/services/user.service.ts.eta +5 -6
  78. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +6 -8
  79. package/templates/nuxt/app.vue.eta +6 -1
  80. package/templates/nuxt/assets/css/style.css._eta +12 -0
  81. package/templates/nuxt/assets/css/tailwind.css._eta +10 -0
  82. package/templates/nuxt/assets/primevue/passthrough.ts._eta +37 -0
  83. package/templates/nuxt/components/ButtonCreateTenant.vue.eta +68 -0
  84. package/templates/nuxt/components/ButtonHome.vue.eta +10 -0
  85. package/templates/nuxt/components/ButtonLogout.vue.eta +9 -0
  86. package/templates/nuxt/components/ButtonMenuPicker.vue.eta +55 -0
  87. package/templates/nuxt/components/ButtonPermissionInfo.vue.eta +113 -0
  88. package/templates/nuxt/components/ButtonProfile.vue.eta +52 -0
  89. package/templates/nuxt/components/CrudNestedDoc.vue.eta +16 -8
  90. package/templates/nuxt/components/CrudSimple.vue.eta +13 -11
  91. package/templates/nuxt/components/DebugDocumentData.vue.eta +1 -1
  92. package/templates/nuxt/components/HeaderBar.vue.eta +39 -0
  93. package/templates/nuxt/components/Invitation.vue.eta +2 -2
  94. package/templates/nuxt/components/ListView.vue.eta +52 -0
  95. package/templates/nuxt/components/Menus.vue.eta +6 -6
  96. package/templates/nuxt/components/SelectBranch.vue.eta +35 -0
  97. package/templates/nuxt/components/SimpleAppDatatable.vue.eta +0 -1
  98. package/templates/nuxt/components/SimpleAppDocumentNo.vue.eta +2 -2
  99. package/templates/nuxt/components/SimpleAppInputTable.vue.eta +2 -2
  100. package/templates/nuxt/components/SimpleFieldContainer.vue.eta +18 -12
  101. package/templates/nuxt/components/Spinner.vue.eta +9 -0
  102. package/templates/nuxt/composables/getMenus.generate.ts.eta +5 -4
  103. package/templates/nuxt/layouts/default.vue.eta +3 -12
  104. package/templates/nuxt/layouts/sidelistcrud.vue.eta +43 -0
  105. package/templates/nuxt/middleware/{10.acl.global.ts.eta → 30.acl.global.ts.eta} +6 -0
  106. package/templates/nuxt/nuxt.config.ts.eta +55 -12
  107. package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +274 -247
  108. package/templates/nuxt/pages/[xorg]/index.vue._eta +13 -0
  109. package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +89 -65
  110. package/templates/nuxt/pages/[xorg]/permission/index.vue.eta +7 -7
  111. package/templates/nuxt/pages/[xorg]/user/index.vue.eta +33 -33
  112. package/templates/nuxt/pages/index.vue.eta +10 -85
  113. package/templates/nuxt/pages/login.vue.eta +9 -3
  114. package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +16 -19
  115. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +19 -3
  116. package/templates/nuxt/plugins/50.simpleapp-client.ts.eta +4 -4
  117. package/templates/nuxt/server/api/[xorg]/[...].ts.eta +4 -4
  118. package/templates/nuxt/server/api/auth/[...].ts.eta +6 -0
  119. package/templates/nuxt/server/api/auth/logout.ts.eta +6 -1
  120. package/templates/nuxt/server/api/profile/[...].ts.eta +4 -5
  121. package/templates/nuxt/server/api/profile/index.ts.eta +4 -6
  122. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +9 -2
  123. package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +12 -3
  124. package/templates/nuxt/simpleapp/generate/commons/events.ts.eta +6 -0
  125. package/templates/nuxt/simpleapp/generate/commons/groups.ts.eta +6 -0
  126. package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +6 -0
  127. package/templates/nuxt/tailwind.config.ts._eta +66 -0
  128. package/templates/nuxt/types/index.ts.eta +22 -1
  129. package/templates/project/build.sh.eta +4 -4
  130. package/templates/project/schemas/category.ts.eta +40 -27
  131. package/templates/project/schemas/customer.ts.eta +35 -0
  132. package/templates/project/schemas/index.ts.eta +4 -4
  133. package/templates/project/schemas/invoice.ts.eta +56 -0
  134. package/templates/project/schemas/product.ts.eta +41 -57
  135. package/templates/project/sharelibs/index.ts.eta +2 -0
  136. package/templates/project/sharelibs/money.ts.eta +17 -0
  137. package/tsconfig.tsbuildinfo +1 -1
  138. package/templates/nuxt/assets/css/tailwind.css.eta +0 -35
  139. package/templates/nuxt/components/PermissionInfo.vue.eta +0 -92
  140. package/templates/nuxt/pages/[xorg]/index.vue.eta +0 -36
  141. package/templates/nuxt/tailwind.config.ts.eta +0 -9
  142. package/templates/project/shares/index.ts.eta +0 -2
  143. /package/templates/nest/{.env.eta → .env._eta} +0 -0
  144. /package/templates/nuxt/{.env.eta → .env._eta} +0 -0
  145. /package/templates/nuxt/pages/[xorg]/branch/{index.vue.eta → index.vue.etax} +0 -0
  146. /package/templates/project/{config.json.eta → config.json._eta} +0 -0
  147. /package/templates/project/{shares → sharelibs}/hello.ts.eta +0 -0
@@ -12,68 +12,68 @@ import {
12
12
  InputTableColumn,
13
13
  } from "@simitgroup/simpleapp-vue-component/src/type";
14
14
  import Column from "primevue/column";
15
- const { $OrganizationDoc,$BranchDoc, $listen } = useNuxtApp();
15
+ const { $OrganizationDoc, $BranchDoc, $listen } = useNuxtApp();
16
16
  //organization
17
17
  const doc = $OrganizationDoc();
18
18
  const data = doc.getReactiveData();
19
19
  const columns = ["orgCode", "orgName", "description", "tenantId", "orgId"];
20
- const branchlist = ref()
21
- const branchdoc = $BranchDoc()
22
- const branchdata = branchdoc.getReactiveData()
23
- const currentOrgId=ref()
24
- const debugdata= ref()
25
- const showbranchfrom = ref(false)
20
+ const branchlist = ref();
21
+ const branchdoc = $BranchDoc();
22
+ const branchdata = branchdoc.getReactiveData();
23
+ const currentOrgId = ref();
24
+ const debugdata = ref();
25
+ const showbranchfrom = ref(false);
26
26
  //branch
27
27
 
28
28
  const getBranchList = () => {
29
-
30
- branchdoc.getApi().runSearch({orgId:data.value.orgId}).then((res)=>{
31
- branchlist.value =res.data
32
- })
33
- }
34
- $listen('editRecord',async (editOrgid)=>{
35
- //console.log('editRecord',editOrgid)
36
- debugdata.value=data.value
37
- if(editOrgid){
38
-
39
- currentOrgId.value=editOrgid
40
- getBranchList()
41
- }
42
- })
29
+ branchdoc
30
+ .getApi()
31
+ .runSearch({ orgId: data.value.orgId })
32
+ .then((res) => {
33
+ branchlist.value = res.data;
34
+ });
35
+ };
36
+ $listen("editRecord", async (editOrgid) => {
37
+ //console.log('editRecord',editOrgid)
38
+ debugdata.value = data.value;
39
+ if (editOrgid) {
40
+ currentOrgId.value = editOrgid;
41
+ getBranchList();
42
+ }
43
+ });
43
44
 
44
- const editBranch=(recordId:string)=>{
45
- console.log("edit nested",currentOrgId,recordId)
46
- showbranchfrom.value=true
47
- debugdata.value=branchdata.value
48
- if(!recordId){
49
- branchdoc.setNew()
50
- }else{
51
- branchdoc.getById(recordId)
45
+ const editBranch = (recordId: string) => {
46
+ console.log("edit nested", currentOrgId, recordId);
47
+ showbranchfrom.value = true;
48
+ debugdata.value = branchdata.value;
49
+ if (!recordId) {
50
+ branchdoc.setNew();
51
+ } else {
52
+ branchdoc.getById(recordId);
52
53
  }
53
- }
54
- const saveBranch= async()=>{
55
- branchdata.value.orgId=data.value.orgId
54
+ };
55
+ const saveBranch = async () => {
56
+ branchdata.value.orgId = data.value.orgId;
56
57
  branchdata.value.organization = {
57
58
  _id: data.value._id,
58
59
  orgId: data.value.orgId,
59
- label: data.value.orgName
60
- }
61
- if(branchdata.value._id==''){
62
- console.log("Create")
63
- await branchdoc.create()
64
- }else{
65
- console.log("update")
66
- await branchdoc.update()
60
+ label: data.value.orgName,
61
+ };
62
+ if (branchdoc.isNew()) {
63
+ console.log("Create");
64
+ await branchdoc.create();
65
+ } else {
66
+ console.log("update");
67
+ await branchdoc.update();
67
68
  }
68
- getBranchList()
69
-
70
- }
69
+ getBranchList();
70
+ };
71
71
 
72
72
  //end
73
73
  </script>
74
74
  <template>
75
75
  <div>
76
- <DebugDocumentData v-model="debugdata"/>
76
+ <DebugDocumentData v-model="debugdata" />
77
77
  <CrudNestedDoc
78
78
  :document="doc"
79
79
  title="Organization"
@@ -116,33 +116,57 @@ const saveBranch= async()=>{
116
116
  </div>
117
117
  <div class="grid grid-cols-4 gap-4 w-full">
118
118
  <div class="col-span-2">
119
-
120
- <SimpleAppDatatable v-model="branchlist" :columns="['branchId','branchCode','branchName','active']">
119
+ <SimpleAppDatatable
120
+ v-model="branchlist"
121
+ :columns="['branchId', 'branchCode', 'branchName', 'active']"
122
+ >
121
123
  <template #header>
122
- <button class="btn-primary" @click="editBranch('')" type="button" ><span class="pi pi-plus "> </span></button>
123
- </template>
124
- <Column header="Action" >
125
- <template #body="{index,data}">
126
- <button type="button" class="btn-primary" @click="editBranch(data._id)">Edit</button>
127
- </template>
128
- </Column>
129
-
124
+ <Button class=" btn-primary" @click="editBranch('')" type="button">
125
+ <span class="font font-normal">Add Branch</span>
126
+ </Button>
127
+ </template>
128
+ <Column header="Action">
129
+ <template #body="{ index, data }">
130
+ <Button
131
+ type="button"
132
+ class=" btn-primary"
133
+ @click="editBranch(data._id)"
134
+ >
135
+ Edit
136
+ </Button>
137
+ </template>
138
+ </Column>
130
139
  </SimpleAppDatatable>
131
140
  </div>
132
- <div class="col-span-2" >
133
- <SimpleAppForm :document="branchdoc" #default="o" v-if="showbranchfrom">
134
- <SimpleAppText v-model="branchdata.branchCode" :setting="o.getField('#/properties/branchCode')"/>
135
- <SimpleAppText v-model="branchdata.branchName" :setting="o.getField('#/properties/branchName')"/>
136
- <SimpleAppCheckbox v-model="branchdata.active" :setting="o.getField('#/properties/active')"/>
137
- <SimpleAppTextarea v-model="branchdata.description" :setting="o.getField('#/properties/description')"/>
138
- <!-- <SimpleAppNumber :readonly="true" v-model="branchdata.orgId" :setting="o.getField('#/properties/orgId')"/> -->
139
- <button class="btn-primary" type="button" @click="saveBranch">Save</button>
140
-
141
+ <div class="col-span-2">
142
+ <SimpleAppForm
143
+ :document="branchdoc"
144
+ #default="o"
145
+ v-if="showbranchfrom"
146
+ >
147
+ <SimpleAppText
148
+ v-model="branchdata.branchCode"
149
+ :setting="o.getField('#/properties/branchCode')"
150
+ />
151
+ <SimpleAppText
152
+ v-model="branchdata.branchName"
153
+ :setting="o.getField('#/properties/branchName')"
154
+ />
155
+ <SimpleAppCheckbox
156
+ v-model="branchdata.active"
157
+ :setting="o.getField('#/properties/active')"
158
+ />
159
+ <SimpleAppTextarea
160
+ v-model="branchdata.description"
161
+ :setting="o.getField('#/properties/description')"
162
+ />
163
+ <!-- <SimpleAppNumber :readonly="true" v-model="branchdata.orgId" :setting="o.getField('#/properties/orgId')"/> -->
164
+ <Button class=" btn-primary" type="button" @click="saveBranch">
165
+ Save
166
+ </Button>
141
167
  </SimpleAppForm>
142
168
  </div>
143
-
144
169
  </div>
145
170
  </CrudNestedDoc>
146
-
147
171
  </div>
148
172
  </template>
@@ -156,7 +156,7 @@ onMounted(() => {
156
156
  });
157
157
  </script>
158
158
  <template>
159
- <button @click="refreshList()" class="pi pi-refresh"></button>
159
+ <Button @click="refreshList()" class="pi pi-refresh"></Button>
160
160
  <Dialog
161
161
  v-model:visible="showpermissioninfo"
162
162
  modal
@@ -204,8 +204,8 @@ onMounted(() => {
204
204
  placeholder="email"
205
205
  v-model="inviteemail"
206
206
  />
207
- <button label="Search" class="btn btn-primary" @click="invite"
208
- >Invite</button
207
+ <Button label="Search" class=" btn-primary" @click="invite"
208
+ >Invite</Button
209
209
  >
210
210
 
211
211
  </div>
@@ -221,10 +221,10 @@ onMounted(() => {
221
221
  {{ invitation.email }}
222
222
  </div>
223
223
  <div>
224
- <button
224
+ <Button
225
225
  class="btn-danger pi pi-times"
226
226
  @click="deleteInvitation(invitation._id)"
227
- ></button>
227
+ ></Button>
228
228
  </div>
229
229
  </div>
230
230
  </div>
@@ -235,10 +235,10 @@ onMounted(() => {
235
235
  <div class="flex flex-row w w-full">
236
236
  <div class="text text-xl p p-2 text-left flex-1">{{ activeuser }}</div>
237
237
  <div class="text-right m mr-2">
238
- <button
238
+ <Button
239
239
  class="btn-primary pi pi-question"
240
240
  @click="previewPermission"
241
- ></button>
241
+ ></Button>
242
242
  </div>
243
243
  </div>
244
244
 
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import Menu from "primevue/menu";
9
9
  import Dialog from "primevue/dialog";
10
- import {SearchBody} from '~/types'
10
+ import { SearchBody } from "~/types";
11
11
  import _ from "lodash";
12
12
  import Panel from "primevue/panel";
13
13
  import { ref } from "vue";
@@ -67,7 +67,9 @@ const permissiontitle = "Permission Information";
67
67
  */
68
68
  const refreshList = async (resetpage: boolean = true) => {
69
69
  const items: any[] = [];
70
- const searchbody: SearchBody = {fields:['uid','email','created','fullname','active']}
70
+ const searchbody: SearchBody = {
71
+ fields: ["uid", "email", "created", "fullname", "active"],
72
+ };
71
73
  userlist.value = await userdoc.search(searchbody);
72
74
  //listUser();
73
75
  // userlist.value = _.uniqBy(permlist.value, "uid");
@@ -90,13 +92,25 @@ const refreshList = async (resetpage: boolean = true) => {
90
92
  */
91
93
  const onSelectUser = async (menuitem: any) => {
92
94
  const user: UserListItem = { ...menuitem };
93
- const orgsearchbody: SearchBody = {fields:['orgId','orgCode','orgName','active']}
94
- const branchsearchbody: SearchBody = {fields:['orgId','branchId','branchCode','branchName','active']}
95
+ const orgsearchbody: SearchBody = {
96
+ fields: ["orgId", "orgCode", "orgName", "active"],
97
+ };
98
+ const branchsearchbody: SearchBody = {
99
+ fields: ["orgId", "branchId", "branchCode", "branchName", "active"],
100
+ };
95
101
  const permsearchbody: SearchBody = {
96
- filter:{$or: [{ uid: user.uid }, { user_id: user._id }],},
97
- fields:['uid','branchId','tenantId','orgId','active','group','created']
98
- }
99
-
102
+ filter: { $or: [{ uid: user.uid }, { user_id: user._id }] },
103
+ fields: [
104
+ "uid",
105
+ "branchId",
106
+ "tenantId",
107
+ "orgId",
108
+ "active",
109
+ "group",
110
+ "created",
111
+ ],
112
+ };
113
+
100
114
  orglist.value = await orgdoc.search(orgsearchbody);
101
115
  branchlist.value = await branchdoc.search(branchsearchbody);
102
116
  permlist.value = await permdoc.search(permsearchbody);
@@ -238,21 +252,11 @@ onMounted(() => {
238
252
  });
239
253
  </script>
240
254
  <template>
241
- <button
255
+ <Button
242
256
  @click="refreshList()"
243
257
  v-if="useRuntimeConfig().public.DEBUGDATA"
244
258
  class="pi pi-refresh"
245
- ></button>
246
- <Dialog
247
- v-model:visible="showpermissioninfo"
248
- modal
249
- :header="permissiontitle"
250
- :autoZIndex="false"
251
- :style="{ zIndex: 100, width: '80vw' }"
252
- >
253
- <PermissionInfo></PermissionInfo>
254
- </Dialog>
255
-
259
+ ></Button>
256
260
  <div class="grid grid-cols-4">
257
261
  <div v-if="userlist">
258
262
  <TabView>
@@ -281,11 +285,11 @@ onMounted(() => {
281
285
  </div>
282
286
  <div class="basis-1/6 m-2">
283
287
  <!-- only debug mode can delete user -->
284
- <button
288
+ <Button
285
289
  v-if="useRuntimeConfig().public.DEBUGDATA"
286
290
  class="pi pi-times btn-danger"
287
291
  @click="deleteUser(item)"
288
- ></button>
292
+ ></Button>
289
293
  </div>
290
294
  </a>
291
295
  </template>
@@ -316,11 +320,11 @@ onMounted(() => {
316
320
  </div>
317
321
  <div class="basis-1/6 m-2">
318
322
  <!-- only debug mode can delete user -->
319
- <button
323
+ <Button
320
324
  v-if="useRuntimeConfig().public.DEBUGDATA"
321
325
  class="pi pi-times btn-danger"
322
326
  @click="deleteUser(item)"
323
- ></button>
327
+ ></Button>
324
328
  </div>
325
329
  </a>
326
330
  </template>
@@ -335,9 +339,9 @@ onMounted(() => {
335
339
  placeholder="email"
336
340
  v-model="inviteemail"
337
341
  />
338
- <button label="Search" class="btn btn-primary" @click="invite">
342
+ <Button label="Search" class="btn btn-primary" @click="invite">
339
343
  Invite
340
- </button>
344
+ </Button>
341
345
  </div>
342
346
  </form>
343
347
  </div>
@@ -364,10 +368,10 @@ onMounted(() => {
364
368
  <div class="text text-sm text-right">{{ item.email }}</div>
365
369
  </div>
366
370
  <div class="basis-1/6 m-2">
367
- <button
371
+ <Button
368
372
  class="pi pi-times btn-danger"
369
373
  @click="deleteUser(item)"
370
- ></button>
374
+ ></Button>
371
375
  </div>
372
376
  </a>
373
377
  </template>
@@ -415,17 +419,13 @@ onMounted(() => {
415
419
  >
416
420
  <BlockUI :blocked="blockscreen">
417
421
  <div class="text-right m mr-2">
418
- <button
419
- class="btn-primary pi pi-question"
420
- @click="previewPermission"
421
- ></button>
422
+ <ButtonPermissionInfo></ButtonPermissionInfo>
422
423
  </div>
423
424
 
424
425
  <div class="grid grid-cols-2">
425
426
  <Card v-for="o in orglist" class="m-2">
426
427
  <template #title>{{ o.orgName }}</template>
427
428
  <template #content>
428
-
429
429
  <table class="w w-full">
430
430
  <thead class="">
431
431
  <tr>
@@ -1,9 +1,9 @@
1
1
  <script lang="ts" setup>
2
2
  /**
3
- * This file was automatically generated by simpleapp generator during initialization.
4
- * You may modify it for your need
5
- * last change 2023-09-09
6
- * author: Ks Tan
3
+ * This file was automatically generated by simpleapp generator. Every
4
+ * MODIFICATION OVERRIDE BY GENERATEOR
5
+ * last change 2023-10-28
6
+ * Author: Ks Tan
7
7
  */
8
8
  import _ from "lodash";
9
9
  import InputText from "primevue/inputtext";
@@ -11,28 +11,21 @@ import Dialog from "primevue/dialog";
11
11
  import { ref, Ref } from "vue";
12
12
  import { SimpleAppEventType } from "../simpleapp/generate/commons/events";
13
13
  import { TenantDoc } from "../simpleapp/docs/TenantDoc";
14
- import ProgressSpinner from 'primevue/progressspinner';
14
+ import ProgressSpinner from "primevue/progressspinner";
15
15
  import Panel from "primevue/panel";
16
16
  import Card from "primevue/card";
17
17
  import { AxiosResponse } from "axios";
18
18
 
19
19
  const { $event, $listen, $userstore } = useNuxtApp();
20
- const errCreateTenant = ref();
21
20
  const branches = ref([]);
22
- const data = ref();
23
- const visible = ref(false);
24
21
  const userprofile = ref();
25
- const createtitle = ref("Create My Company");
26
22
  const orgList = ref();
27
- const onhold = ref(false)
23
+
28
24
  const loadProfile = async () => {
29
25
  await reloadUserStore();
30
26
  userprofile.value = getUserProfile();
31
27
  console.log("useprofile", userprofile.value);
32
- data.value = {
33
- tenantName: "",
34
- };
35
-
28
+
36
29
  branches.value = userprofile.value.branches;
37
30
 
38
31
  orgList.value = _.uniqBy(branches.value, "branch.orgId").map((item) => ({
@@ -52,34 +45,6 @@ onMounted(() => {
52
45
  loadProfile();
53
46
  });
54
47
 
55
- const createTenant = async () => {
56
-
57
- onhold.value=true
58
- const { $axios, $listen } = useNuxtApp();
59
-
60
- const openapi = getApi();
61
- const apipath = `${useRuntimeConfig().public.API_URL}`;
62
- let profileapi = new openapi.PROFILEApi(undefined, apipath, $axios);
63
-
64
- profileapi
65
- .createTenant(data.value)
66
- .then((res) => {
67
- if (res && res.status && res.status == 201) {
68
- if (res.data && res.data["xOrg"]) {
69
- const xorg = res.data["xOrg"];
70
- navigateTo("/" + xorg, { external: true });
71
- }
72
- }
73
-
74
- })
75
- .catch((err) => {
76
- errCreateTenant.value = err["message"];
77
- console.error("errCreateTenant", err);
78
-
79
- }).finally(()=>{
80
- onhold.value=false
81
- });
82
- };
83
48
  </script>
84
49
  <template>
85
50
  <div class="grid grid-cols-2">
@@ -87,38 +52,7 @@ const createTenant = async () => {
87
52
  <Panel header="Create New Tenant">
88
53
  <div>
89
54
  <h1>Create new one?</h1>
90
- <DebugDocumentData
91
- v-model="data"
92
- label="CreateTenant"
93
- ></DebugDocumentData>
94
- <button class="btn-primary" @click="visible = true">
95
- Create My Company
96
- </button>
97
-
98
- <Dialog
99
- v-model:visible="visible"
100
- modal
101
- :header="createtitle"
102
- class="crudsimple-dialog"
103
- >
104
- <form @submit.prevent="true" class="flex flex-col text-center">
105
-
106
- <div v-if="errCreateTenant" class="text-error">
107
- {{ errCreateTenant }}
108
- </div>
109
- <ProgressSpinner v-if="onhold"></ProgressSpinner>
110
- <InputText v-else
111
- type="text"
112
- autofocus="true"
113
- v-model:model-value="data.tenantName"
114
- placeholder="Organization Name"
115
- />
116
-
117
- <button class="btn-primary" type="submit" @click="createTenant">
118
- Create
119
- </button>
120
- </form>
121
- </Dialog>
55
+ <ButtonCreateTenant></ButtonCreateTenant>
122
56
  </div>
123
57
  </Panel>
124
58
  <Panel header="Reserved">
@@ -130,11 +64,11 @@ const createTenant = async () => {
130
64
  <template #header>
131
65
  <div class="flex flex-row">
132
66
  <div class="font font-bold">Login To</div>
133
- <button
67
+ <Button
134
68
  class="pi pi-refresh ml-4"
135
69
  @click="loadProfile"
136
70
  v-if="useRuntimeConfig().public.DEBUGDATA"
137
- ></button>
71
+ ></Button>
138
72
  </div>
139
73
  </template>
140
74
  <div class="grid grid-cols-2">
@@ -180,12 +114,3 @@ const createTenant = async () => {
180
114
  </Panel>
181
115
  </div>
182
116
  </template>
183
-
184
- <style scoped>
185
- .p-panel {
186
- @apply m-2;
187
- }
188
- /* .tenant-link:hover div {
189
- @apply bg-gray-300;
190
- } */
191
- </style>
@@ -1,7 +1,10 @@
1
- <template>
2
- <NuxtPage />
3
- </template>
4
1
  <script setup lang="ts">
2
+ /**
3
+ * This file was automatically generated by simpleapp generator. Every
4
+ * MODIFICATION OVERRIDE BY GENERATEOR
5
+ * last change 2023-10-28
6
+ * Author: Ks Tan
7
+ */
5
8
  definePageMeta({
6
9
  name: "Login",
7
10
  auth: false,
@@ -19,3 +22,6 @@ onMounted(async () => {
19
22
  await signIn("keycloak", { callbackUrl: callbackUrl });
20
23
  });
21
24
  </script>
25
+ <template>
26
+ <NuxtPage />
27
+ </template>
@@ -1,21 +1,16 @@
1
- // import { Tailwind } from 'primevue/passthrough/tailwind';
2
- import Tailwind from "primevue/passthrough/tailwind";
3
-
4
- // const Base64URL = require('@darkwolf/base64url');
5
-
6
1
  /**
7
- * This file was automatically generated by simpleapp generator during initialization.
8
- * DO NOT MODIFY IT BY HAND.
9
- * last change 2023-09-09
10
- * author: Ks Tan
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
11
6
  */
12
7
  import { defineNuxtPlugin } from "#app";
13
8
  import axios, { Axios, AxiosResponse } from 'axios'
14
- import PrimeVue from "primevue/config";
9
+ // import PrimeVue from "primevue/config";
15
10
  import mitt from 'mitt'
16
- import ToastService from 'primevue/toastservice';
17
- import ConfirmationService from 'primevue/confirmationservice';
18
- import Tooltip from 'primevue/tooltip';
11
+ // import ToastService from 'primevue/toastservice';
12
+ // import ConfirmationService from 'primevue/confirmationservice';
13
+ // import Tooltip from 'primevue/tooltip';
19
14
  const emitter = mitt()
20
15
 
21
16
  export default defineNuxtPlugin( async(nuxtApp) => {
@@ -34,12 +29,14 @@ export default defineNuxtPlugin( async(nuxtApp) => {
34
29
  return Promise.reject(error)
35
30
  }
36
31
  });
37
- nuxtApp.vueApp.use(PrimeVue, { ripple: true,Tailwind:true, pt: Tailwind});
38
- nuxtApp.vueApp
39
- .use(ToastService)
40
- .use(ConfirmationService)
41
- .directive('tooltip', Tooltip)
42
- ;
32
+
33
+ // nuxtApp.vueApp.use(PrimeVue, { ripple: true,Tailwind:true, pt: Tailwind});
34
+ // nuxtApp.vueApp.use(PrimeVue, { unstyled: true, pt: {} });
35
+ // nuxtApp.vueApp
36
+ // .use(ToastService)
37
+ // .use(ConfirmationService)
38
+ // .directive('tooltip', Tooltip)
39
+ // ;
43
40
 
44
41
 
45
42
  return {
@@ -1,8 +1,15 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
6
+ */
1
7
  import { defineNuxtPlugin } from "#app";
2
8
  import {PROFILEApi} from '../simpleapp/generate/openapi'
3
9
  import axios, { Axios, AxiosResponse } from 'axios'
4
10
  import _ from 'lodash'
5
11
 
12
+
6
13
  export default defineNuxtPlugin( async(nuxtApp) => {
7
14
 
8
15
 
@@ -13,6 +20,8 @@ export default defineNuxtPlugin( async(nuxtApp) => {
13
20
  branchId:ref(0),
14
21
  branchCode:ref(''),
15
22
  branchName:ref(''),
23
+ orgCode:ref(''),
24
+ orgName:ref(''),
16
25
  uid: ref(''),
17
26
  email: ref(''),
18
27
  fullName: ref(''),
@@ -45,14 +54,15 @@ export default defineNuxtPlugin( async(nuxtApp) => {
45
54
  this.branchId = res.data.branchId
46
55
  this.branchCode = res.data.branchCode
47
56
  this.branchName = res.data.branchName
57
+ this.orgCode = res.data.orgCode
58
+ this.orgName = res.data.orgName
48
59
  this.uid = res.data.uid
49
60
  this.email = res.data.email
50
61
  this.fullName = res.data.fullName
51
62
  this.branches = res.data.branches
52
63
  this.group = res.data.group
53
64
  this.roles = res.data.roles
54
- this.time = res.data.time
55
-
65
+ this.time = res.data.time
56
66
  this.invites = res.data.invites
57
67
 
58
68
  return Promise.resolve(true)
@@ -66,9 +76,12 @@ export default defineNuxtPlugin( async(nuxtApp) => {
66
76
  }
67
77
  })
68
78
  },
79
+ getAvatarLink(size:number){
80
+ return `https://i.pravatar.cc/${size}`
81
+ },
69
82
  getCurrentXorg(){
70
83
  const currentxorg:string = String(useRoute().params.xorg)
71
- return _.find(this.branches,{xorg:currentxorg})
84
+ return currentxorg //_.find(this.branches,{xorg:currentxorg})
72
85
  },
73
86
  async decideInvitation(id:string,decision:string){
74
87
  const apiurl = `${useRuntimeConfig().public.APP_URL}/api`
@@ -125,12 +138,15 @@ export default defineNuxtPlugin( async(nuxtApp) => {
125
138
  email : this.email,
126
139
  branchCode: this.branchCode,
127
140
  branchName: this.branchName,
141
+ orgCode: this.orgCode,
142
+ orgName: this.orgName,
128
143
  fullName : this.fullName,
129
144
  branches:this.branches??[],
130
145
  invites: this.invites ?? [],
131
146
  roles:this.roles,
132
147
  group:this.group,
133
148
  time:this.time,
149
+ currentxorg: this.getCurrentXorg()
134
150
 
135
151
 
136
152
  }