@simitgroup/simpleapp-generator 1.6.2-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/README.md +6 -5
- package/dist/buildinschemas/branch.d.ts.map +1 -1
- package/dist/buildinschemas/branch.js +1 -2
- 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/index.js +4 -1
- package/dist/index.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 -2
- 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/index.ts +8 -3
- 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 +3 -6
- package/templates/basic/nuxt/pages.landing.vue.eta +2 -21
- 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 +36 -30
- 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 +128 -14
- 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/{app.vue._eta → app.vue.eta} +3 -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 +49 -7
- 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 +17 -14
- 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 +62 -22
- 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/ListDocument.vue.eta +10 -5
- package/templates/nuxt/components/list/ListDocumentTable.vue.eta +21 -13
- package/templates/nuxt/components/list/ListMessages.vue.eta +1 -1
- package/templates/nuxt/components/list/ListView.vue.eta +94 -56
- package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +11 -4
- package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +17 -6
- package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +16 -6
- package/templates/nuxt/components/page/PageDocList.vue.eta +108 -31
- 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 +76 -38
- package/templates/nuxt/components/session/SessionBlock.vue.eta +44 -46
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +61 -24
- package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +64 -0
- package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +26 -14
- 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 +128 -33
- 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/confirm.generate.ts.eta +19 -0
- package/templates/nuxt/composables/date.generate.ts.eta +106 -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 +54 -1
- package/templates/nuxt/composables/sysmessage.generate.ts.eta +1 -1
- package/templates/nuxt/pages/[xorg]/docnoformat.vue.eta +1 -1
- package/templates/nuxt/pages/[xorg]/mobile/docnoformat/{index.vue.eta → index.vue.etaxxx} +1 -1
- package/templates/nuxt/pages/[xorg]/mobile/user/{index.vue.eta → index.vue.etaxxx} +1 -1
- package/templates/nuxt/pages/[xorg]/{organization.vue.eta → organization.vue._eta} +39 -10
- package/templates/nuxt/pages/[xorg]/profile.vue.eta +1 -1
- package/templates/nuxt/pages/[xorg]/user.vue.eta +13 -10
- package/templates/nuxt/pages/login.vue._eta +4 -1
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +4 -0
- 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 +5 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +0 -38
- /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
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<OverlayViewer v-model="visible">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
<template #header>
|
|
4
|
+
<div class="flex flex-row gap-4">
|
|
5
|
+
<Chip
|
|
6
|
+
v-for="(v, k) in allview"
|
|
7
|
+
:label="v.label"
|
|
8
|
+
@remove="deleteTab"
|
|
9
|
+
:removable="lastDocumentName == v.documentName"
|
|
10
|
+
/>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
6
13
|
<div class="w-full h-full">
|
|
7
|
-
<!-- <div class="flex flex-row gap-4" v-if="allview.length>0">
|
|
8
|
-
<Chip
|
|
9
|
-
v-for="(v, k) in allview"
|
|
10
|
-
:label="v.label"
|
|
11
|
-
@remove="deleteTab"
|
|
12
|
-
:removable="true"
|
|
13
|
-
/>
|
|
14
|
-
</div> -->
|
|
15
|
-
|
|
16
14
|
<div
|
|
17
15
|
v-for="(v, k) in allview"
|
|
18
16
|
v-memo="[k]"
|
|
@@ -37,7 +35,6 @@
|
|
|
37
35
|
<script setup lang="ts">
|
|
38
36
|
/*
|
|
39
37
|
* This file was automatically generated by simpleapp generator during initialization. It is changable.
|
|
40
|
-
* --remove-this-line-to-prevent-override--
|
|
41
38
|
* last change 2024-02-22
|
|
42
39
|
* author: Ks Tan
|
|
43
40
|
*/
|
|
@@ -47,9 +44,18 @@ import { defineAsyncComponent } from "vue";
|
|
|
47
44
|
import { ViewRecord, FormCrudEvent } from "~/types";
|
|
48
45
|
// import TabView from 'primevue/tabview';
|
|
49
46
|
import Chip from "primevue/chip";
|
|
47
|
+
const lastDocumentName = computed(() => {
|
|
48
|
+
const keys = Object.keys(allview.value);
|
|
49
|
+
|
|
50
|
+
if (keys.length == 0) return "";
|
|
50
51
|
|
|
52
|
+
const keyname = keys[keys.length - 1];
|
|
53
|
+
|
|
54
|
+
return allview.value[keyname].documentName;
|
|
55
|
+
});
|
|
51
56
|
const { $listen } = useNuxtApp();
|
|
52
57
|
const visible = ref(false);
|
|
58
|
+
const autodeletetab = ref(true);
|
|
53
59
|
const allview = ref<{ [key: string]: ViewRecord }>({});
|
|
54
60
|
const after = (
|
|
55
61
|
v: ViewRecord,
|
|
@@ -58,10 +64,12 @@ const after = (
|
|
|
58
64
|
result: any,
|
|
59
65
|
) => {
|
|
60
66
|
if (v.after) {
|
|
61
|
-
v.after(eventType, data);
|
|
62
|
-
|
|
67
|
+
v.after(eventType, data, visible);
|
|
68
|
+
console.log("eventTypeeventType",eventType,"setting['autoclose'] ",autodeletetab.value)
|
|
63
69
|
//only after mount consider no remove tab
|
|
64
|
-
if (eventType
|
|
70
|
+
if (eventType == "mount") return
|
|
71
|
+
|
|
72
|
+
deleteTab();
|
|
65
73
|
}
|
|
66
74
|
};
|
|
67
75
|
|
|
@@ -73,18 +81,30 @@ onKeyStroke("Escape", (e) => {
|
|
|
73
81
|
const deleteTab = () => {
|
|
74
82
|
const keys = Object.keys(allview.value);
|
|
75
83
|
const lastkey = keys[keys.length - 1];
|
|
76
|
-
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
|
+
}
|
|
77
90
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
91
|
+
if(autodeletetab.value){
|
|
92
|
+
delete allview.value[lastkey];
|
|
93
|
+
visible.value = false;
|
|
94
|
+
useNuxtApp().$event("CloseDialog", "viewer");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
}else{
|
|
98
|
+
console.log("Trigger delete tab2")
|
|
99
|
+
delete allview.value[lastkey];
|
|
83
100
|
}
|
|
84
101
|
};
|
|
85
102
|
|
|
86
103
|
$listen("ViewRecord", (setting) => {
|
|
87
104
|
visible.value = true;
|
|
105
|
+
if (setting["autoclose"] != undefined) {
|
|
106
|
+
autodeletetab.value = setting["autoclose"] ==0 ? false : true;
|
|
107
|
+
}
|
|
88
108
|
allview.value[setting.eventId] = setting;
|
|
89
109
|
});
|
|
90
110
|
|
|
@@ -104,6 +124,26 @@ $listen("CloseDialog", (documentName: string) => {
|
|
|
104
124
|
// visible.value = true;
|
|
105
125
|
// allview.value[setting.eventId] = setting;
|
|
106
126
|
// });
|
|
127
|
+
//
|
|
128
|
+
const clearView = () => {
|
|
129
|
+
const firstId = Object.keys(allview.value)[0];
|
|
130
|
+
console.log("clear view", allview.value);
|
|
131
|
+
const callback = allview.value[firstId]?.after;
|
|
132
|
+
if (typeof callback == "function") {
|
|
133
|
+
callback(FormCrudEvent.exit, undefined, visible);
|
|
134
|
+
}
|
|
135
|
+
allview.value = {};
|
|
136
|
+
};
|
|
137
|
+
// watch(visible,()=>{
|
|
138
|
+
// if(visible.value==false){
|
|
139
|
+
// v.after(FormCrudEvent.exit, data,visible);
|
|
140
|
+
// }
|
|
141
|
+
// })
|
|
142
|
+
watch(visible, () => {
|
|
143
|
+
if (!visible.value) {
|
|
144
|
+
clearView();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
107
147
|
</script>
|
|
108
148
|
|
|
109
149
|
<style scoped>
|
|
@@ -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") {
|
|
@@ -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>
|
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
class="w-20 h-20 place-content-center"
|
|
6
6
|
@image-uploaded="handleBase64"
|
|
7
7
|
>
|
|
8
|
-
<Image :src="imageData"></Image>
|
|
8
|
+
<Image v-if="imageData!=''" :src="imageData"></Image>
|
|
9
|
+
<svg v-else xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="black" d="M21 10h-2V4h1V2H4v2h1v6H3a1 1 0 0 0-1 1v9h20v-9a1 1 0 0 0-1-1m-7 8v-4h-4v4H7V4h10v14z"/><path fill="black" d="M9 6h2v2H9zm4 0h2v2h-2zm-4 4h2v2H9zm4 0h2v2h-2z"/></svg>
|
|
9
10
|
</ImageToBase64Uploader>
|
|
10
|
-
<div v-else class="inline-block border rounded-lg w-20 h-20">
|
|
11
|
-
<Image :src="imageData"></Image>
|
|
11
|
+
<div v-else class="inline-block border rounded-lg w-20 h-20 bg-white">
|
|
12
|
+
<Image v-if="imageData!=''" :src="imageData"></Image>
|
|
13
|
+
<svg v-else xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="black" d="M21 10h-2V4h1V2H4v2h1v6H3a1 1 0 0 0-1 1v9h20v-9a1 1 0 0 0-1-1m-7 8v-4h-4v4H7V4h10v14z"/><path fill="black" d="M9 6h2v2H9zm4 0h2v2h-2zm-4 4h2v2H9zm4 0h2v2h-2z"/></svg>
|
|
12
14
|
</div>
|
|
13
15
|
</template>
|
|
14
16
|
<script lang="ts" setup>
|
|
@@ -22,7 +24,7 @@ const handleBase64 = async (data: string) => {
|
|
|
22
24
|
key: "organizationLogo",
|
|
23
25
|
value: data,
|
|
24
26
|
};
|
|
25
|
-
|
|
27
|
+
|
|
26
28
|
const uploadok = await useNuxtApp()
|
|
27
29
|
.$OrganizationDoc()
|
|
28
30
|
.getApi()
|
|
@@ -33,7 +35,7 @@ const handleBase64 = async (data: string) => {
|
|
|
33
35
|
};
|
|
34
36
|
const loadLogo = async () => {
|
|
35
37
|
await refreshOrgLogo();
|
|
36
|
-
imageData.value = getOrgLogo();
|
|
38
|
+
imageData.value = getOrgLogo();
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
onMounted(async () => await loadLogo());
|