@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
|
@@ -1,41 +1,51 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
</template>
|
|
10
|
-
<template #default>
|
|
11
|
-
<pre class="border rounder-lg m-0 p-0 dark:bg-gray-500">{{ modelValue }}
|
|
12
|
-
</pre>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
</Sidebar>
|
|
16
|
-
|
|
2
|
+
<div :class="`p-0 bg-yellow-200 dark:bg-yellow-700 rounded-lg border`" v-if="isdebug == '1'">
|
|
3
|
+
<div
|
|
4
|
+
@click="visible = true"
|
|
5
|
+
class="cursor-pointer text-xs p-0 m-0 flex flex-col p-2 text-center"
|
|
6
|
+
>
|
|
7
|
+
<i class="pi pi-code"></i>
|
|
8
|
+
<span>{{ label }}</span>
|
|
17
9
|
</div>
|
|
18
|
-
|
|
10
|
+
<Sidebar
|
|
11
|
+
v-model:visible="visible"
|
|
12
|
+
:pt="{ root: { class: 'w-5/6' } }"
|
|
13
|
+
class="text-red-100"
|
|
14
|
+
>
|
|
15
|
+
<template #header>
|
|
16
|
+
<h1 class="text-gray-700 text-lg font-bold content-center">
|
|
17
|
+
{{ label }} Data
|
|
18
|
+
</h1>
|
|
19
|
+
</template>
|
|
20
|
+
<template #default>
|
|
21
|
+
<pre class="border rounder-lg m-0 p-0 bg-gray-500 text-white"
|
|
22
|
+
>{{ modelValue }}
|
|
23
|
+
</pre
|
|
24
|
+
>
|
|
25
|
+
</template>
|
|
26
|
+
</Sidebar>
|
|
27
|
+
</div>
|
|
19
28
|
</template>
|
|
20
29
|
|
|
21
30
|
<script setup lang="ts">
|
|
22
31
|
/**
|
|
23
|
-
* This file was automatically generated by simpleapp generator during initialization.
|
|
32
|
+
* This file was automatically generated by simpleapp generator during initialization.
|
|
24
33
|
* IT IS NOT CHANGABLE
|
|
25
34
|
* last change 2024-02-22
|
|
26
35
|
* author: Ks Tan
|
|
27
36
|
*/
|
|
28
37
|
// import Panel from 'primevue/panel';
|
|
29
38
|
// import ScrollPanel from 'primevue/scrollpanel';
|
|
30
|
-
import Dialog from
|
|
31
|
-
import Sidebar from
|
|
39
|
+
import Dialog from "primevue/dialog";
|
|
40
|
+
import Sidebar from "primevue/sidebar";
|
|
32
41
|
|
|
33
|
-
import {ref} from
|
|
34
|
-
const modelValue = defineModel()
|
|
35
|
-
const isdebug = ref(useRuntimeConfig().public.DEBUGDATA)
|
|
36
|
-
const visible = ref(false)
|
|
37
|
-
const props = withDefaults(defineProps<{label?:string}>(),{
|
|
38
|
-
|
|
42
|
+
import { ref } from "vue";
|
|
43
|
+
const modelValue = defineModel();
|
|
44
|
+
const isdebug = ref(useRuntimeConfig().public.DEBUGDATA);
|
|
45
|
+
const visible = ref(false);
|
|
46
|
+
const props = withDefaults(defineProps<{ label?: string }>(), {
|
|
47
|
+
label: "label",
|
|
48
|
+
});
|
|
49
|
+
const buttonlabel = computed(() => props.label ?? "debug");
|
|
39
50
|
const op = ref();
|
|
40
|
-
|
|
41
51
|
</script>
|
|
@@ -35,14 +35,12 @@
|
|
|
35
35
|
<script setup lang="ts">
|
|
36
36
|
/*
|
|
37
37
|
* This file was automatically generated by simpleapp generator during initialization. It is changable.
|
|
38
|
-
* --remove-this-line-to-prevent-override--
|
|
39
38
|
* last change 2024-02-22
|
|
40
39
|
* author: Ks Tan
|
|
41
40
|
*/
|
|
42
41
|
import { onKeyStroke } from "@vueuse/core";
|
|
43
42
|
import { useDialog } from "primevue/usedialog";
|
|
44
43
|
import { defineAsyncComponent } from "vue";
|
|
45
|
-
|
|
46
44
|
import { ViewRecord, FormCrudEvent } from "~/types";
|
|
47
45
|
// import TabView from 'primevue/tabview';
|
|
48
46
|
import Chip from "primevue/chip";
|
|
@@ -57,6 +55,7 @@ const lastDocumentName = computed(() => {
|
|
|
57
55
|
});
|
|
58
56
|
const { $listen } = useNuxtApp();
|
|
59
57
|
const visible = ref(false);
|
|
58
|
+
const autodeletetab = ref(true);
|
|
60
59
|
const allview = ref<{ [key: string]: ViewRecord }>({});
|
|
61
60
|
const after = (
|
|
62
61
|
v: ViewRecord,
|
|
@@ -65,10 +64,12 @@ const after = (
|
|
|
65
64
|
result: any,
|
|
66
65
|
) => {
|
|
67
66
|
if (v.after) {
|
|
68
|
-
v.after(eventType, data);
|
|
69
|
-
|
|
67
|
+
v.after(eventType, data, visible);
|
|
68
|
+
|
|
70
69
|
//only after mount consider no remove tab
|
|
71
|
-
if (eventType
|
|
70
|
+
if (eventType == "mount") return;
|
|
71
|
+
else if(eventType=='setDocStatus') return;
|
|
72
|
+
deleteTab();
|
|
72
73
|
}
|
|
73
74
|
};
|
|
74
75
|
|
|
@@ -80,18 +81,29 @@ onKeyStroke("Escape", (e) => {
|
|
|
80
81
|
const deleteTab = () => {
|
|
81
82
|
const keys = Object.keys(allview.value);
|
|
82
83
|
const lastkey = keys[keys.length - 1];
|
|
83
|
-
delete
|
|
84
|
+
// console.log("Trigger delete tab");
|
|
85
|
+
if (keys.length == 1) {
|
|
86
|
+
const callback = allview.value[lastkey]?.after;
|
|
87
|
+
if (typeof callback == "function") {
|
|
88
|
+
callback(FormCrudEvent.exit, undefined, visible);
|
|
89
|
+
}
|
|
84
90
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
if (autodeletetab.value) {
|
|
92
|
+
delete allview.value[lastkey];
|
|
93
|
+
visible.value = false;
|
|
94
|
+
useNuxtApp().$event("CloseDialog", "viewer");
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
// console.log("Trigger delete tab2");
|
|
98
|
+
delete allview.value[lastkey];
|
|
90
99
|
}
|
|
91
100
|
};
|
|
92
101
|
|
|
93
102
|
$listen("ViewRecord", (setting) => {
|
|
94
103
|
visible.value = true;
|
|
104
|
+
if (setting["autoclose"] != undefined) {
|
|
105
|
+
autodeletetab.value = setting["autoclose"] == 0 ? false : true;
|
|
106
|
+
}
|
|
95
107
|
allview.value[setting.eventId] = setting;
|
|
96
108
|
});
|
|
97
109
|
|
|
@@ -113,11 +125,21 @@ $listen("CloseDialog", (documentName: string) => {
|
|
|
113
125
|
// });
|
|
114
126
|
//
|
|
115
127
|
const clearView = () => {
|
|
128
|
+
const firstId = Object.keys(allview.value)[0];
|
|
129
|
+
// console.log("clear view", allview.value);
|
|
130
|
+
const callback = allview.value[firstId]?.after;
|
|
131
|
+
if (typeof callback == "function") {
|
|
132
|
+
callback(FormCrudEvent.exit, undefined, visible);
|
|
133
|
+
}
|
|
116
134
|
allview.value = {};
|
|
117
135
|
};
|
|
118
|
-
|
|
136
|
+
// watch(visible,()=>{
|
|
137
|
+
// if(visible.value==false){
|
|
138
|
+
// v.after(FormCrudEvent.exit, data,visible);
|
|
139
|
+
// }
|
|
140
|
+
// })
|
|
119
141
|
watch(visible, () => {
|
|
120
|
-
if (visible.value
|
|
142
|
+
if (!visible.value) {
|
|
121
143
|
clearView();
|
|
122
144
|
}
|
|
123
145
|
});
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
:document="doc"
|
|
8
8
|
@on="actionListener"
|
|
9
9
|
></SimpleAppFormToolBar>
|
|
10
|
-
<div
|
|
11
|
-
class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 p-2"
|
|
12
|
-
>
|
|
10
|
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4 p-2">
|
|
13
11
|
<SimpleAppInput
|
|
14
12
|
:input-type="SimpleAppInputType.text"
|
|
15
13
|
:setting="o.getField('#/properties/branchName')"
|
|
@@ -27,7 +25,53 @@
|
|
|
27
25
|
:setting="o.getField('#/properties/active')"
|
|
28
26
|
v-model="data.active"
|
|
29
27
|
/>
|
|
28
|
+
<SimpleAppInput
|
|
29
|
+
:input-type="SimpleAppInputType.selectmultiple"
|
|
30
|
+
:setting="o.getField('#/properties/offdays')"
|
|
31
|
+
v-model="data.offdays"
|
|
32
|
+
/>
|
|
33
|
+
|
|
34
|
+
<SimpleAppInput
|
|
35
|
+
:input-type="SimpleAppInputType.text"
|
|
36
|
+
:setting="o.getField('#/properties/street1')"
|
|
37
|
+
v-model="data.street1"
|
|
38
|
+
/>
|
|
39
|
+
<SimpleAppInput
|
|
40
|
+
:input-type="SimpleAppInputType.text"
|
|
41
|
+
:setting="o.getField('#/properties/street2')"
|
|
42
|
+
v-model="data.street2"
|
|
43
|
+
/>
|
|
30
44
|
|
|
45
|
+
<SimpleAppInput
|
|
46
|
+
:input-type="SimpleAppInputType.text"
|
|
47
|
+
:setting="o.getField('#/properties/postcode')"
|
|
48
|
+
v-model="data.postcode"
|
|
49
|
+
/>
|
|
50
|
+
<SimpleAppInput
|
|
51
|
+
:input-type="SimpleAppInputType.text"
|
|
52
|
+
:setting="o.getField('#/properties/city')"
|
|
53
|
+
v-model="data.city"
|
|
54
|
+
/>
|
|
55
|
+
<SimpleAppInput
|
|
56
|
+
:input-type="SimpleAppInputType.text"
|
|
57
|
+
:setting="o.getField('#/properties/region')"
|
|
58
|
+
v-model="data.region"
|
|
59
|
+
/>
|
|
60
|
+
<SimpleAppInput
|
|
61
|
+
:input-type="SimpleAppInputType.text"
|
|
62
|
+
:setting="o.getField('#/properties/country')"
|
|
63
|
+
v-model="data.country"
|
|
64
|
+
/>
|
|
65
|
+
<SimpleAppInput
|
|
66
|
+
:input-type="SimpleAppInputType.text"
|
|
67
|
+
:setting="o.getField('#/properties/tel')"
|
|
68
|
+
v-model="data.tel"
|
|
69
|
+
/>
|
|
70
|
+
<SimpleAppInput
|
|
71
|
+
:input-type="SimpleAppInputType.text"
|
|
72
|
+
:setting="o.getField('#/properties/email')"
|
|
73
|
+
v-model="data.email"
|
|
74
|
+
/>
|
|
31
75
|
<SimpleAppInput
|
|
32
76
|
:input-type="SimpleAppInputType.textarea"
|
|
33
77
|
:setting="o.getField('#/properties/description')"
|
|
@@ -41,8 +85,7 @@
|
|
|
41
85
|
|
|
42
86
|
<script setup lang="ts">
|
|
43
87
|
/**
|
|
44
|
-
* This file was automatically generated by simpleapp generator during initialization.
|
|
45
|
-
* --remove-this-line-to-prevent-override--
|
|
88
|
+
* This file was automatically generated by simpleapp generator during initialization.
|
|
46
89
|
* last change 2024-02-22
|
|
47
90
|
* author: Ks Tan
|
|
48
91
|
*/
|
|
@@ -69,6 +112,10 @@ const getRecord = async () => {
|
|
|
69
112
|
await doc.getById(id.value);
|
|
70
113
|
} else {
|
|
71
114
|
newData();
|
|
115
|
+
data.value.organization={
|
|
116
|
+
_id:getUserProfile()?.orgRecordId,
|
|
117
|
+
label:getUserProfile()?.orgName
|
|
118
|
+
}
|
|
72
119
|
}
|
|
73
120
|
};
|
|
74
121
|
|
|
@@ -8,13 +8,21 @@
|
|
|
8
8
|
@on="actionListener"
|
|
9
9
|
></SimpleAppFormToolBar>
|
|
10
10
|
<div
|
|
11
|
-
class="grid grid-cols-1
|
|
11
|
+
class="grid grid-cols-1 lg:grid-cols-2 gap-4 p-2"
|
|
12
12
|
>
|
|
13
13
|
<SimpleAppInput
|
|
14
14
|
:input-type="SimpleAppInputType.autocomplete"
|
|
15
15
|
:setting="o.getField('#/properties/branch')"
|
|
16
16
|
v-model="data.branch"
|
|
17
17
|
/>
|
|
18
|
+
<SimpleAppInput
|
|
19
|
+
:readonly="!doc.isNew()"
|
|
20
|
+
:input-type="SimpleAppInputType.select"
|
|
21
|
+
:setting="o.getField('#/properties/docNoType')"
|
|
22
|
+
:options="getAllDocFormats().map((item) => item.docType)"
|
|
23
|
+
v-model="data.docNoType"
|
|
24
|
+
/>
|
|
25
|
+
|
|
18
26
|
|
|
19
27
|
<SimpleAppInput
|
|
20
28
|
:input-type="SimpleAppInputType.text"
|
|
@@ -39,14 +47,7 @@
|
|
|
39
47
|
v-model="data.default"
|
|
40
48
|
/>
|
|
41
49
|
|
|
42
|
-
|
|
43
|
-
:readonly="!doc.isNew()"
|
|
44
|
-
:input-type="SimpleAppInputType.select"
|
|
45
|
-
:setting="o.getField('#/properties/docNoType')"
|
|
46
|
-
:options="getAllDocFormats().map((item) => item.docType)"
|
|
47
|
-
v-model="data.docNoType"
|
|
48
|
-
/>
|
|
49
|
-
|
|
50
|
+
|
|
50
51
|
<SimpleAppInput
|
|
51
52
|
:input-type="SimpleAppInputType.text"
|
|
52
53
|
:setting="o.getField('#/properties/docNoPattern')"
|
|
@@ -91,7 +92,10 @@ const id = computed(() => props._id ?? "");
|
|
|
91
92
|
|
|
92
93
|
/************ start default methods ****************/
|
|
93
94
|
|
|
94
|
-
const newData = () =>
|
|
95
|
+
const newData = () => {
|
|
96
|
+
doc.setNew()
|
|
97
|
+
delete data.value.branch
|
|
98
|
+
}
|
|
95
99
|
|
|
96
100
|
const getRecord = async () => {
|
|
97
101
|
if (id.value && id.value != "new") {
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
<title v-if="id">{{ data.fullName ?? data.email }}</title>
|
|
8
8
|
<TabView lazy>
|
|
9
9
|
<TabPanel :header="t('profile')">
|
|
10
|
-
<div
|
|
11
|
-
class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 p-2"
|
|
12
|
-
>
|
|
10
|
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4 p-2">
|
|
13
11
|
<SimpleAppInput
|
|
14
12
|
:input-type="SimpleAppInputType.text"
|
|
15
13
|
:setting="o.getField('#/properties/fullName')"
|
|
@@ -37,7 +35,7 @@
|
|
|
37
35
|
/>
|
|
38
36
|
</div>
|
|
39
37
|
|
|
40
|
-
<DebugDocumentData v-model="data" :label="doc.getDocName()" />
|
|
38
|
+
<!-- <DebugDocumentData v-model="data" :label="doc.getDocName()" /> -->
|
|
41
39
|
</TabPanel>
|
|
42
40
|
<TabPanel :header="t('permission')">
|
|
43
41
|
<!-- <UserButtonPermissionInfo></UserButtonPermissionInfo> -->
|
|
@@ -1,83 +1,101 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
2
|
+
<div class="w-full">
|
|
3
|
+
<UserButtonPermissionInfo/>
|
|
3
4
|
<div v-for="(b, index) in branchList" :key="index" class="flex flex-col">
|
|
4
|
-
<div>{{ b.branchName }}</div>
|
|
5
|
-
<div>
|
|
6
|
-
<SelectButton
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
<div>{{ b.branchName }}</div>
|
|
6
|
+
<div>
|
|
7
|
+
<SelectButton
|
|
8
|
+
:options="grouplist"
|
|
9
|
+
v-model="permdata[b.branchId ?? 0].groups"
|
|
10
|
+
@update:model-value="updatePermission($event, b.branchId ?? 0)"
|
|
11
|
+
multiple
|
|
12
|
+
option-value="value"
|
|
13
|
+
option-label="label"
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
10
16
|
</div>
|
|
11
17
|
</div>
|
|
12
18
|
</template>
|
|
13
19
|
<script lang="ts" setup>
|
|
14
|
-
import {
|
|
15
|
-
|
|
20
|
+
import {
|
|
21
|
+
Branch,
|
|
22
|
+
Permission,
|
|
23
|
+
UserPermission,
|
|
24
|
+
} from "~/simpleapp/generate/openapi";
|
|
25
|
+
import _ from "lodash";
|
|
16
26
|
const props = defineProps<{ id: string }>();
|
|
17
27
|
const perm = useNuxtApp().$PermissionDoc();
|
|
18
|
-
const branchList = ref<Branch[]>()
|
|
19
|
-
const branch = useNuxtApp().$BranchDoc()
|
|
28
|
+
const branchList = ref<Branch[]>();
|
|
29
|
+
const branch = useNuxtApp().$BranchDoc();
|
|
20
30
|
const grouplist = getAllGroups().map((item) => {
|
|
21
31
|
return { value: item, label: _.capitalize(item) };
|
|
22
32
|
});
|
|
23
33
|
const orgs = ref<UserPermission[]>();
|
|
24
|
-
const selectedGroup=ref()
|
|
25
|
-
type PermDataType = {[key:number]: {groups?:string[]
|
|
26
|
-
const permdata=ref<PermDataType>({})
|
|
27
|
-
const loadBranches = async ()=>{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
const selectedGroup = ref();
|
|
35
|
+
type PermDataType = { [key: number]: { groups?: string[]; permId?: string } };
|
|
36
|
+
const permdata = ref<PermDataType>({});
|
|
37
|
+
const loadBranches = async () => {
|
|
38
|
+
branchList.value = await branch.search({
|
|
39
|
+
filter: { orgId: getUserProfile()?.orgId },
|
|
40
|
+
fields: ["branchCode", "branchName", "active", "branchId"],
|
|
41
|
+
sorts: [["branchCode", "asc"]],
|
|
42
|
+
});
|
|
33
43
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
44
|
+
branchList.value?.forEach((b) => {
|
|
45
|
+
const branchId: number = b.branchId ?? 0;
|
|
46
|
+
permdata.value[branchId] = { groups: [], permId: "" };
|
|
47
|
+
});
|
|
48
|
+
};
|
|
39
49
|
const loadPermission = async () => {
|
|
40
|
-
const permissions:Permission[] = await perm.search({
|
|
41
|
-
filter:{userId:props.id},
|
|
42
|
-
fields:[
|
|
43
|
-
})
|
|
44
|
-
console.log("load permissions"
|
|
45
|
-
permissions.forEach(p=>{
|
|
46
|
-
console.log("PPP",p)
|
|
47
|
-
if(p.branchId && permdata.value[p.branchId]){
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
const permissions: Permission[] = await perm.search({
|
|
51
|
+
filter: { userId: props.id },
|
|
52
|
+
fields: ["groups", "userId", "uid", "branchId"],
|
|
53
|
+
});
|
|
54
|
+
console.log("load permissions", permissions);
|
|
55
|
+
permissions.forEach((p) => {
|
|
56
|
+
console.log("PPP", p);
|
|
57
|
+
if (p.branchId && permdata.value[p.branchId]) {
|
|
58
|
+
permdata.value[p.branchId].groups = p.groups ?? [];
|
|
59
|
+
permdata.value[p.branchId].permId = p._id;
|
|
50
60
|
}
|
|
51
|
-
})
|
|
61
|
+
});
|
|
52
62
|
};
|
|
53
|
-
const updatePermission = async (newgroups:string[],branchId:number)=>{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if(permdata.value[branchId] && permdata.value[branchId].permId){
|
|
65
|
-
await perm.update()
|
|
66
|
-
}else{
|
|
67
|
-
await perm.create()
|
|
63
|
+
const updatePermission = async (newgroups: string[], branchId: number) => {
|
|
64
|
+
const data = perm.getReactiveData();
|
|
65
|
+
const userdoc = useNuxtApp().$UserDoc()
|
|
66
|
+
await userdoc.getById(props.id);
|
|
67
|
+
const userdata = userdoc.getReactiveData()
|
|
68
|
+
console.log("userdata",userdata.value)
|
|
69
|
+
|
|
70
|
+
if (permdata.value[branchId] && permdata.value[branchId].permId) {
|
|
71
|
+
await perm.getById(permdata.value[branchId].permId);
|
|
72
|
+
if(!data.value.uid && userdata.value.uid){
|
|
73
|
+
data.value.uid = userdata.value.uid
|
|
68
74
|
}
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
} else {
|
|
76
|
+
data.value._id = randomUUID();
|
|
77
|
+
data.value.userId = props.id;
|
|
78
|
+
data.value.uid = userdata.value.uid
|
|
79
|
+
data.value.branchId = branchId
|
|
80
|
+
}
|
|
81
|
+
data.value.groups = newgroups;
|
|
82
|
+
// console.log("data",data.value)
|
|
83
|
+
// return false
|
|
84
|
+
if (permdata.value[branchId] && permdata.value[branchId].permId) {
|
|
85
|
+
await perm.update();
|
|
86
|
+
} else {
|
|
87
|
+
await perm.create();
|
|
88
|
+
}
|
|
89
|
+
await loadPermission();
|
|
90
|
+
};
|
|
71
91
|
onMounted(async () => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
92
|
+
await loadBranches();
|
|
93
|
+
await loadPermission();
|
|
75
94
|
});
|
|
76
95
|
watch(
|
|
77
96
|
() => props.id,
|
|
78
97
|
async () => {
|
|
79
|
-
await loadPermission()
|
|
80
|
-
|
|
81
|
-
}
|
|
98
|
+
await loadPermission();
|
|
99
|
+
},
|
|
82
100
|
);
|
|
83
101
|
</script>
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<select
|
|
4
|
+
v-if="selectedbranch"
|
|
5
|
+
v-model="selectedbranch"
|
|
6
|
+
style="background: transparent; border: none;"
|
|
7
|
+
class="text-right pt-3 pb-3 text-lg"
|
|
8
|
+
@change="switchXorg()"
|
|
9
|
+
>
|
|
10
|
+
<optgroup v-for="o in orgList" :label="o.label">
|
|
11
|
+
<option v-for="b in getBranchesForOrg(o)" :value="b['xOrg']">
|
|
12
|
+
{{ b["branch"]["branchCode"] }}
|
|
13
|
+
</option>
|
|
14
|
+
</optgroup>
|
|
15
|
+
</select>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
1
19
|
<script setup lang="ts">
|
|
2
20
|
/**
|
|
3
21
|
* This file was automatically generated by simpleapp generator. Every
|
|
@@ -5,42 +23,31 @@
|
|
|
5
23
|
* last change 2023-10-28
|
|
6
24
|
* Author: Ks Tan
|
|
7
25
|
*/
|
|
8
|
-
import _ from
|
|
9
|
-
import {ref} from
|
|
26
|
+
import _ from "lodash";
|
|
27
|
+
import { ref } from "vue";
|
|
10
28
|
|
|
11
|
-
const selectedbranch = ref(getCurrentXorg())
|
|
12
|
-
const currentTenant=ref(getUserProfile()
|
|
13
|
-
|
|
14
|
-
type Org = {orgId:number, label:string,_id:string}
|
|
15
|
-
const branches = getUserProfile().branches.filter((item:any)=>{return item.branch.tenantId == currentTenant.value})
|
|
16
|
-
const orgList:Org[] = _.uniqBy(branches,'branch.orgId').map((item)=>({
|
|
17
|
-
_id:item['branch']['organization']['_id'],
|
|
18
|
-
orgId:item['branch']['orgId'],
|
|
19
|
-
label:item['branch']['organization']['label']}))
|
|
20
|
-
// console.log("orgList",orgList)
|
|
21
|
-
const getBranchesForOrg = (org:Org)=>{
|
|
22
|
-
const branchlist = branches.filter((item,index)=>{
|
|
23
|
-
// console.log(org['orgId'] ,'===', item['branch']['orgId'])
|
|
24
|
-
return org['orgId'] === item['branch']['orgId']
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
return branchlist
|
|
28
|
-
}
|
|
29
|
-
const switchXorg = ()=>{
|
|
30
|
-
navigateTo(`/${selectedbranch.value}`,{external:true})
|
|
31
|
-
}
|
|
29
|
+
const selectedbranch = ref(getCurrentXorg());
|
|
30
|
+
const currentTenant = ref(getUserProfile()?.tenantId);
|
|
32
31
|
|
|
32
|
+
type Org = { orgId: number; label: string; _id: string };
|
|
33
|
+
const branches = getUserProfile()?.branches.filter((item: any) => {
|
|
34
|
+
return item.branch.tenantId == currentTenant.value;
|
|
35
|
+
});
|
|
36
|
+
const orgList: Org[] = _.uniqBy(branches, "branch.orgId").map((item) => ({
|
|
37
|
+
_id: item["branch"]["organization"]["_id"],
|
|
38
|
+
orgId: item["branch"]["orgId"],
|
|
39
|
+
label: item["branch"]["organization"]["label"],
|
|
40
|
+
}));
|
|
41
|
+
// console.log("orgList",orgList)
|
|
42
|
+
const getBranchesForOrg = (org: Org) => {
|
|
43
|
+
const branchlist = branches.filter((item, index) => {
|
|
44
|
+
// console.log(org['orgId'] ,'===', item['branch']['orgId'])
|
|
45
|
+
return org["orgId"] === item["branch"]["orgId"];
|
|
46
|
+
});
|
|
33
47
|
|
|
48
|
+
return branchlist;
|
|
49
|
+
};
|
|
50
|
+
const switchXorg = () => {
|
|
51
|
+
navigateTo(`/${selectedbranch.value}`, { external: true });
|
|
52
|
+
};
|
|
34
53
|
</script>
|
|
35
|
-
<template>
|
|
36
|
-
<div>
|
|
37
|
-
|
|
38
|
-
<select v-if="selectedbranch" v-model="selectedbranch" class=" text-right" @change="switchXorg()">
|
|
39
|
-
<optgroup v-for="o in orgList" :label="o.label">
|
|
40
|
-
<option v-for="b in getBranchesForOrg(o)" :value="b['xOrg']">{{ b['branch']['branchCode']}} </option>
|
|
41
|
-
</optgroup>
|
|
42
|
-
|
|
43
|
-
</select>
|
|
44
|
-
</div>
|
|
45
|
-
|
|
46
|
-
</template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="inline-block border rounded-lg w-20 h-20 bg-white">
|
|
3
|
+
<Avatar v-if="email"
|
|
4
|
+
:image="getAvatarLink(<string>email, size)"
|
|
5
|
+
shape="circle"
|
|
6
|
+
size="xlarge"
|
|
7
|
+
/>
|
|
8
|
+
<Avatar v-else-if="id"
|
|
9
|
+
:image="getAvatarByUid(<string>id, size)"
|
|
10
|
+
shape="circle"
|
|
11
|
+
size="xlarge"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
</template>
|
|
17
|
+
<script lang="ts" setup>
|
|
18
|
+
/**
|
|
19
|
+
* This file was automatically generated by simpleapp generator during initialization.
|
|
20
|
+
* --remove-this-line-to-prevent-override--
|
|
21
|
+
* last change 2024-04-06
|
|
22
|
+
* author: Ks Tan
|
|
23
|
+
*/
|
|
24
|
+
const props = defineProps<{
|
|
25
|
+
email?: string;
|
|
26
|
+
id?: string;
|
|
27
|
+
size: number;
|
|
28
|
+
}>();
|
|
29
|
+
|
|
30
|
+
</script>
|