@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,56 +1,92 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
2
|
+
<div>
|
|
3
|
+
<button class="" @click="previewPermission">
|
|
4
|
+
<i class="pi pi-question-circle"></i>
|
|
5
|
+
</button>
|
|
6
|
+
<Sidebar
|
|
7
|
+
v-model:visible="showpermissioninfo"
|
|
8
|
+
modal
|
|
9
|
+
:pt="{ root: { class: 'w-2/3' } }"
|
|
10
|
+
:header="permissiontitle"
|
|
11
|
+
position="right"
|
|
12
|
+
>
|
|
13
|
+
<SelectButton
|
|
14
|
+
v-model="selectedgroup"
|
|
15
|
+
@change="selectGroup"
|
|
16
|
+
:options="grouplist"
|
|
17
|
+
option-label="label"
|
|
18
|
+
option-value="value"
|
|
19
|
+
></SelectButton>
|
|
20
|
+
<div v-if="selectedgroup">
|
|
21
|
+
<div
|
|
22
|
+
v-if="useRuntimeConfig().public.DEBUGDATA"
|
|
23
|
+
class="flex flex-row gap-2 p-2"
|
|
24
|
+
>
|
|
25
|
+
<div class="flex align-items-center">
|
|
26
|
+
<RadioButton
|
|
27
|
+
v-model="mode"
|
|
28
|
+
inputId="modepreview"
|
|
29
|
+
name="pizza"
|
|
30
|
+
value="preview"
|
|
31
|
+
/>
|
|
32
|
+
<label for="modepreview" class="ml-2">Preview</label>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="flex align-items-center">
|
|
35
|
+
<RadioButton
|
|
36
|
+
v-model="mode"
|
|
37
|
+
inputId="modeedit"
|
|
38
|
+
name="edit"
|
|
39
|
+
value="edit"
|
|
40
|
+
/>
|
|
41
|
+
<label for="modeedit" class="ml-2">Edit</label>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="flex align-items-center">
|
|
44
|
+
<RadioButton
|
|
45
|
+
v-model="mode"
|
|
46
|
+
inputId="modejson"
|
|
47
|
+
name="json"
|
|
48
|
+
value="json"
|
|
49
|
+
/>
|
|
50
|
+
<label for="modejson" class="ml-2">JSON</label>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
<div v-if="mode == 'json'">
|
|
54
|
+
<div class="flex-row">
|
|
55
|
+
<div><Button @click="copyText">copy</Button></div>
|
|
56
|
+
<div class="text text-gray-400">{{ copied }}</div>
|
|
57
|
+
</div>
|
|
58
|
+
<pre id="permissionstr">
|
|
59
|
+
{{ computedpermissions }}
|
|
60
|
+
</pre
|
|
61
|
+
>
|
|
62
|
+
</div>
|
|
63
|
+
<div
|
|
64
|
+
class="permission-block flex flex-col m mt-4"
|
|
65
|
+
v-for="res in allresources"
|
|
66
|
+
v-else="showjson"
|
|
67
|
+
>
|
|
68
|
+
<div class="m mr-3">{{ res }}</div>
|
|
69
|
+
<div class="gap-4" v-if="allactions" >
|
|
70
|
+
<SelectButton
|
|
71
|
+
v-if="mode == 'edit'"
|
|
72
|
+
multiple
|
|
73
|
+
:options="allactions[res]"
|
|
74
|
+
v-model="permissions[res]"
|
|
75
|
+
></SelectButton>
|
|
76
|
+
|
|
77
|
+
<span v-else v-for="actionname in allactions[res]" class="m m-1">
|
|
78
|
+
<Chip
|
|
79
|
+
class="bg-primary-600 text-white"
|
|
80
|
+
v-if="canPerformAction(selectedgroup, res, actionname)"
|
|
81
|
+
severity="success"
|
|
82
|
+
:label="t(actionname)"
|
|
83
|
+
></Chip>
|
|
84
|
+
<Chip v-else :label="t(actionname)"></Chip>
|
|
85
|
+
</span>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</Sidebar>
|
|
54
90
|
</div>
|
|
55
91
|
</template>
|
|
56
92
|
<script setup lang="ts">
|
|
@@ -61,54 +97,61 @@
|
|
|
61
97
|
* Author: Ks Tan
|
|
62
98
|
*/
|
|
63
99
|
import _ from "lodash";
|
|
64
|
-
import Chip from
|
|
65
|
-
import RadioButton from
|
|
66
|
-
import {ref} from
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const showpermissioninfo = ref(false)
|
|
100
|
+
import Chip from "primevue/chip";
|
|
101
|
+
import RadioButton from "primevue/radiobutton";
|
|
102
|
+
import { ref } from "vue";
|
|
103
|
+
const isdebug = ref(useRuntimeConfig().public.DEBUGDATA);
|
|
104
|
+
const showpermissioninfo = ref(false);
|
|
70
105
|
const permissiontitle = "Permission Information";
|
|
71
|
-
const selectedgroup = ref(
|
|
72
|
-
const grouplist = getAllGroups().map((item)=>
|
|
73
|
-
|
|
106
|
+
const selectedgroup = ref("");
|
|
107
|
+
const grouplist = getAllGroups().map((item) => {
|
|
108
|
+
return { value: item, label: _.capitalize(item) };
|
|
109
|
+
});
|
|
110
|
+
const mode = ref("preview");
|
|
74
111
|
|
|
75
|
-
const allresources = getUniqueResource()
|
|
76
|
-
const allactions = ref()
|
|
77
|
-
const permissions=ref()
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
const
|
|
112
|
+
const allresources = getUniqueResource();
|
|
113
|
+
const allactions = ref();
|
|
114
|
+
const permissions = ref<{ [key: string]: string[] }>();
|
|
115
|
+
const computedpermissions = computed(() => {
|
|
116
|
+
const tmp: { [key: string]: string[] } = {};
|
|
117
|
+
for (const keyname in permissions.value) {
|
|
118
|
+
if (permissions.value[keyname].length > 0)
|
|
119
|
+
tmp[keyname] = permissions.value[keyname];
|
|
120
|
+
}
|
|
121
|
+
return tmp;
|
|
122
|
+
// return permissions.value.filter((item:string[],key:string)=>item.length>0)
|
|
123
|
+
});
|
|
124
|
+
const activeroles = ref();
|
|
125
|
+
const copied = ref("");
|
|
81
126
|
|
|
82
127
|
const previewPermission = () => {
|
|
83
128
|
showpermissioninfo.value = true;
|
|
84
129
|
};
|
|
85
130
|
|
|
86
|
-
|
|
87
131
|
const copyText = () => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
</script>
|
|
132
|
+
copied.value = "copied!";
|
|
133
|
+
const storage = document.createElement("textarea");
|
|
134
|
+
storage.value = String(document.getElementById("permissionstr")?.innerHTML);
|
|
135
|
+
document.body.appendChild(storage);
|
|
136
|
+
storage.select();
|
|
137
|
+
storage.setSelectionRange(0, 99999);
|
|
138
|
+
document.execCommand("copy");
|
|
139
|
+
document.body.removeChild(storage);
|
|
140
|
+
};
|
|
141
|
+
const selectGroup = (selectedgroup: any) => {
|
|
142
|
+
const groupname = selectedgroup.value;
|
|
143
|
+
activeroles.value = getGroupRoles(groupname);
|
|
144
|
+
allactions.value = {};
|
|
145
|
+
permissions.value = {};
|
|
146
|
+
for (let i = 0; i < allresources.length; i++) {
|
|
147
|
+
const r = allresources[i];
|
|
148
|
+
// console.log(r);
|
|
149
|
+
const actions = getActionFromResource(r);
|
|
150
|
+
allactions.value[r] = actions;
|
|
151
|
+
permissions.value[r] = getGroupResourcePermission(groupname, r).map(
|
|
152
|
+
(item) => item.action,
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
console.log(allactions.value, permissions.value);
|
|
156
|
+
};
|
|
157
|
+
</script>
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Dialog
|
|
2
|
+
<Dialog
|
|
3
|
+
v-model:visible="visible"
|
|
4
|
+
modal
|
|
5
|
+
:header="popuptitle"
|
|
6
|
+
class="crudsimple-dialog">
|
|
3
7
|
<div v-if="invites">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</div>
|
|
8
|
+
<div
|
|
9
|
+
v-for="item in invites"
|
|
10
|
+
class="w w-auto p p-2 grid grid-cols-3 hover-list-primary border"
|
|
11
|
+
>
|
|
12
|
+
<div class="flex flex-col col-span-2">
|
|
13
|
+
<div class="font font-bold">{{ item.tenantName }}</div>
|
|
14
|
+
<div class="text text-xs text-gray-500 italic">
|
|
15
|
+
{{ item.created }}
|
|
16
|
+
</div>
|
|
14
17
|
</div>
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
<div class="flex flex-row gap-2">
|
|
19
|
+
<ButtonPrimary @click="approve(item._id)"
|
|
20
|
+
>{{t('approve')}}</ButtonPrimary
|
|
21
|
+
>
|
|
22
|
+
<ButtonDanger @click="decline(item._id)">{{t('decline')}}</ButtonDanger>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</Dialog>
|
|
17
27
|
</template>
|
|
18
28
|
<script setup lang="ts">
|
|
19
29
|
/**
|
|
@@ -22,35 +32,33 @@
|
|
|
22
32
|
* last change 2023-10-28
|
|
23
33
|
* Author: Ks Tan
|
|
24
34
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
</script>
|
|
35
|
+
import Dialog from "primevue/dialog";
|
|
36
|
+
import { onMounted, ref } from "vue";
|
|
37
|
+
import { EventType } from "../types";
|
|
38
|
+
import ProgressSpinner from "primevue/progressspinner";
|
|
39
|
+
const { $userstore, $event } = useNuxtApp();
|
|
40
|
+
const disabled = ref(false);
|
|
41
|
+
const visible = ref(false);
|
|
42
|
+
const invites = ref();
|
|
43
|
+
const invitationmsg = "There is some invitation to join their organization:";
|
|
44
|
+
const popuptitle = ref(invitationmsg);
|
|
45
|
+
onMounted(() => {
|
|
46
|
+
invites.value = getUserProfile().invites;
|
|
47
|
+
if (invites.value.length > 0) {
|
|
48
|
+
visible.value = true;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const approve = async (id: string) => {
|
|
53
|
+
// await reloadUserStore()
|
|
54
|
+
await $userstore.decideInvitation(id, "accept");
|
|
55
|
+
$event("InvitationAccepted", id);
|
|
56
|
+
visible.value = false;
|
|
57
|
+
};
|
|
58
|
+
const decline = async (id: string) => {
|
|
59
|
+
// await reloadUserStore()
|
|
60
|
+
await $userstore.decideInvitation(id, "reject");
|
|
61
|
+
$event("InvitationRejected", id);
|
|
62
|
+
visible.value = false;
|
|
63
|
+
};
|
|
64
|
+
</script>
|
|
@@ -1,71 +1,30 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="w-full">
|
|
3
|
-
<div v-if="waiting" class="p-4
|
|
4
|
-
|
|
5
|
-
</div>
|
|
6
|
-
<div v-else class="w-full p-4">
|
|
7
|
-
|
|
3
|
+
<div v-if="waiting" class="p-4 w-full">waiting..</div>
|
|
4
|
+
<div v-else class="w-full p-2 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
|
|
8
5
|
<div v-for="tenant in alltenants" class="border rounded-lg p-2 m-2">
|
|
6
|
+
|
|
9
7
|
<TextTitle>{{ tenant.tenantName }}</TextTitle>
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
<div class="flex flex-row
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
<div v-for=" item in tenant.permissions">
|
|
9
|
+
<NuxtLink :to="`/${item.xOrg}`" external>
|
|
10
|
+
<div class="flex flex-row gap-2 hover:bg-primary-100">
|
|
11
|
+
<div class="min-w-14 p=2">
|
|
12
|
+
<ImageOrganization :orgRecordId="item.orgRecordId" :size="12"/>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="flex flex-col w-full justify-end gap-2">
|
|
15
|
+
<div class="flex flex-row gap-2">
|
|
16
|
+
<TextMain>{{ item.branchCode }}</TextMain>
|
|
17
|
+
<Tag v-for="groupname in item.groups">{{ t(groupname) }}</Tag>
|
|
18
|
+
</div>
|
|
19
|
+
<TextSubsubtitle>{{ item.orgName }}</TextSubsubtitle>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</NuxtLink>
|
|
25
|
+
</div>
|
|
19
26
|
</div>
|
|
20
|
-
|
|
21
|
-
<!-- <card :pt="{ header: { class: 'text-xl text-gray-600' } }">
|
|
22
|
-
<template #header>
|
|
23
|
-
{{ tenant.tenantName }}
|
|
24
|
-
</template>
|
|
25
|
-
<template #content>
|
|
26
|
-
<ul>
|
|
27
|
-
<li v-for="o in getOrglist(tenant)">
|
|
28
|
-
<h1 class="subtitle-text">{{ o.orgName }}</h1>
|
|
29
|
-
<ul
|
|
30
|
-
role="list"
|
|
31
|
-
class="divide-y divide-gray-100 rounded-md border border-gray-200"
|
|
32
|
-
>
|
|
33
|
-
<li
|
|
34
|
-
v-for="b in getBranchlist(tenant)"
|
|
35
|
-
class="w-full items-center justify-between py-4 pl-4 pr-4 text-sm route-link-list"
|
|
36
|
-
>
|
|
37
|
-
<NuxtLink
|
|
38
|
-
:href="`/${b.xOrg}`"
|
|
39
|
-
v-if="o.orgId == b.orgId"
|
|
40
|
-
:external="true"
|
|
41
|
-
>
|
|
42
|
-
<div class="flex w-full flex-1 items-center">
|
|
43
|
-
<p class="flex-1 flex-shrink-0 font-bold text-primary-600">
|
|
44
|
-
{{ b.branchCode }}
|
|
45
|
-
</p>
|
|
46
|
-
<p class="text-right min-w-0 flex-1 gap-2">
|
|
47
|
-
<span href="#" class="font-medium text-gray-600">{{
|
|
48
|
-
b.group
|
|
49
|
-
}}</span>
|
|
50
|
-
</p>
|
|
51
|
-
</div>
|
|
52
|
-
<div class="flex-shrink-0">
|
|
53
|
-
<span class="font-medium text-gray-400"
|
|
54
|
-
>{{ useRuntimeConfig().public.APP_URL }}/{{
|
|
55
|
-
b.xOrg
|
|
56
|
-
}}</span
|
|
57
|
-
>
|
|
58
|
-
</div>
|
|
59
|
-
</NuxtLink>
|
|
60
|
-
</li>
|
|
61
|
-
</ul>
|
|
62
|
-
</li>
|
|
63
|
-
</ul>
|
|
64
|
-
|
|
65
|
-
</template>
|
|
66
|
-
</card> -->
|
|
67
27
|
</div>
|
|
68
|
-
|
|
69
28
|
</div>
|
|
70
29
|
</template>
|
|
71
30
|
<script setup lang="ts">
|
|
@@ -77,12 +36,13 @@
|
|
|
77
36
|
*/
|
|
78
37
|
import _ from "lodash";
|
|
79
38
|
import TextPrimary from "../text/TextPrimary.vue";
|
|
80
|
-
|
|
39
|
+
import ImageOrganization from "../image/ImageOrganization.vue";
|
|
40
|
+
const waiting = ref(true);
|
|
81
41
|
const alltenants = ref();
|
|
82
42
|
|
|
83
43
|
const loadAllTenants = async () => {
|
|
84
|
-
waiting.value=false
|
|
85
|
-
alltenants.value = (await
|
|
44
|
+
waiting.value = false;
|
|
45
|
+
alltenants.value = (await getProfileApi().getAllTenants()).data;
|
|
86
46
|
};
|
|
87
47
|
|
|
88
48
|
// const props = defineProps<{
|
|
@@ -90,12 +50,13 @@ const loadAllTenants = async () => {
|
|
|
90
50
|
// }>()
|
|
91
51
|
const getBranchlist = (tenant: any) => tenant.permissions;
|
|
92
52
|
|
|
93
|
-
const getOrglist = (tenant: any) =>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
53
|
+
// const getOrglist = (tenant: any) =>
|
|
54
|
+
// _.uniqBy(getBranchlist(tenant), "orgId").map((item: any) => ({
|
|
55
|
+
// orgId: item.orgId,
|
|
56
|
+
// orgRecordId:'aaa',// item.orgRecordId,
|
|
57
|
+
// orgCode: item.orgCode,
|
|
58
|
+
// orgName: item.orgName,
|
|
59
|
+
// }));
|
|
99
60
|
|
|
100
61
|
onNuxtReady(() => {
|
|
101
62
|
loadAllTenants();
|
|
@@ -6,6 +6,92 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { DurationType } from "~/types"
|
|
8
8
|
|
|
9
|
+
const convertToDate= (date:Date|string)=>{
|
|
10
|
+
return date instanceof Date ? date : new Date(date)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//after review
|
|
14
|
+
export const today = () => useDayjs()().format('YYYY-MM-DD')
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* convert date object or ISO8601 date become local datetime string
|
|
18
|
+
* @param date date|string
|
|
19
|
+
* @returns local shortform date-time
|
|
20
|
+
*/
|
|
21
|
+
export const dateRenderToDateTimeStr = (date:Date|string) =>
|
|
22
|
+
convertToDate(date).toLocaleString().replace(',', ' ').slice(0,-3)
|
|
23
|
+
/**
|
|
24
|
+
* convert date object or ISO datestring become local date string
|
|
25
|
+
* @param date date|string
|
|
26
|
+
* @returns local short form date
|
|
27
|
+
*/
|
|
28
|
+
export const dateRenderToDateStr = (date:Date|string) =>
|
|
29
|
+
convertToDate(date).toLocaleDateString().replace(',', ' ')
|
|
30
|
+
/**
|
|
31
|
+
* convert date object or ISO datestring become time string (without seconds)
|
|
32
|
+
* @param date date|string
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
export const dateRenderToTimeStr = (date:Date|string) =>
|
|
36
|
+
convertToDate(date).toLocaleTimeString().slice(0,-3)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* convert date object or ISO datestring become DD/MM format
|
|
41
|
+
* @param date date|string
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
export const dateRenderToDDMM = (date:Date|string) =>
|
|
45
|
+
getDayJs()(date).format('DD/MM')
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* convert iso8601 date string to date object
|
|
51
|
+
* @param datestr :string
|
|
52
|
+
* @returns date object
|
|
53
|
+
*/
|
|
54
|
+
export const stringToDate = (datestr:string) => new Date(datestr)
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* convert date object to ISO string YYYY-MM-DDTHH:mm:ssZ
|
|
58
|
+
* @param date :Date
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
export const dateToISOString = (date:Date|string) => convertToDate(date).toISOString().split('.')[0]+"Z"
|
|
62
|
+
//useDayjs()(date).toISOString().split('.')[0]+"Z"
|
|
63
|
+
/**
|
|
64
|
+
* convert date object to date string (YYYY-MM-DD)
|
|
65
|
+
* @param date :Date
|
|
66
|
+
* @returns date return string in YYYY-MM-DD
|
|
67
|
+
*/
|
|
68
|
+
export const dateToString = (date:Date|string) => useDayjs()(date).format('YYYY-MM-DD')
|
|
69
|
+
/**
|
|
70
|
+
* convert date object to time string (HH:mm:ss)
|
|
71
|
+
* @param date
|
|
72
|
+
* @returns timestring
|
|
73
|
+
*/
|
|
74
|
+
export const dateToTimeString = (date:Date) => useDayjs()(date).format('HH:mm:ss')
|
|
75
|
+
/**
|
|
76
|
+
* get 3 char day name sun/mon/tue in lower case
|
|
77
|
+
* @param date : Date|string date obj or iso8601 date
|
|
78
|
+
* @returns string
|
|
79
|
+
*/
|
|
80
|
+
export const getDayNameInWeek = (date:Date|string) => useDayjs()(date).format('ddd').toLowerCase();
|
|
81
|
+
/**
|
|
82
|
+
* get last date of the specific date
|
|
83
|
+
* @param dates: Date|string
|
|
84
|
+
* @returns string
|
|
85
|
+
*/
|
|
86
|
+
export const lastDateOfMonth = (date:Date|string) => useDayjs()(date).endOf('month').format('YYYY-MM-DD');
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
//before reevaluate
|
|
94
|
+
|
|
9
95
|
export const setDateLocale = (localename:string) => useDayjs().locale(localename)
|
|
10
96
|
export const dateExists = (date:Date,listDate:Date[]) => {
|
|
11
97
|
const existsrecord = listDate.find(item=>{
|
|
@@ -14,15 +100,26 @@ export const dateExists = (date:Date,listDate:Date[]) => {
|
|
|
14
100
|
return existsrecord===undefined ? false :true
|
|
15
101
|
}
|
|
16
102
|
export const getDayJs = ()=>useDayjs()
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export const
|
|
22
|
-
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
export const dateToISOWithoutConvert=(date:Date)=>{
|
|
108
|
+
const timestamp = date.getTime() - date.getTimezoneOffset() * 60000;
|
|
109
|
+
return new Date(timestamp).toISOString().split('.')[0]+"Z"
|
|
110
|
+
}
|
|
111
|
+
export const convertIsoToDateToWithoutConvert=(datestr:string)=>{
|
|
112
|
+
// const timestamp = date.getTime() - date.getTimezoneOffset() * 60000;
|
|
113
|
+
const offsets = (new Date()).getTimezoneOffset() * 60000
|
|
114
|
+
const timestamp = stringToDate(datestr).getTime() + offsets
|
|
115
|
+
return new Date(timestamp)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
23
119
|
export const dateToDateTimeString = (date:Date)=> useDayjs().utc(date).format('YYYY-MM-DD HH:mm:ss')
|
|
24
|
-
export const toLocalDate = (date:string | Date)=> useDayjs()
|
|
120
|
+
export const toLocalDate = (date:string | Date)=> useDayjs()(date).format(getDateFormat())
|
|
25
121
|
export const toLocalDateTime = (date:string | Date)=> useDayjs().utc(date).format(getDateTimeFormat())
|
|
122
|
+
|
|
26
123
|
export const toUTCDate = (date:string | Date)=> useDayjs().utc(date).format(getDateFormat())
|
|
27
124
|
export const toUTCDateTime = (date:string | Date)=> useDayjs().utc(date).format(getDateTimeFormat())
|
|
28
125
|
export const toUTCTime = (date:string | Date)=> useDayjs().utc(date).format('HH:mm')
|
|
@@ -33,5 +130,5 @@ export const getPrimevueCalendarDateFormat = () => {
|
|
|
33
130
|
const country = <string>getUserProfile()?.country
|
|
34
131
|
return 'dd/mm/yy'
|
|
35
132
|
}
|
|
36
|
-
|
|
133
|
+
|
|
37
134
|
export const addTime = (date:Date|string,duration:number,unit:DurationType) => getDayJs()(date).add(duration, 'hour').toDate()
|