@simitgroup/simpleapp-generator 2.0.0-d-alpha → 2.0.0-f-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/ReleaseNote.md +10 -0
- package/dist/buildinschemas/index.d.ts +2 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +5 -3
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/webhook.js +1 -1
- package/dist/generate.js +1 -1
- package/dist/generate.js.map +1 -1
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
- package/dist/processors/jsonschemabuilder.js +3 -0
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/index.ts +2 -2
- package/src/buildinschemas/{webhook.ts.backup → webhook.ts} +1 -1
- package/src/generate.ts +1 -1
- package/src/processors/jsonschemabuilder.ts +4 -2
- package/templates/basic/nest/jsonschema.ts.eta +3 -1
- package/templates/basic/nest/module.ts.eta +2 -2
- package/templates/basic/nest/service.ts.eta +2 -2
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.module.ts.eta +15 -7
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.schema.ts.eta +41 -42
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.service.ts.eta +11 -11
- package/templates/nest/src/simple-app/.core/features/log/log.controller.ts.eta +42 -0
- package/templates/nest/src/simple-app/.core/features/log/log.module.ts.eta +11 -8
- package/templates/nest/src/simple-app/.core/features/log/log.service.ts.eta +42 -12
- package/templates/nest/src/simple-app/.core/features/log/schemas/document-event.schema.ts.eta +23 -1
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager-policy.service.ts.eta +13 -6
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager.service.ts.eta +5 -2
- package/templates/nest/src/simple-app/.core/features/policy/policy.service.ts.eta +6 -5
- package/templates/nest/src/simple-app/.core/features/profile/profile.controller.ts.eta +29 -16
- package/templates/nest/src/simple-app/.core/features/profile/profile.module.ts.eta +7 -6
- package/templates/nest/src/simple-app/.core/features/profile/profile.schema.ts.eta +8 -8
- package/templates/nest/src/simple-app/.core/features/profile/profile.service.ts.eta +9 -1
- package/templates/nest/src/simple-app/.core/features/queue/queue-base/queue-base.consumer.ts.eta +1 -1
- package/templates/nest/src/simple-app/.core/features/simple-app-core-features.module.ts.eta +3 -3
- package/templates/nest/src/simple-app/.core/features/user-context/user.context.ts.eta +11 -0
- package/templates/nest/src/simple-app/.core/features/webhook/schemas/webhook.schema.ts.eta +36 -36
- package/templates/nest/src/simple-app/.core/framework/base/simple-app.service.ts.eta +3 -3
- package/templates/nest/src/simple-app/.core/framework/json-schemas.dict.ts.eta +11 -0
- package/templates/nest/src/simple-app/mini-apps/mini-apps.module.ts._eta +14 -0
- package/templates/nest/src/simple-app/simple-app.module.ts.eta +5 -1
- package/templates/nuxt/components/form/FormDocnoformat.vue._eta +78 -17
- package/templates/nuxt/components/image/ImageAvatar.vue._eta +40 -32
- package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta +1 -2
- package/templates/nuxt/components/renderer/RendererDocHistories.vue._eta +90 -50
- package/templates/nuxt/composables/docformat.generate.ts.eta +2 -2
- package/templates/nuxt/pages/profile.vue._eta +2 -7
- package/templates/nuxt/plugins/19.simpleapp-mini-app-store.ts.eta +2 -2
- package/templates/nuxt/types/events.ts.eta +1 -0
- package/templates/nuxt/types/others.ts.eta +8 -0
- /package/src/buildinschemas/{documentnoformat.ts.backup → documentnoformat.ts} +0 -0
|
@@ -9,132 +9,132 @@ import { Field, ObjectType, ID } from '@nestjs/graphql';
|
|
|
9
9
|
import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json';
|
|
10
10
|
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
11
11
|
|
|
12
|
-
@ObjectType()
|
|
12
|
+
// @ObjectType()
|
|
13
13
|
@Schema({ collection: 'webhook' })
|
|
14
14
|
export class WebhookBasicAuth {
|
|
15
15
|
@Prop()
|
|
16
|
-
@Field()
|
|
16
|
+
// @Field()
|
|
17
17
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
18
18
|
user: string;
|
|
19
19
|
@Prop()
|
|
20
|
-
@Field()
|
|
20
|
+
// @Field()
|
|
21
21
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
22
22
|
password: string;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
@ObjectType()
|
|
25
|
+
// @ObjectType()
|
|
26
26
|
@Schema()
|
|
27
27
|
export class WebhookHeaders {
|
|
28
28
|
@Prop()
|
|
29
|
-
@Field()
|
|
29
|
+
// @Field()
|
|
30
30
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
31
31
|
name: string;
|
|
32
32
|
@Prop()
|
|
33
|
-
@Field()
|
|
33
|
+
// @Field()
|
|
34
34
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
35
35
|
value: string;
|
|
36
36
|
@Prop()
|
|
37
|
-
@Field()
|
|
37
|
+
// @Field()
|
|
38
38
|
@ApiProperty({ type: 'string', required: false, description: 'iso8601 dataempty mean new record', default: '' })
|
|
39
39
|
created: string;
|
|
40
40
|
@Prop()
|
|
41
|
-
@Field()
|
|
41
|
+
// @Field()
|
|
42
42
|
@ApiProperty({ type: 'string', required: false, description: 'iso8601 or empty', default: '' })
|
|
43
43
|
updated: string;
|
|
44
44
|
@Prop()
|
|
45
|
-
@Field()
|
|
45
|
+
// @Field()
|
|
46
46
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
47
47
|
createdBy: string;
|
|
48
48
|
@Prop()
|
|
49
|
-
@Field()
|
|
49
|
+
// @Field()
|
|
50
50
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
51
51
|
updatedBy: string;
|
|
52
52
|
@Prop()
|
|
53
|
-
@Field()
|
|
53
|
+
// @Field()
|
|
54
54
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
55
55
|
_id: string;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
@ObjectType()
|
|
58
|
+
// @ObjectType()
|
|
59
59
|
@Schema()
|
|
60
60
|
export class Webhook {
|
|
61
61
|
@Prop()
|
|
62
|
-
@Field()
|
|
62
|
+
// @Field()
|
|
63
63
|
@ApiProperty({ type: 'string', required: false, format: 'uuid', default: '' })
|
|
64
64
|
_id?: string;
|
|
65
65
|
@Prop()
|
|
66
|
-
@Field()
|
|
66
|
+
// @Field()
|
|
67
67
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
68
68
|
created?: string;
|
|
69
69
|
@Prop()
|
|
70
|
-
@Field()
|
|
70
|
+
// @Field()
|
|
71
71
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
72
72
|
updated?: string;
|
|
73
73
|
@Prop()
|
|
74
|
-
@Field()
|
|
74
|
+
// @Field()
|
|
75
75
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
76
76
|
createdBy?: string;
|
|
77
77
|
@Prop()
|
|
78
|
-
@Field()
|
|
78
|
+
// @Field()
|
|
79
79
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
80
80
|
updatedBy?: string;
|
|
81
81
|
@Prop()
|
|
82
|
-
@Field()
|
|
82
|
+
// @Field()
|
|
83
83
|
@ApiProperty({ type: 'number', required: false, default: 1 })
|
|
84
84
|
tenantId?: number;
|
|
85
85
|
@Prop()
|
|
86
|
-
@Field()
|
|
86
|
+
// @Field()
|
|
87
87
|
@ApiProperty({ type: 'number', required: false, default: 1 })
|
|
88
88
|
orgId?: number;
|
|
89
89
|
@Prop()
|
|
90
|
-
@Field()
|
|
90
|
+
// @Field()
|
|
91
91
|
@ApiProperty({ type: 'number', required: false, default: 1 })
|
|
92
92
|
branchId?: number;
|
|
93
93
|
@Prop()
|
|
94
|
-
@Field()
|
|
94
|
+
// @Field()
|
|
95
95
|
@ApiProperty({ type: 'string', required: true, default: '' })
|
|
96
96
|
title: string;
|
|
97
97
|
@Prop()
|
|
98
|
-
@Field()
|
|
98
|
+
// @Field()
|
|
99
99
|
@ApiProperty({ type: 'string', required: true, format: 'uri', default: '' })
|
|
100
100
|
url: string;
|
|
101
101
|
@Prop()
|
|
102
|
-
@Field()
|
|
102
|
+
// @Field()
|
|
103
103
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
104
104
|
requestMethod: string;
|
|
105
105
|
@Prop()
|
|
106
|
-
@Field()
|
|
106
|
+
// @Field()
|
|
107
107
|
@ApiProperty({ type: 'string', required: false, description: 'apikey authentication use none + headers props', default: '' })
|
|
108
108
|
authentication?: string;
|
|
109
109
|
@Prop()
|
|
110
|
-
@Field()
|
|
110
|
+
// @Field()
|
|
111
111
|
@ApiProperty({ type: 'string', required: false, format: 'text', default: '' })
|
|
112
112
|
description?: string;
|
|
113
113
|
@Prop()
|
|
114
|
-
@Field()
|
|
114
|
+
// @Field()
|
|
115
115
|
@ApiProperty({ type: 'string', required: false, description: 'POST,PUT body template', format: 'text', default: '*' })
|
|
116
116
|
body: string;
|
|
117
117
|
@Prop()
|
|
118
|
-
@Field()
|
|
118
|
+
// @Field()
|
|
119
119
|
@ApiProperty({ type: 'boolean', required: false, default: true })
|
|
120
120
|
active: boolean;
|
|
121
121
|
@Prop()
|
|
122
|
-
@Field()
|
|
122
|
+
// @Field()
|
|
123
123
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
124
124
|
resourceName: string;
|
|
125
125
|
@Prop()
|
|
126
|
-
@Field()
|
|
126
|
+
// @Field()
|
|
127
127
|
@ApiProperty({ type: 'string', required: false, default: '' })
|
|
128
128
|
eventType: string;
|
|
129
129
|
@Prop()
|
|
130
|
-
@Field()
|
|
130
|
+
// @Field()
|
|
131
131
|
@ApiProperty({ type: 'string', required: false, description: 'temporary support realtime and roll-back-when-failed, 2nd way way throw error and roll back data if webhook failed.)', default: '' })
|
|
132
132
|
jobType: string;
|
|
133
133
|
@Prop()
|
|
134
|
-
@Field()
|
|
134
|
+
// @Field()
|
|
135
135
|
@ApiProperty({ type: 'number', required: false, description: 'retries how many time when webhook failed', default: 0 })
|
|
136
136
|
retryAttemps: number;
|
|
137
|
-
@Field()
|
|
137
|
+
// @Field()
|
|
138
138
|
@ApiProperty({ type: () => WebhookBasicAuth, required: false })
|
|
139
139
|
basicAuth?: WebhookBasicAuth;
|
|
140
140
|
@Prop()
|
|
@@ -144,21 +144,21 @@ export class Webhook {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
/***************************************** Start Auto Complete *****************************************/
|
|
147
|
-
@ObjectType()
|
|
147
|
+
// @ObjectType()
|
|
148
148
|
@Schema()
|
|
149
149
|
export class WebhookAutoComplete {
|
|
150
150
|
@Prop()
|
|
151
|
-
@Field()
|
|
151
|
+
// @Field()
|
|
152
152
|
@ApiProperty({ type: 'string', required: true, default: '' })
|
|
153
153
|
_id: string;
|
|
154
154
|
|
|
155
155
|
@Prop()
|
|
156
|
-
@Field()
|
|
156
|
+
// @Field()
|
|
157
157
|
@ApiProperty({ type: 'string', required: true, default: '' })
|
|
158
158
|
code: string;
|
|
159
159
|
|
|
160
160
|
@Prop()
|
|
161
|
-
@Field()
|
|
161
|
+
// @Field()
|
|
162
162
|
@ApiProperty({ type: 'string', required: true, default: '' })
|
|
163
163
|
label: string;
|
|
164
164
|
}
|
|
@@ -19,7 +19,7 @@ import { foreignkeys } from '../../features/foreign-key/foreignkeys.dict';
|
|
|
19
19
|
import { CustomException } from '../custom-exception';
|
|
20
20
|
|
|
21
21
|
import { camelToKebab } from 'src/simple-app/.core/utils/string-utils';
|
|
22
|
-
import {
|
|
22
|
+
import { SimpleAppDocumentNoFormatService } from '../../features/document-no-format/document-no-format.service';
|
|
23
23
|
import { UserContext } from '../../features/user-context/user.context';
|
|
24
24
|
import { RunWebhookService } from '../../features/webhook/run-webhook.service';
|
|
25
25
|
import { UniqueKeyExistResponse, DeleteResultType, IsolationType, MoreProjectionType, SchemaFields, TextSearchBody, PatchManyRequest } from '../schemas';
|
|
@@ -38,7 +38,7 @@ export class SimpleAppService<T extends SchemaFields> {
|
|
|
38
38
|
// @Inject(AuditTrail)
|
|
39
39
|
// protected audittrail: AuditTrail;
|
|
40
40
|
// @Inject(DocNumberFormatGenerator)
|
|
41
|
-
protected docnogenerator:
|
|
41
|
+
protected docnogenerator: SimpleAppDocumentNoFormatService;
|
|
42
42
|
protected logger = new Logger();
|
|
43
43
|
protected strictIsolation = true;
|
|
44
44
|
protected jsonschema: any = {
|
|
@@ -65,7 +65,7 @@ export class SimpleAppService<T extends SchemaFields> {
|
|
|
65
65
|
private logSvc:SimpleAppLogService;
|
|
66
66
|
// protected userprovider = new UserContext() ;
|
|
67
67
|
|
|
68
|
-
constructor(doctype: string, docname: string, newdoc: Model<T>, isolationtype: IsolationType = IsolationType.org, eventEmitter: EventEmitter2, docnogenerator:
|
|
68
|
+
constructor(doctype: string, docname: string, newdoc: Model<T>, isolationtype: IsolationType = IsolationType.org, eventEmitter: EventEmitter2, docnogenerator: SimpleAppDocumentNoFormatService,logSvc: SimpleAppLogService,runWebHook: RunWebhookService) {
|
|
69
69
|
// console.log("-------init simpleapp service abstract class -------userprovider=",typeof this.userprovider)
|
|
70
70
|
this.eventEmitter = eventEmitter;
|
|
71
71
|
this.documentType = doctype.toUpperCase();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<%
|
|
2
|
+
for(let i=0; i<it.modules.length;i++){
|
|
3
|
+
const m= it.modules[i]
|
|
4
|
+
if(getSystemResources().includes(m.docname.toLowerCase())){
|
|
5
|
+
%>
|
|
6
|
+
export * from 'src/simple-app/.core/resources/<%=camelToKebab(m.typename)%>/<%=camelToKebab(m.typename)%>.jsonschema'
|
|
7
|
+
<%}else{%>
|
|
8
|
+
export * from 'src/simple-app/.resources/<%=camelToKebab(m.typename)%>/<%=camelToKebab(m.typename)%>.jsonschema'
|
|
9
|
+
<%}%>
|
|
10
|
+
<%}%>
|
|
11
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator.
|
|
3
|
+
* --remove-this-line-to-prevent-override--
|
|
4
|
+
* last change 2025-09-01
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
*/
|
|
7
|
+
import { Module } from '@nestjs/common';
|
|
8
|
+
@Module({
|
|
9
|
+
// QueueTuitionClassModule
|
|
10
|
+
imports: [],
|
|
11
|
+
providers: [],
|
|
12
|
+
exports: [],
|
|
13
|
+
})
|
|
14
|
+
export class SimpleAppMiniAppsModule {}
|
|
@@ -11,7 +11,7 @@ import {SimpleAppEventsModule} from './events/events.module'
|
|
|
11
11
|
import {SimpleAppFeaturesModule} from './features/features.module'
|
|
12
12
|
|
|
13
13
|
import { SimpleAppResourceApiModule } from './apis/resource-api.module';
|
|
14
|
-
|
|
14
|
+
import { SimpleAppMiniAppsModule } from './mini-apps/mini-apps.module';
|
|
15
15
|
|
|
16
16
|
@Module({
|
|
17
17
|
imports: [
|
|
@@ -19,6 +19,8 @@ import { SimpleAppResourceApiModule } from './apis/resource-api.module';
|
|
|
19
19
|
SimpleAppResourcesModule,
|
|
20
20
|
SimpleAppEventsModule,
|
|
21
21
|
SimpleAppResourceApiModule,
|
|
22
|
+
SimpleAppFeaturesModule,
|
|
23
|
+
SimpleAppMiniAppsModule
|
|
22
24
|
],
|
|
23
25
|
controllers: [],
|
|
24
26
|
providers: [],
|
|
@@ -27,6 +29,8 @@ import { SimpleAppResourceApiModule } from './apis/resource-api.module';
|
|
|
27
29
|
SimpleAppResourcesModule,
|
|
28
30
|
SimpleAppEventsModule,
|
|
29
31
|
SimpleAppResourceApiModule,
|
|
32
|
+
SimpleAppFeaturesModule,
|
|
33
|
+
SimpleAppMiniAppsModule
|
|
30
34
|
]
|
|
31
35
|
})
|
|
32
36
|
export class SimpleAppModule {}
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
:document="doc"
|
|
8
8
|
@on="actionListener"
|
|
9
9
|
></SimpleAppFormToolBar>
|
|
10
|
-
<div
|
|
11
|
-
class="grid grid-cols-1 lg:grid-cols-2 gap-4 p-2"
|
|
12
|
-
>
|
|
10
|
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4 p-2">
|
|
13
11
|
<SimpleAppInput
|
|
14
12
|
:input-type="SimpleAppInputType.autocomplete"
|
|
15
13
|
:setting="o.getField('#/properties/branch')"
|
|
@@ -19,11 +17,15 @@
|
|
|
19
17
|
:readonly="!doc.isNew()"
|
|
20
18
|
:input-type="SimpleAppInputType.select"
|
|
21
19
|
:setting="o.getField('#/properties/docNoType')"
|
|
22
|
-
:options="
|
|
20
|
+
:options="
|
|
21
|
+
getAllDocFormats().map((item) => ({
|
|
22
|
+
label: docNoTypeMapping[item.docType] || item.docType,
|
|
23
|
+
value: item.docType,
|
|
24
|
+
}))
|
|
25
|
+
"
|
|
23
26
|
v-model="data.docNoType"
|
|
24
27
|
/>
|
|
25
28
|
|
|
26
|
-
|
|
27
29
|
<SimpleAppInput
|
|
28
30
|
:input-type="SimpleAppInputType.text"
|
|
29
31
|
:setting="o.getField('#/properties/docNoFormatNo')"
|
|
@@ -47,7 +49,6 @@
|
|
|
47
49
|
v-model="data.default"
|
|
48
50
|
/>
|
|
49
51
|
|
|
50
|
-
|
|
51
52
|
<SimpleAppInput
|
|
52
53
|
:input-type="SimpleAppInputType.text"
|
|
53
54
|
:setting="o.getField('#/properties/docNoPattern')"
|
|
@@ -65,27 +66,43 @@
|
|
|
65
66
|
</div>
|
|
66
67
|
</SimpleAppForm>
|
|
67
68
|
<DebugDocumentData v-model="data" :label="doc.getDocName()" />
|
|
69
|
+
<DataTable
|
|
70
|
+
:value="formatParams"
|
|
71
|
+
class="p-datatable-sm mt-6"
|
|
72
|
+
stripedRows
|
|
73
|
+
responsiveLayout="scroll"
|
|
74
|
+
>
|
|
75
|
+
<template #header>
|
|
76
|
+
<div class="text-sm font-semibold">Format Parameters</div>
|
|
77
|
+
</template>
|
|
78
|
+
<Column
|
|
79
|
+
field="placeholder"
|
|
80
|
+
header="Placeholder"
|
|
81
|
+
style="width: 30%"
|
|
82
|
+
class="text-xs"
|
|
83
|
+
/>
|
|
84
|
+
<Column field="description" header="Description" class="text-xs" />
|
|
85
|
+
</DataTable>
|
|
68
86
|
</div>
|
|
69
87
|
</template>
|
|
70
88
|
|
|
71
89
|
<script setup lang="ts">
|
|
72
90
|
/**
|
|
73
|
-
* This file was automatically generated by simpleapp generator
|
|
74
|
-
* --remove-this-line-to-prevent-override--
|
|
91
|
+
* This file was automatically generated by simpleapp generator.
|
|
75
92
|
* last change 2024-02-16
|
|
76
93
|
* Author: Ks Tan
|
|
77
94
|
*/
|
|
78
95
|
import { SimpleAppInputType, FormCrudEvent } from "~/types";
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
96
|
+
import { DocumentNoFormat } from "~/simpleapp/generate/openapi";
|
|
97
|
+
import { DocumentnoformatDoc } from "~/simpleapp/docs/DocumentnoformatDoc";
|
|
81
98
|
|
|
82
99
|
const props = defineProps<{
|
|
83
100
|
_id?: string;
|
|
84
|
-
doc?:
|
|
85
|
-
paras?:
|
|
101
|
+
doc?: DocumentnoformatDoc;
|
|
102
|
+
paras?: Partial<DocumentNoFormat>;
|
|
86
103
|
}>();
|
|
87
104
|
|
|
88
|
-
const doc = props.doc ?? useNuxtApp().$
|
|
105
|
+
const doc = props.doc ?? useNuxtApp().$DocumentnoformatDoc()
|
|
89
106
|
const data = doc.getReactiveData();
|
|
90
107
|
const sample = ref("");
|
|
91
108
|
const emits = defineEmits(["after"]);
|
|
@@ -94,9 +111,41 @@ const id = computed(() => props._id ?? "");
|
|
|
94
111
|
/************ start default methods ****************/
|
|
95
112
|
|
|
96
113
|
const newData = () => {
|
|
97
|
-
doc.setNew()
|
|
98
|
-
delete data.value.branch
|
|
99
|
-
}
|
|
114
|
+
doc.setNew();
|
|
115
|
+
delete data.value.branch;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const formatParams = [
|
|
119
|
+
{
|
|
120
|
+
placeholder: "[0000]",
|
|
121
|
+
description: "0001 displays the transaction numbering.",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
placeholder: "{YYYY}",
|
|
125
|
+
description: "Displays 4-digit current year (e.g., 2025-9999).",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
placeholder: "{YY}",
|
|
129
|
+
description: "Displays 2-digit current year (e.g., 25).",
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
placeholder: "{MM}",
|
|
133
|
+
description: "Displays 2-digit current month (e.g., 01-12).",
|
|
134
|
+
},
|
|
135
|
+
{ placeholder: "{ddd}", description: "Displays current day (e.g., Tue)." },
|
|
136
|
+
{
|
|
137
|
+
placeholder: "{DD}",
|
|
138
|
+
description: "Displays 2-digit day of the month (e.g., 01-31).",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
placeholder: "{YYMM}",
|
|
142
|
+
description: "Displays 2-digit year and 2-digit month (e.g., 2504).",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
placeholder: "{YYYYMM}",
|
|
146
|
+
description: "Displays 4-digit year and 2-digit month (e.g., 202504).",
|
|
147
|
+
},
|
|
148
|
+
];
|
|
100
149
|
|
|
101
150
|
const getRecord = async () => {
|
|
102
151
|
if (id.value && id.value != "new") {
|
|
@@ -106,6 +155,18 @@ const getRecord = async () => {
|
|
|
106
155
|
}
|
|
107
156
|
};
|
|
108
157
|
|
|
158
|
+
const docNoTypeMapping: Record<string, string> = {
|
|
159
|
+
CN: "Credit Note",
|
|
160
|
+
ANNOUNCEMENT: "Announcement",
|
|
161
|
+
ENROLL: "Enrolment",
|
|
162
|
+
INV: "Invoice",
|
|
163
|
+
PAY: "Payment",
|
|
164
|
+
REFUND: "Refund",
|
|
165
|
+
STU: "Student",
|
|
166
|
+
TEACHER: "Teacher",
|
|
167
|
+
TUITION: "Tuition Class",
|
|
168
|
+
};
|
|
169
|
+
|
|
109
170
|
getRecord();
|
|
110
171
|
watch(id, async () => await getRecord());
|
|
111
172
|
/************ end default methods ****************/
|
|
@@ -134,7 +195,7 @@ onMounted(async () => {
|
|
|
134
195
|
// };
|
|
135
196
|
/************ end api methods ****************/
|
|
136
197
|
const updateSample = () => {
|
|
137
|
-
sample.value = "
|
|
198
|
+
sample.value = "Format Sample: " + previewDocNo();
|
|
138
199
|
};
|
|
139
200
|
|
|
140
201
|
const previewDocNo = (): string => {
|
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
2
|
+
<div class="flex flex-row">
|
|
3
3
|
<ImageToBase64Uploader
|
|
4
4
|
v-if="changable"
|
|
5
|
+
@image-uploaded="handleBase64"
|
|
5
6
|
#default
|
|
6
|
-
:style="`width:${size}px; height:${size} px`"
|
|
7
7
|
:class="`place-content-center `"
|
|
8
|
-
@image-uploaded="handleBase64"
|
|
9
|
-
:imagePath="imagepath"
|
|
10
8
|
>
|
|
9
|
+
<div v-if="uploading" class="w-full h-full rounded-lg">
|
|
10
|
+
<ProgressSpinner class="w-full h-full rounded-lg min-w-32" />
|
|
11
|
+
</div>
|
|
11
12
|
<NuxtImg
|
|
12
|
-
v-
|
|
13
|
-
class="
|
|
14
|
-
:src="
|
|
13
|
+
v-else
|
|
14
|
+
class="h-full rounded-lg"
|
|
15
|
+
:src="`${server}/users/${uid}/${size}`"
|
|
16
|
+
placeholder="/images/student.png"
|
|
15
17
|
:key="imageKey"
|
|
16
|
-
|
|
17
|
-
/>
|
|
18
|
+
/>
|
|
18
19
|
</ImageToBase64Uploader>
|
|
19
|
-
<div
|
|
20
|
-
v-else
|
|
21
|
-
class="inline-block text-black"
|
|
22
|
-
:style="`width:${size}px; height:${size} px`"
|
|
23
|
-
>
|
|
20
|
+
<div v-else class="inline-block text-black">
|
|
24
21
|
<NuxtImg
|
|
25
22
|
v-if="uid"
|
|
26
|
-
class="
|
|
27
|
-
:
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
class="h-full border rounded-full"
|
|
24
|
+
:src="`${server}/users/${uid}/${size}`"
|
|
25
|
+
placeholder="/images/student.png"
|
|
26
|
+
:key="imageKey"
|
|
30
27
|
/>
|
|
31
28
|
</div>
|
|
32
29
|
</div>
|
|
@@ -34,30 +31,41 @@
|
|
|
34
31
|
<script lang="ts" setup>
|
|
35
32
|
import { updateAvatarVersion } from "~/composables/stringHelper.generate";
|
|
36
33
|
import { PHOTOSIZE } from "~/types";
|
|
37
|
-
|
|
34
|
+
const server = useRuntimeConfig().public.avatarUrl;
|
|
35
|
+
const emits = defineEmits(["upload"]);
|
|
36
|
+
const imageUrl = defineModel<string>();
|
|
37
|
+
const uploading = ref(false);
|
|
38
|
+
const imageKey = ref(0);
|
|
38
39
|
// import {KeyValue} from ''
|
|
39
40
|
const props = defineProps<{
|
|
40
41
|
changable?: boolean;
|
|
41
42
|
size?: PHOTOSIZE;
|
|
42
|
-
uid
|
|
43
|
+
uid: string;
|
|
43
44
|
refreshkey?: number;
|
|
44
45
|
}>();
|
|
45
46
|
const size = computed(() => props.size ?? PHOTOSIZE.S64);
|
|
46
|
-
const imageKey = ref(0);
|
|
47
|
-
const uid = computed(() => props.uid ?? getUserProfile()?.uid);
|
|
48
47
|
// const xorgpath = getCurrentXorg() ? `${getCurrentXorg()}/` : "MC0wLTA/";
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
useNuxtApp().$listen("RefreshPhoto", (resource: string[]) => {
|
|
50
|
+
if (resource[0] == "user" && resource[1] == props.uid) {
|
|
51
|
+
imageKey.value = new Date().getTime();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
51
54
|
|
|
52
55
|
const handleBase64 = async (data: string) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
uploading.value = true;
|
|
57
|
+
const keyvalue = {
|
|
58
|
+
key: `--`,
|
|
59
|
+
value: data,
|
|
60
|
+
};
|
|
61
|
+
const uploadok = await getProfileApi().uploadPhoto(keyvalue);
|
|
62
|
+
if (uploadok) {
|
|
63
|
+
imageKey.value = new Date().getTime();
|
|
64
|
+
uploading.value = false;
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
useNuxtApp().$event("RefreshPhoto", ["user", props.uid]);
|
|
67
|
+
}, 1500);
|
|
68
|
+
}
|
|
69
|
+
uploading.value = false;
|
|
62
70
|
};
|
|
63
71
|
</script>
|