@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.
- package/dist/buildinschemas/branch.d.ts.map +1 -1
- package/dist/buildinschemas/branch.js +10 -0
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/index.d.ts +2 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +5 -1
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/keyvaluepair.d.ts +3 -0
- package/dist/buildinschemas/keyvaluepair.d.ts.map +1 -0
- package/dist/buildinschemas/keyvaluepair.js +28 -0
- package/dist/buildinschemas/keyvaluepair.js.map +1 -0
- package/dist/buildinschemas/message.d.ts +3 -0
- package/dist/buildinschemas/message.d.ts.map +1 -0
- package/dist/buildinschemas/message.js +34 -0
- package/dist/buildinschemas/message.js.map +1 -0
- package/dist/buildinschemas/organization.d.ts.map +1 -1
- package/dist/buildinschemas/organization.js +18 -1
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/buildinschemas/systemmessage.d.ts +3 -0
- package/dist/buildinschemas/systemmessage.d.ts.map +1 -0
- package/dist/buildinschemas/systemmessage.js +43 -0
- package/dist/buildinschemas/systemmessage.js.map +1 -0
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +4 -2
- package/dist/framework.js.map +1 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +37 -9
- package/dist/generate.js.map +1 -1
- package/dist/processors/bpmnbuilder.d.ts.map +1 -1
- package/dist/processors/bpmnbuilder.js +23 -32
- package/dist/processors/bpmnbuilder.js.map +1 -1
- package/dist/processors/jrxmlbuilder.d.ts +3 -0
- package/dist/processors/jrxmlbuilder.d.ts.map +1 -0
- package/dist/processors/jrxmlbuilder.js +57 -0
- package/dist/processors/jrxmlbuilder.js.map +1 -0
- package/dist/type.d.ts +6 -0
- package/dist/type.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/branch.ts +10 -0
- package/src/buildinschemas/index.ts +2 -0
- package/src/buildinschemas/keyvaluepair.ts +26 -0
- package/src/buildinschemas/organization.ts +18 -1
- package/src/buildinschemas/systemmessage.ts +42 -0
- package/src/framework.ts +4 -2
- package/src/generate.ts +41 -13
- package/src/processors/bpmnbuilder.ts +34 -38
- package/src/processors/jrxmlbuilder.ts +38 -0
- package/src/type.ts +7 -1
- package/templates/basic/nest/controller.ts.eta +34 -17
- package/templates/basic/nest/processor.ts.eta +2 -1
- package/templates/basic/nest/resolver.ts.eta +1 -1
- package/templates/basic/nest/service.ts.eta +22 -4
- package/templates/basic/nest/type.ts.eta +2 -2
- package/templates/basic/nuxt/component.select.vue.eta +5 -1
- package/templates/basic/nuxt/pages.form.vue.eta +1 -1
- package/templates/basic/nuxt/pages.mobile.landing.vue.eta +4 -61
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +11 -13
- package/templates/nest/src/app.module.ts.eta +12 -4
- package/templates/nest/src/cloudapi/cloudapi.module.ts._eta +1 -1
- package/templates/nest/src/printapi/api/.gitignore.eta +4 -0
- package/templates/nest/src/printapi/api/.npmignore.eta +1 -0
- package/templates/nest/src/printapi/api/.openapi-generator/FILES.eta +8 -0
- package/templates/nest/src/printapi/api/.openapi-generator/VERSION.eta +1 -0
- package/templates/nest/src/printapi/api/.openapi-generator-ignore.eta +23 -0
- package/templates/nest/src/printapi/api/api.ts.eta +223 -0
- package/templates/nest/src/printapi/api/base.ts.eta +86 -0
- package/templates/nest/src/printapi/api/common.ts.eta +150 -0
- package/templates/nest/src/printapi/api/configuration.ts.eta +110 -0
- package/templates/nest/src/printapi/api/git_push.sh.eta +57 -0
- package/templates/nest/src/printapi/api/index.ts.eta +18 -0
- package/templates/nest/src/printapi/api/openapitools.json.eta +7 -0
- package/templates/nest/src/printapi/printapi.module.ts.eta +15 -0
- package/templates/nest/src/printapi/printapi.service.ts.eta +42 -0
- package/templates/nest/src/simpleapp/apischemas/index.ts._eta +11 -0
- package/templates/nest/src/simpleapp/generate/commons/robotuser.service.ts.eta +5 -4
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +7 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +10 -9
- package/templates/nest/src/simpleapp/generate/processors/autoinc.processor.ts.eta +73 -0
- package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +104 -0
- package/templates/nest/src/simpleapp/generate/processors/docno.processor.ts.eta +77 -0
- package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +115 -0
- package/templates/nest/src/simpleapp/generate/processors/perm.processor.ts.eta +71 -0
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +77 -13
- package/templates/nest/src/simpleapp/generate/processors/sysmsg.processor.ts.eta +49 -0
- package/templates/nest/src/simpleapp/generate/processors/tenant.processor.ts.eta +52 -0
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +12 -5
- package/templates/nest/src/simpleapp/generate/workflow/workflow.controller.ts.eta +2 -2
- package/templates/nest/src/simpleapp/generate/workflow/workflow.delegate.ts.eta +33 -28
- package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +95 -26
- package/templates/nest/src/simpleapp/generate/workflow/workflow.type.ts.eta +4 -4
- package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +15 -0
- package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +3 -1
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +20 -3
- package/templates/nest/src/simpleapp/services/sysmsg.service.ts._etaxxx +43 -0
- package/templates/nest/src/simpleapp/services/userresolver.service.ts._eta +70 -0
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +8 -4
- package/templates/nest/src/simpleapp/types/index.ts._eta +5 -0
- package/templates/nuxt/assets/css/listview.css._eta +2 -2
- package/templates/nuxt/components/button/ButtonAction.vue._eta +11 -5
- package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +11 -2
- package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +1 -1
- package/templates/nuxt/components/form/{FormBranch.vue.eta → FormBranch.vue._eta} +1 -1
- package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +38 -0
- package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +40 -0
- package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +147 -0
- package/templates/nuxt/components/list/ListItem.vue.eta +24 -0
- package/templates/nuxt/components/list/ListMessages.vue.eta +89 -0
- package/templates/nuxt/components/list/ListView.vue.eta +9 -12
- package/templates/nuxt/components/renderer/RendererMoney.vue.eta +11 -12
- package/templates/nuxt/components/select/SelectTemplate.vue.eta +49 -20
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +2 -2
- package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +16 -15
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +92 -8
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +29 -6
- package/templates/nuxt/components/text/TextBold.vue._eta +13 -0
- package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +18 -2
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +12 -3
- package/templates/nuxt/composables/hotvalue.generate.ts.eta +30 -0
- package/templates/nuxt/composables/pusher.ts._eta +13 -0
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +2 -3
- package/templates/nuxt/composables/sysmessage.generate.ts.eta +20 -0
- package/templates/nuxt/composables/workflow.generate.ts.eta +9 -4
- package/templates/nuxt/layouts/mobile.vue._eta +31 -42
- package/templates/nuxt/nuxt.config.ts._eta +2 -2
- package/templates/nuxt/othermodules.d.ts.eta +449 -0
- package/templates/nuxt/pages/[xorg]/mobile/organization/[id].vue._eta +40 -0
- package/templates/nuxt/pages/[xorg]/mobile/organization/{index.vue.eta → index.vue.aetaz} +16 -13
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +21 -15
- package/templates/nuxt/plugins/40.pusher.ts.eta +18 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +10 -1
- package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +4 -1
- package/templates/nuxt/types/schema.ts.eta +8 -1
- package/templates/nuxt/types/simpleappinput.ts.eta +3 -5
- package/templates/printformats/template.jrxml._eta +27 -0
- package/templates/project/groups/admin.json.eta +6 -1
- package/templates/project/jsonschemas/branch.json._eta +113 -0
- package/templates/project/jsonschemas/invoice.json._eta +5 -1
- package/templates/project/jsonschemas/organization.json._eta +111 -0
- package/templates/project/lang/default._json +71 -150
- package/templates/workflow/next/listener.ts.eta +6 -3
- package/tsconfig.tsbuildinfo +1 -1
- /package/templates/nest/src/simpleapp/services/{autoinc.service.ts.eta → autoinc.service.ts.etaxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{branch.service.ts.eta → branch.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{docno.service.ts.eta → docno.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{org.service.ts.eta → org.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{perm.service.ts.eta → perm.service.ts.etaxxx} +0 -0
- /package/templates/nest/src/simpleapp/services/{tenant.service.ts.eta → tenant.service.ts.etaxxx} +0 -0
|
@@ -2,7 +2,7 @@ import { error } from 'console';
|
|
|
2
2
|
/**
|
|
3
3
|
* This file was automatically generated by simpleapp generator. Every
|
|
4
4
|
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
5
|
-
* last change 2024-04-
|
|
5
|
+
* last change 2024-04-21
|
|
6
6
|
* Author: Ks Tan
|
|
7
7
|
*/
|
|
8
8
|
import { WorkflowConfig } from './workflow.config';
|
|
@@ -36,12 +36,14 @@ import {
|
|
|
36
36
|
// import { configuration } from './configuration';
|
|
37
37
|
import { UserContext } from '../commons/user.context';
|
|
38
38
|
import { WorkflowName } from '../types';
|
|
39
|
+
// import { UserResolverService } from '../../services/userresolver.service';
|
|
40
|
+
|
|
39
41
|
//import * as formschemas from '../../workflow/formschema';
|
|
40
42
|
export {
|
|
41
43
|
WorkflowSettingApiSchema,
|
|
42
44
|
WorkflowDataApiSchema,
|
|
43
45
|
} from './workflow.type';
|
|
44
|
-
|
|
46
|
+
import { SimpleAppRobotUserService } from 'src/simpleapp/generate/commons/robotuser.service';
|
|
45
47
|
@Injectable()
|
|
46
48
|
export class WorkflowService {
|
|
47
49
|
protected bpmnServer: BPMNServer;
|
|
@@ -49,22 +51,27 @@ export class WorkflowService {
|
|
|
49
51
|
constructor(
|
|
50
52
|
private workflowconfig: WorkflowConfig,
|
|
51
53
|
private eventEmitter: EventEmitter2,
|
|
54
|
+
// private userResolverService: UserResolverService,
|
|
55
|
+
private robotUserService: SimpleAppRobotUserService,
|
|
52
56
|
) {
|
|
53
|
-
const config
|
|
54
|
-
class HiddenLogger implements
|
|
55
|
-
setOptions(){}
|
|
56
|
-
clear(){}
|
|
57
|
-
get(){
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
const config = this.workflowconfig.getConfig();
|
|
58
|
+
class HiddenLogger implements ILogger {
|
|
59
|
+
setOptions() {}
|
|
60
|
+
clear() {}
|
|
61
|
+
get() {
|
|
62
|
+
return [] as any[];
|
|
63
|
+
}
|
|
64
|
+
debug() {}
|
|
65
|
+
warn() {}
|
|
66
|
+
info() {}
|
|
67
|
+
reportError(err: any) {
|
|
68
|
+
// console.log('report Error:', err);
|
|
69
|
+
}
|
|
70
|
+
async save(filename: any) {}
|
|
71
|
+
log() {}
|
|
72
|
+
error(err: any) {
|
|
73
|
+
// console.log('Error:', err);
|
|
63
74
|
}
|
|
64
|
-
async save(filename:any){}
|
|
65
|
-
log(){}
|
|
66
|
-
error(err: any){console.log("Error:",err )
|
|
67
|
-
}
|
|
68
75
|
}
|
|
69
76
|
this.bpmnServer = new BPMNServer(config, new HiddenLogger());
|
|
70
77
|
this.bpmnServer.listener.on(
|
|
@@ -78,14 +85,14 @@ export class WorkflowService {
|
|
|
78
85
|
* @param appuser
|
|
79
86
|
* @returns array of usertask
|
|
80
87
|
*/
|
|
81
|
-
async getActorUserTask(appuser: UserContext
|
|
88
|
+
async getActorUserTask(appuser: UserContext) {
|
|
82
89
|
const tmp: any[] = await this.bpmnServer.dataStore.findItems({
|
|
83
90
|
'items.status': 'wait',
|
|
84
91
|
'data.tenantId': appuser.getTenantId(),
|
|
85
92
|
//filter uid properties base on function
|
|
86
93
|
$or: [
|
|
87
|
-
{ 'items.assignee': appuser.
|
|
88
|
-
{ 'items.candidateUsers': appuser.
|
|
94
|
+
{ 'items.assignee': appuser.getUid() },
|
|
95
|
+
{ 'items.candidateUsers': appuser.getId() },
|
|
89
96
|
{ 'items.candidateGroups': appuser.getGroups() },
|
|
90
97
|
],
|
|
91
98
|
});
|
|
@@ -119,7 +126,7 @@ export class WorkflowService {
|
|
|
119
126
|
* @returns array of usertask
|
|
120
127
|
*/
|
|
121
128
|
async getMyUserTask(appuser: UserContext) {
|
|
122
|
-
return await this.getActorUserTask(appuser
|
|
129
|
+
return await this.getActorUserTask(appuser);
|
|
123
130
|
}
|
|
124
131
|
|
|
125
132
|
/**
|
|
@@ -441,9 +448,14 @@ export class WorkflowService {
|
|
|
441
448
|
schema: schema,
|
|
442
449
|
};
|
|
443
450
|
} else {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
451
|
+
return {
|
|
452
|
+
processName: processName,
|
|
453
|
+
elementId: elementId,
|
|
454
|
+
schema: 'default',
|
|
455
|
+
};
|
|
456
|
+
//throw new InternalServerErrorException(
|
|
457
|
+
// `Cannot resolve schema from invalid formKey '${schema}', example: 'jsonschema://SimpleApproveReject' or 'custom://your-custom-key'`,
|
|
458
|
+
//);
|
|
447
459
|
}
|
|
448
460
|
} else {
|
|
449
461
|
throw new NotFoundException(
|
|
@@ -486,6 +498,8 @@ export class WorkflowService {
|
|
|
486
498
|
* @param event bpmn-server event instance
|
|
487
499
|
*/
|
|
488
500
|
async applyEventListener(event) {
|
|
501
|
+
// console.log("Workflow", event.context.instance.name,", ID:",event.context.item.element.id,
|
|
502
|
+
// ", Type: " ,event.context.item.element.type, ", name: ", event.context.item.element.name, ", event type: ", event.event)
|
|
489
503
|
if (event.context.item) {
|
|
490
504
|
const workflowName: string = event.context.instance.name;
|
|
491
505
|
const eventType: EXECUTION_EVENT = event.event;
|
|
@@ -495,6 +509,7 @@ export class WorkflowService {
|
|
|
495
509
|
const elementProps = event.context.item.element.def;
|
|
496
510
|
// const usertaskinput = event.context.item.input ?? null;
|
|
497
511
|
const data = event.context.instance.data;
|
|
512
|
+
const appuser = this.robotUserService.prepareAppUser(data);
|
|
498
513
|
const vars = {};
|
|
499
514
|
Object.assign(vars, event.context.item.input);
|
|
500
515
|
event.context.item.input = {};
|
|
@@ -513,7 +528,12 @@ export class WorkflowService {
|
|
|
513
528
|
else if (eventType == EXECUTION_EVENT.node_wait)
|
|
514
529
|
usertaskeventtype = 'wait';
|
|
515
530
|
// console.log("event-------=================================",eventType,usertaskeventtype)
|
|
531
|
+
const assignee = event.context.item.assignee;
|
|
532
|
+
const candidateUsers = event.context.item.candidateUsers;
|
|
533
|
+
const candidateGroups = event.context.item.candidateGroups;
|
|
534
|
+
|
|
516
535
|
if (usertaskeventtype) {
|
|
536
|
+
('');
|
|
517
537
|
const props: UserTaskData = {
|
|
518
538
|
workflowName: workflowName,
|
|
519
539
|
eventType: usertaskeventtype,
|
|
@@ -522,9 +542,9 @@ export class WorkflowService {
|
|
|
522
542
|
elementName: elementName,
|
|
523
543
|
elementProps: {
|
|
524
544
|
startedAt: event.context.item.startedAt,
|
|
525
|
-
assignee:
|
|
526
|
-
candidateGroups:
|
|
527
|
-
candidateUsers:
|
|
545
|
+
assignee: assignee,
|
|
546
|
+
candidateGroups: candidateGroups,
|
|
547
|
+
candidateUsers: candidateUsers,
|
|
528
548
|
dueDate: event.context.item.dueDate,
|
|
529
549
|
followUpDate: event.context.item.followUpDate,
|
|
530
550
|
priority: event.context.item.priority,
|
|
@@ -534,8 +554,12 @@ export class WorkflowService {
|
|
|
534
554
|
vars: vars,
|
|
535
555
|
options: options,
|
|
536
556
|
};
|
|
557
|
+
|
|
558
|
+
//send notification
|
|
537
559
|
this.eventEmitter.emit(
|
|
538
560
|
`${workflowName}.${elementId}.${usertaskeventtype}`,
|
|
561
|
+
appuser,
|
|
562
|
+
|
|
539
563
|
props,
|
|
540
564
|
);
|
|
541
565
|
}
|
|
@@ -560,6 +584,7 @@ export class WorkflowService {
|
|
|
560
584
|
};
|
|
561
585
|
this.eventEmitter.emit(
|
|
562
586
|
`${workflowName}.${elementId}.${servicetaskeventtype}`,
|
|
587
|
+
// appuser,
|
|
563
588
|
props,
|
|
564
589
|
);
|
|
565
590
|
}
|
|
@@ -569,4 +594,48 @@ export class WorkflowService {
|
|
|
569
594
|
}
|
|
570
595
|
}
|
|
571
596
|
}
|
|
597
|
+
|
|
598
|
+
// async userResolver(
|
|
599
|
+
// appuser: UserContext,
|
|
600
|
+
// userids: string | string[] | undefined,
|
|
601
|
+
// data: any,
|
|
602
|
+
// ) {
|
|
603
|
+
// if (!userids) return undefined;
|
|
604
|
+
// if (typeof userids == 'string') userids = [userids];
|
|
605
|
+
// if (!Array.isArray(userids)) return undefined;
|
|
606
|
+
// const newids: string[] = [];
|
|
607
|
+
// for (let i = 0; i < userids.length; i++) {
|
|
608
|
+
// let uid = userids[i].trim();
|
|
609
|
+
// if (
|
|
610
|
+
// uid.substring(0, 1) == '@' &&
|
|
611
|
+
// uid.includes('[') &&
|
|
612
|
+
// uid.includes(']')
|
|
613
|
+
// ) {
|
|
614
|
+
// const regextype = /(?<=\@)(.*?)(?=\[)/;
|
|
615
|
+
// const regexvalue = /(?<=\[)(.*?)(?=\])/;
|
|
616
|
+
|
|
617
|
+
// const usertype = uid.match(regextype)[0].trim();
|
|
618
|
+
// const typevalue = uid.match(regexvalue)[0].trim();
|
|
619
|
+
// let idvalue = '';
|
|
620
|
+
// if (typevalue.substring(0, 6) == '$data.') {
|
|
621
|
+
// const fieldpath = typevalue.replace('$data.', '');
|
|
622
|
+
// idvalue = this.readFieldFromData(fieldpath, data);
|
|
623
|
+
// }
|
|
624
|
+
|
|
625
|
+
// uid = await this.userResolverService.resolve(
|
|
626
|
+
// appuser,
|
|
627
|
+
// usertype,
|
|
628
|
+
// idvalue,
|
|
629
|
+
// data,
|
|
630
|
+
// );
|
|
631
|
+
// }
|
|
632
|
+
// if (uid) newids.push(uid);
|
|
633
|
+
// }
|
|
634
|
+
|
|
635
|
+
// return newids;
|
|
636
|
+
// }
|
|
637
|
+
|
|
638
|
+
// readFieldFromData(path: string, data: any) {
|
|
639
|
+
// return path.split('.').reduce((o, i) => o[i], data);
|
|
640
|
+
// }
|
|
572
641
|
}
|
|
@@ -9,9 +9,9 @@ import { UserContext } from '../commons/user.context';
|
|
|
9
9
|
export type WorkflowSettingApiSchema = {
|
|
10
10
|
userServiceUrl: string;
|
|
11
11
|
callBackUrl?: string;
|
|
12
|
-
assignee?: string;
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
assignee?: string|string[];
|
|
13
|
+
candidateGroups?: string | string[];
|
|
14
|
+
candidateUsers?: string | string[];
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export type WorkflowDataApiSchema = {
|
|
@@ -70,7 +70,7 @@ export type UserTaskData = {
|
|
|
70
70
|
vars:any
|
|
71
71
|
elementProps: {
|
|
72
72
|
startedAt: string;
|
|
73
|
-
assignee?: string;
|
|
73
|
+
assignee?: string|string[];
|
|
74
74
|
candidateGroups?: string | string[];
|
|
75
75
|
candidateUsers?: string | string[];
|
|
76
76
|
dueDate?: string;
|
|
@@ -14,6 +14,21 @@ export class RegTenantApiSchema {
|
|
|
14
14
|
default: '',
|
|
15
15
|
})
|
|
16
16
|
tenantName: string;
|
|
17
|
+
@ApiProperty({
|
|
18
|
+
type: 'string',
|
|
19
|
+
required: true,
|
|
20
|
+
examples: ['Asia/Kuala_Lumpur'],
|
|
21
|
+
default: '',
|
|
22
|
+
})
|
|
23
|
+
timeZone: string;
|
|
24
|
+
@ApiProperty({
|
|
25
|
+
type: Number,
|
|
26
|
+
required: true,
|
|
27
|
+
examples: [0,-460],
|
|
28
|
+
|
|
29
|
+
})
|
|
30
|
+
utcOffset: number;
|
|
31
|
+
|
|
17
32
|
}
|
|
18
33
|
export class MyProfileApiSchemaBranches{
|
|
19
34
|
@ApiProperty({type: 'string'})
|
|
@@ -126,8 +126,10 @@ export class ProfileController {
|
|
|
126
126
|
async createTenant(
|
|
127
127
|
@AppUser() appuser: UserContext,
|
|
128
128
|
@Body('tenantName') tenantName: string,
|
|
129
|
+
@Body('timeZone') timeZone: string,
|
|
130
|
+
@Body('utcOffset') utcOffset:number
|
|
129
131
|
) {
|
|
130
|
-
const result = await this.profileservice.createTenant(appuser, tenantName);
|
|
132
|
+
const result = await this.profileservice.createTenant(appuser, tenantName,timeZone,utcOffset);
|
|
131
133
|
if (result) {
|
|
132
134
|
return result;
|
|
133
135
|
} else {
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
import { UserService, User } from './../services/user.service';
|
|
8
|
+
import countrytimezone from 'countries-and-timezones'
|
|
9
|
+
import countryToCurrency, { Currencies, Countries } from "country-to-currency";
|
|
8
10
|
import {
|
|
9
11
|
Injectable,
|
|
10
12
|
Scope,
|
|
@@ -85,8 +87,18 @@ export class ProfileService {
|
|
|
85
87
|
return userinfo;
|
|
86
88
|
}
|
|
87
89
|
|
|
88
|
-
async createTenant(
|
|
90
|
+
async createTenant(
|
|
91
|
+
appuser: UserContext,
|
|
92
|
+
tenantName: string,
|
|
93
|
+
timeZone: string,
|
|
94
|
+
utcOffset: number
|
|
95
|
+
) {
|
|
89
96
|
// try{
|
|
97
|
+
const timezonedata = countrytimezone.getCountriesForTimezone(timeZone)[0]
|
|
98
|
+
const countryCode = timezonedata['id']
|
|
99
|
+
const countryName = timezonedata['name']
|
|
100
|
+
const currencyCode = countryToCurrency[countryCode]
|
|
101
|
+
|
|
90
102
|
appuser.getDBSession().startTransaction();
|
|
91
103
|
const tenantdata: Tenant = {
|
|
92
104
|
tenantId: 1,
|
|
@@ -112,6 +124,10 @@ export class ProfileService {
|
|
|
112
124
|
orgName: tenantName,
|
|
113
125
|
active: true,
|
|
114
126
|
orgCode: 'HQ',
|
|
127
|
+
timeZone: timeZone,
|
|
128
|
+
offsetMinute: utcOffset,
|
|
129
|
+
currency: currencyCode,
|
|
130
|
+
country: countryCode,
|
|
115
131
|
orgId: 1,
|
|
116
132
|
};
|
|
117
133
|
|
|
@@ -127,6 +143,7 @@ export class ProfileService {
|
|
|
127
143
|
branchId: 1,
|
|
128
144
|
branchCode: 'HQ',
|
|
129
145
|
branchName: tenantName,
|
|
146
|
+
country: countryName,
|
|
130
147
|
active: true,
|
|
131
148
|
orgId: orgResult.orgId,
|
|
132
149
|
tenantId: tenantResult.tenantId,
|
|
@@ -225,7 +242,7 @@ export class ProfileService {
|
|
|
225
242
|
return await appuser.getAllTenants();
|
|
226
243
|
}
|
|
227
244
|
|
|
228
|
-
async getSession(appuser:UserContext){
|
|
229
|
-
return 'OK'
|
|
245
|
+
async getSession(appuser: UserContext) {
|
|
246
|
+
return 'OK';
|
|
230
247
|
}
|
|
231
248
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator. It is changable
|
|
3
|
+
* --remove-this-line-to-prevent-override--
|
|
4
|
+
* last change 2024-04-24
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { InjectModel } from '@nestjs/mongoose';
|
|
9
|
+
import { Model } from 'mongoose';
|
|
10
|
+
import { Injectable } from '@nestjs/common';
|
|
11
|
+
import { UserContext } from '../generate/commons/user.context';
|
|
12
|
+
import { SystemmessageProcessor } from '../generate/processors/sysmsg.processor';
|
|
13
|
+
//import { Systemmessage,SystemmessageHooks} from '../generate/types';
|
|
14
|
+
import * as types from '../generate/types';
|
|
15
|
+
export { Systemmessage } from '../generate/types';
|
|
16
|
+
|
|
17
|
+
@Injectable()
|
|
18
|
+
export class SystemmessageService extends SystemmessageProcessor {
|
|
19
|
+
public hooks: types.SystemmessageHooks = {
|
|
20
|
+
afterCreate : async(appuser:UserContext,data:types.Systemmessage) =>
|
|
21
|
+
await this.afterCreate(appuser,data)
|
|
22
|
+
};
|
|
23
|
+
constructor(@InjectModel('Systemmessage') mydoc: Model<types.Systemmessage>) {
|
|
24
|
+
super(mydoc);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async runDefault(appuser: UserContext) {
|
|
28
|
+
return await this.search(appuser, { uid: appuser.getUid() });
|
|
29
|
+
}
|
|
30
|
+
async afterCreate(appuser:UserContext,data:types.Systemmessage){
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/***************************** begin x-document-api definitions *****************************************/
|
|
35
|
+
async runReadmsg(appuser:UserContext,id:string){
|
|
36
|
+
const data = await this.findById(appuser, id);
|
|
37
|
+
data.read=true
|
|
38
|
+
await await this.findIdThenUpdate(appuser,id,data)
|
|
39
|
+
return data
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/***************************** end x-document-api definitions *****************************************/
|
|
43
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator. It is changable
|
|
3
|
+
* --remove-this-line-to-prevent-override--
|
|
4
|
+
* last change 2024-04-24
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Injectable } from '@nestjs/common';
|
|
9
|
+
import { SimpleAppRobotUserService } from '../generate/commons/robotuser.service';
|
|
10
|
+
import { UserContext } from '../generate/commons/user.context';
|
|
11
|
+
import { UserService } from './user.service';
|
|
12
|
+
import { TeacherService } from './teacher.service';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@Injectable()
|
|
16
|
+
export class UserResolverService {
|
|
17
|
+
constructor(
|
|
18
|
+
private userService: UserService,
|
|
19
|
+
private teacherService: TeacherService,
|
|
20
|
+
private robotUserService: SimpleAppRobotUserService,
|
|
21
|
+
) {}
|
|
22
|
+
async teacher(assignvalue: string, data: any) {
|
|
23
|
+
console.log('assign value for teacher', assignvalue);
|
|
24
|
+
|
|
25
|
+
const appuser = this.robotUserService.prepareAppUser(data);
|
|
26
|
+
console.log('gettenant', appuser.getBranchFilter());
|
|
27
|
+
return this.resolve(appuser, 'teacher', assignvalue, data);
|
|
28
|
+
}
|
|
29
|
+
async resolve(appuser: UserContext, usertype: string, id: string, data: any) {
|
|
30
|
+
let result = '';
|
|
31
|
+
switch (usertype) {
|
|
32
|
+
case 'user':
|
|
33
|
+
result = await this.resolveUser(appuser, id, data);
|
|
34
|
+
break;
|
|
35
|
+
case 'teacher':
|
|
36
|
+
result = await this.resolveTeacher(appuser, id, data);
|
|
37
|
+
break;
|
|
38
|
+
|
|
39
|
+
case 'group':
|
|
40
|
+
// result = await this.resolveTeacher(appuser,id,data)
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async getUser(appuser: UserContext, email: string) {
|
|
47
|
+
if (!email) return undefined;
|
|
48
|
+
console.log('get user from email ', email);
|
|
49
|
+
const user = await this.userService.search(appuser, { email: email });
|
|
50
|
+
console.log('user result', user);
|
|
51
|
+
if (user && user.length > 0) return user[0].uid;
|
|
52
|
+
else return undefined;
|
|
53
|
+
}
|
|
54
|
+
async resolveTeacher(
|
|
55
|
+
appuser: UserContext,
|
|
56
|
+
id: string | undefined,
|
|
57
|
+
data: any,
|
|
58
|
+
) {
|
|
59
|
+
if (!id) return undefined;
|
|
60
|
+
console.log('Find teacher::', id);
|
|
61
|
+
const teacher = await this.teacherService.findById(appuser, id);
|
|
62
|
+
console.log('teacher', teacher);
|
|
63
|
+
return this.getUser(appuser, teacher.email);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async resolveUser(appuser: UserContext, id: string | undefined, data: any) {
|
|
67
|
+
const user = await this.userService.findById(appuser, id);
|
|
68
|
+
return user.uid;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -8,7 +8,10 @@ import { Module } from '@nestjs/common';
|
|
|
8
8
|
import { MongooseModule } from '@nestjs/mongoose';
|
|
9
9
|
import {DocNumberFormatGenerator} from './generate/commons/docnogenerator.service'
|
|
10
10
|
import { AuditTrail } from './generate/commons/audittrail.service';
|
|
11
|
-
import {
|
|
11
|
+
import { CloudapiModule } from 'src/cloudapi/cloudapi.module';
|
|
12
|
+
import { PrintapiModule } from 'src/printapi/printapi.module';
|
|
13
|
+
|
|
14
|
+
import { UserResolverService } from './services/userresolver.service';
|
|
12
15
|
// auto import modules
|
|
13
16
|
<% for(let i=0;i<it.modules.length; i++){ %>
|
|
14
17
|
<% let obj = it.modules[i]%>
|
|
@@ -38,7 +41,8 @@ import { <%=capitalizeFirstLetter(bpmn)%>ListenerService } from 'src/simpleapp/w
|
|
|
38
41
|
|
|
39
42
|
@Module({
|
|
40
43
|
imports: [
|
|
41
|
-
|
|
44
|
+
CloudapiModule,
|
|
45
|
+
PrintapiModule,
|
|
42
46
|
MongooseModule.forFeature([
|
|
43
47
|
<% for(let i=0;i<it.modules.length; i++){ %>
|
|
44
48
|
<% let obj = it.modules[i]%>
|
|
@@ -56,11 +60,11 @@ import { <%=capitalizeFirstLetter(bpmn)%>ListenerService } from 'src/simpleapp/w
|
|
|
56
60
|
<%for(let i=0; i<it.allbpmn.length;i++){%>
|
|
57
61
|
<%let bpmn = it.allbpmn[i]%>
|
|
58
62
|
<%=capitalizeFirstLetter(bpmn)%>ListenerService,
|
|
59
|
-
<%}%>
|
|
63
|
+
<%}%> UserResolverService,
|
|
60
64
|
],
|
|
61
65
|
exports:[SimpleAppRobotUserService,AuditTrail,DocNumberFormatGenerator,<% for(let i=0;i<it.modules.length; i++){ %>
|
|
62
66
|
<%= it.modules[i].docname %>Service,
|
|
63
67
|
<%= it.modules[i].docname %>Resolver,
|
|
64
|
-
<%}%> ProfileService,WorkflowDelegate,WorkflowConfig,WorkflowService,WorkflowUserService,]
|
|
68
|
+
<%}%> ProfileService,WorkflowDelegate,WorkflowConfig,WorkflowService,WorkflowUserService,UserResolverService,]
|
|
65
69
|
})
|
|
66
70
|
export class GenerateModule {}
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
@apply block
|
|
9
9
|
}
|
|
10
10
|
/* :hover.listview-item a */
|
|
11
|
-
.listview-item:active
|
|
11
|
+
.listview-item:active .listlink{
|
|
12
12
|
@apply dark:bg-primary-950 bg-primary-300
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.listview-item
|
|
15
|
+
.listview-item .listlink.router-link-exact-active{
|
|
16
16
|
@apply dark:bg-gray-700 bg-primary-200
|
|
17
17
|
}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<ButtonDefault v-if="!actionName" :animate="animate"
|
|
3
|
-
|
|
2
|
+
<ButtonDefault v-if="!actionName" :animate="animate"
|
|
3
|
+
><slot></slot>def</ButtonDefault
|
|
4
|
+
>
|
|
5
|
+
<ButtonPrimary
|
|
6
|
+
v-else-if="['create', 'update','print'].includes(actionName)"
|
|
7
|
+
:animate="animate"
|
|
4
8
|
><slot></slot
|
|
5
9
|
></ButtonPrimary>
|
|
6
|
-
<ButtonDanger
|
|
10
|
+
<ButtonDanger
|
|
11
|
+
v-else-if="['delete', 'void'].includes(actionName)"
|
|
12
|
+
:animate="animate"
|
|
7
13
|
><slot></slot
|
|
8
14
|
></ButtonDanger>
|
|
9
|
-
<ButtonWarning v-else
|
|
15
|
+
<ButtonWarning v-else :animate="animate"><slot></slot></ButtonWarning>
|
|
10
16
|
</template>
|
|
11
17
|
<script setup lang="ts">
|
|
12
18
|
/**
|
|
@@ -15,5 +21,5 @@
|
|
|
15
21
|
* last change 2024-03-01
|
|
16
22
|
* author: Ks Tan
|
|
17
23
|
*/
|
|
18
|
-
const props = defineProps<{ actionName?: string; animate?:boolean }>();
|
|
24
|
+
const props = defineProps<{ actionName?: string; animate?: boolean }>();
|
|
19
25
|
</script>
|
|
@@ -13,11 +13,13 @@
|
|
|
13
13
|
@view-change="viewChange"
|
|
14
14
|
:events="allevents"
|
|
15
15
|
@cell-focus="chooseDate"
|
|
16
|
+
|
|
16
17
|
xsmall
|
|
17
18
|
>
|
|
18
19
|
<template #today-button>
|
|
19
20
|
<!-- Using Vuetify (but we prefer Wave UI 🤘) -->
|
|
20
|
-
<div
|
|
21
|
+
<div
|
|
22
|
+
@click="chooseDate(new Date(), true)">{{ t("today") }}</div>
|
|
21
23
|
</template>
|
|
22
24
|
<template #cell-content="{ cell, events }">
|
|
23
25
|
<div>
|
|
@@ -31,7 +33,7 @@
|
|
|
31
33
|
<span v-else>{{ cell.content }} </span>
|
|
32
34
|
</div>
|
|
33
35
|
<div>
|
|
34
|
-
<slot name="default" :cell="cell" events="events">
|
|
36
|
+
<slot name="default" :cell="cell" :events="events">
|
|
35
37
|
<Badge
|
|
36
38
|
v-if="events.length > 0"
|
|
37
39
|
@contextmenu="(mouseevent) => onRightClickDate(mouseevent, cell)"
|
|
@@ -75,8 +77,14 @@ const allevents = computed(() => {
|
|
|
75
77
|
const list = props.items.map((item) => {
|
|
76
78
|
if (item.start instanceof Date)
|
|
77
79
|
item.start = item.start.format("YYYY-MM-DD HH:mm");
|
|
80
|
+
else if (typeof item.start == 'string' ){
|
|
81
|
+
item.start = item.start.substring(0,16).replace('T',' ');
|
|
82
|
+
}
|
|
78
83
|
if (item.end instanceof Date)
|
|
79
84
|
item.end = item.end.format("YYYY-MM-DD HH:mm");
|
|
85
|
+
else if (typeof item.end == 'string' ){
|
|
86
|
+
item.end = item.end.substring(0,16).replace('T',' ');
|
|
87
|
+
}
|
|
80
88
|
return item;
|
|
81
89
|
});
|
|
82
90
|
return list;
|
|
@@ -84,6 +92,7 @@ const allevents = computed(() => {
|
|
|
84
92
|
const viewChange = (event: CalViewChange) => {
|
|
85
93
|
viewStatus.value = event;
|
|
86
94
|
};
|
|
95
|
+
|
|
87
96
|
const chooseDate = (date1: Date, force?: boolean) => {
|
|
88
97
|
if (force || !viewStatus.value || viewStatus.value.view == "month") {
|
|
89
98
|
selectedDate.value = date1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="`p-0 absolute bg-yellow-200 bottom-
|
|
2
|
+
<div :class="`p-0 absolute bg-yellow-200 bottom-100 right-0`" v-if="isdebug=='1'">
|
|
3
3
|
<button @click="visible=true" class=" text-white text-xs bg-warning-800 p-0 m-0">
|
|
4
4
|
<i class="pi pi-code"></i>{{ label }}</button>
|
|
5
5
|
<Sidebar v-model:visible="visible" class="text-red-100">
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ImageToBase64Uploader
|
|
3
|
+
v-if="changable"
|
|
4
|
+
@image-uploaded="handleBase64"
|
|
5
|
+
#default
|
|
6
|
+
class="w-20 h-20"
|
|
7
|
+
>
|
|
8
|
+
<Avatar
|
|
9
|
+
:image="getAvatarLink(email ?? '', size)"
|
|
10
|
+
shape="circle"
|
|
11
|
+
size="xlarge"
|
|
12
|
+
/>
|
|
13
|
+
</ImageToBase64Uploader>
|
|
14
|
+
<div v-else class="inline-block border rounded-lg w-20 h-20">
|
|
15
|
+
<Avatar
|
|
16
|
+
:image="getAvatarLink(email ?? '', size)"
|
|
17
|
+
shape="circle"
|
|
18
|
+
size="xlarge"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
/**
|
|
24
|
+
* This file was automatically generated by simpleapp generator during initialization.
|
|
25
|
+
* IT IS NOT CHANGABLE
|
|
26
|
+
* last change 2024-04-06
|
|
27
|
+
* author: Ks Tan
|
|
28
|
+
*/
|
|
29
|
+
const props = defineProps<{
|
|
30
|
+
email?: string;
|
|
31
|
+
size: number;
|
|
32
|
+
changable: boolean;
|
|
33
|
+
}>();
|
|
34
|
+
const imageData = ref("");
|
|
35
|
+
const handleBase64 = (data: string) => {
|
|
36
|
+
imageData.value = data;
|
|
37
|
+
};
|
|
38
|
+
</script>
|