@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.
- package/dist/buildinschemas/organization.d.ts.map +1 -1
- package/dist/buildinschemas/organization.js +3 -1
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +4 -9
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +14 -14
- package/dist/generate.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/organization.ts +3 -1
- package/src/framework.ts +5 -9
- package/src/generate.ts +17 -16
- package/templates/basic/nest/controller.ts.eta +17 -0
- package/templates/basic/nest/default.ts.eta +6 -2
- package/templates/basic/nuxt/default.ts.eta +10 -6
- package/templates/basic/nuxt/pages.[id].vue.eta +9 -7
- package/templates/basic/nuxt/pages.form.vue.eta +16 -36
- package/templates/basic/nuxt/pages.landing.vue.eta +42 -35
- package/templates/basic/nuxt/pages.viewer.vue.eta +4 -6
- package/templates/nest/.env._eta +0 -1
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +14 -2
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +32 -18
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +76 -13
- package/templates/nuxt/app.vue.eta +7 -3
- package/templates/nuxt/assets/css/calendar.css._eta +21 -8
- package/templates/nuxt/assets/css/style.css._eta +17 -10
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +44 -22
- package/templates/nuxt/components/button/ButtonDefault.vue._eta +1 -2
- package/templates/nuxt/components/button/ButtonMultiple.vue._eta +21 -0
- package/templates/nuxt/components/calendar/CalendarByResource.vue.eta +29 -8
- package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +3 -4
- package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +75 -65
- package/templates/nuxt/components/event/EventNotification.vue._eta +23 -2
- package/templates/nuxt/components/form/FormBranch.vue.eta +83 -0
- package/templates/nuxt/components/form/readme.md.eta +1 -0
- package/templates/nuxt/components/header/HeaderBar.vue._eta +9 -9
- package/templates/nuxt/components/header/HeaderBreadcrumb.vue.eta +2 -2
- package/templates/nuxt/components/header/button/HeaderButtonMenuPicker.vue._eta +16 -22
- package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +29 -46
- package/templates/nuxt/components/list/ListDocument.vue.eta +25 -0
- package/templates/nuxt/components/list/ListDocumentTable.vue.eta +77 -0
- package/templates/nuxt/components/list/ListView.vue.eta +129 -58
- package/templates/nuxt/components/mobile/MobileToolbar.vue.eta +10 -0
- package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +21 -0
- package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +20 -0
- package/templates/nuxt/components/page/PageDocList.vue.eta +170 -0
- package/templates/nuxt/components/renderer/RendererBoolean.vue.eta +8 -4
- package/templates/nuxt/components/renderer/RendererDate.vue.eta +4 -4
- package/templates/nuxt/components/renderer/RendererLink.vue.eta +12 -20
- package/templates/nuxt/components/renderer/RendererMoney.vue.eta +10 -2
- package/templates/nuxt/components/renderer/RendererViewer.vue.eta +27 -21
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +202 -150
- package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +7 -1
- package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +112 -101
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue.eta +183 -91
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +383 -246
- package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +4 -3
- package/templates/nuxt/components/table/TableDocuments.vue.eta +3 -3
- package/templates/nuxt/components/text/TextDanger.vue._eta +5 -0
- package/templates/nuxt/components/text/TextSubtitle.vue._eta +5 -0
- package/templates/nuxt/components/text/TextTitle.vue._eta +5 -0
- package/templates/nuxt/components/user/UserProfileListItem.vue.eta +2 -2
- package/templates/nuxt/composables/date.generate.ts.eta +21 -0
- package/templates/nuxt/composables/goTo.generate.ts.eta +1 -0
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +0 -5
- package/templates/nuxt/error.vue._eta +3 -3
- package/templates/nuxt/i18n.config.ts.eta +1 -1
- package/templates/nuxt/lang/en.ts.eta +16 -0
- package/templates/nuxt/layouts/default.vue._eta +34 -34
- package/templates/nuxt/layouts/loginlayout.vue._eta +3 -0
- package/templates/nuxt/layouts/mobile.vue._eta +52 -0
- package/templates/nuxt/nuxt.config.ts._eta +28 -22
- package/templates/nuxt/pages/[xorg]/organization/[id].vue.eta +39 -0
- package/templates/nuxt/pages/[xorg]/organization/new.vue.eta +30 -143
- package/templates/nuxt/pages/[xorg]/organization/viewer.vue.eta +3 -0
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +81 -127
- package/templates/nuxt/pages/[xorg]/user/[id].vue.eta +40 -0
- package/templates/nuxt/pages/[xorg]/user/form.vue.eta +329 -0
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +37 -0
- package/templates/nuxt/pages/[xorg]/{organization/[id]/branches/[bid].vue → user/new.vue.eta} +10 -4
- package/templates/nuxt/pages/[xorg]/user/viewer.vue.eta +30 -0
- package/templates/nuxt/pages/[xorg]/{user.vue._eta → user.vue.eta} +88 -78
- package/templates/nuxt/pages/login.vue._eta +34 -0
- package/templates/nuxt/pages/profile.vue.eta +12 -3
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +36 -35
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +6 -0
- package/templates/nuxt/server/api/[xorg]/[...].ts.eta +7 -40
- package/templates/nuxt/server/api/profile/[...].ts.eta +3 -32
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +42 -3
- package/templates/nuxt/types/calendar.ts.eta +8 -1
- package/templates/nuxt/types/documentlist.ts.eta +0 -9
- package/templates/nuxt/types/events.ts.eta +1 -0
- package/templates/nuxt/types/others.ts.eta +4 -1
- package/templates/nuxt/types/simpleappinput.ts.eta +12 -2
- package/templates/nuxt/types/user.ts.eta +2 -0
- package/templates/project/lang/default._json +9 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/components/docPage/DocPageList.vue.eta +0 -125
- package/templates/nuxt/lang/en.ts._eta +0 -6
- package/templates/nuxt/pages/[xorg]/organization/[bid].vue.eta +0 -14
- package/templates/nuxt/pages/[xorg]/organization/[id]/branches/new.vue +0 -149
- package/templates/nuxt/pages/[xorg]/organization/[id]/index.vue.eta +0 -1
- package/templates/nuxt/pages/[xorg]/user/[id].vue._eta +0 -6
- package/templates/nuxt/pages/[xorg]/user/index.vue._eta +0 -302
- package/templates/nuxt/pages/login.vue.eta +0 -30
- /package/templates/nuxt/lang/{df.ts.eta → df.ts.etaxxxx} +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Crud :_id="_id" @after="after" :paras="paras" />
|
|
3
|
+
</template>
|
|
4
|
+
<script setup lang="ts">
|
|
5
|
+
/**
|
|
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.
|
|
9
|
+
* last change 2023-09-09
|
|
10
|
+
* author: Ks Tan
|
|
11
|
+
*/
|
|
12
|
+
import Crud from "./form.vue";import { User } from "~/simpleapp/generate/types";
|
|
13
|
+
const props = defineProps<{ _id: string; paras?: User }>();
|
|
14
|
+
const emits = defineEmits(["afterCreate", "after"]);
|
|
15
|
+
|
|
16
|
+
const after = (actionName: string, data: User, result: any) => {
|
|
17
|
+
switch (actionName) {
|
|
18
|
+
case "new":
|
|
19
|
+
break;
|
|
20
|
+
case "create":
|
|
21
|
+
emits("afterCreate", data);
|
|
22
|
+
break;
|
|
23
|
+
case "update":
|
|
24
|
+
break;
|
|
25
|
+
case "delete":
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
emits("after", actionName, data, result);
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
@@ -1,3 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<title>{{ t("user") }}</title>
|
|
3
|
+
<div class="flex flex-row gap-4">
|
|
4
|
+
|
|
5
|
+
<div v-if="!useDevice().isMobile || (useDevice().isMobile && !userid)"
|
|
6
|
+
class="w-full md:w-1/2 xl:w-1/3 p-4"
|
|
7
|
+
>
|
|
8
|
+
<TabView>
|
|
9
|
+
<TabPanel header="Active">
|
|
10
|
+
<ul role="list" class="divide-y divide-gray-100">
|
|
11
|
+
<li v-for="item in userlist" :key="item.email">
|
|
12
|
+
<NuxtLink
|
|
13
|
+
v-if="item.uid && item.active"
|
|
14
|
+
:to="getDocumentUrl('user',item._id)"
|
|
15
|
+
>
|
|
16
|
+
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
17
|
+
</NuxtLink>
|
|
18
|
+
</li>
|
|
19
|
+
</ul>
|
|
20
|
+
</TabPanel>
|
|
21
|
+
<TabPanel header="Inactive">
|
|
22
|
+
<ul role="list" class="divide-y divide-gray-100">
|
|
23
|
+
<li v-for="item in userlist" :key="item.email">
|
|
24
|
+
<NuxtLink
|
|
25
|
+
v-if="item.uid && !item.active"
|
|
26
|
+
:to="getDocumentUrl('user',item._id)"
|
|
27
|
+
>
|
|
28
|
+
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
29
|
+
</NuxtLink>
|
|
30
|
+
</li>
|
|
31
|
+
</ul>
|
|
32
|
+
</TabPanel>
|
|
33
|
+
<TabPanel header="Invite">
|
|
34
|
+
<div class="padding p-2">
|
|
35
|
+
<form @submit.prevent="true" class="w-full">
|
|
36
|
+
<div class="p-inputgroup flex flex-row">
|
|
37
|
+
<InputText
|
|
38
|
+
class="flex-1"
|
|
39
|
+
type="email"
|
|
40
|
+
placeholder="email"
|
|
41
|
+
v-model="inviteemail"
|
|
42
|
+
/>
|
|
43
|
+
<div class="p-inputgroup-addon p p-0">
|
|
44
|
+
<button
|
|
45
|
+
label="Search"
|
|
46
|
+
class="border rounded-tl-none rounded-bl-none btn btn-primary -ml-1 h-full p-3 rounded-r-md"
|
|
47
|
+
@click="invite"
|
|
48
|
+
>
|
|
49
|
+
Invite
|
|
50
|
+
</button>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</form>
|
|
54
|
+
</div>
|
|
55
|
+
<ul role="list" class="divide-y divide-gray-100">
|
|
56
|
+
<li v-for="item in userlist" :key="item.email">
|
|
57
|
+
<NuxtLink
|
|
58
|
+
v-if="!item.uid"
|
|
59
|
+
:to="getDocumentUrl('user',item._id)"
|
|
60
|
+
>
|
|
61
|
+
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
62
|
+
</NuxtLink>
|
|
63
|
+
</li>
|
|
64
|
+
</ul>
|
|
65
|
+
</TabPanel>
|
|
66
|
+
</TabView>
|
|
67
|
+
</div>
|
|
68
|
+
<div v-if="userid || !isMobile()" class="flex-1">
|
|
69
|
+
<NuxtPage :_id="userid" />
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
1
74
|
<script setup lang="ts">
|
|
2
75
|
/**
|
|
3
76
|
* invite user into current tenant (put user into user catalogue)
|
|
@@ -8,7 +81,7 @@
|
|
|
8
81
|
// import userchild from './userchild.vue'
|
|
9
82
|
import Menu from "primevue/menu";
|
|
10
83
|
import Dialog from "primevue/dialog";
|
|
11
|
-
import { SearchBody, EventType } from "~/types";
|
|
84
|
+
import { SearchBody, EventType,UserProfile } from "~/types";
|
|
12
85
|
import _ from "lodash";
|
|
13
86
|
import Panel from "primevue/panel";
|
|
14
87
|
import { ref } from "vue";
|
|
@@ -36,7 +109,7 @@ const {
|
|
|
36
109
|
$UserDoc,
|
|
37
110
|
// $InvitationDoc,
|
|
38
111
|
} = useNuxtApp();
|
|
39
|
-
|
|
112
|
+
const userid = computed(() => getPathPara("id"));
|
|
40
113
|
const permdoc = $PermissionDoc();
|
|
41
114
|
const orgdoc = $OrganizationDoc();
|
|
42
115
|
const branchdoc = $BranchDoc();
|
|
@@ -61,6 +134,11 @@ const activeuser = ref("");
|
|
|
61
134
|
const showpermissioninfo = ref(false);
|
|
62
135
|
const permissionselected = ref();
|
|
63
136
|
|
|
137
|
+
|
|
138
|
+
const selectUser = (user:any) =>{
|
|
139
|
+
// goTo('user',user._id)
|
|
140
|
+
}
|
|
141
|
+
|
|
64
142
|
/**
|
|
65
143
|
* 1. get all users from this tenant
|
|
66
144
|
* @param resetpage after reload, will it reset user interface or remain as current
|
|
@@ -113,9 +191,9 @@ const invite = async () => {
|
|
|
113
191
|
newuserdata.value.email = inviteemail.value;
|
|
114
192
|
newuserdata.value.fullName = inviteemail.value.split("@")[0];
|
|
115
193
|
newuserdata.value.active = true;
|
|
116
|
-
newuserdata.value.tenantId = currentuser
|
|
117
|
-
newuserdata.value.orgId = currentuser
|
|
118
|
-
newuserdata.value.branchId = currentuser
|
|
194
|
+
newuserdata.value.tenantId = currentuser?.tenantId;
|
|
195
|
+
newuserdata.value.orgId = currentuser?.orgId;
|
|
196
|
+
newuserdata.value.branchId = currentuser?.branchId;
|
|
119
197
|
|
|
120
198
|
const invitedata = await inviteuserdoc.create();
|
|
121
199
|
inviteemail.value = "";
|
|
@@ -123,82 +201,14 @@ const invite = async () => {
|
|
|
123
201
|
// onSelectUser(invitedata);
|
|
124
202
|
};
|
|
125
203
|
|
|
126
|
-
$listen("
|
|
127
|
-
refreshList();
|
|
204
|
+
$listen("RefreshDocumentList", async() => {
|
|
205
|
+
await refreshList();
|
|
128
206
|
});
|
|
129
|
-
onMounted(() => {
|
|
130
|
-
refreshList();
|
|
207
|
+
onMounted(async () => {
|
|
208
|
+
await refreshList();
|
|
131
209
|
});
|
|
132
210
|
|
|
133
211
|
definePageMeta({
|
|
134
212
|
menuPath: "setting/user",
|
|
135
|
-
|
|
213
|
+
});
|
|
136
214
|
</script>
|
|
137
|
-
<template>
|
|
138
|
-
<div class="grid grid-cols-4">
|
|
139
|
-
<title>{{ t('user')}} </title>
|
|
140
|
-
<div v-if="userlist" class="m-2 p-2 border-r-2">
|
|
141
|
-
<TabView>
|
|
142
|
-
<TabPanel header="Active">
|
|
143
|
-
<ul role="list" class="divide-y divide-gray-100">
|
|
144
|
-
<li v-for="item in userlist" :key="item.email">
|
|
145
|
-
<NuxtLink
|
|
146
|
-
v-if="item.uid && item.active"
|
|
147
|
-
:to="`${getPageBaseUrl('user')}/${item._id}`"
|
|
148
|
-
>
|
|
149
|
-
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
150
|
-
</NuxtLink>
|
|
151
|
-
</li>
|
|
152
|
-
</ul>
|
|
153
|
-
</TabPanel>
|
|
154
|
-
<TabPanel header="Inactive">
|
|
155
|
-
<ul role="list" class="divide-y divide-gray-100">
|
|
156
|
-
<li v-for="item in userlist" :key="item.email">
|
|
157
|
-
<NuxtLink
|
|
158
|
-
v-if="item.uid && !item.active"
|
|
159
|
-
:to="`${getPageBaseUrl('user')}/${item._id}`"
|
|
160
|
-
>
|
|
161
|
-
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
162
|
-
</NuxtLink>
|
|
163
|
-
</li>
|
|
164
|
-
</ul>
|
|
165
|
-
</TabPanel>
|
|
166
|
-
<TabPanel header="Invite">
|
|
167
|
-
<div class="padding p-2">
|
|
168
|
-
<form @submit.prevent="true" class="w-full">
|
|
169
|
-
<div class="p-inputgroup flex flex-row ">
|
|
170
|
-
<InputText
|
|
171
|
-
class="flex-1"
|
|
172
|
-
type="email"
|
|
173
|
-
placeholder="email"
|
|
174
|
-
v-model="inviteemail"
|
|
175
|
-
/>
|
|
176
|
-
<div class="p-inputgroup-addon p p-0">
|
|
177
|
-
<button label="Search"
|
|
178
|
-
class="border rounded-tl-none rounded-bl-none btn btn-primary -ml-1 h-full p-3 rounded-r-md"
|
|
179
|
-
@click="invite">
|
|
180
|
-
Invite
|
|
181
|
-
</button>
|
|
182
|
-
</div>
|
|
183
|
-
|
|
184
|
-
</div>
|
|
185
|
-
</form>
|
|
186
|
-
</div>
|
|
187
|
-
<ul role="list" class="divide-y divide-gray-100">
|
|
188
|
-
<li v-for="item in userlist" :key="item.email">
|
|
189
|
-
<NuxtLink
|
|
190
|
-
v-if="!item.uid"
|
|
191
|
-
:to="`${getPageBaseUrl('user')}/${item._id}`"
|
|
192
|
-
>
|
|
193
|
-
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
194
|
-
</NuxtLink>
|
|
195
|
-
</li>
|
|
196
|
-
</ul>
|
|
197
|
-
</TabPanel>
|
|
198
|
-
</TabView>
|
|
199
|
-
</div>
|
|
200
|
-
<div class="col-span-3 p-2">
|
|
201
|
-
<NuxtPage />
|
|
202
|
-
</div>
|
|
203
|
-
</div>
|
|
204
|
-
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="p-10 m-10 text-3xl border text-center dark:text-white">
|
|
3
|
+
{{ t('redirectToLoginPage') }}
|
|
4
|
+
<!-- <NuxtPage /> -->
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
/**
|
|
9
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
10
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
11
|
+
* last change 2024-02-13
|
|
12
|
+
* Author: Ks Tan
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
definePageMeta({
|
|
16
|
+
name: "Login",
|
|
17
|
+
auth: false,
|
|
18
|
+
layout: false
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const route = useRoute();
|
|
22
|
+
const { signIn } = useAuth();
|
|
23
|
+
const callbackUrl = ref("");
|
|
24
|
+
onMounted(async () => {
|
|
25
|
+
if (route.query.callbackUrl) {
|
|
26
|
+
callbackUrl.value = <string>route.query.callbackUrl;
|
|
27
|
+
} else {
|
|
28
|
+
callbackUrl.value = "/";
|
|
29
|
+
}
|
|
30
|
+
callbackUrl.value = decodeURIComponent(callbackUrl.value);
|
|
31
|
+
// console.log("callbackUrlcallbackUrlcallbackUrl", callbackUrl.value);
|
|
32
|
+
await signIn("keycloak", { callbackUrl: callbackUrl.value });
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
<dt
|
|
53
53
|
class="text-sm font-medium leading-6 text-gray-900 dark:text-gray-400"
|
|
54
54
|
>
|
|
55
|
-
{{t(
|
|
55
|
+
{{ t("branches") }}
|
|
56
56
|
</dt>
|
|
57
57
|
<dd class="mt-2 text-sm text-gray-900 sm:col-span-2 sm:mt-0">
|
|
58
58
|
<ul
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
</ul>
|
|
89
89
|
</dd>
|
|
90
90
|
</div>
|
|
91
|
+
|
|
91
92
|
|
|
92
93
|
<div
|
|
93
94
|
v-if="useRuntimeConfig().public.DEBUGDATA == '1'"
|
|
@@ -96,14 +97,22 @@
|
|
|
96
97
|
<dt
|
|
97
98
|
class="text-sm font-medium leading-6 text-gray-900 dark:text-gray-400"
|
|
98
99
|
>
|
|
99
|
-
{{t(
|
|
100
|
+
{{ t("more") }}
|
|
100
101
|
<p class="text-danger-600">{{ t("onlyAppearInDebugMode") }}</p>
|
|
101
102
|
<p class="text-danger-600">{{ getUserProfile().sessionId }}</p>
|
|
102
103
|
</dt>
|
|
103
104
|
<dd
|
|
104
105
|
class="mt-1 text-sm leading-6 text-gray-700 dark:text-gray-300 sm:col-span-2 sm:mt-0"
|
|
105
106
|
>
|
|
106
|
-
|
|
107
|
+
<div>
|
|
108
|
+
<p>{{t('accessRights')}}</p>
|
|
109
|
+
{{ getUserProfile().roles }}
|
|
110
|
+
</div>
|
|
111
|
+
<div>
|
|
112
|
+
<p>{{ t('others') }}</p>
|
|
113
|
+
{{ getUserProfile()?.country }} / {{ getUserProfile()?.currency }} / {{ getUserProfile()?.offsetMinute }}
|
|
114
|
+
</div>
|
|
115
|
+
|
|
107
116
|
</dd>
|
|
108
117
|
</div>
|
|
109
118
|
</dl>
|
|
@@ -10,6 +10,7 @@ import axios, { Axios, AxiosResponse } from 'axios'
|
|
|
10
10
|
import {Notification,EventType} from '~/types'
|
|
11
11
|
// import PrimeVue from "primevue/config";
|
|
12
12
|
import mitt from 'mitt'
|
|
13
|
+
|
|
13
14
|
// import ToastService from 'primevue/toastservice';
|
|
14
15
|
// import ConfirmationService from 'primevue/confirmationservice';
|
|
15
16
|
// import Tooltip from 'primevue/tooltip';
|
|
@@ -23,44 +24,44 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
23
24
|
//const { csrf } = useCsrf()
|
|
24
25
|
//axios.defaults.headers.common = {"CSRF-TOKEN": csrf};
|
|
25
26
|
const myaxios = axios.create({timeout:5000})
|
|
26
|
-
myaxios.interceptors.response.use(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
console.error("axios 401 session expired, pop up for relogin")
|
|
41
|
-
}else if(error.response && error.response.status){
|
|
42
|
-
let errmsg = error.response.message
|
|
43
|
-
let errorcode =error.response.status
|
|
44
|
-
if(error.response?.data && error.response?.data?.message){
|
|
45
|
-
errmsg = error.response.data.message
|
|
46
|
-
errorcode = error.response.data.statusCode
|
|
27
|
+
myaxios.interceptors.response.use(
|
|
28
|
+
(response) => {
|
|
29
|
+
return response
|
|
30
|
+
},
|
|
31
|
+
(error) => {
|
|
32
|
+
if(error.code && error.code == 'ERR_BAD_REQUEST'){
|
|
33
|
+
console.error("axios ERR_BAD_REQUEST, redirect to relogin")
|
|
34
|
+
}
|
|
35
|
+
else if(error.code){
|
|
36
|
+
throw createError({
|
|
37
|
+
statusCode:error.code,
|
|
38
|
+
statusMessage:error.message,
|
|
39
|
+
fatal:true
|
|
40
|
+
})
|
|
47
41
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
42
|
+
else if(error.response && error.response.status==302){
|
|
43
|
+
console.error("axios 302 session expired, start login flow")
|
|
44
|
+
}else if(error.response && error.response.status){
|
|
45
|
+
let errmsg = error.response.message
|
|
46
|
+
let errorcode =error.response.status
|
|
47
|
+
if(error.response?.data && error.response?.data?.message){
|
|
48
|
+
errmsg = error.response.data.message
|
|
49
|
+
errorcode = error.response.data.statusCode
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
throw createError({
|
|
53
|
+
statusCode:errorcode,
|
|
54
|
+
statusMessage:errmsg,
|
|
55
|
+
fatal:true
|
|
56
|
+
})
|
|
57
|
+
// return Promise.reject(error)
|
|
58
|
+
}else{
|
|
59
|
+
console.error("unknown error")
|
|
60
|
+
throw createError({statusCode:500,statusMessage:"Internal server error"})
|
|
61
|
+
}
|
|
62
|
+
});
|
|
61
63
|
return {
|
|
62
64
|
provide: {
|
|
63
|
-
|
|
64
65
|
event: emitter.emit, // Will emit an event
|
|
65
66
|
listen: emitter.on, // Will register a listener for an event
|
|
66
67
|
axios: myaxios,
|
|
@@ -27,6 +27,8 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
27
27
|
orgName:ref(''),
|
|
28
28
|
timeZone:ref(''),
|
|
29
29
|
currency:ref(''),
|
|
30
|
+
country: ref(''),
|
|
31
|
+
offsetMinute: ref(0),
|
|
30
32
|
uid: ref(''),
|
|
31
33
|
email: ref(''),
|
|
32
34
|
fullName: ref(''),
|
|
@@ -70,6 +72,8 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
70
72
|
this.orgName = res.data.orgName
|
|
71
73
|
this.timeZone = res.data.timeZone
|
|
72
74
|
this.currency = res.data.currency
|
|
75
|
+
this.country = res.data.country
|
|
76
|
+
this.offsetMinute = res.data.offsetMinute
|
|
73
77
|
this.uid = res.data.uid
|
|
74
78
|
this.email = res.data.email
|
|
75
79
|
this.fullName = res.data.fullName
|
|
@@ -173,6 +177,8 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
173
177
|
orgName: this.orgName,
|
|
174
178
|
currency: this.currency,
|
|
175
179
|
timeZone: this.timeZone,
|
|
180
|
+
country: this.country,
|
|
181
|
+
offsetMinute: this.offsetMinute,
|
|
176
182
|
fullName : this.fullName,
|
|
177
183
|
branches:this.branches??[],
|
|
178
184
|
invites: this.invites ?? [],
|
|
@@ -19,63 +19,30 @@ export default defineEventHandler(async (event:any) => {
|
|
|
19
19
|
session = await getServerSession(event)
|
|
20
20
|
|
|
21
21
|
} catch (error) {
|
|
22
|
-
|
|
22
|
+
throw createError({ statusText: 'Unauthorized', status: 302 })
|
|
23
|
+
}
|
|
24
|
+
if(!session) {
|
|
25
|
+
throw createError({ statusText: 'Unauthorized', status: 302 })
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
return new Promise<any>(async (resolve, reject) => {
|
|
26
|
-
if(!session) {
|
|
27
|
-
//if(!session || !session.accessToken) {
|
|
28
|
-
reject({ statusMessage: 'Unauthorized', statusCode: 401 });
|
|
29
|
-
throw createError({ statusMessage: 'Unauthorized', statusCode: 401 })
|
|
30
|
-
}
|
|
31
|
-
// console.log("------hihi------")
|
|
32
|
-
const seperateSymbol = '.';
|
|
33
|
-
// const seperateSymbol = '&';
|
|
28
|
+
return new Promise<any>(async (resolve, reject) => {
|
|
34
29
|
const xOrg = event.context.params?.xorg ?? ''
|
|
35
30
|
const documentLink = event.context.params?._ ?? ''
|
|
36
|
-
// const platform = event.context.params?.platform ?? ''
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// console.error("event.context???",event.context)
|
|
40
31
|
const accessToken = session?.accessToken;
|
|
41
32
|
|
|
42
|
-
// const allowPlatform = ['report-api', 'cloudapi'];
|
|
43
|
-
// if(!key || !platform || !allowPlatform.includes(platform) || !accessToken) {
|
|
44
|
-
// reject({ statusMessage: 'Unauthorized', statusCode: 401 });
|
|
45
|
-
// // throw createError({ statusMessage: 'Unauthorized', statusCode: 401 })
|
|
46
|
-
// }
|
|
47
|
-
|
|
48
|
-
// let tenantKey = '', organizationKey = '';
|
|
49
|
-
// let xOrg = '';
|
|
50
|
-
|
|
51
|
-
// if(key !== 'system') {
|
|
52
|
-
// [tenantKey, organizationKey] = key.split(seperateSymbol);
|
|
53
|
-
// xOrg = `${tenantKey}/${organizationKey}/`;
|
|
54
|
-
// }
|
|
55
|
-
|
|
56
|
-
// if(key === 'system' && platform == 'cloudapi') {
|
|
57
|
-
// // xOrg = 'MC0wLTA'
|
|
58
|
-
// }
|
|
59
33
|
|
|
60
34
|
let forwardData: any = {};
|
|
61
|
-
|
|
62
35
|
const req = event.node.req;
|
|
63
|
-
|
|
64
|
-
if(req.method == 'POST' || req.method == 'PUT') {
|
|
36
|
+
if(req.method == 'POST' || req.method == 'PUT' || req.method == 'PATCH' ) {
|
|
65
37
|
|
|
66
38
|
forwardData = await readBody(event);
|
|
67
39
|
} else {
|
|
68
40
|
forwardData = getQuery(event);
|
|
69
41
|
}
|
|
70
42
|
|
|
71
|
-
// if(typeof forwardData === "object" && "_branch" in forwardData) {
|
|
72
|
-
// xOrg = xOrg + forwardData._branch;
|
|
73
|
-
// delete forwardData._branch;
|
|
74
|
-
// }
|
|
75
43
|
|
|
76
44
|
const frontEndRes = event.node.res;
|
|
77
45
|
const url = process.env.SIMPLEAPP_BACKEND_URL + '/' + documentLink;
|
|
78
|
-
// console.warn('backend server-----',req.method,url,forwardData)
|
|
79
46
|
const axiosConfig: any = {
|
|
80
47
|
method: req.method,
|
|
81
48
|
url: url,
|
|
@@ -115,7 +82,7 @@ export default defineEventHandler(async (event:any) => {
|
|
|
115
82
|
statusCode: 503,
|
|
116
83
|
});
|
|
117
84
|
}else if (error.response.status == 401) {
|
|
118
|
-
return sendRedirect(event, '/login',
|
|
85
|
+
return sendRedirect(event, '/login', 302)
|
|
119
86
|
}else{
|
|
120
87
|
const responseCode = error.response.data?.statusCode ? error.response.data.statusCode : error.response.status
|
|
121
88
|
const responseMsg = error.response.data ? error.response.data.message : error.response.statusText
|
|
@@ -21,43 +21,14 @@ export default defineEventHandler(async (event:any) => {
|
|
|
21
21
|
} catch (error) {
|
|
22
22
|
return sendRedirect(event, '/login', 401)
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
if(!session) {
|
|
25
|
+
throw createError({ statusText: 'Unauthorized', status: 302 })
|
|
26
|
+
}
|
|
25
27
|
return new Promise<any>(async (resolve, reject) => {
|
|
26
|
-
if(!session) {
|
|
27
|
-
//if(!session || !session.accessToken) {
|
|
28
|
-
reject({ statusMessage: 'Unauthorized', statusCode: 401 });
|
|
29
|
-
throw createError({ statusMessage: 'Unauthorized', statusCode: 401 })
|
|
30
|
-
}
|
|
31
|
-
//console.log("------hihi------",event.context.params)
|
|
32
28
|
|
|
33
29
|
const seperateSymbol = '.';
|
|
34
|
-
// const seperateSymbol = '&';
|
|
35
|
-
// const xOrg = event.context.params?.xorg ?? ''
|
|
36
30
|
const documentLink = event.context.params?._ ?? ''
|
|
37
|
-
// const platform = event.context.params?.platform ?? ''
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// console.error("event.context???",event.context)
|
|
41
31
|
const accessToken = session?.accessToken;
|
|
42
|
-
|
|
43
|
-
// const allowPlatform = ['report-api', 'cloudapi'];
|
|
44
|
-
// if(!key || !platform || !allowPlatform.includes(platform) || !accessToken) {
|
|
45
|
-
// reject({ statusMessage: 'Unauthorized', statusCode: 401 });
|
|
46
|
-
// // throw createError({ statusMessage: 'Unauthorized', statusCode: 401 })
|
|
47
|
-
// }
|
|
48
|
-
|
|
49
|
-
// let tenantKey = '', organizationKey = '';
|
|
50
|
-
// let xOrg = '';
|
|
51
|
-
|
|
52
|
-
// if(key !== 'system') {
|
|
53
|
-
// [tenantKey, organizationKey] = key.split(seperateSymbol);
|
|
54
|
-
// xOrg = `${tenantKey}/${organizationKey}/`;
|
|
55
|
-
// }
|
|
56
|
-
|
|
57
|
-
// if(key === 'system' && platform == 'cloudapi') {
|
|
58
|
-
// // xOrg = 'MC0wLTA'
|
|
59
|
-
// }
|
|
60
|
-
|
|
61
32
|
let forwardData: any = {};
|
|
62
33
|
|
|
63
34
|
const req = event.node.req;
|
|
@@ -20,6 +20,7 @@ type crudType = {
|
|
|
20
20
|
runFindOne: Function;
|
|
21
21
|
runCreate: Function;
|
|
22
22
|
runUpdate: Function;
|
|
23
|
+
runPatch: Function;
|
|
23
24
|
runDelete: Function;
|
|
24
25
|
runSearch: Function
|
|
25
26
|
};
|
|
@@ -97,7 +98,7 @@ export class SimpleAppClient<
|
|
|
97
98
|
// status:NotificationStatus.success
|
|
98
99
|
// })
|
|
99
100
|
this.data.value = { ...res.data };
|
|
100
|
-
return res;
|
|
101
|
+
return res.data;
|
|
101
102
|
}).catch((errors:any)=>{
|
|
102
103
|
// console.log(this.getDocName(),"-----failed")
|
|
103
104
|
$event('Notification',{
|
|
@@ -154,6 +155,37 @@ export class SimpleAppClient<
|
|
|
154
155
|
});
|
|
155
156
|
}
|
|
156
157
|
}
|
|
158
|
+
|
|
159
|
+
async patch() {
|
|
160
|
+
const {$event} =useNuxtApp()
|
|
161
|
+
const recordid: string = this.data.value._id ?? '';
|
|
162
|
+
return await this.docapi
|
|
163
|
+
.runPatch(recordid, this.data.value,{timeout:this.defaultTimeOut})
|
|
164
|
+
.then((res: AxiosResponse) => {
|
|
165
|
+
// if(this.event){this.event('success:update',res.data)}
|
|
166
|
+
// $event('Notification',{
|
|
167
|
+
// documentName:this.getDocName(),
|
|
168
|
+
// summary:'Record update success',
|
|
169
|
+
// status:NotificationStatus.success,
|
|
170
|
+
// data:errors
|
|
171
|
+
// })
|
|
172
|
+
this.data.value = res.data
|
|
173
|
+
return res.data;
|
|
174
|
+
}).catch((errors:any)=>{
|
|
175
|
+
$event('Notification',{
|
|
176
|
+
documentName:this.getDocName(),
|
|
177
|
+
summary:'Record patch failed',
|
|
178
|
+
status:NotificationStatus.error,
|
|
179
|
+
data:errors.response.data.data
|
|
180
|
+
})
|
|
181
|
+
// console.error('error:update---',errors,",---",errors.message)
|
|
182
|
+
// if(this.event){
|
|
183
|
+
// this.event('error:update',errors.response.data.data)}
|
|
184
|
+
console.error('error:patch',errors.response.data.data)
|
|
185
|
+
return Promise.reject(errors)
|
|
186
|
+
|
|
187
|
+
})
|
|
188
|
+
}
|
|
157
189
|
async delete(id?: string) {
|
|
158
190
|
if(!id){
|
|
159
191
|
id = this.data.value._id ?? ''
|
|
@@ -219,7 +251,14 @@ export class SimpleAppClient<
|
|
|
219
251
|
const tmp: { [key: string]: any } = {};
|
|
220
252
|
if (errors) {
|
|
221
253
|
for (let i = 0; i < errors?.length; i++) {
|
|
222
|
-
const
|
|
254
|
+
const err = errors[i]
|
|
255
|
+
let key: string = err.instancePath
|
|
256
|
+
if(err.keyword == 'required'){
|
|
257
|
+
key += `/${err.params.missingProperty}`
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
223
262
|
if (!tmp[key]) {
|
|
224
263
|
tmp[key] = [];
|
|
225
264
|
}
|
|
@@ -240,7 +279,7 @@ export class SimpleAppClient<
|
|
|
240
279
|
|
|
241
280
|
public getActions():FormActions{
|
|
242
281
|
const data:FormActions = {
|
|
243
|
-
crud:['
|
|
282
|
+
crud:['create','update','delete',],
|
|
244
283
|
docstatus:[],
|
|
245
284
|
api:[]
|
|
246
285
|
}
|
|
@@ -51,4 +51,11 @@ export type CalResource = ForeignKey & {
|
|
|
51
51
|
displayName: string; //use to display at calendar, undefine will use foreignkey label
|
|
52
52
|
email?: string; //for generate avatar only
|
|
53
53
|
};
|
|
54
|
-
|
|
54
|
+
export type CalViewClickSlotEvent = {
|
|
55
|
+
split:string
|
|
56
|
+
date:Date
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type CalViewChange = {
|
|
60
|
+
startDate: Date
|
|
61
|
+
}
|