@simitgroup/simpleapp-generator 1.2.6 → 1.2.7

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.
Files changed (67) hide show
  1. package/README.md +6 -0
  2. package/dist/buildinschemas/organization.js +2 -2
  3. package/dist/buildinschemas/organization.js.map +1 -1
  4. package/package.json +1 -1
  5. package/src/buildinschemas/organization.ts +2 -2
  6. package/templates/basic/nest/controller.ts.eta +25 -21
  7. package/templates/basic/nest/service.ts.eta +5 -5
  8. package/templates/basic/nuxt/default.ts.eta +1 -1
  9. package/templates/basic/nuxt/pages.form.vue.eta +4 -4
  10. package/templates/basic/nuxt/pages.landing.vue.eta +9 -0
  11. package/templates/basic/nuxt/pages.viewer.vue.eta +4 -3
  12. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +6 -17
  13. package/templates/nest/src/simpleapp/apischemas/index.ts._eta +10 -0
  14. package/templates/nest/src/simpleapp/generate/apischemas/index.ts.eta +7 -19
  15. package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +20 -0
  16. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +9 -3
  17. package/templates/nest/src/simpleapp/generate/types/index.ts.eta +3 -3
  18. package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +1 -4
  19. package/templates/nest/src/simpleapp/types/index.ts._eta +7 -0
  20. package/templates/nuxt/assets/css/calendar.css._eta +37 -0
  21. package/templates/nuxt/assets/css/style.css._eta +3 -2
  22. package/templates/nuxt/assets/primevue/passthrough.ts._eta +16 -5
  23. package/templates/nuxt/components/button/ButtonDanger.vue._eta +6 -0
  24. package/templates/nuxt/components/button/ButtonDefault.vue._eta +6 -0
  25. package/templates/nuxt/components/button/ButtonPrimary.vue._eta +6 -0
  26. package/templates/nuxt/components/button/ButtonWarning.vue._eta +6 -0
  27. package/templates/nuxt/components/calendar/CalendarByResource.vue.eta +167 -0
  28. package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +74 -0
  29. package/templates/nuxt/components/docPage/DocPageList.vue.eta +48 -40
  30. package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +10 -10
  31. package/templates/nuxt/components/header/HeaderBar.vue._eta +25 -12
  32. package/templates/nuxt/components/renderer/RendererBoolean.vue.eta +6 -1
  33. package/templates/nuxt/components/renderer/RendererDate.vue.eta +6 -0
  34. package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +7 -1
  35. package/templates/nuxt/components/renderer/RendererLink.vue.eta +33 -0
  36. package/templates/nuxt/components/renderer/RendererMoney.vue.eta +11 -1
  37. package/templates/nuxt/components/renderer/RendererMultiText.vue.eta +6 -0
  38. package/templates/nuxt/components/renderer/RendererViewer.vue.eta +32 -0
  39. package/templates/nuxt/components/renderer/{index.ts.eta → index.ts._eta} +10 -2
  40. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +3 -3
  41. package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +1 -1
  42. package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +1 -1
  43. package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +1 -1
  44. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue.eta +3 -2
  45. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +1 -1
  46. package/templates/nuxt/components/simpleApp/pending/SimpleAppValue.vue +1 -1
  47. package/templates/nuxt/composables/screensize.generate.ts.eta +1 -0
  48. package/templates/nuxt/composables/stringHelper.generate.ts.eta +3 -1
  49. package/templates/nuxt/error.vue._eta +1 -1
  50. package/templates/nuxt/layouts/default.vue._eta +47 -8
  51. package/templates/nuxt/nuxt.config.ts._eta +5 -1
  52. package/templates/nuxt/pages/[xorg]/index.vue._eta +11 -9
  53. package/templates/nuxt/pages/[xorg]/organization.vue.eta +5 -0
  54. package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +13 -2
  55. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +6 -0
  56. package/templates/nuxt/types/calendar.ts.eta +54 -0
  57. package/templates/nuxt/types/documentlist.ts.eta +6 -0
  58. package/templates/nuxt/types/events.ts.eta +5 -5
  59. package/templates/nuxt/types/index.ts._eta +4 -3
  60. package/templates/nuxt/types/listview.ts.eta +6 -0
  61. package/templates/nuxt/types/notifications.ts.eta +6 -1
  62. package/templates/nuxt/types/others.ts.eta +6 -1
  63. package/templates/nuxt/types/schema.ts.eta +8 -0
  64. package/templates/nuxt/types/simpleappinput.ts.eta +6 -0
  65. package/templates/nuxt/types/user.ts.eta +8 -0
  66. package/templates/nuxt/types/workflow.ts.eta +6 -1
  67. package/tsconfig.tsbuildinfo +1 -1
package/README.md CHANGED
@@ -34,6 +34,12 @@ SimpleApp generator is a typescript code generator for convert jsonschemas becom
34
34
  4. [End to End test](./docs/test.md)
35
35
  5. [BPMN walk through](./docs/bpmn.md)
36
36
  6. [Language](./doc/language.md)
37
+ 7. Viewer, with add, update. using event after and properties `paras`
38
+ 8. Document Status
39
+ 9. Additional Api & define api schema
40
+ 10.SimpleAppInputs
41
+ 11.Role Base Access Control
42
+
37
43
 
38
44
  # Quick start
39
45
  1. Simpleapp implement database transaction, and require mongodb cluster, below setup 3 nodes
@@ -28,8 +28,8 @@ exports.organization = {
28
28
  orgName: { type: "string", },
29
29
  active: { type: "boolean", "default": true, },
30
30
  description: { type: "string", format: "text", },
31
- timeZone: { "type": "string", "examples": ["Asia/Kuala_Lumpur"]
32
- }
31
+ timeZone: { "type": "string", "examples": ["Asia/Kuala_Lumpur"] },
32
+ currency: { "type": "string", minimum: 3, maximum: 3 }
33
33
  }
34
34
  };
35
35
  //# sourceMappingURL=organization.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"organization.js","sourceRoot":"","sources":["../../src/buildinschemas/organization.ts"],"names":[],"mappings":";;;AAAA,kCAA4D;AAE/C,QAAA,YAAY,GAAa;IAClC,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAC;QACjB,aAAa,EAAC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QACzC,WAAW,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,MAAM,EAAC,MAAM,GAAE;QAC5C,QAAQ,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,UAAU,EAAE,CAAC,mBAAmB,CAAC,EAAC;QAC9D,QAAQ,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,OAAO,EAAC,CAAC,EAAC,OAAO,EAAC,CAAC,EAAC;KACjD;CACF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simitgroup/simpleapp-generator",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "description": "frontend nuxtjs and backend nests code generator using jsonschema",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -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
- timeZone: {"type": "string","examples": ["Asia/Kuala_Lumpur"]
30
- }
29
+ timeZone: {"type": "string","examples": ["Asia/Kuala_Lumpur"]},
30
+ currency:{"type":"string",minimum:3,maximum:3}
31
31
  }
32
32
  }
@@ -24,10 +24,10 @@ import {
24
24
  } from '@nestjs/common';
25
25
  import { SimpleAppAbstractController } from './simpleapp.controller';
26
26
  import { <%= it.typename %>Service } from '../../services/<%= it.doctype %>.service';
27
- import * as <%= it.doctype %>type from '../types/<%= it.doctype %>.type';
28
- import {SearchBody} from '../types';
29
- import {ApiSearchBody} from '../apischemas';
30
- import * as <%= it.doctype %>apischema from '../apischemas/<%= it.doctype %>.apischema';
27
+ // import * as <%= it.doctype %>type from '../types/<%= it.doctype %>.type';
28
+ import * as types from '../types';
29
+ import * as schemas from '../apischemas';
30
+ //import * as <%= it.doctype %>apischema from '../apischemas/<%= it.doctype %>.apischema';
31
31
  import { ApiTags, ApiBody, ApiResponse,ApiOperation,ApiQuery } from '@nestjs/swagger';
32
32
  import {Roles} from '../commons/roles/roles.decorator'
33
33
  import {Role} from '../commons/roles/roles.enum'
@@ -40,9 +40,9 @@ const doctype = '<%= it.doctype %>'.toUpperCase();
40
40
  @ApiTags(doctype)
41
41
  @Controller(doctype.toLowerCase())
42
42
  export class <%= it.typename %>Controller extends SimpleAppAbstractController<
43
- <%= it.typename %>Service,
44
- <%= it.doctype %>apischema.<%= it.typename %>,
45
- <%= it.doctype %>type.<%= it.typename %>
43
+ <%= it.typename %>Service,
44
+ schemas.<%= it.typename%>,
45
+ types.<%= it.typename %>
46
46
  > {
47
47
  constructor(service: <%= it.typename %>Service) {
48
48
  super(service);
@@ -57,7 +57,7 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
57
57
  @ApiResponse({
58
58
  status: 200,
59
59
  description: 'Found',
60
- type: String //[<%= it.fullApiSchemaName%>]
60
+ type: String
61
61
  })
62
62
  @ApiResponse({ status: 500, description: 'Internal error' })
63
63
  @ApiOperation({ operationId: 'runHello', description:"Say hello only" })
@@ -93,13 +93,13 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
93
93
  @ApiResponse({
94
94
  status: 201,
95
95
  description: 'success',
96
- type: <%= it.fullApiSchemaName%>
96
+ type: schemas.<%= it.typename%>
97
97
  })
98
98
  @ApiResponse({ status: 400, description: 'bad request' })
99
99
  @ApiResponse({ status: 500, description: 'internal error' })
100
- @ApiBody({ description: 'Data',type:<%= it.fullApiSchemaName%> })
100
+ @ApiBody({ description: 'Data',type:schemas.<%= it.typename%> })
101
101
  @ApiOperation({ operationId: 'runCreate' })
102
- async create(@AppUser() appuser: UserContext,@Body() data: <%= it.fullApiSchemaName%>) {
102
+ async create(@AppUser() appuser: UserContext,@Body() data: schemas.<%= it.typename%>) {
103
103
  return await this._create(appuser,data)
104
104
  }
105
105
 
@@ -113,13 +113,13 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
113
113
  @ApiResponse({
114
114
  status: 200,
115
115
  description: 'success',
116
- type: [<%= it.fullApiSchemaName%>]
116
+ type: [schemas.<%= it.typename%>]
117
117
  })
118
118
  @ApiResponse({ status: 400, description: 'bad request' })
119
119
  @ApiResponse({ status: 500, description: 'internal error' })
120
- @ApiBody({ description: 'Data', type: ApiSearchBody })
120
+ @ApiBody({ description: 'Data', type: schemas.ApiSearchBody })
121
121
  @ApiOperation({ operationId: 'runSearch' })
122
- async search(@AppUser() appuser: UserContext,@Body() data: SearchBody) {
122
+ async search(@AppUser() appuser: UserContext,@Body() data: types.SearchBody) {
123
123
  return await this._search(appuser,data)
124
124
  }
125
125
 
@@ -143,9 +143,12 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
143
143
  )
144
144
  <%}%>
145
145
  <% if(['post','put','patch'].includes(api.method)){ %>
146
- @ApiBody({ description: 'Data', type: Object })
146
+ @ApiBody({ description: 'Request Body', type: <%= api.schema? 'schemas.'+api.schema : 'Object'%> })
147
147
  <%}%>
148
- @ApiResponse({status: 200,description: '<%=api.description%>' ,type: Object })
148
+ @ApiResponse({status: 200,description: '<%=api.description%>'
149
+ ,type: <%= api.responseType
150
+ ? (api.responseType.includes('[') ? '[schemas.'+api.responseType.replace('[','').replace(']','') + ']' : 'schemas.'+api.responseType )
151
+ : 'Object'%> })
149
152
  @ApiOperation({ operationId: 'run<%=capitalizeFirstLetter(api.action)%>' })
150
153
  <% if(api.queryPara && api.queryPara.length>0) {%>
151
154
  <%for(let q=0;q<api.queryPara.length; q++){%>
@@ -155,7 +158,8 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
155
158
  async <%=capitalizeFirstLetter(api.action) %>(
156
159
  @AppUser() appuser: UserContext,
157
160
  <%if(['post','put','patch'].includes(api.method.toLowerCase())){%>
158
- @Body() data:any,
161
+ @Body() data:<%= api.schema? 'types.'+api.schema : 'Object'%>,
162
+ //@Body() data:any,
159
163
  <%}%>
160
164
  <% if(api.entryPoint && api.entryPoint.includes(':')) {%>
161
165
  <%let subpath = api.entryPoint.split('/')%>
@@ -222,7 +226,7 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
222
226
  @ApiResponse({
223
227
  status: 200,
224
228
  description: 'Founds',
225
- type: <%= it.fullApiSchemaName%>
229
+ type: schemas.<%= it.typename%>
226
230
  })
227
231
  @ApiResponse({ status: 404, description: 'Document not found' })
228
232
  @ApiResponse({ status: 500, description: 'Internal error' })
@@ -249,9 +253,9 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
249
253
  <%}%>
250
254
  @ApiResponse({ status: 404, description: 'Document not found' })
251
255
  @ApiResponse({ status: 500, description: 'Internal error' })
252
- @ApiBody({ description: 'Data',type: <%= it.fullApiSchemaName%> })
256
+ @ApiBody({ description: 'Data',type: schemas.<%= it.typename%> })
253
257
  @ApiOperation({ operationId: 'runUpdate' })
254
- async update(@AppUser() appuser: UserContext,@Param('id') id: string, @Body() data: <%= it.fullApiSchemaName%>) {
258
+ async update(@AppUser() appuser: UserContext,@Param('id') id: string, @Body() data: schemas.<%= it.typename%>) {
255
259
  return await this._update(appuser,id, data) ;
256
260
  }
257
261
 
@@ -264,7 +268,7 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
264
268
  @ApiResponse({
265
269
  status: 200,
266
270
  description: 'success',
267
- type: <%= it.fullApiSchemaName%>
271
+ type: schemas.<%= it.typename%>
268
272
  })
269
273
  @ApiResponse({ status: 404, description: 'Document not found' })
270
274
  @ApiResponse({ status: 500, description: 'Internal error' })
@@ -9,8 +9,8 @@ import { Model } from 'mongoose';
9
9
  import { Injectable } from '@nestjs/common';
10
10
  import { UserContext } from '../generate/commons/user.context';
11
11
  import { <%= it.typename %>Processor } from '../generate/processors/<%= it.doctype %>.processor';
12
- import { <%= it.typename %>,<%= it.typename %>Hooks} from '../generate/types';
13
-
12
+ //import { <%= it.typename %>,<%= it.typename %>Hooks} from '../generate/types';
13
+ import * as types from '../generate/types';
14
14
  export { <%= it.typename %>} from '../generate/types';
15
15
 
16
16
 
@@ -19,9 +19,9 @@ export class <%= it.typename %>Service extends <%= it.typename %>Processor {
19
19
  <% const config = it.jsonschema['x-simpleapp-config']%>
20
20
  <%if(config['loseDataIsolation']){%>protected strictIsolation = false;<%}%>
21
21
 
22
- public hooks: <%= it.typename %>Hooks = {}
22
+ public hooks: types.<%= it.typename %>Hooks = {}
23
23
  constructor(
24
- @InjectModel('<%= it.typename %>') mydoc: Model<<%= it.typename %>>
24
+ @InjectModel('<%= it.typename %>') mydoc: Model<types.<%= it.typename %>>
25
25
  ){
26
26
  super(mydoc)
27
27
  }
@@ -48,7 +48,7 @@ export class <%= it.typename %>Service extends <%= it.typename %>Processor {
48
48
  <%}%>
49
49
  <%}%>
50
50
  <%if(['post','put','patch'].includes(api.method.toLowerCase())){%>
51
- data:any,
51
+ data:<%= api.schema? 'types.'+api.schema: 'any'%>,
52
52
  <%}%>
53
53
  ){
54
54
  <%if (api.workflowSetting && api.workflowSetting.bpmn){ %>
@@ -32,7 +32,7 @@ export const Default<%=modelname%> = (uuid:string)=>{
32
32
  <%} else if(Array.isArray(field) && ['string','integer','number','boolean'].includes(field[0])) {%>
33
33
  <%=key%> : <<%=field[0]%>[]>[], //typeof field == array <%~JSON.stringify(field)%>
34
34
  <%} else if(Array.isArray(field)) {%>
35
- <%=key%> : [Default<%=field[0]%>(crypto.randomUUID())], //typeof field == array <%~JSON.stringify(field)%>
35
+ <%=key%> : [Default<%=field[0]%>(randomUUID())], //typeof field == array <%~JSON.stringify(field)%>
36
36
  <%} else {%>
37
37
  <%=key%> : <%=field.default%>, //else <%= typeof field %>
38
38
  <%}%>
@@ -15,7 +15,7 @@
15
15
  <%}%>
16
16
 
17
17
  <SimpleAppFormToolBar :document="doc" @on="actionListener"></SimpleAppFormToolBar>
18
- <div class="grid grid-cols-4 gap-4">
18
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
19
19
  <% let isautofocus='' %>
20
20
  <%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
21
21
 
@@ -147,8 +147,8 @@
147
147
  * author: Ks Tan
148
148
  */
149
149
  import { SimpleAppInputType } from "~/types";
150
-
151
- const props = defineProps<{ _id?: string}>();
150
+ import { <%= it.typename %> } from "~/simpleapp/generate/types";
151
+ const props = defineProps<{ _id?: string,paras?:<%= it.typename %>}>();
152
152
  const doc = useNuxtApp().$<%= it.typename %>Doc()
153
153
  const data = doc.getReactiveData();
154
154
  const emits = defineEmits(["after"]);
@@ -159,7 +159,7 @@
159
159
  const newData = () => doc.setNew()
160
160
  const createData = async () => await doc.create()
161
161
  const updateData = async () => await doc.update()
162
- const deleteData = async () => await doc.delete(data.value._id ?? "")
162
+ const deleteData = async () => await doc.delete()
163
163
 
164
164
  const getRecord = async () => {
165
165
  if(id.value && id.value != 'new'){
@@ -30,7 +30,16 @@
30
30
 
31
31
  const columns:CellSetting[] = [<%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
32
32
  <%let obj=it.jsonschema.properties[key] %>
33
+ <%let config=it.jsonschema['x-simpleapp-config'] %>
33
34
  <%if(skipcolumns.indexOf(key)>=0){%>/* skip system columns <%=key%>*/
35
+ <%} else if(config['uniqueKey'] && (config['uniqueKey']==key || config['documentTitle']==key) ){%>
36
+ {
37
+ title: '<%=key%>',
38
+ field: '*',
39
+ moreFields:['<%=key%>'],
40
+ rendererName: "RendererLink",
41
+ rendererSetting: { path: "<%=config['documentName']%>" },
42
+ },
34
43
  <%} else if(['string','number','integer'].indexOf(obj.type)>=0){%>'<%=key%>',
35
44
  <%} else if(obj.type =='object' && obj['x-foreignkey'] ){%>
36
45
  {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <Crud :_id="_id" @after="after"/>
2
+ <Crud :_id="_id" @after="after" :paras="paras"/>
3
3
  </template>
4
4
  <script setup lang="ts">
5
5
  /**
@@ -11,8 +11,8 @@
11
11
  */
12
12
  import Crud from './form.vue'
13
13
  import {<%= it.typename %>} from '~/simpleapp/generate/types'
14
- const props = defineProps<{_id:string}>();
15
- const emits = defineEmits(["afterCreate"]);
14
+ const props = defineProps<{_id:string,paras?:<%= it.typename %>}>();
15
+ const emits = defineEmits(["afterCreate","after"]);
16
16
 
17
17
  const after = (actionName: string, data: <%= it.typename %>, result: any) => {
18
18
  switch (actionName) {
@@ -26,5 +26,6 @@ const after = (actionName: string, data: <%= it.typename %>, result: any) => {
26
26
  case "delete":
27
27
  break;
28
28
  }
29
+ emits("after",actionName,data,result)
29
30
  };
30
31
  </script>
@@ -21,18 +21,7 @@ import {AxiosResponse} from 'axios'
21
21
  <%}%>
22
22
  <%}%>
23
23
  // import { JSONSchema7 } from 'json-schema';
24
- import { Configuration,
25
- <%= it.doctype.toUpperCase()%>Api,
26
- <%= it.typename%> ,
27
- <%Object.keys(it.schema).forEach(function(key){%>
28
- <% if(typeof it.schema[key]=='string' || (Array.isArray(it.schema[key]) && typeof it.schema[key][0]=='string' && it.schema[key][0]!='string')){%>
29
- <%= it.schema[key] %>,
30
- <%} else {%>
31
- /*<%~ key + JSON.stringify(it.schema[key]) %>,*/
32
- <%} %>
33
- <%})%>
34
-
35
- } from '../openapi';
24
+ import * as openapi from '../openapi';
36
25
 
37
26
  export type {
38
27
  <%= it.typename%> ,
@@ -46,7 +35,7 @@ export type {
46
35
 
47
36
  } from '../openapi'
48
37
 
49
- export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<%= it.doctype.toUpperCase()%>Api>{
38
+ export class <%= it.typename%>Client extends SimpleAppClient<openapi.<%= it.typename%>,openapi.<%= it.doctype.toUpperCase()%>Api>{
50
39
  public readonly schema= <%~ JSON.stringify(it.jsonschema) %> as SchemaType;
51
40
  protected documentIdentityCode='<%~ it.autocompletecode %>'
52
41
  protected documentIdentityName='<%~ it.autocompletename %>'
@@ -82,7 +71,7 @@ export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<
82
71
 
83
72
  }
84
73
  setNew = ()=>{
85
- const newdata = Default<%= it.typename%>(crypto.randomUUID())
74
+ const newdata = Default<%= it.typename%>(randomUUID())
86
75
  this.setData(newdata)
87
76
  return true
88
77
  }
@@ -107,7 +96,7 @@ export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<
107
96
  <%let tablefields = Object.keys(obj.items.properties) %>
108
97
  public add<%=key%> = () => {
109
98
 
110
- this.getReactiveData().value.<%= key %>.push(Default<%= it.typename%><%=capitalizeFirstLetter(key)%>(crypto.randomUUID()))
99
+ this.getReactiveData().value.<%= key %>.push(Default<%= it.typename%><%=capitalizeFirstLetter(key)%>(randomUUID()))
111
100
  return this.getReactiveData().value.<%= key %>.length -1
112
101
  }
113
102
 
@@ -156,7 +145,7 @@ export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<
156
145
  <%}%>
157
146
 
158
147
 
159
- <% if(['post','put','patch'].includes(api.method)){ %>data:any<%}%>
148
+ <% if(['post','put','patch'].includes(api.method)){ %>data:<%=api.schema ? 'openapi.'+api.schema :'any'%><%}%>
160
149
  ){
161
150
  //const recordid: string = this.data.value._id ?? '';
162
151
  return await this.docapi.run<%=capitalizeFirstLetter(api.action)%>(
@@ -276,7 +265,7 @@ export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<
276
265
  /***************************** begin document status code*****************************************/
277
266
  <%for(let i=0;i<it.docStatusSettings.length;i++){%>
278
267
  <% let setting = it.docStatusSettings[i] %>
279
- async setStatus<%=capitalizeFirstLetter(setting.status)%>(id?:string,data:<%= it.typename%>,runValidate:boolean=false) {
268
+ async setStatus<%=capitalizeFirstLetter(setting.status)%>(id:string='',data:<%= it.typename%>,runValidate:boolean=false) {
280
269
  const {$event} =useNuxtApp()
281
270
  if(runValidate){
282
271
  const errors = this.validateFailed();
@@ -0,0 +1,10 @@
1
+ //put customize schemas in this folder
2
+ import { ApiProperty } from '@nestjs/swagger';
3
+ export class ForeignKey {
4
+ @ApiProperty({ type: 'string', required: false, format: 'uuid', default: '' })
5
+ _id: string;
6
+ @ApiProperty({ type: 'string', required: false, default: '' })
7
+ code: string;
8
+ @ApiProperty({ type: 'string', required: false, default: '' })
9
+ label: string;
10
+ }
@@ -1,20 +1,8 @@
1
- /**
2
- * This file was automatically generated by simpleapp generator. Every
3
- * MODIFICATION OVERRIDE BY GENERATEOR
4
- * last change 2023-10-28
5
- * Author: Ks Tan
6
- */
1
+ <%for(let i=0; i<it.modules.length;i++){ %>
2
+ <% const d = it.modules[i] %>
3
+ export * from './<%= d['doctype']%>.apischema'
4
+ <%}%>
7
5
 
8
- import { ApiProperty } from '@nestjs/swagger';
9
- export class ApiKeyValuePair {
10
- @ApiProperty({"type":Object,"required":false,"examples":['{"field1":"1"}'],"default":""} )
11
- field1: any
12
- }
13
- export class ApiSearchBody{
14
- @ApiProperty({ "type":Object, "required":false, "examples":['{"field1":"1"}'] ,"default":{"field1":"ok","field2":true,}} )
15
- filter: Object;
16
- @ApiProperty({"type":[Object],"required":true,"examples":['["field1","field2"]'],"default":["field1","field2"]} )
17
- fields: [Object];
18
- @ApiProperty({"type":()=>[Object],"required":true,"examples":['[[ "field1", "asc" ]]'],"default":[[ 'field1', 'asc' ]]} )
19
- sorts: [Object];
20
- }
6
+ export * from './simpleapp.apischema'
7
+
8
+ export * from '../../apischemas'
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2024-02-01
5
+ * Author: Ks Tan
6
+ */
7
+
8
+ import { ApiProperty } from '@nestjs/swagger';
9
+ export class ApiKeyValuePair {
10
+ @ApiProperty({"type":Object,"required":false,"examples":['{"field1":"1"}'],"default":""} )
11
+ field1: any
12
+ }
13
+ export class ApiSearchBody{
14
+ @ApiProperty({ "type":Object, "required":false, "examples":['{"field1":"1"}'] ,"default":{"field1":"ok","field2":true,}} )
15
+ filter: Object;
16
+ @ApiProperty({"type":[Object],"required":true,"examples":['["field1","field2"]'],"default":["field1","field2"]} )
17
+ fields: [Object];
18
+ @ApiProperty({"type":()=>[Object],"required":true,"examples":['[[ "field1", "asc" ]]'],"default":[[ 'field1', 'asc' ]]} )
19
+ sorts: [Object];
20
+ }
@@ -55,7 +55,8 @@ export class UserContext {
55
55
  protected branchName: string = '';
56
56
  protected orgCode: string = '';
57
57
  protected orgName: string = '';
58
- protected timeZone:string=''
58
+ protected timeZone: string = '';
59
+ protected currency: string = '';
59
60
  protected branches: any[] = [];
60
61
  protected lastActivity: string = new Date().toISOString();
61
62
  protected invites: any[] = []; //User + field tenant:Tenant[]
@@ -88,6 +89,7 @@ export class UserContext {
88
89
  getEmail = () => this.email;
89
90
  getTimeZone = () => this.timeZone;
90
91
  getGroup = () => this.group;
92
+ getCurrency = () => this.currency;
91
93
  getMoreProps = () => this.moreProps;
92
94
  getRoles = () => this.roles;
93
95
  getModifieds = () => this.modifiedRecords;
@@ -209,6 +211,7 @@ export class UserContext {
209
211
  userinfo.orgCode = myperm.currentorg[0].orgCode;
210
212
  userinfo.orgName = myperm.currentorg[0].orgName;
211
213
  userinfo.timeZone = myperm.currentorg[0].timeZone;
214
+ userinfo.currency = myperm.currentorg[0].currency;
212
215
  }
213
216
  } else {
214
217
  userinfo.group = '';
@@ -258,7 +261,8 @@ export class UserContext {
258
261
  this.branchName = userinfo['branchName'] ?? '';
259
262
  this.orgCode = userinfo['orgCode'] ?? '';
260
263
  this.orgName = userinfo['orgName'] ?? '';
261
- this.timeZone = userinfo['timeZone']?? '';
264
+ this.timeZone = userinfo['timeZone'] ?? '';
265
+ this.currency= userinfo['currency'] ?? '';
262
266
  this.orgRecordId = userinfo['orgRecordId'] ?? '';
263
267
  this.branchRecordId = userinfo['branchRecordId'] ?? '';
264
268
  this.group = userinfo['group'] ?? '';
@@ -379,6 +383,7 @@ export class UserContext {
379
383
  orgCode: this.orgCode,
380
384
  orgName: this.orgName,
381
385
  timeZone: this.getTimeZone(),
386
+ currency: this.getCurrency(),
382
387
  email: this.getEmail(),
383
388
  uid: this.getUid(),
384
389
  fullName: this.getFullname(),
@@ -675,8 +680,9 @@ export class UserContext {
675
680
  'orgId',
676
681
  'orgName',
677
682
  'timeZone',
683
+ 'currency',
678
684
  'tenantId',
679
- 'lastActivity',
685
+ 'lastActivity',
680
686
  'group',
681
687
  '__v',
682
688
  'uid',
@@ -1,7 +1,7 @@
1
-
2
-
3
1
  <%for(let i=0; i<it.modules.length;i++){ %>
4
2
  <% const d = it.modules[i] %>
5
3
  export * from './<%= d['doctype']%>.type'
6
4
  <%}%>
7
- export * from './simpleapp.type'
5
+ export * from './simpleapp.type'
6
+
7
+ export * from '../../types';
@@ -5,10 +5,7 @@
5
5
  * Author: Ks Tan
6
6
  */
7
7
  import { UserContext } from 'src/simpleapp/generate/commons/user.context';
8
- export type ForeignKey = {
9
- _id: string;
10
- label: string;
11
- };
8
+
12
9
  export type ModifiedCollection = {
13
10
  [key: string]: string[];
14
11
  };
@@ -0,0 +1,7 @@
1
+ //put additional customize types in this folder
2
+ export type ForeignKey = {
3
+ _id: string
4
+ code?:string
5
+ label: string
6
+ [key:string]:any
7
+ };
@@ -0,0 +1,37 @@
1
+
2
+ /* calendar */
3
+
4
+ #monthviewcal .vuecal__cell--current,
5
+ #monthviewcal .vuecal__cell--today {
6
+ background-color: lightblue;
7
+ }
8
+ #monthviewcal .vuecal__cell--selected {
9
+ background-color: lightgreen;
10
+ }
11
+
12
+ #monthviewcal .vuecal__cell {
13
+ height: 3rem;
14
+ }
15
+
16
+ #resourceviewcal .vuecal__event {
17
+ border-radius: 0.5rem;
18
+ }
19
+ #resourceviewcal .vuecal__split-days-headers {
20
+ min-height: 6rem;
21
+ }
22
+
23
+ #resourceviewcal .vuecal__event {
24
+ border: solid 1px #ccc !important;
25
+ }
26
+
27
+ #resourceviewcal .normalevent{
28
+ background-color: aqua;
29
+ }
30
+
31
+ #resourceviewcal .urgentevent{
32
+ background-color: lightcoral;
33
+ }
34
+
35
+ #resourceviewcal .seminal{
36
+ background-color: lightblue;
37
+ }
@@ -15,7 +15,7 @@
15
15
  }
16
16
 
17
17
  body {
18
- @apply bg-gray-50 dark:bg-gray-800
18
+ @apply bg-gray-50 dark:bg-gray-800 h-screen w-screen overflow-y-scroll
19
19
  }
20
20
 
21
21
  input {
@@ -59,4 +59,5 @@ input {
59
59
 
60
60
  .simpleapp-input-label{
61
61
  @apply text-left
62
- }
62
+ }
63
+
@@ -24,15 +24,22 @@ const CustomTailwind = usePassThrough(
24
24
  selectbutton:{
25
25
  root:{class:'flex flex-row gap-1'},
26
26
  button: ({ context }) => ({
27
-
28
- class: ['text-center border text-gray-300 dark:border-gray-700 dark:text-gray-300 rounded-lg p-2 cursor-pointer hover:bg-primary-400 dark:hover:bg-primary-800 hover:text-white', context.active ? 'bg-primary-600 dark:bg-primary-700 text-white' : '']
27
+ class: ` focus:outline-none transition duration-150 ease-in-out rounded p-2 m-1 border dark:border-gray-600 ${context.active ? 'bg-primary-600 border-primary-400 text-white' : undefined}`
29
28
  }),
29
+ // button: ( context) => ({
30
+
31
+ // class: ['text-center border text-gray-400 dark:border-gray-700 dark:text-gray-300 rounded-lg p-2 cursor-pointer hover:bg-primary-400 dark:hover:bg-primary-800 hover:text-white', context.active ? 'bg-primary-600 dark:bg-primary-700 text-white' : '']
32
+ // }),
30
33
  label:{class: 'text-sm'},
31
34
  },
32
35
  button:{root:{class: 'focus:outline-none transition duration-150 ease-in-out rounded p-2 m-1 border dark:border-gray-600'}},
33
- dialog:{root:{class:['border p-2 h-4/5']}},
36
+ dialog:{root:{class:['border p-2 w-full max-h-full max-w-full md:h-3/4 lg:h-1/2']},},
37
+ calendar:{
38
+ root:{class:'border border-gray-400 dark:!border-blue-900/40 rounded-lg flex flex-row p-1'},
39
+ input:{class:'w-full p-2 font-sans rounded-lg transition-colors duration-200 appearance-none hover:border-blue-500 focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)] text-base'},
40
+ },
34
41
  autocomplete:{
35
- root:{class:'border border-gray-300 dark:!border-blue-900/40 rounded-lg flex flex-row'},
42
+ root:{class:'border border-gray-400 dark:!border-blue-900/40 rounded-lg flex flex-row'},
36
43
  input:{class:'w-full p-2 font-sans rounded-lg rounded-tr-none rounded-br-none transition-colors duration-200 appearance-none hover:border-blue-500 focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)] text-base'},
37
44
  loadingIcon:{class:'hidden'},
38
45
  dropdownbutton: {
@@ -42,7 +49,7 @@ const CustomTailwind = usePassThrough(
42
49
  sidebar:{
43
50
  root:{class:'w-full md:w-1/2 xl:w-1/4 bg-white dark:bg-gray-800 border p-0 h-full'},
44
51
  content:{class:'p-0 pt-0 h-full w-full grow overflow-y-auto'}
45
- },
52
+ },
46
53
  panel: {
47
54
  root:{class:['border']},
48
55
  title: {class: ['leading-none font-light text-2xl']},
@@ -51,6 +58,10 @@ const CustomTailwind = usePassThrough(
51
58
  },
52
59
  breadcrumb:{
53
60
  root:{class:''}
61
+ },
62
+ inputnumber:{
63
+ // root:{class:''},
64
+ input:{class:'bg-white dark:bg-white text-black dark-text-black'}
54
65
  }
55
66
  },
56
67
  );
@@ -0,0 +1,6 @@
1
+ <template>
2
+ <!-- this component allow modify -->
3
+ <Button class="btn-danger">
4
+ <slot></slot>
5
+ </Button>
6
+ </template>
@@ -0,0 +1,6 @@
1
+ <template>
2
+ <!-- this component allow modify -->
3
+ <Button>
4
+ <slot></slot>
5
+ </Button>
6
+ </template>
@@ -0,0 +1,6 @@
1
+ <template>
2
+ <!-- this component allow modify -->
3
+ <Button class="btn-primary">
4
+ <slot></slot>
5
+ </Button>
6
+ </template>
@@ -0,0 +1,6 @@
1
+ <template>
2
+ <!-- this component allow modify -->
3
+ <Button class="btn-warn">
4
+ <slot></slot>
5
+ </Button>
6
+ </template>