@simitgroup/simpleapp-generator 1.6.3-alpha → 1.6.4-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 +23 -2
- 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/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 +13 -3
- 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/simpleapp.processor.ts.eta +120 -19
- 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 +30 -8
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +2 -1
- 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 +33 -16
- 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 +36 -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 +1 -1
- 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 +7 -5
- 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 +9 -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 +47 -21
- package/templates/nuxt/components/session/SessionBlock.vue.eta +44 -46
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +24 -15
- package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +64 -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 +66 -22
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +89 -168
- package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +43 -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 +127 -93
- package/templates/nuxt/components/user/UserTenantPicker.vue.eta +1 -1
- 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 +37 -5
- 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 +8 -13
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +52 -0
- package/templates/nuxt/composables/sysmessage.generate.ts.eta +1 -1
- 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 +45 -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 +3 -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
|
@@ -1,56 +1,91 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
2
|
+
<div>
|
|
3
|
+
<button class="" @click="previewPermission">
|
|
4
|
+
<i class="pi pi-question-circle"></i>
|
|
5
|
+
</button>
|
|
6
|
+
<Sidebar
|
|
7
|
+
v-model:visible="showpermissioninfo"
|
|
8
|
+
modal
|
|
9
|
+
:header="permissiontitle"
|
|
10
|
+
position="right"
|
|
11
|
+
>
|
|
12
|
+
<SelectButton
|
|
13
|
+
v-model="selectedgroup"
|
|
14
|
+
@change="selectGroup"
|
|
15
|
+
:options="grouplist"
|
|
16
|
+
option-label="label"
|
|
17
|
+
option-value="value"
|
|
18
|
+
></SelectButton>
|
|
19
|
+
<div v-if="selectedgroup">
|
|
20
|
+
<div
|
|
21
|
+
v-if="useRuntimeConfig().public.DEBUGDATA"
|
|
22
|
+
class="flex flex-row gap-2 p-2"
|
|
23
|
+
>
|
|
24
|
+
<div class="flex align-items-center">
|
|
25
|
+
<RadioButton
|
|
26
|
+
v-model="mode"
|
|
27
|
+
inputId="modepreview"
|
|
28
|
+
name="pizza"
|
|
29
|
+
value="preview"
|
|
30
|
+
/>
|
|
31
|
+
<label for="modepreview" class="ml-2">Preview</label>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="flex align-items-center">
|
|
34
|
+
<RadioButton
|
|
35
|
+
v-model="mode"
|
|
36
|
+
inputId="modeedit"
|
|
37
|
+
name="edit"
|
|
38
|
+
value="edit"
|
|
39
|
+
/>
|
|
40
|
+
<label for="modeedit" class="ml-2">Edit</label>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="flex align-items-center">
|
|
43
|
+
<RadioButton
|
|
44
|
+
v-model="mode"
|
|
45
|
+
inputId="modejson"
|
|
46
|
+
name="json"
|
|
47
|
+
value="json"
|
|
48
|
+
/>
|
|
49
|
+
<label for="modejson" class="ml-2">JSON</label>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<div v-if="mode == 'json'">
|
|
53
|
+
<div class="flex-row">
|
|
54
|
+
<div><Button @click="copyText">copy</Button></div>
|
|
55
|
+
<div class="text text-gray-400">{{ copied }}</div>
|
|
56
|
+
</div>
|
|
57
|
+
<pre id="permissionstr">
|
|
36
58
|
{{ permissions }}
|
|
37
|
-
</pre
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
</pre
|
|
60
|
+
>
|
|
61
|
+
</div>
|
|
62
|
+
<div
|
|
63
|
+
class="permission-block flex flex-col m mt-4"
|
|
64
|
+
v-for="res in allresources"
|
|
65
|
+
v-else="showjson"
|
|
66
|
+
>
|
|
67
|
+
<div class="m mr-3">{{ res }}</div>
|
|
68
|
+
<div class="gap-4" v-if="allactions">
|
|
69
|
+
<SelectButton
|
|
70
|
+
v-if="mode == 'edit'"
|
|
71
|
+
multiple
|
|
72
|
+
:options="allactions[res]"
|
|
73
|
+
v-model="permissions[res]"
|
|
74
|
+
></SelectButton>
|
|
75
|
+
|
|
76
|
+
<span v-else v-for="actionname in allactions[res]" class="m m-1">
|
|
77
|
+
<Chip
|
|
78
|
+
class="bg-primary"
|
|
79
|
+
v-if="canPerformAction(selectedgroup, res, actionname)"
|
|
80
|
+
severity="success"
|
|
81
|
+
:label="actionname"
|
|
82
|
+
></Chip>
|
|
83
|
+
<Chip v-else :label="actionname"></Chip>
|
|
84
|
+
</span>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</Sidebar>
|
|
54
89
|
</div>
|
|
55
90
|
</template>
|
|
56
91
|
<script setup lang="ts">
|
|
@@ -61,54 +96,53 @@
|
|
|
61
96
|
* Author: Ks Tan
|
|
62
97
|
*/
|
|
63
98
|
import _ from "lodash";
|
|
64
|
-
import Chip from
|
|
65
|
-
import RadioButton from
|
|
66
|
-
import {ref} from
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const showpermissioninfo = ref(false)
|
|
99
|
+
import Chip from "primevue/chip";
|
|
100
|
+
import RadioButton from "primevue/radiobutton";
|
|
101
|
+
import { ref } from "vue";
|
|
102
|
+
const isdebug = ref(useRuntimeConfig().public.DEBUGDATA);
|
|
103
|
+
const showpermissioninfo = ref(false);
|
|
70
104
|
const permissiontitle = "Permission Information";
|
|
71
|
-
const selectedgroup = ref(
|
|
72
|
-
const grouplist = getAllGroups().map((item)=>
|
|
73
|
-
|
|
105
|
+
const selectedgroup = ref("");
|
|
106
|
+
const grouplist = getAllGroups().map((item) => {
|
|
107
|
+
return { value: item, label: _.capitalize(item) };
|
|
108
|
+
});
|
|
109
|
+
const mode = ref("preview");
|
|
74
110
|
|
|
75
|
-
const allresources = getUniqueResource()
|
|
76
|
-
const allactions = ref()
|
|
77
|
-
const permissions=ref()
|
|
111
|
+
const allresources = getUniqueResource();
|
|
112
|
+
const allactions = ref();
|
|
113
|
+
const permissions = ref();
|
|
78
114
|
|
|
79
|
-
const activeroles = ref()
|
|
80
|
-
const copied = ref(
|
|
115
|
+
const activeroles = ref();
|
|
116
|
+
const copied = ref("");
|
|
81
117
|
|
|
82
118
|
const previewPermission = () => {
|
|
83
119
|
showpermissioninfo.value = true;
|
|
84
120
|
};
|
|
85
121
|
|
|
86
|
-
|
|
87
122
|
const copyText = () => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
</script>
|
|
123
|
+
copied.value = "copied!";
|
|
124
|
+
const storage = document.createElement("textarea");
|
|
125
|
+
storage.value = String(document.getElementById("permissionstr")?.innerHTML);
|
|
126
|
+
document.body.appendChild(storage);
|
|
127
|
+
storage.select();
|
|
128
|
+
storage.setSelectionRange(0, 99999);
|
|
129
|
+
document.execCommand("copy");
|
|
130
|
+
document.body.removeChild(storage);
|
|
131
|
+
};
|
|
132
|
+
const selectGroup = (selectedgroup: any) => {
|
|
133
|
+
const groupname = selectedgroup.value;
|
|
134
|
+
activeroles.value = getGroupRoles(groupname);
|
|
135
|
+
allactions.value = {};
|
|
136
|
+
permissions.value = {};
|
|
137
|
+
for (let i = 0; i < allresources.length; i++) {
|
|
138
|
+
const r = allresources[i];
|
|
139
|
+
console.log(r);
|
|
140
|
+
const actions = getActionFromResource(r);
|
|
141
|
+
allactions.value[r] = actions;
|
|
142
|
+
permissions.value[r] = getGroupResourcePermission(groupname, r).map(
|
|
143
|
+
(item) => item.action,
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
console.log(allactions.value, permissions.value);
|
|
147
|
+
};
|
|
148
|
+
</script>
|
|
@@ -82,7 +82,7 @@ const alltenants = ref();
|
|
|
82
82
|
|
|
83
83
|
const loadAllTenants = async () => {
|
|
84
84
|
waiting.value=false
|
|
85
|
-
alltenants.value = (await
|
|
85
|
+
alltenants.value = (await getProfileApi().getAllTenants()).data;
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
// const props = defineProps<{
|
|
@@ -6,6 +6,92 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { DurationType } from "~/types"
|
|
8
8
|
|
|
9
|
+
const convertToDate= (date:Date|string)=>{
|
|
10
|
+
return date instanceof Date ? date : new Date(date)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//after review
|
|
14
|
+
export const today = () => useDayjs()().format('YYYY-MM-DD')
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* convert date object or ISO8601 date become local datetime string
|
|
18
|
+
* @param date date|string
|
|
19
|
+
* @returns local shortform date-time
|
|
20
|
+
*/
|
|
21
|
+
export const dateRenderToDateTimeStr = (date:Date|string) =>
|
|
22
|
+
convertToDate(date).toLocaleString().replace(',', ' ').slice(0,-3)
|
|
23
|
+
/**
|
|
24
|
+
* convert date object or ISO datestring become local date string
|
|
25
|
+
* @param date date|string
|
|
26
|
+
* @returns local short form date
|
|
27
|
+
*/
|
|
28
|
+
export const dateRenderToDateStr = (date:Date|string) =>
|
|
29
|
+
convertToDate(date).toLocaleDateString().replace(',', ' ')
|
|
30
|
+
/**
|
|
31
|
+
* convert date object or ISO datestring become time string (without seconds)
|
|
32
|
+
* @param date date|string
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
export const dateRenderToTimeStr = (date:Date|string) =>
|
|
36
|
+
convertToDate(date).toLocaleTimeString().slice(0,-3)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* convert date object or ISO datestring become DD/MM format
|
|
41
|
+
* @param date date|string
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
export const dateRenderToDDMM = (date:Date|string) =>
|
|
45
|
+
getDayJs()(date).format('DD/MM')
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* convert iso8601 date string to date object
|
|
51
|
+
* @param datestr :string
|
|
52
|
+
* @returns date object
|
|
53
|
+
*/
|
|
54
|
+
export const stringToDate = (datestr:string) => new Date(datestr)
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* convert date object to ISO string YYYY-MM-DDTHH:mm:ssZ
|
|
58
|
+
* @param date :Date
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
export const dateToISOString = (date:Date|string) => convertToDate(date).toISOString().split('.')[0]+"Z"
|
|
62
|
+
//useDayjs()(date).toISOString().split('.')[0]+"Z"
|
|
63
|
+
/**
|
|
64
|
+
* convert date object to date string (YYYY-MM-DD)
|
|
65
|
+
* @param date :Date
|
|
66
|
+
* @returns date return string in YYYY-MM-DD
|
|
67
|
+
*/
|
|
68
|
+
export const dateToString = (date:Date|string) => useDayjs()(date).format('YYYY-MM-DD')
|
|
69
|
+
/**
|
|
70
|
+
* convert date object to time string (HH:mm:ss)
|
|
71
|
+
* @param date
|
|
72
|
+
* @returns timestring
|
|
73
|
+
*/
|
|
74
|
+
export const dateToTimeString = (date:Date) => useDayjs()(date).format('HH:mm:ss')
|
|
75
|
+
/**
|
|
76
|
+
* get 3 char day name sun/mon/tue in lower case
|
|
77
|
+
* @param date : Date|string date obj or iso8601 date
|
|
78
|
+
* @returns string
|
|
79
|
+
*/
|
|
80
|
+
export const getDayNameInWeek = (date:Date|string) => useDayjs()(date).format('ddd').toLowerCase();
|
|
81
|
+
/**
|
|
82
|
+
* get last date of the specific date
|
|
83
|
+
* @param dates: Date|string
|
|
84
|
+
* @returns string
|
|
85
|
+
*/
|
|
86
|
+
export const lastDateOfMonth = (date:Date|string) => useDayjs()(date).endOf('month').format('YYYY-MM-DD');
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
//before reevaluate
|
|
94
|
+
|
|
9
95
|
export const setDateLocale = (localename:string) => useDayjs().locale(localename)
|
|
10
96
|
export const dateExists = (date:Date,listDate:Date[]) => {
|
|
11
97
|
const existsrecord = listDate.find(item=>{
|
|
@@ -14,15 +100,26 @@ export const dateExists = (date:Date,listDate:Date[]) => {
|
|
|
14
100
|
return existsrecord===undefined ? false :true
|
|
15
101
|
}
|
|
16
102
|
export const getDayJs = ()=>useDayjs()
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export const
|
|
22
|
-
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
export const dateToISOWithoutConvert=(date:Date)=>{
|
|
108
|
+
const timestamp = date.getTime() - date.getTimezoneOffset() * 60000;
|
|
109
|
+
return new Date(timestamp).toISOString().split('.')[0]+"Z"
|
|
110
|
+
}
|
|
111
|
+
export const convertIsoToDateToWithoutConvert=(datestr:string)=>{
|
|
112
|
+
// const timestamp = date.getTime() - date.getTimezoneOffset() * 60000;
|
|
113
|
+
const offsets = (new Date()).getTimezoneOffset() * 60000
|
|
114
|
+
const timestamp = stringToDate(datestr).getTime() + offsets
|
|
115
|
+
return new Date(timestamp)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
23
119
|
export const dateToDateTimeString = (date:Date)=> useDayjs().utc(date).format('YYYY-MM-DD HH:mm:ss')
|
|
24
|
-
export const toLocalDate = (date:string | Date)=> useDayjs()
|
|
120
|
+
export const toLocalDate = (date:string | Date)=> useDayjs()(date).format(getDateFormat())
|
|
25
121
|
export const toLocalDateTime = (date:string | Date)=> useDayjs().utc(date).format(getDateTimeFormat())
|
|
122
|
+
|
|
26
123
|
export const toUTCDate = (date:string | Date)=> useDayjs().utc(date).format(getDateFormat())
|
|
27
124
|
export const toUTCDateTime = (date:string | Date)=> useDayjs().utc(date).format(getDateTimeFormat())
|
|
28
125
|
export const toUTCTime = (date:string | Date)=> useDayjs().utc(date).format('HH:mm')
|
|
@@ -33,5 +130,5 @@ export const getPrimevueCalendarDateFormat = () => {
|
|
|
33
130
|
const country = <string>getUserProfile()?.country
|
|
34
131
|
return 'dd/mm/yy'
|
|
35
132
|
}
|
|
36
|
-
|
|
133
|
+
|
|
37
134
|
export const addTime = (date:Date|string,duration:number,unit:DurationType) => getDayJs()(date).add(duration, 'hour').toDate()
|
|
@@ -11,7 +11,7 @@ export const getDocument = (docname:SimpleAppDocumentType) =>{
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
// (appuser: UserContext, filter: any) => Promise<void>;
|
|
14
|
-
export const onScreenAddDocument = <T>(docname:SimpleAppDocumentType,paras?:T,after?:(eventType:FormCrudEvent, data:T)=>Promise<void>)=>{
|
|
14
|
+
export const onScreenAddDocument = <T>(docname:SimpleAppDocumentType,paras?:T,after?:(eventType:FormCrudEvent, data:T,visible:Ref<boolean>)=>Promise<void>)=>{
|
|
15
15
|
useNuxtApp().$event('ViewRecord',{
|
|
16
16
|
documentName: docname,
|
|
17
17
|
eventId:randomUUID(),
|
|
@@ -19,24 +19,26 @@ export const onScreenAddDocument = <T>(docname:SimpleAppDocumentType,paras?:T,af
|
|
|
19
19
|
paras:paras,
|
|
20
20
|
document: getDocument(docname)?.docClass,
|
|
21
21
|
viewer: getDocument(docname)?.viewer,
|
|
22
|
-
after: (eventType:FormCrudEvent, data: any) => {
|
|
22
|
+
after: (eventType:FormCrudEvent, data: any,visible:Ref<boolean>) => {
|
|
23
23
|
//do nothing
|
|
24
|
-
|
|
24
|
+
if(after)after(eventType,data as T,visible)
|
|
25
25
|
},
|
|
26
26
|
label:t(docname)
|
|
27
27
|
|
|
28
28
|
})
|
|
29
29
|
}
|
|
30
|
-
export const onScreenEditDocument = <T>(docname:SimpleAppDocumentType,_id:string,after?:(eventType:FormCrudEvent, data:T)=>Promise<void
|
|
30
|
+
export const onScreenEditDocument = <T>(docname:SimpleAppDocumentType,_id:string,after?:(eventType:FormCrudEvent, data:T,visible:Ref<boolean>)=>Promise<void>,autoclose:number=1)=>{
|
|
31
|
+
|
|
31
32
|
useNuxtApp().$event('ViewRecord',{
|
|
32
33
|
documentName: docname,
|
|
33
34
|
eventId:randomUUID(),
|
|
34
35
|
_id:_id,
|
|
36
|
+
autoclose:autoclose,
|
|
35
37
|
document: getDocument(docname)?.docClass,
|
|
36
38
|
viewer: getDocument(docname)?.viewer,
|
|
37
|
-
after: async (eventType:FormCrudEvent, data: any) => {
|
|
39
|
+
after: async (eventType:FormCrudEvent, data: any,visible:Ref<boolean>) => {
|
|
38
40
|
//do nothing
|
|
39
|
-
if(after)after(eventType,data as T)
|
|
41
|
+
if(after)after(eventType,data as T,visible)
|
|
40
42
|
},
|
|
41
43
|
label:t(docname)
|
|
42
44
|
})
|
|
@@ -9,8 +9,11 @@ import * as o from "../simpleapp/generate/openapi";
|
|
|
9
9
|
import axios from 'axios'
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
const getAxiosConfig = () => {
|
|
13
|
-
const
|
|
12
|
+
export const getAxiosConfig = () => {
|
|
13
|
+
const xorg = getCurrentXorg()
|
|
14
|
+
const xorgdecode = xorg!==undefined ? atob(<string>xorg) :''
|
|
15
|
+
|
|
16
|
+
const suffix = xorgdecode.includes('-') ? '/'+getCurrentXorg() : ''
|
|
14
17
|
const config: o.Configuration = {
|
|
15
18
|
basePath: `${useRuntimeConfig().public.APP_URL}/api${suffix}`,
|
|
16
19
|
isJsonMime: () => true,
|
|
@@ -18,10 +21,14 @@ const getAxiosConfig = () => {
|
|
|
18
21
|
return config
|
|
19
22
|
}
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
//get apisession exclude from shared axios to separate handle session
|
|
22
25
|
export const getApiSession = async ()=> {
|
|
23
|
-
|
|
24
|
-
return
|
|
26
|
+
console.log("getApiSession from computable")
|
|
27
|
+
return getUserStore().pingSession()
|
|
28
|
+
//,useNuxtApp().$axios)
|
|
29
|
+
// const profileapi = new o.PROFILEApi(getAxiosConfig(),undefined)
|
|
30
|
+
// const res = await profileapi.getSession()
|
|
31
|
+
// return res
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
export const getDocumentApi = (documentName: string): any => {
|
|
@@ -31,10 +38,51 @@ export const getDocumentApi = (documentName: string): any => {
|
|
|
31
38
|
|
|
32
39
|
const config = getAxiosConfig()
|
|
33
40
|
const docsOpenapi: any = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
'tenant': new o.TENANTApi(config),
|
|
42
|
+
'organization': new o.ORGApi(config),
|
|
43
|
+
'branch': new o.BRANCHApi(config),
|
|
44
|
+
'permission': new o.PERMApi(config),
|
|
45
|
+
'autoincreament': new o.AUTOINCApi(config),
|
|
46
|
+
'docnoformat': new o.DOCNOApi(config),
|
|
47
|
+
'systemmessage': new o.SYSMSGApi(config),
|
|
48
|
+
'keyvaluepair': new o.KVPAIRApi(config),
|
|
49
|
+
'webhook': new o.WEBHOOKApi(config),
|
|
50
|
+
'academysession': new o.ACADEMYSESSIONApi(config),
|
|
51
|
+
'accounttransaction': new o.ACCTRANSApi(config),
|
|
52
|
+
'agent': new o.AGENTApi(config),
|
|
53
|
+
'area': new o.AREAApi(config),
|
|
54
|
+
'attendance': new o.ATTApi(config),
|
|
55
|
+
'category': new o.CATApi(config),
|
|
56
|
+
'creditnote': new o.CNApi(config),
|
|
57
|
+
'enrollment': new o.ENROLLApi(config),
|
|
58
|
+
'enrollmenttransaction': new o.ENROLLTRANSApi(config),
|
|
59
|
+
'holiday': new o.HOLIDAYApi(config),
|
|
60
|
+
'invoice': new o.INVApi(config),
|
|
61
|
+
'level': new o.LVLApi(config),
|
|
62
|
+
'parent': new o.PARENTApi(config),
|
|
63
|
+
'payment': new o.PAYApi(config),
|
|
64
|
+
'paymentmethod': new o.PAYMETHODApi(config),
|
|
65
|
+
'product': new o.PRDApi(config),
|
|
66
|
+
'productpackage': new o.PRDPKGApi(config),
|
|
67
|
+
'race': new o.RACEApi(config),
|
|
68
|
+
'refund': new o.REFUNDApi(config),
|
|
69
|
+
'refundtype': new o.REFUNDTYPEApi(config),
|
|
70
|
+
'religion': new o.RELIGIONApi(config),
|
|
71
|
+
'room': new o.ROOMApi(config),
|
|
72
|
+
'roomtype': new o.ROOMTYPEApi(config),
|
|
73
|
+
'schedule': new o.SCHEDULEApi(config),
|
|
74
|
+
'school': new o.SCHOOLApi(config),
|
|
75
|
+
'stopenrollment': new o.STOPENROLLApi(config),
|
|
76
|
+
'stopreason': new o.STOPREASONApi(config),
|
|
77
|
+
'student': new o.STUApi(config),
|
|
78
|
+
'studentgroup': new o.STUGROUPApi(config),
|
|
79
|
+
'studentsource': new o.STUDENTSRCApi(config),
|
|
80
|
+
'studentsummary': new o.STUSUMApi(config),
|
|
81
|
+
'teacher': new o.TEACHERApi(config),
|
|
82
|
+
'teachergroup': new o.TEACHERGROUPApi(config),
|
|
83
|
+
'tuitionclass': new o.TUITIONApi(config),
|
|
84
|
+
'user': new o.USERApi(config),
|
|
85
|
+
|
|
38
86
|
};
|
|
39
87
|
|
|
40
88
|
if (!docsOpenapi[documentName]) {
|
|
@@ -57,6 +105,6 @@ export const getWorkflowApi = () => {
|
|
|
57
105
|
|
|
58
106
|
}
|
|
59
107
|
|
|
60
|
-
export const
|
|
108
|
+
export const getProfileApi = () => {
|
|
61
109
|
return new o.PROFILEApi(getAxiosConfig())
|
|
62
110
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getUserProfile } from './getUserStore.generate';
|
|
1
2
|
/**
|
|
2
3
|
* This file was automatically generated by simpleapp generator. Every
|
|
3
4
|
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
@@ -15,12 +16,25 @@ export const reloadUserStore = async () =>{
|
|
|
15
16
|
await $userstore.loadRemoteUserInfo()
|
|
16
17
|
}
|
|
17
18
|
export const getCurrency = () =>getUserStore()?.currency ?? '$$'
|
|
18
|
-
export const getUserProfile =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return !userstore ? undefined :userstore.getUserInfo()
|
|
22
|
-
}
|
|
19
|
+
export const getUserProfile = () => getUserStore()?.getUserInfo()
|
|
20
|
+
|
|
23
21
|
|
|
22
|
+
export const isGuideComplete=(guidename: string):boolean=>{
|
|
23
|
+
if(useNuxtApp().$userstore.moreProps.completedTours!==undefined){
|
|
24
|
+
return useNuxtApp().$userstore.moreProps.completedTours.includes(guidename)
|
|
25
|
+
}
|
|
26
|
+
else return false
|
|
27
|
+
}
|
|
28
|
+
export const setGuideComplete= async(guidename:string)=>{
|
|
29
|
+
const userstore =useNuxtApp().$userstore
|
|
30
|
+
await getProfileApi().runTourComplete(guidename);
|
|
31
|
+
if(getUserProfile()!==undefined){
|
|
32
|
+
if(!Array.isArray(getUserProfile()?.moreProps.completedTours))
|
|
33
|
+
userstore.moreProps.completedTours=[guidename]
|
|
34
|
+
else
|
|
35
|
+
userstore.moreProps.completedTours.push(guidename)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
24
38
|
export const getCurrentXorg = () =>{
|
|
25
39
|
return (useRoute().params.xorg) ? String(useRoute().params.xorg) : undefined
|
|
26
40
|
}
|
|
@@ -36,6 +50,11 @@ export const getPageBaseUrl = (resourcename:string) =>{
|
|
|
36
50
|
export const canPerform = (resource:string,action:string):boolean =>{
|
|
37
51
|
return getUserStore().canPerform(resource,action)
|
|
38
52
|
}
|
|
53
|
+
export const haveAccess = (resource:string):boolean =>{
|
|
54
|
+
return getUserStore().haveAccess(resource)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
39
58
|
|
|
40
59
|
export const getProfileEmail = () => getUserProfile()?.email
|
|
41
60
|
export const getProfileFullName = () => getUserProfile()?.fullName
|
|
@@ -46,3 +65,16 @@ export const refreshOrgLogo = async () => {
|
|
|
46
65
|
}
|
|
47
66
|
export const getOrgLogo = ()=> orgLogo
|
|
48
67
|
export const setOrgLogo = (str:string) => orgLogo = str
|
|
68
|
+
export const getCurrentBranch = ()=>{
|
|
69
|
+
const branchId= getUserStore().branchId
|
|
70
|
+
const branchinfo = getUserStore().branches.find(item=>item.branch.branchId==branchId)
|
|
71
|
+
return branchinfo
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const getMySimpleAppUserPicker=()=>{
|
|
75
|
+
return {
|
|
76
|
+
_id: getUserProfile()?._id,
|
|
77
|
+
uid:getUserProfile()?.uid,
|
|
78
|
+
fullName:getUserProfile()?.fullName
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -18,6 +18,9 @@ export const getDocumentUrl = (document:string,id?:string,querystr?:string)=>{
|
|
|
18
18
|
return path
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
export const getPathResource=()=>{
|
|
22
|
+
return useRoute().path.toString().replace('/'+getCurrentXorg(),'')
|
|
23
|
+
}
|
|
21
24
|
|
|
22
25
|
export const goTo = (document:string,id?:string,querystr?:string)=>{
|
|
23
26
|
navigateTo(getDocumentUrl(document,id,querystr))
|
|
@@ -38,5 +41,15 @@ export const getPathPara = (paraname:string,emptyvalue:string=''):string=>{
|
|
|
38
41
|
return emptyvalue
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
|
-
|
|
44
|
+
export const getPathQuery = (paraname:string,emptyvalue:string|string[]=''):string|string[]=>{
|
|
45
|
+
const paravalue = useRoute().query[paraname]
|
|
46
|
+
if( paraname.includes('[')){
|
|
47
|
+
return (typeof paravalue == 'string'? [paravalue] : paravalue) as string[]
|
|
48
|
+
}else if(typeof paravalue == 'string'){
|
|
49
|
+
return paravalue.toString()
|
|
50
|
+
}
|
|
51
|
+
else{
|
|
52
|
+
return emptyvalue
|
|
53
|
+
}
|
|
54
|
+
}
|
|
42
55
|
export const setCurrentUrl = (path:string)=>useRouter().push({path:path})
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* last change 2024-03-13
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
import {NotificationStatus} from "~/types"
|
|
8
8
|
import { createHttpLink, } from '@apollo/client/core';
|
|
9
9
|
|
|
10
10
|
export const setGraphqlServer=()=>{
|
|
@@ -23,4 +23,22 @@ export const setGraphqlServer=()=>{
|
|
|
23
23
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export const graphquery=async<T>(qqlstr: typeof gql) =>(await useAsyncQuery<T>(qqlstr))
|
|
26
|
+
// export const graphquery=async<T>(qqlstr: typeof gql) =>(await useAsyncQuery<T>(qqlstr))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export const gqlQuery=async<T>(gqlstr:string):Promise<T|undefined>=>{
|
|
30
|
+
const query = gql(gqlstr);
|
|
31
|
+
try{
|
|
32
|
+
const result = await useAsyncQuery<T>(query);
|
|
33
|
+
return result.data.value as T
|
|
34
|
+
}catch(e){
|
|
35
|
+
useNuxtApp().$event('Notification',{
|
|
36
|
+
documentName:'report',
|
|
37
|
+
summary:t('reportQueryFailed'),
|
|
38
|
+
status:NotificationStatus.error,
|
|
39
|
+
data:e
|
|
40
|
+
})
|
|
41
|
+
// return e
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {RecentlyValue} from "~/types"
|
|
2
|
+
export const getRecently = ()=>useNuxtApp().$recently
|
|
3
|
+
export const setRecentDocument = (key:string, value:RecentlyValue)=>{
|
|
4
|
+
const recent = getRecently()
|
|
5
|
+
recent.set(key,value)
|
|
6
|
+
const tmp:{[key:string]:RecentlyValue}={}
|
|
7
|
+
recent.forEach((value,key)=>{
|
|
8
|
+
tmp[key]=value
|
|
9
|
+
})
|
|
10
|
+
console.log("JSON.stringify(tmp)",tmp)
|
|
11
|
+
localStorage.setItem('recently', JSON.stringify(tmp)); // Store keys as an array
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
export const getRecentDocument = (key:string)=>{
|
|
15
|
+
getRecently().get(key)
|
|
16
|
+
}
|