@simitgroup/simpleapp-generator 1.6.3-alpha → 1.6.4-b-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.
- package/dist/buildinschemas/branch.d.ts.map +1 -1
- package/dist/buildinschemas/branch.js +1 -0
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/changehistories.d.ts +3 -0
- package/dist/buildinschemas/changehistories.d.ts.map +1 -0
- package/dist/buildinschemas/changehistories.js +36 -0
- package/dist/buildinschemas/changehistories.js.map +1 -0
- package/dist/buildinschemas/index.d.ts +1 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +3 -1
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/organization.js +2 -2
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +5 -1
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/buildinschemas/webhook.d.ts +3 -0
- package/dist/buildinschemas/webhook.d.ts.map +1 -0
- package/dist/buildinschemas/webhook.js +33 -0
- package/dist/buildinschemas/webhook.js.map +1 -0
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +3 -2
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +30 -11
- package/dist/generate.js.map +1 -1
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
- package/dist/processors/jsonschemabuilder.js +10 -2
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/type.d.ts +2 -0
- package/dist/type.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/branch.ts +1 -0
- package/src/buildinschemas/changehistories.ts +33 -0
- package/src/buildinschemas/index.ts +2 -1
- package/src/buildinschemas/organization.ts +2 -2
- package/src/buildinschemas/user.ts +5 -1
- package/src/buildinschemas/webhook.ts +31 -0
- package/src/framework.ts +3 -2
- package/src/generate.ts +35 -15
- package/src/processors/jsonschemabuilder.ts +10 -2
- package/src/type.ts +2 -0
- package/templates/basic/nest/controller.ts.eta +24 -3
- package/templates/basic/nest/model.ts.eta +9 -1
- package/templates/basic/nest/resolver.ts.eta +2 -2
- package/templates/basic/nuxt/pages.[id].vue.eta +7 -7
- package/templates/basic/nuxt/pages.form.vue.eta +1 -4
- package/templates/basic/nuxt/pages.landing.vue.eta +1 -20
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +8 -1
- package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +2 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +9 -2
- package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +21 -8
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +5 -10
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +1 -0
- package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +50 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +22 -8
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +9 -1
- package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +12 -6
- package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +7 -12
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +133 -28
- package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +3 -1
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +1 -0
- package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +19 -0
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +33 -8
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +15 -9
- package/templates/nuxt/assets/css/calendar.css._eta +3 -0
- package/templates/nuxt/assets/css/style.css._eta +1 -1
- package/templates/nuxt/assets/images/unknown.png.eta +0 -0
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +6 -1
- package/templates/nuxt/components/button/ButtonAction.vue._eta +40 -39
- package/templates/nuxt/components/button/ButtonDanger.vue._eta +11 -3
- package/templates/nuxt/components/button/ButtonDefault.vue._eta +11 -3
- package/templates/nuxt/components/button/ButtonPrimary.vue._eta +9 -3
- package/templates/nuxt/components/button/ButtonSecondary.vue._eta +33 -0
- package/templates/nuxt/components/button/ButtonText.vue._eta +9 -5
- package/templates/nuxt/components/button/ButtonWarning.vue._eta +11 -3
- package/templates/nuxt/components/calendar/CalendarInput.vue.eta +4 -3
- package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +76 -52
- package/templates/nuxt/components/chart/card.vue._eta +1 -1
- package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +36 -26
- package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +35 -13
- package/templates/nuxt/components/form/FormBranch.vue._eta +52 -5
- package/templates/nuxt/components/form/FormDocnoformat.vue.eta +14 -10
- package/templates/nuxt/components/form/FormUser.vue._eta +2 -4
- package/templates/nuxt/components/form/user/FormUserPermission.vue.eta +77 -59
- package/templates/nuxt/components/header/HeaderSelectBranch.vue.eta +42 -35
- package/templates/nuxt/components/image/ImageAvatar.vue.eta._vue +30 -0
- package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +34 -14
- package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +67 -50
- package/templates/nuxt/components/list/ListDocumentTable.vue.eta +20 -12
- package/templates/nuxt/components/list/ListView.vue.eta +64 -35
- package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +5 -4
- package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +8 -8
- package/templates/nuxt/components/page/PageDocList.vue.eta +36 -13
- package/templates/nuxt/components/renderer/RendererDate.vue.eta +8 -2
- package/templates/nuxt/components/renderer/RendererDateTime.vue.eta +7 -1
- package/templates/nuxt/components/renderer/RendererDocHistories.vue.eta +56 -0
- package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +14 -8
- package/templates/nuxt/components/renderer/RendererLink.vue.eta +7 -4
- package/templates/nuxt/components/renderer/RendererMoney.vue.eta +25 -17
- package/templates/nuxt/components/renderer/RendererTime.vue.eta +7 -1
- package/templates/nuxt/components/renderer/RendererViewer.vue.eta +19 -9
- package/templates/nuxt/components/select/SelectTemplate.vue.eta +53 -22
- package/templates/nuxt/components/session/SessionBlock.vue.eta +44 -46
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +25 -16
- package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +60 -0
- package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +16 -8
- package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +8 -8
- package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +1 -1
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +114 -38
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +89 -168
- package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +44 -40
- package/templates/nuxt/components/simpleApp/SimpleAppUserPicker.vue.eta +387 -0
- package/templates/nuxt/components/text/TextDocStatus.vue._eta +22 -0
- package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +13 -15
- package/templates/nuxt/components/user/UserButtonPermissionInfo.vue.eta +138 -95
- package/templates/nuxt/components/user/UserInvitation.vue.eta +53 -45
- package/templates/nuxt/components/user/UserTenantPicker.vue.eta +32 -71
- package/templates/nuxt/composables/date.generate.ts.eta +105 -8
- package/templates/nuxt/composables/getDocument.generate.ts.eta +8 -6
- package/templates/nuxt/composables/getOpenApi.generate.ts.eta +58 -10
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +39 -6
- package/templates/nuxt/composables/goTo.generate.ts.eta +14 -1
- package/templates/nuxt/composables/graphquery.generate.ts.eta +20 -2
- package/templates/nuxt/composables/recently.generate.ts.eta +16 -0
- package/templates/nuxt/composables/roles.generate.ts.eta +9 -13
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +52 -0
- package/templates/nuxt/composables/sysmessage.generate.ts.eta +1 -1
- package/templates/nuxt/error.vue._eta +4 -2
- package/templates/nuxt/pages/[xorg]/{organization.vue.eta → organization.vue._eta} +38 -9
- package/templates/nuxt/pages/[xorg]/user.vue.eta +12 -9
- package/templates/nuxt/pages/login.vue._eta +4 -1
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +54 -26
- package/templates/nuxt/plugins/70.recently.ts.eta +55 -0
- package/templates/nuxt/providers/my-provider.ts.eta +22 -0
- package/templates/nuxt/server/api/[xorg]/{[...].ts.eta → [...].ts._eta} +47 -21
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +44 -3
- package/templates/nuxt/types/events.ts.eta +3 -2
- package/templates/nuxt/types/others.ts.eta +11 -1
- package/templates/nuxt/types/schema.ts.eta +3 -1
- package/templates/nuxt/types/simpleappinput.ts.eta +1 -1
- package/templates/nuxt/types/user.ts.eta +8 -7
- package/templates/project/jsonschemas/branch.json._eta +1 -0
- package/templates/project/jsonschemas/invoice.json._eta +4 -3
- package/templates/project/jsonschemas/organization.json._eta +2 -2
- package/templates/project/lang/default._json +6 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +0 -38
- /package/templates/nuxt/pages/[xorg]/mobile/docnoformat/{index.vue.eta → index.vue.etaxxx} +0 -0
- /package/templates/nuxt/pages/[xorg]/mobile/{index.vue._eta → index.vue._etaxxx} +0 -0
- /package/templates/nuxt/pages/[xorg]/mobile/organization/{[id].vue._eta → [id].vue._etaxxx} +0 -0
- /package/templates/nuxt/pages/[xorg]/mobile/{pickgroup.vue._eta → pickgroup.vue._etaxxx} +0 -0
- /package/templates/nuxt/pages/[xorg]/mobile/user/{index.vue.eta → index.vue.etaxxx} +0 -0
|
@@ -102,28 +102,43 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
102
102
|
getCurrentXorg(){
|
|
103
103
|
return (useRoute().params.xorg) ? <String>useRoute().params.xorg : undefined
|
|
104
104
|
},
|
|
105
|
-
async pingSession(){
|
|
105
|
+
async pingSession():Promise<string>{
|
|
106
106
|
let xorg = this.getCurrentXorg()
|
|
107
107
|
let apiurl=''
|
|
108
|
+
|
|
108
109
|
if(!xorg){
|
|
109
110
|
apiurl = `${useRuntimeConfig().public.APP_URL}/api`
|
|
110
111
|
}else{
|
|
111
|
-
|
|
112
|
+
const xorgdecode = atob(<string>xorg)
|
|
113
|
+
if(xorgdecode.includes('-')){
|
|
114
|
+
apiurl = `${useRuntimeConfig().public.APP_URL}/api/${xorg}`
|
|
115
|
+
}else{
|
|
116
|
+
return Promise.reject('wrongxorg')
|
|
117
|
+
}
|
|
118
|
+
|
|
112
119
|
}
|
|
113
120
|
const {$axios} = useNuxtApp()
|
|
114
|
-
|
|
115
|
-
|
|
121
|
+
try{
|
|
122
|
+
const pingresult = await new PROFILEApi(undefined,apiurl).getSession()
|
|
123
|
+
if(pingresult.status<300)
|
|
124
|
+
return Promise.resolve('ok')
|
|
125
|
+
else
|
|
126
|
+
return Promise.reject('relogin')
|
|
127
|
+
}catch(e){
|
|
128
|
+
return Promise.reject(e)
|
|
129
|
+
}
|
|
130
|
+
|
|
116
131
|
},
|
|
117
132
|
async decideInvitation(id:string,decision:string){
|
|
118
133
|
const apiurl = `${useRuntimeConfig().public.APP_URL}/api`
|
|
119
134
|
const {$axios} = useNuxtApp()
|
|
120
|
-
console.log("decideInvitation",id,decision)
|
|
135
|
+
// console.log("decideInvitation",id,decision)
|
|
121
136
|
const result = await new PROFILEApi(undefined,apiurl,$axios).decideInvitation(id,decision)
|
|
122
137
|
|
|
123
138
|
if(result){
|
|
124
|
-
console.log(result)
|
|
139
|
+
// console.log(result)
|
|
125
140
|
}else{
|
|
126
|
-
console.log(result)
|
|
141
|
+
// console.log(result)
|
|
127
142
|
}
|
|
128
143
|
//().then((res:AxiosResponse)=>{ }
|
|
129
144
|
},
|
|
@@ -206,28 +221,41 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
206
221
|
|
|
207
222
|
|
|
208
223
|
if( useRoute().meta.auth !==false){
|
|
209
|
-
|
|
210
|
-
if(await useUserStore().pingSession()){
|
|
211
|
-
await useUserStore().loadRemoteUserInfo()
|
|
212
|
-
|
|
213
|
-
}else{
|
|
214
|
-
await useUserStore().logout(useRoute().path)
|
|
215
|
-
}
|
|
216
|
-
}else{
|
|
217
|
-
// if(await useUserStore().pingSession()){
|
|
224
|
+
console.log("pingsessionres starat")
|
|
218
225
|
|
|
219
|
-
|
|
226
|
+
try{
|
|
227
|
+
const pingsessionres = await useUserStore().pingSession()
|
|
228
|
+
if(pingsessionres == 'wrongxorg'){
|
|
229
|
+
navigateTo('/')
|
|
230
|
+
}
|
|
231
|
+
else if(pingsessionres){
|
|
232
|
+
await useUserStore().loadRemoteUserInfo()
|
|
233
|
+
}
|
|
234
|
+
return {
|
|
235
|
+
provide: {
|
|
236
|
+
userstore:useUserStore()
|
|
237
|
+
// base64url: Base64URL
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}catch(e){
|
|
241
|
+
console.error("Ping issue cannot proceed:",e)
|
|
220
242
|
|
|
221
|
-
|
|
243
|
+
if(e?.code=='ERR_BAD_RESPONSE'){
|
|
244
|
+
console.log("ping failed failed failed",e.code)
|
|
245
|
+
throw createError({
|
|
246
|
+
statusCode:e.code,
|
|
247
|
+
statusMessage:e.message,
|
|
248
|
+
fatal:true
|
|
249
|
+
})
|
|
250
|
+
}
|
|
251
|
+
else
|
|
252
|
+
await useUserStore().logout(useRoute().path)
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
}else{
|
|
256
|
+
|
|
222
257
|
}
|
|
223
258
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
provide: {
|
|
228
|
-
userstore:useUserStore()
|
|
229
|
-
// base64url: Base64URL
|
|
230
|
-
}
|
|
231
|
-
}
|
|
259
|
+
|
|
232
260
|
|
|
233
261
|
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2024-02-23
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
*/
|
|
7
|
+
import { defineNuxtPlugin } from "#app";
|
|
8
|
+
import { LRUCache } from 'lru-cache'
|
|
9
|
+
import {RecentlyValue} from "~/types"
|
|
10
|
+
export default defineNuxtPlugin( async(nuxtApp) => {
|
|
11
|
+
const options = {
|
|
12
|
+
max: 20,
|
|
13
|
+
|
|
14
|
+
// for use with tracking overall storage size
|
|
15
|
+
maxSize: 5000,
|
|
16
|
+
sizeCalculation: (value, key) => {
|
|
17
|
+
return 1
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
dispose: (value, key) => {
|
|
21
|
+
//freeFromMemoryOrWhatever(value)
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
// how long to live in ms
|
|
25
|
+
ttl: 1000 * 60 * 5,
|
|
26
|
+
|
|
27
|
+
// return stale items before removing from cache?
|
|
28
|
+
allowStale: false,
|
|
29
|
+
|
|
30
|
+
updateAgeOnGet: false,
|
|
31
|
+
updateAgeOnHas: false,
|
|
32
|
+
|
|
33
|
+
fetchMethod: async (
|
|
34
|
+
key,
|
|
35
|
+
staleValue,
|
|
36
|
+
{ options, signal, context }
|
|
37
|
+
) => {},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const recently = new LRUCache<string,RecentlyValue>(options)
|
|
41
|
+
const tmp = localStorage.getItem('recently' ); // Store keys as an array
|
|
42
|
+
if(tmp){
|
|
43
|
+
const histories = JSON.parse(tmp)
|
|
44
|
+
const keys=Object.keys(histories)
|
|
45
|
+
keys.forEach(key=>{
|
|
46
|
+
recently.set(key,histories[key])
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
provide: {
|
|
52
|
+
recently:recently
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { joinURL } from 'ufo'
|
|
2
|
+
import type { ProviderGetImage } from '@nuxt/image'
|
|
3
|
+
import { createOperationsGenerator } from '#image'
|
|
4
|
+
|
|
5
|
+
const operationsGenerator = createOperationsGenerator()
|
|
6
|
+
|
|
7
|
+
export const getImage: ProviderGetImage = (
|
|
8
|
+
src,
|
|
9
|
+
{ modifiers = {}, baseURL } = {}
|
|
10
|
+
) => {
|
|
11
|
+
|
|
12
|
+
if (!baseURL) {
|
|
13
|
+
// also support runtime config
|
|
14
|
+
baseURL = useRuntimeConfig().public.API_URL
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const operations = operationsGenerator(modifiers)
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
url: joinURL(baseURL, src + (operations ? '?' + operations : '')),
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
*
|
|
3
|
+
* --remove-this-line-to-prevent-override--
|
|
4
4
|
* last change 2024-02-23
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import axios, { AxiosRequestConfig } from 'axios';
|
|
10
10
|
import { getServerSession } from '#auth'
|
|
11
11
|
import type { Session } from 'next-auth';
|
|
12
|
-
|
|
12
|
+
import * as fs from 'fs'
|
|
13
13
|
export default defineEventHandler(async (event:any) => {
|
|
14
14
|
type additionalprops = {accessToken?:string}
|
|
15
15
|
let session:any=null
|
|
@@ -53,27 +53,44 @@ export default defineEventHandler(async (event:any) => {
|
|
|
53
53
|
data: bodydata,
|
|
54
54
|
params: querydata,
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
|
|
57
|
+
try{
|
|
58
|
+
const res = await axios(axiosConfig)
|
|
57
59
|
if (res.headers['content-type'] === 'image/png') {
|
|
58
|
-
// Set the response headers for the image
|
|
59
60
|
frontEndRes.setHeader('Content-Type', 'image/png');
|
|
60
61
|
frontEndRes.setHeader('Content-Disposition', 'inline');
|
|
61
|
-
|
|
62
|
-
// Send the image data as the response body
|
|
63
62
|
frontEndRes.end(Buffer.from(res.data, 'binary'));
|
|
64
|
-
}
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
}else if(documentLink.includes('images/')){
|
|
64
|
+
// console.log(documentLink," Resdata of base64 photo",res.data.length)
|
|
65
|
+
let imageData
|
|
66
|
+
frontEndRes.setHeader('Content-Type', 'image/png');
|
|
67
|
+
|
|
68
|
+
// console.log("load image for",documentLink)
|
|
69
|
+
if( res.data.length){
|
|
70
|
+
console.log("obtain base64 from server length:",res.data.length)
|
|
71
|
+
imageData = base64ToBuffer(res.data);
|
|
72
|
+
|
|
73
|
+
}else{
|
|
74
|
+
// console.log("server no image, use default image")
|
|
75
|
+
const folder = 'assets/images/'
|
|
76
|
+
let filename = filename='unknown.png';
|
|
77
|
+
const fullpath = folder+filename;
|
|
78
|
+
if(fs.existsSync(fullpath)){
|
|
79
|
+
imageData = fs.readFileSync(fullpath)
|
|
80
|
+
}else{
|
|
81
|
+
console.log(fullpath,'does not exists')
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
frontEndRes.end(Buffer.from(imageData, 'binary'));
|
|
85
|
+
|
|
86
|
+
}else{
|
|
68
87
|
frontEndRes.statusCode = res.status;
|
|
69
88
|
if(res.statusText) {
|
|
70
89
|
frontEndRes.statusMessage = res.statusText;
|
|
71
90
|
}
|
|
72
|
-
|
|
73
91
|
resolve(res.data);
|
|
74
92
|
}
|
|
75
|
-
|
|
76
|
-
}).catch((error) => {
|
|
93
|
+
}catch(error){
|
|
77
94
|
if(!error?.response){
|
|
78
95
|
console.log("backend server no response ",error.code)
|
|
79
96
|
reject({
|
|
@@ -94,13 +111,22 @@ export default defineEventHandler(async (event:any) => {
|
|
|
94
111
|
});
|
|
95
112
|
|
|
96
113
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
// resolve({
|
|
102
|
-
// status: 'ok'
|
|
103
|
-
// })
|
|
114
|
+
}
|
|
104
115
|
})
|
|
105
116
|
|
|
106
|
-
})
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
function base64ToBuffer(base64String:string) {
|
|
122
|
+
// Split the base64 string into parts
|
|
123
|
+
const parts = base64String.split(',');
|
|
124
|
+
const contentType = parts[0].split(':')[1];
|
|
125
|
+
const base64Data = parts[1];
|
|
126
|
+
|
|
127
|
+
// Decode the base64 data
|
|
128
|
+
const binaryString = atob(base64Data);
|
|
129
|
+
const buffer = new Buffer.from(binaryString, 'binary');
|
|
130
|
+
|
|
131
|
+
return buffer
|
|
132
|
+
}
|
|
@@ -30,7 +30,9 @@ export class SimpleAppClient<
|
|
|
30
30
|
TApi extends crudType,
|
|
31
31
|
> {
|
|
32
32
|
// protected defaultTimeOut=5000
|
|
33
|
-
protected
|
|
33
|
+
protected ready = true;
|
|
34
|
+
protected delayAfterGetId = 0.5*1000;
|
|
35
|
+
protected unwantchobj:any;
|
|
34
36
|
protected docapi;
|
|
35
37
|
public event:Function|null=null;
|
|
36
38
|
public listen:Function|null=null;
|
|
@@ -48,7 +50,7 @@ export class SimpleAppClient<
|
|
|
48
50
|
this.docname = docname
|
|
49
51
|
this.axios = useNuxtApp().$axios
|
|
50
52
|
}
|
|
51
|
-
|
|
53
|
+
isReady = ()=>this.ready
|
|
52
54
|
getDocType = () => this.doctype;
|
|
53
55
|
getDocName = (capFirst:boolean=false) => capFirst ? upperFirst(this.docname) :this.docname;
|
|
54
56
|
setNew = ()=>{}
|
|
@@ -67,6 +69,7 @@ export class SimpleAppClient<
|
|
|
67
69
|
};
|
|
68
70
|
|
|
69
71
|
async getById(id?: string) {
|
|
72
|
+
this.ready=false
|
|
70
73
|
if(this.unwantchobj)this.unwantchobj()
|
|
71
74
|
return await this.docapi.runFindOne(id,this.axios)
|
|
72
75
|
.then((res: AxiosResponse) => {
|
|
@@ -74,9 +77,16 @@ export class SimpleAppClient<
|
|
|
74
77
|
this.data.value={} as TData
|
|
75
78
|
Object.assign(this.data.value, res.data);
|
|
76
79
|
this.setWatchChange()
|
|
80
|
+
setTimeout(()=>{
|
|
81
|
+
this.ready=true
|
|
82
|
+
},this.delayAfterGetId)
|
|
83
|
+
|
|
77
84
|
return res;
|
|
78
85
|
}).catch((res:any)=>{
|
|
79
86
|
// if(this.event){this.event('error:getById',res)}
|
|
87
|
+
setTimeout(()=>{
|
|
88
|
+
this.ready=true
|
|
89
|
+
},this.delayAfterGetId)
|
|
80
90
|
return Promise.reject(res)
|
|
81
91
|
});
|
|
82
92
|
}
|
|
@@ -89,6 +99,7 @@ export class SimpleAppClient<
|
|
|
89
99
|
async create() {
|
|
90
100
|
const errors = this.validateFailed();
|
|
91
101
|
const {$event} =useNuxtApp()
|
|
102
|
+
|
|
92
103
|
if (errors) {
|
|
93
104
|
$event('Notification',{
|
|
94
105
|
documentName:this.getDocName(),
|
|
@@ -100,6 +111,7 @@ export class SimpleAppClient<
|
|
|
100
111
|
return await Promise.reject(errors);
|
|
101
112
|
} else {
|
|
102
113
|
holdScreenStart()
|
|
114
|
+
this.ready=false
|
|
103
115
|
return await this.docapi
|
|
104
116
|
.runCreate(this.data.value,this.axios)
|
|
105
117
|
.then((res: AxiosResponse) => {
|
|
@@ -112,6 +124,9 @@ export class SimpleAppClient<
|
|
|
112
124
|
// })
|
|
113
125
|
this.data.value = {} as TData
|
|
114
126
|
this.data.value = { ...res.data };
|
|
127
|
+
setTimeout(()=>{
|
|
128
|
+
this.ready=true
|
|
129
|
+
},this.delayAfterGetId)
|
|
115
130
|
holdScreenEnd()
|
|
116
131
|
return res.data;
|
|
117
132
|
}).catch((errors:any)=>{
|
|
@@ -122,6 +137,9 @@ export class SimpleAppClient<
|
|
|
122
137
|
data:errors.response.data
|
|
123
138
|
})
|
|
124
139
|
console.error('error:create',errors.response.data)
|
|
140
|
+
setTimeout(()=>{
|
|
141
|
+
this.ready=true
|
|
142
|
+
},this.delayAfterGetId)
|
|
125
143
|
holdScreenEnd()
|
|
126
144
|
return Promise.reject(errors)
|
|
127
145
|
});
|
|
@@ -144,6 +162,7 @@ export class SimpleAppClient<
|
|
|
144
162
|
return await Promise.reject(errors);
|
|
145
163
|
} else {
|
|
146
164
|
holdScreenStart()
|
|
165
|
+
this.ready=false
|
|
147
166
|
return await this.docapi
|
|
148
167
|
.runUpdate(recordid, this.data.value,this.axios)
|
|
149
168
|
.then((res: AxiosResponse) => {
|
|
@@ -155,6 +174,9 @@ export class SimpleAppClient<
|
|
|
155
174
|
// data:errors
|
|
156
175
|
// })
|
|
157
176
|
this.data.value = res.data
|
|
177
|
+
setTimeout(()=>{
|
|
178
|
+
this.ready=true
|
|
179
|
+
},this.delayAfterGetId)
|
|
158
180
|
holdScreenEnd()
|
|
159
181
|
return res.data;
|
|
160
182
|
}).catch((errors:any)=>{
|
|
@@ -168,6 +190,9 @@ export class SimpleAppClient<
|
|
|
168
190
|
// if(this.event){
|
|
169
191
|
// this.event('error:update',errors.response.data.data)}
|
|
170
192
|
console.error('error:update',errors.response.data)
|
|
193
|
+
setTimeout(()=>{
|
|
194
|
+
this.ready=true
|
|
195
|
+
},this.delayAfterGetId)
|
|
171
196
|
holdScreenEnd()
|
|
172
197
|
return Promise.reject(errors)
|
|
173
198
|
});
|
|
@@ -178,6 +203,7 @@ export class SimpleAppClient<
|
|
|
178
203
|
const {$event} =useNuxtApp()
|
|
179
204
|
const recordid: string = this.data.value._id ?? '';
|
|
180
205
|
holdScreenStart()
|
|
206
|
+
this.ready=false
|
|
181
207
|
return await this.docapi
|
|
182
208
|
.runPatch(recordid, this.data.value,this.axios)
|
|
183
209
|
.then((res: AxiosResponse) => {
|
|
@@ -188,7 +214,10 @@ export class SimpleAppClient<
|
|
|
188
214
|
// status:NotificationStatus.success,
|
|
189
215
|
// data:errors
|
|
190
216
|
// })
|
|
191
|
-
this.data.value = res.data
|
|
217
|
+
this.data.value = res.data
|
|
218
|
+
setTimeout(()=>{
|
|
219
|
+
this.ready=true
|
|
220
|
+
},this.delayAfterGetId)
|
|
192
221
|
holdScreenEnd()
|
|
193
222
|
return res.data;
|
|
194
223
|
}).catch((errors:any)=>{
|
|
@@ -202,6 +231,9 @@ export class SimpleAppClient<
|
|
|
202
231
|
// if(this.event){
|
|
203
232
|
// this.event('error:update',errors.response.data.data)}
|
|
204
233
|
console.error('error:patch',errors.response.data)
|
|
234
|
+
setTimeout(()=>{
|
|
235
|
+
this.ready=true
|
|
236
|
+
},this.delayAfterGetId)
|
|
205
237
|
holdScreenEnd()
|
|
206
238
|
return Promise.reject(errors)
|
|
207
239
|
|
|
@@ -213,6 +245,7 @@ export class SimpleAppClient<
|
|
|
213
245
|
}
|
|
214
246
|
const {$event} =useNuxtApp()
|
|
215
247
|
holdScreenStart()
|
|
248
|
+
this.ready=false
|
|
216
249
|
return await this.docapi.runDelete(id,this.axios)
|
|
217
250
|
.then((res:AxiosResponse)=>{
|
|
218
251
|
// if(this.event){this.event('success:delete',res.data)}
|
|
@@ -222,7 +255,11 @@ export class SimpleAppClient<
|
|
|
222
255
|
// status:NotificationStatus.success,
|
|
223
256
|
// data:res.data
|
|
224
257
|
// })
|
|
258
|
+
setTimeout(()=>{
|
|
259
|
+
this.ready=true
|
|
260
|
+
},this.delayAfterGetId)
|
|
225
261
|
holdScreenEnd()
|
|
262
|
+
|
|
226
263
|
return Promise.resolve(res.data)
|
|
227
264
|
}).catch((errors:any)=>{
|
|
228
265
|
// if(this.event){this.event('error:delete',errors.response.data.data)}
|
|
@@ -233,6 +270,9 @@ export class SimpleAppClient<
|
|
|
233
270
|
data:errors.response.data
|
|
234
271
|
})
|
|
235
272
|
console.error(errors.response.data)
|
|
273
|
+
setTimeout(()=>{
|
|
274
|
+
this.ready=true
|
|
275
|
+
},this.delayAfterGetId)
|
|
236
276
|
holdScreenEnd()
|
|
237
277
|
return Promise.reject(errors)
|
|
238
278
|
});
|
|
@@ -261,6 +301,7 @@ export class SimpleAppClient<
|
|
|
261
301
|
ajv.addFormat('text',/.*$/)
|
|
262
302
|
ajv.addFormat('html',/.*$/)
|
|
263
303
|
ajv.addFormat('documentno',/.*$/)
|
|
304
|
+
ajv.addFormat('money',/.*$/)
|
|
264
305
|
|
|
265
306
|
ajv.addKeyword({ keyword: 'x-foreignkey', schemaType: 'string' });
|
|
266
307
|
ajv.addKeyword({ keyword: 'x-simpleapp-config', schemaType: 'object' });
|
|
@@ -16,8 +16,9 @@ export type ViewRecord = {
|
|
|
16
16
|
documentName: SimpleAppDocumentType
|
|
17
17
|
viewer?: any
|
|
18
18
|
readonly?:boolean
|
|
19
|
+
autoclose?:number
|
|
19
20
|
paras?:any
|
|
20
|
-
after?: (eventType:FormCrudEvent,data:any )=>void
|
|
21
|
+
after?: (eventType:FormCrudEvent,data:any,dialogVisible:Ref<boolean> )=>void
|
|
21
22
|
document?:SimpleAppClient<any,any>
|
|
22
23
|
}
|
|
23
24
|
export type RefreshDocumentList ={
|
|
@@ -37,5 +38,5 @@ export type EventType ={
|
|
|
37
38
|
'SessionExpire': string
|
|
38
39
|
'CloseDialog': string
|
|
39
40
|
'pickGroup':string
|
|
40
|
-
'HoldScreen':boolean
|
|
41
|
+
'HoldScreen':boolean
|
|
41
42
|
}
|
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import {SimpleAppClient} from '~/simpleapp/generate/clients/SimpleAppClient'
|
|
8
8
|
import { SimpleAppDocumentType } from './documentlist';
|
|
9
|
+
export type NameValue={
|
|
10
|
+
name:string;
|
|
11
|
+
value:number
|
|
12
|
+
}
|
|
9
13
|
export type ForeignKey = {
|
|
10
14
|
_id: string;
|
|
11
15
|
label: string;
|
|
@@ -31,7 +35,12 @@ import { SimpleAppDocumentType } from './documentlist';
|
|
|
31
35
|
isolationType?:string
|
|
32
36
|
url?:string
|
|
33
37
|
}
|
|
34
|
-
|
|
38
|
+
export type RecentlyValue = {
|
|
39
|
+
docName:string
|
|
40
|
+
label:string
|
|
41
|
+
branchId:number
|
|
42
|
+
time:string
|
|
43
|
+
}
|
|
35
44
|
export type DocNoFormat ={
|
|
36
45
|
docNoFormatName: string
|
|
37
46
|
docNoFormatNo:string
|
|
@@ -52,4 +61,5 @@ import { SimpleAppDocumentType } from './documentlist';
|
|
|
52
61
|
fields?: any[];
|
|
53
62
|
|
|
54
63
|
sorts?: any[];
|
|
64
|
+
lookup?: {[key:string]:string};
|
|
55
65
|
}
|
|
@@ -30,16 +30,18 @@ export type DocumentStatus = {
|
|
|
30
30
|
formula:string //example "jslib.getDocumentSubTotal(@F{$.details})"
|
|
31
31
|
}
|
|
32
32
|
export type SchemaConfig = {
|
|
33
|
-
isolationType:
|
|
33
|
+
isolationType: string
|
|
34
34
|
requiredRoles?:string[]
|
|
35
35
|
pageType?: string
|
|
36
36
|
uniqueKey?:string
|
|
37
37
|
uniqueKeys?:string[][]
|
|
38
38
|
documentTitle?:string
|
|
39
39
|
generateDocumentNumber?:boolean
|
|
40
|
+
docNoPattern?:string
|
|
40
41
|
documentDate?:string
|
|
41
42
|
allStatus?:DocumentStatus[]
|
|
42
43
|
additionalApis?:DocumentApi[]
|
|
44
|
+
search?:string[]
|
|
43
45
|
additionalAutoCompleteFields ?: string[]
|
|
44
46
|
// libs?:ImportLibs[] // both process class and frontend client class will import same lib
|
|
45
47
|
formulas?: Formula[]
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* last change 2024-02-23
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
|
+
import {Branch} from "~/simpleapp/generate/openapi"
|
|
7
8
|
export type UserListItem = {
|
|
8
9
|
_id: string
|
|
9
10
|
uid?:string
|
|
@@ -31,7 +32,12 @@ export type UserListItem = {
|
|
|
31
32
|
group:string
|
|
32
33
|
active:boolean
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
export type UserStoreBranch ={
|
|
36
|
+
branch:Branch
|
|
37
|
+
group:string[]
|
|
38
|
+
xOrg:string
|
|
39
|
+
_id:string
|
|
40
|
+
}
|
|
35
41
|
|
|
36
42
|
export type PermissionListItem = {
|
|
37
43
|
branchId: number
|
|
@@ -66,12 +72,7 @@ export type UserProfile = {
|
|
|
66
72
|
offsetMinute:number
|
|
67
73
|
timeZone:string
|
|
68
74
|
fullName : string
|
|
69
|
-
branches:
|
|
70
|
-
_id: string
|
|
71
|
-
branch: any
|
|
72
|
-
group: string
|
|
73
|
-
xOrg: string
|
|
74
|
-
}[]
|
|
75
|
+
branches: UserStoreBranch[]
|
|
75
76
|
invites: {
|
|
76
77
|
_id: string;
|
|
77
78
|
email: string;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"documentTitle": "invoiceTitle",
|
|
9
9
|
"documentDate": "invoiceDate",
|
|
10
10
|
"generateDocumentNumber": true,
|
|
11
|
+
"docNoPattern":"INV/@BranchCode/[00000]",
|
|
11
12
|
"pageType": "crud",
|
|
12
13
|
"formulas": [
|
|
13
14
|
{ "jsonPath": "$.details[*]", "formula": "sharelibs.getSubtotal($item)" },
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
"examples": ["Sales to XYZ"],
|
|
58
59
|
"minLength": 3
|
|
59
60
|
},
|
|
60
|
-
"invoiceTotal": { "type": "number", "default": 0
|
|
61
|
+
"invoiceTotal": { "type": "number", "default": 0.00,"format":"money" },
|
|
61
62
|
"details": {
|
|
62
63
|
"type": "array",
|
|
63
64
|
"items": {
|
|
@@ -73,8 +74,8 @@
|
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
76
|
"quantity": { "type": "integer", "default": 1 },
|
|
76
|
-
"unitPrice": { "type": "number", "default": 0
|
|
77
|
-
"subTotal": { "type": "number", "default": 0
|
|
77
|
+
"unitPrice": { "type": "number", "default": 0.00,"format":"money" },
|
|
78
|
+
"subTotal": { "type": "number", "default": 0.00,"format":"money" }
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
},
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"additionalApis":[{
|
|
19
19
|
"action":"getlogo",
|
|
20
20
|
"entryPoint":"logo",
|
|
21
|
-
"requiredRole":[],
|
|
21
|
+
"requiredRole":["User"],
|
|
22
22
|
"method":"get",
|
|
23
23
|
"schema":"string",
|
|
24
24
|
"responseType":"String",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},{
|
|
27
27
|
"action":"uploadlogo",
|
|
28
28
|
"entryPoint":"logo",
|
|
29
|
-
"requiredRole":[],
|
|
29
|
+
"requiredRole":["Admin"],
|
|
30
30
|
"method":"post",
|
|
31
31
|
"schema":"KeyValue",
|
|
32
32
|
"responseType":"String",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"suspendcustomer": "Suspend Customer",
|
|
37
37
|
"formKeyNotFound": "Formkey not found \"{formKey}\"",
|
|
38
38
|
"selectAll": "Select All",
|
|
39
|
+
"clear": "Clear",
|
|
39
40
|
"branches":"Branches",
|
|
40
41
|
"accessRights": "Access Rights",
|
|
41
42
|
"fullName":"Full Name",
|
|
@@ -69,6 +70,9 @@
|
|
|
69
70
|
"printPreview": "Print Preview",
|
|
70
71
|
"messages":"Messages",
|
|
71
72
|
"systemconfig": "System Config",
|
|
72
|
-
"preview": "Preview"
|
|
73
|
-
|
|
73
|
+
"preview": "Preview",
|
|
74
|
+
"docnoformat":"Document Numbering Formats",
|
|
75
|
+
"add":"Add",
|
|
76
|
+
"approve" : "Approve",
|
|
77
|
+
"decline":"Decline"
|
|
74
78
|
}
|