@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
@@ -0,0 +1,40 @@
1
+ <template>
2
+ <ImageToBase64Uploader
3
+ v-if="changable"
4
+ #default
5
+ class="w-20 h-20 place-content-center"
6
+ @image-uploaded="handleBase64"
7
+ >
8
+ <Image :src="imageData"></Image>
9
+ </ImageToBase64Uploader>
10
+ <div v-else class="inline-block border rounded-lg w-20 h-20">
11
+ <Image :src="imageData"></Image>
12
+ </div>
13
+ </template>
14
+ <script lang="ts" setup>
15
+ // import {KeyValue} from ''
16
+ const props = defineProps<{
17
+ changable: boolean;
18
+ }>();
19
+ const imageData = ref("");
20
+ const handleBase64 = async (data: string) => {
21
+ const keyvalue = {
22
+ key: "organizationLogo",
23
+ value: data,
24
+ };
25
+
26
+ const uploadok = await useNuxtApp()
27
+ .$OrganizationDoc()
28
+ .getApi()
29
+ .runUploadlogo(keyvalue);
30
+ if (uploadok) {
31
+ await loadLogo();
32
+ }
33
+ };
34
+ const loadLogo = async () => {
35
+ await refreshOrgLogo();
36
+ imageData.value = getOrgLogo();
37
+ };
38
+
39
+ onMounted(async () => await loadLogo());
40
+ </script>
@@ -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>
@@ -51,10 +51,7 @@
51
51
  index > 0 ? 'border-t-2' : ''
52
52
  }`"
53
53
  >
54
- <NuxtLink :to="getUrl(item)"
55
-
56
- class="p-2"
57
- >
54
+ <NuxtLink :to="getUrl(item)" :class="`p-2 ${showClickEffect ? 'listlink' :''}`">
58
55
  <slot name="default" :item="item" :index="index">
59
56
  <div class="flex flex-row">
60
57
  <div class="flex-1 mr-2 dark:text-white">
@@ -90,7 +87,7 @@
90
87
  */
91
88
  import { ref } from "vue";
92
89
  import { ListItem } from "~/types/listview";
93
- import _ from 'lodash'
90
+ import _ from "lodash";
94
91
  const listviewfilter = ref();
95
92
  const props = withDefaults(
96
93
  defineProps<{
@@ -102,6 +99,7 @@ const props = withDefaults(
102
99
  withFilter?: boolean;
103
100
  withAddNew?: boolean;
104
101
  showIndex?: boolean;
102
+ showClickEffect?:boolean
105
103
  }>(),
106
104
  {
107
105
  idField: "_id",
@@ -117,14 +115,13 @@ const clickRow = (item: ListItem) => {
117
115
  // emit('clickitem',item)
118
116
  // selecteditem.value = item.code
119
117
  };
120
- const getUrl = (item:any)=>{
121
- if(props.url && props.idField) {
122
- if(_.last(props.url)=='/') return `${props.url}${item[props.idField]}`
123
- else return `${props.url}/${item[props.idField]}`
124
- }
125
- else return undefined
118
+ const getUrl = (item: any) => {
119
+ if (props.url && props.idField) {
120
+ if (_.last(props.url) == "/") return `${props.url}${item[props.idField]}`;
121
+ else return `${props.url}/${item[props.idField]}`;
122
+ } else return undefined;
126
123
  // :to="url ? `${url}/${item[idField]}` : undefined"
127
- }
124
+ };
128
125
  const filterlist = computed(() => {
129
126
  let newlist: T[] = [];
130
127
  if (!Array.isArray(props.list)) {
@@ -1,10 +1,8 @@
1
1
  <template>
2
- <span v-if="typeof modelValue=='undefined' || typeof modelValue=='string' ">-</span>
3
- <span v-else-if="showCurrency">
4
- {{
5
- currenyValue
6
- }}</span
2
+ <span v-if="typeof modelValue == 'undefined' || typeof modelValue == 'string'"
3
+ >-</span
7
4
  >
5
+ <span v-else-if="showCurrency"> {{ currenyValue }}</span>
8
6
  <span v-else>
9
7
  {{ modelValue.toLocaleString(useI18n().defaultLocale, options) }}</span
10
8
  >
@@ -16,14 +14,14 @@
16
14
  * last change 2024-02-04
17
15
  * author: Ks Tan
18
16
  */
19
- const currenyValue = computed(()=>{
20
- if(modelValue.value === undefined) return '-'
17
+ const currenyValue = computed(() => {
18
+ if (modelValue.value === undefined) return "-";
21
19
  return Intl.NumberFormat(useI18n().defaultLocale, {
22
- // style: "currency",
23
- // currency: getUserProfile()?.currency ?? '',
24
- // currencyDisplay: "symbol",
25
- }).format(modelValue.value)
26
- })
20
+ // style: "currency",
21
+ // currency: getUserProfile()?.currency ?? '',
22
+ // currencyDisplay: "symbol",
23
+ }).format(modelValue.value);
24
+ });
27
25
  const options = {
28
26
  style: "decimal", // Other options: 'currency', 'percent', etc.
29
27
  minimumFractionDigits: 2,
@@ -31,4 +29,5 @@ const options = {
31
29
  };
32
30
  const modelValue = defineModel<number>({ required: true });
33
31
  const props = defineProps<{ showCurrency?: boolean }>();
32
+
34
33
  </script>
@@ -1,12 +1,36 @@
1
1
  <template>
2
- <Dropdown
3
- @update:modelValue="change"
4
- v-model="modelValue"
5
- :options="options"
6
- optionLabel="label"
7
- optionValue="value"
8
- :placeholder="placeholder"
9
- />
2
+ <div>
3
+ <div class="flex flex-row ">
4
+ <label v-if="!hideLabel" :for="fieldid" class="pt-2">
5
+ {{t(documentName)}}
6
+ </label>
7
+ <ButtonText v-if="allowAddNew" @click="addnew" class="text-xs text-blue-600">
8
+ <span>{{t('new')}}</span>
9
+ </ButtonText>
10
+ </div>
11
+ <MultiSelect
12
+ :input-id="fieldid"
13
+ v-if="multiple"
14
+ display="chip"
15
+ @update:modelValue="change"
16
+ v-model="modelValue"
17
+ :options="options"
18
+ optionLabel="label"
19
+ optionValue="value"
20
+ :placeholder="placeholder"
21
+ />
22
+ <Dropdown
23
+
24
+ :input-id="fieldid"
25
+ v-else
26
+ @update:modelValue="change"
27
+ v-model="modelValue"
28
+ :options="options"
29
+ optionLabel="label"
30
+ optionValue="value"
31
+ :placeholder="placeholder"
32
+ />
33
+ </div>
10
34
  </template>
11
35
  <script setup lang="ts">
12
36
  /**
@@ -18,15 +42,17 @@
18
42
  import Dropdown from "primevue/dropdown";
19
43
  import { ForeignKey, FormCrudEvent } from "~/types";
20
44
  const emits = defineEmits(["change"]);
21
- const modelValue = defineModel<string>();
45
+ const modelValue = defineModel<string | string[]>();
22
46
  const list = ref<ForeignKey[]>([]);
23
-
47
+ const fieldid = randomUUID()
24
48
  const props = defineProps<{
25
49
  documentName: string;
26
50
  placeholder?: string;
27
51
  showNull?: boolean;
28
52
  allowAddNew?: boolean;
29
- filter?: any
53
+ filter?: any;
54
+ multiple?: boolean;
55
+ hideLabel?:boolean
30
56
  }>();
31
57
  const options = ref<
32
58
  {
@@ -35,12 +61,12 @@ const options = ref<
35
61
  }[]
36
62
  >([]);
37
63
  const getListOptions = async () => {
38
- const filter = props.filter ?? {}
64
+ const filter = props.filter ?? {};
39
65
  const res = await getDocumentApi(props.documentName).autoComplete("", filter);
40
66
  list.value = res.data as ForeignKey[];
41
- if (props.allowAddNew)
42
- list.value.unshift({ _id: "new", code: "", label: t("addNew") });
43
- if (props.showNull)
67
+ // if (!props.multiple && props.allowAddNew)
68
+ // list.value.unshift({ _id: "new", code: "", label: t("addNew") });
69
+ if (!props.multiple && props.showNull)
44
70
  list.value.unshift({ _id: "", code: "", label: t("null") });
45
71
  options.value = list.value.map((item) => ({
46
72
  value: item._id,
@@ -55,7 +81,12 @@ const getItem = (id: string) => list.value?.find((item) => item._id == id);
55
81
 
56
82
  const change = (id: string) => {
57
83
  const selectedItem = getItem(id);
58
- if (selectedItem?._id == "new") {
84
+ emits("change", id, selectedItem);
85
+
86
+ };
87
+
88
+ const addnew=()=>{
89
+
59
90
  const doc = getDocument(props.documentName)?.docClass;
60
91
  if (doc) {
61
92
  const tmpdata = doc?.getReactiveData();
@@ -71,9 +102,7 @@ const change = (id: string) => {
71
102
  }
72
103
  },
73
104
  );
74
- }
75
- } else {
76
- emits("change", id, selectedItem);
105
+
77
106
  }
78
- };
107
+ }
79
108
  </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>
@@ -83,7 +83,7 @@
83
83
  </ButtonText>
84
84
  </template>
85
85
  <template #center>
86
- <TextTitle>{{ t(docname) }}</TextTitle>
86
+ <TextTitle class="text-white">{{ t(docname) }}</TextTitle>
87
87
  </template>
88
88
  <template #end>
89
89
  <div></div>
@@ -1,14 +1,16 @@
1
1
  <template>
2
2
  <div class="flex flex-col">
3
- <div class="flex flex-row">
4
- <div class="p-2 flex-1">
5
- <TextTitle v-if="title">{{ title }}</TextTitle>
6
- </div>
7
- <div class="pr-2">
8
- <ButtonDefault v-if="!readOnly" @click="addRow"
9
- ><i class="pi pi-plus"></i
10
- ></ButtonDefault>
11
- </div>
3
+ <div class="flex flex-row gap-2">
4
+
5
+ <TextTitle v-if="title" class="flex-1">{{ title }}</TextTitle>
6
+
7
+ <div class="flex flex-row"><slot name="buttons"></slot></div>
8
+
9
+ <div>
10
+ <ButtonDefault v-if="!readOnly" @click="addRow">
11
+ <i class="pi pi-plus"></i>
12
+ </ButtonDefault>
13
+ </div>
12
14
  </div>
13
15
  <ListView
14
16
  class="p-2 dark:bg-slate-900 bg-slate-200 rounded-lg"
@@ -61,10 +63,9 @@ const updateItem = () => {
61
63
  showDialog.value = false;
62
64
  emits("itemupdated", rowIndex.value);
63
65
  };
64
- const addRow = (event:MouseEvent) =>{
65
-
66
- emits('addrow', MouseEvent)
67
- const lineno = props.list.length -1
68
- showRow(lineno, props.list[lineno])
69
- }
66
+ const addRow = (event: MouseEvent) => {
67
+ emits("addrow", MouseEvent);
68
+ const lineno = props.list.length - 1;
69
+ showRow(lineno, props.list[lineno]);
70
+ };
70
71
  </script>