@simitgroup/simpleapp-generator 1.0.47 → 1.0.49

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 (137) hide show
  1. package/README.md +44 -4
  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 +10 -2
  15. package/dist/framework.js.map +1 -1
  16. package/dist/generate.js +24 -13
  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/type.d.ts +1 -0
  21. package/dist/type.d.ts.map +1 -1
  22. package/dist/type.js.map +1 -1
  23. package/package.json +1 -1
  24. package/src/buildinschemas/autoincreament.ts +1 -1
  25. package/src/buildinschemas/branch.ts +1 -1
  26. package/src/buildinschemas/docnoformat.ts +13 -27
  27. package/src/buildinschemas/user.ts +1 -0
  28. package/src/framework.ts +10 -2
  29. package/src/generate.ts +26 -13
  30. package/src/index.ts +1 -1
  31. package/src/type.ts +1 -0
  32. package/templates/basic/nest/processor.ts.eta +2 -2
  33. package/templates/basic/nest/service.ts.eta +2 -4
  34. package/templates/basic/nuxt/pages.crud.vue.eta +2 -2
  35. package/templates/nest/src/app.controller.ts.eta +6 -0
  36. package/templates/nest/src/app.module.ts.eta +9 -1
  37. package/templates/nest/src/app.service.ts.eta +6 -0
  38. package/templates/nest/src/main.ts.eta +7 -0
  39. package/templates/nest/src/simpleapp/generate/apischemas/index.ts.eta +6 -2
  40. package/templates/nest/src/simpleapp/generate/commons/audittrail.service.ts.eta +17 -0
  41. package/templates/nest/src/simpleapp/generate/commons/decorators/appuser.decorator.ts.eta +6 -0
  42. package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +14 -0
  43. package/templates/nest/src/simpleapp/generate/commons/dicts/foreignkeys.ts.eta +6 -0
  44. package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +9 -3
  45. package/templates/nest/src/simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta +23 -3
  46. package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +52 -10
  47. package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +6 -0
  48. package/templates/nest/src/simpleapp/generate/commons/providers/workflow.provider.ts.etax +6 -0
  49. package/templates/nest/src/simpleapp/generate/commons/roles/roles.decorator.ts.eta +6 -1
  50. package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +6 -0
  51. package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +6 -0
  52. package/templates/nest/src/simpleapp/generate/commons/roles/roles.guard.ts.eta +6 -1
  53. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +15 -7
  54. package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +6 -0
  55. package/templates/nest/src/simpleapp/generate/models/apievent.model.ts.eta +27 -0
  56. package/templates/nest/src/simpleapp/generate/models/perm.model.ts.eta +3 -4
  57. package/templates/nest/src/simpleapp/generate/models/tenant.model.ts.eta +3 -5
  58. package/templates/nest/src/simpleapp/generate/models/user.model.ts.eta +3 -4
  59. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +42 -11
  60. package/templates/nest/src/simpleapp/generate/types/apievent.type.ts.eta +22 -0
  61. package/templates/nest/src/simpleapp/generate/types/index.ts.eta +6 -0
  62. package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +6 -0
  63. package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +6 -0
  64. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +6 -0
  65. package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +6 -0
  66. package/templates/nest/src/simpleapp/services/autoinc.service.ts.eta +5 -6
  67. package/templates/nest/src/simpleapp/services/branch.service.ts.eta +50 -10
  68. package/templates/nest/src/simpleapp/services/docno.service.ts.eta +5 -7
  69. package/templates/nest/src/simpleapp/services/org.service.ts.eta +4 -6
  70. package/templates/nest/src/simpleapp/services/perm.service.ts.eta +6 -7
  71. package/templates/nest/src/simpleapp/services/tenant.service.ts.eta +5 -6
  72. package/templates/nest/src/simpleapp/services/user.service.ts.eta +5 -6
  73. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +6 -8
  74. package/templates/nuxt/app.vue.eta +6 -1
  75. package/templates/nuxt/assets/css/style.css._eta +12 -0
  76. package/templates/nuxt/assets/css/tailwind.css._eta +10 -0
  77. package/templates/nuxt/assets/primevue/passthrough.ts._eta +37 -0
  78. package/templates/nuxt/components/ButtonCreateTenant.vue.eta +68 -0
  79. package/templates/nuxt/components/ButtonHome.vue.eta +10 -0
  80. package/templates/nuxt/components/ButtonLogout.vue.eta +9 -0
  81. package/templates/nuxt/components/ButtonMenuPicker.vue.eta +55 -0
  82. package/templates/nuxt/components/ButtonPermissionInfo.vue.eta +113 -0
  83. package/templates/nuxt/components/ButtonProfile.vue.eta +52 -0
  84. package/templates/nuxt/components/CrudNestedDoc.vue.eta +11 -7
  85. package/templates/nuxt/components/CrudSimple.vue.eta +13 -11
  86. package/templates/nuxt/components/DebugDocumentData.vue.eta +1 -1
  87. package/templates/nuxt/components/HeaderBar.vue.eta +39 -0
  88. package/templates/nuxt/components/Invitation.vue.eta +2 -2
  89. package/templates/nuxt/components/Menus.vue.eta +7 -7
  90. package/templates/nuxt/components/SelectBranch.vue.eta +35 -0
  91. package/templates/nuxt/components/SimpleAppAutocomplete.vue.eta +1 -1
  92. package/templates/nuxt/components/SimpleAppDatatable.vue.eta +0 -1
  93. package/templates/nuxt/components/SimpleAppDocumentNo.vue.eta +1 -1
  94. package/templates/nuxt/components/SimpleAppForm.vue.eta +1 -1
  95. package/templates/nuxt/components/SimpleAppInputTable.vue.eta +2 -2
  96. package/templates/nuxt/components/SimpleFieldContainer.vue.eta +18 -12
  97. package/templates/nuxt/components/Spinner.vue.eta +9 -0
  98. package/templates/nuxt/composables/getMenus.generate.ts.eta +5 -4
  99. package/templates/nuxt/layouts/default.vue.eta +3 -12
  100. package/templates/nuxt/middleware/{10.acl.global.ts.eta → 30.acl.global.ts.eta} +6 -0
  101. package/templates/nuxt/nuxt.config.ts.eta +55 -12
  102. package/templates/nuxt/pages/[xorg]/branch/{index.vue.eta → index.vue.etax} +1 -4
  103. package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +83 -113
  104. package/templates/nuxt/pages/[xorg]/index.vue._eta +13 -0
  105. package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +89 -69
  106. package/templates/nuxt/pages/[xorg]/permission/index.vue.eta +7 -7
  107. package/templates/nuxt/pages/[xorg]/tenant/index.vue.eta +0 -4
  108. package/templates/nuxt/pages/[xorg]/user/index.vue.eta +33 -33
  109. package/templates/nuxt/pages/index.vue.eta +10 -85
  110. package/templates/nuxt/pages/login.vue.eta +9 -3
  111. package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +16 -19
  112. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +19 -3
  113. package/templates/nuxt/plugins/50.simpleapp-client.ts.eta +4 -4
  114. package/templates/nuxt/server/api/[xorg]/[...].ts.eta +4 -4
  115. package/templates/nuxt/server/api/auth/[...].ts.eta +6 -0
  116. package/templates/nuxt/server/api/auth/logout.ts.eta +6 -1
  117. package/templates/nuxt/server/api/profile/[...].ts.eta +4 -5
  118. package/templates/nuxt/server/api/profile/index.ts.eta +4 -6
  119. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +9 -2
  120. package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +12 -3
  121. package/templates/nuxt/simpleapp/generate/commons/events.ts.eta +6 -0
  122. package/templates/nuxt/simpleapp/generate/commons/groups.ts.eta +6 -0
  123. package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +6 -0
  124. package/templates/nuxt/tailwind.config.ts._eta +66 -0
  125. package/templates/nuxt/types/index.ts.eta +22 -1
  126. package/templates/project/build.sh.eta +4 -4
  127. package/templates/project/schemas/invoice.ts.eta +1 -0
  128. package/templates/project/schemas/product.ts.eta +1 -1
  129. package/tsconfig.tsbuildinfo +1 -1
  130. package/templates/nuxt/assets/css/tailwind.css.eta +0 -35
  131. package/templates/nuxt/components/PermissionInfo.vue.eta +0 -92
  132. package/templates/nuxt/components/XorgPicker.vue.eta +0 -66
  133. package/templates/nuxt/pages/[xorg]/index.vue.eta +0 -36
  134. package/templates/nuxt/tailwind.config.ts.eta +0 -9
  135. /package/templates/nest/{.env.eta → .env._eta} +0 -0
  136. /package/templates/nuxt/{.env.eta → .env._eta} +0 -0
  137. /package/templates/project/{config.json.eta → config.json._eta} +0 -0
@@ -1,5 +1,10 @@
1
1
  <script setup lang="ts">
2
-
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
+ */
3
8
  </script>
4
9
  <template>
5
10
  <div>
@@ -0,0 +1,12 @@
1
+ .btn {
2
+ @apply p-2 border-2 m-1
3
+ }
4
+ .btn-primary{
5
+ @apply bg-primary-600 text-white
6
+ }
7
+ .btn-danger{
8
+ @apply bg-danger-600 text-white
9
+ }
10
+ .btn-warning{
11
+ @apply bg-danger-600 text-white
12
+ }
@@ -0,0 +1,10 @@
1
+ /* tailwind.css */
2
+ @layer tailwind-base {
3
+ @tailwind base;
4
+ }
5
+
6
+ @layer tailwind-utilities {
7
+ @tailwind components;
8
+ @tailwind utilities;
9
+ }
10
+
@@ -0,0 +1,37 @@
1
+ import { usePassThrough } from "primevue/passthrough";
2
+ import Tailwind from "primevue/passthrough/tailwind";
3
+
4
+
5
+ const CustomTailwind = usePassThrough(
6
+ Tailwind,
7
+ {
8
+ button:{
9
+ root:{
10
+ class:['p-2 m-2 border']
11
+ }
12
+ },
13
+ dialog:{
14
+ root:{
15
+ class:['bg-white border p-2' ]
16
+ }
17
+ },
18
+ panel: {
19
+ root:{
20
+ class:['border']
21
+ },
22
+ title: {
23
+ class: ['leading-none font-light text-2xl']
24
+ },
25
+ header:{
26
+ class:['bg bg-gray-200 h-10 content-middle']
27
+ },
28
+ content:{
29
+ class:['']
30
+ }
31
+ }
32
+ },
33
+ );
34
+
35
+
36
+
37
+ export default CustomTailwind;
@@ -0,0 +1,68 @@
1
+ <template>
2
+ <div>
3
+ <Button class="btn-primary " @click="visible = true">
4
+ <i class="pi pi-sitemap mr-2"></i>Create My Company
5
+ </Button>
6
+ <Dialog
7
+ v-model:visible="visible"
8
+ modal
9
+ :header="createtitle"
10
+ class="crudsimple-dialog"
11
+ >
12
+ <form @submit.prevent="true" class="flex flex-col text-center">
13
+ <div v-if="errCreateTenant" class="text-error">
14
+ {{ errCreateTenant }}
15
+ </div>
16
+ <InputText
17
+ v-else
18
+ type="text"
19
+ autofocus="true"
20
+ v-model:model-value="data.tenantName"
21
+ placeholder="Organization Name"
22
+ />
23
+
24
+ <Button class=" btn-primary" type="submit" @click="createTenant" :loading="onhold">
25
+ Create <span class="pi pi-save"></span>
26
+ </Button>
27
+ </form>
28
+ </Dialog>
29
+ </div>
30
+
31
+ </template>
32
+ <script setup lang="ts">
33
+ import {ref} from 'vue'
34
+ import {AxiosResponse} from 'axios'
35
+ const visible = ref(false);
36
+ const data = ref({tenantName: "",});
37
+
38
+ const createtitle = ref("Create My Company");
39
+ const errCreateTenant = ref();
40
+ const onhold = ref(false);
41
+
42
+ const createTenant = async () => {
43
+ onhold.value = true;
44
+ const { $axios, $listen } = useNuxtApp();
45
+
46
+ const openapi = getApi();
47
+ const apipath = `${useRuntimeConfig().public.API_URL}`;
48
+ let profileapi = new openapi.PROFILEApi(undefined, apipath, $axios);
49
+
50
+ profileapi
51
+ .createTenant(data.value)
52
+ .then((res:AxiosResponse) => {
53
+ if (res && res.status && res.status == 201) {
54
+ if (res.data && res.data["xOrg"]) {
55
+ const xorg = res.data["xOrg"];
56
+ navigateTo("/" + xorg, { external: true });
57
+ }
58
+ }
59
+ })
60
+ .catch((err) => {
61
+ errCreateTenant.value = err["message"];
62
+ console.error("errCreateTenant", err);
63
+ })
64
+ .finally(() => {
65
+ onhold.value = false;
66
+ });
67
+ };
68
+ </script>
@@ -0,0 +1,10 @@
1
+ <template>
2
+ <button class="flex flex-row">
3
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
4
+ <path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" />
5
+ </svg>
6
+
7
+ <span>{{ getUserProfile().orgName }}</span>
8
+
9
+ </button>
10
+ </template>
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <button class="flex flex-row">
3
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
4
+ <path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15M12 9l-3 3m0 0l3 3m-3-3h12.75" />
5
+ </svg>
6
+ <span>logout</span>
7
+
8
+ </button>
9
+ </template>
@@ -0,0 +1,55 @@
1
+ <script lang="ts" setup>
2
+ import Dialog from 'primevue/dialog';
3
+ import {ref} from 'vue'
4
+ import {MenuData} from '~/types'
5
+ const visible = ref(false)
6
+ const menus = getMenus();
7
+ // const emit = defineEmits(['select'])
8
+ const selectMenu = (menu:MenuData) =>{
9
+ navigateTo(menu.url)
10
+ visible.value=false
11
+ // emit('select',menu)
12
+ }
13
+ </script>
14
+ <template>
15
+ <div>
16
+
17
+ <button class="text-center border-none cursor-pointer" v-if="useRoute().params.xorg" @click="visible=true">
18
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
19
+ <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" />
20
+ </svg>
21
+ </button>
22
+
23
+ <Dialog v-model:visible="visible" modal header="Pick Document" >
24
+ <div class="desktop-shortcut-link">
25
+
26
+ <Button v-for="menu in menus[1].items" @click="selectMenu(menu)">
27
+ <div v-if="menu.isolationType == 'none'" class="adminmenu">
28
+ * {{ camelCaseToWords(menu.label) }}
29
+ </div>
30
+ <div v-else class="usermenu">{{ camelCaseToWords(menu.label) }}</div>
31
+ </Button>
32
+ </div>
33
+ </Dialog>
34
+
35
+
36
+
37
+ </div>
38
+ </template>
39
+ <style scoped>
40
+ .desktop-shortcut-link {
41
+ @apply m-2 p-2 space-x-2 rounded-sm text-center grid grid-cols-4 gap-4;
42
+ }
43
+ .desktop-shortcut-link .adminmenu {
44
+ @apply bg-red-300 p-2;
45
+ }
46
+ .desktop-shortcut-link .adminmenu:hover {
47
+ @apply bg-red-600 p-2;
48
+ }
49
+ .desktop-shortcut-link .usermenu {
50
+ @apply bg-teal-300 p-2;
51
+ }
52
+ .desktop-shortcut-link .usermenu:hover {
53
+ @apply bg-teal-600 p-2;
54
+ }
55
+ </style>
@@ -0,0 +1,113 @@
1
+ <template>
2
+
3
+ <div>
4
+ <Button
5
+ class="btn-primary pi pi-question"
6
+ @click="previewPermission"
7
+ >
8
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
9
+ <path stroke-linecap="round" stroke-linejoin="round" d="M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z" />
10
+ </svg>
11
+ </Button>
12
+ <Sidebar
13
+ v-model:visible="showpermissioninfo"
14
+ modal
15
+ :header="permissiontitle"
16
+ position="right"
17
+ >
18
+ <SelectButton v-model="selectedgroup" @change="selectGroup" :options="grouplist" option-label="label" option-value="value"></SelectButton>
19
+ <div v-if="selectedgroup">
20
+ <div v-if="useRuntimeConfig().public.DEBUGDATA" class="flex flex-row gap-2 p-2">
21
+ <div class="flex align-items-center">
22
+ <RadioButton v-model="mode" inputId="modepreview" name="pizza" value="preview" />
23
+ <label for="modepreview" class="ml-2">Preview</label>
24
+ </div>
25
+ <div class="flex align-items-center">
26
+ <RadioButton v-model="mode" inputId="modeedit" name="edit" value="edit" />
27
+ <label for="modeedit" class="ml-2">Edit</label>
28
+ </div>
29
+ <div class="flex align-items-center">
30
+ <RadioButton v-model="mode" inputId="modejson" name="json" value="json" />
31
+ <label for="modejson" class="ml-2">JSON</label>
32
+ </div>
33
+
34
+ </div>
35
+ <div v-if="mode=='json'">
36
+ <div class="flex-row">
37
+ <div><Button @click="copyText">copy</Button> </div>
38
+ <div class="text text-gray-400">{{ copied }}</div>
39
+ </div>
40
+ <pre id="permissionstr">
41
+ {{ permissions }}
42
+ </pre>
43
+ </div>
44
+ <div class="permission-block flex flex-col m mt-4" v-for="res in allresources" v-else="showjson">
45
+ <div class="m mr-3 ">{{ res }}</div>
46
+ <div class="gap-4" v-if="allactions">
47
+ <SelectButton v-if="mode=='edit'" multiple :options="allactions[res]" v-model="permissions[res]"></SelectButton>
48
+
49
+ <span v-else v-for="actionname in allactions[res]" class="m m-1">
50
+ <Chip class="bg-primary" v-if="canPerformAction(selectedgroup,res,actionname)" severity="success" :label="actionname" ></Chip>
51
+ <Chip v-else :label="actionname" ></Chip>
52
+ </span>
53
+
54
+
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </Sidebar>
59
+ </div>
60
+ </template>
61
+ <script setup lang="ts">
62
+ import _ from "lodash";
63
+ import Chip from 'primevue/chip';
64
+ import RadioButton from 'primevue/radiobutton';
65
+ import {ref} from 'vue'
66
+
67
+
68
+ const showpermissioninfo = ref(false)
69
+ const permissiontitle = "Permission Information";
70
+ const selectedgroup = ref('')
71
+ const grouplist = getAllGroups().map((item)=>{return {value:item,label:_.capitalize(item)}})
72
+ const mode = ref('preview')
73
+
74
+ const allresources = getUniqueResource()
75
+ const allactions = ref()
76
+ const permissions=ref()
77
+
78
+ const activeroles = ref()
79
+ const copied = ref('')
80
+
81
+ const previewPermission = () => {
82
+ showpermissioninfo.value = true;
83
+ };
84
+
85
+
86
+ const copyText = () => {
87
+ copied.value="copied!"
88
+ const storage = document.createElement('textarea');
89
+ storage.value = String(document.getElementById('permissionstr')?.innerHTML)
90
+ document.body.appendChild(storage);
91
+ storage.select();
92
+ storage.setSelectionRange(0, 99999);
93
+ document.execCommand('copy');
94
+ document.body.removeChild(storage);
95
+
96
+
97
+
98
+ }
99
+ const selectGroup = (selectedgroup:any) => {
100
+ const groupname = selectedgroup.value
101
+ activeroles.value= getGroupRoles(groupname)
102
+ allactions.value={}
103
+ permissions.value={}
104
+ for(let i=0; i< allresources.length; i++){
105
+ const r = allresources[i]
106
+ console.log(r)
107
+ const actions = getActionFromResource(r)
108
+ allactions.value[r]=actions
109
+ permissions.value[r]=getGroupResourcePermission(groupname,r).map(item=>item.action)
110
+ }
111
+ console.log(allactions.value,permissions.value)
112
+ }
113
+ </script>
@@ -0,0 +1,52 @@
1
+ <script setup lang="ts">
2
+ import Avatar from 'primevue/avatar';
3
+ import OverlayPanel from 'primevue/overlaypanel';
4
+ import {ref} from 'vue'
5
+
6
+ const userprofileoverlay = ref();
7
+ const toggle = (event:any) => {
8
+ userprofileoverlay.value.toggle(event);
9
+ }
10
+
11
+ </script>
12
+
13
+ <template>
14
+ <div>
15
+ <div class=" w-[120px] truncate ...">
16
+
17
+ <div class="flex flex-row-reverse cursor-pointer border-none w-full" @click="toggle">
18
+ <p>{{ getUserProfile().fullName }}</p>
19
+ <Avatar :image="getUserStore().getAvatarLink(32)" class="" size="normal" shape="circle" />
20
+ </div>
21
+
22
+ </div>
23
+ <OverlayPanel ref="userprofileoverlay">
24
+ <div class="flex flex-col">
25
+ <div class="flex flex-row">
26
+ <div class="content-center border">
27
+ <Avatar :image="getUserStore().getAvatarLink(60)" class="mr-2" size="xlarge" shape="circle" />
28
+ </div>
29
+ <div>
30
+ <div class="text text-center border">
31
+ {{getUserProfile().fullName }}
32
+ </div>
33
+ <div class="text text-center text-sm border" >
34
+ {{getUserProfile().group }}
35
+ </div>
36
+ </div>
37
+ </div>
38
+
39
+
40
+ <div class="flex flex-row gap-2 border">
41
+ <Button class="border">
42
+ <i class="pi pi-user"></i>profile
43
+ </Button>
44
+ <Button class="border" @click="logout()">
45
+ <i class="pi pi-sign-out"></i>logout
46
+ </Button>
47
+ </div>
48
+
49
+ </div>
50
+ </OverlayPanel>
51
+ </div>
52
+ </template>
@@ -69,8 +69,8 @@ const newData = () => {
69
69
  $event("newRecord")
70
70
  };
71
71
 
72
- const triggerEdit = (event: any) => {
73
- let id = event.data._id.toString()
72
+ const triggerEdit = (data: any) => {
73
+ let id = data._id.toString()
74
74
  router.push({ path: `${props.path}/${id}` })
75
75
  };
76
76
  const editRecord = (id:string) => {
@@ -133,13 +133,17 @@ onNuxtReady(()=>{
133
133
  <template>
134
134
  <div class="simpleapp-crudnesteddocument">
135
135
  <h1 v-if="systemwindows" class="error-text text-center">* It is system administration screen</h1>
136
- <button class="btn-primary" @click="newData" v-tooltip="'Add new(ctrl+enter)'" v-if="canPerform(resourcename,'create')">New</button>
136
+ <Button class="btn-primary" @click="newData" v-tooltip="'Add new(ctrl+enter)'" v-if="canPerform(resourcename,'create')">New</Button>
137
137
  <SimpleAppDatatable
138
138
  @row-dblclick="triggerEdit"
139
139
  v-model="recordlist"
140
140
  :setting="{}"
141
141
  :columns="listColumns"
142
142
  >
143
+ <Column header=" ">
144
+ <template #body="{index,data}">
145
+ <Button icon="pi pi-pencil" class="btn-primary" @click="triggerEdit(data)"></Button>
146
+ </template></Column>
143
147
  </SimpleAppDatatable>
144
148
 
145
149
 
@@ -148,10 +152,10 @@ onNuxtReady(()=>{
148
152
  <Dialog v-model:visible="visible" modal :header="popuptitle" class="crudsimple-dialog" :autoZIndex="false" :style="{zIndex:100, width: '80vw' }">
149
153
  <SimpleAppForm :document="obj" #default="o">
150
154
  <div class="simpleapp-tool-bar col-span-4 text-left gap-4" >
151
- <button class="btn-default" :disabled="disabled" @click="newData" type="button" v-if="canPerform(resourcename,'create')">New</button>
152
- <button class="btn-primary" :disabled="disabled" @click="createData" type="button" v-if="canPerform(resourcename,'update') && data.created==''">Create</button>
153
- <button class="btn-primary" :disabled="disabled" @click="updateData" type="button" v-if="canPerform(resourcename,'update') && data.created!=''">Update</button>
154
- <button class="btn-danger" :disabled="disabled" @click="deleteData($event)" type="button" v-if="canPerform(resourcename,'delete') && data.created!=''">Delete</button>
155
+ <Button class=" btn-default" :disabled="disabled" @click="newData" type="button" v-if="canPerform(resourcename,'create')">New</Button>
156
+ <Button class=" btn-primary" :disabled="disabled" @click="createData" type="button" v-if="canPerform(resourcename,'update') && data.created==''">Create</Button>
157
+ <Button class=" btn-primary" :disabled="disabled" @click="updateData" type="button" v-if="canPerform(resourcename,'update') && data.created!=''">Update</Button>
158
+ <Button class=" btn-danger" :disabled="disabled" @click="deleteData($event)" type="button" v-if="canPerform(resourcename,'delete') && data.created!=''">Delete</Button>
155
159
  <ProgressSpinner v-if="disabled==true" style="width: 2rem; height: 2rem" ></ProgressSpinner>
156
160
  <ConfirmPopup></ConfirmPopup>
157
161
 
@@ -70,8 +70,8 @@ const newData = () => {
70
70
  $event("newRecord")
71
71
  };
72
72
 
73
- const triggerEdit = (event: any) => {
74
- let id = event.data._id.toString()
73
+ const triggerEdit = (data: any) => {
74
+ let id = data._id
75
75
  router.push({ path: `${props.path}/${id}` })
76
76
  };
77
77
  const editRecord = (id:string) => {
@@ -140,15 +140,17 @@ onNuxtReady(()=>{
140
140
 
141
141
  <template>
142
142
  <div class="simpleapp-crudsimple">
143
- <h1 v-if="systemwindows" class="error-text text-center">* system administration screen</h1>
144
-
145
- <button class="btn-primary" @click="newData" v-tooltip="'Add new(ctrl+enter)'" v-if="canPerform(resourcename,'create')">New</button>
146
- <SimpleAppDatatable
147
- @row-dblclick="triggerEdit"
143
+ <h1 v-if="systemwindows" class="error-text text-center">* system administration screen</h1>
144
+ <Button class=" btn-primary" @click="newData" v-tooltip="'Add new(ctrl+enter)'" v-if="canPerform(resourcename,'create')">New</Button>
145
+ <SimpleAppDatatable
148
146
  v-model="recordlist"
149
147
  :setting="{}"
150
148
  :columns="listColumns"
151
149
  >
150
+ <Column header=" ">
151
+ <template #body="{index,data}">
152
+ <Button icon="pi pi-pencil" class="btn-primary" @click="triggerEdit(data)"></Button>
153
+ </template></Column>
152
154
  </SimpleAppDatatable>
153
155
 
154
156
  <DebugDocumentData v-model="data"/>
@@ -157,10 +159,10 @@ onNuxtReady(()=>{
157
159
  <Dialog v-model:visible="visible" modal :header="popuptitle" class="crudsimple-dialog" :autoZIndex="false" :style="{zIndex:100, width: '80vw' }">
158
160
  <SimpleAppForm :document="obj" #default="o">
159
161
  <div class="simpleapp-tool-bar col-span-4 text-left gap-4" >
160
- <button class="btn-default" :disabled="disabled" @click="newData" type="button" v-if="canPerform(resourcename,'create')">New</button>
161
- <button class="btn-primary" :disabled="disabled" @click="createData" type="button" v-if="canPerform(resourcename,'create') && data.created==''">Create</button>
162
- <button class="btn-primary" :disabled="disabled" @click="updateData" type="button" v-if="canPerform(resourcename,'update') && data.created!=''">Update</button>
163
- <button class="btn-danger" :disabled="disabled" @click="deleteData($event)" type="button" v-if="canPerform(resourcename,'delete') && data.created!=''">Delete</button>
162
+ <Button class=" btn-default" :disabled="disabled" @click="newData" type="button" v-if="canPerform(resourcename,'create')">New</Button>
163
+ <Button class=" btn-primary" :disabled="disabled" @click="createData" type="button" v-if="canPerform(resourcename,'create') && data.created==''">Create</Button>
164
+ <Button class=" btn-primary" :disabled="disabled" @click="updateData" type="button" v-if="canPerform(resourcename,'update') && data.created!=''">Update</Button>
165
+ <Button class=" btn-danger" :disabled="disabled" @click="deleteData($event)" type="button" v-if="canPerform(resourcename,'delete') && data.created!=''">Delete</Button>
164
166
  <ProgressSpinner v-if="disabled==true" style="width: 2rem; height: 2rem" ></ProgressSpinner>
165
167
  <ConfirmPopup></ConfirmPopup>
166
168
 
@@ -18,7 +18,7 @@ const label = ref(props.label??'Debug')
18
18
  </script>
19
19
  <template>
20
20
  <div class="floatright" v-if="isdebug=='1'">
21
- <button @click="visible=true">{{ label }}</button>
21
+ <Button @click="visible=true">{{ label }}</Button>
22
22
  <Dialog v-model:visible="visible" modal header="Debug data" :style="{ width: '80vw' }">
23
23
  <pre>{{ modelValue }}</pre>
24
24
  </Dialog>
@@ -0,0 +1,39 @@
1
+ <script setup lang="ts">
2
+ import ButtonMenuPicker from "./ButtonMenuPicker.vue"
3
+
4
+ import ButtonProfile from './ButtonProfile.vue';
5
+
6
+
7
+ </script>
8
+ <template>
9
+ <!-- <header> -->
10
+ <!-- <MegaMenu :model="getMenus()" orientation="horizontal" /> -->
11
+ <div class="bg-white border-b-2 border-b-gray-300 h-10 flex flex-row">
12
+
13
+
14
+ <div class="flex-1 flex flex-row gap-2 p-2">
15
+ <div class="">
16
+ <ButtonMenuPicker/>
17
+
18
+ </div>
19
+ <div class="">
20
+ <ButtonHome @click="navigateTo(`/${getUserProfile().currentxorg}`)"/>
21
+ </div>
22
+
23
+ </div>
24
+ <div class="flex-1 flex flex-row-reverse gap-2 p-2">
25
+
26
+ <div class=" text-right">
27
+ <ButtonProfile/>
28
+ </div>
29
+
30
+ <div class="">
31
+ <SelectBranch/>
32
+ </div>
33
+ </div>
34
+
35
+
36
+
37
+ </div>
38
+ <!-- </header> -->
39
+ </template>
@@ -8,8 +8,8 @@
8
8
  <div class="text text-xs text-gray-500 italic">{{ item.created }}</div>
9
9
  </div>
10
10
  <div >
11
- <button class="btn-primary" @click="approve(item._id)">Approve</button>
12
- <button class="btn-danger" @click="decline(item._id)">Decline</button>
11
+ <Button class="btn-primary" @click="approve(item._id)">Approve</Button>
12
+ <Button class="btn-danger" @click="decline(item._id)">Decline</Button>
13
13
  </div>
14
14
  </div>
15
15
  </div>
@@ -27,29 +27,29 @@ const visibletenant = ref(false)
27
27
  <MenuIndex></MenuIndex>
28
28
  </Dialog>
29
29
  <Dialog v-model:visible="visibletenant" modal header="Pick Tenant" :autoZIndex="false" :style="{zIndex:100, width: '80vw' }">
30
- <XorgPicker></XorgPicker>
30
+
31
31
  </Dialog>
32
32
 
33
33
  <div class="flex-1">
34
34
  <NuxtLink to="/" :external="true"><i class="pi pi-home m-2"></i>Home</NuxtLink>
35
35
  </div>
36
36
  <div class="flex-1 p-1">
37
- <button class="text-center border-none cursor-pointer" v-if="useRoute().params.xorg" @click="visible=true">
38
- <i class="pi pi-microsoft mr-2"></i>Menu</button>
37
+ <Button class="text-center border-none cursor-pointer" v-if="useRoute().params.xorg" @click="visible=true">
38
+ <i class="pi pi-microsoft mr-2"></i>Menu</Button>
39
39
  <span v-else></span>
40
40
  </div>
41
41
  <div class="flex-1 p-1">
42
- <button class="text-center border-none cursor-pointer" v-if="useRoute().params.xorg" @click="visibletenant=true">
42
+ <Button class="text-center border-none cursor-pointer" v-if="useRoute().params.xorg" @click="visibletenant=true">
43
43
  <i class="pi pi-globe mr-2"></i>
44
44
 
45
45
  {{ getUserProfile().branchCode }} - {{ getUserProfile().branchName }}
46
- </button>
46
+ </Button>
47
47
  <span v-else></span>
48
48
  </div>
49
49
  <div class="flex-1 text-right p-1">
50
- <button class=" cursor-pointer border-none" @click="logout()">
50
+ <Button class=" cursor-pointer border-none" @click="logout()">
51
51
  <i class="pi pi-sign-out mr-2"></i>logout {{ getUserProfile().fullName }}
52
- </button>
52
+ </Button>
53
53
  </div>
54
54
 
55
55
 
@@ -0,0 +1,35 @@
1
+ <script setup lang="ts">
2
+ import _ from 'lodash'
3
+ import {ref} from 'vue'
4
+
5
+ const selectedbranch = ref(getUserProfile().currentxorg)
6
+ type Org = {orgId:number, label:string,_id:string}
7
+ const branches = getUserProfile().branches
8
+ const orgList:Org[] = _.uniqBy(branches,'branch.orgId').map((item)=>({
9
+ _id:item['branch']['organization']['_id'],
10
+ orgId:item['branch']['orgId'],
11
+ label:item['branch']['organization']['label']}))
12
+ // console.log("orgList",orgList)
13
+ const getBranchesForOrg = (org:Org)=>{
14
+ const branchlist = branches.filter((item,index)=>{
15
+ // console.log(org['orgId'] ,'===', item['branch']['orgId'])
16
+ return org['orgId'] === item['branch']['orgId']
17
+ })
18
+
19
+ return branchlist
20
+ }
21
+ const switchXorg = ()=>{
22
+ navigateTo(`/${selectedbranch.value}`,{external:true})
23
+ }
24
+ </script>
25
+ <template>
26
+ <div>
27
+ <select v-model="selectedbranch" class=" text-right" @change="switchXorg()">
28
+ <optgroup v-for="o in orgList" :label="o.label">
29
+ <option v-for="b in getBranchesForOrg(o)" :value="b['xOrg']">{{ b['branch']['branchCode']}} </option>
30
+ </optgroup>
31
+
32
+ </select>
33
+ </div>
34
+
35
+ </template>
@@ -32,7 +32,7 @@ import AutoComplete from 'primevue/autocomplete';
32
32
  import FieldContainer from './SimpleFieldContainer.vue'
33
33
  import {prepareList} from './helper'
34
34
  import type {SimpleAppFieldSetting,ListOptionType} from './type'
35
- import { SimpleAppClient } from '../generate/docs/SimpleAppClient' //'../SimpleAppClient';
35
+ import { SimpleAppClient } from '../simpleapp/generate/clients/SimpleAppClient'
36
36
  import type { JSONSchema7 } from 'json-schema';
37
37
 
38
38
  type autocompletetype={[key:string]:any}
@@ -11,7 +11,6 @@
11
11
  <script setup lang="ts">
12
12
  import DataTable from 'primevue/datatable';
13
13
  import Column from 'primevue/column';
14
- import Button from 'primevue/button';
15
14
  import {camelCaseToWords} from './helper'
16
15
  const props = defineProps<{columns:string[]}>()
17
16
  const valueModel = defineModel<Object[]>()
@@ -10,7 +10,7 @@
10
10
  :pt="{input:{class:'text-right w-full'}}"
11
11
  />
12
12
  <span class="p-inputgroup-addon p p-0">
13
- <button class="pi pi-angle-down" type="button" @click="toggle"></button>
13
+ <Button class="pi pi-angle-down" type="button" @click="toggle"></Button>
14
14
 
15
15
  <OverlayPanel ref="op">
16
16
  <ul>