@simitgroup/simpleapp-generator 1.6.2-alpha → 1.6.4-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/dist/buildinschemas/branch.d.ts.map +1 -1
- package/dist/buildinschemas/branch.js +1 -2
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/changehistories.d.ts +3 -0
- package/dist/buildinschemas/changehistories.d.ts.map +1 -0
- package/dist/buildinschemas/changehistories.js +36 -0
- package/dist/buildinschemas/changehistories.js.map +1 -0
- package/dist/buildinschemas/index.d.ts +1 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +3 -1
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/organization.js +2 -2
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +5 -1
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/buildinschemas/webhook.d.ts +3 -0
- package/dist/buildinschemas/webhook.d.ts.map +1 -0
- package/dist/buildinschemas/webhook.js +33 -0
- package/dist/buildinschemas/webhook.js.map +1 -0
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +3 -2
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +30 -11
- package/dist/generate.js.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
- package/dist/processors/jsonschemabuilder.js +10 -2
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/type.d.ts +2 -0
- package/dist/type.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/branch.ts +1 -2
- package/src/buildinschemas/changehistories.ts +33 -0
- package/src/buildinschemas/index.ts +2 -1
- package/src/buildinschemas/organization.ts +2 -2
- package/src/buildinschemas/user.ts +5 -1
- package/src/buildinschemas/webhook.ts +31 -0
- package/src/framework.ts +3 -2
- package/src/generate.ts +35 -15
- package/src/index.ts +8 -3
- package/src/processors/jsonschemabuilder.ts +10 -2
- package/src/type.ts +2 -0
- package/templates/basic/nest/controller.ts.eta +23 -2
- package/templates/basic/nest/model.ts.eta +9 -1
- package/templates/basic/nest/resolver.ts.eta +2 -2
- package/templates/basic/nuxt/pages.[id].vue.eta +7 -7
- package/templates/basic/nuxt/pages.form.vue.eta +3 -6
- package/templates/basic/nuxt/pages.landing.vue.eta +2 -21
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +8 -1
- package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +2 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +9 -2
- package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +36 -30
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +5 -10
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +1 -0
- package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +50 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +13 -3
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +9 -1
- package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +12 -6
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +128 -14
- package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +3 -1
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +1 -0
- package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +19 -0
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +30 -8
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +2 -1
- package/templates/nuxt/{app.vue._eta → app.vue.eta} +3 -1
- package/templates/nuxt/assets/css/calendar.css._eta +3 -0
- package/templates/nuxt/assets/css/style.css._eta +1 -1
- package/templates/nuxt/assets/images/unknown.png.eta +0 -0
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +6 -1
- package/templates/nuxt/components/button/ButtonAction.vue._eta +49 -7
- package/templates/nuxt/components/button/ButtonDanger.vue._eta +11 -3
- package/templates/nuxt/components/button/ButtonDefault.vue._eta +11 -3
- package/templates/nuxt/components/button/ButtonPrimary.vue._eta +9 -3
- package/templates/nuxt/components/button/ButtonSecondary.vue._eta +33 -0
- package/templates/nuxt/components/button/ButtonText.vue._eta +9 -5
- package/templates/nuxt/components/button/ButtonWarning.vue._eta +11 -3
- package/templates/nuxt/components/calendar/CalendarInput.vue.eta +17 -14
- package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +33 -16
- package/templates/nuxt/components/chart/card.vue._eta +1 -1
- package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +36 -26
- package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +62 -22
- package/templates/nuxt/components/form/FormBranch.vue._eta +52 -5
- package/templates/nuxt/components/form/FormDocnoformat.vue.eta +14 -10
- package/templates/nuxt/components/form/FormUser.vue._eta +1 -1
- package/templates/nuxt/components/form/user/FormUserPermission.vue.eta +77 -59
- package/templates/nuxt/components/header/HeaderSelectBranch.vue.eta +42 -35
- package/templates/nuxt/components/image/ImageAvatar.vue.eta._vue +30 -0
- package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +7 -5
- package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +67 -50
- package/templates/nuxt/components/list/ListDocument.vue.eta +10 -5
- package/templates/nuxt/components/list/ListDocumentTable.vue.eta +21 -13
- package/templates/nuxt/components/list/ListMessages.vue.eta +1 -1
- package/templates/nuxt/components/list/ListView.vue.eta +94 -56
- package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +11 -4
- package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +17 -6
- package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +16 -6
- package/templates/nuxt/components/page/PageDocList.vue.eta +108 -31
- package/templates/nuxt/components/renderer/RendererDate.vue.eta +8 -2
- package/templates/nuxt/components/renderer/RendererDateTime.vue.eta +7 -1
- package/templates/nuxt/components/renderer/RendererDocHistories.vue.eta +56 -0
- package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +9 -8
- package/templates/nuxt/components/renderer/RendererLink.vue.eta +7 -4
- package/templates/nuxt/components/renderer/RendererMoney.vue.eta +25 -17
- package/templates/nuxt/components/renderer/RendererTime.vue.eta +7 -1
- package/templates/nuxt/components/renderer/RendererViewer.vue.eta +19 -9
- package/templates/nuxt/components/select/SelectTemplate.vue.eta +76 -38
- package/templates/nuxt/components/session/SessionBlock.vue.eta +44 -46
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +61 -24
- package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +64 -0
- package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +26 -14
- package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +8 -8
- package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +1 -1
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +128 -33
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +89 -168
- package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +43 -40
- package/templates/nuxt/components/simpleApp/SimpleAppUserPicker.vue.eta +387 -0
- package/templates/nuxt/components/text/TextDocStatus.vue._eta +22 -0
- package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +13 -15
- package/templates/nuxt/components/user/UserButtonPermissionInfo.vue.eta +127 -93
- package/templates/nuxt/components/user/UserTenantPicker.vue.eta +1 -1
- package/templates/nuxt/composables/confirm.generate.ts.eta +19 -0
- package/templates/nuxt/composables/date.generate.ts.eta +106 -8
- package/templates/nuxt/composables/getDocument.generate.ts.eta +8 -6
- package/templates/nuxt/composables/getOpenApi.generate.ts.eta +58 -10
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +37 -5
- package/templates/nuxt/composables/goTo.generate.ts.eta +14 -1
- package/templates/nuxt/composables/graphquery.generate.ts.eta +20 -2
- package/templates/nuxt/composables/recently.generate.ts.eta +16 -0
- package/templates/nuxt/composables/roles.generate.ts.eta +8 -13
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +54 -1
- package/templates/nuxt/composables/sysmessage.generate.ts.eta +1 -1
- package/templates/nuxt/pages/[xorg]/docnoformat.vue.eta +1 -1
- package/templates/nuxt/pages/[xorg]/mobile/docnoformat/{index.vue.eta → index.vue.etaxxx} +1 -1
- package/templates/nuxt/pages/[xorg]/mobile/user/{index.vue.eta → index.vue.etaxxx} +1 -1
- package/templates/nuxt/pages/[xorg]/{organization.vue.eta → organization.vue._eta} +39 -10
- package/templates/nuxt/pages/[xorg]/profile.vue.eta +1 -1
- package/templates/nuxt/pages/[xorg]/user.vue.eta +13 -10
- package/templates/nuxt/pages/login.vue._eta +4 -1
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +4 -0
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +45 -26
- package/templates/nuxt/plugins/70.recently.ts.eta +55 -0
- package/templates/nuxt/providers/my-provider.ts.eta +22 -0
- package/templates/nuxt/server/api/[xorg]/{[...].ts.eta → [...].ts._eta} +47 -21
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +44 -3
- package/templates/nuxt/types/events.ts.eta +3 -2
- package/templates/nuxt/types/others.ts.eta +11 -1
- package/templates/nuxt/types/schema.ts.eta +3 -1
- package/templates/nuxt/types/simpleappinput.ts.eta +1 -1
- package/templates/nuxt/types/user.ts.eta +8 -7
- package/templates/project/jsonschemas/branch.json._eta +1 -0
- package/templates/project/jsonschemas/invoice.json._eta +4 -3
- package/templates/project/jsonschemas/organization.json._eta +2 -2
- package/templates/project/lang/default._json +5 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +0 -38
- /package/templates/nuxt/pages/[xorg]/mobile/{index.vue._eta → index.vue._etaxxx} +0 -0
- /package/templates/nuxt/pages/[xorg]/mobile/organization/{[id].vue._eta → [id].vue._etaxxx} +0 -0
- /package/templates/nuxt/pages/[xorg]/mobile/{pickgroup.vue._eta → pickgroup.vue._etaxxx} +0 -0
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
<template #center>
|
|
12
12
|
<slot name="center" :menu="menu">
|
|
13
|
-
<
|
|
13
|
+
<TextMain class="text-white line-clamp-2">{{ title }}</TextMain>
|
|
14
14
|
</slot>
|
|
15
15
|
</template>
|
|
16
16
|
<template #end>
|
|
@@ -33,11 +33,17 @@
|
|
|
33
33
|
<ContextMenu ref="menu" :model="menus as MenuItem[]" />
|
|
34
34
|
</template>
|
|
35
35
|
</MobileToolbar>
|
|
36
|
-
<ConfirmDialog></ConfirmDialog>
|
|
37
36
|
</div>
|
|
38
37
|
<div v-else class="simpleapp-tool-bar">
|
|
39
|
-
<
|
|
40
|
-
<
|
|
38
|
+
<!-- <div class="flex flex-row justify-end p-2">
|
|
39
|
+
<TextTitle class="dark:text-white line-clamp-2 flex-1">{{
|
|
40
|
+
title
|
|
41
|
+
}}</TextTitle>
|
|
42
|
+
<ButtonText @click="callClose"><i class="pi pi-times" /></ButtonText>
|
|
43
|
+
</div> -->
|
|
44
|
+
<div class="flex flex-row gap-2 mb-2 p-0 justify-between">
|
|
45
|
+
<!-- left -->
|
|
46
|
+
<div class="flex flex-row gap-2">
|
|
41
47
|
<div v-for="(menu, index) in menus" :key="index">
|
|
42
48
|
<div v-if="menu.label && menu.type == 'crud'">
|
|
43
49
|
<ButtonAction
|
|
@@ -47,11 +53,16 @@
|
|
|
47
53
|
>
|
|
48
54
|
</div>
|
|
49
55
|
</div>
|
|
50
|
-
</
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<!-- center -->
|
|
59
|
+
<div class="flex flex-row"></div>
|
|
60
|
+
<!-- right -->
|
|
61
|
+
<div class="flex flex-row gap-2">
|
|
62
|
+
<DebugDocumentData v-model="data" :label="t(doc.getDocName())" />
|
|
63
|
+
<div v-if="data.documentStatus">
|
|
64
|
+
<RendererDocHistories :data="data" />
|
|
65
|
+
</div>
|
|
55
66
|
<div v-for="(menu, index) in menus" :key="index">
|
|
56
67
|
<div v-if="menu.label && menu.type == 'docstatus'">
|
|
57
68
|
<ButtonAction
|
|
@@ -61,11 +72,11 @@
|
|
|
61
72
|
>
|
|
62
73
|
</div>
|
|
63
74
|
</div>
|
|
64
|
-
</
|
|
65
|
-
</
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
66
77
|
<ConfirmPopup></ConfirmPopup>
|
|
67
78
|
</div>
|
|
68
|
-
<Dialog v-model:visible="visiblePrintFormats" :header="t('printFormats')">
|
|
79
|
+
<!-- <Dialog v-model:visible="visiblePrintFormats" :header="t('printFormats')">
|
|
69
80
|
<div>
|
|
70
81
|
<ListView
|
|
71
82
|
:list="printformats"
|
|
@@ -73,28 +84,73 @@
|
|
|
73
84
|
@click="printPdf"
|
|
74
85
|
>
|
|
75
86
|
<div class="flex flex-col">
|
|
76
|
-
<TextBold>{{ item.formatName }}</TextBold>
|
|
87
|
+
<TextBold>{{ t(item.formatName) }}</TextBold>
|
|
77
88
|
<TextSubtitle>{{ item.description }}</TextSubtitle>
|
|
78
89
|
</div>
|
|
79
90
|
</ListView>
|
|
80
91
|
</div>
|
|
81
|
-
</Dialog>
|
|
82
|
-
<
|
|
83
|
-
v-
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
</Dialog> -->
|
|
93
|
+
<OverlayPanelWithToolBar
|
|
94
|
+
v-if="visiblePrintPreview"
|
|
95
|
+
v-model="visiblePrintPreview"
|
|
96
|
+
close-event-name="closePrintPreview"
|
|
86
97
|
>
|
|
98
|
+
<template #headerLeft>
|
|
99
|
+
<ButtonText @click="visiblePrintPreview = false"
|
|
100
|
+
><i class="pi pi-times"
|
|
101
|
+
/></ButtonText>
|
|
102
|
+
</template>
|
|
103
|
+
<template #headerCenter>
|
|
104
|
+
<div class="flex flex-row gap-2 justify-center">
|
|
105
|
+
<Dropdown
|
|
106
|
+
:options="printformats"
|
|
107
|
+
option-label="formatName"
|
|
108
|
+
option-value="formatId"
|
|
109
|
+
v-model="currentprintformat"
|
|
110
|
+
@change="printPdf"
|
|
111
|
+
></Dropdown>
|
|
112
|
+
<ButtonPrimary @click="showPrintFormats"
|
|
113
|
+
><i class="pi pi-refresh"
|
|
114
|
+
/></ButtonPrimary>
|
|
115
|
+
</div>
|
|
116
|
+
</template>
|
|
117
|
+
<template #headerRight>
|
|
118
|
+
<div v-if="isMobile()">
|
|
119
|
+
<ButtonText class="text-xl" @click="sendToPrint">
|
|
120
|
+
<i class="pi pi-print"></i>
|
|
121
|
+
</ButtonText>
|
|
122
|
+
<ButtonText class="text-xl" v-if="sharable" @click="togglePdfMenu">
|
|
123
|
+
<i class="pi pi-ellipsis-v"></i>
|
|
124
|
+
</ButtonText>
|
|
125
|
+
</div>
|
|
126
|
+
<div v-else></div>
|
|
127
|
+
</template>
|
|
128
|
+
<!-- :header="t('printPreview')"
|
|
129
|
+
position="bottom" -->
|
|
130
|
+
<!-- {{pdfReady}} -->
|
|
131
|
+
|
|
132
|
+
<!-- <div v-if="!pdfReady">
|
|
133
|
+
<div class="flex flex-col justify-center">
|
|
134
|
+
<div class="pi pi-spin pi-spinner" style="font-size: 8rem"></div>
|
|
135
|
+
<div>{{ t("loading") + "..." }}</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div> -->
|
|
87
138
|
<TextDanger v-if="printservererror || !printstr">
|
|
88
139
|
{{ t("printServerError") }}
|
|
89
140
|
</TextDanger>
|
|
90
141
|
<vue-pdf-embed
|
|
142
|
+
ref="pdfrenderer"
|
|
91
143
|
class="w-11/12"
|
|
92
144
|
v-else-if="isMobile()"
|
|
93
145
|
:source="printstr"
|
|
94
146
|
:disableTextLayer="true"
|
|
147
|
+
@loading-failed="console.log"
|
|
148
|
+
@rendering-failed="console.log"
|
|
95
149
|
/>
|
|
96
|
-
<
|
|
97
|
-
|
|
150
|
+
<div class="p-0 w-full h-screen" v-else>
|
|
151
|
+
<iframe width="100%" height="100%" :src="printstr"></iframe>
|
|
152
|
+
</div>
|
|
153
|
+
</OverlayPanelWithToolBar>
|
|
98
154
|
</template>
|
|
99
155
|
<script setup lang="ts">
|
|
100
156
|
/**
|
|
@@ -110,22 +166,34 @@ import VuePdfEmbed from "vue-pdf-embed";
|
|
|
110
166
|
|
|
111
167
|
import { SimpleAppClient } from "~/simpleapp/generate/clients/SimpleAppClient";
|
|
112
168
|
import { useConfirm } from "primevue/useconfirm";
|
|
113
|
-
import {
|
|
169
|
+
import {
|
|
170
|
+
FormActions,
|
|
171
|
+
FormCrudEvent,
|
|
172
|
+
FormMenu,
|
|
173
|
+
SchemaPrintFormat,
|
|
174
|
+
} from "~/types";
|
|
175
|
+
import { DropdownChangeEvent } from "primevue/dropdown";
|
|
114
176
|
import { MenuItem } from "primevue/menuitem";
|
|
115
177
|
import { MenuItemCommandEvent } from "primevue/menuitem";
|
|
178
|
+
const currentprintformat = ref();
|
|
179
|
+
const pdfrenderer = ref();
|
|
116
180
|
const confirm = useConfirm();
|
|
117
181
|
const emits = defineEmits(["on", "close"]);
|
|
118
182
|
const visiblePrintFormats = ref(false);
|
|
119
183
|
const visiblePrintPreview = ref(false);
|
|
120
184
|
const printstr = ref();
|
|
121
185
|
const printservererror = ref(false);
|
|
186
|
+
const pdfReady = ref(false);
|
|
122
187
|
const props = defineProps<{
|
|
123
188
|
document: SimpleAppClient<any, any>;
|
|
124
189
|
disableaction?: string[];
|
|
125
190
|
}>();
|
|
191
|
+
const doc = props.document;
|
|
192
|
+
const data = doc.getReactiveData();
|
|
126
193
|
|
|
127
194
|
const createData = async () => {
|
|
128
195
|
try {
|
|
196
|
+
setRecentDocument(data.value._id,{docName:doc.getDocName(),label:title.value})
|
|
129
197
|
return await doc.create();
|
|
130
198
|
} catch (e) {
|
|
131
199
|
console.debug("validation error:", e);
|
|
@@ -133,6 +201,7 @@ const createData = async () => {
|
|
|
133
201
|
};
|
|
134
202
|
const updateData = async () => {
|
|
135
203
|
try {
|
|
204
|
+
setRecentDocument(data.value._id,{docName:doc.getDocName(),label:title.value})
|
|
136
205
|
return await doc.update();
|
|
137
206
|
} catch (e) {
|
|
138
207
|
console.debug("validation error:", e);
|
|
@@ -140,14 +209,13 @@ const updateData = async () => {
|
|
|
140
209
|
};
|
|
141
210
|
const deleteData = async () => {
|
|
142
211
|
try {
|
|
212
|
+
getRecently().delete(data.value._id)
|
|
143
213
|
return await doc.delete();
|
|
144
214
|
} catch (e) {
|
|
145
215
|
console.debug("validation error:", e);
|
|
146
216
|
}
|
|
147
217
|
};
|
|
148
218
|
|
|
149
|
-
const doc = props.document;
|
|
150
|
-
const data = doc.getReactiveData();
|
|
151
219
|
type Datatype = keyof typeof data.value;
|
|
152
220
|
const config = doc.getSchema()["x-simpleapp-config"];
|
|
153
221
|
const titlefield = (config.documentTitle ?? config.uniqueKey) as Datatype;
|
|
@@ -181,25 +249,36 @@ const emitMobileEvent = (itemevent: MenuItemCommandEvent) => {
|
|
|
181
249
|
emitEvent(itemevent.item, event);
|
|
182
250
|
};
|
|
183
251
|
|
|
184
|
-
const printPdf = async (
|
|
252
|
+
const printPdf = async (dropdown?: DropdownChangeEvent) => {
|
|
253
|
+
let index = 0;
|
|
254
|
+
|
|
255
|
+
if (printformats && printformats.length > 0 && dropdown !== undefined) {
|
|
256
|
+
index = printformats?.findIndex((item) => item.formatId == dropdown.value);
|
|
257
|
+
}
|
|
258
|
+
let format: SchemaPrintFormat = printformats[index];
|
|
185
259
|
printservererror.value = false;
|
|
186
260
|
const formatid: string = format.formatId;
|
|
261
|
+
currentprintformat.value = formatid;
|
|
187
262
|
visiblePrintPreview.value = true;
|
|
188
263
|
// console.log("formatidformatid", format);
|
|
264
|
+
// pdfReady.value=false
|
|
189
265
|
try {
|
|
190
266
|
const tmp: any = await doc
|
|
191
267
|
.getApi()
|
|
192
268
|
.runPrint(data.value._id ?? "", formatid);
|
|
269
|
+
// pdfReady.value=true
|
|
193
270
|
printstr.value = "data:application/pdf;base64," + tmp.data;
|
|
194
271
|
} catch (e) {
|
|
272
|
+
pdfReady.value = true;
|
|
195
273
|
printservererror.value = true;
|
|
196
|
-
printstr.value = "";
|
|
274
|
+
// printstr.value = "";
|
|
197
275
|
console.error("error from print server", e);
|
|
198
276
|
}
|
|
199
277
|
};
|
|
200
278
|
const getActions = () => {
|
|
201
279
|
const actions = doc.getActions();
|
|
202
|
-
const printformats = doc.getSchema()["x-simpleapp-config"]?.printFormats;
|
|
280
|
+
// const printformats = doc.getSchema()["x-simpleapp-config"]?.printFormats;
|
|
281
|
+
|
|
203
282
|
const crudmenus: any[] = [];
|
|
204
283
|
|
|
205
284
|
// Object.keys(actions).forEach((key)=>{ //crud, api, docstatus
|
|
@@ -219,21 +298,20 @@ const getActions = () => {
|
|
|
219
298
|
if (printformats && printformats.length > 0) {
|
|
220
299
|
crudmenus.push({
|
|
221
300
|
action: "print",
|
|
222
|
-
label: t("
|
|
301
|
+
label: t("preview"),
|
|
223
302
|
type: "crud",
|
|
224
|
-
icon: "pi pi-
|
|
303
|
+
icon: "pi pi-file-pdf",
|
|
225
304
|
command: showPrintFormats,
|
|
226
305
|
});
|
|
227
306
|
}
|
|
228
|
-
console.log("crudmenus", crudmenus);
|
|
307
|
+
// console.log("crudmenus", crudmenus);
|
|
229
308
|
|
|
230
309
|
// })
|
|
231
310
|
return crudmenus;
|
|
232
311
|
};
|
|
233
312
|
|
|
234
|
-
const showPrintFormats = () => {
|
|
235
|
-
|
|
236
|
-
// console.log("showPrintFormatContext",itemEvent)
|
|
313
|
+
const showPrintFormats = async () => {
|
|
314
|
+
await printPdf();
|
|
237
315
|
};
|
|
238
316
|
const emitEvent = async (menu: FormMenu, clickEvent: Event | MouseEvent) => {
|
|
239
317
|
if (menu.action == "delete") {
|
|
@@ -287,7 +365,7 @@ const getDocActions = () => {
|
|
|
287
365
|
const showMenuButton = (menu: FormMenu) => {
|
|
288
366
|
if (menu.separator) return true;
|
|
289
367
|
|
|
290
|
-
if (menu.action == "print") return true;
|
|
368
|
+
if (menu.action == "print" && !doc.isNew()) return true;
|
|
291
369
|
//all document status cannot direct apply regardless new or draft
|
|
292
370
|
if (menu.type == "docstatus") return true;
|
|
293
371
|
|
|
@@ -335,6 +413,23 @@ const getActionIcon = (actionName: string) => {
|
|
|
335
413
|
}
|
|
336
414
|
return `pi ${icon}`;
|
|
337
415
|
};
|
|
416
|
+
|
|
417
|
+
const sendToPrint = () => {
|
|
418
|
+
// window.print()
|
|
419
|
+
pdfrenderer.value.print();
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
const sharable = computed(() => typeof navigator.share != "undefined");
|
|
423
|
+
const togglePdfMenu = async () => {
|
|
424
|
+
const blob = await (await fetch(printstr.value)).blob();
|
|
425
|
+
const file = new File([blob], "fileName.pdf", { type: blob.type });
|
|
426
|
+
|
|
427
|
+
navigator.share({
|
|
428
|
+
title: "Title to be shared",
|
|
429
|
+
text: "Text to be shared",
|
|
430
|
+
files: [file],
|
|
431
|
+
});
|
|
432
|
+
};
|
|
338
433
|
</script>
|
|
339
434
|
<style>
|
|
340
435
|
.vue-pdf-embed {
|
|
@@ -34,71 +34,51 @@
|
|
|
34
34
|
v-bind="componentProps as InputSwitchProps"
|
|
35
35
|
@change="onChange"
|
|
36
36
|
/>
|
|
37
|
-
|
|
38
|
-
<InputText
|
|
39
|
-
type="date"
|
|
40
|
-
:pt="pt"
|
|
41
|
-
v-else-if="inputType == SimpleAppInputType.date"
|
|
42
|
-
:inputId="slotprops.uuid"
|
|
43
|
-
:path="setting.instancepath"
|
|
44
|
-
v-model="datevalue"
|
|
45
|
-
@update:modelValue="updateDate"
|
|
46
|
-
:readonly="isReadonly"
|
|
47
|
-
:placeholder="placeholder"
|
|
48
|
-
v-bind="componentProps as InputTextProps"
|
|
49
|
-
/> -->
|
|
37
|
+
|
|
50
38
|
<!-- calendar component -->
|
|
51
|
-
<
|
|
52
|
-
type="date"
|
|
53
|
-
:pt="pt"
|
|
39
|
+
<SimpleAppCalendarInput
|
|
54
40
|
v-else-if="
|
|
55
41
|
SimpleAppInputType.calendar == inputType ||
|
|
56
42
|
inputType == SimpleAppInputType.date
|
|
57
43
|
"
|
|
58
|
-
:
|
|
59
|
-
|
|
60
|
-
v-model="
|
|
61
|
-
|
|
62
|
-
:touchUI="isMobile()"
|
|
63
|
-
showButtonBar
|
|
64
|
-
:readonly="isReadonly"
|
|
44
|
+
:pt="pt"
|
|
45
|
+
type="date"
|
|
46
|
+
v-model="modelValue"
|
|
47
|
+
:uuid="slotprops.uuid"
|
|
65
48
|
:placeholder="placeholder"
|
|
66
|
-
:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
49
|
+
:setting="setting"
|
|
50
|
+
:readonly="isReadonly"
|
|
51
|
+
:componentProps="componentProps"
|
|
52
|
+
@change="onChange"
|
|
53
|
+
/>
|
|
54
|
+
|
|
70
55
|
<!-- time component -->
|
|
71
|
-
<
|
|
72
|
-
:pt="pt"
|
|
56
|
+
<SimpleAppCalendarInput
|
|
73
57
|
v-else-if="inputType == SimpleAppInputType.time"
|
|
74
|
-
timeOnly
|
|
75
|
-
showTime
|
|
76
|
-
hourFormat="12"
|
|
77
|
-
@update:modelValue="updateTime"
|
|
78
|
-
:inputId="slotprops.uuid"
|
|
79
|
-
:path="setting.instancepath"
|
|
80
|
-
v-model="timevalue"
|
|
81
|
-
:readonly="isReadonly"
|
|
82
|
-
:placeholder="placeholder"
|
|
83
|
-
v-bind="componentProps as CalendarProps"
|
|
84
|
-
/>
|
|
85
|
-
|
|
86
|
-
<Calendar
|
|
87
58
|
:pt="pt"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
:touchUI="isMobile()"
|
|
94
|
-
showButtonBar
|
|
59
|
+
type="time"
|
|
60
|
+
v-model="modelValue"
|
|
61
|
+
:uuid="slotprops.uuid"
|
|
62
|
+
:placeholder="placeholder"
|
|
63
|
+
:setting="setting"
|
|
95
64
|
:readonly="isReadonly"
|
|
65
|
+
:componentProps="componentProps"
|
|
66
|
+
@change="onChange"
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
<SimpleAppCalendarInput
|
|
70
|
+
v-else-if="inputType == SimpleAppInputType.datetime"
|
|
71
|
+
:pt="pt"
|
|
72
|
+
type="datetime"
|
|
73
|
+
v-model="modelValue"
|
|
74
|
+
:uuid="slotprops.uuid"
|
|
96
75
|
:placeholder="placeholder"
|
|
97
|
-
:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
76
|
+
:setting="setting"
|
|
77
|
+
:readonly="isReadonly"
|
|
78
|
+
:componentProps="componentProps"
|
|
79
|
+
@change="onChange"
|
|
80
|
+
/>
|
|
81
|
+
|
|
102
82
|
<!-- select/list component -->
|
|
103
83
|
<Listbox
|
|
104
84
|
v-model="modelValue"
|
|
@@ -134,7 +114,6 @@
|
|
|
134
114
|
@change="onChange"
|
|
135
115
|
/>
|
|
136
116
|
|
|
137
|
-
|
|
138
117
|
<MultiSelect
|
|
139
118
|
v-model="modelValue"
|
|
140
119
|
:pt="pt"
|
|
@@ -168,6 +147,31 @@
|
|
|
168
147
|
</div>
|
|
169
148
|
</div>
|
|
170
149
|
|
|
150
|
+
<SimpleAppUserPicker
|
|
151
|
+
v-else-if="inputType == SimpleAppInputType.user"
|
|
152
|
+
v-model="modelValue as autocompletetype"
|
|
153
|
+
:hidelabel="hidelabel"
|
|
154
|
+
:pt="pt"
|
|
155
|
+
:setting="setting"
|
|
156
|
+
:disabled="isReadonly"
|
|
157
|
+
:inputId="slotprops.uuid"
|
|
158
|
+
:path="setting.instancepath"
|
|
159
|
+
:readonly="isReadonly"
|
|
160
|
+
:placeholder="placeholder"
|
|
161
|
+
:autocompleteFilter="autocompleteFilter"
|
|
162
|
+
@change="onChange"
|
|
163
|
+
>
|
|
164
|
+
<template #header>
|
|
165
|
+
<slot name="header"></slot>
|
|
166
|
+
</template>
|
|
167
|
+
<template #content>
|
|
168
|
+
<slot name="content"></slot>
|
|
169
|
+
</template>
|
|
170
|
+
<template #option="{ index, option }">
|
|
171
|
+
<slot name="option" :index="index" :option="option"></slot>
|
|
172
|
+
</template>
|
|
173
|
+
</SimpleAppUserPicker>
|
|
174
|
+
|
|
171
175
|
<!-- autocomplete, need do more enterprise grade component-->
|
|
172
176
|
<SimpleAppAutocomplete
|
|
173
177
|
v-else-if="inputType == SimpleAppInputType.autocomplete"
|
|
@@ -182,7 +186,17 @@
|
|
|
182
186
|
:placeholder="placeholder"
|
|
183
187
|
:autocompleteFilter="autocompleteFilter"
|
|
184
188
|
@change="onChange"
|
|
185
|
-
|
|
189
|
+
>
|
|
190
|
+
<template #header>
|
|
191
|
+
<slot name="header"></slot>
|
|
192
|
+
</template>
|
|
193
|
+
<template #content>
|
|
194
|
+
<slot name="content"></slot>
|
|
195
|
+
</template>
|
|
196
|
+
<template #option="{ index, option }">
|
|
197
|
+
<slot name="option" :index="index" :option="option"></slot>
|
|
198
|
+
</template>
|
|
199
|
+
</SimpleAppAutocomplete>
|
|
186
200
|
<!-- v-bind:attributes="componentProps" -->
|
|
187
201
|
<!-- document no input-->
|
|
188
202
|
<SimpleAppDocumentNo
|
|
@@ -265,6 +279,8 @@
|
|
|
265
279
|
@focus="setFocus"
|
|
266
280
|
:max-fraction-digits="2"
|
|
267
281
|
:min-fraction-digits="2"
|
|
282
|
+
mode="currency"
|
|
283
|
+
:currency="getCurrency()"
|
|
268
284
|
:readonly="isReadonly"
|
|
269
285
|
:pt="pt"
|
|
270
286
|
:class="!pt ? 'w-full flex flex-col' : ''"
|
|
@@ -340,10 +356,8 @@ const resetcount = ref(0);
|
|
|
340
356
|
const instancepath = ref("");
|
|
341
357
|
const modelValue = defineModel({ required: true });
|
|
342
358
|
|
|
343
|
-
|
|
344
|
-
const
|
|
345
|
-
const timevalue = ref<Date>();
|
|
346
|
-
let watchOnChange = 0;
|
|
359
|
+
|
|
360
|
+
const watchOnChange = ref(false);
|
|
347
361
|
const props = withDefaults(
|
|
348
362
|
defineProps<{
|
|
349
363
|
inputType: SimpleAppInputType;
|
|
@@ -353,6 +367,7 @@ const props = withDefaults(
|
|
|
353
367
|
setting: any;
|
|
354
368
|
type?: string;
|
|
355
369
|
instancepath?: string;
|
|
370
|
+
options?: string[];
|
|
356
371
|
hidelabel?: boolean;
|
|
357
372
|
readonly?: boolean;
|
|
358
373
|
autofocus?: boolean;
|
|
@@ -373,26 +388,6 @@ const props = withDefaults(
|
|
|
373
388
|
|
|
374
389
|
const pt = ref(props.pt);
|
|
375
390
|
|
|
376
|
-
if (props.inputType == SimpleAppInputType.date && modelValue.value) {
|
|
377
|
-
datevalue.value = stringToDate(<string>modelValue.value); //.format("YYYY-MM-DD");
|
|
378
|
-
} else {
|
|
379
|
-
datevalue.value = undefined;
|
|
380
|
-
}
|
|
381
|
-
if (props.inputType == SimpleAppInputType.datetime && modelValue.value) {
|
|
382
|
-
datetimevalue.value = stringToDate(<string>modelValue.value);
|
|
383
|
-
} else {
|
|
384
|
-
datetimevalue.value = undefined;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
if (props.inputType == SimpleAppInputType.time) {
|
|
388
|
-
if (modelValue.value) {
|
|
389
|
-
timevalue.value = stringToDate(
|
|
390
|
-
(today() + "T" + modelValue.value) as string,
|
|
391
|
-
); //.format("YYYY-MM-DD");
|
|
392
|
-
} else {
|
|
393
|
-
timevalue.value = undefined;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
391
|
|
|
397
392
|
if (props?.instancepath) instancepath.value = props.instancepath;
|
|
398
393
|
else if (props.setting?.instancepath)
|
|
@@ -424,6 +419,8 @@ watch(props.setting.errors, (newvalue, oldvalue) => {
|
|
|
424
419
|
} else {
|
|
425
420
|
pt.value = props.pt;
|
|
426
421
|
}
|
|
422
|
+
|
|
423
|
+
watchOnChange.value = true;
|
|
427
424
|
});
|
|
428
425
|
const isReadonly = computed(() => {
|
|
429
426
|
if (props.readonly) {
|
|
@@ -434,39 +431,19 @@ const isReadonly = computed(() => {
|
|
|
434
431
|
return false;
|
|
435
432
|
}
|
|
436
433
|
});
|
|
437
|
-
|
|
438
|
-
value.setSeconds(0);
|
|
439
|
-
modelValue.value = dateToTimeString(value);
|
|
440
|
-
onChange();
|
|
441
|
-
};
|
|
442
|
-
const updateDate = (value: any) => {
|
|
443
|
-
if (value) {
|
|
444
|
-
modelValue.value = dateToString(value);
|
|
445
|
-
} else {
|
|
446
|
-
modelValue.value = "";
|
|
447
|
-
}
|
|
448
|
-
onChange();
|
|
449
|
-
};
|
|
450
|
-
const updateDateTime = (value: any) => {
|
|
451
|
-
if (value) {
|
|
452
|
-
modelValue.value = dateToISOString(value);
|
|
453
|
-
} else {
|
|
454
|
-
modelValue.value = "";
|
|
455
|
-
}
|
|
456
|
-
onChange();
|
|
457
|
-
};
|
|
434
|
+
|
|
458
435
|
|
|
459
436
|
const setFocus = (ev: any) => {
|
|
460
437
|
if (!isMobile()) ev.target.select();
|
|
461
438
|
};
|
|
462
439
|
|
|
463
440
|
const getListOptions = () => {
|
|
464
|
-
const options = [];
|
|
465
|
-
const enumlist =
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
441
|
+
const options = [];
|
|
442
|
+
const enumlist =
|
|
443
|
+
props.options ??
|
|
444
|
+
(props.setting.fieldsetting.type == "array"
|
|
445
|
+
? props.setting.fieldsetting.items.enum
|
|
446
|
+
: props.setting.fieldsetting.enum);
|
|
470
447
|
|
|
471
448
|
if (enumlist) {
|
|
472
449
|
for (let i = 0; i < enumlist.length; i++) {
|
|
@@ -487,69 +464,13 @@ const emits = defineEmits([
|
|
|
487
464
|
"update:docNoFormat",
|
|
488
465
|
]);
|
|
489
466
|
|
|
490
|
-
const getDateFormat = () => {
|
|
491
|
-
return getPrimevueCalendarDateFormat();
|
|
492
|
-
};
|
|
493
|
-
|
|
494
|
-
watch(modelValue, (newvalue: any) => {
|
|
495
|
-
if (
|
|
496
|
-
[SimpleAppInputType.date, SimpleAppInputType.calendar].includes(
|
|
497
|
-
props.inputType,
|
|
498
|
-
)
|
|
499
|
-
) {
|
|
500
|
-
if (modelValue.value) {
|
|
501
|
-
datevalue.value = stringToDate(modelValue.value as string);
|
|
502
|
-
} else {
|
|
503
|
-
timevalue.value = undefined;
|
|
504
|
-
}
|
|
505
|
-
} else if (props.inputType == SimpleAppInputType.datetime) {
|
|
506
|
-
if (modelValue.value) {
|
|
507
|
-
datetimevalue.value = stringToDate(modelValue.value as string);
|
|
508
|
-
} else {
|
|
509
|
-
timevalue.value = undefined;
|
|
510
|
-
}
|
|
511
|
-
} else if (props.inputType == SimpleAppInputType.time) {
|
|
512
|
-
if (modelValue.value) {
|
|
513
|
-
timevalue.value = stringToDate(
|
|
514
|
-
(today() + "T" + modelValue.value) as string,
|
|
515
|
-
);
|
|
516
|
-
} else {
|
|
517
|
-
timevalue.value = undefined;
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
});
|
|
521
|
-
onMounted(() => {
|
|
522
|
-
if (
|
|
523
|
-
[SimpleAppInputType.date, SimpleAppInputType.calendar].includes(
|
|
524
|
-
props.inputType,
|
|
525
|
-
)
|
|
526
|
-
) {
|
|
527
|
-
if (modelValue.value) {
|
|
528
|
-
datevalue.value = stringToDate(modelValue.value as string);
|
|
529
|
-
} else {
|
|
530
|
-
datevalue.value = undefined;
|
|
531
|
-
}
|
|
532
|
-
} else if (props.inputType == SimpleAppInputType.datetime) {
|
|
533
|
-
if (modelValue.value) {
|
|
534
|
-
datetimevalue.value = stringToDate(modelValue.value as string);
|
|
535
|
-
} else {
|
|
536
|
-
datetimevalue.value = undefined;
|
|
537
|
-
}
|
|
538
|
-
} else if (props.inputType == SimpleAppInputType.time) {
|
|
539
|
-
if (modelValue.value) {
|
|
540
|
-
timevalue.value = stringToDate(
|
|
541
|
-
(today() + "T" + modelValue.value) as string,
|
|
542
|
-
);
|
|
543
|
-
} else {
|
|
544
|
-
timevalue.value = undefined;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
});
|
|
548
467
|
|
|
549
468
|
const onChange = () => {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
469
|
+
if (props.setting.document.isReady()) {
|
|
470
|
+
pt.value = undefined;
|
|
471
|
+
resetcount.value++;
|
|
472
|
+
emits("change", modelValue.value);
|
|
473
|
+
}
|
|
553
474
|
};
|
|
554
475
|
|
|
555
476
|
/************ start autocomplete only ***************/
|