@simitgroup/simpleapp-generator 1.2.7 → 1.3.0-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 (106) hide show
  1. package/dist/buildinschemas/organization.d.ts.map +1 -1
  2. package/dist/buildinschemas/organization.js +3 -1
  3. package/dist/buildinschemas/organization.js.map +1 -1
  4. package/dist/framework.d.ts.map +1 -1
  5. package/dist/framework.js +4 -9
  6. package/dist/framework.js.map +1 -1
  7. package/dist/generate.js +14 -14
  8. package/dist/generate.js.map +1 -1
  9. package/package.json +1 -1
  10. package/src/buildinschemas/organization.ts +3 -1
  11. package/src/framework.ts +5 -9
  12. package/src/generate.ts +17 -16
  13. package/templates/basic/nest/controller.ts.eta +17 -0
  14. package/templates/basic/nest/default.ts.eta +6 -2
  15. package/templates/basic/nuxt/default.ts.eta +10 -6
  16. package/templates/basic/nuxt/pages.[id].vue.eta +9 -7
  17. package/templates/basic/nuxt/pages.form.vue.eta +16 -36
  18. package/templates/basic/nuxt/pages.landing.vue.eta +42 -35
  19. package/templates/basic/nuxt/pages.viewer.vue.eta +4 -6
  20. package/templates/nest/.env._eta +0 -1
  21. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +14 -2
  22. package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +32 -18
  23. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +76 -13
  24. package/templates/nuxt/app.vue.eta +7 -3
  25. package/templates/nuxt/assets/css/calendar.css._eta +21 -8
  26. package/templates/nuxt/assets/css/style.css._eta +17 -10
  27. package/templates/nuxt/assets/primevue/passthrough.ts._eta +44 -22
  28. package/templates/nuxt/components/button/ButtonDefault.vue._eta +1 -2
  29. package/templates/nuxt/components/button/ButtonMultiple.vue._eta +21 -0
  30. package/templates/nuxt/components/calendar/CalendarByResource.vue.eta +29 -8
  31. package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +3 -4
  32. package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +75 -65
  33. package/templates/nuxt/components/event/EventNotification.vue._eta +23 -2
  34. package/templates/nuxt/components/form/FormBranch.vue.eta +83 -0
  35. package/templates/nuxt/components/form/readme.md.eta +1 -0
  36. package/templates/nuxt/components/header/HeaderBar.vue._eta +9 -9
  37. package/templates/nuxt/components/header/HeaderBreadcrumb.vue.eta +2 -2
  38. package/templates/nuxt/components/header/button/HeaderButtonMenuPicker.vue._eta +16 -22
  39. package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +29 -46
  40. package/templates/nuxt/components/list/ListDocument.vue.eta +25 -0
  41. package/templates/nuxt/components/list/ListDocumentTable.vue.eta +77 -0
  42. package/templates/nuxt/components/list/ListView.vue.eta +129 -58
  43. package/templates/nuxt/components/mobile/MobileToolbar.vue.eta +10 -0
  44. package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +21 -0
  45. package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +20 -0
  46. package/templates/nuxt/components/page/PageDocList.vue.eta +170 -0
  47. package/templates/nuxt/components/renderer/RendererBoolean.vue.eta +8 -4
  48. package/templates/nuxt/components/renderer/RendererDate.vue.eta +4 -4
  49. package/templates/nuxt/components/renderer/RendererLink.vue.eta +12 -20
  50. package/templates/nuxt/components/renderer/RendererMoney.vue.eta +10 -2
  51. package/templates/nuxt/components/renderer/RendererViewer.vue.eta +27 -21
  52. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +202 -150
  53. package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +7 -1
  54. package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +112 -101
  55. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue.eta +183 -91
  56. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +383 -246
  57. package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +4 -3
  58. package/templates/nuxt/components/table/TableDocuments.vue.eta +3 -3
  59. package/templates/nuxt/components/text/TextDanger.vue._eta +5 -0
  60. package/templates/nuxt/components/text/TextSubtitle.vue._eta +5 -0
  61. package/templates/nuxt/components/text/TextTitle.vue._eta +5 -0
  62. package/templates/nuxt/components/user/UserProfileListItem.vue.eta +2 -2
  63. package/templates/nuxt/composables/date.generate.ts.eta +21 -0
  64. package/templates/nuxt/composables/goTo.generate.ts.eta +1 -0
  65. package/templates/nuxt/composables/stringHelper.generate.ts.eta +0 -5
  66. package/templates/nuxt/error.vue._eta +3 -3
  67. package/templates/nuxt/i18n.config.ts.eta +1 -1
  68. package/templates/nuxt/lang/en.ts.eta +16 -0
  69. package/templates/nuxt/layouts/default.vue._eta +34 -34
  70. package/templates/nuxt/layouts/loginlayout.vue._eta +3 -0
  71. package/templates/nuxt/layouts/mobile.vue._eta +52 -0
  72. package/templates/nuxt/nuxt.config.ts._eta +28 -22
  73. package/templates/nuxt/pages/[xorg]/organization/[id].vue.eta +39 -0
  74. package/templates/nuxt/pages/[xorg]/organization/new.vue.eta +30 -143
  75. package/templates/nuxt/pages/[xorg]/organization/viewer.vue.eta +3 -0
  76. package/templates/nuxt/pages/[xorg]/organization.vue.eta +81 -127
  77. package/templates/nuxt/pages/[xorg]/user/[id].vue.eta +40 -0
  78. package/templates/nuxt/pages/[xorg]/user/form.vue.eta +329 -0
  79. package/templates/nuxt/pages/[xorg]/user/index.vue.eta +37 -0
  80. package/templates/nuxt/pages/[xorg]/{organization/[id]/branches/[bid].vue → user/new.vue.eta} +10 -4
  81. package/templates/nuxt/pages/[xorg]/user/viewer.vue.eta +30 -0
  82. package/templates/nuxt/pages/[xorg]/{user.vue._eta → user.vue.eta} +88 -78
  83. package/templates/nuxt/pages/login.vue._eta +34 -0
  84. package/templates/nuxt/pages/profile.vue.eta +12 -3
  85. package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +36 -35
  86. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +6 -0
  87. package/templates/nuxt/server/api/[xorg]/[...].ts.eta +7 -40
  88. package/templates/nuxt/server/api/profile/[...].ts.eta +3 -32
  89. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +42 -3
  90. package/templates/nuxt/types/calendar.ts.eta +8 -1
  91. package/templates/nuxt/types/documentlist.ts.eta +0 -9
  92. package/templates/nuxt/types/events.ts.eta +1 -0
  93. package/templates/nuxt/types/others.ts.eta +4 -1
  94. package/templates/nuxt/types/simpleappinput.ts.eta +12 -2
  95. package/templates/nuxt/types/user.ts.eta +2 -0
  96. package/templates/project/lang/default._json +9 -1
  97. package/tsconfig.tsbuildinfo +1 -1
  98. package/templates/nuxt/components/docPage/DocPageList.vue.eta +0 -125
  99. package/templates/nuxt/lang/en.ts._eta +0 -6
  100. package/templates/nuxt/pages/[xorg]/organization/[bid].vue.eta +0 -14
  101. package/templates/nuxt/pages/[xorg]/organization/[id]/branches/new.vue +0 -149
  102. package/templates/nuxt/pages/[xorg]/organization/[id]/index.vue.eta +0 -1
  103. package/templates/nuxt/pages/[xorg]/user/[id].vue._eta +0 -6
  104. package/templates/nuxt/pages/[xorg]/user/index.vue._eta +0 -302
  105. package/templates/nuxt/pages/login.vue.eta +0 -30
  106. /package/templates/nuxt/lang/{df.ts.eta → df.ts.etaxxxx} +0 -0
@@ -2,9 +2,9 @@
2
2
  <DataTable v-bind="$attrs" stripedRows resizableColumns
3
3
  class="simpleapp-datatable p-datatable-sm" :value="modelValue">
4
4
  <template #empty> <div class="text-center">No record found.</div> </template>
5
- <template #header >
6
- <div>
7
- <Button v-if="!setting.readonly" icon="pi pi-plus" @click="addNew()" class="simpleapp-datatable-add btn-primary" type="button">Add</Button>
5
+ <template #header v-if="!setting.readonly && !readonly">
6
+ <div >
7
+ <Button icon="pi pi-plus" @click="addNew()" class="simpleapp-datatable-add btn-primary" type="button">Add</Button>
8
8
  </div>
9
9
  </template>
10
10
  <slot>
@@ -35,6 +35,7 @@ const props = defineProps<{
35
35
  // columns:InputTableColumn[],
36
36
  setting:any,
37
37
  getField:Function,
38
+ readonly?:boolean
38
39
  }>()
39
40
 
40
41
 
@@ -22,7 +22,7 @@
22
22
  </div>
23
23
  <div class="flex-1">
24
24
  <slot name="title">
25
- <h1 class="text text-2xl pt-2 text-center">{{ t(title) }}</h1>
25
+ <h1 class="text text-2xl pt-2 text-center dark:text-white">{{ t(title) }}</h1>
26
26
  </slot>
27
27
 
28
28
  </div>
@@ -95,7 +95,7 @@
95
95
  </slot>
96
96
  </Datatable>
97
97
  </template>
98
- <script setup lang="ts">
98
+ <script setup lang="ts" generic="T">
99
99
  import {CellSetting} from '~/types'
100
100
  import { FilterMatchMode } from 'primevue/api';
101
101
  import DataTable from 'primevue/datatable';
@@ -103,7 +103,7 @@ import Column from 'primevue/column';
103
103
  import renderComponent from '~/components/renderer'
104
104
  import { emit } from 'process';
105
105
  const props = defineProps<{
106
- value:any[]
106
+ value:T[]
107
107
  columns: CellSetting[]
108
108
  title:string
109
109
 
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="text-red-600 dark:text-red-500">
3
+ <slot name="default"></slot>
4
+ </div>
5
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="text-base text-gray-600 dark:text-gray-500">
3
+ <slot name="default"></slot>
4
+ </div>
5
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="text-xl text-black dark:text-white content-center">
3
+ <slot name="default"></slot>
4
+ </div>
5
+ </template>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <!-- <ul role="list" class="divide-y divide-gray-100">
3
3
  <li v-for="person in people" :key="person.email" class="flex justify-between gap-x-6 py-5"> -->
4
- <div class="flex justify-between gap-x-6 py-5 cursor-pointer">
4
+ <div class="flex justify-between gap-x-6 py-5 cursor-pointer" @click="emits('click',data)">
5
5
  <div class="flex min-w-0 gap-x-4">
6
6
  <img class="h-12 w-12 flex-none rounded-full bg-gray-50" :src="`${getAvatarLink(data.email,32)}`" alt="" />
7
7
  <div class="min-w-0 flex-auto">
@@ -38,7 +38,7 @@ import moment from 'moment'
38
38
  const props = defineProps<{
39
39
  data:any
40
40
  }>()
41
-
41
+ const emits = defineEmits(['click'])
42
42
 
43
43
 
44
44
  const datedifferent = computed(()=>{
@@ -0,0 +1,21 @@
1
+
2
+
3
+
4
+ export const setDateLocale = (localename:string) => useDayjs().locale(localename)
5
+ export const dateExists = (date:Date,listDate:Date[]) => {
6
+ const existsrecord = listDate.find(item=>{
7
+ return date.getTime()===item.getTime()
8
+ })
9
+ return existsrecord===undefined ? false :true
10
+ }
11
+ export const getDayJs = ()=>useDayjs()
12
+ export const lastDateOfMonth = (datestr:string) => useDayjs()(datestr).endOf('month').format('YYYY-MM-DD');
13
+ export const today = () => useDayjs()().format('YYYY-MM-DD')
14
+ export const dateToString = (date:Date) => useDayjs()(date).format('YYYY-MM-DD')
15
+ export const dateToDateTimeString = (date:Date)=> useDayjs()(date).format('YYYY-MM-DD HH:mm:ss')
16
+ export const toLocalDate = (date:string | Date)=> useDayjs()(date).format(getDateFormat())
17
+ export const getDateFormat = ():string=> 'DD-MM-YYYY'
18
+ export const getPrimevueCalendarDateFormat = () => {
19
+ const country = <string>getUserProfile()?.country
20
+ return 'dd/mm/yy'
21
+ }
@@ -30,3 +30,4 @@ export const getPathPara = (paraname:string,emptyvalue:string=''):string=>{
30
30
  }
31
31
  }
32
32
 
33
+ export const setCurrentUrl = (path:string)=>useRouter().push({path:path})
@@ -16,10 +16,5 @@ export const getAvatarLink = (email:string, size:number):string=>{
16
16
 
17
17
  }
18
18
 
19
- export const toLocalDate = (dateiso8601:string)=> new Date(String(dateiso8601)).toLocaleDateString()
20
19
  export const t = (txt:string,options?:any):string => !txt || txt.trim()=='' ? '' : useNuxtApp().$i18n.t(txt,options)
21
- export const today = () => moment().format('YYYY-MM-DD')
22
- export const dateToString = (date:Date) => moment(date).format('YYYY-MM-DD')
23
- export const getMoment = (startTime:string)=> moment(startTime)
24
- export const lastDateOfMonth = (datestr:string) => moment(datestr).endOf('month').format('YYYY-MM-DD');
25
20
  export const upperFirst = (str:string) => _.upperFirst(str)
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <div class="flex items-center justify-center py-12 bg bg-gray-500">
3
- <div class="bg-white border rounded-md flex items-center justify-center mx-4 md:w-2/3">
2
+ <div class="w w-full items-center justify-center py-12 bg bg-gray-500">
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
 
6
6
  <div class="flex flex-row">
7
- <div class="w w-40">
7
+ <div class="w w-full ">
8
8
  <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-13.59 -13.59 480.17 480.17" xml:space="preserve" fill="#000000" stroke="#000000" stroke-width="0.00452986"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <g> <g> <path style="fill:#010002;" d="M0,0v452.986h452.986V0H0z M403.223,24.655c8.132,0,14.668,6.558,14.668,14.625 c0,8.111-6.536,14.711-14.668,14.711c-8.089,0-14.668-6.601-14.668-14.711C388.576,31.234,395.134,24.655,403.223,24.655z M352.035,24.655c8.046,0,14.647,6.558,14.647,14.625c0,8.111-6.601,14.711-14.647,14.711c-8.132,0-14.668-6.601-14.668-14.711 C337.389,31.234,343.903,24.655,352.035,24.655z M417.955,418.624H35.053V85.701h382.903V418.624z"></path> <path style="fill:#010002;" d="M226.493,398.952c80.394,0,145.495-65.101,145.495-145.43s-65.101-145.495-145.495-145.495 c-80.373,0-145.516,65.165-145.516,145.495C80.977,333.873,146.12,398.952,226.493,398.952z M142.044,198.516l29.444-29.444 l55.005,55.027l54.984-55.027l29.379,29.444L255.894,253.5l54.984,54.941l-29.423,29.444l-54.962-54.962l-55.005,54.984 l-29.444-29.444l54.984-54.941L142.044,198.516z"></path> </g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> </g> </g></svg>
9
9
  </div>
10
10
  <div>
@@ -1,5 +1,5 @@
1
1
  export default defineI18nConfig(() => ({
2
2
  legacy: false,
3
- locale: 'df',
3
+ locale: 'en',
4
4
 
5
5
  }))
@@ -0,0 +1,16 @@
1
+ export default {
2
+ //auto generate from lang/default.ts
3
+ <%let langkeys = Object.keys(it.lang) %>
4
+ <% for(let l=0; l< langkeys.length; l++){ %>
5
+ <% let key = langkeys[l] %>
6
+ '<%=key%>' : '<%= it.lang[key] %>',
7
+ <%}%>
8
+
9
+
10
+ //auto generate from schema
11
+ <% for(let i=0; i< it.allfields.length; i++){ %>
12
+ <% let f = it.allfields[i] %>
13
+ '<%= f %>' : '<%= camelCaseToWords(f) %>',
14
+ <%}%>
15
+
16
+ }
@@ -1,15 +1,22 @@
1
1
  <template>
2
- <div class="h-full flex flex-row" v-if="!isMobile()">
3
- <div>
4
- <HeaderButtonMenuPicker class="p-2 text-6xl cursor-pointer"></HeaderButtonMenuPicker>
5
- <div class="" v-for="item in menus">
6
- <div class="border">
7
- <NuxtLink
8
- :class="`pi ${item.iconClass} p-2 text-6xl cursor-pointer`"
9
- :to="getDocumentUrl(item.path)"
10
- ></NuxtLink>
2
+ <div class="h-full flex flex-row">
3
+ <div class="flex flex-col h-screen ">
4
+ <div class="flex-1">
5
+ <div class="" v-for="item in menus">
6
+ <div class="">
7
+ <NuxtLink v-if="item.path !==undefined"
8
+ :class="`pi ${item.iconClass} p-2 text-6xl cursor-pointer`"
9
+ :to="getDocumentUrl(item.path)"
10
+ ></NuxtLink>
11
+ <div v-else-if="item.command" :class="`pi ${item.iconClass} p-2 text-6xl cursor-pointer`" @click="item.command">
12
+ </div>
13
+ </div>
11
14
  </div>
12
- </div>
15
+ </div>
16
+ <div class="p-2 text-6xl cursor-pointer pi pi-user dark:text-white" @click="openProfile">
17
+ <HeaderButtonProfile v-model="showProfile"/>
18
+ </div>
19
+
13
20
  </div>
14
21
  <div class="flex-1">
15
22
  <HeaderBar />
@@ -17,33 +24,26 @@
17
24
  <slot></slot>
18
25
  </div>
19
26
  </div>
20
- <div v-else class="mb-20">
21
- <div v-if="getCurrentXorg()" class="border flex flex-row h-20 fixed left-0 w-full justify justify-between bottom-0 z-50 bg-white dark:bg-gray-800" >
22
-
23
- <div v-for="item in menus">
24
- <NuxtLink
25
- :class="`pi ${item.iconClass} p-2 text-6xl cursor-pointer`"
26
- :to="getDocumentUrl(item.path)"
27
- ></NuxtLink>
28
- </div>
29
- <HeaderButtonMenuPicker class="p-2 text-6xl cursor-pointer"></HeaderButtonMenuPicker>
30
- </div>
31
- <div class="flex flex-col h-screen ">
32
-
33
- <HeaderBar />
34
- <UserInvitation/>
35
- <slot></slot>
36
-
37
- </div>
27
+ <div >
28
+ <HeaderButtonMenuPicker v-model="showMenu"></HeaderButtonMenuPicker>
38
29
  </div>
30
+
39
31
  </template>
40
32
  <script setup lang="ts">
41
- const menus=[
42
- // {iconClass:'pi-bars',path:'managestudents/profile'},
43
- {iconClass:'pi-home',path:''},
44
- {iconClass:'pi-users',path:'managestudents/profile'},
45
- {iconClass:'pi-calendar',path:`manageclasses`},
33
+ const showMenu =ref(false)
34
+ const showProfile =ref(false)
35
+
36
+ const openMenu = ()=>showMenu.value=true
37
+ const openProfile = ()=>showProfile.value=true
38
+
39
+ const menus=[
40
+ {iconClass:'pi-home dark:text-white',path:''},
41
+ //{iconClass:'pi-users dark:text-white',path:'managestudents/new'},
42
+ //{iconClass:'pi-calendar dark:text-white',path:`manageclasses`},
46
43
  // {iconClass:'pi-database',path:'managedata'},
47
- {iconClass:'pi-chart-pie',path:'reports'},
44
+ {iconClass:'pi-chart-pie dark:text-white',path:'reports'},
45
+ {iconClass:'pi-bars dark:text-white',command: openMenu},
46
+
47
+
48
48
  ]
49
49
  </script>
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <slot v-if="useRoute().path=='/login'"></slot>
3
+ </template>
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <div class="h-screen flex flex-col">
3
+
4
+ <div class="flex flex-col grow overflow-y-auto">
5
+ <div class="flex flex-row mb-36 w-full">
6
+ <slot></slot>
7
+ </div>
8
+
9
+
10
+ </div>
11
+ <!-- fixed -->
12
+ <div v-if="getCurrentXorg()" class="flex h-16 border-t-2 dark:border-t-gray-700 text-3xl flex-row left-0 w-full justify justify-between bottom-0 fixed z-50 bg-white dark:bg-slate-800 opacity opacity-95 " >
13
+ <div v-for="item in menus">
14
+ <NuxtLink v-if="item.path !== undefined"
15
+ :class="`pi ${item.iconClass} p-4 cursor-pointer inline-block align-middle`"
16
+ :to="getDocumentUrl(item.path)"
17
+ >
18
+
19
+ </NuxtLink>
20
+ <div v-else-if="item.command" :class="`pi ${item.iconClass} p-4 cursor-pointer inline-block align-middle`" @click="item.command">
21
+ </div>
22
+ </div>
23
+
24
+ <HeaderButtonMenuPicker v-model="showMenu"></HeaderButtonMenuPicker>
25
+ <HeaderButtonProfile v-model="showProfile"/>
26
+ <UserInvitation/>
27
+ </div>
28
+
29
+ <!-- <HeaderBar class="border flex flex-row h-10 fixed left-0 w-full justify justify-between top-0 z-50 bg-white dark:bg-gray-800"/> -->
30
+
31
+ </div>
32
+ </template>
33
+ <script setup lang="ts">
34
+ const showMenu =ref(false)
35
+ const showProfile =ref(false)
36
+
37
+ const openMenu = ()=>showMenu.value=true
38
+ const openProfile = ()=>showProfile.value=true
39
+ const menus=[
40
+ // {iconClass:'pi-bars',path:'managestudents/profile'},
41
+ {iconClass:'pi-home dark:text-white',path:''},
42
+ //{iconClass:'pi-users dark:text-white',path:'managestudents'},
43
+ //{iconClass:'pi-calendar dark:text-white',path:`manageclasses`},
44
+ {iconClass:'pi-chart-pie dark:text-white',path:'reports'},
45
+ {iconClass:'pi-bars dark:text-white',command: openMenu},
46
+ {iconClass:'pi-user dark:text-white',command: openProfile},
47
+ // {iconClass:'pi-database',path:'managedata'},
48
+
49
+ ]
50
+
51
+
52
+ </script>
@@ -6,7 +6,11 @@
6
6
  */
7
7
  import path from 'path'
8
8
  export default defineNuxtConfig({
9
- // colorMode: {} ,
9
+ colorMode: {
10
+ classSuffix: ''
11
+
12
+ },
13
+
10
14
  runtimeConfig:{
11
15
  public:{
12
16
  APP_URL: process.env.APP_URL,
@@ -26,16 +30,20 @@ export default defineNuxtConfig({
26
30
  tailwindcss: {
27
31
  // Options
28
32
  },
29
- devServer: {
30
- // host: "0.0.0.0",
31
- },
33
+ devServer: {
34
+ host: "0.0.0.0",
35
+ },
32
36
  modules: [
33
37
  // "@hebilicious/authjs-nuxt",
38
+ '@nuxtjs/color-mode',
39
+ '@nuxtjs/device',
34
40
  '@nuxtjs/i18n',
41
+ 'dayjs-nuxt',
35
42
  '@sidebase/nuxt-auth',
36
43
  'nuxt-primevue',
44
+ // '@nuxtjs/pwa', //cannot turn on, will cause nuxt cant start
37
45
  // "nuxt-security", //temporary avoid nuxt-security cause cors
38
- '@vueuse/nuxt',
46
+ '@vueuse/nuxt',
39
47
  '@nuxtjs/tailwindcss',
40
48
  ['@pinia/nuxt',{
41
49
  autoImports: [
@@ -44,21 +52,19 @@ tailwindcss: {
44
52
  ['defineStore', 'definePiniaStore'], // import { defineStore as definePiniaStore } from 'pinia'
45
53
  ],
46
54
  }],
47
- '@nuxtjs/color-mode',
55
+
48
56
 
49
57
 
50
- ],
58
+ ],
59
+ device: {
60
+ refreshOnResize: true
61
+ },
51
62
  i18n: {
52
63
  lazy: true,
53
64
  langDir: "lang/",
54
65
  strategy: "no_prefix",
55
66
  locales: [
56
- {
57
- code: "df",
58
- iso: "df",
59
- name: "Default",
60
- file: "df.ts",
61
- },
67
+
62
68
  {
63
69
  code: "en",
64
70
  iso: "en",
@@ -70,13 +76,14 @@ tailwindcss: {
70
76
  iso: "cn",
71
77
  name: "Chinese",
72
78
  file: "cn.ts",
79
+
73
80
  },
74
81
  ],
75
- defaultLocale: "df",
82
+ defaultLocale: "en",
76
83
  },
77
84
  primevue: {
78
85
  options: {
79
- unstyled: true,
86
+ //unstyled: true,
80
87
  ripple: true,
81
88
  inputStyle: 'filled'
82
89
  },
@@ -85,7 +92,7 @@ tailwindcss: {
85
92
  exclude: ['chart']
86
93
  },
87
94
  directives: {
88
- include: ['Ripple', 'Tooltip','BadgeDirective']
95
+ include: ['Ripple', 'Tooltip','BadgeDirective','FocusTrap']
89
96
  },
90
97
  cssLayerOrder: 'tailwind-base, primevue, tailwind-utilities',
91
98
  importPT: { as: 'SimpleAppPT', from: path.resolve(__dirname,'./assets/primevue/passthrough.ts') },
@@ -96,7 +103,7 @@ tailwindcss: {
96
103
 
97
104
  // },
98
105
  auth: {
99
- globalAppMiddleware: true
106
+ globalAppMiddleware: false
100
107
  },
101
108
  // security: {
102
109
  // corsHandler:{
@@ -127,13 +134,12 @@ tailwindcss: {
127
134
  'primeicons/primeicons.css',
128
135
  path.resolve(__dirname,'./assets/css/style.css'),
129
136
  path.resolve(__dirname,'./assets/css/calendar.css'),
130
- ],
137
+ ],
138
+ },
131
139
 
132
140
  // devtools: { enabled: true },
133
141
  // build: {
134
142
  // // transpile: ["primevue"]
135
- // },
136
-
137
-
143
+ // },
138
144
 
139
- })
145
+ )
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <LazyFormBranch :_id="_id" @after="after" />
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ /**
7
+ * This file was automatically generated by simpleapp generator.
8
+ * last change 2023-09-09
9
+ * author: Ks Tan
10
+ */
11
+
12
+ import { Branch } from "~/simpleapp/generate/types";
13
+ const doc = useNuxtApp().$BranchDoc();
14
+
15
+ const props = defineProps<{ _id: string }>();
16
+ const after = (actionName: string, data: Branch) => {
17
+ console.log("Branch capture after emits ", actionName,doc.getDocName().toLowerCase());
18
+ switch (actionName) {
19
+ case "new":
20
+ goTo('organization');
21
+ break;
22
+ case "create":
23
+ goTo('organization');
24
+ refreshDocumentList('branch');
25
+ useNuxtApp().$event("CloseDialog", doc.getDocName().toLowerCase());
26
+ break;
27
+ case "update":
28
+ goTo('organization');
29
+ refreshDocumentList('branch');
30
+ useNuxtApp().$event("CloseDialog", doc.getDocName().toLowerCase());
31
+ break;
32
+ case "delete":
33
+ goTo('organization');
34
+ refreshDocumentList('branch');
35
+ useNuxtApp().$event("CloseDialog", doc.getDocName().toLowerCase());
36
+ break;
37
+ }
38
+ };
39
+ </script>
@@ -1,151 +1,38 @@
1
+ <template>
2
+ <LazyFormBranch _id="new" @after="after" />
3
+ </template>
4
+
1
5
  <script setup lang="ts">
2
6
  /**
3
- * This file was automatically generated by simpleapp everytime regenerate code.
4
- * delete file "delete-me-for-avoid-override" if you want to modify this file and
5
- * prevent regenerate code override it.
7
+ * This file was automatically generated by simpleapp generator.
6
8
  * last change 2023-09-09
7
9
  * author: Ks Tan
8
10
  */
9
- import { SimpleAppInputType } from "~/types";
10
- import ConfirmPopup from "primevue/confirmpopup";
11
- import { useConfirm } from "primevue/useconfirm";
12
- const confirm = useConfirm();
13
-
14
- const { $BranchDoc, $OrganizationDoc, $event } = useNuxtApp();
15
- const orgdoc = $OrganizationDoc();
16
- const doc = $BranchDoc();
17
- const data = doc.getReactiveData();
18
- const bid = ref(String(useRoute().params.bid ?? ""));
19
- const isReadOnly = ref(true);
20
- const fetchRecord = async (id: string) => {
21
- await doc.getById(id);
22
- };
23
-
24
- const disabled = computed(() => {
25
- return false;
26
- });
27
-
28
- const createData = async () => {
29
- doc
30
- .create()
31
- .then((res) => {
32
- refresh();
33
- goBranch(res.data._id);
34
- })
35
- .catch((err) => {
36
- console.error(err);
37
- });
38
- };
39
- const updateData = async () => {
40
- doc
41
- .update()
42
- .then(() => {
43
- // visible.value=false
44
- refresh();
45
- })
46
- .catch((err) => {
47
- console.error(err);
48
- });
49
- };
50
- const deleteData = (event: Event) => {
51
- confirm.require({
52
- target: event.currentTarget as HTMLElement,
53
- message: "Delete?",
54
- icon: "pi pi-exclamation-triangle",
55
- acceptClass: "p-button-danger",
56
- accept: () => {
57
- // disabled.value=true
58
- doc.delete(data.value._id ?? "").then((res) => {
59
- refresh();
60
-
61
- goTo(doc.getDocName());
62
- });
63
- },
64
- reject: () => {
65
- console.log("Cancel delete");
66
- },
67
- });
68
- };
69
11
 
70
- const refresh = () => {
71
- $event("RefreshDocumentList", { documentName: doc.getDocName() });
72
- isReadOnly.value = true;
12
+ import { Branch } from "~/simpleapp/generate/types";
13
+ const doc = useNuxtApp().$BranchDoc();
14
+
15
+
16
+ const after = (actionName: string, data: Branch) => {
17
+ console.log("Branch capture after emits ", actionName,'branch');
18
+ switch (actionName) {
19
+ case "create":
20
+ goTo('organization');
21
+ refreshDocumentList('branch');
22
+ useNuxtApp().$event("CloseDialog", 'branch');
23
+ break;
24
+ case "update":
25
+ goTo('organization');
26
+ refreshDocumentList('branch');
27
+ useNuxtApp().$event("CloseDialog", 'branch');
28
+
29
+
30
+ break;
31
+ case "delete":
32
+ goTo('organization');
33
+ refreshDocumentList('branch');
34
+ useNuxtApp().$event("CloseDialog", 'branch');
35
+ break;
36
+ }
73
37
  };
74
-
75
- if (bid.value) {
76
- fetchRecord(bid.value);
77
- } else {
78
- // const orgRecordid = ref(String(useRoute().params.id));
79
- // const orgdata = (await orgdoc.getById(orgRecordid.value)).data;
80
- doc.setNew();
81
- isReadOnly.value = false;
82
- data.value.tenantId = getUserProfile().tenantId;
83
- data.value.orgId = getUserProfile().orgId;
84
- data.value.organization._id = getUserProfile().orgRecordId;
85
- data.value.organization.label = getUserProfile().orgName;
86
- data.value.organization.orgId = getUserProfile().orgId;
87
- data.value.organization.code = getUserProfile().orgCode;
88
- }
89
38
  </script>
90
- <template>
91
- <div class="grid grid-cols2">
92
- <SimpleAppForm :document="doc" #default="o" :readonly="isReadOnly">
93
- <div v-if="!isReadOnly" class="col-span-4 text-left gap-4">
94
- <Button
95
- class="btn btn-primary"
96
- :isReadOnly="isReadOnly"
97
- @click="createData"
98
- type="button"
99
- v-if="canPerform(doc.getDocName(), 'create') && doc.isNew()"
100
- >Create</Button
101
- >
102
- <Button
103
- class="btn btn-primary"
104
- @click="updateData"
105
- type="button"
106
- v-if="canPerform(doc.getDocName(), 'update') && !doc.isNew()"
107
- >Update</Button
108
- >
109
- <Button
110
- class="btn btn-danger"
111
- @click="deleteData($event)"
112
- type="button"
113
- v-if="canPerform(doc.getDocName(), 'delete') && !doc.isNew()"
114
- >Delete</Button
115
- >
116
-
117
- <ConfirmPopup></ConfirmPopup>
118
- </div>
119
- <div v-else class="col-span-4 text-left gap-4">
120
- <Button
121
- class="btn btn-primary"
122
- @click="isReadOnly = false"
123
- type="button"
124
- >Edit</Button
125
- >
126
- </div>
127
-
128
- <SimpleAppInput
129
- :input-type="SimpleAppInputType.text"
130
- v-model="data.branchCode"
131
- :setting="o.getField('#/properties/branchCode')"
132
- />
133
- <SimpleAppInput
134
- :input-type="SimpleAppInputType.text"
135
- v-model="data.branchName"
136
- :setting="o.getField('#/properties/branchName')"
137
- />
138
- <SimpleAppInput
139
- :input-type="SimpleAppInputType.checkbox"
140
- v-model="data.active"
141
- :setting="o.getField('#/properties/active')"
142
- />
143
- <SimpleAppInput
144
- :input-type="SimpleAppInputType.textarea"
145
- v-model="data.description"
146
- :setting="o.getField('#/properties/description')"
147
- />
148
- </SimpleAppForm>
149
- <DebugDocumentData v-model="data" label="branch" />
150
- </div>
151
- </template>
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <div>no org viewer</div>
3
+ </template>