@simitgroup/simpleapp-generator 1.5.1-alpha → 1.6.1-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 (147) hide show
  1. package/dist/buildinschemas/branch.d.ts.map +1 -1
  2. package/dist/buildinschemas/branch.js +10 -0
  3. package/dist/buildinschemas/branch.js.map +1 -1
  4. package/dist/buildinschemas/index.d.ts +2 -0
  5. package/dist/buildinschemas/index.d.ts.map +1 -1
  6. package/dist/buildinschemas/index.js +5 -1
  7. package/dist/buildinschemas/index.js.map +1 -1
  8. package/dist/buildinschemas/keyvaluepair.d.ts +3 -0
  9. package/dist/buildinschemas/keyvaluepair.d.ts.map +1 -0
  10. package/dist/buildinschemas/keyvaluepair.js +28 -0
  11. package/dist/buildinschemas/keyvaluepair.js.map +1 -0
  12. package/dist/buildinschemas/message.d.ts +3 -0
  13. package/dist/buildinschemas/message.d.ts.map +1 -0
  14. package/dist/buildinschemas/message.js +34 -0
  15. package/dist/buildinschemas/message.js.map +1 -0
  16. package/dist/buildinschemas/organization.d.ts.map +1 -1
  17. package/dist/buildinschemas/organization.js +18 -1
  18. package/dist/buildinschemas/organization.js.map +1 -1
  19. package/dist/buildinschemas/systemmessage.d.ts +3 -0
  20. package/dist/buildinschemas/systemmessage.d.ts.map +1 -0
  21. package/dist/buildinschemas/systemmessage.js +43 -0
  22. package/dist/buildinschemas/systemmessage.js.map +1 -0
  23. package/dist/framework.d.ts.map +1 -1
  24. package/dist/framework.js +4 -2
  25. package/dist/framework.js.map +1 -1
  26. package/dist/generate.d.ts.map +1 -1
  27. package/dist/generate.js +37 -9
  28. package/dist/generate.js.map +1 -1
  29. package/dist/processors/bpmnbuilder.d.ts.map +1 -1
  30. package/dist/processors/bpmnbuilder.js +23 -32
  31. package/dist/processors/bpmnbuilder.js.map +1 -1
  32. package/dist/processors/jrxmlbuilder.d.ts +3 -0
  33. package/dist/processors/jrxmlbuilder.d.ts.map +1 -0
  34. package/dist/processors/jrxmlbuilder.js +57 -0
  35. package/dist/processors/jrxmlbuilder.js.map +1 -0
  36. package/dist/type.d.ts +6 -0
  37. package/dist/type.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/src/buildinschemas/branch.ts +10 -0
  40. package/src/buildinschemas/index.ts +2 -0
  41. package/src/buildinschemas/keyvaluepair.ts +26 -0
  42. package/src/buildinschemas/organization.ts +18 -1
  43. package/src/buildinschemas/systemmessage.ts +42 -0
  44. package/src/framework.ts +4 -2
  45. package/src/generate.ts +41 -13
  46. package/src/processors/bpmnbuilder.ts +34 -38
  47. package/src/processors/jrxmlbuilder.ts +38 -0
  48. package/src/type.ts +7 -1
  49. package/templates/basic/nest/controller.ts.eta +34 -17
  50. package/templates/basic/nest/processor.ts.eta +2 -1
  51. package/templates/basic/nest/resolver.ts.eta +1 -1
  52. package/templates/basic/nest/service.ts.eta +22 -4
  53. package/templates/basic/nest/type.ts.eta +2 -2
  54. package/templates/basic/nuxt/component.select.vue.eta +5 -1
  55. package/templates/basic/nuxt/pages.form.vue.eta +1 -1
  56. package/templates/basic/nuxt/pages.mobile.landing.vue.eta +4 -61
  57. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +11 -13
  58. package/templates/nest/src/app.module.ts.eta +12 -4
  59. package/templates/nest/src/cloudapi/cloudapi.module.ts._eta +1 -1
  60. package/templates/nest/src/printapi/api/.gitignore.eta +4 -0
  61. package/templates/nest/src/printapi/api/.npmignore.eta +1 -0
  62. package/templates/nest/src/printapi/api/.openapi-generator/FILES.eta +8 -0
  63. package/templates/nest/src/printapi/api/.openapi-generator/VERSION.eta +1 -0
  64. package/templates/nest/src/printapi/api/.openapi-generator-ignore.eta +23 -0
  65. package/templates/nest/src/printapi/api/api.ts.eta +223 -0
  66. package/templates/nest/src/printapi/api/base.ts.eta +86 -0
  67. package/templates/nest/src/printapi/api/common.ts.eta +150 -0
  68. package/templates/nest/src/printapi/api/configuration.ts.eta +110 -0
  69. package/templates/nest/src/printapi/api/git_push.sh.eta +57 -0
  70. package/templates/nest/src/printapi/api/index.ts.eta +18 -0
  71. package/templates/nest/src/printapi/api/openapitools.json.eta +7 -0
  72. package/templates/nest/src/printapi/printapi.module.ts.eta +15 -0
  73. package/templates/nest/src/printapi/printapi.service.ts.eta +42 -0
  74. package/templates/nest/src/simpleapp/apischemas/index.ts._eta +11 -0
  75. package/templates/nest/src/simpleapp/generate/commons/robotuser.service.ts.eta +5 -4
  76. package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +7 -0
  77. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +10 -9
  78. package/templates/nest/src/simpleapp/generate/processors/autoinc.processor.ts.eta +73 -0
  79. package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +104 -0
  80. package/templates/nest/src/simpleapp/generate/processors/docno.processor.ts.eta +77 -0
  81. package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +115 -0
  82. package/templates/nest/src/simpleapp/generate/processors/perm.processor.ts.eta +71 -0
  83. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +77 -13
  84. package/templates/nest/src/simpleapp/generate/processors/sysmsg.processor.ts.eta +49 -0
  85. package/templates/nest/src/simpleapp/generate/processors/tenant.processor.ts.eta +52 -0
  86. package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +12 -5
  87. package/templates/nest/src/simpleapp/generate/workflow/workflow.controller.ts.eta +2 -2
  88. package/templates/nest/src/simpleapp/generate/workflow/workflow.delegate.ts.eta +33 -28
  89. package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +95 -26
  90. package/templates/nest/src/simpleapp/generate/workflow/workflow.type.ts.eta +4 -4
  91. package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +15 -0
  92. package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +3 -1
  93. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +20 -3
  94. package/templates/nest/src/simpleapp/services/sysmsg.service.ts._etaxxx +43 -0
  95. package/templates/nest/src/simpleapp/services/userresolver.service.ts._eta +70 -0
  96. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +8 -4
  97. package/templates/nest/src/simpleapp/types/index.ts._eta +5 -0
  98. package/templates/nuxt/assets/css/listview.css._eta +2 -2
  99. package/templates/nuxt/components/button/ButtonAction.vue._eta +11 -5
  100. package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +11 -2
  101. package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +1 -1
  102. package/templates/nuxt/components/form/{FormBranch.vue.eta → FormBranch.vue._eta} +1 -1
  103. package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +38 -0
  104. package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +40 -0
  105. package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +147 -0
  106. package/templates/nuxt/components/list/ListItem.vue.eta +24 -0
  107. package/templates/nuxt/components/list/ListMessages.vue.eta +89 -0
  108. package/templates/nuxt/components/list/ListView.vue.eta +9 -12
  109. package/templates/nuxt/components/renderer/RendererMoney.vue.eta +11 -12
  110. package/templates/nuxt/components/select/SelectTemplate.vue.eta +49 -20
  111. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +2 -2
  112. package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +16 -15
  113. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +92 -8
  114. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +29 -6
  115. package/templates/nuxt/components/text/TextBold.vue._eta +13 -0
  116. package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +18 -2
  117. package/templates/nuxt/composables/getUserStore.generate.ts.eta +12 -3
  118. package/templates/nuxt/composables/hotvalue.generate.ts.eta +30 -0
  119. package/templates/nuxt/composables/pusher.ts._eta +13 -0
  120. package/templates/nuxt/composables/stringHelper.generate.ts.eta +2 -3
  121. package/templates/nuxt/composables/sysmessage.generate.ts.eta +20 -0
  122. package/templates/nuxt/composables/workflow.generate.ts.eta +9 -4
  123. package/templates/nuxt/layouts/mobile.vue._eta +31 -42
  124. package/templates/nuxt/nuxt.config.ts._eta +2 -2
  125. package/templates/nuxt/othermodules.d.ts.eta +449 -0
  126. package/templates/nuxt/pages/[xorg]/mobile/organization/[id].vue._eta +40 -0
  127. package/templates/nuxt/pages/[xorg]/mobile/organization/{index.vue.eta → index.vue.aetaz} +16 -13
  128. package/templates/nuxt/pages/[xorg]/organization.vue.eta +21 -15
  129. package/templates/nuxt/plugins/40.pusher.ts.eta +18 -0
  130. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +10 -1
  131. package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +4 -1
  132. package/templates/nuxt/types/schema.ts.eta +8 -1
  133. package/templates/nuxt/types/simpleappinput.ts.eta +3 -5
  134. package/templates/printformats/template.jrxml._eta +27 -0
  135. package/templates/project/groups/admin.json.eta +6 -1
  136. package/templates/project/jsonschemas/branch.json._eta +113 -0
  137. package/templates/project/jsonschemas/invoice.json._eta +5 -1
  138. package/templates/project/jsonschemas/organization.json._eta +111 -0
  139. package/templates/project/lang/default._json +71 -150
  140. package/templates/workflow/next/listener.ts.eta +6 -3
  141. package/tsconfig.tsbuildinfo +1 -1
  142. /package/templates/nest/src/simpleapp/services/{autoinc.service.ts.eta → autoinc.service.ts.etaxx} +0 -0
  143. /package/templates/nest/src/simpleapp/services/{branch.service.ts.eta → branch.service.ts.etaxxx} +0 -0
  144. /package/templates/nest/src/simpleapp/services/{docno.service.ts.eta → docno.service.ts.etaxxx} +0 -0
  145. /package/templates/nest/src/simpleapp/services/{org.service.ts.eta → org.service.ts.etaxxx} +0 -0
  146. /package/templates/nest/src/simpleapp/services/{perm.service.ts.eta → perm.service.ts.etaxxx} +0 -0
  147. /package/templates/nest/src/simpleapp/services/{tenant.service.ts.eta → tenant.service.ts.etaxxx} +0 -0
@@ -32,7 +32,7 @@
32
32
  </slot>
33
33
  <ContextMenu ref="menu" :model="menus as MenuItem[]" />
34
34
  </template>
35
- </MobileToolbar>
35
+ </MobileToolbar>
36
36
  <ConfirmDialog></ConfirmDialog>
37
37
  </div>
38
38
  <div v-else class="simpleapp-tool-bar">
@@ -65,14 +65,48 @@
65
65
  </Toolbar>
66
66
  <ConfirmPopup></ConfirmPopup>
67
67
  </div>
68
+ <Dialog v-model:visible="visiblePrintFormats" :header="t('printFormats')">
69
+ <div>
70
+ <ListView
71
+ :list="printformats"
72
+ #default="{ item, index }"
73
+ @click="printPdf"
74
+ >
75
+ <div class="flex flex-col">
76
+ <TextBold>{{ item.formatName }}</TextBold>
77
+ <TextSubtitle>{{ item.description }}</TextSubtitle>
78
+ </div>
79
+ </ListView>
80
+ </div>
81
+ </Dialog>
82
+ <Sidebar
83
+ v-model:visible="visiblePrintPreview"
84
+ :header="t('printPreview')"
85
+ position="bottom"
86
+ >
87
+ <TextDanger v-if="printservererror || !printstr">
88
+ {{ t("printServerError") }}
89
+ </TextDanger>
90
+ <vue-pdf-embed
91
+ class="w-11/12"
92
+ v-else-if="isMobile()"
93
+ :source="printstr"
94
+ :disableTextLayer="true"
95
+ />
96
+ <iframe v-else width="100%" height="100%" :src="printstr"></iframe>
97
+ </Sidebar>
68
98
  </template>
69
99
  <script setup lang="ts">
70
100
  /**
71
101
  * This file was automatically generated by simpleapp generator during initialization. It is changable.
72
- * --remove-this-line-to-prevent-override--
73
- * last change 2024-02-22
102
+ * MODIFICATION OVERRIDE BY GENERATEOR
103
+ * last change 2024-04-02
74
104
  * author: Ks Tan
75
105
  */
106
+ import VuePdfEmbed from "vue-pdf-embed";
107
+
108
+ // import VuePdfKit from 'vue-pdf-kit'
109
+ // import 'vue-pdf-kit/dist/style.css'
76
110
 
77
111
  import { SimpleAppClient } from "~/simpleapp/generate/clients/SimpleAppClient";
78
112
  import { useConfirm } from "primevue/useconfirm";
@@ -81,10 +115,15 @@ import { MenuItem } from "primevue/menuitem";
81
115
  import { MenuItemCommandEvent } from "primevue/menuitem";
82
116
  const confirm = useConfirm();
83
117
  const emits = defineEmits(["on", "close"]);
118
+ const visiblePrintFormats = ref(false);
119
+ const visiblePrintPreview = ref(false);
120
+ const printstr = ref();
121
+ const printservererror = ref(false);
84
122
  const props = defineProps<{
85
123
  document: SimpleAppClient<any, any>;
86
124
  disableaction?: string[];
87
125
  }>();
126
+
88
127
  const createData = async () => {
89
128
  try {
90
129
  return await doc.create();
@@ -111,13 +150,13 @@ const doc = props.document;
111
150
  const data = doc.getReactiveData();
112
151
  type Datatype = keyof typeof data.value;
113
152
  const config = doc.getSchema()["x-simpleapp-config"];
114
- const titlefield = (config.uniqueKey ?? config.documentTitle) as Datatype;
153
+ const titlefield = (config.documentTitle ?? config.uniqueKey) as Datatype;
115
154
  const title = computed(() =>
116
155
  data.value[titlefield as Datatype]
117
156
  ? data.value[titlefield as Datatype]
118
157
  : t(doc.getDocName()),
119
158
  );
120
-
159
+ const printformats = doc.getSchema()["x-simpleapp-config"]?.printFormats;
121
160
  const menu = ref();
122
161
  const menus = computed(() =>
123
162
  [...getActions(), ...getDocActions()].filter((item) => showMenuButton(item)),
@@ -142,8 +181,25 @@ const emitMobileEvent = (itemevent: MenuItemCommandEvent) => {
142
181
  emitEvent(itemevent.item, event);
143
182
  };
144
183
 
184
+ const printPdf = async (index: number, format: any) => {
185
+ printservererror.value = false;
186
+ const formatid: string = format.formatId;
187
+ visiblePrintPreview.value = true;
188
+ // console.log("formatidformatid", format);
189
+ try {
190
+ const tmp: any = await doc
191
+ .getApi()
192
+ .runPrint(data.value._id ?? "", formatid);
193
+ printstr.value = "data:application/pdf;base64," + tmp.data;
194
+ } catch (e) {
195
+ printservererror.value = true;
196
+ printstr.value = "";
197
+ console.error("error from print server", e);
198
+ }
199
+ };
145
200
  const getActions = () => {
146
201
  const actions = doc.getActions();
202
+ const printformats = doc.getSchema()["x-simpleapp-config"]?.printFormats;
147
203
  const crudmenus: any[] = [];
148
204
 
149
205
  // Object.keys(actions).forEach((key)=>{ //crud, api, docstatus
@@ -160,11 +216,26 @@ const getActions = () => {
160
216
  });
161
217
  }
162
218
  });
219
+ if (printformats && printformats.length > 0) {
220
+ crudmenus.push({
221
+ action: "print",
222
+ label: t("print"),
223
+ type: "crud",
224
+ icon: "pi pi-print",
225
+ command: showPrintFormats,
226
+ });
227
+ }
228
+ console.log("crudmenus", crudmenus);
229
+
163
230
  // })
164
231
  return crudmenus;
165
232
  };
166
233
 
167
- const emitEvent = async (menu: FormMenu, clickEvent: MouseEvent) => {
234
+ const showPrintFormats = () => {
235
+ visiblePrintFormats.value = true;
236
+ // console.log("showPrintFormatContext",itemEvent)
237
+ };
238
+ const emitEvent = async (menu: FormMenu, clickEvent: Event | MouseEvent) => {
168
239
  if (menu.action == "delete") {
169
240
  confirm.require({
170
241
  target: clickEvent.target as HTMLElement,
@@ -172,13 +243,15 @@ const emitEvent = async (menu: FormMenu, clickEvent: MouseEvent) => {
172
243
  message: `${t("deleteThisRecord?")}`,
173
244
 
174
245
  // icon: "pi pi-exclamation-triangle gap-4",
175
- acceptClass: "p-button-danger",
246
+ acceptClass: "bg-danger-600 text-white",
176
247
  accept: async () => {
177
248
  if (await deleteData()) emits("on", FormCrudEvent.delete);
178
249
  },
179
250
  });
180
251
  } else {
181
- if (menu.action == "create") {
252
+ if (menu.action == "print") {
253
+ showPrintFormats();
254
+ } else if (menu.action == "create") {
182
255
  if (await createData()) emits("on", FormCrudEvent.create);
183
256
  } else if (menu.action == "update") {
184
257
  if (await updateData()) emits("on", FormCrudEvent.update);
@@ -214,6 +287,7 @@ const getDocActions = () => {
214
287
  const showMenuButton = (menu: FormMenu) => {
215
288
  if (menu.separator) return true;
216
289
 
290
+ if (menu.action == "print") return true;
217
291
  //all document status cannot direct apply regardless new or draft
218
292
  if (menu.type == "docstatus") return true;
219
293
 
@@ -262,3 +336,13 @@ const getActionIcon = (actionName: string) => {
262
336
  return `pi ${icon}`;
263
337
  };
264
338
  </script>
339
+ <style>
340
+ .vue-pdf-embed {
341
+ @apply p-4;
342
+ }
343
+ .vue-pdf-embed > div {
344
+ @apply mb-4;
345
+ /* margin-bottom: 8px;
346
+ box-shadow: 0 2px 8px 4px rgba(0, 0, 0, 0.1); */
347
+ }
348
+ </style>
@@ -134,6 +134,23 @@
134
134
  @change="onChange"
135
135
  />
136
136
 
137
+
138
+ <MultiSelect
139
+ v-model="modelValue"
140
+ :pt="pt"
141
+ v-else-if="SimpleAppInputType.selectmultiple == inputType"
142
+ :inputId="slotprops.uuid"
143
+ :path="setting.instancepath"
144
+ :readonly="isReadonly"
145
+ class="w w-full lg:w-full"
146
+ :disabled="isReadonly"
147
+ :options="getListOptions()"
148
+ optionLabel="label"
149
+ optionValue="value"
150
+ :placeholder="placeholder"
151
+ v-bind="componentProps"
152
+ @change="onChange"
153
+ />
137
154
  <!-- radio component -->
138
155
  <div v-else-if="inputType == SimpleAppInputType.radio">
139
156
  <div v-for="(item, index) in getListOptions()">
@@ -236,7 +253,6 @@
236
253
  :class="!pt ? 'w-full flex flex-col' : ''"
237
254
  :inputId="slotprops.uuid"
238
255
  @update:modelValue="onChange"
239
-
240
256
  :path="setting.instancepath"
241
257
  v-bind="componentProps as InputNumber"
242
258
  :placeholder="placeholder"
@@ -288,6 +304,8 @@
288
304
  v-bind="componentProps as InputTextProps"
289
305
  />
290
306
  <!-- component require special treatment -->
307
+
308
+ <slot name="footer"></slot>
291
309
  </SimpleAppFieldContainer>
292
310
  </template>
293
311
 
@@ -443,10 +461,16 @@ const setFocus = (ev: any) => {
443
461
  };
444
462
 
445
463
  const getListOptions = () => {
446
- const options = [];
447
- if (props.setting.fieldsetting.enum) {
448
- for (let i = 0; i < props.setting.fieldsetting.enum.length; i++) {
449
- const v = props.setting.fieldsetting.enum[i];
464
+ const options = [];
465
+ const enumlist = props.setting.fieldsetting.type == 'array'
466
+ ? props.setting.fieldsetting.items.enum
467
+ : props.setting.fieldsetting.enum
468
+
469
+
470
+
471
+ if (enumlist) {
472
+ for (let i = 0; i < enumlist.length; i++) {
473
+ const v = enumlist[i];
450
474
  if (typeof v == "string") {
451
475
  options.push({ value: v, label: t(v) });
452
476
  } else {
@@ -523,7 +547,6 @@ onMounted(() => {
523
547
  });
524
548
 
525
549
  const onChange = () => {
526
- console.log("On change ", props.inputType)
527
550
  pt.value = undefined;
528
551
  resetcount.value++;
529
552
  emits("change", modelValue.value);
@@ -0,0 +1,13 @@
1
+ <template>
2
+ <div class="text-base font font-bold">
3
+ <slot name="default"></slot>
4
+ </div>
5
+ </template>
6
+ <script setup lang="ts">
7
+ /**
8
+ * This file was automatically generated by simpleapp generator during initialization. It is changable.
9
+ * --remove-this-line-to-prevent-override--
10
+ * last change 2024-04-24
11
+ * author: Ks Tan
12
+ */
13
+ </script>
@@ -33,8 +33,15 @@
33
33
  */
34
34
  import { ref } from "vue";
35
35
  import { AxiosResponse } from "axios";
36
+ import {EventType,NotificationStatus} from "~/types"
36
37
  const visible = ref(false);
37
- const data = ref({ tenantName: "" });
38
+ const data = ref({
39
+ tenantName: "",
40
+ timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
41
+ utcOffset: new Date().getTimezoneOffset()
42
+ });
43
+
44
+
38
45
 
39
46
  const createtitle = ref("Create My Company");
40
47
  const errCreateTenant = ref();
@@ -55,7 +62,16 @@ const createTenant = async () => {
55
62
  })
56
63
  .catch((err) => {
57
64
  errCreateTenant.value = err["message"];
58
- console.error("errCreateTenant", err);
65
+ console.error("errCreateTenant", err.response.data.data);
66
+
67
+ useNuxtApp().$event('Notification',{
68
+ documentName:'tenant',
69
+ status: NotificationStatus.error,
70
+ summary:t('createError'),
71
+ data:err.response?.data?.data
72
+
73
+ })
74
+
59
75
  })
60
76
  .finally(() => {
61
77
  onhold.value = false;
@@ -1,9 +1,11 @@
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-04-06
5
5
  * Author: Ks Tan
6
6
  */
7
+ let orgLogo = ""
8
+
7
9
  export const getUserStore = ()=>{
8
10
  const {$userstore} = useNuxtApp()
9
11
  return $userstore
@@ -12,7 +14,7 @@ export const reloadUserStore = async () =>{
12
14
  const {$userstore} = useNuxtApp()
13
15
  await $userstore.loadRemoteUserInfo()
14
16
  }
15
-
17
+ export const getCurrency = () =>getUserStore()?.currency ?? '$$'
16
18
  export const getUserProfile = () =>{
17
19
  const userstore = getUserStore()
18
20
 
@@ -36,4 +38,11 @@ export const canPerform = (resource:string,action:string):boolean =>{
36
38
  }
37
39
 
38
40
  export const getProfileEmail = () => getUserProfile()?.email
39
- export const getProfileFullName = () => getUserProfile()?.fullName
41
+ export const getProfileFullName = () => getUserProfile()?.fullName
42
+
43
+ export const refreshOrgLogo = async () => {
44
+ const logodata = await useNuxtApp().$OrganizationDoc().getApi().runGetlogo()
45
+ orgLogo = logodata.data
46
+ }
47
+ export const getOrgLogo = ()=> orgLogo
48
+ export const setOrgLogo = (str:string) => orgLogo = str
@@ -0,0 +1,30 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2024-04-20
5
+ * Author: Ks Tan
6
+ */
7
+
8
+ import { Channel } from "pusher-js"
9
+
10
+ let channels: {[key:string]:Channel} = {}
11
+
12
+ export const subscribeHotValueText=(eventName:string,callback:Function )=>{
13
+ const channelname = `[${getUserProfile()?.tenantId??0}]${eventName}`
14
+ channels[channelname]= useNuxtApp().$pusher.subscribe('text')
15
+ channels[channelname].bind(channelname,(msg:string)=>{
16
+ callback(msg)
17
+ })
18
+ }
19
+
20
+ export const subsribeHotValueJson=(eventName:string,callback:Function )=>{
21
+ const channelname = `[${getUserProfile()?.tenantId??0}]${eventName}`
22
+ channels[channelname]= useNuxtApp().$pusher.subscribe('json')
23
+ channels[channelname].bind(channelname,(jsondata:any)=>{
24
+ callback(jsondata)
25
+ })
26
+ }
27
+
28
+ export const clearChannel = () =>{
29
+ channels = {}
30
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator.
3
+ * --remove-this-line-to-prevent-override--
4
+ * last change 2023-10-28
5
+ * Author: Ks Tan
6
+ */
7
+
8
+ export const activatePusher =()=>{
9
+ clearChannel()
10
+ subscribeHotValueText(`messages:${getUserProfile()?.uid}`,async (msg:string)=>{
11
+ refreshDocumentList('systemmessage')
12
+ })
13
+ }
@@ -6,9 +6,9 @@
6
6
  */
7
7
  import _ from 'lodash'
8
8
  import {Md5} from 'ts-md5'
9
- import moment from "moment";
10
9
  import { v4 as uuidv4 } from 'uuid';
11
10
 
11
+ let orgLogo = ""
12
12
  export const camelCaseToWords = (s: string) =>{
13
13
  const result = s.replace(/([A-Z])/g, ' $1');
14
14
  return result.charAt(0).toUpperCase() + result.slice(1);
@@ -18,8 +18,7 @@ export const randomUUID = ()=> uuidv4()
18
18
  export const md5=(s:string)=> new Md5().appendStr(s).end()
19
19
 
20
20
  export const getAvatarLink = (email:string, size:number):string=>{
21
- return `https://api.simbiz.cloud/cloudapi/avatar/${md5(email)}?size=${size}`
22
-
21
+ return `https://api.simbiz.cloud/cloudapi/avatar/${md5(email)}?size=${size}`
23
22
  }
24
23
 
25
24
  export const t = (txt:string,options?:any):string => !txt || txt.trim()=='' ? '' : useNuxtApp().$i18n.t(txt,options)
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2024-03-24
5
+ * Author: Ks Tan
6
+ */
7
+ import { Systemmessage } from "~/simpleapp/generate/openapi";
8
+
9
+ let messages = ref<Systemmessage[]>([])
10
+ export const systemMsgQty = computed(()=>messages.value.filter(item=>!item.read).length)
11
+ export const sysMessage ={
12
+ download: async ()=> {
13
+ messages.value = await useNuxtApp().$SystemmessageDoc().search({})
14
+ console.log("Download messages",messages)
15
+ return messages.value
16
+ },
17
+ getMessages: () => messages.value
18
+ }
19
+
20
+
@@ -1,13 +1,18 @@
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-24
5
5
  * Author: Ks Tan
6
6
  */
7
- import {UserTaskType} from '../types'
7
+ // import {UserTaskApiSchema} from
8
+ // import {UserTaskType} from '../types'
9
+
10
+ import { UserTaskApiSchema } from "~/simpleapp/generate/openapi"
11
+ let taskslist:UserTaskApiSchema[] =[]
12
+
8
13
  export const getTaskList = async ()=>{
9
- const tasks = await getWorkflowApi().getMyUserTask()
10
- return tasks.data as UserTaskType[]
14
+ const tmp = await getWorkflowApi().getMyUserTask()
15
+ return taskslist
11
16
  }
12
17
 
13
18
  export const getTaskForm = async (workflowName:string,elementId:string)=>{
@@ -1,72 +1,61 @@
1
1
  <template>
2
- <div class="h-screen flex flex-col">
2
+ <div class="h-screen flex flex-col ">
3
3
 
4
4
  <div class="flex flex-col grow overflow-y-auto">
5
5
  <div class="flex flex-col mb-14 w-full">
6
- <slot></slot>
7
- </div>
8
-
9
-
6
+ <ListMessages v-model="messagesVisible"/>
7
+ <UserInvitation/>
8
+ <slot></slot>
9
+ </div>
10
10
  </div>
11
11
  <!-- fixed -->
12
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-900 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>
13
+ <div v-if="getUserProfile()?.currentGroup=='teacher'" class="flex flex-row">
14
+ <NuxtLink :class="`pi pi-home p-4 cursor-pointer inline-block align-middle`" :to="getDocumentUrl('')" />
15
+ <ButtonText class="cursor-pointer inline-block align-middle" @click="openMessages">
16
+ <i class="pi pi-envelope p-1" ></i>
17
+ <Badge v-if="systemMsgQty" class="-ml-4" :value="systemMsgQty"></Badge>
18
+ </ButtonText>
19
+ <ButtonText :class="`pi pi-user p-4 cursor-pointer inline-block align-middle`" @click="openProfile"/>
20
+ </div>
21
+ <div v-else class="flex flex-row">
22
+ <NuxtLink :class="`pi pi-home p-4 cursor-pointer inline-block align-middle`" :to="getDocumentUrl('')" />
23
+
24
+ <ButtonText :class="`pi pi-bars p-4 cursor-pointer inline-block align-middle`" @click="openMenu"/>
25
+ <ButtonText class="cursor-pointer inline-block align-middle" @click="openMessages">
26
+ <i class="pi pi-envelope p-1" ></i>
27
+ <Badge v-if="systemMsgQty" class="-ml-4" :value="systemMsgQty"></Badge>
28
+ </ButtonText>
29
+ <ButtonText :class="`pi pi-user p-4 cursor-pointer inline-block align-middle`" @click="openProfile"/>
22
30
  </div>
23
31
 
24
32
  <HeaderButtonMenuPicker v-model="showMenu"></HeaderButtonMenuPicker>
25
33
  <HeaderButtonProfile v-model="showProfile"/>
26
34
 
27
35
  </div>
28
- <UserInvitation/>
36
+
37
+
29
38
  <!-- <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
39
 
31
40
  </div>
41
+
32
42
  </template>
33
43
  <script setup lang="ts">
34
44
  /**
35
45
  * This file was automatically generated by simpleapp generator during initialization. It is changable.
36
- * last change 2024-02-22
46
+ * last change 2024-04-10
37
47
  * author: Ks Tan
38
48
  */
39
49
  const showMenu =ref(false)
40
50
  const showProfile =ref(false)
41
-
51
+ const messagesVisible = ref(false)
42
52
  const openMenu = ()=>showMenu.value=true
43
53
  const openProfile = ()=>showProfile.value=true
54
+ const openMessages=() => messagesVisible.value = true
55
+
56
+
44
57
  type MenuType = {iconClass:string,path?:string,command?:Function}
45
- type AllMenus = {[key:string]:MenuType[]}
46
- const menus=ref<MenuType[]>([])
47
- // {iconClass:'pi-bars',path:'managestudents/profile'},
48
- const allmenus:AllMenus = {
49
- admin:[
50
- {iconClass:'pi-home dark:text-white',path:''},
51
- //{iconClass:'pi-users dark:text-white',path:'managestudents'},
52
- //{iconClass:'pi-calendar dark:text-white',path:`manageclasses`},
53
- {iconClass:'pi-bars dark:text-white',command: openMenu},
54
- {iconClass:'pi-user dark:text-white',command: openProfile},
55
- ],
56
- teacher: [{iconClass:'pi-home dark:text-white',path:''},
57
- {iconClass:'pi-user dark:text-white',command: openProfile},],
58
- unknown:[]
59
- }
60
58
 
61
- const readGroup=()=>{
62
- if(getUserProfile()?.currentGroup) {
63
- menus.value = allmenus[getUserProfile()?.currentGroup ?? 'unknown']
64
- }
65
- }
66
59
 
67
- onMounted(()=>{
68
- readGroup()
69
- useNuxtApp().$listen('pickGroup',()=>readGroup())
70
- })
71
60
 
72
- </script>
61
+ </script>
@@ -1,6 +1,6 @@
1
1
  /**
2
- * This file was automatically generated by simpleapp generator. Every
3
- * MODIFICATION OVERRIDE BY GENERATEOR
2
+ * This file was automatically generated by simpleapp generator.
3
+ * --remove-this-line-to-prevent-override--
4
4
  * last change 2023-10-28
5
5
  * Author: Ks Tan
6
6
  */