@simitgroup/simpleapp-generator 1.2.7 → 1.3.0-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 (106) hide show
  1. package/dist/buildinschemas/organization.d.ts.map +1 -1
  2. package/dist/buildinschemas/organization.js +3 -1
  3. package/dist/buildinschemas/organization.js.map +1 -1
  4. package/dist/framework.d.ts.map +1 -1
  5. package/dist/framework.js +4 -9
  6. package/dist/framework.js.map +1 -1
  7. package/dist/generate.js +14 -14
  8. package/dist/generate.js.map +1 -1
  9. package/package.json +1 -1
  10. package/src/buildinschemas/organization.ts +3 -1
  11. package/src/framework.ts +5 -9
  12. package/src/generate.ts +17 -16
  13. package/templates/basic/nest/controller.ts.eta +17 -0
  14. package/templates/basic/nest/default.ts.eta +6 -2
  15. package/templates/basic/nuxt/default.ts.eta +10 -6
  16. package/templates/basic/nuxt/pages.[id].vue.eta +9 -7
  17. package/templates/basic/nuxt/pages.form.vue.eta +16 -36
  18. package/templates/basic/nuxt/pages.landing.vue.eta +42 -35
  19. package/templates/basic/nuxt/pages.viewer.vue.eta +4 -6
  20. package/templates/nest/.env._eta +0 -1
  21. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +14 -2
  22. package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +32 -18
  23. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +76 -13
  24. package/templates/nuxt/app.vue.eta +7 -3
  25. package/templates/nuxt/assets/css/calendar.css._eta +21 -8
  26. package/templates/nuxt/assets/css/style.css._eta +17 -10
  27. package/templates/nuxt/assets/primevue/passthrough.ts._eta +44 -22
  28. package/templates/nuxt/components/button/ButtonDefault.vue._eta +1 -2
  29. package/templates/nuxt/components/button/ButtonMultiple.vue._eta +21 -0
  30. package/templates/nuxt/components/calendar/CalendarByResource.vue.eta +29 -8
  31. package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +3 -4
  32. package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +75 -65
  33. package/templates/nuxt/components/event/EventNotification.vue._eta +23 -2
  34. package/templates/nuxt/components/form/FormBranch.vue.eta +83 -0
  35. package/templates/nuxt/components/form/readme.md.eta +1 -0
  36. package/templates/nuxt/components/header/HeaderBar.vue._eta +9 -9
  37. package/templates/nuxt/components/header/HeaderBreadcrumb.vue.eta +2 -2
  38. package/templates/nuxt/components/header/button/HeaderButtonMenuPicker.vue._eta +16 -22
  39. package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +29 -46
  40. package/templates/nuxt/components/list/ListDocument.vue.eta +25 -0
  41. package/templates/nuxt/components/list/ListDocumentTable.vue.eta +77 -0
  42. package/templates/nuxt/components/list/ListView.vue.eta +129 -58
  43. package/templates/nuxt/components/mobile/MobileToolbar.vue.eta +10 -0
  44. package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +21 -0
  45. package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +20 -0
  46. package/templates/nuxt/components/page/PageDocList.vue.eta +170 -0
  47. package/templates/nuxt/components/renderer/RendererBoolean.vue.eta +8 -4
  48. package/templates/nuxt/components/renderer/RendererDate.vue.eta +4 -4
  49. package/templates/nuxt/components/renderer/RendererLink.vue.eta +12 -20
  50. package/templates/nuxt/components/renderer/RendererMoney.vue.eta +10 -2
  51. package/templates/nuxt/components/renderer/RendererViewer.vue.eta +27 -21
  52. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +202 -150
  53. package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +7 -1
  54. package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +112 -101
  55. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue.eta +183 -91
  56. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +383 -246
  57. package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +4 -3
  58. package/templates/nuxt/components/table/TableDocuments.vue.eta +3 -3
  59. package/templates/nuxt/components/text/TextDanger.vue._eta +5 -0
  60. package/templates/nuxt/components/text/TextSubtitle.vue._eta +5 -0
  61. package/templates/nuxt/components/text/TextTitle.vue._eta +5 -0
  62. package/templates/nuxt/components/user/UserProfileListItem.vue.eta +2 -2
  63. package/templates/nuxt/composables/date.generate.ts.eta +21 -0
  64. package/templates/nuxt/composables/goTo.generate.ts.eta +1 -0
  65. package/templates/nuxt/composables/stringHelper.generate.ts.eta +0 -5
  66. package/templates/nuxt/error.vue._eta +3 -3
  67. package/templates/nuxt/i18n.config.ts.eta +1 -1
  68. package/templates/nuxt/lang/en.ts.eta +16 -0
  69. package/templates/nuxt/layouts/default.vue._eta +34 -34
  70. package/templates/nuxt/layouts/loginlayout.vue._eta +3 -0
  71. package/templates/nuxt/layouts/mobile.vue._eta +52 -0
  72. package/templates/nuxt/nuxt.config.ts._eta +28 -22
  73. package/templates/nuxt/pages/[xorg]/organization/[id].vue.eta +39 -0
  74. package/templates/nuxt/pages/[xorg]/organization/new.vue.eta +30 -143
  75. package/templates/nuxt/pages/[xorg]/organization/viewer.vue.eta +3 -0
  76. package/templates/nuxt/pages/[xorg]/organization.vue.eta +81 -127
  77. package/templates/nuxt/pages/[xorg]/user/[id].vue.eta +40 -0
  78. package/templates/nuxt/pages/[xorg]/user/form.vue.eta +329 -0
  79. package/templates/nuxt/pages/[xorg]/user/index.vue.eta +37 -0
  80. package/templates/nuxt/pages/[xorg]/{organization/[id]/branches/[bid].vue → user/new.vue.eta} +10 -4
  81. package/templates/nuxt/pages/[xorg]/user/viewer.vue.eta +30 -0
  82. package/templates/nuxt/pages/[xorg]/{user.vue._eta → user.vue.eta} +88 -78
  83. package/templates/nuxt/pages/login.vue._eta +34 -0
  84. package/templates/nuxt/pages/profile.vue.eta +12 -3
  85. package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +36 -35
  86. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +6 -0
  87. package/templates/nuxt/server/api/[xorg]/[...].ts.eta +7 -40
  88. package/templates/nuxt/server/api/profile/[...].ts.eta +3 -32
  89. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +42 -3
  90. package/templates/nuxt/types/calendar.ts.eta +8 -1
  91. package/templates/nuxt/types/documentlist.ts.eta +0 -9
  92. package/templates/nuxt/types/events.ts.eta +1 -0
  93. package/templates/nuxt/types/others.ts.eta +4 -1
  94. package/templates/nuxt/types/simpleappinput.ts.eta +12 -2
  95. package/templates/nuxt/types/user.ts.eta +2 -0
  96. package/templates/project/lang/default._json +9 -1
  97. package/tsconfig.tsbuildinfo +1 -1
  98. package/templates/nuxt/components/docPage/DocPageList.vue.eta +0 -125
  99. package/templates/nuxt/lang/en.ts._eta +0 -6
  100. package/templates/nuxt/pages/[xorg]/organization/[bid].vue.eta +0 -14
  101. package/templates/nuxt/pages/[xorg]/organization/[id]/branches/new.vue +0 -149
  102. package/templates/nuxt/pages/[xorg]/organization/[id]/index.vue.eta +0 -1
  103. package/templates/nuxt/pages/[xorg]/user/[id].vue._eta +0 -6
  104. package/templates/nuxt/pages/[xorg]/user/index.vue._eta +0 -302
  105. package/templates/nuxt/pages/login.vue.eta +0 -30
  106. /package/templates/nuxt/lang/{df.ts.eta → df.ts.etaxxxx} +0 -0
@@ -9,13 +9,13 @@
9
9
  <SimpleAppForm #default="o" :document="doc">
10
10
  <client-only>
11
11
  <% if(it.autocompletename){%>
12
- <title v-if="id">{{ t(doc.getDocName())}}: {{ data.<%=it.autocompletename%> ?? ''}}</title>
12
+ <title v-if="id">{{ data.<%=it.autocompletename%> ?? data.<%=it.autocompletecode%>}}</title>
13
13
  <%}else{%>
14
14
  <title v-if="id">{{ t(doc.getDocName())}}</title>
15
15
  <%}%>
16
16
 
17
17
  <SimpleAppFormToolBar :document="doc" @on="actionListener"></SimpleAppFormToolBar>
18
- <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl: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 p-2">
19
19
  <% let isautofocus='' %>
20
20
  <%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
21
21
 
@@ -140,16 +140,18 @@
140
140
 
141
141
  <script setup lang="ts">
142
142
  /**
143
- * This file was automatically generated by simpleapp everytime regenerate code.
144
- * delete file "delete-me-for-avoid-override" if you want to modify this file and
145
- * prevent regenerate code override it.
146
- * last change 2023-09-09
147
- * author: Ks Tan
143
+ * This file was automatically generated by simpleapp generator.
144
+ * --remove-this-line-to-prevent-override--
145
+ * last change 2024-02-16
146
+ * Author: Ks Tan
148
147
  */
149
- import { SimpleAppInputType } from "~/types";
148
+ import { SimpleAppInputType,FormCrudEvent } from "~/types";
150
149
  import { <%= it.typename %> } from "~/simpleapp/generate/types";
151
- const props = defineProps<{ _id?: string,paras?:<%= it.typename %>}>();
152
- const doc = useNuxtApp().$<%= it.typename %>Doc()
150
+ import { <%= it.typename %>Doc} from "~/simpleapp/docs/<%= it.typename %>Doc"
151
+
152
+
153
+ const props = defineProps<{ _id?: string, doc?: <%= it.typename %>Doc , paras?:<%= it.typename %>}>();
154
+ const doc = props.doc ?? useNuxtApp().$<%= it.typename %>Doc()
153
155
  const data = doc.getReactiveData();
154
156
  const emits = defineEmits(["after"]);
155
157
  const id = computed(() => props._id ?? "");
@@ -157,9 +159,6 @@
157
159
  /************ start default methods ****************/
158
160
 
159
161
  const newData = () => doc.setNew()
160
- const createData = async () => await doc.create()
161
- const updateData = async () => await doc.update()
162
- const deleteData = async () => await doc.delete()
163
162
 
164
163
  const getRecord = async () => {
165
164
  if(id.value && id.value != 'new'){
@@ -170,34 +169,15 @@ const getRecord = async () => {
170
169
  }
171
170
 
172
171
  getRecord()
173
- watch(id,async ()=>getRecord())
172
+ watch(id,async ()=> await getRecord())
174
173
  /************ end default methods ****************/
175
174
 
176
175
 
177
- const actionListener = async (actionName: string) => {
178
-
179
- let result
180
- switch (actionName) {
181
- case "create":
182
- result =await createData()
183
- break;
184
- case "update":
185
- result = await updateData();
186
- break;
187
- case "delete":
188
- result =await deleteData()
189
- break;
190
- case "new":
191
- result =await newData();
192
- break;
193
- case "mount":
194
- break;
195
- }
196
-
197
- emits('after',actionName,data.value,doc,result)
176
+ const actionListener = async (actionName: string) => {
177
+ emits('after',actionName,data.value)
198
178
  };
199
- onMounted(async ()=> await actionListener('mount'))
200
179
 
180
+ onMounted(async ()=> await actionListener(FormCrudEvent.mount))
201
181
  /************ start api methods ****************/
202
182
 
203
183
  <%for(let i=0;i<it.apiSettings.length;i++){%>
@@ -1,55 +1,62 @@
1
+ <% const skipcolumns = ['_id','createdBy','created','updatedBy','updated','orgId','branchId','tenantId','doctype'] %>
1
2
  <template>
2
3
 
3
- <DocPageList :document="doc" :columns="columns" :sorts="sorts">
4
- <title v-if="!id">{{ t(doc.getDocName()) }} </title>
5
- <div>
6
- <NuxtPage :_id="id ?? 'new'"/>
7
-
8
-
9
- </div>
10
- </DocPageList>
4
+ <PageDocList :document="doc" :columns="columns" :data="docdata" :sorts="sorts">
5
+ <template #mobileList="{index,item}">
6
+ </template>
7
+ <template #dataTableColumns>
8
+ <%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
9
+ <%let obj=it.jsonschema.properties[key] %>
10
+ <%let config=it.jsonschema['x-simpleapp-config'] %>
11
+ <%if(skipcolumns.indexOf(key)>=0){%>
12
+ <%} else if(config['uniqueKey'] && (config['uniqueKey']==key || config['documentTitle']==key) ){%>
13
+ <Column #body="{index,data}" :header="t('<%=key%>')">
14
+ <RendererLink :value="data" :setting="{path:'<%=it.name%>'}" :fields="['<%=key%>']">{{ data.<%=key%> }}</RendererLink>
15
+ </Column>
16
+
17
+ <%} else if(['string','number','integer','boolean'].indexOf(obj.type)>=0){%>
18
+ <Column #body="{index,data}" :header="t('<%=key%>')">
19
+ {{data.<%=key%>}}
20
+ </Column>
21
+ <%} else if(obj.type =='object' && obj['x-foreignkey'] ){%>
22
+ <Column #body="{index,data}" :header="t('<%=key%>')">
23
+ <RendererViewer :value="data.<%=key%>" :setting="{documentName:'<%=obj["x-foreignkey"]%>'}" :fields="['<%=key%>']">{{ data.label }}</RendererViewer>
24
+ </Column>
25
+ <%}%>
26
+ <%})%>
27
+ </template>
28
+ <template #default><div><NuxtPage :_id="id ?? 'new'"/></div></template>
29
+ </PageDocList>
11
30
  </template>
12
31
  <script setup lang="ts">
13
32
  /**
14
- * This file was automatically generated by simpleapp everytime regenerate code.
15
- * delete file "delete-me.txt" if you want to modify this file and
16
- * prevent regenerate code override it.
33
+ * This file was automatically generated by simpleapp generator.
34
+ * --remove-this-line-to-prevent-override--
17
35
  * last change 2023-09-09
18
36
  * author: Ks Tan
19
37
  */
20
- <% const skipcolumns = ['_id','createdBy','created','updatedBy','updated','orgId','branchId','tenantId','doctype'] %>
38
+
21
39
 
22
- import { CellSetting } from "~/types";
23
40
  const {$<%= it.typename %>Doc,$listen } = useNuxtApp();
24
41
  const doc = $<%= it.typename %>Doc()
25
- const data = doc.getReactiveData();
42
+ const docdata = doc.getReactiveData();
26
43
 
27
44
  definePageMeta({
28
- menuPath:'sample/<%= it.name %>'
45
+ menuPath:'nocategory/<%= it.name %>'
29
46
  });
30
47
 
31
- const columns:CellSetting[] = [<%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
48
+ const columns= [<%Object.keys(it.jsonschema.properties).forEach(function(key) { %>
32
49
  <%let obj=it.jsonschema.properties[key] %>
33
50
  <%let config=it.jsonschema['x-simpleapp-config'] %>
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
- },
43
- <%} else if(['string','number','integer'].indexOf(obj.type)>=0){%>'<%=key%>',
44
- <%} else if(obj.type =='object' && obj['x-foreignkey'] ){%>
45
- {
46
- title:'<%=key%>',
47
- field:'<%=key%>',
48
- rendererName:'RendererForeignKey',
49
- rendererSetting:{collection:'<%=obj["x-foreignkey"]%>' }
50
- },
51
- <%}%>
52
- <%})%>] as CellSetting[]
51
+ <%if(skipcolumns.indexOf(key)>=0){%>
52
+ <%}else if(['string','number','integer','boolean'].indexOf(obj.type)>=0){%>'<%=key%>',
53
+ <%} %>
54
+ <%})%>]
55
+
56
+
57
+
58
+
59
+
53
60
  const sorts:string[][] = [
54
61
  <%if(it.jsonschema['x-simpleapp-config'] && it.jsonschema['x-simpleapp-config']['uniqueKey']){%>
55
62
  ['<%=it.jsonschema['x-simpleapp-config']['uniqueKey']%>','asc'],
@@ -1,20 +1,18 @@
1
1
  <template>
2
- <Crud :_id="_id" @after="after" :paras="paras"/>
2
+ <LazyForm<%=it.typename%> :_id="_id" @after="after" :paras="paras"/>
3
3
  </template>
4
4
  <script setup lang="ts">
5
5
  /**
6
6
  * This file was automatically generated by simpleapp everytime regenerate code.
7
- * delete file "delete-me-for-avoid-override" if you want to modify this file and
8
- * prevent regenerate code override it.
7
+ * --remove-this-line-to-prevent-override--
9
8
  * last change 2023-09-09
10
9
  * author: Ks Tan
11
10
  */
12
- import Crud from './form.vue'
13
11
  import {<%= it.typename %>} from '~/simpleapp/generate/types'
14
12
  const props = defineProps<{_id:string,paras?:<%= it.typename %>}>();
15
13
  const emits = defineEmits(["afterCreate","after"]);
16
14
 
17
- const after = (actionName: string, data: <%= it.typename %>, result: any) => {
15
+ const after = (actionName: string, data: <%= it.typename %>) => {
18
16
  switch (actionName) {
19
17
  case "new":
20
18
  break;
@@ -26,6 +24,6 @@ const after = (actionName: string, data: <%= it.typename %>, result: any) => {
26
24
  case "delete":
27
25
  break;
28
26
  }
29
- emits("after",actionName,data,result)
27
+ emits("after",actionName,data)
30
28
  };
31
29
  </script>
@@ -33,7 +33,6 @@ AUTH_SECRET_KEY=<%=it.configs.oauthSetting.oauthAuthSecretKey%>
33
33
 
34
34
  BACKEND_URL=http://localhost:<%=it.configs.backendPort%>
35
35
 
36
- AUTH_ORIGIN=http://localhost:8080
37
36
 
38
37
  ADMIN_EMAIL=
39
38
  TEST_OAUTH2_USERNAME=
@@ -56,6 +56,8 @@ export class UserContext {
56
56
  protected orgCode: string = '';
57
57
  protected orgName: string = '';
58
58
  protected timeZone: string = '';
59
+ protected country: string = '';
60
+ protected offsetMinute: number =0;
59
61
  protected currency: string = '';
60
62
  protected branches: any[] = [];
61
63
  protected lastActivity: string = new Date().toISOString();
@@ -88,6 +90,8 @@ export class UserContext {
88
90
  getBranchId = () => this.branchId;
89
91
  getEmail = () => this.email;
90
92
  getTimeZone = () => this.timeZone;
93
+ getCountry = () => this.country
94
+ getOffsetMinute = () => this.offsetMinute
91
95
  getGroup = () => this.group;
92
96
  getCurrency = () => this.currency;
93
97
  getMoreProps = () => this.moreProps;
@@ -212,6 +216,8 @@ export class UserContext {
212
216
  userinfo.orgName = myperm.currentorg[0].orgName;
213
217
  userinfo.timeZone = myperm.currentorg[0].timeZone;
214
218
  userinfo.currency = myperm.currentorg[0].currency;
219
+ userinfo.country = myperm.currentorg[0].country;
220
+ userinfo.offsetMinute = myperm.currentorg[0].offsetMinute;
215
221
  }
216
222
  } else {
217
223
  userinfo.group = '';
@@ -262,7 +268,9 @@ export class UserContext {
262
268
  this.orgCode = userinfo['orgCode'] ?? '';
263
269
  this.orgName = userinfo['orgName'] ?? '';
264
270
  this.timeZone = userinfo['timeZone'] ?? '';
265
- this.currency= userinfo['currency'] ?? '';
271
+ this.currency = userinfo['currency'] ?? '';
272
+ this.country = userinfo['country'] ?? '';
273
+ this.offsetMinute = userinfo['offsetMinute'] ?? '';
266
274
  this.orgRecordId = userinfo['orgRecordId'] ?? '';
267
275
  this.branchRecordId = userinfo['branchRecordId'] ?? '';
268
276
  this.group = userinfo['group'] ?? '';
@@ -384,6 +392,8 @@ export class UserContext {
384
392
  orgName: this.orgName,
385
393
  timeZone: this.getTimeZone(),
386
394
  currency: this.getCurrency(),
395
+ country : this.getCountry(),
396
+ offsetMinute: this.getOffsetMinute(),
387
397
  email: this.getEmail(),
388
398
  uid: this.getUid(),
389
399
  fullName: this.getFullname(),
@@ -681,8 +691,10 @@ export class UserContext {
681
691
  'orgName',
682
692
  'timeZone',
683
693
  'currency',
694
+ 'country',
695
+ 'offsetMinute',
684
696
  'tenantId',
685
- 'lastActivity',
697
+ 'lastActivity',
686
698
  'group',
687
699
  '__v',
688
700
  'uid',
@@ -15,8 +15,8 @@ import {
15
15
  Type,
16
16
  } from '@nestjs/common';
17
17
  // import { ApiTags, ApiBody, ApiResponse, ApiOperation } from '@nestjs/swagger';
18
- import {UserContext} from '../commons/user.context'
19
- import {SearchBody} from '../types';
18
+ import { UserContext } from '../commons/user.context';
19
+ import { SearchBody } from '../types';
20
20
  const doctype = 'person'.toUpperCase();
21
21
  type ServiceType = {
22
22
  list: Function;
@@ -27,13 +27,18 @@ type ServiceType = {
27
27
  findById: Function;
28
28
  findIdThenDelete: Function;
29
29
  findIdThenUpdate: Function;
30
+ findIdThenPatch: Function;
30
31
  setData: Function;
31
32
  getAutoComplete: Function;
32
33
  };
33
34
 
34
35
  // @ApiTags(doctype)
35
36
  // @Controller(doctype.toLowerCase())
36
- export class SimpleAppAbstractController<TService extends ServiceType, TApiSchema, T> {
37
+ export class SimpleAppAbstractController<
38
+ TService extends ServiceType,
39
+ TApiSchema,
40
+ T,
41
+ > {
37
42
  protected service: TService;
38
43
  protected tryno: number;
39
44
  // protected apiSchemaClass=
@@ -42,36 +47,45 @@ export class SimpleAppAbstractController<TService extends ServiceType, TApiSchem
42
47
  this.service = service;
43
48
  }
44
49
 
45
- async _list(appuser:UserContext) {
46
- return this.service.list(appuser,);
50
+ async _list(appuser: UserContext) {
51
+ return this.service.list(appuser);
47
52
  }
48
- async _search(appuser:UserContext,searchObject:SearchBody) {
49
-
50
- return this.service.search(appuser,searchObject['filter'], searchObject['fields'],searchObject['sorts']);
53
+ async _search(appuser: UserContext, searchObject: SearchBody) {
54
+ return this.service.search(
55
+ appuser,
56
+ searchObject['filter'],
57
+ searchObject['fields'],
58
+ searchObject['sorts'],
59
+ );
51
60
  }
52
- async _autocomplete(appuser:UserContext,keyword: string) {
53
- return this.service.getAutoComplete(appuser,keyword);
61
+ async _autocomplete(appuser: UserContext, keyword: string) {
62
+ return this.service.getAutoComplete(appuser, keyword);
54
63
  }
55
- async _findOne(appuser:UserContext,id: string) {
56
- const result = (await this.service.findById(appuser,id)) as TApiSchema;
64
+ async _findOne(appuser: UserContext, id: string) {
65
+ const result = (await this.service.findById(appuser, id)) as TApiSchema;
57
66
 
58
67
  return result as Type<TApiSchema>;
59
68
  }
60
69
 
61
- async _create(appuser:UserContext,data: TApiSchema) {
70
+ async _create(appuser: UserContext, data: TApiSchema) {
62
71
  //const newdata: persontype.Person = { ...data };
63
72
  const newdata: T = {} as T; //= { ...data };
64
73
  Object.assign(newdata, data); //
65
- return this.service.create(appuser,newdata) as TApiSchema;
74
+ return this.service.create(appuser, newdata) as TApiSchema;
66
75
  }
67
76
 
68
- async _update(appuser:UserContext,id: string, data: TApiSchema) {
77
+ async _update(appuser: UserContext, id: string, data: TApiSchema) {
69
78
  const newdata: T = {} as T; //= { ...data };
70
79
  Object.assign(newdata, data); //
71
- return this.service.findIdThenUpdate(appuser,id, newdata) as TApiSchema;
80
+ return this.service.findIdThenUpdate(appuser, id, newdata) as TApiSchema;
81
+ }
82
+ async _patch(appuser: UserContext, id: string, data: TApiSchema) {
83
+ const newdata: T = {} as T; //= { ...data };
84
+ Object.assign(newdata, data); //
85
+ return this.service.findIdThenPatch(appuser, id, newdata) as TApiSchema;
72
86
  }
73
87
 
74
- async _delete(appuser:UserContext,id: string) {
75
- return this.service.findIdThenDelete(appuser,id);
88
+ async _delete(appuser: UserContext, id: string) {
89
+ return this.service.findIdThenDelete(appuser, id);
76
90
  }
77
91
  }
@@ -32,7 +32,12 @@ import {
32
32
  } from '@nestjs/common/exceptions';
33
33
  import { UserContext } from '../commons/user.context';
34
34
  import { DocNumberFormatGenerator } from '../commons/docnogenerator.service';
35
- import { IsolationType, DefaultHooks, MoreProjectionType,DeleteResultType } from '../types';
35
+ import {
36
+ IsolationType,
37
+ DefaultHooks,
38
+ MoreProjectionType,
39
+ DeleteResultType,
40
+ } from '../types';
36
41
  @Injectable()
37
42
  export class SimpleAppService<T extends { _id?: string }> {
38
43
  @Inject(EventEmitter2)
@@ -447,7 +452,7 @@ export class SimpleAppService<T extends { _id?: string }> {
447
452
  try {
448
453
  if (this.hooks.beforeDelete) await this.hooks.beforeDelete(appuser, id);
449
454
  this.logger.debug('delete record', this.documentName, id);
450
- dependency = await this.getRelatedRecords(appuser,id);
455
+ dependency = await this.getRelatedRecords(appuser, id);
451
456
  //console.log('dependency', dependency);
452
457
  if (!dependency) {
453
458
  let filterIsolation = this.getIsolationFilter(appuser);
@@ -460,7 +465,10 @@ export class SimpleAppService<T extends { _id?: string }> {
460
465
  .session(dbsession);
461
466
 
462
467
  appuser.addDeletedRecordId(this.documentName, id);
463
- const deleteresult:DeleteResultType<T> = { result: result, data: deletedata };
468
+ const deleteresult: DeleteResultType<T> = {
469
+ result: result,
470
+ data: deletedata,
471
+ };
464
472
  this.logger.debug(
465
473
  deleteresult,
466
474
  ' delete result' + this.doc.collection.name,
@@ -472,9 +480,9 @@ export class SimpleAppService<T extends { _id?: string }> {
472
480
  //this.doc.findByIdAndDelete(id);
473
481
  return deleteresult;
474
482
  } else {
475
- console.log("reject query",dependency)
483
+ console.log('reject query', dependency);
476
484
 
477
- throw new ForbiddenException(dependency,'Foreignkey constraint');
485
+ throw new ForbiddenException(dependency, 'Foreignkey constraint');
478
486
  }
479
487
  } catch (err) {
480
488
  throw new InternalServerErrorException(err);
@@ -504,13 +512,13 @@ export class SimpleAppService<T extends { _id?: string }> {
504
512
  if (!dbsession.inTransaction()) {
505
513
  dbsession.startTransaction();
506
514
  }
507
-
508
515
  // try {
509
516
  Object.assign(data, appuser.getUpdateFilter());
510
- Object.assign(existingdata, data);
517
+ // Object.assign(existingdata, data);
511
518
  delete data['_id'];
512
519
 
513
520
  this.reCalculateValue(data);
521
+
514
522
  // existingdata['_id']=''
515
523
  // console.log("newdata",data)
516
524
  await this.validateData(appuser, data);
@@ -520,10 +528,63 @@ export class SimpleAppService<T extends { _id?: string }> {
520
528
 
521
529
  isolationFilter['_id'] = id;
522
530
  this.applyNestedDateTime(appuser, data, 'update');
531
+
523
532
  try {
524
- const result = await this.doc
525
- .findOneAndUpdate(isolationFilter, data)
526
- .session(dbsession);
533
+ const result = await this.doc.findOneAndReplace(isolationFilter, data, {
534
+ session: dbsession,
535
+ });
536
+
537
+ appuser.addUpdatedRecordId(this.documentName, data._id);
538
+
539
+ if (this.hooks.afterUpdate)
540
+ await this.hooks.afterUpdate(appuser, id, result);
541
+ return await this.findById(appuser, id);
542
+ } catch (err) {
543
+ throw new InternalServerErrorException(err.message);
544
+ }
545
+ };
546
+
547
+ findIdThenPatch = async (
548
+ appuser: UserContext,
549
+ id: string,
550
+ data: T,
551
+ session: mongo.ClientSession = undefined,
552
+ ) => {
553
+ const existingdata = await this.findById(appuser, id);
554
+ if (!existingdata) {
555
+ throw new NotFoundException(`${id} not found`, 'not found');
556
+ }
557
+
558
+ if (this.hooks.beforeUpdate)
559
+ await this.hooks.beforeUpdate(appuser, id, data);
560
+
561
+ const dbsession = appuser.getDBSession();
562
+ if (!dbsession.inTransaction()) {
563
+ dbsession.startTransaction();
564
+ }
565
+ // try {
566
+ Object.assign(data, appuser.getUpdateFilter());
567
+ // Object.assign(existingdata, data);
568
+ delete data['_id'];
569
+
570
+ this.reCalculateValue(data);
571
+
572
+ // existingdata['_id']=''
573
+ // console.log("newdata",data)
574
+ //path record no validation
575
+ // await this.validateData(appuser, data);
576
+
577
+ const isolationFilter = { ...this.getIsolationFilter(appuser) };
578
+ this.polishIsolationFilter(isolationFilter);
579
+
580
+ isolationFilter['_id'] = id;
581
+ this.applyNestedDateTime(appuser, data, 'update');
582
+
583
+ try {
584
+ const result = await this.doc.findOneAndUpdate(isolationFilter, data, {
585
+ session: dbsession,
586
+ });
587
+
527
588
  appuser.addUpdatedRecordId(this.documentName, data._id);
528
589
 
529
590
  if (this.hooks.afterUpdate)
@@ -535,9 +596,9 @@ export class SimpleAppService<T extends { _id?: string }> {
535
596
  };
536
597
 
537
598
  //find what foreign key constraint
538
- async getRelatedRecords(appuser:UserContext,id: string) {
599
+ async getRelatedRecords(appuser: UserContext, id: string) {
539
600
  this.logger.debug('get foreignkey for delete:', id);
540
- console.log("session modifeds",appuser.getModifieds())
601
+ console.log('session modifeds', appuser.getModifieds());
541
602
  if (foreignkeys === undefined) {
542
603
  this.logger.error('foreignkeys object undetected');
543
604
  throw new InternalServerErrorException('foreignkeys object undetected');
@@ -562,7 +623,9 @@ export class SimpleAppService<T extends { _id?: string }> {
562
623
  //not deleted in current session, check from database
563
624
  let filter = {};
564
625
  filter[fkey] = id;
565
- const result = await collection.findOne(filter,{session:appuser.getDBSession()});
626
+ const result = await collection.findOne(filter, {
627
+ session: appuser.getDBSession(),
628
+ });
566
629
  if (result) {
567
630
  this.logger.error(result, 'related result found');
568
631
  return result;
@@ -8,15 +8,19 @@
8
8
  watch(()=>useRoute().params['xorg'],(newval,oldvalue)=>{
9
9
  reloadUserStore()
10
10
  })
11
+
12
+ const getLayout = ()=>{
13
+ const { status } = useAuth();
14
+ if(status.value=='unauthenticated') return 'loginlayout'
15
+ else return useDevice().isMobile ? 'mobile' : 'default'
16
+ }
11
17
  </script>
12
18
  <template>
13
- <div>
14
- <NuxtLayout>
19
+ <NuxtLayout :name="getLayout()">
15
20
  <SessionBlock/>
16
21
  <EventDocumentViewer></EventDocumentViewer>
17
22
  <EventDecision/>
18
23
  <EventNotification/>
19
24
  <NuxtPage />
20
25
  </NuxtLayout>
21
- </div>
22
26
  </template>
@@ -16,22 +16,35 @@
16
16
  #resourceviewcal .vuecal__event {
17
17
  border-radius: 0.5rem;
18
18
  }
19
- #resourceviewcal .vuecal__split-days-headers {
20
- min-height: 6rem;
19
+ #resourceviewcal .vuecal__time-column {
20
+ margin-top: 3rem;
21
+ /* background-color: red; */
21
22
  }
22
23
 
24
+ #resourceviewcal .vuecal__split-days-headers{
25
+ min-height: 3rem;
26
+ /* background-color: blue; */
27
+ /* margin-left:-4rem; */
28
+ }
23
29
  #resourceviewcal .vuecal__event {
24
30
  border: solid 1px #ccc !important;
25
31
  }
26
32
 
27
- #resourceviewcal .normalevent{
33
+
34
+
35
+
36
+ #resourceviewcal .nostudent{
28
37
  background-color: aqua;
29
38
  }
30
-
31
- #resourceviewcal .urgentevent{
32
- background-color: lightcoral;
39
+ #resourceviewcal .full{
40
+ @apply bg-orange-700 text-white
41
+ /* background-color: darkorange; */
42
+ /* color:white; */
33
43
  }
34
-
35
- #resourceviewcal .seminal{
44
+ #resourceviewcal .overlimit{
45
+ background-color: darkred;
46
+ color:white;
47
+ }
48
+ #resourceviewcal .default{
36
49
  background-color: lightblue;
37
50
  }
@@ -1,6 +1,6 @@
1
1
 
2
2
  [disabled] ,[readonly]{
3
- @apply bg-gray-300 dark:bg-gray-900
3
+ @apply bg-gray-300 dark:bg-gray-600
4
4
  }
5
5
 
6
6
  [aria-selected=true]{
@@ -13,21 +13,27 @@
13
13
  [data-pc-section=pagebutton]{
14
14
  @apply p-3 m-0 border
15
15
  }
16
+ html {
17
+ overflow: hidden;
18
+ overscroll-behavior: none;
19
+ touch-action: manipulation;
20
+ }
21
+ /* #__nuxt{
22
+
23
+ } */
16
24
 
17
25
  body {
18
- @apply bg-gray-50 dark:bg-gray-800 h-screen w-screen overflow-y-scroll
26
+ @apply bg-gray-100 dark:bg-slate-950 dark:text-gray-300 h-screen w-screen
27
+ /* overflow-y-scroll overflow-x-scroll */
19
28
  }
20
29
 
21
- input {
22
- @apply bg-opacity-0 bg-black
23
- }
24
30
 
25
31
  .route-link-list {
26
- @apply hover:bg-secondary-200 dark:hover:bg-gray-800
32
+ @apply text-black hover:text-secondary-200 dark:hover:text-primary-400
27
33
  }
28
34
 
29
35
  .router-link-exact-active{
30
- @apply bg-primary-100 dark:bg-gray-800 block
36
+ @apply text-primary-100 dark:text-primary-600 block
31
37
  }
32
38
 
33
39
  .invisible{
@@ -39,6 +45,10 @@ input {
39
45
  .subtitle-text{
40
46
  @apply text-base text-gray-500
41
47
  }
48
+ .p-inputnumber-input{
49
+ @apply text-right
50
+ }
51
+
42
52
 
43
53
  .btn {
44
54
  @apply font-medium text-gray-50 dark:text-gray-300 border
@@ -57,7 +67,4 @@ input {
57
67
  @apply btn bg-warning-600 hover:bg-warning-400
58
68
  }
59
69
 
60
- .simpleapp-input-label{
61
- @apply text-left
62
- }
63
70