@simitgroup/simpleapp-generator 1.3.4-alpha → 1.3.5-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simitgroup/simpleapp-generator",
3
- "version": "1.3.4-alpha",
3
+ "version": "1.3.5-alpha",
4
4
  "description": "frontend nuxtjs and backend nests code generator using jsonschema",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -165,7 +165,7 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
165
165
  <%}%>
166
166
  async <%=capitalizeFirstLetter(api.action) %>(
167
167
  @AppUser() appuser: UserContext,
168
- <%if(['post','put','patch'].includes(api.method.toLowerCase())){%>
168
+ <%if(['post','put','patch'].includes(api.method.toLowerCase())){%>
169
169
  @Body() data:<%= api.schema
170
170
  ? (api.schema.includes('[') ? 'types.'+api.schema.replace('[','').replace(']','') + '[]' : 'types.'+api.schema )
171
171
  : 'Object'%>,
@@ -41,4 +41,9 @@ lerna-debug.log*
41
41
  !.vscode/settings.json
42
42
  !.vscode/tasks.json
43
43
  !.vscode/launch.json
44
- !.vscode/extensions.json
44
+ !.vscode/extensions.json
45
+
46
+
47
+
48
+ # system file
49
+ .env
@@ -13,16 +13,16 @@
13
13
  @apply bg-gray-300 dark:bg-gray-600
14
14
  }
15
15
 
16
- [aria-selected=true]{
16
+ /* [aria-selected=true]{
17
17
  @apply bg-primary-100
18
- }
19
-
18
+ } */
19
+ /*
20
20
  [data-pc-group-section=pagebutton]{
21
21
  @apply p-2 m-0 rounded-none border
22
22
  }
23
23
  [data-pc-section=pagebutton]{
24
24
  @apply p-3 m-0 border
25
- }
25
+ } */
26
26
  html {
27
27
  overflow: hidden;
28
28
  overscroll-behavior: none;
@@ -25,9 +25,15 @@ const CustomTailwind = usePassThrough(
25
25
  // title:{class:''},
26
26
  // header:{class:''}
27
27
  },
28
- tabpanel:{
29
- headerTitle:{class:'m-0 p-0'},
30
- },
28
+ // tabview:{
29
+ // tabpanel:{
30
+ // headeraction:{class:'p-tabview-nav-link p-tabview-header-action items-center cursor-pointer flex overflow-hidden relative select-none text-decoration-none select-none border-b-2 p-5 font-bold rounded-t-md transition-shadow duration-200 m-0 transition-colors duration-200 bg-white border-blue-500 text-blue-500 dark:bg-gray-600 dark:border-blue-300 dark:text-blue-300'}
31
+ // },
32
+ // },
33
+
34
+ // tabpanel:{
35
+ // headerTitle:{class:'m-0 p-0'},
36
+ // },
31
37
  accordiontab:{
32
38
  content:{style:'padding: 0.7rem;'}
33
39
 
@@ -49,7 +55,7 @@ const CustomTailwind = usePassThrough(
49
55
  //},
50
56
  button:{root:{class: 'focus:outline-none transition duration-150 ease-in-out rounded p-2 m-1 border dark:border-gray-600'}},
51
57
  dialog:{
52
- root:{class:[' w-full max-h-full bodycolorclass max-w-full md:h-3/4 lg:h-1/2 border m-2 rounded-lg']},
58
+ root:{class:[' w-full bodycolorclass max-w-full md:h-3/4 lg:h-1/2 border border-gray-400 dark:bg-gray-700 m-2 rounded-lg']},
53
59
  header:{class: 'p-dialog-header flex items-center text-2xl justify-between shrink-0 border-t-0 rounded-tl-lg rounded-tr-lg p-6 bodycolorclass'},
54
60
  footer:{class:'p-dialog-footer flex gap-2 shrink-0 justify-end align-center border-t-0 px-6 pb-6 text-right rounded-b-lg bodycolorclass'},
55
61
  content:{class:'p-dialog-content overflow-y-auto px-6 pb-8 pt-0 rounded-bl-lg rounded-br-lg h-full bodycolorclass'}
@@ -5,52 +5,60 @@
5
5
  * last change 2024-02-22
6
6
  * author: Ks Tan
7
7
  */
8
-
9
- import Dialog from 'primevue/dialog';
10
- // import {ref} from 'vue'
11
- import {MenuData} from '~/types'
12
- const visible = defineModel<boolean>({default:true,required:true})
13
8
 
14
- // const emit = defineEmits(['select'])
15
- const selectMenu = (menuname:{name:string,children:any}) =>{
16
- goTo(menuname.name)
17
- visible.value=false
18
- }
9
+ import { MenuData } from "~/types";
10
+ const visible = defineModel<boolean>({ default: true, required: true });
19
11
 
12
+ // const emit = defineEmits(['select'])
13
+ const selectMenu = (menuname: { name: string; children: any }) => {
14
+ goTo(menuname.name);
15
+ visible.value = false;
16
+ };
20
17
 
21
- const m = getMenustFromPageMeta()
22
- let treemenu:any[] = []
18
+ const m = getMenustFromPageMeta();
19
+ let treemenu: any[] = [];
23
20
 
24
- getMenustFromPageMeta().reduce((r, item) => {
25
- item.split('/').
26
- reduce((o, name) => {
27
- var temp = (o.children = o.children || []).find(q => q.name === name);
28
- if (!temp) o.children.push(temp = { name });
29
- return temp;
21
+ getMenustFromPageMeta().reduce(
22
+ (r, item) => {
23
+ item.split("/").reduce((o, name) => {
24
+ var temp = (o.children = o.children || []).find((q) => q.name === name);
25
+ if (!temp) o.children.push((temp = { name }));
26
+ return temp;
30
27
  }, r);
31
28
  return r;
32
- }, { children: treemenu })
29
+ },
30
+ { children: treemenu },
31
+ );
33
32
 
34
- treemenu = treemenu.sort((a,b)=>a.name<b.name ?-1:1)
33
+ treemenu = treemenu.sort((a, b) => (a.name < b.name ? -1 : 1));
35
34
  </script>
36
35
  <template>
37
-
38
- <!-- <button class="text-center border-none cursor-pointer pi pi-bars dark:text-white" v-if="getCurrentXorg()" @click="visible=true"> -->
39
- <Dialog v-model:visible="visible" modal :header="t('pickDocument')" :pt="{dialog:{ class:' bg-primary-800 ' }}">
40
- <div class="">
41
-
42
- <div v-for="m in treemenu.sort()" class="m-4">
43
-
44
- <h3>{{ t(m.name) }}</h3>
45
- <div class="grid md:grid-cols-2 lg:grid-cols-6 gap-4">
46
- <ButtonPrimary v-for="submenu in m.children.sort((a:any,b:any)=>a.name<b.name ?-1:1)" class="border rounded-lg p-2" @click="selectMenu(submenu)">
47
- {{ t(submenu.name) }}
48
- </ButtonPrimary>
49
- </div>
50
-
51
- </div>
52
-
36
+ <!-- <button class="text-center border-none cursor-pointer pi pi-bars dark:text-white" v-if="getCurrentXorg()" @click="visible=true"> -->
37
+ <Dialog
38
+ v-model:visible="visible"
39
+ modal
40
+ dismissableMask
41
+ position="top"
42
+ :header="t('pickDocument')"
43
+ :pt="{root:{class:'h-6/7',},}"
44
+ :pt-options="{mergeProps:true,mergeSections:true}"
45
+ >
46
+ <div class="">
47
+ <div v-for="(m,index) in treemenu.sort()" class="m-4" :key="index">
48
+ <h3>{{ t(m.name) }}</h3>
49
+ <div class="grid md:grid-cols-2 lg:grid-cols-6 gap-4">
50
+ <ButtonPrimary
51
+ v-for="(submenu,menuindex) in m.children.sort((a: any, b: any) =>
52
+ a.name < b.name ? -1 : 1,
53
+ )"
54
+ class="border rounded-lg p-2"
55
+ :key="menuindex"
56
+ @click="selectMenu(submenu)"
57
+ >
58
+ {{ t(submenu.name) }}
59
+ </ButtonPrimary>
53
60
  </div>
54
- </Dialog>
55
-
61
+ </div>
62
+ </div>
63
+ </Dialog>
56
64
  </template>
@@ -43,6 +43,8 @@ const saveLocale = async (v: string) => {
43
43
  <!-- </div> -->
44
44
 
45
45
  <Dialog
46
+ modal
47
+ dismissableMask
46
48
  appendTo="body"
47
49
  ref="userprofileoverlay"
48
50
  v-model:visible="modelValue"
@@ -1,11 +1,15 @@
1
- <template>
2
- <div
3
- class="w-full dark:bg-gray-800 z-20 justify justify-between absolute h h-14 flex flex-row place-items-center opacity-90 dark:text-white"
4
- >
5
- <div class="text-left"><slot name="start"></slot></div>
6
- <div class="flex-1 text-center line-clamp-2"><slot name="center"></slot></div>
7
- <div class=" text-right"><slot name="end"></slot></div>
8
- </div>
1
+ <template>
2
+ <div v-bind="$attrs"
3
+ class="w-full dark:bg-gray-800 z-20 justify justify-between absolute h h-14 flex flex-row place-items-center opacity-90 dark:text-white"
4
+ >
5
+ <div class="text-left"><slot name="start"></slot></div>
6
+ <div class="flex-1 text-center line-clamp-2">
7
+ <slot name="center"></slot>
8
+ </div>
9
+ <div class="text-right"><slot name="end"></slot></div>
10
+ </div>
11
+ <div class="h-14"></div>
12
+
9
13
  </template>
10
14
  <script setup lang="ts">
11
15
  /**
@@ -19,7 +19,7 @@
19
19
  <slot name="headerRight"></slot>
20
20
  </template>
21
21
  </MobileToolbar>
22
- <div class="mt-14">
22
+ <div >
23
23
  <slot name="default"></slot>
24
24
  </div>
25
25
  </div>
@@ -15,16 +15,21 @@
15
15
  <!-- <div :uuid="uuid" >{{ modelValue }}</div> -->
16
16
  <!-- <div v-if="typeof modelValue =='object' && typeof modelValue['_id']!='undefined' && typeof modelValue['label']!='undefined' && readonly ==true " :uuid="uuid" class="simpleapp-value-readonly">{{ modelValue['label'] }}</div> -->
17
17
  <!-- <div v-else-if="readonly==true" :uuid="uuid" class="simpleapp-value-readonly">{{ modelValue }}</div> -->
18
- <!-- <slot v-else name="default" :uuid="uuid" :error="error"></slot> -->
19
- <slot name="default" :uuid="uuid" :error="error"></slot>
20
-
18
+ <!-- <slot v-else name="default" :uuid="uuid" :error="error"></slot> -->
19
+ <slot name="default" :uuid="uuid" :error="error"></slot>
21
20
 
22
- <small v-if="error" class="text-danger-600 dark:text-danger-400">{{ error }}</small>
21
+ <small v-if="error" class="text-danger-600 dark:text-danger-400">{{
22
+ error
23
+ }}</small>
23
24
  <small v-else class="input-desc">{{ fielddesc }}</small>
24
25
  </div>
25
26
  <div v-else :class="defaultcssclass">
26
- <label class="etext-danger-600 dark:text-danger-400">wrong path in getField()</label>
27
- <div class="text-danger-600 dark:text-danger-400">{{ props.setting.path }}</div>
27
+ <label class="etext-danger-600 dark:text-danger-400"
28
+ >wrong path in getField()</label
29
+ >
30
+ <div class="text-danger-600 dark:text-danger-400">
31
+ {{ props.setting.path }}
32
+ </div>
28
33
  </div>
29
34
  </template>
30
35
  <script setup lang="ts">
@@ -55,6 +60,7 @@ const props = defineProps<{
55
60
  readonly?: boolean;
56
61
  // error?:string,
57
62
  setting: any;
63
+ resetcount: number;
58
64
  }>();
59
65
 
60
66
  const readonly = computed(() => {
@@ -85,7 +91,7 @@ const getLabelClass = () => {
85
91
  class1 += "-mb-4 ml-1 z-10 text-xs dark:text-gray-100";
86
92
  else if (modelValue.value !== undefined)
87
93
  class1 += "-mb-4 ml-1 z-10 text-xs dark:text-gray-100";
88
- else class1 += "-mb-4 ml-1 z-10 text-xs dark:text-gray-100 hidden";
94
+ else class1 += "-mb-4 ml-1 z-10 text-xs dark:text-gray-100 ";
89
95
  return class1;
90
96
  };
91
97
 
@@ -137,4 +143,11 @@ watch(props.setting.errors, (newvalue, oldvalue) => {
137
143
  // console.log("validation result",props.setting.instancepath,)
138
144
  // error.value = newvalue[props.setting.instancepath].message
139
145
  });
146
+
147
+ watch(
148
+ () => props.resetcount,
149
+ () => {
150
+ error.value = "";
151
+ },
152
+ );
140
153
  </script>
@@ -32,8 +32,7 @@
32
32
  </slot>
33
33
  <ContextMenu ref="menu" :model="menus as MenuItem[]" />
34
34
  </template>
35
- </MobileToolbar>
36
- <div class="h-14"></div>
35
+ </MobileToolbar>
37
36
  <ConfirmDialog></ConfirmDialog>
38
37
  </div>
39
38
  <div v-else class="simpleapp-tool-bar">
@@ -121,9 +120,7 @@ const title = computed(() =>
121
120
 
122
121
  const menu = ref();
123
122
  const menus = computed(() =>
124
- [...getActions(), ...getDocActions()].filter((item) =>
125
- showMenuButton(item),
126
- ),
123
+ [...getActions(), ...getDocActions()].filter((item) => showMenuButton(item)),
127
124
  );
128
125
 
129
126
  const isShow = computed(
@@ -10,6 +10,7 @@
10
10
  :instancepath="instancepath"
11
11
  :error="error"
12
12
  #default="slotprops"
13
+ :resetcount="resetcount"
13
14
  >
14
15
  <Checkbox
15
16
  v-if="inputType == SimpleAppInputType.checkbox"
@@ -299,13 +300,13 @@ import Rating, { RatingProps } from "primevue/rating";
299
300
  import Slider, { SliderProps } from "primevue/slider";
300
301
  import Textarea, { TextareaProps } from "primevue/textarea";
301
302
  import { SimpleAppInputType } from "~/types";
302
-
303
+ const resetcount = ref(0)
303
304
  const instancepath = ref("");
304
305
  const modelValue = defineModel({ required: true });
305
306
 
306
307
  const datevalue = ref<Date>();
307
308
  const timevalue = ref<Date>();
308
- let watchOnChange=0
309
+ let watchOnChange = 0;
309
310
  const props = withDefaults(
310
311
  defineProps<{
311
312
  inputType: SimpleAppInputType;
@@ -367,7 +368,7 @@ watch(props.setting.errors, (newvalue, oldvalue) => {
367
368
  errmsg = "";
368
369
  }
369
370
  if (errmsg != "") {
370
- const errorstyle = { style: "border-color: lightcoral; color:white " };
371
+ const errorstyle = { style: "border-color: lightcoral; color:lightcoral " };
371
372
  if (!pt.value) pt.value = {};
372
373
 
373
374
  if (props.inputType == SimpleAppInputType.text)
@@ -394,7 +395,7 @@ const isReadonly = computed(() => {
394
395
  const updateTime = (value: Date) => {
395
396
  value.setSeconds(0);
396
397
  modelValue.value = dateToTimeString(value);
397
- onChange()
398
+ onChange();
398
399
  };
399
400
  const updateDate = (value: any) => {
400
401
  if (value) {
@@ -402,7 +403,7 @@ const updateDate = (value: any) => {
402
403
  } else {
403
404
  modelValue.value = "";
404
405
  }
405
- onChange()
406
+ onChange();
406
407
  };
407
408
 
408
409
  const setFocus = (ev: any) => {
@@ -454,8 +455,6 @@ watch(modelValue, (newvalue: any) => {
454
455
  timevalue.value = undefined;
455
456
  }
456
457
  }
457
-
458
-
459
458
  });
460
459
  onMounted(() => {
461
460
  if (
@@ -477,12 +476,13 @@ onMounted(() => {
477
476
  timevalue.value = undefined;
478
477
  }
479
478
  }
480
-
481
479
  });
482
480
 
483
- const onChange=()=>{
484
- emits("change", modelValue.value);
485
- }
481
+ const onChange = () => {
482
+ pt.value=undefined
483
+ resetcount.value++
484
+ emits("change", modelValue.value);
485
+ };
486
486
 
487
487
  /************ start autocomplete only ***************/
488
488
 
@@ -2,11 +2,11 @@
2
2
  <div>
3
3
  <div class="mt-8 md:flex justify-start md:gap-4">
4
4
  <form @submit.prevent="true" class="w-full">
5
- <div>{{ t('createNewCompany') }}</div>
5
+ <div>{{ t("createNewCompany") }}</div>
6
6
  <div class="p-inputgroup flex flex-row">
7
7
  <InputText
8
8
  class="flex-1"
9
- :placeholder="t('yourCompanyName')"
9
+ :placeholder="t('enterYourCompanyName')"
10
10
  v-model:model-value="data.tenantName"
11
11
  />
12
12
  <div class="p-inputgroup-addon p p-0">
@@ -21,10 +21,7 @@
21
21
  </div>
22
22
  </div>
23
23
  </form>
24
-
25
24
  </div>
26
-
27
-
28
25
  </div>
29
26
  </template>
30
27
  <script setup lang="ts">
@@ -46,7 +43,6 @@ const onhold = ref(false);
46
43
  const createTenant = async () => {
47
44
  onhold.value = true;
48
45
 
49
-
50
46
  getPorfileApi()
51
47
  .createTenant(data.value)
52
48
  .then((res: AxiosResponse) => {
@@ -1,8 +1,19 @@
1
1
  /**
2
2
  * This file was automatically generated by simpleapp generator. Every
3
3
  * MODIFICATION OVERRIDE BY GENERATEOR
4
- * last change 2023-10-28
4
+ * last change 2024-03-07
5
5
  * Author: Ks Tan
6
6
  */
7
7
  export const refreshDocumentList = (docName:string)=>useNuxtApp().$event('RefreshDocumentList',{documentName:docName})
8
- export const refreshDocument = (docName:string)=>useNuxtApp().$event('RefreshDocument',docName)
8
+ export const refreshDocument = (docName:string)=>useNuxtApp().$event('RefreshDocument',docName)
9
+
10
+ export const listenDocument = (docName:string,callback:Function) =>{
11
+ useNuxtApp().$listen('RefreshDocument',async (eventdocname:string)=>{
12
+ if(eventdocname==docName) await callback()
13
+ })
14
+ }
15
+ export const listenDocumentList = (docName:string,callback:Function) =>{
16
+ useNuxtApp().$listen('RefreshDocumentList',async (eventdata)=>{
17
+ if(eventdata.documentName == docName) await callback()
18
+ })
19
+ }
@@ -1,47 +1,69 @@
1
1
  <template>
2
- <title>{{ t("organization") }}</title>
3
- <div class="w-full flex-col flex">
4
- <MobileToolbar>
5
- <template #center>{{ t('organization') }}</template>
6
- <template #end>
7
- <ButtonText @click="showEditOrg=true"><i class="pi pi-pencil"></i></ButtonText>
8
- </template>
9
- </MobileToolbar>
10
- <div class="w-full flex flex-row p-2">
11
- <div class="p-4">
12
- <div class="border w-12 h-12 md:w-24 md:h24"></div>
13
- </div>
14
- <div class="flex flex-col flex-1 ">
15
- <TextTitle>{{ data.orgName }} / {{ data.orgCode }}</TextTitle>
16
- <div class="text-gray-600 dark:text-gray-400 text-sm">{{ data.description }}</div>
17
- <div class="text-gray-600 dark:text-gray-400 text-sm">
18
- {{ data.country }}/{{ data.currency }}/{{ data.timeZone }}//{{ data.offsetMinute }}
19
- </div>
20
-
21
- </div>
2
+
3
+ <div class="w-full flex-col flex">
4
+ <title>{{ t("organization") }}</title>
5
+ <MobileToolbar class="bg-gray-600">
6
+ <template #center><TextTitle class="text-white">{{ t("organization") }}</TextTitle></template>
7
+ <template #end>
8
+ <ButtonText @click="showEditOrg = true" class="text-white"
9
+ ><i class="pi pi-pencil"></i
10
+ ></ButtonText>
11
+ </template>
12
+ </MobileToolbar>
13
+
14
+ <div class="w-full flex flex-row p-2 border-b border-gray-300 ">
15
+ <div class="p-4">
16
+ <div class="border w-12 h-12 md:w-24 md:h24"></div>
22
17
  </div>
18
+ <div class="flex flex-col flex-1 ">
19
+ <TextTitle>{{ data.orgName }} / {{ data.orgCode }}</TextTitle>
20
+ <TextSubtitle>
21
+ {{ data.description }}
22
+ </TextSubtitle>
23
+ </div>
24
+ </div>
23
25
 
24
-
25
- <div class="w-full p-2">
26
- <h1>Branches</h1>
27
- <ButtonText @click="goBranch('new')">{{ t('addBranch') }}</ButtonText>
28
- <ListView
29
- :list="branchlist"
30
- title-field="branchName"
31
- sub-title-field="branchCode"
32
- :url="getDocumentUrl('organization', id)"
33
- >
34
- </ListView>
26
+ <div class="w-full p-2 flex flex-col ">
27
+
28
+ <div class="flex flex-row justify-end">
29
+ <TextTitle class="flex-1 p-2">{{ t('branches') }}</TextTitle>
30
+ <div>
31
+ <ButtonPrimary @click="goBranch('new')">
32
+ <i class="pi pi-plus"></i> <span>{{ t("addBranches") }}</span>
33
+ </ButtonPrimary>
34
+ </div>
35
35
  </div>
36
-
36
+ <ListView class="border rounded-lg border-gray-400 dark:border-gray-600"
37
+ :list="branchlist"
38
+ title-field="branchName"
39
+ sub-title-field="branchCode"
40
+ :url="getDocumentUrl('organization', id)"
41
+ #default="{item}"
42
+ >
43
+ <div class="flex flex-row">
44
+ <div class="flex-col flex flex-1">
45
+ <TextPrimary>{{ item.branchName }}</TextPrimary>
46
+ <TextSubtitle>{{ item.description }}</TextSubtitle>
47
+ </div>
48
+ <div class="flex-col flex text-right">
49
+ <div>{{ item.branchCode }}</div>
50
+ <renderer-boolean v-model="item.active"></renderer-boolean>
51
+ </div>
52
+ </div>
37
53
 
38
- <OverlaySideBarCrud v-model="showEditOrg" close-event-name="organization">
39
- <FormOrganization :_id="getUserProfile()?.orgRecordId" @after="afterOrganization"></FormOrganization>
40
- </OverlaySideBarCrud>
41
-
42
- <OverlaySideBarCrud v-model="showEditBranch" close-event-name="branch">
43
- <NuxtPage :_id="id"></NuxtPage>
44
- </OverlaySideBarCrud>
54
+ </ListView>
55
+ </div>
56
+
57
+ <OverlaySideBarCrud v-model="showEditOrg" close-event-name="organization">
58
+ <FormOrganization
59
+ :_id="getUserProfile()?.orgRecordId"
60
+ @after="afterOrganization"
61
+ ></FormOrganization>
62
+ </OverlaySideBarCrud>
63
+
64
+ <OverlaySideBarCrud v-model="showEditBranch" close-event-name="branch">
65
+ <NuxtPage :_id="id"></NuxtPage>
66
+ </OverlaySideBarCrud>
45
67
  </div>
46
68
  </template>
47
69
 
@@ -56,12 +78,12 @@ import { FormCrudEvent, SimpleAppInputType } from "~/types";
56
78
  import ConfirmPopup from "primevue/confirmpopup";
57
79
  import { useConfirm } from "primevue/useconfirm";
58
80
  const confirm = useConfirm();
59
- const showEditOrg = ref<boolean>(false)
60
- const showEditBranch = ref<boolean>(false)
81
+ const showEditOrg = ref<boolean>(false);
82
+ const showEditBranch = ref<boolean>(false);
61
83
 
62
84
  const { $OrganizationDoc, $BranchDoc, $event, $listen } = useNuxtApp();
63
85
 
64
- const orgId = computed(()=><string>getUserProfile()?.orgRecordId)
86
+ const orgId = computed(() => <string>getUserProfile()?.orgRecordId);
65
87
  const doc = $OrganizationDoc();
66
88
  const brancdoc = $BranchDoc();
67
89
  const data = doc.getReactiveData();
@@ -69,7 +91,7 @@ const branchlist = ref([]);
69
91
  const isReadOnly = ref(true);
70
92
  const getCurrentOrg = async () => {
71
93
  await doc.getById(orgId.value);
72
- await fetchRecord()
94
+ await fetchRecord();
73
95
  };
74
96
  const fetchRecord = async () => {
75
97
  //fetch org
@@ -79,41 +101,38 @@ const fetchRecord = async () => {
79
101
  filter: { orgId: data.value.orgId },
80
102
  });
81
103
 
82
- console.log("reload data",branchlist)
104
+ console.log("reload data", branchlist);
83
105
  };
84
106
 
85
107
  const id = computed((): string => String(useRoute().params.id ?? ""));
86
108
 
87
-
88
109
  definePageMeta({
89
110
  menuPath: "setting/organization",
90
111
  });
91
112
 
92
113
  //branch record update then reload
93
114
  $listen("RefreshDocumentList", async (data) => {
94
- console.log("trigger RefreshDocumentList",data)
115
+ console.log("trigger RefreshDocumentList", data);
95
116
  if (data.documentName == "branch" || data.documentName == "organization") {
96
117
  await fetchRecord();
97
118
  }
98
119
  });
99
120
 
121
+ const showBranchDialogIfRequired = () => {
122
+ if (useRoute().path.includes("/new") || id.value) showEditBranch.value = true;
123
+ };
100
124
 
101
-
102
- const showBranchDialogIfRequired = () =>{
103
- if(useRoute().path.includes('/new') || id.value) showEditBranch.value=true
104
- }
105
-
106
- const afterOrganization = (actionName:FormCrudEvent)=>{
107
- if(actionName==FormCrudEvent.update){
108
- showEditOrg.value=false
109
- getCurrentOrg()
125
+ const afterOrganization = (actionName: FormCrudEvent) => {
126
+ if (actionName == FormCrudEvent.update) {
127
+ showEditOrg.value = false;
128
+ getCurrentOrg();
110
129
  }
111
- }
130
+ };
112
131
 
113
- watch(()=>useRoute().path,()=>showBranchDialogIfRequired())
114
- onMounted(()=>showBranchDialogIfRequired())
132
+ watch(
133
+ () => useRoute().path,
134
+ () => showBranchDialogIfRequired(),
135
+ );
136
+ onMounted(() => showBranchDialogIfRequired());
115
137
  getCurrentOrg();
116
-
117
-
118
-
119
138
  </script>
@@ -1,67 +1,150 @@
1
- {
2
- "home":"Home",
3
- "welcome": "Welcome",
4
- "create": "Create",
5
- "close": "Close",
6
- "update": "Update",
7
- "delete": "Delete",
8
- "modify": "Modify",
9
- "confirm": "Confirm",
10
- "void": "Void",
11
- "draft": "Draft",
12
- "profile": "Profile",
13
- "logout": "logout",
14
- "language": "Language",
15
- "theme": "Theme",
16
- "welcomeSimpleApp": "Welcome To SimpleApp",
17
- "changeHomePageMsg": "{fullName}, it is product front page and by right you shall replace it with something else.",
18
- "realman": "Real man code with simpleapp",
19
- "new": "New",
20
- "keyword": "Keyword",
21
- "empty": "Empty",
22
- "noDataFound": "No Data Found",
23
- "userInfo": "User Information",
24
- "currentBranchAccessRights": "Current Branch Access Rights",
25
- "yourCompanyName": "Your Company Name",
26
- "onlyAppearInDebugMode": "Only Appear In Debug Mode",
27
- "pickDocument": "Pick Document",
28
- "sample": "Sample",
29
- "createYourContentHere": "Create your content here",
30
- "setting": "Setting",
31
- "mytasks": "My Tasks",
32
- "suspend": "Suspend",
33
- "submit": "Submit",
34
- "decision": "Decision",
35
- "simpleApproveMessage": "Approve or reject",
36
- "suspendcustomer": "Suspend Customer",
37
- "formKeyNotFound": "Formkey not found \"{formKey}\"",
38
- "selectAll": "Select All",
39
- "branches":"Branches",
40
- "accessRights": "Access Rights",
41
- "fullName":"Full Name",
42
- "type": "Type",
43
- "save": "Save",
44
- "general": "General",
45
- "login":"Login",
46
- "sessionExpire": "Session Expire",
47
- "reloginMessage": "Session Expire, relogin" ,
48
- "backToHome":"Back To Home",
49
- "undefined": "Undefined",
50
- "no":"No",
51
- "edit":"Edit",
52
- "select":"Select",
53
- "backendServerDownMessage":"Seems there is some connectivity issue, please try again later",
54
- "invalidXorg":"Invalid XOrg ",
55
- "userNotExistInTenant":"This tenant is not accessible" ,
56
- "light":"Light",
57
- "dark":"Dark",
58
- "redirectToLoginPage":"Redirect To Login Page",
59
- "cancel":"Cancel",
60
- "deleteRecord":"Delete Record",
61
- "deleteThisRecord?":"Delete this Record?",
62
- "ok":"OK",
63
- "null":"Null",
64
- "switchDatabase":"Switch Database",
65
- "pickYourDatabase" : "Pick Your Database",
66
- "createNewCompany":"Create New Company"
67
- }
1
+ <template>
2
+ <div v-if="schema" :class="getLayoutClass()">
3
+ <label v-if="hidelabel"></label>
4
+ <label v-else :for="uuid" :class="getLabelClass()"
5
+ >{{ fieldlabel }}
6
+ <span
7
+ v-if="props.setting.isrequired && fieldlabel"
8
+ class="text-danger-600 dark:text-danger-400"
9
+ >*</span
10
+ ></label
11
+ >
12
+ <!-- <label v-else-if="error" class="simpleapp-input-label text-danger-600 overflow-hidden" :for="uuid">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="text-danger-600">*</span></label>
13
+ <label v-else :for="uuid" class="simpleapp-input-label whitespace-nowrap text-gray-500 truncate">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="text-danger-600">*</span></label> -->
14
+
15
+ <!-- <div :uuid="uuid" >{{ modelValue }}</div> -->
16
+ <!-- <div v-if="typeof modelValue =='object' && typeof modelValue['_id']!='undefined' && typeof modelValue['label']!='undefined' && readonly ==true " :uuid="uuid" class="simpleapp-value-readonly">{{ modelValue['label'] }}</div> -->
17
+ <!-- <div v-else-if="readonly==true" :uuid="uuid" class="simpleapp-value-readonly">{{ modelValue }}</div> -->
18
+ <!-- <slot v-else name="default" :uuid="uuid" :error="error"></slot> -->
19
+ <slot name="default" :uuid="uuid" :error="error"></slot>
20
+
21
+ <small v-if="error" class="text-danger-600 dark:text-danger-400">{{
22
+ error
23
+ }}</small>
24
+ <small v-else class="input-desc">{{ fielddesc }}</small>
25
+ </div>
26
+ <div v-else :class="defaultcssclass">
27
+ <label class="etext-danger-600 dark:text-danger-400"
28
+ >wrong path in getField()</label
29
+ >
30
+ <div class="text-danger-600 dark:text-danger-400">
31
+ {{ props.setting.path }}
32
+ </div>
33
+ </div>
34
+ </template>
35
+ <script setup lang="ts">
36
+ import SimpleAppValue from "./SimpleAppValue.vue";
37
+ /**
38
+ * This file was automatically generated by simpleapp generator. Every
39
+ * MODIFICATION OVERRIDE BY GENERATEOR
40
+ * last change 2023-10-28
41
+ * Author: Ks Tan
42
+ */
43
+ // import {camelCaseToWords} from './helper'
44
+ // import {computed,setBlockTracking,watch} from 'vue'
45
+
46
+ import { ref } from "vue";
47
+
48
+ const uuid = randomUUID();
49
+ // const fieldlabel = ref('')
50
+ // const fielddesc = ref('')
51
+ const defaultcssclass = "simpleapp-input-container";
52
+ const fieldcontainerclass = ref(defaultcssclass);
53
+ let instancepath = ref("");
54
+ const props = defineProps<{
55
+ label?: string;
56
+ inputType: string;
57
+ description?: string;
58
+ instancepath?: string;
59
+ hidelabel?: boolean;
60
+ readonly?: boolean;
61
+ // error?:string,
62
+ setting: any;
63
+ resetcount:number
64
+ }>();
65
+
66
+ const readonly = computed(() => {
67
+ return props.readonly ?? props.setting.readonly ?? false;
68
+ });
69
+
70
+ const modelValue = defineModel<any>(); //this model value support all kind of data, string, number, autocomplete and etc
71
+ const readonlyclass = "simpleapp-value-readonly";
72
+ // console.log('props.setting',modelValue.value,props.setting)
73
+ let schema: any;
74
+
75
+ const getLayoutClass = () =>
76
+ `simpleapp-input-container flex ${
77
+ props.inputType == "checkbox"
78
+ ? " flex-row gap-4 mt-1 ml-1 "
79
+ : "flex flex-col "
80
+ }`;
81
+
82
+ const getLabelClass = () => {
83
+ let class1 =
84
+ "simpleapp-input-label text-left text-gray-500 dark:text-gray-200 ";
85
+
86
+ if (!isMobile()) class1 += "whitespace-nowrap truncate";
87
+ else if (props.inputType == "checkbox") class1 += " ml-1 dark:text-gray-200";
88
+ else if (props.inputType != "autocomplete" && modelValue.value)
89
+ class1 += "-mb-4 ml-1 z-10 text-xs dark:text-gray-100";
90
+ else if (props.inputType == "autocomplete" && modelValue.value?.label)
91
+ class1 += "-mb-4 ml-1 z-10 text-xs dark:text-gray-100";
92
+ else if (modelValue.value !== undefined)
93
+ class1 += "-mb-4 ml-1 z-10 text-xs dark:text-gray-100";
94
+ else class1 += "-mb-4 ml-1 z-10 text-xs dark:text-gray-100 ";
95
+ return class1;
96
+ };
97
+
98
+ const fielddesc = computed(() => {
99
+ return props.description ?? "";
100
+ });
101
+
102
+ if (props.setting.fieldsetting && props.setting.fieldsetting.type) {
103
+ schema = props.setting.fieldsetting;
104
+ // console.log("schema setting",props.setting,schema)
105
+ if (props?.instancepath) instancepath.value = props.instancepath;
106
+ else if (props.setting?.instancepath)
107
+ instancepath.value = props.setting.instancepath;
108
+ else instancepath.value = "/unknown";
109
+
110
+ const fieldnamearr = instancepath.value.split("/");
111
+ const fieldname = camelCaseToWords(fieldnamearr[fieldnamearr.length - 1]);
112
+
113
+ // if(props.description)fielddesc.value = props.description
114
+ // else if (schema?.description != 'undefined') fielddesc.value=schema.description
115
+ // else fielddesc.value=''
116
+ }
117
+ const fieldlabel = computed(() => {
118
+ if (props.label) {
119
+ return t(props.label);
120
+ } else if (schema.title) {
121
+ return t(schema.title);
122
+ } else {
123
+ return t(props.setting.key);
124
+ }
125
+ });
126
+ const errormsg = computed(() => {
127
+ props.setting.errors[instancepath.value];
128
+ });
129
+ const error = ref("");
130
+ watch(props.setting.errors, (newvalue, oldvalue) => {
131
+ //it is array
132
+ error.value = "";
133
+ if (newvalue[instancepath.value]) {
134
+ const errlist: any[] = newvalue[instancepath.value];
135
+ for (let i = 0; i < errlist.length; i++) {
136
+ error.value += errlist[i].message + ",";
137
+ }
138
+ fieldcontainerclass.value = defaultcssclass + " input-error";
139
+ } else {
140
+ error.value = "";
141
+ fieldcontainerclass.value = defaultcssclass;
142
+ }
143
+ // console.log("validation result",props.setting.instancepath,)
144
+ // error.value = newvalue[props.setting.instancepath].message
145
+ });
146
+
147
+ watch(()=>props.resetcount,()=>{
148
+ error.value=''
149
+ })
150
+ </script>