@simitgroup/simpleapp-generator 1.1.0 → 1.1.2

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 (70) hide show
  1. package/dist/framework.js +2 -2
  2. package/dist/framework.js.map +1 -1
  3. package/dist/generate.d.ts.map +1 -1
  4. package/dist/generate.js +15 -44
  5. package/dist/generate.js.map +1 -1
  6. package/dist/processors/jsonschemabuilder.js +9 -0
  7. package/dist/processors/jsonschemabuilder.js.map +1 -1
  8. package/dist/storage.d.ts +1 -0
  9. package/dist/storage.d.ts.map +1 -1
  10. package/dist/storage.js +2 -1
  11. package/dist/storage.js.map +1 -1
  12. package/package.json +1 -1
  13. package/src/framework.ts +2 -2
  14. package/src/generate.ts +22 -49
  15. package/src/processors/jsonschemabuilder.ts +12 -2
  16. package/src/storage.ts +2 -1
  17. package/templates/basic/nuxt/pages.landing.vue.eta +20 -27
  18. package/templates/basic/nuxt/pages.new.vue.eta +8 -7
  19. package/templates/basic/nuxt/pages.viewer.vue.eta +13 -0
  20. package/templates/nest/src/simpleapp/services/docno.service.ts.eta +1 -1
  21. package/templates/nuxt/app.vue.eta +5 -1
  22. package/templates/nuxt/assets/css/style.css._eta +33 -15
  23. package/templates/nuxt/assets/primevue/passthrough.ts._eta +14 -7
  24. package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +23 -22
  25. package/templates/nuxt/components/docPage/DocPageList.vue.eta +112 -0
  26. package/templates/nuxt/components/event/EventDocumentViewer.vue.eta +69 -0
  27. package/templates/nuxt/components/header/HeaderBar.vue.eta +12 -10
  28. package/templates/nuxt/components/header/HeaderBreadcrumb.vue.eta +76 -0
  29. package/templates/nuxt/components/header/button/HeaderButtonMenuPicker.vue.eta +5 -7
  30. package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +39 -8
  31. package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +22 -3
  32. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +82 -0
  33. package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +8 -8
  34. package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +21 -7
  35. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +24 -63
  36. package/templates/nuxt/components/table/TableDocuments.vue.eta +12 -6
  37. package/templates/nuxt/components/user/UserButtonCreateTenant.vue.eta +25 -3
  38. package/templates/nuxt/components/user/UserProfileListItem.vue.eta +41 -41
  39. package/templates/nuxt/components/user/UserTenantPicker.vue.eta +26 -14
  40. package/templates/nuxt/composables/getDocument.generate.ts.eta +1 -1
  41. package/templates/nuxt/composables/getUserStore.generate.ts.eta +4 -1
  42. package/templates/nuxt/composables/stringHelper.generate.ts.eta +5 -1
  43. package/templates/nuxt/composables/themes.generate.ts.eta +1 -0
  44. package/templates/nuxt/i18n.config.ts.eta +5 -0
  45. package/templates/nuxt/lang/cn.ts._eta +9 -0
  46. package/templates/nuxt/lang/df.ts.eta +18 -0
  47. package/templates/nuxt/lang/en.ts._eta +6 -0
  48. package/templates/nuxt/layouts/{documentlist.vue.eta → documentlist.vue.eta.disabled} +1 -1
  49. package/templates/nuxt/nuxt.config.ts.eta +49 -16
  50. package/templates/nuxt/pages/[xorg]/docnoformat.vue.eta +11 -81
  51. package/templates/nuxt/pages/[xorg]/organization/[id]/branches/new.vue +1 -1
  52. package/templates/nuxt/pages/[xorg]/organization.vue.eta +10 -0
  53. package/templates/nuxt/pages/[xorg]/profile.vue.eta +3 -0
  54. package/templates/nuxt/pages/[xorg]/user.vue.eta +5 -0
  55. package/templates/nuxt/pages/index.vue._eta +19 -56
  56. package/templates/nuxt/pages/profile.vue.eta +12 -12
  57. package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +7 -0
  58. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +1 -1
  59. package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +4 -1
  60. package/templates/nuxt/tailwind.config.ts._eta +18 -17
  61. package/templates/nuxt/types/events.ts.eta +11 -0
  62. package/templates/nuxt/types/others.ts.eta +4 -1
  63. package/templates/project/jsonschemas/category.json._eta +3 -3
  64. package/templates/project/jsonschemas/customer.json._eta +15 -2
  65. package/templates/project/jsonschemas/invoice.json._eta +5 -4
  66. package/templates/project/jsonschemas/product.json._eta +3 -3
  67. package/templates/project/sharelibs/money.ts.eta +2 -3
  68. package/tsconfig.tsbuildinfo +1 -1
  69. /package/templates/nuxt/layouts/{sidelist.vue.eta → sidelist.vue.eta.disabled} +0 -0
  70. /package/templates/nuxt/layouts/{sidelistcrud.vue.eta → sidelistcrud.vue.eta.disabled} +0 -0
@@ -16,6 +16,7 @@
16
16
  import ConfirmPopup from 'primevue/confirmpopup';
17
17
  import { useConfirm } from "primevue/useconfirm";
18
18
  const confirm = useConfirm();
19
+ const props = defineProps<{_id?:string}>()
19
20
  const isReadOnly =ref(true)
20
21
  const {$<%= it.typename %>Doc,$event } = useNuxtApp();
21
22
  const doc = $<%= it.typename %>Doc()
@@ -25,7 +26,7 @@ const fetchRecord = async (recordid:string) =>{
25
26
  await doc.getById(recordid)
26
27
  }
27
28
 
28
- const id = computed(()=>String(useRoute().params.id??''))
29
+ const id = computed(() => props._id ? props._id : String(useRoute().params.id ?? ""));
29
30
 
30
31
 
31
32
  const disabled = computed(()=>{
@@ -91,15 +92,15 @@ if (id.value) {
91
92
  <SimpleAppForm #default="o" :document="doc" :readonly="isReadOnly">
92
93
  <div v-if="isReadOnly" class="w-full">
93
94
  <Button
94
- class="btn btn-primary" @click="isReadOnly=false"
95
+ class="btn-primary" @click="isReadOnly=false"
95
96
  type="button" >Edit</Button>
96
97
  <Button class="" :disabled="disabled" @click="newData" type="button" v-if="canPerform(doc.getDocName(),'create')">New</Button>
97
98
  </div>
98
99
  <div v-else class="simpleapp-tool-bar col-span-4 text-left gap-4" >
99
100
  <Button class="" :disabled="disabled" @click="newData" type="button" v-if="canPerform(doc.getDocName(),'create')">New</Button>
100
- <Button class="btn btn-primary" :disabled="disabled" @click="createData" type="button" v-if="canPerform(doc.getDocName(),'create') && doc.isNew()">Create</Button>
101
- <Button class="btn btn-primary" :disabled="disabled" @click="updateData" type="button" v-if="canPerform(doc.getDocName(),'update') && !doc.isNew()">Update</Button>
102
- <Button class="btn btn-danger" :disabled="disabled" @click="deleteData($event)" type="button" v-if="canPerform(doc.getDocName(),'delete') && !doc.isNew()">Delete</Button>
101
+ <Button class="btn-primary" :disabled="disabled" @click="createData" type="button" v-if="canPerform(doc.getDocName(),'create') && doc.isNew()">Create</Button>
102
+ <Button class="btn-primary" :disabled="disabled" @click="updateData" type="button" v-if="canPerform(doc.getDocName(),'update') && !doc.isNew()">Update</Button>
103
+ <Button class="btn-danger" :disabled="disabled" @click="deleteData($event)" type="button" v-if="canPerform(doc.getDocName(),'delete') && !doc.isNew()">Delete</Button>
103
104
 
104
105
 
105
106
  <ProgressSpinner v-if="disabled==true" style="width: 2rem; height: 2rem" ></ProgressSpinner>
@@ -141,7 +142,7 @@ if (id.value) {
141
142
  <% } else if(obj['oneOf']){ %>
142
143
  <% for(let f = 0; f < obj['oneOf'].length; f++){ %>
143
144
  <%if(obj['oneOf'][f]['format']){ %>
144
- <%~ getBasicElement('text',`#/properties/${key}`,`data.${key}`,obj['anyOf'][f]['format']) %>
145
+ <%~ getBasicElement('text',`#/properties/${key}`,`data.${key}`,obj['oneOf'][f]['format']) %>
145
146
  <%}%>
146
147
  <%}%>
147
148
 
@@ -218,5 +219,5 @@ if (id.value) {
218
219
  <%})%>
219
220
  </div>
220
221
  </SimpleAppForm>
221
- <DebugDocumentData v-model="data"/>
222
+ <DebugDocumentData v-model="data" :label="doc.getDocName()"/>
222
223
  </template>
@@ -0,0 +1,13 @@
1
+ <script setup lang="ts">
2
+ /**
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.
6
+ * last change 2023-09-09
7
+ * author: Ks Tan
8
+ */
9
+ import Crud from './new.vue'
10
+ </script>
11
+ <template>
12
+ <Crud/>
13
+ </template>
@@ -67,7 +67,7 @@ export class DocnoformatService extends DocnoformatProcessor {
67
67
  doctype = doctype.toUpperCase();
68
68
  const searchresult = await this.search(
69
69
  appuser,
70
- { docNoType:doctype},
70
+ { docNoType: doctype,'branch.branchId':appuser.getBranchId() },
71
71
  undefined,
72
72
  {default:'desc'}
73
73
  );
@@ -2,13 +2,17 @@
2
2
  /**
3
3
  * This file was automatically generated by simpleapp generator. Every
4
4
  * MODIFICATION OVERRIDE BY GENERATEOR
5
- * last change 2023-10-28
5
+ * last change 2023-11-12
6
6
  * Author: Ks Tan
7
7
  */
8
+ watch(()=>useRoute().params['xorg'],(newval,oldvalue)=>{
9
+ reloadUserStore()
10
+ })
8
11
  </script>
9
12
  <template>
10
13
  <div>
11
14
  <NuxtLayout>
15
+ <EventDocumentViewer></EventDocumentViewer>
12
16
  <EventDecision/>
13
17
  <EventNotification/>
14
18
  <NuxtPage />
@@ -1,7 +1,11 @@
1
- .router-link-exact-active{
2
- @apply bg-primary-100 block
1
+
2
+ [disabled] ,[readonly]{
3
+ @apply bg-gray-300 dark:bg-gray-900
3
4
  }
4
5
 
6
+ [aria-selected=true]{
7
+ @apply bg-primary-100
8
+ }
5
9
 
6
10
  [data-pc-group-section=pagebutton]{
7
11
  @apply p-2 m-0 rounded-none border
@@ -9,27 +13,41 @@
9
13
  [data-pc-section=pagebutton]{
10
14
  @apply p-3 m-0 border
11
15
  }
16
+
17
+
18
+ input {
19
+ @apply bg-opacity-0 bg-black
20
+ }
21
+
22
+ .route-link-list {
23
+ @apply hover:bg-secondary-200 dark:hover:bg-gray-800
24
+ }
25
+
26
+ .router-link-exact-active{
27
+ @apply bg-primary-100 dark:bg-gray-800 block
28
+ }
29
+
30
+
31
+ .title-text{
32
+ @apply text-xl font-bold text-gray-700
33
+ }
34
+ .subtitle-text{
35
+ @apply text-base text-gray-500
36
+ }
37
+
12
38
  .btn {
13
- @apply font-medium
39
+ @apply font-medium text-gray-50 dark:text-gray-300 border
14
40
  }
15
41
 
16
42
  .btn-primary {
17
- @apply bg-primary-600 hover:bg-primary-400 text-white
43
+ @apply btn bg-primary-600 hover:bg-primary-400 dark:!bg-primary-700 dark:hover:bg-primary-800
18
44
  }
19
45
  .btn-secondary {
20
- @apply bg-secondary-600 hover:bg-secondary-400 text-white
46
+ @apply btn bg-secondary-600 hover:bg-secondary-400
21
47
  }
22
48
  .btn-danger {
23
- @apply bg-danger-600 hover:bg-danger-400 text-white
49
+ @apply btn bg-danger-600 hover:bg-danger-400 dark:bg-danger-700 dark:hover:bg-danger-800
24
50
  }
25
51
  .btn-warn {
26
- @apply bg-warning-600 hover:bg-warning-400 text-white
52
+ @apply btn bg-warning-600 hover:bg-warning-400
27
53
  }
28
-
29
- [disabled] ,[readonly]{
30
- @apply bg-gray-300
31
- }
32
-
33
- [aria-selected=true]{
34
- @apply bg-primary-100
35
- }
@@ -13,22 +13,29 @@ const CustomTailwind = usePassThrough(
13
13
  content:{class:'flex flex-row-reverse w-full'},
14
14
  buttonContainer:{class:'hidden'},
15
15
  },
16
- card:{root:{class:'shadow p-4'}},
17
- tabpanel:{headerTitle:{class:'m-3 p-3 bg bg-text-300'},},
16
+ card:{
17
+ root:{class:'shadow p-4 rounded-2xl m-2'},
18
+ // title:{class:''},
19
+ // header:{class:''}
20
+ },
21
+ tabpanel:{
22
+ headerTitle:{class:'m-0 p-0'},
23
+ },
18
24
  selectbutton:{
19
25
  root:{class:'flex flex-row gap-1'},
20
26
  button: ({ context }) => ({
21
- class: ['text-center border rounded p-2 cursor-pointer hover:bg-primary-400 hover:text-white', context.active ? 'bg-primary-600 text-white' : '']
27
+ class: ['text-center border-gray-400 dark:border-gray-700 text-gray-50 dark:text-gray-300 rounded-lg p-2 cursor-pointer hover:bg-primary-400 dark:hover:bg-primary-800 hover:text-white', context.active ? 'bg-primary-600 dark:bg-primary-700 text-white' : '']
22
28
  }),
23
29
  label:{class: 'text-sm'},
24
30
  },
25
- button:{root:{class: 'focus:outline-none transition duration-150 ease-in-out rounded px-8 py-2 m-1 border'}},
31
+ button:{root:{class: 'focus:outline-none transition duration-150 ease-in-out rounded p-2 m-1 border dark:border-gray-600'}},
26
32
  dialog:{root:{class:['border p-2']}},
27
33
  autocomplete:{
28
- input:{class:'m-0 font-sans text-gray-600 dark:text-white/80 bg-white dark:bg-gray-900 border border-gray-300 dark:border-blue-900/40 rounded-lg rounded-tr-none rounded-br-none transition-colors duration-200 appearance-none hover:border-blue-500 focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)] p-3 text-base flex-1'},
29
- loadingIcon:{class:'animate-spin mt-4 -ml-6 mr-2'},
34
+ root:{class:'border border-gray-300 dark:!border-blue-900/40 rounded-lg flex flex-row'},
35
+ input:{class:'w-full p-2 font-sans rounded-lg rounded-tr-none rounded-br-none transition-colors duration-200 appearance-none hover:border-blue-500 focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)] text-base'},
36
+ loadingIcon:{class:'hidden'},
30
37
  dropdownbutton: {
31
- root:' bg-primary-600 hover:bg-primary-400 text-white rounded flex flex-row p-3 -ml-6 rounded-tl-none rounded-bl-none '
38
+ root:' btn-primary dark:shadow-primary-800 dark:border-primary-900 text-white rounded-lg flex flex-row p-3 rounded-tl-none rounded-bl-none '
32
39
  }
33
40
  },
34
41
  sidebar:{
@@ -1,3 +1,24 @@
1
+ <template>
2
+ <div class="p-0 top-0 absolute left-1/2 text-right bg-yellow-200" v-if="isdebug=='1'">
3
+ <Button @click="visible=true" class=" text-white bg-warning-800">
4
+ <i class="pi pi-code"></i>
5
+ {{ label }}</Button>
6
+ <Sidebar v-model:visible="visible" class="text-red-100">
7
+
8
+ <template #header >
9
+ <h1 class="text-gray-700 text-lg font-bold content-center">{{ label }} Data</h1>
10
+ </template>
11
+ <template #default>
12
+ <pre class="border rounder-lg m-0 p-0 dark:bg-gray-500">{{ modelValue }}
13
+ </pre>
14
+ </template>
15
+
16
+ </Sidebar>
17
+
18
+ </div>
19
+
20
+ </template>
21
+
1
22
  <script setup lang="ts">
2
23
  /**
3
24
  * This file was automatically generated by simpleapp generator during initialization.
@@ -14,28 +35,8 @@ import {ref} from 'vue'
14
35
  const modelValue = defineModel()
15
36
  const isdebug = ref(useRuntimeConfig().public.DEBUGDATA)
16
37
  const visible = ref(false)
17
- const props = defineProps<{label?:string}>()
18
- const label = ref(props.label??'Debug')
38
+ const props = withDefaults(defineProps<{label?:string}>(),{label:'label'})
39
+ const buttonlabel = computed(()=>props.label??'debug')
19
40
  const op = ref();
20
41
 
21
42
  </script>
22
- <template>
23
- <div class="floatright" v-if="isdebug=='1'">
24
- <Button @click="visible=true" >{{ label }}</Button>
25
- <Sidebar v-model:visible="visible">
26
- <pre class="pb-2">{{ modelValue }}</pre>
27
- </Sidebar>
28
-
29
- </div>
30
-
31
- </template>
32
- <style scoped>
33
- .floatright{
34
- position: fixed;
35
- right: 0;
36
- background-color: antiquewhite;
37
- font-size: large;
38
- top: 20;
39
- z-index: 999999;
40
- }
41
- </style>
@@ -0,0 +1,112 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * This file was automatically generated by simpleapp generator during initialization.
4
+ * DO NOT MODIFY IT BY HAND.
5
+ * last change 2023-09-09
6
+ * author: Ks Tan
7
+ */
8
+ import {ref} from 'vue'
9
+ import _ from 'lodash'
10
+ import { SimpleAppClient } from '~/simpleapp/generate/clients/SimpleAppClient' //'../SimpleAppClient';
11
+
12
+ import {SearchBody,CellSetting} from '~/types'
13
+ const props = defineProps<{
14
+ document:SimpleAppClient<any,any>
15
+ columns:CellSetting[]
16
+ sorts?: string[][]
17
+ }>()
18
+ const resourcename = ref( _.upperFirst(props.document.getDocName()))
19
+ const visible = ref(false)
20
+ const doc = props.document
21
+ const data = doc.getReactiveData()
22
+ const disabled=ref(false)
23
+ const recordlist = ref();
24
+ const router = useRouter()
25
+ const route = useRoute()
26
+ const filters = ref()
27
+ const popuptitle = ref("New "+doc.getDocName())
28
+ const systemwindows = ref(false)
29
+ const {$event,$listen} = useNuxtApp()
30
+
31
+ const refresh = () => {
32
+ const searchbody: SearchBody = {
33
+ fields: getWantedFields(props.columns),
34
+ sorts:props.sorts
35
+ }
36
+ console.log('searchbody',searchbody)
37
+ doc.search(searchbody).then((res:any) => {
38
+ console.log("refreshrefreshrefresh",recordlist.value)
39
+ recordlist.value = res;
40
+ disabled.value=false
41
+ });
42
+ };
43
+ const newData = () => {
44
+ router.push({ path: getDocumentUrl(doc.getDocName(),'new') })
45
+ doc.setNew()
46
+ visible.value=true;
47
+ };
48
+
49
+
50
+
51
+
52
+ onNuxtReady(()=>{
53
+ refresh()
54
+ })
55
+ $listen('RefreshDocumentList',(data)=>{
56
+ if(data.documentName == doc.getDocName()){
57
+ refresh()
58
+ }
59
+ })
60
+
61
+ const getWantedFields = (selectedCols:CellSetting[]) =>{
62
+ let cols:string[] = []
63
+
64
+ selectedCols.forEach((item)=>{
65
+
66
+ if(typeof item=='string'){
67
+ cols.push(item)
68
+ }else if(typeof item =='object'){
69
+ if(item.field !='*'){
70
+ cols.push(item.field)
71
+ }
72
+ if(item.moreFields && item.moreFields.length>0){
73
+ cols = cols.concat(item.moreFields)
74
+ }
75
+ }
76
+ })
77
+ return cols
78
+ }
79
+
80
+ const selectRow = (data:any) =>{
81
+ console.log("select row",data)
82
+ goTo(doc.getDocName(),data._id)
83
+ }
84
+ </script>
85
+
86
+ <template>
87
+ <div class="simpleapp-crudsimple">
88
+ <h1 v-if="systemwindows" class="error-text text-center">* system administration screen</h1>
89
+ <div class="grid grid-cols-2">
90
+ <div v-if="recordlist" class="p-4">
91
+ <TableDocuments :value="recordlist" :columns="columns" :title="t(doc.getDocName())" @select-row="selectRow">
92
+ <template #toolbar>
93
+ <div class="w-full text-left">
94
+ <Button class=" btn-primary" @click="newData" v-tooltip="'Add new(ctrl+enter)'" v-if="canPerform(resourcename,'create')">{{ t('new') }}</Button>
95
+ </div>
96
+ </template>
97
+ <template #additionaltoolbar>
98
+ <Button class="bg-secondary-600 hover:bg-secondary-400 text-white" @click="refresh()" type="button" >{{ t('refresh') }}</Button>
99
+ </template>
100
+ </TableDocuments>
101
+
102
+ </div>
103
+ <div class="p-4">
104
+ <slot>
105
+ undefine page content
106
+ </slot>
107
+ </div>
108
+ </div>
109
+
110
+ <DebugDocumentData v-model="data" :label="doc.getDocName()"/>
111
+ </div>
112
+ </template>
@@ -0,0 +1,69 @@
1
+ <template>
2
+ <Dialog v-model:visible="visible"
3
+ @update:visible="closeDialog"
4
+ :pt="{root:{class:'w-5/6 h-5/6'}}"
5
+ :modal="true"
6
+ :close-on-escape="false" >
7
+ <template #header>
8
+ <div class="flex flex-row">
9
+ <Chip v-for="(v,index) in allview" :label="v.label" @remove="deleteTab" :removable="index == allview.length-1"/>
10
+ </div>
11
+ </template>
12
+ <template #default>
13
+ <div v-for="(v,index) in allview">
14
+ <component v-if="index == allview.length-1" :is="defineAsyncComponent(v.viewer)" :_id="v._id" :readonly="v.readonly"></component>
15
+ </div>
16
+ </template>
17
+ </Dialog>
18
+ </template>
19
+ <script setup lang="ts">
20
+ import { onKeyStroke } from '@vueuse/core'
21
+
22
+ import { useDialog } from 'primevue/usedialog';
23
+ import {defineAsyncComponent} from 'vue'
24
+ import { ViewRecord } from '~/types';
25
+ // import TabView from 'primevue/tabview';
26
+ import Chip from 'primevue/chip';
27
+
28
+ const tabindex =ref(0)
29
+ const activetabindex=ref(0)
30
+ const findindex = ref(0)
31
+ const dialog = useDialog()
32
+ const {$listen,} = useNuxtApp()
33
+ const visible = ref(false)
34
+ const _id = ref('')
35
+ const ViewRecordComponent = ref()
36
+ const readonly = ref<boolean>()
37
+ const allview = ref<ViewRecord[]>([])
38
+
39
+
40
+ onKeyStroke('Escape', (e) => {
41
+ e.preventDefault()
42
+ deleteTab()
43
+ })
44
+
45
+ const deleteTab=()=>{
46
+
47
+ const index = allview.value.length- 1
48
+ allview.value.splice(index,1)
49
+
50
+ if(allview.value.length==0){
51
+ visible.value=false
52
+ return
53
+ }else{
54
+ activetabindex.value = activetabindex.value >0 ? activetabindex.value - 1 : 0
55
+ }
56
+ }
57
+ const closeDialog = ()=>{
58
+ allview.value=[]
59
+ }
60
+ $listen('ViewRecord',(setting)=>{
61
+
62
+ visible.value=true
63
+
64
+ allview.value.push(setting)
65
+ activetabindex.value = allview.value.length-1
66
+
67
+ })
68
+
69
+ </script>
@@ -8,32 +8,34 @@
8
8
  <template>
9
9
  <!-- <header> -->
10
10
  <!-- <MegaMenu :model="getMenus()" orientation="horizontal" /> -->
11
- <div class="bg-white border-b-gray-300 h-10 flex flex-row">
11
+ <client-only>
12
+ <div class="flex flex-row">
12
13
 
13
14
 
14
15
  <div class="flex-1 flex flex-row gap-2 p-2">
15
16
  <div class="">
16
- <HeaderButtonMenuPicker/>
17
-
18
- </div>
19
- <div class="">
20
- <HeaderButtonHome/>
21
- </div>
17
+ <HeaderButtonMenuPicker/>
18
+ </div>
22
19
 
20
+ <!-- <div class="">
21
+ <HeaderButtonHome/>
22
+ </div> -->
23
+ <HeaderBreadcrumb class="hidden md:block" v-if="useRoute().fullPath!='/'"></HeaderBreadcrumb>
23
24
  </div>
24
25
  <div class="flex-1 flex flex-row-reverse gap-2 p-2">
25
26
 
26
27
  <div class=" text-right">
27
- <HeaderButtonProfile/>
28
+ <HeaderButtonProfile/>
28
29
  </div>
29
30
 
30
- <div class="">
31
+ <!-- <div class="">
31
32
  <HeaderSelectBranch/>
32
- </div>
33
+ </div> -->
33
34
  </div>
34
35
 
35
36
 
36
37
 
37
38
  </div>
39
+ </client-only>
38
40
  <!-- </header> -->
39
41
  </template>
@@ -0,0 +1,76 @@
1
+ <script setup lang="ts">
2
+ import OverlayPanel from 'primevue/overlaypanel';
3
+ const op = ref()
4
+
5
+ const home = ref({
6
+ icon: 'pi pi-home',
7
+ url: '/'
8
+
9
+ });
10
+ const items = computed(()=>{
11
+ const fullpath = useRoute().fullPath
12
+ let path = fullpath
13
+ const params = useRoute().params
14
+ const name = useRoute().meta.name
15
+ const data = []
16
+ const patharr = fullpath.split('/').filter((item)=>item!='')
17
+ let pathurl = ''
18
+ for(let i=0; i< patharr.length;i++){
19
+ const p = patharr[i]
20
+ pathurl = `${pathurl}/${p}`
21
+ let pathlabel = ''
22
+ if(i==0 && params['xorg']){
23
+
24
+ pathlabel = getUserProfile().branchName
25
+ data.push ({ label: pathlabel })
26
+ }else{
27
+ pathlabel = t(p)
28
+ data.push ({ label: pathlabel , url:pathurl})
29
+ }
30
+
31
+
32
+ }
33
+ if(params['xorg']){
34
+
35
+ path = path.replace('/'+params['xorg'],'')
36
+ }
37
+
38
+ return data
39
+ })
40
+
41
+ const showSwitcher=(event:any)=>{
42
+ op.value.toggle(event)
43
+ }
44
+
45
+ const getBranches = ()=>{
46
+ const orgId = getUserProfile().orgId
47
+ const tenantId=getUserProfile().tenantId
48
+ return getUserProfile().branches.filter((item:any)=>{return item.branch.tenantId == tenantId && item.branch.orgId == orgId})
49
+ }
50
+ </script>
51
+ <template>
52
+ <Breadcrumb :home="home" :model="items" class="!p-0 border-none ">
53
+ <template #item="{ item }">
54
+ <NuxtLink :to="item.url" v-if="item.url" :active-class="'-'" :exact-active-class="'-'">
55
+ <span :class="item.icon"></span>{{ item.label }}
56
+ </NuxtLink>
57
+ <div v-else>
58
+ <span class="cursor-pointer" @click="showSwitcher">{{ item.label }}</span>
59
+ <OverlayPanel ref="op">
60
+ <div>
61
+ <ul class="flex flex-col">
62
+ <li v-for="b in getBranches()" class="p-1 route-link-list ">
63
+ <NuxtLink :to="'/'+b['xOrg']" >
64
+ {{ b['branch']['branchCode']}} - {{ b['branch']['branchName']}}
65
+ </NuxtLink>
66
+ </li>
67
+ </ul>
68
+ </div>
69
+ </OverlayPanel>
70
+ </div>
71
+
72
+ </template>
73
+ <template #separator> <span class="pi pi-chevron-right"></span></template>
74
+ </Breadcrumb>
75
+
76
+ </template>
@@ -3,18 +3,19 @@ import Dialog from 'primevue/dialog';
3
3
  import {ref} from 'vue'
4
4
  import {MenuData} from '~/types'
5
5
  const visible = ref(false)
6
- const menus = getMenus();
6
+
7
7
  // const emit = defineEmits(['select'])
8
8
  const selectMenu = (menu:MenuData) =>{
9
9
  navigateTo(menu.url)
10
10
  visible.value=false
11
+
11
12
  // emit('select',menu)
12
13
  }
13
14
  </script>
14
15
  <template>
15
16
  <div>
16
17
 
17
- <button class="text-center border-none cursor-pointer" v-if="useRoute().params.xorg" @click="visible=true">
18
+ <button class="text-center border-none cursor-pointer" v-if="getCurrentXorg()" @click="visible=true">
18
19
  <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
20
  <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" />
20
21
  </svg>
@@ -22,17 +23,14 @@ const selectMenu = (menu:MenuData) =>{
22
23
 
23
24
  <Dialog v-model:visible="visible" modal header="Pick Document" :pt="{dialog:{ class:' bg-primary-800 ' }}">
24
25
  <div class="">
25
- <Button v-for="menu in menus" @click="selectMenu(menu)" >
26
+ <Button v-for="menu in getMenus()" @click="selectMenu(menu)" >
26
27
  <div v-if="menu.isolationType == 'none'" class="text-warning-600 hover:text-warning-500">
27
28
  * {{ camelCaseToWords(menu.label) }}
28
29
  </div>
29
30
  <div v-else class="">{{ camelCaseToWords(menu.label) }}</div>
30
31
  </Button>
31
32
  </div>
32
- </Dialog>
33
-
34
-
35
-
33
+ </Dialog>
36
34
  </div>
37
35
  </template>
38
36
  <style scoped>