@simitgroup/simpleapp-generator 1.6.2-alpha → 1.6.3-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.
Files changed (41) hide show
  1. package/README.md +6 -5
  2. package/dist/buildinschemas/branch.d.ts.map +1 -1
  3. package/dist/buildinschemas/branch.js +0 -2
  4. package/dist/buildinschemas/branch.js.map +1 -1
  5. package/dist/index.js +4 -1
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/buildinschemas/branch.ts +0 -2
  9. package/src/index.ts +8 -3
  10. package/templates/basic/nuxt/pages.form.vue.eta +2 -2
  11. package/templates/basic/nuxt/pages.landing.vue.eta +1 -1
  12. package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +36 -30
  13. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +16 -3
  14. package/templates/nuxt/{app.vue._eta → app.vue.eta} +3 -1
  15. package/templates/nuxt/components/button/ButtonAction.vue._eta +49 -8
  16. package/templates/nuxt/components/calendar/CalendarInput.vue.eta +16 -14
  17. package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +30 -13
  18. package/templates/nuxt/components/list/ListDocument.vue.eta +10 -5
  19. package/templates/nuxt/components/list/ListDocumentTable.vue.eta +2 -2
  20. package/templates/nuxt/components/list/ListMessages.vue.eta +1 -1
  21. package/templates/nuxt/components/list/ListView.vue.eta +61 -52
  22. package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +10 -4
  23. package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +17 -6
  24. package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +16 -6
  25. package/templates/nuxt/components/page/PageDocList.vue.eta +81 -27
  26. package/templates/nuxt/components/select/SelectTemplate.vue.eta +43 -31
  27. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +45 -17
  28. package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +15 -11
  29. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +71 -20
  30. package/templates/nuxt/composables/confirm.generate.ts.eta +19 -0
  31. package/templates/nuxt/composables/date.generate.ts.eta +1 -0
  32. package/templates/nuxt/composables/stringHelper.generate.ts.eta +2 -1
  33. package/templates/nuxt/pages/[xorg]/docnoformat.vue.eta +1 -1
  34. package/templates/nuxt/pages/[xorg]/mobile/docnoformat/index.vue.eta +1 -1
  35. package/templates/nuxt/pages/[xorg]/mobile/user/index.vue.eta +1 -1
  36. package/templates/nuxt/pages/[xorg]/organization.vue.eta +1 -1
  37. package/templates/nuxt/pages/[xorg]/profile.vue.eta +1 -1
  38. package/templates/nuxt/pages/[xorg]/user.vue.eta +1 -1
  39. package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +4 -0
  40. package/templates/project/lang/default._json +4 -1
  41. package/tsconfig.tsbuildinfo +1 -1
package/README.md CHANGED
@@ -104,7 +104,7 @@ simpleapp-generator -g init
104
104
 
105
105
  5. prepare backend
106
106
  ```sh
107
- bash build.sh backend
107
+ ./build.sh backend
108
108
  ```
109
109
  6. update backend configurations file by modify `~/project1/backend/.env`, change mongodb, keycloak settings according your requirements
110
110
  7. start backend:
@@ -115,12 +115,13 @@ pnpm start:dev
115
115
 
116
116
  8. prepare frontend (i use pnpm cause faster)
117
117
  ```sh
118
- sh build.sh frontend
118
+ ./build.sh frontend
119
119
  ```
120
120
  9. modify frontend configuration by modify `~/project1/frontend/.env`, change keycloak settings
121
121
  ```sh
122
122
  OAUTH2_BASEURL=https://server-url #keycloak server url
123
- OAUTH2_CONFIGURL=https://server-url/realms/testing
123
+ OAUTH2_CONFIGURL=https://server-url/realms/testingrealm
124
+ OAUTH2_REALM=testingrealm
124
125
  OAUTH2_CLIENTID=client1
125
126
  OAUTH2_CLIENTSECRET=aaaa-xxxxx-yyyy-zzzzz-www
126
127
  ADMIN_EMAIL=your@ykeycloakemail.com #if you have multiple, separate by ','
@@ -140,8 +141,8 @@ nuxi preview
140
141
  1. add some schemas at `~/project1/schemas`
141
142
  2. then run
142
143
  ```sh
143
- sh build.sh updatebackend
144
- sh build.sh updatefrontend
144
+ ./build.sh updatebackend
145
+ ./build.sh updatefrontend
145
146
  ```
146
147
  3. to add different user group permission, you may change `project1/groups`
147
148
 
@@ -1 +1 @@
1
- {"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/buildinschemas/branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,SAAS,CAAA;AAE5D,eAAO,MAAM,MAAM,EAAC,UA+CnB,CAAA"}
1
+ {"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/buildinschemas/branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA2B,MAAM,SAAS,CAAA;AAE5D,eAAO,MAAM,MAAM,EAAC,UA6CnB,CAAA"}
@@ -37,8 +37,6 @@ exports.branch = {
37
37
  branchName: { type: "string", minLength: 1 },
38
38
  street1: { type: "string" },
39
39
  street2: { type: "string" },
40
- street3: { type: "string" },
41
- street4: { type: "string" },
42
40
  city: { type: "string" },
43
41
  region: { type: "string" },
44
42
  postcode: { type: "string" },
@@ -1 +1 @@
1
- {"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/buildinschemas/branch.ts"],"names":[],"mappings":";;;AAAA,kCAA4D;AAE/C,QAAA,MAAM,GAAa;IAC5B,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAC;QACjB,aAAa,EAAC,oBAAa,CAAC,GAAG;QAC/B,YAAY,EAAC,QAAQ;QACrB,YAAY,EAAC,QAAQ;QACrB,oBAAoB;QACpB,SAAS,EAAC,YAAY;QACtB,UAAU,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QACzB,aAAa,EAAC,YAAY;QAC1B,4BAA4B,EAAE,CAAC,UAAU,CAAC;KAC7C;IACD,YAAY,EAAE;QACV,GAAG,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;QACnB,OAAO,E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AAS,EAAC,OAAO,EAAC,CAAC,EAAC,OAAO,EAAC,CAAC,EAAE;QAC/C,YAAY,EAAC;YACX,IAAI,EAAC,QAAQ;YACb,cAAc,EAAC,cAAc;YAC7B,UAAU,EAAC;gBACP,KAAK,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC;gBACvB,MAAM,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC;gBACxB,OAAO,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC;gBACzB,OAAO,EAAC,EAAC,MAAM,EAAC,SAAS,EAAC;aAC7B;SACF;QACD,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,SAAS,EAAC,CAAC,EAAC;QACxC,UAAU,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,SAAS,EAAC,CAAC,EAAC;QACxC,OAAO,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACzB,OAAO,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACzB,IAAI,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACtB,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACxB,QAAQ,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QAC1B,OAAO,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACzB,GAAG,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACrB,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACvB,MAAM,EAAE,EAAC,IAAI,EAAE,SAAS,EAAC,OAAO,EAAC,IAAI,EAAC;QACtC,WAAW,EAAE,EAAC,IAAI,EAAE,QAAQ,GAAE;KAC/B;CAEN,CAAA"}
package/dist/index.js CHANGED
@@ -27,6 +27,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
27
27
  const console_1 = require("console");
28
28
  const fw = __importStar(require("./framework"));
29
29
  const generate = __importStar(require("./generate"));
30
+ const fs_1 = require("fs");
30
31
  const program = require("commander"); // add this line
31
32
  const Fieldtypes = require('./type');
32
33
  // const generate= require( './generate')
@@ -54,7 +55,9 @@ let continueexecute = true;
54
55
  if (options.generateType && options.generateType == 'init') {
55
56
  continueexecute = false;
56
57
  fw.prepareProject(() => {
57
- process.exit(1);
58
+ (0, fs_1.chmod)(process.cwd() + '/build.sh', 0o755, () => {
59
+ process.exit(1);
60
+ });
58
61
  });
59
62
  }
60
63
  else if (!options.configFile) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAA+B;AAC/B,gDAAkC;AAClC,qDAAsC;AACtC,MAAM,OAAO,GAAI,OAAO,CAAC,WAAW,CAAC,CAAA,CAAC,gBAAgB;AACtD,MAAM,UAAU,GAAE,OAAO,CAAE,QAAQ,CAAC,CAAA;AACpC,yCAAyC;AAEzC,MAAM,EAAE,GAAG,OAAO,CAAE,IAAI,CAAC,CAAA;AACzB,MAAO,aAAa,GAAE,OAAO,CAAE,iBAAiB,CAAC,CAAA;AACjD,MAAM,EAAE,GAAI,OAAO,CAAE,eAAe,CAAC,CAAA;AACrC,MAAM,qBAAqB,GAAE,OAAO,CAAE,QAAQ,CAAC,CAAA;AAC/C,MAAM,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,OAAO,CAAE,OAAO,CAAC,CAAC;AAE5C,MAAM,GAAG,GAAiB,IAAI,MAAM,EAAE,CAAC;AAEvC,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACjC,iCAAiC;AACjC,MAAM,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAErC,IAAI,OAAO,GAAC,EAAE,CAAC,OAAO,CAAA;AACtB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,+EAA+E,CAAC;KAC5F,MAAM,CAAC,2BAA2B,EAAE,oBAAoB,CAAC;KACzD,MAAM,CAAC,6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GAAE,EAAE;YACjB,EAAE,CAAC,WAAW,CAAC,GAAE,EAAE;gBACX,kGAAkG;gBAChG,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAC,CAAC,MAAM,CAAC,EAAC,GAAE,EAAE;oBAChC,EAAE,CAAC,UAAU,EAAE,CAAA;gBACnB,CAAC,CAAC,CAAA;YACZ,CAAC,CAAC,CAAA;QAEN,CAAC,CAAC,CAAA;IACN,CAAC,CAAA;IAED,MAAM,WAAW,GAAG,KAAK,IAAE,EAAE;QAC3B,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAA;QAC5B,EAAE,CAAC,aAAa,CAAC,GAAE,EAAE;YACT,EAAE,CAAC,WAAW,CAAC,GAAE,EAAE;gBACf,yGAAyG;gBACzG,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAC,CAAC,MAAM,CAAC,EAAC,GAAE,EAAE;oBAC9B,EAAE,CAAC,UAAU,EAAE,CAAA;gBACnB,CAAC,CAAC,CAAA;YACd,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;IAGD,QAAO,OAAO,CAAC,YAAY,EAAC;QAC1B,KAAK,gBAAgB;YACnB,aAAa,EAAE,CAAA;YACjB,MAAM;QACN,KAAK,eAAe;YAClB,YAAY,EAAE,CAAA;YAChB,MAAM;QACN,KAAK,UAAU;YACb,WAAW,EAAE,CAAA;YACf,MAAM;QACN,KAAK,SAAS;YACZ,UAAU,EAAE,CAAA;YACd,MAAM;QACN,KAAK,KAAK;YACR,GAAG,EAAE,CAAA;YACP,MAAM;QACN;YACE,GAAG,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;YACpC,MAAM;KAEP;CAEF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simitgroup/simpleapp-generator",
3
- "version": "1.6.2-alpha",
3
+ "version": "1.6.3-alpha",
4
4
  "description": "frontend nuxtjs and backend nests code generator using jsonschema",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -35,8 +35,6 @@ export const branch:SchemaType ={
35
35
  branchName: {type: "string",minLength:1},
36
36
  street1: {type: "string"},
37
37
  street2: {type: "string"},
38
- street3: {type: "string"},
39
- street4: {type: "string"},
40
38
  city: {type: "string"},
41
39
  region: {type: "string"},
42
40
  postcode: {type: "string"},
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  import { error } from "console"
3
3
  import * as fw from './framework'
4
4
  import * as generate from './generate'
5
+ import { chmod } from "fs"
5
6
  const program = require("commander") // add this line
6
7
  const Fieldtypes= require( './type')
7
8
  // const generate= require( './generate')
@@ -33,9 +34,13 @@ console.log(figlet.textSync(`${version}`));
33
34
  let continueexecute = true
34
35
  if(options.generateType && options.generateType=='init'){
35
36
  continueexecute=false
36
- fw.prepareProject(()=>{
37
- process.exit(1)
38
- })
37
+
38
+ fw.prepareProject(()=>{
39
+ chmod(process.cwd()+'/build.sh',0o755,()=>{
40
+ process.exit(1)
41
+ })
42
+ })
43
+
39
44
 
40
45
  }
41
46
  else if(!options.configFile){
@@ -13,8 +13,8 @@
13
13
  <%}%>
14
14
  <SimpleAppForm #default="o" :document="doc">
15
15
  <SimpleAppFormToolBar :document="doc" @on="actionListener"></SimpleAppFormToolBar>
16
- <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 p-2">
17
- <% let isautofocus='' %>
16
+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-4 p-2">
17
+ <% let isautofocus='' %>
18
18
  <%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
19
19
 
20
20
  <% let obj=it.jsonschema.properties[key] %>
@@ -44,7 +44,7 @@ import { <%= it.typename %> } from '~/simpleapp/generate/openapi';
44
44
  type <%= it.typename %>Key = keyof <%= it.typename %>
45
45
 
46
46
  definePageMeta({
47
- menuPath:'nocategory/<%= it.name %>'
47
+ menuPath:'general/nocategory/<%= it.name %>'
48
48
  });
49
49
 
50
50
  const columns:<%= it.typename %>Key[] = [<%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
@@ -7,39 +7,39 @@
7
7
  import { UserContext } from './user.context';
8
8
  import { InjectModel } from '@nestjs/mongoose';
9
9
  import { Model } from 'mongoose';
10
- import {DocNumberFormatResult} from '../types'
11
- import { Docnoformat } from '../types/docno.type'
12
- import { Injectable, InternalServerErrorException,BadRequestException } from '@nestjs/common';
13
- import moment from 'moment';
14
- import {ForeignKey} from '../types'
10
+ import { DocNumberFormatResult } from '../types';
11
+ import { Docnoformat } from '../types/docno.type';
12
+ import { Injectable, InternalServerErrorException, BadRequestException} from '@nestjs/common';
13
+ // import moment from 'moment';
14
+ import dayjs from 'dayjs'
15
+ import { ForeignKey } from '../types';
15
16
 
16
- export class DocNumberFormatGenerator{
17
- constructor(@InjectModel('Docnoformat') private docformat: Model<Docnoformat>) {}
17
+ export class DocNumberFormatGenerator {
18
+ constructor(@InjectModel('Docnoformat') private docformat: Model<Docnoformat>,) {}
18
19
 
19
20
 
20
- async generateNextNumberFromDocument(appuser:UserContext,docType:string,data:any){
21
- let formatId = ''
22
- if(data.docNoFormat && data.docNoFormat._id){
23
- formatId=data.docNoFormat._id
21
+ async generateNextNumberFromDocument( appuser: UserContext, docType: string, data: any,) {
22
+ let formatId = '';
23
+ if (data.docNoFormat && data.docNoFormat._id) {
24
+ formatId = data.docNoFormat._id;
24
25
  }
25
- const docnoobj = await this.generateNextNo(appuser,docType,formatId)
26
- const result:ForeignKey = {
27
- _id : String(docnoobj.formatId),
28
- label: docnoobj.formatName
29
- }
30
- data.docNoFormat = result
31
- return docnoobj.result
26
+ const docnoobj = await this.generateNextNo(appuser, docType, formatId);
27
+ const result: ForeignKey = {
28
+ _id: String(docnoobj.formatId),
29
+ label: docnoobj.formatName,
30
+ };
31
+ data.docNoFormat = result;
32
+ return docnoobj.result;
32
33
  }
33
34
 
34
-
35
- generateNextNo = async (appuser: UserContext,doctype: string,id: string = '') => {
35
+ generateNextNo = async ( appuser: UserContext,doctype: string, id: string = '',) => {
36
36
  doctype = doctype.toUpperCase();
37
37
  let filter = { docNoType: doctype };
38
38
  if (id) {
39
39
  filter['_id'] = id;
40
40
  }
41
- Object.assign(filter,appuser.getBranchFilter())
42
- const result = await this.docformat.find(filter)
41
+ Object.assign(filter, appuser.getBranchFilter());
42
+ const result = await this.docformat.find(filter);
43
43
  //search(appuser, filter);
44
44
  if (result && result.length > 0) {
45
45
  const d: Docnoformat = result[0];
@@ -47,11 +47,17 @@ export class DocNumberFormatGenerator{
47
47
  const newdocno = DocNumberFormatGenerator.previewDocNo(d);
48
48
  const newnextnumber = d.nextNumber + 1;
49
49
  const updatedata = { nextNumber: newnextnumber } as Docnoformat;
50
- const updateresult = await this.docformat.findByIdAndUpdate(recordId,updatedata).session(appuser.getDBSession())
51
-
52
- if (updateresult) {
53
- const result:DocNumberFormatResult = {formatId:d._id,formatName:d.docNoFormatName,result: newdocno }
54
- return result
50
+ const updateresult = await this.docformat
51
+ .findByIdAndUpdate(recordId, updatedata)
52
+ .session(appuser.getDBSession());
53
+
54
+ if (updateresult) {
55
+ const result: DocNumberFormatResult = {
56
+ formatId: d._id,
57
+ formatName: d.docNoFormatName,
58
+ result: newdocno,
59
+ };
60
+ return result;
55
61
  //;
56
62
  } else {
57
63
  throw new InternalServerErrorException(
@@ -86,13 +92,13 @@ export class DocNumberFormatGenerator{
86
92
  nextnumber = '0' + nextnumber;
87
93
  }
88
94
  newvalue = newvalue.replace(numberpattern[0], nextnumber);
89
- }
95
+ }
90
96
 
91
97
  if (datepattern && datepattern.length > 0) {
92
98
  for (let d = 0; d < datepattern.length; d++) {
93
99
  const dpattern = datepattern[d];
94
100
  const date = new Date();
95
- const formatteddate = moment().format(
101
+ const formatteddate =dayjs().format(
96
102
  dpattern.replace('{', '').replace('}', ''),
97
103
  );
98
104
  newvalue = newvalue.replace(dpattern, formatteddate);
@@ -104,4 +110,4 @@ export class DocNumberFormatGenerator{
104
110
  throw new InternalServerErrorException(errors);
105
111
  }
106
112
  };
107
- }
113
+ }
@@ -43,7 +43,7 @@ import {
43
43
  WorkflowName,
44
44
  } from '../types';
45
45
  @Injectable()
46
- export class SimpleAppService<T extends { _id?: string }> {
46
+ export class SimpleAppService<T extends { _id?: string, __v?:number }> {
47
47
  @Inject(EventEmitter2)
48
48
  protected eventEmitter: EventEmitter2;
49
49
  @Inject(CloudApiService)
@@ -542,6 +542,13 @@ export class SimpleAppService<T extends { _id?: string }> {
542
542
 
543
543
  findIdThenUpdate = async (appuser: UserContext, id: string, data: T) => {
544
544
  const existingdata = await this.findById(appuser, id);
545
+
546
+ //version exists, need ensure different only 1
547
+ if(typeof data.__v=='number' && data.__v != existingdata.__v ){
548
+ throw new BadRequestException(`You submit older version data "v${data.__v}"" but latest version = "v${existingdata.__v}"`)
549
+ }
550
+
551
+ data.__v = existingdata.__v+1
545
552
  if (!existingdata) {
546
553
  throw new NotFoundException(`${id} not found`, 'not found');
547
554
  }
@@ -592,6 +599,12 @@ export class SimpleAppService<T extends { _id?: string }> {
592
599
  if (!existingdata) {
593
600
  throw new NotFoundException(`${id} not found`, 'not found');
594
601
  }
602
+ if(typeof data.__v=='number' && data.__v != existingdata.__v ){
603
+ throw new BadRequestException(`You submit older version data "v${data.__v}"" but latest version = "v${existingdata.__v}"`)
604
+ }
605
+
606
+ data.__v = existingdata.__v+1
607
+
595
608
 
596
609
  if (this.hooks.beforeUpdate)
597
610
  await this.hooks.beforeUpdate(appuser, id, data, existingdata);
@@ -744,7 +757,7 @@ export class SimpleAppService<T extends { _id?: string }> {
744
757
  * @param {string} eventName The event name
745
758
  * @param {any} data The data
746
759
  */
747
- runBackgroundWorker(appuser: UserContext, eventName: string, payloads:any) {
760
+ runBackgroundWorker(appuser: UserContext, eventName: string, payloads: any) {
748
761
  this.eventEmitter.emit(eventName, appuser, payloads);
749
762
  }
750
763
 
@@ -764,7 +777,7 @@ export class SimpleAppService<T extends { _id?: string }> {
764
777
  * @param {any} data The data
765
778
  * @return {Promise} { description_of_the_return_value }
766
779
  */
767
- async runWorker(appuser: UserContext, eventName: string, payloads:any) {
780
+ async runWorker(appuser: UserContext, eventName: string, payloads: any) {
768
781
  const res = await this.eventEmitter.emitAsync(eventName, appuser, payloads);
769
782
  if (!this.eventEmitter.hasListeners(eventName)) {
770
783
  throw new InternalServerErrorException(`${eventName} seems no listener`);
@@ -1,5 +1,7 @@
1
1
  <template>
2
- <NuxtLayout :name="getLayout()">
2
+ <NuxtLayout :name="getLayout()">
3
+ <ConfirmDialog></ConfirmDialog>
4
+ <DynamicDialog />
3
5
  <SessionBlock/>
4
6
  <OverlayHoldscreen/>
5
7
  <EventDocumentViewer></EventDocumentViewer>
@@ -1,25 +1,66 @@
1
1
  <template>
2
- <ButtonDefault v-if="!actionName" :animate="animate"
3
- ><slot></slot>def</ButtonDefault
2
+ <ButtonDefault v-if="!actionName" :animate="animate">
3
+ <i :class="getIcon()"/><slot></slot>def</ButtonDefault
4
4
  >
5
5
  <ButtonPrimary
6
- v-else-if="['create', 'update','print'].includes(actionName)"
6
+ v-else-if="['create', 'update','confirm'].includes(actionName)"
7
7
  :animate="animate"
8
- ><slot></slot
8
+ >
9
+ <i :class="getIcon()"/>
10
+ <slot></slot
9
11
  ></ButtonPrimary>
12
+
10
13
  <ButtonDanger
11
14
  v-else-if="['delete', 'void'].includes(actionName)"
12
15
  :animate="animate"
13
- ><slot></slot
14
- ></ButtonDanger>
15
- <ButtonWarning v-else :animate="animate"><slot></slot></ButtonWarning>
16
+ >
17
+ <i :class="getIcon()"/>
18
+ <slot></slot>
19
+ </ButtonDanger>
20
+ <ButtonWarning v-else-if="['draft'].includes(actionName)" :animate="animate">
21
+ <i :class="getIcon()"/>
22
+ <slot></slot>
23
+ </ButtonWarning>
24
+ <ButtonDefault
25
+ v-else
26
+ :animate="animate"
27
+ >
28
+ <i :class="getIcon()"/>
29
+ <slot></slot
30
+ ></ButtonDefault>
16
31
  </template>
17
32
  <script setup lang="ts">
18
33
  /**
19
34
  * This file was automatically generated by simpleapp generator during initialization. It is changable.
20
- * --remove-this-line-to-prevent-override--
21
35
  * last change 2024-03-01
22
36
  * author: Ks Tan
23
37
  */
38
+
24
39
  const props = defineProps<{ actionName?: string; animate?: boolean }>();
40
+ const getIcon = ()=>{
41
+ let cssname='mr-1 pi ';
42
+ switch(props.actionName){
43
+ case 'create':
44
+ case 'update':
45
+ cssname+='pi-save';
46
+ break;
47
+ case 'delete':
48
+ cssname+='pi-trash';
49
+ break;
50
+ case 'print':
51
+ cssname+='pi-file-pdf';
52
+ break;
53
+ case 'confirm':
54
+ cssname+='pi-check';
55
+ break;
56
+ case 'void':
57
+ cssname+='pi-file-excel';
58
+ break;
59
+ case 'draft':
60
+ cssname+='pi-file-edit';
61
+ break;
62
+ }
63
+ return cssname
64
+ }
65
+
25
66
  </script>
@@ -1,13 +1,14 @@
1
1
  <template>
2
- <div class="flex flex-col ">
3
- <label v-if="label" :for="inputid">{{ label }}</label>
4
- <Calendar
5
- v-model="modelValue"
6
- class="w-full"
7
- :inputid="inputid"
8
- :date-format="getPrimevueCalendarDateFormat()"
9
- />
10
- </div>
2
+ <div class="flex flex-col">
3
+ <label v-if="label" :for="inputid">{{ label }}</label>
4
+ <Calendar
5
+ v-model="modelValue"
6
+ class="w-full"
7
+ :inputid="inputid"
8
+ :date-format="getPrimevueCalendarDateFormat()"
9
+ @update:modelValue="emits('change',modelValue)"
10
+ />
11
+ </div>
11
12
  </template>
12
13
  <script setup lang="ts">
13
14
  /**
@@ -16,9 +17,10 @@
16
17
  * last change 2024-04-16
17
18
  * author: Ks Tan
18
19
  */
19
- const modelValue = defineModel<Date>({required:true})
20
- const inputid=randomUUID()
20
+ const modelValue = defineModel<Date>({ required: true });
21
+ const inputid = randomUUID();
22
+ const emits = defineEmits(['change'])
21
23
  const props = defineProps<{
22
- label?:string
23
- }>()
24
- </script>
24
+ label?: string;
25
+ }>();
26
+ </script>
@@ -1,18 +1,16 @@
1
1
  <template>
2
2
  <OverlayViewer v-model="visible">
3
- <!-- <template #header>
4
-
5
- </template> -->
3
+ <template #header>
4
+ <div class="flex flex-row gap-4">
5
+ <Chip
6
+ v-for="(v, k) in allview"
7
+ :label="v.label"
8
+ @remove="deleteTab"
9
+ :removable="lastDocumentName == v.documentName"
10
+ />
11
+ </div>
12
+ </template>
6
13
  <div class="w-full h-full">
7
- <!-- <div class="flex flex-row gap-4" v-if="allview.length>0">
8
- <Chip
9
- v-for="(v, k) in allview"
10
- :label="v.label"
11
- @remove="deleteTab"
12
- :removable="true"
13
- />
14
- </div> -->
15
-
16
14
  <div
17
15
  v-for="(v, k) in allview"
18
16
  v-memo="[k]"
@@ -44,10 +42,19 @@
44
42
  import { onKeyStroke } from "@vueuse/core";
45
43
  import { useDialog } from "primevue/usedialog";
46
44
  import { defineAsyncComponent } from "vue";
45
+
47
46
  import { ViewRecord, FormCrudEvent } from "~/types";
48
47
  // import TabView from 'primevue/tabview';
49
48
  import Chip from "primevue/chip";
49
+ const lastDocumentName = computed(() => {
50
+ const keys = Object.keys(allview.value);
51
+
52
+ if (keys.length == 0) return "";
53
+
54
+ const keyname = keys[keys.length - 1];
50
55
 
56
+ return allview.value[keyname].documentName;
57
+ });
51
58
  const { $listen } = useNuxtApp();
52
59
  const visible = ref(false);
53
60
  const allview = ref<{ [key: string]: ViewRecord }>({});
@@ -59,7 +66,7 @@ const after = (
59
66
  ) => {
60
67
  if (v.after) {
61
68
  v.after(eventType, data);
62
-
69
+
63
70
  //only after mount consider no remove tab
64
71
  if (eventType != "mount") deleteTab();
65
72
  }
@@ -104,6 +111,16 @@ $listen("CloseDialog", (documentName: string) => {
104
111
  // visible.value = true;
105
112
  // allview.value[setting.eventId] = setting;
106
113
  // });
114
+ //
115
+ const clearView = () => {
116
+ allview.value = {};
117
+ };
118
+
119
+ watch(visible, () => {
120
+ if (visible.value == false) {
121
+ clearView();
122
+ }
123
+ });
107
124
  </script>
108
125
 
109
126
  <style scoped>
@@ -6,10 +6,15 @@
6
6
  :sub-title-field="uniqueKey"
7
7
  #default="{ item, index }"
8
8
  >
9
- <div class="cursor-pointer flex flex-row gap-2" @click="emits('click', item)">
10
- <slot name="default" :index="index" :item="item">
11
- <TextTitle class="flex-1">{{ item[(documentTitle as keyof typeof item) ] }}</TextTitle>
12
- <TextSubtitle >{{ item[uniqueKey as keyof typeof item] }}</TextSubtitle>
9
+ <div
10
+ class="cursor-pointer flex flex-row gap-2"
11
+ @click="emits('click', item)"
12
+ >
13
+ <slot name="default" :index="index" :item="item">
14
+ <TextMain class="flex-1">{{
15
+ item[documentTitle as keyof typeof item]
16
+ }}</TextMain>
17
+ <TextSubsubtitle>{{ item[uniqueKey as keyof typeof item] }}</TextSubsubtitle>
13
18
  </slot>
14
19
  </div>
15
20
  </ListView>
@@ -24,7 +29,7 @@
24
29
  import { SearchBody } from "~/types";
25
30
  const emits = defineEmits(["click"]);
26
31
  const props = defineProps<{
27
- recordlist: T[];
32
+ recordlist: T[];
28
33
  uniqueKey?: string;
29
34
  documentTitle?: string;
30
35
  }>();
@@ -30,11 +30,11 @@
30
30
  </slot>
31
31
  </div>
32
32
  <span class="p-input-icon-left flex-1">
33
- <i class="pi pi-search mt-4 ml-2 text-gray-400 absolute" />
33
+
34
34
  <InputText
35
35
  type="search"
36
36
  v-model="filters['global'].value"
37
- class="text-right"
37
+ class="w-full dark:text-white text-sm"
38
38
  placeholder="Keyword Search"
39
39
  />
40
40
  </span>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div>
3
- <Sidebar v-model:visible="messagesvisible" :header="t('messages')">
3
+ <Sidebar v-model:visible="messagesvisible" position="right" :header="t('messages')">
4
4
  <ListView :list="list" #default="{ item, index }" @click="openMessage">
5
5
  <div class="flex flex-col">
6
6
  <TextBold v-if="!item.read">{{ item.messageTitle }}</TextBold>