@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
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<title v-if="!id">{{ t(doc.getDocName()) }}</title>
|
|
3
|
+
|
|
3
4
|
<div v-if="isMobile()" class="w-full">
|
|
4
5
|
<div class="p-2 flex flex-row justify-end place-items-center h-14">
|
|
5
6
|
<div class="flex-1">
|
|
6
|
-
<
|
|
7
|
+
<TextMain>{{ t(doc.getDocName()) }}</TextMain>
|
|
7
8
|
</div>
|
|
8
9
|
<div>
|
|
9
10
|
<ButtonText
|
|
11
|
+
v-if="allowAction('create')"
|
|
10
12
|
@click="goTo(doc.getDocName(), 'new')"
|
|
11
13
|
class="pi pi-plus"
|
|
12
14
|
></ButtonText>
|
|
@@ -35,47 +37,107 @@
|
|
|
35
37
|
>
|
|
36
38
|
<template #toolbar>
|
|
37
39
|
<div class="w-full text-left">
|
|
38
|
-
<ButtonPrimary
|
|
39
|
-
class="pi pi-plus"
|
|
40
|
+
<ButtonPrimary
|
|
40
41
|
@click="newData"
|
|
41
42
|
v-tooltip="t('new')"
|
|
42
|
-
v-if="canPerform(resourcename, 'create')"
|
|
43
|
-
|
|
43
|
+
v-if="allowAction('create') && canPerform(resourcename, 'create')"
|
|
44
|
+
>
|
|
45
|
+
<i class="pi pi-plus"></i>
|
|
46
|
+
</ButtonPrimary>
|
|
44
47
|
</div>
|
|
45
48
|
</template>
|
|
46
49
|
<template #default>
|
|
47
50
|
<slot name="dataTableColumns">
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
class="min-w-[5rem]"
|
|
52
|
-
#body="{ index, data }"
|
|
51
|
+
<!-- :sortable="schemacols[col] && schemacols[col].type!='object'" -->
|
|
52
|
+
<template
|
|
53
|
+
v-for="col in columns.filter((item, index) => index < maxcolumns)"
|
|
53
54
|
>
|
|
54
|
-
<
|
|
55
|
-
v-if="
|
|
56
|
-
:
|
|
57
|
-
|
|
58
|
-
:
|
|
55
|
+
<Column
|
|
56
|
+
v-if="schemacols[col]"
|
|
57
|
+
:header="t(col)"
|
|
58
|
+
sortable
|
|
59
|
+
:field="schemacols[col]['x-foreignkey'] ? col + '.label' : col"
|
|
60
|
+
:class="`min-w-[5rem] ${getCssClass(col)}`"
|
|
61
|
+
#body="{ index, data }"
|
|
59
62
|
>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
<RendererLink
|
|
64
|
+
v-if="uniqueKey === col || documentTitle === col"
|
|
65
|
+
:value="data"
|
|
66
|
+
:setting="{ path: resourcename.toLocaleLowerCase() }"
|
|
67
|
+
:fields="[col]"
|
|
68
|
+
>
|
|
69
|
+
</RendererLink>
|
|
70
|
+
<TextMain v-else-if="col == 'documentStatus'">{{
|
|
71
|
+
t(data[col])
|
|
72
|
+
}}</TextMain>
|
|
73
|
+
<RendererMoney
|
|
74
|
+
v-else-if="schemacols[col]['format'] == 'money'"
|
|
75
|
+
v-model="data[col]"
|
|
76
|
+
>
|
|
77
|
+
</RendererMoney>
|
|
78
|
+
<span v-else-if="typeof schemacols[col].enum != 'undefined'">
|
|
79
|
+
{{ t(data[col]) }}
|
|
80
|
+
</span>
|
|
81
|
+
<span v-else-if="schemacols[col].type == 'boolean'">
|
|
82
|
+
<RendererBoolean v-model="data[col]" />
|
|
83
|
+
</span>
|
|
84
|
+
<RendererForeignKey
|
|
85
|
+
v-else-if="schemacols[col]['x-foreignkey']"
|
|
86
|
+
v-model="data[col]"
|
|
87
|
+
:setting="{ collection: schemacols[col]['x-foreignkey'] }"
|
|
88
|
+
>
|
|
89
|
+
{{ data[col]?.label ?? data[col]?.code ?? data[col] }}
|
|
90
|
+
</RendererForeignKey>
|
|
91
|
+
<span v-else-if="schemacols[col].format == 'date'">
|
|
92
|
+
<RendererDate v-model="data[col]" />
|
|
93
|
+
</span>
|
|
94
|
+
<span v-else-if="schemacols[col].format == 'datetime'">
|
|
95
|
+
<RendererDateTime v-model="data[col]" />
|
|
96
|
+
</span>
|
|
97
|
+
<span v-else-if="data[col]?.label !== undefined">{{
|
|
98
|
+
data[col].label
|
|
99
|
+
}}</span>
|
|
100
|
+
<span v-else>{{ data[col] }}</span>
|
|
101
|
+
</Column>
|
|
102
|
+
</template>
|
|
67
103
|
</slot>
|
|
68
104
|
</template>
|
|
69
105
|
</ListDocumentTable>
|
|
70
106
|
</div>
|
|
71
|
-
<
|
|
107
|
+
<OverlayPanelWithToolBar
|
|
72
108
|
v-model="showDialog"
|
|
73
109
|
:closeEventName="doc.getDocName()"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
110
|
+
:dismissable="false"
|
|
111
|
+
:position="sidebarposition"
|
|
112
|
+
>
|
|
113
|
+
<template #headerLeft>
|
|
114
|
+
<ButtonText @click="showDialog = false">
|
|
115
|
+
<i class="pi pi-times"></i>
|
|
116
|
+
</ButtonText>
|
|
117
|
+
</template>
|
|
118
|
+
<template #headerCenter>
|
|
119
|
+
<TextTitle class="text-center text-white">{{
|
|
120
|
+
t(doc.getDocName())
|
|
121
|
+
}}</TextTitle>
|
|
122
|
+
</template>
|
|
123
|
+
<template #headerRight>
|
|
124
|
+
<ButtonText
|
|
125
|
+
@click="
|
|
126
|
+
sidebarposition =
|
|
127
|
+
sidebarposition == 'right' ? (sidebarposition = 'full') : 'right'
|
|
128
|
+
"
|
|
129
|
+
>
|
|
130
|
+
<i v-if="sidebarposition == 'right'" class="pi pi-window-maximize" />
|
|
131
|
+
<i v-if="sidebarposition == 'full'" class="pi pi-window-minimize" />
|
|
132
|
+
</ButtonText>
|
|
133
|
+
</template>
|
|
134
|
+
|
|
135
|
+
<div class="p-2">
|
|
136
|
+
<slot name="default">
|
|
137
|
+
<NuxtPage :_id="id"></NuxtPage>
|
|
138
|
+
</slot>
|
|
139
|
+
</div>
|
|
140
|
+
</OverlayPanelWithToolBar>
|
|
79
141
|
</template>
|
|
80
142
|
|
|
81
143
|
<script setup lang="ts" generic="T extends { [key: string]: any }">
|
|
@@ -89,14 +151,17 @@ import { ref } from "vue";
|
|
|
89
151
|
import _ from "lodash";
|
|
90
152
|
import { SearchBody } from "~/types";
|
|
91
153
|
import { SimpleAppClient } from "~/simpleapp/generate/clients/SimpleAppClient";
|
|
154
|
+
const sidebarposition = ref("right");
|
|
92
155
|
const props = defineProps<{
|
|
93
156
|
document: SimpleAppClient<any, any>;
|
|
94
157
|
data: T;
|
|
158
|
+
dismissable?: boolean;
|
|
95
159
|
columns: string[];
|
|
96
160
|
mobileColumns?: string[];
|
|
97
161
|
sorts?: string[][];
|
|
162
|
+
availableActions?:string[]
|
|
98
163
|
}>();
|
|
99
|
-
|
|
164
|
+
const maxcolumns = 16;
|
|
100
165
|
const emits = defineEmits(["selectRow"]);
|
|
101
166
|
const id = computed(() => getPathPara("id"));
|
|
102
167
|
const resourcename = ref(_.upperFirst(props.document.getDocName()));
|
|
@@ -115,7 +180,19 @@ const { $event, $listen } = useNuxtApp();
|
|
|
115
180
|
const recordlist = ref<T[]>();
|
|
116
181
|
const uniqueKey = doc.getSchema()["x-simpleapp-config"].uniqueKey;
|
|
117
182
|
const documentTitle = doc.getSchema()["x-simpleapp-config"].documentTitle;
|
|
118
|
-
|
|
183
|
+
const schemacols = doc.getSchema().properties;
|
|
184
|
+
const allowAction = (actname:string)=>{
|
|
185
|
+
if(props.availableActions === undefined) return true
|
|
186
|
+
else if(Array.isArray(props.availableActions) && props.availableActions.length>0 && !props.availableActions.includes(actname))
|
|
187
|
+
return false
|
|
188
|
+
else return true
|
|
189
|
+
}
|
|
190
|
+
const getCssClass = (col: string) => {
|
|
191
|
+
if (schemacols[col]?.type == "number") return "text-right";
|
|
192
|
+
else if (schemacols[col]?.type == "boolean")
|
|
193
|
+
return "text-center place-items-center";
|
|
194
|
+
else return "text-left";
|
|
195
|
+
};
|
|
119
196
|
const refresh = () => {
|
|
120
197
|
const searchbody: SearchBody = {
|
|
121
198
|
fields: props.columns,
|
|
@@ -154,7 +231,7 @@ watch(showDialog, () => {
|
|
|
154
231
|
watch(
|
|
155
232
|
() => useRoute().path,
|
|
156
233
|
async () => {
|
|
157
|
-
if(!isMobile()){
|
|
234
|
+
if (!isMobile()) {
|
|
158
235
|
if (getPathPara("id")) {
|
|
159
236
|
showDialog.value = true;
|
|
160
237
|
} else {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<span v-if="modelValue">
|
|
2
|
+
<span v-if="modelValue">
|
|
3
|
+
{{ dateRenderToDateStr(modelValue) }}
|
|
4
|
+
</span>
|
|
5
|
+
<span v-else-if="value">
|
|
6
|
+
{{ dateRenderToDateStr(value) }}
|
|
7
|
+
</span>
|
|
3
8
|
<span v-else>-</span>
|
|
4
9
|
</template>
|
|
5
10
|
<script lang="ts" setup>
|
|
@@ -9,5 +14,6 @@
|
|
|
9
14
|
* last change 2024-02-04
|
|
10
15
|
* author: Ks Tan
|
|
11
16
|
*/
|
|
12
|
-
const modelValue = defineModel<Date|string>()
|
|
17
|
+
const modelValue = defineModel<Date | string>();
|
|
18
|
+
const props = defineProps<{value:Date|string}>()
|
|
13
19
|
</script>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<span v-if="modelValue">
|
|
2
|
+
<span v-if="modelValue">
|
|
3
|
+
{{ dateRenderToDateTimeStr(modelValue) }}
|
|
4
|
+
</span>
|
|
5
|
+
<span v-else-if="value">
|
|
6
|
+
{{ dateRenderToDateTimeStr(value) }}
|
|
7
|
+
</span>
|
|
3
8
|
<span v-else>-</span>
|
|
4
9
|
</template>
|
|
5
10
|
<script lang="ts" setup>
|
|
@@ -10,4 +15,5 @@
|
|
|
10
15
|
* author: Ks Tan
|
|
11
16
|
*/
|
|
12
17
|
const modelValue = defineModel<Date | string>();
|
|
18
|
+
const props = defineProps<{value:Date|string}>()
|
|
13
19
|
</script>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-row text-xs cursor-pointer"
|
|
3
|
+
v-if="data?.updated && data?.updated !=''" @click="viewHistories">
|
|
4
|
+
<ImageAvatar v-if="data?.updatedBy" :id="data.updatedBy" :size="12"></ImageAvatar>
|
|
5
|
+
<div class="flex flex-col p-2">
|
|
6
|
+
<TextDocStatus v-if="data?.docStatus" :docStatus="data?.docStatus" />
|
|
7
|
+
<TextSubsubtitle class=" text-gray-400 italic">{{ t('updated') }}:</TextSubsubtitle>
|
|
8
|
+
<RendererDateTime :value="data?.updated" class="text-gray-400 italic"/>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<Dialog v-model:visible="visibleHistories" modal
|
|
13
|
+
:header="t('histories')" :pt="{root:{class:'w-1/4'}}">
|
|
14
|
+
<Timeline :value="events" class="w-full md:w-20rem">
|
|
15
|
+
<template #opposite="slotProps">
|
|
16
|
+
<RendererDateTime class="italic text-gray-400 text-xs" :value="slotProps.item.date"/>
|
|
17
|
+
</template>
|
|
18
|
+
<template #content="slotProps">
|
|
19
|
+
<div>
|
|
20
|
+
<div>{{ slotProps.item.status }}</div>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
</template>
|
|
24
|
+
</Timeline>
|
|
25
|
+
</Dialog>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
</template>
|
|
29
|
+
<script lang="ts" setup>
|
|
30
|
+
import TextSubsubtitle from '../text/TextSubsubtitle.vue';
|
|
31
|
+
import RendererDateTime from './RendererDateTime.vue';
|
|
32
|
+
const visibleHistories = ref(false)
|
|
33
|
+
const props=defineProps<{data:any}>()
|
|
34
|
+
const events = computed(()=>{
|
|
35
|
+
const list = [{ status: t('created'), date: props.data.created },]
|
|
36
|
+
|
|
37
|
+
if(props.data.updated != props.data.created){
|
|
38
|
+
list.push({ status: t('paidFeature'), date:''})
|
|
39
|
+
list.push( { status: t('lastUpdate'), date: props.data.updated })
|
|
40
|
+
}
|
|
41
|
+
return list
|
|
42
|
+
})
|
|
43
|
+
const severity = computed(()=>{
|
|
44
|
+
const stat = props.data.docStatus
|
|
45
|
+
if(props.data.docStatus=='confirm') return "success"
|
|
46
|
+
else if(props.data.docStatus=='void') return "danger"
|
|
47
|
+
else if(props.data.docStatus=='draft') return "secondary"
|
|
48
|
+
else return "warning"
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
const viewHistories = () =>{
|
|
53
|
+
visibleHistories.value=true
|
|
54
|
+
console.log("histories")
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
@@ -21,25 +21,26 @@ import { ForeignKey, FormCrudEvent, SimpleAppDocumentType } from "~/types";
|
|
|
21
21
|
|
|
22
22
|
type SettingProp = { collection: SimpleAppDocumentType; displayField?: string };
|
|
23
23
|
const modelValue = defineModel<ForeignKey>();
|
|
24
|
+
|
|
24
25
|
const emits = defineEmits(["after"]);
|
|
25
|
-
const props = defineProps<{
|
|
26
|
+
const props = defineProps<{value?:ForeignKey; setting: SettingProp }>();
|
|
26
27
|
const displayText = computed(() => {
|
|
27
28
|
const s = props.setting;
|
|
28
|
-
if (!modelValue.value) return undefined;
|
|
29
|
-
else if (!s.collection) return modelValue.value;
|
|
30
|
-
else if (s.displayField) return modelValue.value[s.displayField];
|
|
31
|
-
else return modelValue.value.label;
|
|
29
|
+
if (!modelValue.value && !props.value) return undefined;
|
|
30
|
+
else if (!s.collection) return modelValue.value??props.value;
|
|
31
|
+
else if (s.displayField) return modelValue.value[s.displayField] ??props.value[s.displayField];
|
|
32
|
+
else return modelValue.value?.label ??props.value?.label;
|
|
32
33
|
});
|
|
33
34
|
const { $event } = useNuxtApp();
|
|
34
35
|
const viewer = ref();
|
|
35
36
|
const viewRecord = () => {
|
|
36
37
|
viewer.value = getDocument(props.setting.collection)?.viewer;
|
|
37
|
-
|
|
38
|
+
const value = modelValue.value?? props.value
|
|
38
39
|
// getDocumentUrl(setting.collection,modelValue ? modelValue['_id']:'')
|
|
39
40
|
//getDocumentUrl(setting.collection,modelValue ? modelValue['_id']:'')
|
|
40
41
|
$event("ViewRecord", {
|
|
41
|
-
_id:
|
|
42
|
-
label:
|
|
42
|
+
_id: value?._id as string,
|
|
43
|
+
label: value?.label as string,
|
|
43
44
|
eventId: randomUUID(),
|
|
44
45
|
documentName: props.setting.collection,
|
|
45
46
|
viewer: viewer.value,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<a
|
|
2
|
+
<a
|
|
3
|
+
@click="go"
|
|
4
|
+
class="text-primary-700 dark:text-primary-300 dark:hover:text-primary-200 hover:text-primary-500 cursor-pointer"
|
|
5
|
+
>
|
|
3
6
|
<slot name="default">
|
|
4
|
-
<div>{{ value[fields[0]] }}</div>
|
|
7
|
+
<div>{{ value[fields[0]] ?? t('undefined') }}</div>
|
|
5
8
|
</slot>
|
|
6
9
|
</a>
|
|
7
10
|
</template>
|
|
@@ -20,6 +23,6 @@ const props = defineProps<{
|
|
|
20
23
|
}>();
|
|
21
24
|
|
|
22
25
|
const go = () => {
|
|
23
|
-
goTo(props.setting.path, props.value._id);
|
|
26
|
+
goTo(props.setting.path, props.value._id);
|
|
24
27
|
};
|
|
25
|
-
</script>
|
|
28
|
+
</script>
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
|
|
3
|
+
<span>
|
|
4
|
+
<span class="mr-1" v-if="showCurrency">{{ getCurrency() }}</span>
|
|
5
|
+
<span v-if="typeof modelValue != 'undefined'">{{
|
|
6
|
+
modelValue.toLocaleString(useI18n().defaultLocale, options)
|
|
7
|
+
}}</span>
|
|
8
|
+
<span v-else-if="typeof props.value != 'undefined'">{{
|
|
9
|
+
props.value.toLocaleString(useI18n().defaultLocale, options)
|
|
10
|
+
}}</span>
|
|
11
|
+
<span v-else>-</span>
|
|
12
|
+
</span>
|
|
9
13
|
</template>
|
|
10
14
|
<script lang="ts" setup>
|
|
11
15
|
/**
|
|
@@ -14,20 +18,24 @@
|
|
|
14
18
|
* last change 2024-02-04
|
|
15
19
|
* author: Ks Tan
|
|
16
20
|
*/
|
|
17
|
-
const currenyValue = computed(() => {
|
|
18
|
-
if (modelValue.value === undefined) return "-";
|
|
19
|
-
return Intl.NumberFormat(useI18n().defaultLocale, {
|
|
20
|
-
// style: "currency",
|
|
21
|
-
// currency: getUserProfile()?.currency ?? '',
|
|
22
|
-
// currencyDisplay: "symbol",
|
|
23
|
-
}).format(modelValue.value);
|
|
24
|
-
});
|
|
25
21
|
const options = {
|
|
26
22
|
style: "decimal", // Other options: 'currency', 'percent', etc.
|
|
27
23
|
minimumFractionDigits: 2,
|
|
28
24
|
maximumFractionDigits: 2,
|
|
29
25
|
};
|
|
30
|
-
const modelValue = defineModel<number>(
|
|
31
|
-
const props = defineProps<{ showCurrency?: boolean }>();
|
|
26
|
+
const modelValue = defineModel<number>();
|
|
27
|
+
const props = defineProps<{ showCurrency?: boolean ; value?:number }>();
|
|
28
|
+
|
|
29
|
+
const currenyValue = computed(() => {
|
|
30
|
+
if (typeof modelValue.value == 'number'){
|
|
31
|
+
return Intl.NumberFormat(useI18n().defaultLocale,
|
|
32
|
+
{}).format(modelValue.value);
|
|
33
|
+
}else if(typeof props.value == 'number'){
|
|
34
|
+
return Intl.NumberFormat(useI18n().defaultLocale,{}).format(props.value);
|
|
35
|
+
}else return '-'
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
});
|
|
39
|
+
|
|
32
40
|
|
|
33
41
|
</script>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<span v-if="modelValue">
|
|
2
|
+
<span v-if="modelValue">
|
|
3
|
+
{{ dateRenderToTimeStr(modelValue) }}
|
|
4
|
+
</span>
|
|
5
|
+
<span v-else-if="value">
|
|
6
|
+
{{ dateRenderToTimeStr(value) }}
|
|
7
|
+
</span>
|
|
3
8
|
<span v-else>-</span>
|
|
4
9
|
</template>
|
|
5
10
|
<script lang="ts" setup>
|
|
@@ -10,4 +15,5 @@
|
|
|
10
15
|
* author: Ks Tan
|
|
11
16
|
*/
|
|
12
17
|
const modelValue = defineModel<Date | string>();
|
|
18
|
+
const props = defineProps<{ value: Date | string }>();
|
|
13
19
|
</script>
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<div v-if="!value"></div>
|
|
3
|
+
<a v-else
|
|
3
4
|
@click="openViewer"
|
|
4
5
|
class="text-primary-700 dark:text-primary-400 hover:text-primary-500 cursor-pointer"
|
|
5
6
|
>
|
|
6
7
|
<slot name="default">
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
<TextDanger v-if="!value">{{t('undefined')}}</TextDanger>
|
|
10
|
+
<TextDanger v-else-if="!Array.isArray(fields) || !fields[0]">{{t('undefinedFields')}}</TextDanger>
|
|
11
|
+
<div v-else-if="value[fields[0]]">{{ value[fields[0]] }}</div>
|
|
12
|
+
<div v-else></div>
|
|
8
13
|
</slot>
|
|
9
|
-
</a>
|
|
14
|
+
</a>
|
|
10
15
|
</template>
|
|
11
16
|
<script setup lang="ts">
|
|
12
17
|
/**
|
|
@@ -21,18 +26,23 @@ const props = defineProps<{
|
|
|
21
26
|
setting: RendererSetting;
|
|
22
27
|
value: any;
|
|
23
28
|
}>();
|
|
24
|
-
|
|
29
|
+
const viewervalue = computed(()=>{
|
|
30
|
+
return props.value ?? {}
|
|
31
|
+
})
|
|
25
32
|
const openViewer = () => {
|
|
26
33
|
useNuxtApp().$event("ViewRecord", {
|
|
27
34
|
_id: props.value._id,
|
|
28
35
|
documentName: props.setting.documentName,
|
|
29
36
|
viewer: getDocument(props.setting.documentName)?.viewer,
|
|
30
|
-
label:
|
|
37
|
+
label:
|
|
38
|
+
props.fields !== undefined
|
|
39
|
+
? props.value[props.fields[0]]
|
|
40
|
+
: props.setting.documentName,
|
|
31
41
|
document: getDocument(props.setting.documentName)?.docClass,
|
|
32
|
-
eventId: randomUUID(),
|
|
33
|
-
after:()=>{
|
|
34
|
-
useNuxtApp().$event(
|
|
35
|
-
}
|
|
42
|
+
eventId: randomUUID(),
|
|
43
|
+
after: () => {
|
|
44
|
+
useNuxtApp().$event("CloseDialog", props.setting.documentName);
|
|
45
|
+
},
|
|
36
46
|
});
|
|
37
47
|
};
|
|
38
48
|
</script>
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="flex flex-row
|
|
4
|
-
<label v-if="!hideLabel" :for="fieldid"
|
|
5
|
-
|
|
2
|
+
<div class="w-full">
|
|
3
|
+
<div class="flex flex-row">
|
|
4
|
+
<label v-if="!hideLabel" :for="fieldid">
|
|
5
|
+
{{ t(documentName) }}
|
|
6
6
|
</label>
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
<div
|
|
8
|
+
v-if="allowAddNew"
|
|
9
|
+
@click="addnew"
|
|
10
|
+
class="cursor-pointer ml-2 pt-1 text-xs text-blue-600"
|
|
11
|
+
>
|
|
12
|
+
<span>{{ t("new") }}</span>
|
|
13
|
+
</div>
|
|
10
14
|
</div>
|
|
11
15
|
<MultiSelect
|
|
16
|
+
class="w-full md:w-full"
|
|
12
17
|
:input-id="fieldid"
|
|
13
18
|
v-if="multiple"
|
|
14
19
|
display="chip"
|
|
@@ -17,19 +22,39 @@
|
|
|
17
22
|
:options="options"
|
|
18
23
|
optionLabel="label"
|
|
19
24
|
optionValue="value"
|
|
25
|
+
filter
|
|
20
26
|
:placeholder="placeholder"
|
|
21
|
-
|
|
27
|
+
>
|
|
28
|
+
<template #value="slotProps">
|
|
29
|
+
<slot name="value" :slotProps="slotProps">
|
|
30
|
+
</slot>
|
|
31
|
+
</template>
|
|
32
|
+
<template #option="slotProps">
|
|
33
|
+
<slot name="default" :option="slotProps.option" :index="slotProps.index">
|
|
34
|
+
</slot>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
</MultiSelect>
|
|
22
38
|
<Dropdown
|
|
23
|
-
|
|
39
|
+
class="w-full md:w-full"
|
|
24
40
|
:input-id="fieldid"
|
|
25
41
|
v-else
|
|
26
42
|
@update:modelValue="change"
|
|
43
|
+
filter
|
|
27
44
|
v-model="modelValue"
|
|
28
45
|
:options="options"
|
|
29
46
|
optionLabel="label"
|
|
30
47
|
optionValue="value"
|
|
31
48
|
:placeholder="placeholder"
|
|
32
|
-
|
|
49
|
+
>
|
|
50
|
+
<template #value="slotProps">
|
|
51
|
+
<slot name="value" :item="getItem(modelValue)"></slot>
|
|
52
|
+
</template>
|
|
53
|
+
<template #option="slotProps" >
|
|
54
|
+
<slot name="default" :option="slotProps.option" :index="slotProps.index"></slot>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
</Dropdown>
|
|
33
58
|
</div>
|
|
34
59
|
</template>
|
|
35
60
|
<script setup lang="ts">
|
|
@@ -40,24 +65,30 @@
|
|
|
40
65
|
* Author: Ks Tan
|
|
41
66
|
*/
|
|
42
67
|
import Dropdown from "primevue/dropdown";
|
|
43
|
-
|
|
68
|
+
|
|
69
|
+
import { ForeignKey, SimpleAppDocuments, FormCrudEvent } from "~/types";
|
|
44
70
|
const emits = defineEmits(["change"]);
|
|
45
|
-
|
|
46
|
-
const list = ref<ForeignKey[]>([]);
|
|
47
|
-
const fieldid = randomUUID()
|
|
71
|
+
|
|
48
72
|
const props = defineProps<{
|
|
49
|
-
documentName:
|
|
73
|
+
documentName: keyof SimpleAppDocuments;
|
|
50
74
|
placeholder?: string;
|
|
51
75
|
showNull?: boolean;
|
|
52
76
|
allowAddNew?: boolean;
|
|
53
77
|
filter?: any;
|
|
54
78
|
multiple?: boolean;
|
|
55
|
-
hideLabel?:boolean
|
|
79
|
+
hideLabel?: boolean;
|
|
56
80
|
}>();
|
|
81
|
+
// const initvalue = props.multiple==true ? [] : ''
|
|
82
|
+
const modelValue = defineModel<string | string[]>();
|
|
83
|
+
|
|
84
|
+
const list = ref<ForeignKey[]>([]);
|
|
85
|
+
const fieldid = randomUUID();
|
|
86
|
+
|
|
57
87
|
const options = ref<
|
|
58
88
|
{
|
|
59
89
|
value: string;
|
|
60
90
|
label: string;
|
|
91
|
+
more:any;
|
|
61
92
|
}[]
|
|
62
93
|
>([]);
|
|
63
94
|
const getListOptions = async () => {
|
|
@@ -71,38 +102,45 @@ const getListOptions = async () => {
|
|
|
71
102
|
options.value = list.value.map((item) => ({
|
|
72
103
|
value: item._id,
|
|
73
104
|
label: item.label,
|
|
105
|
+
more: item
|
|
74
106
|
}));
|
|
75
107
|
};
|
|
76
108
|
onMounted(async () => {
|
|
109
|
+
|
|
77
110
|
await getListOptions();
|
|
78
111
|
if (modelValue.value) change(modelValue.value);
|
|
79
112
|
});
|
|
80
|
-
const getItem = (id: string) => list.value?.find((item) =>
|
|
113
|
+
const getItem = (id: string) => list.value?.find((item) => {
|
|
114
|
+
return item._id == id
|
|
115
|
+
});
|
|
81
116
|
|
|
82
|
-
const change = (id: string) => {
|
|
117
|
+
const change = (id: string | string[]) => {
|
|
83
118
|
const selectedItem = getItem(id);
|
|
84
119
|
emits("change", id, selectedItem);
|
|
85
|
-
|
|
120
|
+
// console.log("changed",selectedItem)
|
|
86
121
|
};
|
|
87
122
|
|
|
88
|
-
const addnew=()=>{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
modelValue.value = data._id;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
123
|
+
const addnew = () => {
|
|
124
|
+
const doc = getDocument(props.documentName)?.docClass;
|
|
125
|
+
if (doc) {
|
|
126
|
+
const tmpdata = doc?.getReactiveData();
|
|
127
|
+
type DataType = typeof tmpdata.value;
|
|
128
|
+
onScreenAddDocument<DataType>(
|
|
129
|
+
props.documentName,
|
|
130
|
+
undefined,
|
|
131
|
+
async (eventType: FormCrudEvent, data: DataType) => {
|
|
132
|
+
if (eventType == FormCrudEvent.create) {
|
|
133
|
+
await getListOptions();
|
|
134
|
+
if (props.multiple) {
|
|
135
|
+
if (modelValue.value === undefined) modelValue.value = [data._id];
|
|
136
|
+
else if (Array.isArray(modelValue.value))
|
|
137
|
+
modelValue.value.push(data._id);
|
|
138
|
+
} else modelValue.value = data._id;
|
|
139
|
+
refreshDocumentList(props.documentName);
|
|
140
|
+
emits("change", data._id, getItem(data._id));
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
);
|
|
106
144
|
}
|
|
107
|
-
}
|
|
145
|
+
};
|
|
108
146
|
</script>
|