@simitgroup/simpleapp-generator 1.5.1-alpha → 1.6.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) 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 +3 -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 +3 -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/resolver.ts.eta +1 -1
  51. package/templates/basic/nest/service.ts.eta +22 -4
  52. package/templates/basic/nest/type.ts.eta +2 -2
  53. package/templates/basic/nuxt/pages.form.vue.eta +1 -1
  54. package/templates/basic/nuxt/pages.mobile.landing.vue.eta +4 -61
  55. package/templates/nest/src/printapi/api/.gitignore.eta +4 -0
  56. package/templates/nest/src/printapi/api/.npmignore.eta +1 -0
  57. package/templates/nest/src/printapi/api/.openapi-generator/FILES.eta +8 -0
  58. package/templates/nest/src/printapi/api/.openapi-generator/VERSION.eta +1 -0
  59. package/templates/nest/src/printapi/api/.openapi-generator-ignore.eta +23 -0
  60. package/templates/nest/src/printapi/api/api.ts.eta +223 -0
  61. package/templates/nest/src/printapi/api/base.ts.eta +86 -0
  62. package/templates/nest/src/printapi/api/common.ts.eta +150 -0
  63. package/templates/nest/src/printapi/api/configuration.ts.eta +110 -0
  64. package/templates/nest/src/printapi/api/git_push.sh.eta +57 -0
  65. package/templates/nest/src/printapi/api/index.ts.eta +18 -0
  66. package/templates/nest/src/printapi/api/openapitools.json.eta +7 -0
  67. package/templates/nest/src/printapi/printapi.module.ts.eta +15 -0
  68. package/templates/nest/src/printapi/printapi.service.ts.eta +42 -0
  69. package/templates/nest/src/simpleapp/apischemas/index.ts._eta +11 -0
  70. package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +7 -0
  71. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +9 -9
  72. package/templates/nest/src/simpleapp/generate/processors/autoinc.processor.ts.eta +73 -0
  73. package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +104 -0
  74. package/templates/nest/src/simpleapp/generate/processors/docno.processor.ts.eta +77 -0
  75. package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +115 -0
  76. package/templates/nest/src/simpleapp/generate/processors/perm.processor.ts.eta +71 -0
  77. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +29 -9
  78. package/templates/nest/src/simpleapp/generate/processors/sysmsg.processor.ts.eta +49 -0
  79. package/templates/nest/src/simpleapp/generate/processors/tenant.processor.ts.eta +52 -0
  80. package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +10 -3
  81. package/templates/nest/src/simpleapp/generate/workflow/workflow.controller.ts.eta +2 -2
  82. package/templates/nest/src/simpleapp/generate/workflow/workflow.delegate.ts.eta +33 -28
  83. package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +95 -26
  84. package/templates/nest/src/simpleapp/generate/workflow/workflow.type.ts.eta +4 -4
  85. package/templates/nest/src/simpleapp/services/sysmsg.service.ts._etaxxx +43 -0
  86. package/templates/nest/src/simpleapp/services/userresolver.service.ts._eta +70 -0
  87. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +6 -2
  88. package/templates/nest/src/simpleapp/types/index.ts._eta +5 -0
  89. package/templates/nuxt/components/button/ButtonAction.vue._eta +11 -5
  90. package/templates/nuxt/components/form/{FormBranch.vue.eta → FormBranch.vue._eta} +1 -1
  91. package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +38 -0
  92. package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +40 -0
  93. package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +147 -0
  94. package/templates/nuxt/components/list/ListItem.vue.eta +24 -0
  95. package/templates/nuxt/components/list/ListMessages.vue.eta +89 -0
  96. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +1 -1
  97. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +93 -7
  98. package/templates/nuxt/components/text/TextBold.vue._eta +13 -0
  99. package/templates/nuxt/composables/getUserStore.generate.ts.eta +11 -2
  100. package/templates/nuxt/composables/hotvalue.generate.ts.eta +30 -0
  101. package/templates/nuxt/composables/pusher.ts._eta +13 -0
  102. package/templates/nuxt/composables/stringHelper.generate.ts.eta +2 -3
  103. package/templates/nuxt/composables/sysmessage.generate.ts.eta +20 -0
  104. package/templates/nuxt/composables/workflow.generate.ts.eta +9 -4
  105. package/templates/nuxt/layouts/mobile.vue._eta +31 -42
  106. package/templates/nuxt/nuxt.config.ts._eta +2 -2
  107. package/templates/nuxt/othermodules.d.ts.eta +449 -0
  108. package/templates/nuxt/pages/[xorg]/mobile/organization/[id].vue._eta +40 -0
  109. package/templates/nuxt/pages/[xorg]/mobile/organization/{index.vue.eta → index.vue.aetaz} +16 -13
  110. package/templates/nuxt/pages/[xorg]/organization.vue.eta +21 -15
  111. package/templates/nuxt/plugins/40.pusher.ts.eta +18 -0
  112. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +7 -1
  113. package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +4 -1
  114. package/templates/nuxt/types/schema.ts.eta +8 -1
  115. package/templates/nuxt/types/simpleappinput.ts.eta +3 -5
  116. package/templates/printformats/template.jrxml._eta +27 -0
  117. package/templates/project/groups/admin.json.eta +6 -1
  118. package/templates/project/jsonschemas/branch.json._eta +113 -0
  119. package/templates/project/jsonschemas/invoice.json._eta +5 -1
  120. package/templates/project/jsonschemas/organization.json._eta +111 -0
  121. package/templates/project/lang/default._json +70 -150
  122. package/templates/workflow/next/listener.ts.eta +6 -3
  123. package/tsconfig.tsbuildinfo +1 -1
  124. /package/templates/nest/src/simpleapp/services/{autoinc.service.ts.eta → autoinc.service.ts.etaxx} +0 -0
  125. /package/templates/nest/src/simpleapp/services/{branch.service.ts.eta → branch.service.ts.etaxxx} +0 -0
  126. /package/templates/nest/src/simpleapp/services/{docno.service.ts.eta → docno.service.ts.etaxxx} +0 -0
  127. /package/templates/nest/src/simpleapp/services/{org.service.ts.eta → org.service.ts.etaxxx} +0 -0
  128. /package/templates/nest/src/simpleapp/services/{perm.service.ts.eta → perm.service.ts.etaxxx} +0 -0
  129. /package/templates/nest/src/simpleapp/services/{tenant.service.ts.eta → tenant.service.ts.etaxxx} +0 -0
@@ -0,0 +1,147 @@
1
+ <template>
2
+ <button
3
+ @click="openUploadDialog"
4
+ :title="selectedBase64Img"
5
+ class="place-content-center image-to-base64-uploader rounded-lg border block"
6
+ >
7
+ <slot name="default">
8
+ <Image v-if="selectedBase64Img" :src="selectedBase64Img" />
9
+ <i v-else class="pi pi-upload text-3xl"></i>
10
+ </slot>
11
+
12
+ <Dialog
13
+ v-model:visible="dialogVisible"
14
+ header="Image Upload"
15
+ :pt="{ root: { class: 'w-4/5' } }"
16
+ >
17
+ <div class="upload-container">
18
+ <input
19
+ type="file"
20
+ ref="fileInput"
21
+ accept="image/*"
22
+ @change="handleImageUpload"
23
+ />
24
+ <div id="preview" v-if="scaledImage" class="w-7/8">
25
+ <Cropper
26
+ ref="cropperInstance"
27
+ :src="scaledImage"
28
+ :stencil-props="{ aspectRatio: 1 }"
29
+ :options="cropperOptions"
30
+ @change="changeChropper"
31
+ />
32
+ <!-- :maxWidth="50"
33
+ :maxHeight="50" -->
34
+ </div>
35
+ </div>
36
+ <template #footer>
37
+ <div class="flex flex-row gap-4">
38
+ <ButtonWarning @click="dialogVisible = false">{{
39
+ t("cancel")
40
+ }}</ButtonWarning>
41
+ <ButtonPrimary @click="confirm">{{ t("confirm") }}</ButtonPrimary>
42
+ </div>
43
+ </template>
44
+ </Dialog>
45
+ </button>
46
+ </template>
47
+
48
+ <script setup lang="ts">
49
+ /**
50
+ * This file was automatically generated by simpleapp generator during initialization.
51
+ * IT IS NOT CHANGABLE
52
+ * last change 2024-04-06
53
+ * author: Ks Tan
54
+ */
55
+ // Assuming the Dialog component and Cropper component are globally available or imported in a parent component
56
+ import { defineEmits } from "vue";
57
+ // import Cropper from 'cropperjs'; // Assuming CropperJS is installed using a package manager
58
+ import { Cropper } from "vue-advanced-cropper";
59
+ import "vue-advanced-cropper/dist/style.css";
60
+ const selectedBase64Img = ref("");
61
+ const cropedBase64Img = ref("");
62
+ const dialogVisible = ref(false);
63
+ const previewImage = ref<string | null>(null);
64
+ const scaledImage = ref<string | null>(null);
65
+ const image = ref<string | null>(null);
66
+
67
+ const emit = defineEmits<{
68
+ (event: "image-uploaded", imageData: string): void;
69
+ }>();
70
+
71
+ const openUploadDialog = () => {
72
+ dialogVisible.value = true;
73
+ };
74
+
75
+ const handleImageUpload = (event) => {
76
+ const file = event.target.files?.[0];
77
+ if (file) {
78
+ const reader = new FileReader();
79
+ reader.onload = (e) => {
80
+ const img = new Image();
81
+ img.onload = () => {
82
+ const maxWidth = 800; // Set your desired maximum width
83
+ const maxHeight = 600; // Set your desired maximum height
84
+ const scale = Math.min(maxWidth / img.width, maxHeight / img.height);
85
+ const scaledWidth = img.width * scale;
86
+ const scaledHeight = img.height * scale;
87
+
88
+ const canvas = document.createElement("canvas");
89
+ canvas.width = scaledWidth;
90
+ canvas.height = scaledHeight;
91
+ const ctx = canvas.getContext("2d");
92
+ ctx.drawImage(img, 0, 0, scaledWidth, scaledHeight);
93
+
94
+ scaledImage.value = canvas.toDataURL("image/jpeg"); // Replace with your preferred format
95
+ };
96
+ img.src = e.target.result;
97
+ };
98
+ reader.readAsDataURL(file);
99
+ }
100
+ };
101
+
102
+ // const handleImageUpload = (event) => {
103
+ // const file = event.target.files?.[0];
104
+ // if (file) {
105
+ // const reader = new FileReader();
106
+ // reader.onload = (e) => {
107
+ // previewImage.value = e.target.result as string;
108
+ // // Initialize Cropper instance automatically
109
+ // // if (cropperInstance.value) {
110
+ // // cropperInstance.value.replace(previewImage.value); // Update Cropper with new image
111
+ // // }
112
+ // };
113
+ // reader.readAsDataURL(file);
114
+ // }
115
+ // };
116
+ const changeChropper = (imageEvent: any) => {
117
+ // console.log('changeChropper',imageEvent)
118
+ // if(cropedBase64Img.value==''){
119
+ // cropedBase64Img.value = imageEvent.image.src
120
+ // }else{
121
+ // cropedBase64Img.value=''
122
+ // }
123
+ };
124
+ const cropperInstance = ref();
125
+ const cropperOptions = {
126
+ aspectRatio: 16 / 9, // Optional: Set aspect ratio for cropping
127
+ zoomable: true, // Optional: Allow zooming
128
+ movable: true, // Optional: Allow moving the crop area
129
+ viewMode: 1, // Optional: Set initial zoom level
130
+ };
131
+
132
+ const confirm = () => {
133
+ const imgevent = cropperInstance.value.getResult();
134
+ selectedBase64Img.value = imgevent.canvas.toDataURL("image/jpeg");
135
+ emit("image-uploaded", selectedBase64Img.value);
136
+
137
+ dialogVisible.value = false;
138
+ resetFileInput(); // Optional: Reset file input value
139
+ };
140
+
141
+ const resetFileInput = () => {
142
+ const fileInput = ref(null);
143
+ if (fileInput.value) {
144
+ fileInput.value = null;
145
+ }
146
+ };
147
+ </script>
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <div class="flex-col border-b border-gray-200 dark:border-gray-700 p-1">
3
+ <label class="dark:text-gray-400">
4
+ <slot name="label">
5
+ {{ label }}
6
+ </slot>
7
+ </label>
8
+ <div class="dark:text-white text-right">
9
+ <slot name="default">{{ value }}</slot>
10
+ </div>
11
+ </div>
12
+ </template>
13
+ <script lang="ts" setup>
14
+ /**
15
+ * This file was automatically generated by simpleapp generator. Every
16
+ * MODIFICATION OVERRIDE BY GENERATEOR
17
+ * last change 2023-04-24
18
+ * Author: Ks Tan
19
+ */
20
+ const props = defineProps<{
21
+ label?: string;
22
+ value?: string;
23
+ }>();
24
+ </script>
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <div>
3
+ <Sidebar v-model:visible="messagesvisible" :header="t('messages')">
4
+ <ListView :list="list" #default="{ item, index }" @click="openMessage">
5
+ <div class="flex flex-col">
6
+ <TextBold v-if="!item.read">{{ item.messageTitle }}</TextBold>
7
+ <TextSubtitle v-else>{{ item.messageTitle }}</TextSubtitle>
8
+ <TextSubtitle class="text-xs"><RendererDateTime class="text-sm" v-model="item.created" /></TextSubtitle>
9
+ <TextSubtitle class="text-sm line-clamp-2">{{
10
+ item.description
11
+ }}</TextSubtitle>
12
+ </div>
13
+ </ListView>
14
+ <Dialog v-model:visible="viewmsg" :header="selectedMsg?.messageTitle">
15
+ <template #default>
16
+ <div v-if="selectedMsg" class="flex flex-col w-full">
17
+ <TextSubtitle class="text-sm"
18
+ ><RendererDateTime v-model="selectedMsg.created"></RendererDateTime
19
+ ></TextSubtitle>
20
+ <div class="whitespace-pre-line">{{ selectedMsg?.description}}</div>
21
+ </div>
22
+ <div v-else>
23
+ <TextDanger>{{ t("cannotObtainMessage") }}</TextDanger>
24
+ </div>
25
+ </template>
26
+ <template #footer>
27
+ <ButtonPrimary @click="viewmsg=false">{{t('close')}}</ButtonPrimary>
28
+ <ButtonDanger @click="deleteMsg">{{t('delete')}}</ButtonDanger>
29
+ </template>
30
+ </Dialog>
31
+ <ConfirmPopup></ConfirmPopup>
32
+ </Sidebar>
33
+ </div>
34
+ </template>
35
+ <script setup lang="ts">
36
+ // import { sysMessage } from "~/composables/messages.generate";
37
+ import { Systemmessage } from "~/simpleapp/generate/openapi";
38
+ import { useConfirm } from "primevue/useconfirm";
39
+ import ButtonDanger from "../button/ButtonDanger.vue";
40
+ const confirm = useConfirm();
41
+ const list = ref<Systemmessage[]>();
42
+ const viewmsg = ref(false);
43
+ const selectedMsg = ref<Systemmessage>();
44
+ const selectedIndex = ref(0)
45
+ const messagesvisible = defineModel<boolean>({ required: true });
46
+
47
+ const openMessage = async (index: number, item: Systemmessage) => {
48
+ selectedMsg.value = await useNuxtApp().$SystemmessageDoc().runReadmsg(item?._id??'')
49
+ selectedIndex.value = index
50
+ const rowIndex = list.value?.findIndex(listitem=>listitem._id == item._id) ?? -1
51
+ if(list.value && rowIndex >=0 )list.value[rowIndex].read=true
52
+ console.log("selectedMsg.value",selectedMsg.value)
53
+ viewmsg.value=true
54
+
55
+ };
56
+ const deleteMsg = async (clickEvent:MouseEvent) =>{
57
+
58
+ confirm.require({
59
+ target: clickEvent.target as HTMLElement,
60
+ header: t("deleteRecord"),
61
+ message: `${t("deleteThisRecord?")}`,
62
+
63
+ // icon: "pi pi-exclamation-triangle gap-4",
64
+ acceptClass: "p-button-danger",
65
+ accept: async () => {
66
+ const id = selectedMsg.value?._id ??''
67
+ const deleteresult = await useNuxtApp().$SystemmessageDoc().delete(id)
68
+ if(deleteresult) {
69
+ viewmsg.value = false
70
+ list.value?.splice(selectedIndex.value,1)
71
+ }
72
+ },
73
+ });
74
+
75
+
76
+
77
+ }
78
+ const refresh = async ()=>{
79
+ list.value = await sysMessage.download()
80
+ }
81
+ onMounted(async () => {
82
+ await refresh()
83
+ listenDocumentList('systemmessage',()=>{
84
+ refresh()
85
+ })
86
+ });
87
+
88
+
89
+ </script>
@@ -46,7 +46,7 @@
46
46
  </template>
47
47
  <template #option="{ index, option }">
48
48
  <slot name="option" :index="index" :option="option">
49
- <div class="flex flex-row dark:text-white">
49
+ <div class="flex flex-row text-white">
50
50
  <div class="w w-1/3">{{ option.code }}</div>
51
51
  <div class="w w-2/3">{{ option.label }}</div>
52
52
  </div>
@@ -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
+
88
+ <TextDanger v-if="printservererror || !printstr">
89
+ {{ t("printServerError") }}
90
+ </TextDanger>
91
+ <vue-pdf-embed v-else-if="isMobile()"
92
+ :source="printstr"
93
+ :disableTextLayer="true"
94
+ />
95
+ <iframe v-else width="100%" height="100%" :src="printstr"></iframe>
96
+
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,27 @@ 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 =
194
+ "data:application/pdf;base64," +
195
+ tmp.data;
196
+ } catch (e) {
197
+ printservererror.value = true;
198
+ printstr.value = "";
199
+ console.error("error from print server", e);
200
+ }
201
+ };
145
202
  const getActions = () => {
146
203
  const actions = doc.getActions();
204
+ const printformats = doc.getSchema()["x-simpleapp-config"]?.printFormats;
147
205
  const crudmenus: any[] = [];
148
206
 
149
207
  // Object.keys(actions).forEach((key)=>{ //crud, api, docstatus
@@ -160,11 +218,26 @@ const getActions = () => {
160
218
  });
161
219
  }
162
220
  });
221
+ if (printformats && printformats.length > 0) {
222
+ crudmenus.push({
223
+ action: "print",
224
+ label: t("print"),
225
+ type: "crud",
226
+ icon: "pi pi-print",
227
+ command: showPrintFormats,
228
+ });
229
+ }
230
+ console.log("crudmenus", crudmenus);
231
+
163
232
  // })
164
233
  return crudmenus;
165
234
  };
166
235
 
167
- const emitEvent = async (menu: FormMenu, clickEvent: MouseEvent) => {
236
+ const showPrintFormats = () => {
237
+ visiblePrintFormats.value = true;
238
+ // console.log("showPrintFormatContext",itemEvent)
239
+ };
240
+ const emitEvent = async (menu: FormMenu, clickEvent: Event | MouseEvent) => {
168
241
  if (menu.action == "delete") {
169
242
  confirm.require({
170
243
  target: clickEvent.target as HTMLElement,
@@ -178,7 +251,9 @@ const emitEvent = async (menu: FormMenu, clickEvent: MouseEvent) => {
178
251
  },
179
252
  });
180
253
  } else {
181
- if (menu.action == "create") {
254
+ if (menu.action == "print") {
255
+ showPrintFormats();
256
+ } else if (menu.action == "create") {
182
257
  if (await createData()) emits("on", FormCrudEvent.create);
183
258
  } else if (menu.action == "update") {
184
259
  if (await updateData()) emits("on", FormCrudEvent.update);
@@ -214,6 +289,7 @@ const getDocActions = () => {
214
289
  const showMenuButton = (menu: FormMenu) => {
215
290
  if (menu.separator) return true;
216
291
 
292
+ if (menu.action == "print") return true;
217
293
  //all document status cannot direct apply regardless new or draft
218
294
  if (menu.type == "docstatus") return true;
219
295
 
@@ -262,3 +338,13 @@ const getActionIcon = (actionName: string) => {
262
338
  return `pi ${icon}`;
263
339
  };
264
340
  </script>
341
+ <style>
342
+ .vue-pdf-embed {
343
+ @apply p-4
344
+ }
345
+ .vue-pdf-embed > div {
346
+ @apply mb-4;
347
+ /* margin-bottom: 8px;
348
+ box-shadow: 0 2px 8px 4px rgba(0, 0, 0, 0.1); */
349
+ }
350
+ </style>
@@ -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>
@@ -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
@@ -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)=>{