@simitgroup/simpleapp-generator 1.6.3-alpha → 1.6.4-b-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 (152) hide show
  1. package/dist/buildinschemas/branch.d.ts.map +1 -1
  2. package/dist/buildinschemas/branch.js +1 -0
  3. package/dist/buildinschemas/branch.js.map +1 -1
  4. package/dist/buildinschemas/changehistories.d.ts +3 -0
  5. package/dist/buildinschemas/changehistories.d.ts.map +1 -0
  6. package/dist/buildinschemas/changehistories.js +36 -0
  7. package/dist/buildinschemas/changehistories.js.map +1 -0
  8. package/dist/buildinschemas/index.d.ts +1 -0
  9. package/dist/buildinschemas/index.d.ts.map +1 -1
  10. package/dist/buildinschemas/index.js +3 -1
  11. package/dist/buildinschemas/index.js.map +1 -1
  12. package/dist/buildinschemas/organization.js +2 -2
  13. package/dist/buildinschemas/organization.js.map +1 -1
  14. package/dist/buildinschemas/user.d.ts.map +1 -1
  15. package/dist/buildinschemas/user.js +5 -1
  16. package/dist/buildinschemas/user.js.map +1 -1
  17. package/dist/buildinschemas/webhook.d.ts +3 -0
  18. package/dist/buildinschemas/webhook.d.ts.map +1 -0
  19. package/dist/buildinschemas/webhook.js +33 -0
  20. package/dist/buildinschemas/webhook.js.map +1 -0
  21. package/dist/framework.d.ts.map +1 -1
  22. package/dist/framework.js +3 -2
  23. package/dist/framework.js.map +1 -1
  24. package/dist/generate.js +30 -11
  25. package/dist/generate.js.map +1 -1
  26. package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
  27. package/dist/processors/jsonschemabuilder.js +10 -2
  28. package/dist/processors/jsonschemabuilder.js.map +1 -1
  29. package/dist/type.d.ts +2 -0
  30. package/dist/type.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/buildinschemas/branch.ts +1 -0
  33. package/src/buildinschemas/changehistories.ts +33 -0
  34. package/src/buildinschemas/index.ts +2 -1
  35. package/src/buildinschemas/organization.ts +2 -2
  36. package/src/buildinschemas/user.ts +5 -1
  37. package/src/buildinschemas/webhook.ts +31 -0
  38. package/src/framework.ts +3 -2
  39. package/src/generate.ts +35 -15
  40. package/src/processors/jsonschemabuilder.ts +10 -2
  41. package/src/type.ts +2 -0
  42. package/templates/basic/nest/controller.ts.eta +24 -3
  43. package/templates/basic/nest/model.ts.eta +9 -1
  44. package/templates/basic/nest/resolver.ts.eta +2 -2
  45. package/templates/basic/nuxt/pages.[id].vue.eta +7 -7
  46. package/templates/basic/nuxt/pages.form.vue.eta +1 -4
  47. package/templates/basic/nuxt/pages.landing.vue.eta +1 -20
  48. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +8 -1
  49. package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +2 -0
  50. package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +9 -2
  51. package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +21 -8
  52. package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +5 -10
  53. package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +1 -0
  54. package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +50 -0
  55. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +22 -8
  56. package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +9 -1
  57. package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +12 -6
  58. package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +7 -12
  59. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +133 -28
  60. package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +3 -1
  61. package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +1 -0
  62. package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +19 -0
  63. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +33 -8
  64. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +15 -9
  65. package/templates/nuxt/assets/css/calendar.css._eta +3 -0
  66. package/templates/nuxt/assets/css/style.css._eta +1 -1
  67. package/templates/nuxt/assets/images/unknown.png.eta +0 -0
  68. package/templates/nuxt/assets/primevue/passthrough.ts._eta +6 -1
  69. package/templates/nuxt/components/button/ButtonAction.vue._eta +40 -39
  70. package/templates/nuxt/components/button/ButtonDanger.vue._eta +11 -3
  71. package/templates/nuxt/components/button/ButtonDefault.vue._eta +11 -3
  72. package/templates/nuxt/components/button/ButtonPrimary.vue._eta +9 -3
  73. package/templates/nuxt/components/button/ButtonSecondary.vue._eta +33 -0
  74. package/templates/nuxt/components/button/ButtonText.vue._eta +9 -5
  75. package/templates/nuxt/components/button/ButtonWarning.vue._eta +11 -3
  76. package/templates/nuxt/components/calendar/CalendarInput.vue.eta +4 -3
  77. package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +76 -52
  78. package/templates/nuxt/components/chart/card.vue._eta +1 -1
  79. package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +36 -26
  80. package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +35 -13
  81. package/templates/nuxt/components/form/FormBranch.vue._eta +52 -5
  82. package/templates/nuxt/components/form/FormDocnoformat.vue.eta +14 -10
  83. package/templates/nuxt/components/form/FormUser.vue._eta +2 -4
  84. package/templates/nuxt/components/form/user/FormUserPermission.vue.eta +77 -59
  85. package/templates/nuxt/components/header/HeaderSelectBranch.vue.eta +42 -35
  86. package/templates/nuxt/components/image/ImageAvatar.vue.eta._vue +30 -0
  87. package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +34 -14
  88. package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +67 -50
  89. package/templates/nuxt/components/list/ListDocumentTable.vue.eta +20 -12
  90. package/templates/nuxt/components/list/ListView.vue.eta +64 -35
  91. package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +5 -4
  92. package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +8 -8
  93. package/templates/nuxt/components/page/PageDocList.vue.eta +36 -13
  94. package/templates/nuxt/components/renderer/RendererDate.vue.eta +8 -2
  95. package/templates/nuxt/components/renderer/RendererDateTime.vue.eta +7 -1
  96. package/templates/nuxt/components/renderer/RendererDocHistories.vue.eta +56 -0
  97. package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +14 -8
  98. package/templates/nuxt/components/renderer/RendererLink.vue.eta +7 -4
  99. package/templates/nuxt/components/renderer/RendererMoney.vue.eta +25 -17
  100. package/templates/nuxt/components/renderer/RendererTime.vue.eta +7 -1
  101. package/templates/nuxt/components/renderer/RendererViewer.vue.eta +19 -9
  102. package/templates/nuxt/components/select/SelectTemplate.vue.eta +53 -22
  103. package/templates/nuxt/components/session/SessionBlock.vue.eta +44 -46
  104. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +25 -16
  105. package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +60 -0
  106. package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +16 -8
  107. package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +8 -8
  108. package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +1 -1
  109. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +114 -38
  110. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +89 -168
  111. package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +44 -40
  112. package/templates/nuxt/components/simpleApp/SimpleAppUserPicker.vue.eta +387 -0
  113. package/templates/nuxt/components/text/TextDocStatus.vue._eta +22 -0
  114. package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +13 -15
  115. package/templates/nuxt/components/user/UserButtonPermissionInfo.vue.eta +138 -95
  116. package/templates/nuxt/components/user/UserInvitation.vue.eta +53 -45
  117. package/templates/nuxt/components/user/UserTenantPicker.vue.eta +32 -71
  118. package/templates/nuxt/composables/date.generate.ts.eta +105 -8
  119. package/templates/nuxt/composables/getDocument.generate.ts.eta +8 -6
  120. package/templates/nuxt/composables/getOpenApi.generate.ts.eta +58 -10
  121. package/templates/nuxt/composables/getUserStore.generate.ts.eta +39 -6
  122. package/templates/nuxt/composables/goTo.generate.ts.eta +14 -1
  123. package/templates/nuxt/composables/graphquery.generate.ts.eta +20 -2
  124. package/templates/nuxt/composables/recently.generate.ts.eta +16 -0
  125. package/templates/nuxt/composables/roles.generate.ts.eta +9 -13
  126. package/templates/nuxt/composables/stringHelper.generate.ts.eta +52 -0
  127. package/templates/nuxt/composables/sysmessage.generate.ts.eta +1 -1
  128. package/templates/nuxt/error.vue._eta +4 -2
  129. package/templates/nuxt/pages/[xorg]/{organization.vue.eta → organization.vue._eta} +38 -9
  130. package/templates/nuxt/pages/[xorg]/user.vue.eta +12 -9
  131. package/templates/nuxt/pages/login.vue._eta +4 -1
  132. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +54 -26
  133. package/templates/nuxt/plugins/70.recently.ts.eta +55 -0
  134. package/templates/nuxt/providers/my-provider.ts.eta +22 -0
  135. package/templates/nuxt/server/api/[xorg]/{[...].ts.eta → [...].ts._eta} +47 -21
  136. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +44 -3
  137. package/templates/nuxt/types/events.ts.eta +3 -2
  138. package/templates/nuxt/types/others.ts.eta +11 -1
  139. package/templates/nuxt/types/schema.ts.eta +3 -1
  140. package/templates/nuxt/types/simpleappinput.ts.eta +1 -1
  141. package/templates/nuxt/types/user.ts.eta +8 -7
  142. package/templates/project/jsonschemas/branch.json._eta +1 -0
  143. package/templates/project/jsonschemas/invoice.json._eta +4 -3
  144. package/templates/project/jsonschemas/organization.json._eta +2 -2
  145. package/templates/project/lang/default._json +6 -2
  146. package/tsconfig.tsbuildinfo +1 -1
  147. package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +0 -38
  148. /package/templates/nuxt/pages/[xorg]/mobile/docnoformat/{index.vue.eta → index.vue.etaxxx} +0 -0
  149. /package/templates/nuxt/pages/[xorg]/mobile/{index.vue._eta → index.vue._etaxxx} +0 -0
  150. /package/templates/nuxt/pages/[xorg]/mobile/organization/{[id].vue._eta → [id].vue._etaxxx} +0 -0
  151. /package/templates/nuxt/pages/[xorg]/mobile/{pickgroup.vue._eta → pickgroup.vue._etaxxx} +0 -0
  152. /package/templates/nuxt/pages/[xorg]/mobile/user/{index.vue.eta → index.vue.etaxxx} +0 -0
@@ -1,56 +1,92 @@
1
1
  <template>
2
-
3
- <div>
4
- <button class="" @click="previewPermission">
5
- <i class="pi pi-question-circle" ></i>
6
- </button>
7
- <Sidebar
8
- v-model:visible="showpermissioninfo"
9
- modal
10
- :header="permissiontitle"
11
- position="right"
12
- >
13
- <SelectButton v-model="selectedgroup" @change="selectGroup" :options="grouplist" option-label="label" option-value="value"></SelectButton>
14
- <div v-if="selectedgroup">
15
- <div v-if="useRuntimeConfig().public.DEBUGDATA" class="flex flex-row gap-2 p-2 ">
16
- <div class="flex align-items-center">
17
- <RadioButton v-model="mode" inputId="modepreview" name="pizza" value="preview" />
18
- <label for="modepreview" class="ml-2">Preview</label>
19
- </div>
20
- <div class="flex align-items-center">
21
- <RadioButton v-model="mode" inputId="modeedit" name="edit" value="edit" />
22
- <label for="modeedit" class="ml-2">Edit</label>
23
- </div>
24
- <div class="flex align-items-center">
25
- <RadioButton v-model="mode" inputId="modejson" name="json" value="json" />
26
- <label for="modejson" class="ml-2">JSON</label>
27
- </div>
28
-
29
- </div>
30
- <div v-if="mode=='json'">
31
- <div class="flex-row">
32
- <div><Button @click="copyText">copy</Button> </div>
33
- <div class="text text-gray-400">{{ copied }}</div>
34
- </div>
35
- <pre id="permissionstr">
36
- {{ permissions }}
37
- </pre>
38
- </div>
39
- <div class="permission-block flex flex-col m mt-4" v-for="res in allresources" v-else="showjson">
40
- <div class="m mr-3 ">{{ res }}</div>
41
- <div class="gap-4" v-if="allactions">
42
- <SelectButton v-if="mode=='edit'" multiple :options="allactions[res]" v-model="permissions[res]"></SelectButton>
43
-
44
- <span v-else v-for="actionname in allactions[res]" class="m m-1">
45
- <Chip class="bg-primary" v-if="canPerformAction(selectedgroup,res,actionname)" severity="success" :label="actionname" ></Chip>
46
- <Chip v-else :label="actionname" ></Chip>
47
- </span>
48
-
49
-
50
- </div>
51
- </div>
52
- </div>
53
- </Sidebar>
2
+ <div>
3
+ <button class="" @click="previewPermission">
4
+ <i class="pi pi-question-circle"></i>
5
+ </button>
6
+ <Sidebar
7
+ v-model:visible="showpermissioninfo"
8
+ modal
9
+ :pt="{ root: { class: 'w-2/3' } }"
10
+ :header="permissiontitle"
11
+ position="right"
12
+ >
13
+ <SelectButton
14
+ v-model="selectedgroup"
15
+ @change="selectGroup"
16
+ :options="grouplist"
17
+ option-label="label"
18
+ option-value="value"
19
+ ></SelectButton>
20
+ <div v-if="selectedgroup">
21
+ <div
22
+ v-if="useRuntimeConfig().public.DEBUGDATA"
23
+ class="flex flex-row gap-2 p-2"
24
+ >
25
+ <div class="flex align-items-center">
26
+ <RadioButton
27
+ v-model="mode"
28
+ inputId="modepreview"
29
+ name="pizza"
30
+ value="preview"
31
+ />
32
+ <label for="modepreview" class="ml-2">Preview</label>
33
+ </div>
34
+ <div class="flex align-items-center">
35
+ <RadioButton
36
+ v-model="mode"
37
+ inputId="modeedit"
38
+ name="edit"
39
+ value="edit"
40
+ />
41
+ <label for="modeedit" class="ml-2">Edit</label>
42
+ </div>
43
+ <div class="flex align-items-center">
44
+ <RadioButton
45
+ v-model="mode"
46
+ inputId="modejson"
47
+ name="json"
48
+ value="json"
49
+ />
50
+ <label for="modejson" class="ml-2">JSON</label>
51
+ </div>
52
+ </div>
53
+ <div v-if="mode == 'json'">
54
+ <div class="flex-row">
55
+ <div><Button @click="copyText">copy</Button></div>
56
+ <div class="text text-gray-400">{{ copied }}</div>
57
+ </div>
58
+ <pre id="permissionstr">
59
+ {{ computedpermissions }}
60
+ </pre
61
+ >
62
+ </div>
63
+ <div
64
+ class="permission-block flex flex-col m mt-4"
65
+ v-for="res in allresources"
66
+ v-else="showjson"
67
+ >
68
+ <div class="m mr-3">{{ res }}</div>
69
+ <div class="gap-4" v-if="allactions" >
70
+ <SelectButton
71
+ v-if="mode == 'edit'"
72
+ multiple
73
+ :options="allactions[res]"
74
+ v-model="permissions[res]"
75
+ ></SelectButton>
76
+
77
+ <span v-else v-for="actionname in allactions[res]" class="m m-1">
78
+ <Chip
79
+ class="bg-primary-600 text-white"
80
+ v-if="canPerformAction(selectedgroup, res, actionname)"
81
+ severity="success"
82
+ :label="t(actionname)"
83
+ ></Chip>
84
+ <Chip v-else :label="t(actionname)"></Chip>
85
+ </span>
86
+ </div>
87
+ </div>
88
+ </div>
89
+ </Sidebar>
54
90
  </div>
55
91
  </template>
56
92
  <script setup lang="ts">
@@ -61,54 +97,61 @@
61
97
  * Author: Ks Tan
62
98
  */
63
99
  import _ from "lodash";
64
- import Chip from 'primevue/chip';
65
- import RadioButton from 'primevue/radiobutton';
66
- import {ref} from 'vue'
67
-
68
-
69
- const showpermissioninfo = ref(false)
100
+ import Chip from "primevue/chip";
101
+ import RadioButton from "primevue/radiobutton";
102
+ import { ref } from "vue";
103
+ const isdebug = ref(useRuntimeConfig().public.DEBUGDATA);
104
+ const showpermissioninfo = ref(false);
70
105
  const permissiontitle = "Permission Information";
71
- const selectedgroup = ref('')
72
- const grouplist = getAllGroups().map((item)=>{return {value:item,label:_.capitalize(item)}})
73
- const mode = ref('preview')
106
+ const selectedgroup = ref("");
107
+ const grouplist = getAllGroups().map((item) => {
108
+ return { value: item, label: _.capitalize(item) };
109
+ });
110
+ const mode = ref("preview");
74
111
 
75
- const allresources = getUniqueResource()
76
- const allactions = ref()
77
- const permissions=ref()
78
-
79
- const activeroles = ref()
80
- const copied = ref('')
112
+ const allresources = getUniqueResource();
113
+ const allactions = ref();
114
+ const permissions = ref<{ [key: string]: string[] }>();
115
+ const computedpermissions = computed(() => {
116
+ const tmp: { [key: string]: string[] } = {};
117
+ for (const keyname in permissions.value) {
118
+ if (permissions.value[keyname].length > 0)
119
+ tmp[keyname] = permissions.value[keyname];
120
+ }
121
+ return tmp;
122
+ // return permissions.value.filter((item:string[],key:string)=>item.length>0)
123
+ });
124
+ const activeroles = ref();
125
+ const copied = ref("");
81
126
 
82
127
  const previewPermission = () => {
83
128
  showpermissioninfo.value = true;
84
129
  };
85
130
 
86
-
87
131
  const copyText = () => {
88
- copied.value="copied!"
89
- const storage = document.createElement('textarea');
90
- storage.value = String(document.getElementById('permissionstr')?.innerHTML)
91
- document.body.appendChild(storage);
92
- storage.select();
93
- storage.setSelectionRange(0, 99999);
94
- document.execCommand('copy');
95
- document.body.removeChild(storage);
96
-
97
-
98
-
99
- }
100
- const selectGroup = (selectedgroup:any) => {
101
- const groupname = selectedgroup.value
102
- activeroles.value= getGroupRoles(groupname)
103
- allactions.value={}
104
- permissions.value={}
105
- for(let i=0; i< allresources.length; i++){
106
- const r = allresources[i]
107
- console.log(r)
108
- const actions = getActionFromResource(r)
109
- allactions.value[r]=actions
110
- permissions.value[r]=getGroupResourcePermission(groupname,r).map(item=>item.action)
111
- }
112
- console.log(allactions.value,permissions.value)
113
- }
114
- </script>
132
+ copied.value = "copied!";
133
+ const storage = document.createElement("textarea");
134
+ storage.value = String(document.getElementById("permissionstr")?.innerHTML);
135
+ document.body.appendChild(storage);
136
+ storage.select();
137
+ storage.setSelectionRange(0, 99999);
138
+ document.execCommand("copy");
139
+ document.body.removeChild(storage);
140
+ };
141
+ const selectGroup = (selectedgroup: any) => {
142
+ const groupname = selectedgroup.value;
143
+ activeroles.value = getGroupRoles(groupname);
144
+ allactions.value = {};
145
+ permissions.value = {};
146
+ for (let i = 0; i < allresources.length; i++) {
147
+ const r = allresources[i];
148
+ // console.log(r);
149
+ const actions = getActionFromResource(r);
150
+ allactions.value[r] = actions;
151
+ permissions.value[r] = getGroupResourcePermission(groupname, r).map(
152
+ (item) => item.action,
153
+ );
154
+ }
155
+ console.log(allactions.value, permissions.value);
156
+ };
157
+ </script>
@@ -1,19 +1,29 @@
1
1
  <template>
2
- <Dialog v-model:visible="visible" modal :header="popuptitle" class="crudsimple-dialog" :autoZIndex="false" :style="{zIndex:100 }">
2
+ <Dialog
3
+ v-model:visible="visible"
4
+ modal
5
+ :header="popuptitle"
6
+ class="crudsimple-dialog">
3
7
  <div v-if="invites">
4
-
5
- <div v-for="item in invites" class="w w-auto p p-2 grid grid-cols-3 hover-list-primary border">
6
- <div class="flex flex-col col-span-2">
7
- <div class="font font-bold">{{item.tenantName}}</div>
8
- <div class="text text-xs text-gray-500 italic">{{ item.created }}</div>
9
- </div>
10
- <div >
11
- <Button class="btn-primary" @click="approve(item._id)">Approve</Button>
12
- <Button class="btn-danger" @click="decline(item._id)">Decline</Button>
13
- </div>
8
+ <div
9
+ v-for="item in invites"
10
+ class="w w-auto p p-2 grid grid-cols-3 hover-list-primary border"
11
+ >
12
+ <div class="flex flex-col col-span-2">
13
+ <div class="font font-bold">{{ item.tenantName }}</div>
14
+ <div class="text text-xs text-gray-500 italic">
15
+ {{ item.created }}
16
+ </div>
14
17
  </div>
15
- </div>
16
- </Dialog>
18
+ <div class="flex flex-row gap-2">
19
+ <ButtonPrimary @click="approve(item._id)"
20
+ >{{t('approve')}}</ButtonPrimary
21
+ >
22
+ <ButtonDanger @click="decline(item._id)">{{t('decline')}}</ButtonDanger>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </Dialog>
17
27
  </template>
18
28
  <script setup lang="ts">
19
29
  /**
@@ -22,35 +32,33 @@
22
32
  * last change 2023-10-28
23
33
  * Author: Ks Tan
24
34
  */
25
- import Dialog from 'primevue/dialog';
26
- import {onMounted, ref} from 'vue'
27
- import {EventType} from '../types'
28
- import ProgressSpinner from 'primevue/progressspinner'
29
- const {$userstore,$event}= useNuxtApp()
30
- const disabled = ref(false)
31
- const visible=ref(false)
32
- const invites = ref()
33
- const invitationmsg = "There is some invitation to join their organization:"
34
- const popuptitle = ref(invitationmsg)
35
- onMounted(()=>{
36
- invites.value = getUserProfile().invites
37
- if(invites.value.length>0){
38
- visible.value=true
39
- }
40
- })
41
-
42
- const approve = async (id:string) =>{
43
-
44
- // await reloadUserStore()
45
- await $userstore.decideInvitation(id,'accept')
46
- $event('InvitationAccepted',id)
47
- visible.value=false
48
- }
49
- const decline = async (id:string) => {
50
- // await reloadUserStore()
51
- await $userstore.decideInvitation(id,'reject')
52
- $event('InvitationRejected',id)
53
- visible.value=false
54
- }
55
-
56
- </script>
35
+ import Dialog from "primevue/dialog";
36
+ import { onMounted, ref } from "vue";
37
+ import { EventType } from "../types";
38
+ import ProgressSpinner from "primevue/progressspinner";
39
+ const { $userstore, $event } = useNuxtApp();
40
+ const disabled = ref(false);
41
+ const visible = ref(false);
42
+ const invites = ref();
43
+ const invitationmsg = "There is some invitation to join their organization:";
44
+ const popuptitle = ref(invitationmsg);
45
+ onMounted(() => {
46
+ invites.value = getUserProfile().invites;
47
+ if (invites.value.length > 0) {
48
+ visible.value = true;
49
+ }
50
+ });
51
+
52
+ const approve = async (id: string) => {
53
+ // await reloadUserStore()
54
+ await $userstore.decideInvitation(id, "accept");
55
+ $event("InvitationAccepted", id);
56
+ visible.value = false;
57
+ };
58
+ const decline = async (id: string) => {
59
+ // await reloadUserStore()
60
+ await $userstore.decideInvitation(id, "reject");
61
+ $event("InvitationRejected", id);
62
+ visible.value = false;
63
+ };
64
+ </script>
@@ -1,71 +1,30 @@
1
1
  <template>
2
2
  <div class="w-full">
3
- <div v-if="waiting" class="p-4 w-full">
4
- waiting..
5
- </div>
6
- <div v-else class="w-full p-4">
7
-
3
+ <div v-if="waiting" class="p-4 w-full">waiting..</div>
4
+ <div v-else class="w-full p-2 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
8
5
  <div v-for="tenant in alltenants" class="border rounded-lg p-2 m-2">
6
+
9
7
  <TextTitle>{{ tenant.tenantName }}</TextTitle>
10
- <ListView :list="tenant.permissions" url="/" idField="xOrg">
11
- <template #default="{item,index}">
12
- <div class="flex flex-row w-full justify-end">
13
- <TextPrimary class="flex-1">{{ item.orgName }}</TextPrimary>
14
- <TextPrimary>{{ item.branchCode }}</TextPrimary>
15
-
16
- </div>
17
- </template>
18
- </ListView>
8
+ <div v-for=" item in tenant.permissions">
9
+ <NuxtLink :to="`/${item.xOrg}`" external>
10
+ <div class="flex flex-row gap-2 hover:bg-primary-100">
11
+ <div class="min-w-14 p=2">
12
+ <ImageOrganization :orgRecordId="item.orgRecordId" :size="12"/>
13
+ </div>
14
+ <div class="flex flex-col w-full justify-end gap-2">
15
+ <div class="flex flex-row gap-2">
16
+ <TextMain>{{ item.branchCode }}</TextMain>
17
+ <Tag v-for="groupname in item.groups">{{ t(groupname) }}</Tag>
18
+ </div>
19
+ <TextSubsubtitle>{{ item.orgName }}</TextSubsubtitle>
20
+
21
+
22
+ </div>
23
+ </div>
24
+ </NuxtLink>
25
+ </div>
19
26
  </div>
20
-
21
- <!-- <card :pt="{ header: { class: 'text-xl text-gray-600' } }">
22
- <template #header>
23
- {{ tenant.tenantName }}
24
- </template>
25
- <template #content>
26
- <ul>
27
- <li v-for="o in getOrglist(tenant)">
28
- <h1 class="subtitle-text">{{ o.orgName }}</h1>
29
- <ul
30
- role="list"
31
- class="divide-y divide-gray-100 rounded-md border border-gray-200"
32
- >
33
- <li
34
- v-for="b in getBranchlist(tenant)"
35
- class="w-full items-center justify-between py-4 pl-4 pr-4 text-sm route-link-list"
36
- >
37
- <NuxtLink
38
- :href="`/${b.xOrg}`"
39
- v-if="o.orgId == b.orgId"
40
- :external="true"
41
- >
42
- <div class="flex w-full flex-1 items-center">
43
- <p class="flex-1 flex-shrink-0 font-bold text-primary-600">
44
- {{ b.branchCode }}
45
- </p>
46
- <p class="text-right min-w-0 flex-1 gap-2">
47
- <span href="#" class="font-medium text-gray-600">{{
48
- b.group
49
- }}</span>
50
- </p>
51
- </div>
52
- <div class="flex-shrink-0">
53
- <span class="font-medium text-gray-400"
54
- >{{ useRuntimeConfig().public.APP_URL }}/{{
55
- b.xOrg
56
- }}</span
57
- >
58
- </div>
59
- </NuxtLink>
60
- </li>
61
- </ul>
62
- </li>
63
- </ul>
64
-
65
- </template>
66
- </card> -->
67
27
  </div>
68
-
69
28
  </div>
70
29
  </template>
71
30
  <script setup lang="ts">
@@ -77,12 +36,13 @@
77
36
  */
78
37
  import _ from "lodash";
79
38
  import TextPrimary from "../text/TextPrimary.vue";
80
- const waiting = ref(true)
39
+ import ImageOrganization from "../image/ImageOrganization.vue";
40
+ const waiting = ref(true);
81
41
  const alltenants = ref();
82
42
 
83
43
  const loadAllTenants = async () => {
84
- waiting.value=false
85
- alltenants.value = (await getPorfileApi().getAllTenants()).data;
44
+ waiting.value = false;
45
+ alltenants.value = (await getProfileApi().getAllTenants()).data;
86
46
  };
87
47
 
88
48
  // const props = defineProps<{
@@ -90,12 +50,13 @@ const loadAllTenants = async () => {
90
50
  // }>()
91
51
  const getBranchlist = (tenant: any) => tenant.permissions;
92
52
 
93
- const getOrglist = (tenant: any) =>
94
- _.uniqBy(getBranchlist(tenant), "orgId").map((item: any) => ({
95
- orgId: item.orgId,
96
- orgCode: item.orgCode,
97
- orgName: item.orgName,
98
- }));
53
+ // const getOrglist = (tenant: any) =>
54
+ // _.uniqBy(getBranchlist(tenant), "orgId").map((item: any) => ({
55
+ // orgId: item.orgId,
56
+ // orgRecordId:'aaa',// item.orgRecordId,
57
+ // orgCode: item.orgCode,
58
+ // orgName: item.orgName,
59
+ // }));
99
60
 
100
61
  onNuxtReady(() => {
101
62
  loadAllTenants();
@@ -6,6 +6,92 @@
6
6
  */
7
7
  import { DurationType } from "~/types"
8
8
 
9
+ const convertToDate= (date:Date|string)=>{
10
+ return date instanceof Date ? date : new Date(date)
11
+ }
12
+
13
+ //after review
14
+ export const today = () => useDayjs()().format('YYYY-MM-DD')
15
+
16
+ /**
17
+ * convert date object or ISO8601 date become local datetime string
18
+ * @param date date|string
19
+ * @returns local shortform date-time
20
+ */
21
+ export const dateRenderToDateTimeStr = (date:Date|string) =>
22
+ convertToDate(date).toLocaleString().replace(',', ' ').slice(0,-3)
23
+ /**
24
+ * convert date object or ISO datestring become local date string
25
+ * @param date date|string
26
+ * @returns local short form date
27
+ */
28
+ export const dateRenderToDateStr = (date:Date|string) =>
29
+ convertToDate(date).toLocaleDateString().replace(',', ' ')
30
+ /**
31
+ * convert date object or ISO datestring become time string (without seconds)
32
+ * @param date date|string
33
+ * @returns
34
+ */
35
+ export const dateRenderToTimeStr = (date:Date|string) =>
36
+ convertToDate(date).toLocaleTimeString().slice(0,-3)
37
+
38
+
39
+ /**
40
+ * convert date object or ISO datestring become DD/MM format
41
+ * @param date date|string
42
+ * @returns
43
+ */
44
+ export const dateRenderToDDMM = (date:Date|string) =>
45
+ getDayJs()(date).format('DD/MM')
46
+
47
+
48
+
49
+ /**
50
+ * convert iso8601 date string to date object
51
+ * @param datestr :string
52
+ * @returns date object
53
+ */
54
+ export const stringToDate = (datestr:string) => new Date(datestr)
55
+
56
+ /**
57
+ * convert date object to ISO string YYYY-MM-DDTHH:mm:ssZ
58
+ * @param date :Date
59
+ * @returns
60
+ */
61
+ export const dateToISOString = (date:Date|string) => convertToDate(date).toISOString().split('.')[0]+"Z"
62
+ //useDayjs()(date).toISOString().split('.')[0]+"Z"
63
+ /**
64
+ * convert date object to date string (YYYY-MM-DD)
65
+ * @param date :Date
66
+ * @returns date return string in YYYY-MM-DD
67
+ */
68
+ export const dateToString = (date:Date|string) => useDayjs()(date).format('YYYY-MM-DD')
69
+ /**
70
+ * convert date object to time string (HH:mm:ss)
71
+ * @param date
72
+ * @returns timestring
73
+ */
74
+ export const dateToTimeString = (date:Date) => useDayjs()(date).format('HH:mm:ss')
75
+ /**
76
+ * get 3 char day name sun/mon/tue in lower case
77
+ * @param date : Date|string date obj or iso8601 date
78
+ * @returns string
79
+ */
80
+ export const getDayNameInWeek = (date:Date|string) => useDayjs()(date).format('ddd').toLowerCase();
81
+ /**
82
+ * get last date of the specific date
83
+ * @param dates: Date|string
84
+ * @returns string
85
+ */
86
+ export const lastDateOfMonth = (date:Date|string) => useDayjs()(date).endOf('month').format('YYYY-MM-DD');
87
+
88
+
89
+
90
+
91
+
92
+
93
+ //before reevaluate
94
+
9
95
  export const setDateLocale = (localename:string) => useDayjs().locale(localename)
10
96
  export const dateExists = (date:Date,listDate:Date[]) => {
11
97
  const existsrecord = listDate.find(item=>{
@@ -14,15 +100,26 @@ export const dateExists = (date:Date,listDate:Date[]) => {
14
100
  return existsrecord===undefined ? false :true
15
101
  }
16
102
  export const getDayJs = ()=>useDayjs()
17
- export const lastDateOfMonth = (datestr:string) => useDayjs()(datestr).endOf('month').format('YYYY-MM-DD');
18
- export const today = () => useDayjs()().format('YYYY-MM-DD')
19
- export const dateToString = (date:Date) => useDayjs()(date).format('YYYY-MM-DD')
20
- export const dateToISOString = (date:Date) => useDayjs()(date).toISOString()
21
- export const dateToTimeString = (date:Date) => useDayjs()(date).format('HH:mm:ss')
22
- export const stringToDate = (datestr:string) => new Date(datestr)
103
+
104
+
105
+
106
+
107
+ export const dateToISOWithoutConvert=(date:Date)=>{
108
+ const timestamp = date.getTime() - date.getTimezoneOffset() * 60000;
109
+ return new Date(timestamp).toISOString().split('.')[0]+"Z"
110
+ }
111
+ export const convertIsoToDateToWithoutConvert=(datestr:string)=>{
112
+ // const timestamp = date.getTime() - date.getTimezoneOffset() * 60000;
113
+ const offsets = (new Date()).getTimezoneOffset() * 60000
114
+ const timestamp = stringToDate(datestr).getTime() + offsets
115
+ return new Date(timestamp)
116
+ }
117
+
118
+
23
119
  export const dateToDateTimeString = (date:Date)=> useDayjs().utc(date).format('YYYY-MM-DD HH:mm:ss')
24
- export const toLocalDate = (date:string | Date)=> useDayjs().utc(date).format(getDateFormat())
120
+ export const toLocalDate = (date:string | Date)=> useDayjs()(date).format(getDateFormat())
25
121
  export const toLocalDateTime = (date:string | Date)=> useDayjs().utc(date).format(getDateTimeFormat())
122
+
26
123
  export const toUTCDate = (date:string | Date)=> useDayjs().utc(date).format(getDateFormat())
27
124
  export const toUTCDateTime = (date:string | Date)=> useDayjs().utc(date).format(getDateTimeFormat())
28
125
  export const toUTCTime = (date:string | Date)=> useDayjs().utc(date).format('HH:mm')
@@ -33,5 +130,5 @@ export const getPrimevueCalendarDateFormat = () => {
33
130
  const country = <string>getUserProfile()?.country
34
131
  return 'dd/mm/yy'
35
132
  }
36
- export const getDayNameInWeek = (date:Date|string) => useDayjs()(date).format('ddd').toLowerCase();
133
+
37
134
  export const addTime = (date:Date|string,duration:number,unit:DurationType) => getDayJs()(date).add(duration, 'hour').toDate()