@simitgroup/simpleapp-generator 1.0.63 → 1.0.64
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 copy.md +9 -9
- package/buildinschemas copy/autoincreament.autoinc.jsonschema.json +1 -1
- package/buildinschemas copy/docnoformat.docno.jsonschema.json +2 -2
- package/dist/buildinschemas/autoincreament.js +6 -6
- package/dist/buildinschemas/branch.js +3 -3
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/docnoformat.js +5 -5
- package/dist/buildinschemas/docnoformat.js.map +1 -1
- package/dist/buildinschemas/organization.js +3 -3
- package/dist/buildinschemas/permission.js +5 -5
- package/dist/buildinschemas/permission.js.map +1 -1
- package/dist/buildinschemas/tenant.js +2 -2
- package/dist/buildinschemas/user.js +3 -3
- package/dist/generate.js +2 -2
- package/dist/generate.js.map +1 -1
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
- package/dist/processors/jsonschemabuilder.js +6 -6
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/type.d.ts +7 -19
- package/dist/type.d.ts.map +1 -1
- package/docs/backend.md +2 -2
- package/docs/jsonschema.md +6 -6
- package/package.json +1 -1
- package/src/buildinschemas/autoincreament.ts +6 -6
- package/src/buildinschemas/branch.ts +3 -3
- package/src/buildinschemas/docnoformat.ts +5 -5
- package/src/buildinschemas/organization.ts +3 -3
- package/src/buildinschemas/permission.ts +5 -5
- package/src/buildinschemas/tenant.ts +2 -2
- package/src/buildinschemas/user.ts +3 -3
- package/src/generate.ts +2 -2
- package/src/processors/jsonschemabuilder.ts +7 -9
- package/src/processors/jsonschemabuilder.ts-old +5 -5
- package/src/type.ts +20 -20
- package/templates/basic/nest/controller.ts.eta +18 -18
- package/templates/basic/nest/processor.ts.eta +1 -1
- package/templates/basic/nuxt/pages.[id].vue.eta +1 -1
- package/templates/basic/nuxt/pages.landing.vue.eta +11 -16
- package/templates/basic/nuxt/{pages.crud.vue.eta → pages.new.vue.eta} +22 -9
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +6 -6
- package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +1 -1
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +20 -10
- package/templates/nest/src/simpleapp/generate/models/apievent.model.ts.eta +1 -1
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +8 -8
- package/templates/nest/src/simpleapp/generate/types/apievent.type.ts.eta +1 -1
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +16 -7
- package/templates/nest/src/simpleapp/services/autoinc.service.ts.eta +10 -7
- package/templates/nest/src/simpleapp/services/branch.service.ts.eta +2 -2
- package/templates/nuxt/assets/css/style.css._eta +4 -0
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +2 -1
- package/templates/nuxt/components/{SimpleAppDatatable.vue.eta → DocumentDatatable.vue.eta} +15 -63
- package/templates/nuxt/components/ListView.vue.eta +38 -26
- package/templates/nuxt/components/UserProfileListItem.vue.eta +1 -1
- package/templates/nuxt/components/{EventNotification.vue.eta → event/EventNotification.vue.eta} +1 -1
- package/templates/nuxt/components/{HeaderBar.vue.eta → header/HeaderBar.vue.eta} +6 -6
- package/templates/nuxt/components/{SelectBranch.vue.eta → header/HeaderSelectBranch.vue.eta} +2 -2
- package/templates/nuxt/components/{ButtonMenuPicker.vue.eta → header/button/HeaderButtonMenuPicker.vue.eta} +3 -3
- package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +11 -0
- package/templates/nuxt/components/renderer/index.ts.eta +12 -0
- package/templates/nuxt/components/{SimpleAppAutocomplete.vue.eta → simpleApp/SimpleAppAutocomplete.vue.eta} +13 -1
- package/templates/nuxt/components/{SimpleAppAutocompletemulti.vue.eta → simpleApp/SimpleAppAutocompletemulti.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppCalendar.vue.eta → simpleApp/SimpleAppCalendar.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppCheckbox.vue.eta → simpleApp/SimpleAppCheckbox.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppChip.vue.eta → simpleApp/SimpleAppChip.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppColor.vue.eta → simpleApp/SimpleAppColor.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppDocumentNo.vue.eta → simpleApp/SimpleAppDocumentNo.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppEditor.vue.eta → simpleApp/SimpleAppEditor.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppList.vue.eta → simpleApp/SimpleAppList.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppListmulti.vue.eta → simpleApp/SimpleAppListmulti.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppNumber.vue.eta → simpleApp/SimpleAppNumber.vue.eta} +12 -1
- package/templates/nuxt/components/{SimpleAppPassword.vue.eta → simpleApp/SimpleAppPassword.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppRadio.vue.eta → simpleApp/SimpleAppRadio.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppRating.vue.eta → simpleApp/SimpleAppRating.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppSelect.vue.eta → simpleApp/SimpleAppSelect.vue.eta} +12 -2
- package/templates/nuxt/components/{SimpleAppSelectmulti.vue.eta → simpleApp/SimpleAppSelectmulti.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppSlider.vue.eta → simpleApp/SimpleAppSlider.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppSwitch.vue.eta → simpleApp/SimpleAppSwitch.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppText.vue.eta → simpleApp/SimpleAppText.vue.eta} +13 -2
- package/templates/nuxt/components/{SimpleAppTextarea.vue.eta → simpleApp/SimpleAppTextarea.vue.eta} +13 -2
- package/templates/nuxt/composables/getMenus.generate.ts.eta +4 -1
- package/templates/nuxt/composables/goTo.generate.ts.eta +7 -0
- package/templates/nuxt/composables/notifications.generate.ts.eta +1 -1
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +1 -0
- package/templates/nuxt/layouts/documentlist.vue.eta +23 -7
- package/templates/nuxt/layouts/sidelist.vue.eta +68 -0
- package/templates/nuxt/pages/[xorg]/branch/index.vue.etax +2 -2
- package/templates/nuxt/pages/[xorg]/docnoformat/{[id].vue.eta → [doctype]/[id].vue.eta} +2 -5
- package/templates/nuxt/pages/[xorg]/docnoformat/[doctype]/new.vue.eta +216 -0
- package/templates/nuxt/pages/[xorg]/docnoformat/[doctype].vue.eta +33 -0
- package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +4 -294
- package/templates/nuxt/pages/[xorg]/docnoformat.vue.eta +100 -0
- package/templates/nuxt/pages/[xorg]/organization/[bid].vue.eta +14 -0
- package/templates/nuxt/pages/[xorg]/organization/[id]/branches/[bid].vue +13 -0
- package/templates/nuxt/pages/[xorg]/organization/[id]/branches/new.vue +149 -0
- package/templates/nuxt/pages/[xorg]/organization/[id]/index.vue.eta +1 -0
- package/templates/nuxt/pages/[xorg]/organization/new.vue.eta +145 -0
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +130 -0
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +28 -33
- package/templates/nuxt/pages/[xorg]/user.vue.eta +3 -3
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +1 -1
- package/templates/nuxt/types/documentlist.ts.eta +2 -2
- package/templates/project/jsonschemas/category.json._eta +2 -2
- package/templates/project/jsonschemas/customer.json._eta +2 -2
- package/templates/project/jsonschemas/invoice.json._eta +4 -4
- package/templates/project/jsonschemas/product.json._eta +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/components/renderers/ForeignKeyRender.vue.eta +0 -10
- package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +0 -168
- /package/templates/nuxt/components/{DebugDocumentData.vue.eta → debug/DebugDocumentData.vue.eta} +0 -0
- /package/templates/nuxt/components/{EventDecision.vue.eta → event/EventDecision.vue.eta} +0 -0
- /package/templates/nuxt/components/{ButtonHome.vue.eta → header/button/HeaderButtonHome.vue.eta} +0 -0
- /package/templates/nuxt/components/{ButtonLogout.vue.eta → header/button/HeaderButtonLogout.vue.eta} +0 -0
- /package/templates/nuxt/components/{ButtonProfile.vue.eta → header/button/HeaderButtonProfile.vue.eta} +0 -0
- /package/templates/nuxt/components/{renderers/BooleanRender.vue.eta → renderer/RendererBoolean.vue.eta} +0 -0
- /package/templates/nuxt/components/{renderers/DateRender.vue.eta → renderer/RendererDate.vue.eta} +0 -0
- /package/templates/nuxt/components/{renderers/MoneyRender.vue.eta → renderer/RendererMoney.vue.eta} +0 -0
- /package/templates/nuxt/components/{renderers/MultiTextRender.vue.eta → renderer/RendererMultiText.vue.eta} +0 -0
- /package/templates/nuxt/components/{SimpleAppDynamicInput.vue.eta → simpleApp/SimpleAppDynamicInput.vue.eta} +0 -0
- /package/templates/nuxt/components/{SimpleFieldContainer.vue.eta → simpleApp/SimpleAppFieldContainer.vue.eta} +0 -0
- /package/templates/nuxt/components/{SimpleAppForm.vue.eta → simpleApp/SimpleAppForm.vue.eta} +0 -0
- /package/templates/nuxt/components/{SimpleAppInputTable.vue.eta → simpleApp/SimpleAppInputTable.vue.eta} +0 -0
- /package/templates/nuxt/components/{SimpleAppValue.vue.eta → simpleApp/SimpleAppValue.vue.eta} +0 -0
- /package/templates/nuxt/components/{helper.ts.eta → simpleApp/helper.ts.eta} +0 -0
- /package/templates/nuxt/components/{type.ts.eta → simpleApp/type.ts.eta} +0 -0
|
@@ -3,7 +3,7 @@ import {SchemaType,RESTMethods,IsolationType} from '../type'
|
|
|
3
3
|
export const docnoformat:SchemaType ={
|
|
4
4
|
type: "object",
|
|
5
5
|
"x-simpleapp-config":{
|
|
6
|
-
isolationType:IsolationType.
|
|
6
|
+
isolationType:IsolationType.org,
|
|
7
7
|
documentType:'docno',
|
|
8
8
|
documentName:'docnoformat',
|
|
9
9
|
pageType:"crud",
|
|
@@ -12,8 +12,8 @@ export const docnoformat:SchemaType ={
|
|
|
12
12
|
additionalAutoCompleteFields: ['default'],
|
|
13
13
|
additionalApis:[{
|
|
14
14
|
"action":"listDocFormats",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"entryPoint":"/listdocformats/:doctype",
|
|
16
|
+
"requiredRole":["User"],
|
|
17
17
|
"method":RESTMethods.get,
|
|
18
18
|
"execute":"listDocFormats",
|
|
19
19
|
"description":"get list of document format for 1 doctype"
|
|
@@ -23,8 +23,8 @@ export const docnoformat:SchemaType ={
|
|
|
23
23
|
_id:{type:'string'},
|
|
24
24
|
created:{type:'string'},
|
|
25
25
|
updated:{type:'string'},
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
createdBy:{type:'string'},
|
|
27
|
+
updatedBy:{type:'string'},
|
|
28
28
|
tenantId: {type:'integer',default:1,minimum:1 },
|
|
29
29
|
orgId: {type:'integer',default:1,minimum:1 },
|
|
30
30
|
branchId: {type:'integer',default:1,minimum:1 },
|
|
@@ -17,8 +17,8 @@ export const organization:SchemaType ={
|
|
|
17
17
|
_id:{type:'string'},
|
|
18
18
|
created:{type:'string'},
|
|
19
19
|
updated:{type:'string'},
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
createdBy:{type:'string'},
|
|
21
|
+
updatedBy:{type:'string'},
|
|
22
22
|
tenantId: {type:'integer',default:1,minimum:1 },
|
|
23
23
|
orgId: {type:'integer',default:1,minimum:1 },
|
|
24
24
|
branchId: {type:'integer',default:1,minimum:0 },
|
|
@@ -26,7 +26,7 @@ export const organization:SchemaType ={
|
|
|
26
26
|
orgName: {type: "string",},
|
|
27
27
|
active: {type: "boolean","default":true,},
|
|
28
28
|
description: {type: "string",format:"text",},
|
|
29
|
-
|
|
29
|
+
timeZone: {"type": "string","examples": ["Asia/Kuala_Lumpur"]
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -5,11 +5,11 @@ export const permission:SchemaType ={
|
|
|
5
5
|
"x-simpleapp-config":{
|
|
6
6
|
documentType:'perm',
|
|
7
7
|
documentName:'permission',
|
|
8
|
-
isolationType:IsolationType.
|
|
8
|
+
isolationType:IsolationType.org,
|
|
9
9
|
additionalApis:[{
|
|
10
10
|
action:"listUser",
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
entryPoint:"listuser",
|
|
12
|
+
requiredRole:["SuperAdmin"],
|
|
13
13
|
method:RESTMethods.get,
|
|
14
14
|
execute:"listUser",
|
|
15
15
|
description:"Get current permissionlist lookup user info"
|
|
@@ -19,8 +19,8 @@ export const permission:SchemaType ={
|
|
|
19
19
|
_id:{type:'string'},
|
|
20
20
|
created:{type:'string'},
|
|
21
21
|
updated:{type:'string'},
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
createdBy:{type:'string'},
|
|
23
|
+
updatedBy:{type:'string'},
|
|
24
24
|
tenantId: {type:'integer',default:1,minimum:0},
|
|
25
25
|
orgId: {type:'integer',default:1,minimum:0 },
|
|
26
26
|
branchId: {type:'integer',default:1,minimum:0 },
|
|
@@ -16,8 +16,8 @@ export const tenant:SchemaType ={
|
|
|
16
16
|
_id:{type:'string'},
|
|
17
17
|
created:{type:'string'},
|
|
18
18
|
updated:{type:'string'},
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
createdBy:{type:'string'},
|
|
20
|
+
updatedBy:{type:'string'},
|
|
21
21
|
tenantId: {type:'integer',default:1,minimum:0 },
|
|
22
22
|
orgId: {type:'integer',default:1,minimum:0 },
|
|
23
23
|
branchId: {type:'integer',default:1,minimum:0 },
|
|
@@ -17,13 +17,13 @@ export const user:SchemaType ={
|
|
|
17
17
|
_id:{type:'string'},
|
|
18
18
|
created:{type:'string'},
|
|
19
19
|
updated:{type:'string'},
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
createdBy:{type:'string'},
|
|
21
|
+
updatedBy:{type:'string'},
|
|
22
22
|
tenantId: {type:'integer',default:1,minimum:0 },
|
|
23
23
|
orgId: {type:'integer',default:1,minimum:0 },
|
|
24
24
|
branchId: {type:'integer',default:1,minimum:0 },
|
|
25
25
|
uid: {type: "string",},
|
|
26
|
-
|
|
26
|
+
fullName: {type: "string",minLength:3},
|
|
27
27
|
email: {type: "string",minLength:10,format: "email"},
|
|
28
28
|
active: {type: "boolean",default:true},
|
|
29
29
|
description: {type:"string"},
|
package/src/generate.ts
CHANGED
|
@@ -255,9 +255,9 @@ const generateSchema = ( docname: string,
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
const mapfiles = {
|
|
258
|
-
'pages.
|
|
258
|
+
'pages.new.vue.eta': {
|
|
259
259
|
to:`pages/[xorg]/${docname}`,
|
|
260
|
-
as:'
|
|
260
|
+
as:'new.vue',
|
|
261
261
|
validate: validateWritePage
|
|
262
262
|
},
|
|
263
263
|
'pages.[id].vue.eta': {
|
|
@@ -15,9 +15,7 @@ import {
|
|
|
15
15
|
ChildModels,
|
|
16
16
|
SchemaModel,
|
|
17
17
|
TypeForeignKey,
|
|
18
|
-
TypeForeignKeyCatalogue,
|
|
19
|
-
DocSetting,
|
|
20
|
-
|
|
18
|
+
TypeForeignKeyCatalogue,
|
|
21
19
|
} from '../type';
|
|
22
20
|
const log: Logger<ILogObj> = new Logger();
|
|
23
21
|
const configname = "x-simpleapp-config"
|
|
@@ -25,8 +23,8 @@ const FOREIGNKEY_PROPERTY = 'x-foreignkey'
|
|
|
25
23
|
const COMPULSORYFIELDS={ _id:{type:'string'},
|
|
26
24
|
created:{type:'string'},
|
|
27
25
|
updated:{type:'string'},
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
createdBy:{type:'string'},
|
|
27
|
+
updatedBy:{type:'string'},
|
|
30
28
|
tenantId: {type:'integer',default:1,minimum:1 },
|
|
31
29
|
orgId: {type:'integer',default:1,minimum:1 },
|
|
32
30
|
branchId: {type:'integer',default:1,minimum:1 },
|
|
@@ -212,11 +210,11 @@ const genSchema = async (
|
|
|
212
210
|
if(!childprops['updated']){
|
|
213
211
|
childprops['updated']={type:'string',description:'iso8601 or empty'}
|
|
214
212
|
}
|
|
215
|
-
if(!childprops['
|
|
216
|
-
childprops['
|
|
213
|
+
if(!childprops['createdBy']){
|
|
214
|
+
childprops['createdBy']={type:'string'}
|
|
217
215
|
}
|
|
218
|
-
if(!childprops['
|
|
219
|
-
childprops['
|
|
216
|
+
if(!childprops['updatedBy']){
|
|
217
|
+
childprops['updatedBy']={type:'string'}
|
|
220
218
|
}
|
|
221
219
|
if(!childprops['_id']){
|
|
222
220
|
childprops['_id']={type:'string'}
|
|
@@ -119,8 +119,8 @@ const processObject = (doctype: string,
|
|
|
119
119
|
jsondata.properties['doctype'] = {type: 'string', default:doctype, examples: [doctype],description: 'Control value, dont edit it',};
|
|
120
120
|
jsondata.properties['created'] = {type: 'string',description: 'Control value, dont edit it',};
|
|
121
121
|
jsondata.properties['updated'] = {type: 'string',description: 'Control value, dont edit it',};
|
|
122
|
-
jsondata.properties['
|
|
123
|
-
jsondata.properties['
|
|
122
|
+
jsondata.properties['createdBy'] = {type: 'string',description: 'Control value, dont edit it',};
|
|
123
|
+
jsondata.properties['updatedBy'] = {type: 'string',description: 'Control value, dont edit it',};
|
|
124
124
|
|
|
125
125
|
if(doctype !='tenant'){
|
|
126
126
|
jsondata.properties['tenantId'] = {type: 'number',description: 'Control value, dont edit it',};
|
|
@@ -306,11 +306,11 @@ const genSchema = (docname: string,schematype: string,jsondata: JsonSchemaProper
|
|
|
306
306
|
if(!childprops['updated']){
|
|
307
307
|
childprops['updated']={type:'string',description:'iso8601 or empty'}
|
|
308
308
|
}
|
|
309
|
-
if(!childprops['
|
|
309
|
+
if(!childprops['createdBy']){
|
|
310
310
|
childprops['createdby']={type:'string'}
|
|
311
311
|
}
|
|
312
|
-
if(!childprops['
|
|
313
|
-
childprops['
|
|
312
|
+
if(!childprops['updatedBy']){
|
|
313
|
+
childprops['updatedBy']={type:'string'}
|
|
314
314
|
}
|
|
315
315
|
if(!childprops['_id']){
|
|
316
316
|
childprops['_id']={type:'string'}
|
package/src/type.ts
CHANGED
|
@@ -93,19 +93,19 @@ foreignkeys: MyForeignKey
|
|
|
93
93
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
export type DocSetting = {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
96
|
+
// export type DocSetting = {
|
|
97
|
+
// docName:string,
|
|
98
|
+
// docType:string,
|
|
99
|
+
// colDocNo:string,
|
|
100
|
+
// colDocLabel:string,
|
|
101
|
+
// collectionName:string,
|
|
102
|
+
// autoCompleteFields:string[],
|
|
103
|
+
// docStatusSettings:DocumentStatus[],
|
|
104
|
+
// apiSettings:DocumentApi[],
|
|
105
|
+
// // requireautocomplete:boolean
|
|
106
|
+
// isolationType:string
|
|
107
|
+
// foreignKeys: MyForeignKey
|
|
108
|
+
// }
|
|
109
109
|
|
|
110
110
|
export type DocumentStatus = {
|
|
111
111
|
status:string //'CO', 'V', 'CL', 'D' and etc
|
|
@@ -116,9 +116,9 @@ export type DocumentStatus = {
|
|
|
116
116
|
export enum RESTMethods {'post'='post','get'='get', 'delete'='delete','put'='put', 'patch'='patch'}
|
|
117
117
|
export type DocumentApi = {
|
|
118
118
|
action:string //api action name
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
entryPoint:string //api entry point example:':id', ':id/confirm'
|
|
120
|
+
queryPara?:string[] //what query parameter wish to accept, example: ['description','date']
|
|
121
|
+
requiredRole?: string[] // what special user role wish to allow for this api, example: ['SuperUser']
|
|
122
122
|
method:RESTMethods
|
|
123
123
|
execute:string, //what service class method name to execute, example: 'ping','getDocumentName'
|
|
124
124
|
description:string //description of api
|
|
@@ -126,8 +126,8 @@ export type DocumentApi = {
|
|
|
126
126
|
export enum IsolationType {"none"="none" , "tenant"="tenant","org"="org", "branch"="branch"}
|
|
127
127
|
// export type ImportLibs = {"lib":string,"as":string}
|
|
128
128
|
export type Formula = {
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
jsonPath:string //example: "$.subtotal","$.details[*]"
|
|
130
|
+
formula:string //example "jslib.getDocumentSubTotal(@F{$.details})"
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
export type SchemaConfig = {
|
|
@@ -158,8 +158,8 @@ export type SchemaFields = {
|
|
|
158
158
|
branchId: SimpleAppJSONSchema7
|
|
159
159
|
created: SimpleAppJSONSchema7
|
|
160
160
|
updated: SimpleAppJSONSchema7
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
createdBy: SimpleAppJSONSchema7
|
|
162
|
+
updatedBy: SimpleAppJSONSchema7
|
|
163
163
|
[key:string]:SimpleAppJSONSchema7 | SimpleAppJSONSchema7[] | undefined
|
|
164
164
|
|
|
165
165
|
}
|
|
@@ -126,17 +126,17 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
|
|
|
126
126
|
|
|
127
127
|
<% for(let i=0;i<it.apiSettings.length;i++){%>
|
|
128
128
|
<% let api = it.apiSettings[i] %>
|
|
129
|
-
<%~ `@${capitalizeFirstLetter(api.method)}('${api.
|
|
129
|
+
<%~ `@${capitalizeFirstLetter(api.method)}('${api.entryPoint}')`%>
|
|
130
130
|
<%if(superadmindoctype.includes(it.doctype)){%>
|
|
131
131
|
@Roles(Role.SuperAdmin,Role.<%= `${it.typename}_${api.action}`%>,
|
|
132
|
-
<%if(api.
|
|
133
|
-
<% for(let r=0;r<api.
|
|
132
|
+
<%if(api.requiredRole && api.requiredRole.length>0) { %>
|
|
133
|
+
<% for(let r=0;r<api.requiredRole.length;r++){%>Role.<%=api.requiredRole[r]%>,<%}%>
|
|
134
134
|
<%}%>
|
|
135
135
|
)
|
|
136
136
|
<%}else{%>
|
|
137
137
|
@Roles(Role.SuperAdmin,Role.SuperUser,Role.<%= `${it.typename}_${api.action}`%>,
|
|
138
|
-
<%if(api.
|
|
139
|
-
<% for(let r=0;r<api.
|
|
138
|
+
<%if(api.requiredRole && api.requiredRole.length>0) { %>
|
|
139
|
+
<% for(let r=0;r<api.requiredRole.length;r++){%>Role.<%=api.requiredRole[r]%>,<%}%>
|
|
140
140
|
<%}%>
|
|
141
141
|
)
|
|
142
142
|
<%}%>
|
|
@@ -144,13 +144,13 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
|
|
|
144
144
|
@ApiResponse({status: 200,description: '<%=api.description%>' ,type: Object })
|
|
145
145
|
@ApiResponse({status: 418,description: 'undefine bpmn,setDocumentStatus or bpmn'})
|
|
146
146
|
@ApiOperation({ operationId: '<%=api.execute ??api.action%>' })
|
|
147
|
-
<% if(api.
|
|
148
|
-
<%for(let q=0;q<api.
|
|
149
|
-
@ApiQuery({name: "<%=api['
|
|
147
|
+
<% if(api.queryPara && api.queryPara.length>0) {%>
|
|
148
|
+
<%for(let q=0;q<api.queryPara.length; q++){%>
|
|
149
|
+
@ApiQuery({name: "<%=api['queryPara'][q]%>",required: false,type: String})
|
|
150
150
|
<%}%>
|
|
151
151
|
<%}%>
|
|
152
|
-
async <%=api.execute??api.action %>(@AppUser() appuser: UserContext,@Res() res:Response,<% if(api.
|
|
153
|
-
<%let subpath = api.
|
|
152
|
+
async <%=api.execute??api.action %>(@AppUser() appuser: UserContext,@Res() res:Response,<% if(api.entryPoint && api.entryPoint.includes(':')) {%>
|
|
153
|
+
<%let subpath = api.entryPoint.split('/')%>
|
|
154
154
|
<% for(let a=0;a<subpath.length;a++){%>
|
|
155
155
|
<%const partstr = subpath[a]%>
|
|
156
156
|
<%if(partstr.includes(':')){%>
|
|
@@ -159,16 +159,16 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
|
|
|
159
159
|
<%}%>
|
|
160
160
|
<%}%>
|
|
161
161
|
<%}%>
|
|
162
|
-
<% if(api.
|
|
163
|
-
<%for(let q=0;q<api.
|
|
164
|
-
<% const qp = api['
|
|
162
|
+
<% if(api.queryPara && api.queryPara.length>0) {%>
|
|
163
|
+
<%for(let q=0;q<api.queryPara.length; q++){%>
|
|
164
|
+
<% const qp = api['queryPara'][q] %>
|
|
165
165
|
@Query('<%=qp%>') <%=qp%>: string,
|
|
166
166
|
<%}%>
|
|
167
167
|
<%}%>
|
|
168
168
|
){
|
|
169
169
|
<%if(api.execute){%>
|
|
170
|
-
const result = await this.service.<%=api.execute%>(appuser,<% if(api.
|
|
171
|
-
<%let subpath = api.
|
|
170
|
+
const result = await this.service.<%=api.execute%>(appuser,<% if(api.entryPoint && api.entryPoint.includes(':')) {%>
|
|
171
|
+
<%let subpath = api.entryPoint.split('/')%>
|
|
172
172
|
<% for(let a=0;a<subpath.length;a++){%>
|
|
173
173
|
<%const partstr = subpath[a]%>
|
|
174
174
|
<%if(partstr.includes(':')){%>
|
|
@@ -177,9 +177,9 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
|
|
|
177
177
|
<%}%>
|
|
178
178
|
<%}%>
|
|
179
179
|
<%}%>
|
|
180
|
-
<% if(api.
|
|
181
|
-
<%for(let q=0;q<api.
|
|
182
|
-
<%= api['
|
|
180
|
+
<% if(api.queryPara && api.queryPara.length>0) {%>
|
|
181
|
+
<%for(let q=0;q<api.queryPara.length; q++){%>
|
|
182
|
+
<%= api['queryPara'][q] %>,
|
|
183
183
|
<%}%>
|
|
184
184
|
<%}%>
|
|
185
185
|
)
|
|
@@ -59,7 +59,7 @@ export class <%= it.typename %>Processor extends SimpleAppService<<%= it.typenam
|
|
|
59
59
|
// <%~ JSON.stringify(fml) %>
|
|
60
60
|
//const tmp = jsopbj.query(vdata,fieldpath).filter((item:string)=>item!='')
|
|
61
61
|
|
|
62
|
-
jsopbj.apply(data, '<%~ fml.
|
|
62
|
+
jsopbj.apply(data, '<%~ fml.jsonPath %>', function(value:any) { return <%~fml.formula %> });
|
|
63
63
|
|
|
64
64
|
<%}) %>
|
|
65
65
|
<%} %>
|
|
@@ -6,14 +6,9 @@
|
|
|
6
6
|
* last change 2023-09-09
|
|
7
7
|
* author: Ks Tan
|
|
8
8
|
*/
|
|
9
|
-
<% const skipcolumns = ['_id','
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
import MultiTextRender from '~/components/renderers/MultiTextRender.vue'
|
|
13
|
-
import BooleanRender from '~/components/renderers/BooleanRender.vue'
|
|
14
|
-
import DateRender from '~/components/renderers/DateRender.vue'
|
|
15
|
-
import ForeignKeyRender from '~/components/renderers/ForeignKeyRender.vue'
|
|
16
|
-
|
|
9
|
+
<% const skipcolumns = ['_id','createdBy','created','updatedBy','updated','orgId','branchId','tenantId','doctype'] %>
|
|
10
|
+
|
|
11
|
+
import { CellSetting } from "~/types";
|
|
17
12
|
const {$<%= it.typename %>Doc } = useNuxtApp();
|
|
18
13
|
const doc = $<%= it.typename %>Doc()
|
|
19
14
|
const data = doc.getReactiveData();
|
|
@@ -29,13 +24,13 @@ definePageMeta({
|
|
|
29
24
|
<%} else if(['string','number','integer'].indexOf(obj.type)>=0){%>'<%=key%>',
|
|
30
25
|
<%} else if(obj.type =='object' && obj['x-foreignkey'] ){%>
|
|
31
26
|
{
|
|
32
|
-
title:'<%=
|
|
27
|
+
title:t('<%=key%>'),
|
|
33
28
|
field:'<%=key%>',
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
rendererName:'RendererForeignKey',
|
|
30
|
+
rendererSetting:{collection:'<%=obj["x-foreignkey"]%>' }
|
|
36
31
|
},
|
|
37
32
|
<%}%>
|
|
38
|
-
<%})%>],
|
|
33
|
+
<%})%>] as CellSetting[],
|
|
39
34
|
sorts:[
|
|
40
35
|
<%if(it.jsonschema['x-simpleapp-config'] && it.jsonschema['x-simpleapp-config']['uniqueKey']){%>
|
|
41
36
|
['<%=it.jsonschema['x-simpleapp-config']['uniqueKey']%>','asc'],
|
|
@@ -57,19 +52,19 @@ const exitRecord = ()=>{
|
|
|
57
52
|
}
|
|
58
53
|
|
|
59
54
|
watch(()=> useRoute().fullPath ,(newvalue,oldvalue)=>{
|
|
60
|
-
visible.value =
|
|
55
|
+
visible.value = useRoute().params.id || useRoute().fullPath.includes("/new") ? true : false;
|
|
61
56
|
})
|
|
62
57
|
|
|
63
58
|
onNuxtReady(()=>{
|
|
64
|
-
visible.value = useRoute().params.id ? true : false;
|
|
59
|
+
visible.value = useRoute().params.id || useRoute().fullPath.includes('/new') ? true : false;
|
|
65
60
|
})
|
|
66
61
|
</script>
|
|
67
62
|
<template>
|
|
68
63
|
<div>
|
|
69
64
|
<Button class="bg-primary-600 hover:bg-primary-400 text-white" v-if="canPerform(String(useRoute().meta.name),'create')" @click="newData">New</Button>
|
|
70
65
|
<Dialog v-model:visible="visible"
|
|
71
|
-
:pt="{root:{class:'w-full h-full bg-white'}}"
|
|
72
|
-
modal :header="doc.getDocName()"
|
|
66
|
+
:pt="{ root: { class: 'w-full h-full bg-white' } , headertitle:{class:'m-2 ml-6 text-2xl font-bold'}}"
|
|
67
|
+
modal :header="t(doc.getDocName())"
|
|
73
68
|
:autoZIndex="false"
|
|
74
69
|
@update:visible="exitRecord"
|
|
75
70
|
>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<% const skipcolumns = ['_id','
|
|
1
|
+
<% const skipcolumns = ['_id','createdBy','created','updatedBy','updated','orgId','branchId','tenantId','doctype'] %>
|
|
2
2
|
<script setup lang="ts">
|
|
3
3
|
/**
|
|
4
4
|
* This file was automatically generated by simpleapp everytime regenerate code.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import ConfirmPopup from 'primevue/confirmpopup';
|
|
11
11
|
import { useConfirm } from "primevue/useconfirm";
|
|
12
12
|
const confirm = useConfirm();
|
|
13
|
-
|
|
13
|
+
const isReadOnly =ref(true)
|
|
14
14
|
const {$<%= it.typename %>Doc,$event } = useNuxtApp();
|
|
15
15
|
const doc = $<%= it.typename %>Doc()
|
|
16
16
|
const data = doc.getReactiveData();
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
const fetchRecord = async (id:string) =>{
|
|
19
19
|
await doc.getById(id)
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
|
|
22
|
+
const id = String(useRoute().params.id);
|
|
23
|
+
|
|
24
|
+
|
|
25
25
|
const disabled = computed(()=>{
|
|
26
26
|
return false
|
|
27
27
|
})
|
|
@@ -73,10 +73,20 @@ const newData = ()=>{
|
|
|
73
73
|
const refresh = ()=>{
|
|
74
74
|
$event('RefreshDocumentList',{documentName:doc.getDocName()})
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
if(id){
|
|
78
|
+
fetchRecord(id);
|
|
79
|
+
}
|
|
80
|
+
|
|
76
81
|
</script>
|
|
77
|
-
<template>
|
|
78
|
-
<SimpleAppForm #default="o" :document="doc">
|
|
79
|
-
|
|
82
|
+
<template>
|
|
83
|
+
<SimpleAppForm #default="o" :document="doc" :readonly="isReadOnly">
|
|
84
|
+
<div v-if="isReadOnly" class="w-full">
|
|
85
|
+
<Button
|
|
86
|
+
class="bg-primary-600 hover:bg-primary-400" @click="isReadOnly=false"
|
|
87
|
+
type="button" >Edit</Button>
|
|
88
|
+
</div>
|
|
89
|
+
<div v-else class="simpleapp-tool-bar col-span-4 text-left gap-4" >
|
|
80
90
|
<Button class="" :disabled="disabled" @click="newData" type="button" v-if="canPerform(doc.getDocName(),'create')">New</Button>
|
|
81
91
|
<Button class="bg-primary-600 hover:bg-primary-400 text-white" :disabled="disabled" @click="createData" type="button" v-if="canPerform(doc.getDocName(),'create') && doc.isNew()">Create</Button>
|
|
82
92
|
<Button class="bg-primary-600 hover:bg-primary-400 text-white" :disabled="disabled" @click="updateData" type="button" v-if="canPerform(doc.getDocName(),'update') && !doc.isNew()">Update</Button>
|
|
@@ -86,6 +96,7 @@ const refresh = ()=>{
|
|
|
86
96
|
<ProgressSpinner v-if="disabled==true" style="width: 2rem; height: 2rem" ></ProgressSpinner>
|
|
87
97
|
<ConfirmPopup></ConfirmPopup>
|
|
88
98
|
</div>
|
|
99
|
+
<div class="grid grid-cols-4 gap-4">
|
|
89
100
|
<%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
|
|
90
101
|
|
|
91
102
|
<% let obj=it.jsonschema.properties[key] %>
|
|
@@ -221,5 +232,7 @@ const refresh = ()=>{
|
|
|
221
232
|
<!-- <%~ JSON.stringify(obj) %>-->
|
|
222
233
|
<%}%>
|
|
223
234
|
<%})%>
|
|
235
|
+
</div>
|
|
224
236
|
</SimpleAppForm>
|
|
237
|
+
<DebugDocumentData v-model="data"/>
|
|
225
238
|
</template>
|
|
@@ -104,8 +104,8 @@ export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<
|
|
|
104
104
|
|
|
105
105
|
<%for(let i=0;i<it.apiSettings.length;i++){%>
|
|
106
106
|
<% let api = it.apiSettings[i] %>
|
|
107
|
-
async <%=api.action%>(<% if(api.
|
|
108
|
-
<%let subpath = api.
|
|
107
|
+
async <%=api.action%>(<% if(api.entryPoint && api.entryPoint.includes(':')) {%>
|
|
108
|
+
<%let subpath = api.entryPoint.split('/')%>
|
|
109
109
|
<% for(let a=0;a<subpath.length;a++){%>
|
|
110
110
|
<%const partstr = subpath[a]%>
|
|
111
111
|
<%if(partstr.includes(':')){%>
|
|
@@ -116,8 +116,8 @@ export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<
|
|
|
116
116
|
<%}%>){
|
|
117
117
|
//const recordid: string = this.data.value._id ?? '';
|
|
118
118
|
return await this.docapi.<%=api.action%>(
|
|
119
|
-
<% if(api.
|
|
120
|
-
<%let subpath = api.
|
|
119
|
+
<% if(api.entryPoint && api.entryPoint.includes(':')) {%>
|
|
120
|
+
<%let subpath = api.entryPoint.split('/')%>
|
|
121
121
|
<% for(let a=0;a<subpath.length;a++){%>
|
|
122
122
|
<%const partstr = subpath[a]%>
|
|
123
123
|
<%if(partstr.includes(':')){%>
|
|
@@ -140,7 +140,7 @@ export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<
|
|
|
140
140
|
|
|
141
141
|
|
|
142
142
|
reCalculateValue(){
|
|
143
|
-
console.log('trigger new recalculate')
|
|
143
|
+
//console.log('trigger new recalculate')
|
|
144
144
|
const data = this.getData()
|
|
145
145
|
|
|
146
146
|
<% if(it.jsonschema['x-simpleapp-config']['formulas']){ %>
|
|
@@ -149,7 +149,7 @@ export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<
|
|
|
149
149
|
// <%~ JSON.stringify(fml) %>
|
|
150
150
|
//const tmp = jsonpath.query(vdata,fieldpath).filter((item:string)=>item!='')
|
|
151
151
|
|
|
152
|
-
jsonpath.apply(data, '<%~ fml.
|
|
152
|
+
jsonpath.apply(data, '<%~ fml.jsonPath %>', function(value) { return <%~fml.formula %> });
|
|
153
153
|
|
|
154
154
|
<%}) %>
|
|
155
155
|
<%} %>
|
|
@@ -34,6 +34,8 @@ export class UserContext {
|
|
|
34
34
|
protected xOrg: string = '';
|
|
35
35
|
protected tenantId: number = 0;
|
|
36
36
|
protected orgId: number = 0;
|
|
37
|
+
protected orgRecordId:string = ''
|
|
38
|
+
protected branchRecordId:string = ''
|
|
37
39
|
protected branchId: number = 0;
|
|
38
40
|
protected ssoACL: any = {};
|
|
39
41
|
protected token: string = '';
|
|
@@ -157,14 +159,18 @@ export class UserContext {
|
|
|
157
159
|
if(users && users.length>0){
|
|
158
160
|
const userinfo = users[0]
|
|
159
161
|
|
|
160
|
-
|
|
162
|
+
console.log(userinfo)
|
|
161
163
|
if(this.tenantId>0){
|
|
162
164
|
const myperm=userinfo.permissions[0]
|
|
165
|
+
|
|
163
166
|
if(myperm && myperm.group){
|
|
164
167
|
userinfo.group = myperm.group
|
|
165
168
|
userinfo.roles = rolegroups[userinfo.group]()
|
|
169
|
+
|
|
170
|
+
userinfo.branchRecordId = myperm.currentbranch[0].branchRecordId
|
|
166
171
|
userinfo.branchCode = myperm.currentbranch[0].branchCode
|
|
167
172
|
userinfo.branchName = myperm.currentbranch[0].branchName
|
|
173
|
+
userinfo.orgRecordId = myperm.currentorg[0]._id
|
|
168
174
|
userinfo.orgCode = myperm.currentorg[0].orgCode
|
|
169
175
|
userinfo.orgName = myperm.currentorg[0].orgName
|
|
170
176
|
|
|
@@ -181,11 +187,11 @@ export class UserContext {
|
|
|
181
187
|
|
|
182
188
|
|
|
183
189
|
//update last activtity dont too frequent
|
|
184
|
-
if(!dblastactivity || currentitme - lastvisit > 5000 ){
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
190
|
+
//if(!dblastactivity || currentitme - lastvisit > 5000 ){
|
|
191
|
+
// const newusermodel = await this.usermodel.findById(userinfo._id)
|
|
192
|
+
// newusermodel.lastActivity= this.lastActivity
|
|
193
|
+
// const result = await newusermodel.save()
|
|
194
|
+
//}
|
|
189
195
|
|
|
190
196
|
// const result = await this.usermodel.findOneAndUpdate({_id: userinfo._id},{lastActivity: new Date().toISOString})
|
|
191
197
|
return userinfo
|
|
@@ -217,6 +223,8 @@ export class UserContext {
|
|
|
217
223
|
this.branchName = userinfo['branchName'] ?? ''
|
|
218
224
|
this.orgCode = userinfo['orgCode'] ?? ''
|
|
219
225
|
this.orgName = userinfo['orgName'] ?? ''
|
|
226
|
+
this.orgRecordId = userinfo['orgRecordId'] ?? ''
|
|
227
|
+
this.branchRecordId = userinfo['branchRecordId'] ?? ''
|
|
220
228
|
this.group = userinfo['group'] ?? ''
|
|
221
229
|
this.roles = userinfo['roles'] ?? [Role.Everyone,Role.User]
|
|
222
230
|
}else{
|
|
@@ -271,8 +279,8 @@ export class UserContext {
|
|
|
271
279
|
tenantId: u.tenantId,
|
|
272
280
|
orgId: u.orgId,
|
|
273
281
|
branchId: u.branchId,
|
|
274
|
-
|
|
275
|
-
|
|
282
|
+
createdBy: u.uid,
|
|
283
|
+
updatedBy: u.uid,
|
|
276
284
|
created: new Date().toISOString(),
|
|
277
285
|
updated: new Date().toISOString()
|
|
278
286
|
};
|
|
@@ -280,7 +288,7 @@ export class UserContext {
|
|
|
280
288
|
getUpdateFilter = () => {
|
|
281
289
|
const u = this;
|
|
282
290
|
return {
|
|
283
|
-
|
|
291
|
+
updatedBy: u.uid,
|
|
284
292
|
updated: new Date().toISOString()
|
|
285
293
|
};
|
|
286
294
|
};
|
|
@@ -312,6 +320,8 @@ export class UserContext {
|
|
|
312
320
|
sessionId:this.sessionId,
|
|
313
321
|
tenantId: this.getTenantId(),
|
|
314
322
|
orgId: this.getOrgId(),
|
|
323
|
+
orgRecordId: this.orgRecordId ,
|
|
324
|
+
branchRecordId: this.branchRecordId,
|
|
315
325
|
branchId: this.getBranchId(),
|
|
316
326
|
branchCode: this.branchCode,
|
|
317
327
|
branchName: this.branchName,
|
|
@@ -386,7 +396,7 @@ export class UserContext {
|
|
|
386
396
|
// console.log("find invitation:",res)
|
|
387
397
|
if(!res.uid){
|
|
388
398
|
res.uid = this.getUid()
|
|
389
|
-
res.
|
|
399
|
+
res.fullName = this.fullname
|
|
390
400
|
res.active = true
|
|
391
401
|
|
|
392
402
|
if(decision=='accept'){
|