@simitgroup/simpleapp-generator 2.0.0-e-alpha → 2.0.0-g-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 (38) hide show
  1. package/ReleaseNote.md +13 -0
  2. package/dist/buildinschemas/index.d.ts +2 -0
  3. package/dist/buildinschemas/index.d.ts.map +1 -1
  4. package/dist/buildinschemas/index.js +5 -3
  5. package/dist/buildinschemas/index.js.map +1 -1
  6. package/dist/buildinschemas/webhook.js +1 -1
  7. package/dist/generate.js +1 -1
  8. package/dist/generate.js.map +1 -1
  9. package/package.json +1 -1
  10. package/src/buildinschemas/index.ts +2 -2
  11. package/src/buildinschemas/{webhook.ts.backup → webhook.ts} +1 -1
  12. package/src/generate.ts +1 -1
  13. package/templates/basic/nest/module.ts.eta +2 -2
  14. package/templates/basic/nest/service.ts.eta +2 -2
  15. package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.module.ts.eta +15 -7
  16. package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.schema.ts.eta +41 -42
  17. package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.service.ts.eta +11 -11
  18. package/templates/nest/src/simple-app/.core/features/log/log.controller.ts.eta +42 -0
  19. package/templates/nest/src/simple-app/.core/features/log/log.module.ts.eta +11 -8
  20. package/templates/nest/src/simple-app/.core/features/log/log.service.ts.eta +48 -13
  21. package/templates/nest/src/simple-app/.core/features/log/schemas/document-event.schema.ts.eta +23 -1
  22. package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager-policy.service.ts.eta +13 -6
  23. package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager.service.ts.eta +5 -2
  24. package/templates/nest/src/simple-app/.core/features/policy/policy.service.ts.eta +6 -5
  25. package/templates/nest/src/simple-app/.core/features/profile/profile.service.ts.eta +3 -1
  26. package/templates/nest/src/simple-app/.core/features/queue/queue-base/queue-base.consumer.ts.eta +7 -5
  27. package/templates/nest/src/simple-app/.core/features/simple-app-core-features.module.ts.eta +3 -3
  28. package/templates/nest/src/simple-app/.core/features/user-context/user.context.ts.eta +11 -0
  29. package/templates/nest/src/simple-app/.core/features/webhook/schemas/webhook.schema.ts.eta +36 -36
  30. package/templates/nest/src/simple-app/.core/framework/base/simple-app.service.ts.eta +188 -165
  31. package/templates/nest/src/simple-app/mini-apps/mini-apps.module.ts._eta +14 -0
  32. package/templates/nest/src/simple-app/simple-app.module.ts.eta +5 -1
  33. package/templates/nuxt/components/form/FormDocnoformat.vue._eta +78 -17
  34. package/templates/nuxt/components/renderer/RendererDocHistories.vue._eta +90 -50
  35. package/templates/nuxt/components/user/UserTenantPicker.vue._eta +6 -1
  36. package/templates/nuxt/composables/docformat.generate.ts.eta +2 -2
  37. package/templates/nuxt/plugins/19.simpleapp-mini-app-store.ts.eta +2 -2
  38. /package/src/buildinschemas/{documentnoformat.ts.backup → documentnoformat.ts} +0 -0
@@ -1,65 +1,89 @@
1
1
  <template>
2
+ <!-- <div>histories</div> -->
2
3
  <div
3
- class="flex flex-row text-xs cursor-pointer justify-end"
4
+ class="flex flex-row items-center gap-2 text-xs cursor-pointer justify-end"
4
5
  v-if="data?.updated && data?.updated != ''"
5
6
  @click="viewHistories"
6
7
  >
7
8
  <ImageAvatar
8
- v-if="data?.updatedBy"
9
- :id="data.updatedBy"
10
- :size="36"
9
+ class="w-10 h-10"
10
+ v-if="data?.createdBy"
11
+ :uid="data.createdBy"
12
+ :size="PHOTOSIZE.S40"
13
+ :changable="false"
11
14
  ></ImageAvatar>
12
15
  <div class="flex flex-col flex-1">
13
16
  <TextDocStatus
14
17
  v-if="data?.documentStatus"
15
18
  :docStatus="data?.documentStatus"
16
19
  />
17
- <!-- <TextSubsubtitle class="text-gray-400 italic"
18
- >{{ t("updated") }}:</TextSubsubtitle
19
- > -->
20
20
  <RendererDateAge :value="data?.updated" class="text-gray-400 italic" />
21
21
  </div>
22
22
 
23
- <Dialog
23
+ <Drawer
24
24
  v-model:visible="visibleHistories"
25
25
  modal
26
+ position="right"
26
27
  :header="t(documentName) + ' ' + t('histories')"
27
28
  :pt="{ root: { class: 'w-1/3' } }"
28
29
  >
29
30
  <Timeline :value="events" class="w-full md:w-20rem">
30
- <template #opposite="{ item }">
31
- <div class="flex flex-row">
32
- <ImageAvatar :email="item.email" :id="item.uid" />
33
- <div class="flex flex-col">
34
- <span>{{ item.fullName }}</span>
35
- <RendererDateAge
36
- class="italic text-gray-400 text-xs whitespace-nowrap"
37
- :value="item.eventDate"
38
- />
31
+ <template #opposite="{ item,index }">
32
+ <div class="flex flex-col">
33
+ <div class="flex items-center space-x-2">
34
+ <div class="flex-shrink-0">
35
+ <ImageAvatar :uid="item.uid" class="w-10 h-9" />
36
+ </div>
37
+ <span class="flex-1">{{ item.fullName }}</span>
39
38
  </div>
39
+ <RendererDateAge
40
+ class="italic text-gray-400 text-xs whitespace-nowrap"
41
+ v-tooltip="dateRenderToDateTimeStr(item.eventDate)"
42
+ :value="item.eventDate"
43
+ />
40
44
  </div>
41
45
  </template>
42
- <template #content="{ item }">
46
+ <template #content="{ item,index }">
43
47
  <div>
44
48
  <div>{{ item.status }}</div>
49
+ <div v-if="item.eventData && hasAuditTrail">
50
+ <TextPrimary
51
+ @click="viewChanges(index)"
52
+ class="cursor-pointer"
53
+ >{{ t("details") }}{{ index }}</TextPrimary
54
+ >
55
+ </div>
56
+ <div v-else-if="item.eventData">
57
+ <TextSubtitle class="text-gray-500">{{
58
+ t("upgradeToEnt")
59
+ }}</TextSubtitle>
60
+ </div>
61
+ <div v-else>
62
+ <!-- no event data available -->
63
+ </div>
45
64
  </div>
46
65
  </template>
47
66
  </Timeline>
48
- </Dialog>
67
+
68
+ <Dialog v-model:visible="visibleAuditTrailDetail" modal :header="t('modificationDetails')">
69
+ <pre class="text-xs text-gray-500">{{eventData}}</pre>
70
+ </Dialog>
71
+ </Drawer>
49
72
  </div>
50
73
  </template>
51
74
  <script lang="ts" setup>
52
- /**
53
- * This file was automatically generated by simpleapp generator during initialization. It is changable.
54
- * --remove-this-line-to-prevent-override--
55
- * last change 2024-02-22
56
- * author: Ks Tan
57
- */
75
+ import { PHOTOSIZE } from "~/types";
58
76
  import TextSubsubtitle from "../text/TextSubsubtitle.vue";
59
77
  import RendererDateTime from "./RendererDateTime.vue";
60
- import { Documentevent, User } from "~/simpleapp/generate/openapi";
61
- const eventDoc = useNuxtApp().$DocumenteventDoc();
78
+ import { LOGApi } from "~/simpleapp/generate/openapi";
79
+ import TextPrimary from "../text/TextPrimary.vue";
80
+ import { diff, addedDiff, deletedDiff, updatedDiff, detailedDiff } from 'deep-object-diff';
81
+ const logDoc = new LOGApi(getAxiosConfig());
82
+ const hasAuditTrail = true; //getUserProfile().tenantInfo?.package==='enterprise'
62
83
  const visibleHistories = ref(false);
84
+ const visibleAuditTrailDetail = ref(false);
85
+ const auditTrailIndex=ref(-1)
86
+ const eventData = ref<Object>({})
63
87
  const props = defineProps<{ data: any; documentName: string }>();
64
88
  type EventHistory = {
65
89
  status: string;
@@ -67,6 +91,7 @@ type EventHistory = {
67
91
  uid?: string;
68
92
  fullName?: string;
69
93
  email?: string;
94
+ eventData?: any;
70
95
  };
71
96
  const events = ref<EventHistory[]>([]);
72
97
  const getEvents = async () => {
@@ -74,6 +99,7 @@ const getEvents = async () => {
74
99
  {
75
100
  status: t("created"),
76
101
  eventDate: props.data.created,
102
+ fullName: "",
77
103
  uid: props.data.createdBy,
78
104
  },
79
105
  ];
@@ -81,32 +107,30 @@ const getEvents = async () => {
81
107
  simplelog.push({
82
108
  status: t("lastUpdate"),
83
109
  eventDate: props.data.updated,
110
+ fullName: "",
84
111
  uid: props.data.updatedBy,
85
112
  });
86
113
  }
87
114
 
88
- // events.value=[];
89
- // console.log("Renderer getEvents histories");
90
- const list: (Documentevent & { _user: User })[] = await eventDoc.search({
91
- filter: {
92
- documentName: props.documentName,
93
- documentId: props.data._id,
94
- },
95
- fields: ["created", "createdBy", "eventType"],
96
- sorts: [["created", "asc"]],
97
- lookup: { "user.uid": "createdBy" },
98
- });
99
- if (list.length > 0) {
100
- events.value = list.map((item) => ({
101
- _id: <string>item._id,
102
- status: t(<string>item.eventType),
103
- eventDate: <string>item.created,
104
- uid: <string>item.createdBy,
105
- fullName: <string>item._user.fullName,
106
- email: <string>item._user.email,
107
- }));
108
- } else {
109
- events.value = simplelog;
115
+ events.value = simplelog;
116
+
117
+ if (hasAuditTrail) {
118
+ const tmp = await logDoc.searchDocumentEvent(
119
+ props.documentName,
120
+ props.data._id,
121
+ );
122
+ const list = tmp.data;
123
+
124
+ if (list.length > 0) {
125
+ events.value = list.map((item) => ({
126
+ _id: <string>item._id,
127
+ status: t(<string>item.eventType),
128
+ eventDate: <string>item.created,
129
+ uid: <string>item.createdBy,
130
+ fullName: <string>item.fullName,
131
+ eventData: item?.eventData,
132
+ }));
133
+ }
110
134
  }
111
135
  };
112
136
  const severity = computed(() => {
@@ -114,7 +138,7 @@ const severity = computed(() => {
114
138
  if (props.data.docStatus == "confirm") return "success";
115
139
  else if (props.data.docStatus == "void") return "danger";
116
140
  else if (props.data.docStatus == "draft") return "secondary";
117
- else return "warning";
141
+ else return "warn";
118
142
  });
119
143
 
120
144
  const viewHistories = async () => {
@@ -122,4 +146,20 @@ const viewHistories = async () => {
122
146
  await getEvents();
123
147
  // console.log("histories");
124
148
  };
149
+
150
+ const viewChanges = async (index:number) => {
151
+ auditTrailIndex.value=index
152
+ const lastIndex = events.value.length-1
153
+ if(index == lastIndex){
154
+ eventData.value = events.value[index].eventData
155
+ }else{
156
+
157
+ const lastEvent = events.value[index+1].eventData
158
+ const thisEvent = events.value[index].eventData
159
+ eventData.value= diff(thisEvent, lastEvent)
160
+ }
161
+
162
+ visibleAuditTrailDetail.value = true;
163
+
164
+ };
125
165
  </script>
@@ -13,7 +13,12 @@
13
13
  <NuxtLink :to="`/${item.xOrg}`" external>
14
14
  <div class="flex flex-row gap-2 hover:bg-primary-100">
15
15
  <div class="min-w-14 p=2">
16
- <ImageOrganization :orgRecordId="item.orgRecordId" :size="12" />
16
+ <ImageOrganization
17
+ v-if="tenant?.permissions.length > 0"
18
+ class="w-10 h-10"
19
+ :orgRecordId="tenant?.permissions[0]?.orgRecordId"
20
+ :size="PHOTOSIZE.S40"
21
+ />
17
22
  </div>
18
23
  <div class="flex flex-col w-full justify-end gap-2">
19
24
  <div class="flex flex-row gap-2">
@@ -4,10 +4,10 @@
4
4
  * last change 2023-10-28
5
5
  * Author: Ks Tan
6
6
  */
7
- import {DOCNOApi} from '~/simpleapp/generate/openapi'
7
+ import {DOCUMENTNOFORMATApi} from '~/simpleapp/generate/openapi'
8
8
 
9
9
  export const getDocFormats = async (doctype:string)=>{
10
- const docno = new DOCNOApi(getAxiosConfig())
10
+ const docno = new DOCUMENTNOFORMATApi(getAxiosConfig())
11
11
  const docnoformats = await docno.runListDocFormats(doctype)
12
12
  return docnoformats.data
13
13
  }
@@ -6,10 +6,10 @@
6
6
 
7
7
  import _, { min } from "lodash";
8
8
  import {
9
- Miniapp,
9
+ MiniApp,
10
10
  MiniAppDetail,
11
11
  MiniAppDetailPermission,
12
- MiniappIntegrationCustomPagePages,
12
+ MiniAppIntegrationCustomPagePages,
13
13
  MINIAPPMANAGERApi,
14
14
  } from "~/simpleapp/generate/openapi";
15
15
  import { MiniAppFormWithMiniAppCode } from "~/simpleapp/generate/features/miniApp/app/types/miniApp";