@simitgroup/simpleapp-generator 1.3.4-alpha → 1.4.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildinschemas/permission.d.ts.map +1 -1
- package/dist/buildinschemas/permission.js +10 -6
- package/dist/buildinschemas/permission.js.map +1 -1
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +22 -2
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/generate.js +20 -6
- package/dist/generate.js.map +1 -1
- package/dist/type.d.ts +2 -0
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/permission.ts +10 -6
- package/src/buildinschemas/user.ts +23 -3
- package/src/generate.ts +19 -6
- package/src/type.ts +3 -1
- package/templates/basic/nest/controller.ts.eta +1 -1
- package/templates/basic/nest/service.ts.eta +7 -3
- package/templates/basic/nuxt/pages.[id].vue.eta +4 -4
- package/templates/basic/nuxt/pages.mobile.[id].vue.eta +39 -0
- package/templates/basic/nuxt/pages.mobile.landing.vue.eta +69 -0
- package/templates/nest/.gitignore.eta +6 -1
- package/templates/nest/src/simpleapp/apischemas/index.ts._eta +29 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +22 -12
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +26 -1
- package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +1 -1
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +1 -1
- package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +1 -1
- package/templates/nest/src/simpleapp/services/perm.service.ts.eta +5 -7
- package/templates/nest/src/simpleapp/services/user.service.ts.eta.old +118 -0
- package/templates/nest/src/simpleapp/types/index.ts._eta +8 -0
- package/templates/nuxt/app.vue._eta +31 -17
- package/templates/nuxt/assets/css/style.css._eta +4 -4
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +10 -4
- package/templates/nuxt/components/calendar/CalendarByResource.vue.eta +181 -163
- package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +8 -6
- package/templates/nuxt/components/form/FormDocnoformat.vue.eta +174 -0
- package/templates/nuxt/components/form/FormUser.vue._eta +91 -0
- package/templates/nuxt/components/form/user/FormUserPermission.vue.eta +83 -0
- package/templates/nuxt/components/header/HeaderBar.vue._eta +43 -39
- package/templates/nuxt/components/header/button/HeaderButtonMenuPicker.vue._eta +46 -38
- package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +9 -9
- package/templates/nuxt/components/mobile/MobileToolbar.vue.eta +12 -8
- package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +1 -1
- package/templates/nuxt/components/page/PageDocList.vue.eta +6 -4
- package/templates/nuxt/components/renderer/RendererDateTime.vue.eta +13 -0
- package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +6 -3
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +3 -4
- package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +20 -7
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +2 -5
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +56 -12
- package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +2 -6
- package/templates/nuxt/composables/date.generate.ts.eta +3 -1
- package/templates/nuxt/composables/goTo.generate.ts.eta +4 -1
- package/templates/nuxt/composables/refreshDocumentList.generate.ts.eta +13 -2
- package/templates/nuxt/layouts/mobile.vue._eta +26 -12
- package/templates/nuxt/nuxt.config.ts._eta +27 -20
- package/templates/nuxt/pages/[xorg]/{user/index.vue.eta → docnoformat/[id].vue.eta} +11 -9
- package/templates/nuxt/pages/[xorg]/docnoformat.vue.eta +51 -20
- package/templates/nuxt/pages/[xorg]/mobile/docnoformat/index.vue.eta +59 -0
- package/templates/nuxt/pages/[xorg]/mobile/index.vue._eta +19 -0
- package/templates/nuxt/pages/[xorg]/mobile/organization/index.vue.eta +138 -0
- package/templates/nuxt/pages/[xorg]/mobile/pickgroup.vue._eta +35 -0
- package/templates/nuxt/pages/[xorg]/mobile/user/index.vue.eta +231 -0
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +80 -61
- package/templates/nuxt/pages/[xorg]/pickgroup.vue._eta +35 -0
- package/templates/nuxt/pages/[xorg]/user.vue.eta +91 -74
- package/templates/nuxt/pages/profile.vue.eta +7 -7
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +14 -3
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +18 -16
- package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +1 -1
- package/templates/nuxt/types/events.ts.eta +1 -0
- package/templates/nuxt/types/simpleappinput.ts.eta +3 -2
- package/templates/nuxt/types/user.ts.eta +2 -1
- package/templates/project/lang/default._json +150 -67
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nest/src/simpleapp/services/user.service.ts.etax +0 -66
- package/templates/nuxt/pages/[xorg]/docnoformat/[doctype]/[id].vue.eta +0 -13
- package/templates/nuxt/pages/[xorg]/docnoformat/[doctype]/new.vue.eta +0 -229
- package/templates/nuxt/pages/[xorg]/docnoformat/[doctype].vue.eta +0 -38
- package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +0 -11
- package/templates/nuxt/pages/[xorg]/user/[id].vue.eta +0 -39
- package/templates/nuxt/pages/[xorg]/user/form.vue.eta +0 -334
- package/templates/nuxt/pages/[xorg]/user/new.vue.eta +0 -18
- package/templates/nuxt/pages/[xorg]/user/viewer.vue.eta +0 -29
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
|
|
3
|
+
<div class="w-full flex-col flex">
|
|
4
|
+
<title>{{ t("organization") }}</title>
|
|
5
|
+
<MobileToolbar class="bg-gray-600">
|
|
6
|
+
<template #center><TextTitle class="text-white">{{ t("organization") }}</TextTitle></template>
|
|
7
|
+
<template #end>
|
|
8
|
+
<ButtonText @click="showEditOrg = true" class="text-white"
|
|
9
|
+
><i class="pi pi-pencil"></i
|
|
10
|
+
></ButtonText>
|
|
11
|
+
</template>
|
|
12
|
+
</MobileToolbar>
|
|
13
|
+
|
|
14
|
+
<div class="w-full flex flex-row p-2 border-b border-gray-300 ">
|
|
15
|
+
<div class="p-4">
|
|
16
|
+
<div class="border w-12 h-12 md:w-24 md:h24"></div>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="flex flex-col flex-1 ">
|
|
19
|
+
<TextTitle>{{ data.orgName }} / {{ data.orgCode }}</TextTitle>
|
|
20
|
+
<TextSubtitle>
|
|
21
|
+
{{ data.description }}
|
|
22
|
+
</TextSubtitle>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div class="w-full p-2 flex flex-col ">
|
|
27
|
+
|
|
28
|
+
<div class="flex flex-row justify-end">
|
|
29
|
+
<TextTitle class="flex-1 p-2">{{ t('branches') }}</TextTitle>
|
|
30
|
+
<div>
|
|
31
|
+
<ButtonPrimary @click="goBranch('new')">
|
|
32
|
+
<i class="pi pi-plus"></i> <span>{{ t("addBranches") }}</span>
|
|
33
|
+
</ButtonPrimary>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<ListView class="border rounded-lg border-gray-400 dark:border-gray-600"
|
|
37
|
+
:list="branchlist"
|
|
38
|
+
title-field="branchName"
|
|
39
|
+
sub-title-field="branchCode"
|
|
40
|
+
:url="getDocumentUrl('organization', id)"
|
|
41
|
+
#default="{item}"
|
|
42
|
+
>
|
|
43
|
+
<div class="flex flex-row">
|
|
44
|
+
<div class="flex-col flex flex-1">
|
|
45
|
+
<TextPrimary>{{ item.branchName }}</TextPrimary>
|
|
46
|
+
<TextSubtitle>{{ item.description }}</TextSubtitle>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="flex-col flex text-right">
|
|
49
|
+
<div>{{ item.branchCode }}</div>
|
|
50
|
+
<renderer-boolean v-model="item.active"></renderer-boolean>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
</ListView>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<OverlaySideBarCrud v-model="showEditOrg" close-event-name="organization">
|
|
58
|
+
<FormOrganization
|
|
59
|
+
:_id="getUserProfile()?.orgRecordId"
|
|
60
|
+
@after="afterOrganization"
|
|
61
|
+
></FormOrganization>
|
|
62
|
+
</OverlaySideBarCrud>
|
|
63
|
+
|
|
64
|
+
<OverlaySideBarCrud v-model="showEditBranch" close-event-name="branch">
|
|
65
|
+
<NuxtPage :_id="id"></NuxtPage>
|
|
66
|
+
</OverlaySideBarCrud>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script setup lang="ts">
|
|
71
|
+
/**
|
|
72
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
73
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
74
|
+
* last change 2023-10-28
|
|
75
|
+
* Author: Ks Tan
|
|
76
|
+
*/
|
|
77
|
+
import { FormCrudEvent, SimpleAppInputType } from "~/types";
|
|
78
|
+
import ConfirmPopup from "primevue/confirmpopup";
|
|
79
|
+
import { useConfirm } from "primevue/useconfirm";
|
|
80
|
+
const confirm = useConfirm();
|
|
81
|
+
const showEditOrg = ref<boolean>(false);
|
|
82
|
+
const showEditBranch = ref<boolean>(false);
|
|
83
|
+
|
|
84
|
+
const { $OrganizationDoc, $BranchDoc, $event, $listen } = useNuxtApp();
|
|
85
|
+
|
|
86
|
+
const orgId = computed(() => <string>getUserProfile()?.orgRecordId);
|
|
87
|
+
const doc = $OrganizationDoc();
|
|
88
|
+
const brancdoc = $BranchDoc();
|
|
89
|
+
const data = doc.getReactiveData();
|
|
90
|
+
const branchlist = ref([]);
|
|
91
|
+
const isReadOnly = ref(true);
|
|
92
|
+
const getCurrentOrg = async () => {
|
|
93
|
+
await doc.getById(orgId.value);
|
|
94
|
+
await fetchRecord();
|
|
95
|
+
};
|
|
96
|
+
const fetchRecord = async () => {
|
|
97
|
+
//fetch org
|
|
98
|
+
// await doc.getById(data.value.orgId);
|
|
99
|
+
//fetch branch
|
|
100
|
+
branchlist.value = await brancdoc.search({
|
|
101
|
+
filter: { orgId: data.value.orgId },
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
console.log("reload data", branchlist);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const id = computed((): string => String(useRoute().params.id ?? ""));
|
|
108
|
+
|
|
109
|
+
definePageMeta({
|
|
110
|
+
menuPath: "setting/organization",
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
//branch record update then reload
|
|
114
|
+
$listen("RefreshDocumentList", async (data) => {
|
|
115
|
+
console.log("trigger RefreshDocumentList", data);
|
|
116
|
+
if (data.documentName == "branch" || data.documentName == "organization") {
|
|
117
|
+
await fetchRecord();
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const showBranchDialogIfRequired = () => {
|
|
122
|
+
if (useRoute().path.includes("/new") || id.value) showEditBranch.value = true;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const afterOrganization = (actionName: FormCrudEvent) => {
|
|
126
|
+
if (actionName == FormCrudEvent.update) {
|
|
127
|
+
showEditOrg.value = false;
|
|
128
|
+
getCurrentOrg();
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
watch(
|
|
133
|
+
() => useRoute().path,
|
|
134
|
+
() => showBranchDialogIfRequired(),
|
|
135
|
+
);
|
|
136
|
+
onMounted(() => showBranchDialogIfRequired());
|
|
137
|
+
getCurrentOrg();
|
|
138
|
+
</script>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col w-full gap-4 p-4">
|
|
3
|
+
<TextTitle class="text-center">{{ t("pickGroup") }}</TextTitle>
|
|
4
|
+
<div v-for="(groupName, index) in getUserProfile()?.groups" :key="index">
|
|
5
|
+
<div
|
|
6
|
+
class="border rounded-lg bg-primary-500 text-white p-4 text-center"
|
|
7
|
+
@click="pickGroup(groupName)"
|
|
8
|
+
>
|
|
9
|
+
{{ t(groupName) }}
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<script lang="ts" setup>
|
|
15
|
+
/**
|
|
16
|
+
* This file was automatically generated by simpleapp generator during initialization. It is changable.
|
|
17
|
+
* --remove-this-line-to-prevent-override--
|
|
18
|
+
* last change 2024-04-09
|
|
19
|
+
* author: Ks Tan
|
|
20
|
+
*/
|
|
21
|
+
const pickGroup = async (groupName: string) => {
|
|
22
|
+
try{
|
|
23
|
+
useCookie('currentGroup').value= groupName
|
|
24
|
+
localStorage.setItem('currentGroup',groupName)
|
|
25
|
+
useNuxtApp().$userstore.currentGroup = groupName;
|
|
26
|
+
useNuxtApp().$event("pickGroup", groupName);
|
|
27
|
+
goTo("");
|
|
28
|
+
}catch(e){
|
|
29
|
+
alert("something wrong")
|
|
30
|
+
console.error(e)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
};
|
|
34
|
+
</script>
|
|
35
|
+
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="w-full flex flex-col p-3">
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
<div><TextTitle>{{ t('user') }}</TextTitle></div>
|
|
6
|
+
<div class="flex flex-row w-full ">
|
|
7
|
+
<title>{{ t("user") }}</title>
|
|
8
|
+
|
|
9
|
+
<div class="w-full md:w-1/2 xl:w-1/3">
|
|
10
|
+
<TabView>
|
|
11
|
+
<TabPanel header="Active">
|
|
12
|
+
<ul role="list" class="divide-y divide-gray-100">
|
|
13
|
+
<li v-for="item in userlist" :key="item.email">
|
|
14
|
+
<NuxtLink
|
|
15
|
+
v-if="item.uid && item.active"
|
|
16
|
+
:to="getDocumentUrl('user', item._id)"
|
|
17
|
+
>
|
|
18
|
+
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
19
|
+
</NuxtLink>
|
|
20
|
+
</li>
|
|
21
|
+
</ul>
|
|
22
|
+
</TabPanel>
|
|
23
|
+
<TabPanel header="Inactive">
|
|
24
|
+
<ul role="list" class="divide-y divide-gray-100">
|
|
25
|
+
<li v-for="item in userlist" :key="item.email">
|
|
26
|
+
<NuxtLink
|
|
27
|
+
v-if="item.uid && !item.active"
|
|
28
|
+
:to="getDocumentUrl('user', item._id)"
|
|
29
|
+
>
|
|
30
|
+
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
31
|
+
</NuxtLink>
|
|
32
|
+
</li>
|
|
33
|
+
</ul>
|
|
34
|
+
</TabPanel>
|
|
35
|
+
<TabPanel header="Invite">
|
|
36
|
+
<div class="padding p-2">
|
|
37
|
+
<form @submit.prevent="true" class="w-full">
|
|
38
|
+
<div class="p-inputgroup flex flex-row">
|
|
39
|
+
<InputText
|
|
40
|
+
class="flex-1"
|
|
41
|
+
type="email"
|
|
42
|
+
placeholder="email"
|
|
43
|
+
v-model="inviteemail"
|
|
44
|
+
/>
|
|
45
|
+
<div class="p-inputgroup-addon p p-0">
|
|
46
|
+
<button
|
|
47
|
+
label="Search"
|
|
48
|
+
class="border rounded-tl-none rounded-bl-none btn btn-primary -ml-1 h-full p-3 rounded-r-md"
|
|
49
|
+
@click="invite"
|
|
50
|
+
>
|
|
51
|
+
Invite
|
|
52
|
+
</button>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</form>
|
|
56
|
+
</div>
|
|
57
|
+
<ul role="list" class="divide-y divide-gray-100">
|
|
58
|
+
<li v-for="item in userlist" :key="item.email">
|
|
59
|
+
<NuxtLink v-if="!item.uid" :to="getDocumentUrl('user', item._id)">
|
|
60
|
+
<UserProfileListItem :data="item"></UserProfileListItem>
|
|
61
|
+
</NuxtLink>
|
|
62
|
+
</li>
|
|
63
|
+
</ul>
|
|
64
|
+
</TabPanel>
|
|
65
|
+
</TabView>
|
|
66
|
+
</div>
|
|
67
|
+
<div v-if="!isMobile()" class="flex-1">
|
|
68
|
+
<NuxtPage :_id="userid" />
|
|
69
|
+
</div>
|
|
70
|
+
<OverlaySideBarCrud
|
|
71
|
+
v-if="dialogvisible"
|
|
72
|
+
v-model="dialogvisible"
|
|
73
|
+
closeEventName="user"
|
|
74
|
+
>
|
|
75
|
+
<NuxtPage :_id="userid" />
|
|
76
|
+
</OverlaySideBarCrud>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<script setup lang="ts">
|
|
82
|
+
/**
|
|
83
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
84
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
85
|
+
* last change 2023-10-28
|
|
86
|
+
* Author: Ks Tan
|
|
87
|
+
*/
|
|
88
|
+
// import userchild from './userchild.vue'
|
|
89
|
+
import Menu from "primevue/menu";
|
|
90
|
+
import Dialog from "primevue/dialog";
|
|
91
|
+
import { SearchBody, EventType, UserProfile } from "~/types";
|
|
92
|
+
import _ from "lodash";
|
|
93
|
+
import Panel from "primevue/panel";
|
|
94
|
+
import { ref } from "vue";
|
|
95
|
+
import {
|
|
96
|
+
UserListItem,
|
|
97
|
+
BranchListItem,
|
|
98
|
+
OrgListItem,
|
|
99
|
+
PermissionListItem,
|
|
100
|
+
} from "~/types";
|
|
101
|
+
import SelectButton from "primevue/selectbutton";
|
|
102
|
+
import Button from "primevue/button";
|
|
103
|
+
import InputText from "primevue/inputtext";
|
|
104
|
+
import Card from "primevue/card";
|
|
105
|
+
import TabView from "primevue/tabview";
|
|
106
|
+
import TabPanel from "primevue/tabpanel";
|
|
107
|
+
import { Permission, User } from "~/simpleapp/generate/openapi/api";
|
|
108
|
+
import BlockUI from "primevue/blockui";
|
|
109
|
+
const dialogvisible = ref(false);
|
|
110
|
+
//initialize api
|
|
111
|
+
const {
|
|
112
|
+
$listen,
|
|
113
|
+
$PermissionDoc,
|
|
114
|
+
$OrganizationDoc,
|
|
115
|
+
$BranchDoc,
|
|
116
|
+
$UserDoc,
|
|
117
|
+
// $InvitationDoc,
|
|
118
|
+
} = useNuxtApp();
|
|
119
|
+
const userid = computed(() => getPathPara("id"));
|
|
120
|
+
const permdoc = $PermissionDoc();
|
|
121
|
+
const orgdoc = $OrganizationDoc();
|
|
122
|
+
const branchdoc = $BranchDoc();
|
|
123
|
+
// const invitedoc = $InvitationDoc();
|
|
124
|
+
const userdoc = $UserDoc();
|
|
125
|
+
const userdata = userdoc.getReactiveData();
|
|
126
|
+
//initialize require list in UI
|
|
127
|
+
const permlist = ref<PermissionListItem[]>([]);
|
|
128
|
+
const userlist = ref<UserListItem[]>([]);
|
|
129
|
+
const orglist = ref<OrgListItem[]>([]);
|
|
130
|
+
const branchlist = ref<BranchListItem[]>([]);
|
|
131
|
+
const currentpermissions = ref<Permission[]>([]);
|
|
132
|
+
const grouplist = getAllGroups().map((item) => {
|
|
133
|
+
return { value: item, label: _.capitalize(item) };
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
//initialize some runtime variable
|
|
137
|
+
const blockscreen = ref(false);
|
|
138
|
+
const inviteemail = ref("");
|
|
139
|
+
const selected = ref("");
|
|
140
|
+
const activeuser = ref("");
|
|
141
|
+
const showpermissioninfo = ref(false);
|
|
142
|
+
const permissionselected = ref();
|
|
143
|
+
|
|
144
|
+
const selectUser = (user: any) => {
|
|
145
|
+
// goTo('user',user._id)
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* 1. get all users from this tenant
|
|
150
|
+
* @param resetpage after reload, will it reset user interface or remain as current
|
|
151
|
+
*/
|
|
152
|
+
const refreshList = async (resetpage: boolean = true) => {
|
|
153
|
+
const items: any[] = [];
|
|
154
|
+
const searchbody: SearchBody = {
|
|
155
|
+
fields: [
|
|
156
|
+
"uid",
|
|
157
|
+
"email",
|
|
158
|
+
"created",
|
|
159
|
+
"fullName",
|
|
160
|
+
"active",
|
|
161
|
+
"lastActivity",
|
|
162
|
+
"description",
|
|
163
|
+
],
|
|
164
|
+
};
|
|
165
|
+
userlist.value = await userdoc.search(searchbody);
|
|
166
|
+
//listUser();
|
|
167
|
+
// userlist.value = _.uniqBy(permlist.value, "uid");
|
|
168
|
+
if (resetpage) {
|
|
169
|
+
selected.value = "";
|
|
170
|
+
activeuser.value = "";
|
|
171
|
+
}
|
|
172
|
+
blockscreen.value = false;
|
|
173
|
+
// console.log("userlist", userlist.value);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* identity branch object under org
|
|
178
|
+
* @param org object of org
|
|
179
|
+
* @param branch object of branch
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* generate dialog for view each user group have what permission
|
|
184
|
+
*/
|
|
185
|
+
const previewPermission = () => {
|
|
186
|
+
showpermissioninfo.value = true;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
/***** send or remove invitation ******/
|
|
190
|
+
|
|
191
|
+
const invite = async () => {
|
|
192
|
+
// const invitedata:User = {}
|
|
193
|
+
const currentuser = getUserProfile();
|
|
194
|
+
const inviteuserdoc = $UserDoc();
|
|
195
|
+
inviteuserdoc.setNew();
|
|
196
|
+
const newuserdata = inviteuserdoc.getReactiveData();
|
|
197
|
+
newuserdata.value.email = inviteemail.value;
|
|
198
|
+
newuserdata.value.fullName = inviteemail.value.split("@")[0];
|
|
199
|
+
newuserdata.value.active = true;
|
|
200
|
+
newuserdata.value.tenantId = currentuser?.tenantId;
|
|
201
|
+
newuserdata.value.orgId = currentuser?.orgId;
|
|
202
|
+
newuserdata.value.branchId = currentuser?.branchId;
|
|
203
|
+
|
|
204
|
+
const invitedata = await inviteuserdoc.create();
|
|
205
|
+
inviteemail.value = "";
|
|
206
|
+
await refreshList();
|
|
207
|
+
// onSelectUser(invitedata);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const showDialogIfNeeded = () => {
|
|
211
|
+
if (isMobile()) {
|
|
212
|
+
if (userid.value != "") dialogvisible.value = true;
|
|
213
|
+
else dialogvisible.value = false;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
watch(
|
|
217
|
+
() => useRoute().path,
|
|
218
|
+
() => showDialogIfNeeded(),
|
|
219
|
+
);
|
|
220
|
+
$listen("RefreshDocumentList", async () => {
|
|
221
|
+
await refreshList();
|
|
222
|
+
});
|
|
223
|
+
onMounted(async () => {
|
|
224
|
+
await refreshList();
|
|
225
|
+
showDialogIfNeeded();
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
definePageMeta({
|
|
229
|
+
menuPath: "setting/user",
|
|
230
|
+
});
|
|
231
|
+
</script>
|
|
@@ -1,47 +1,69 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
<div class="w-full flex-col flex">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<div class="text-gray-600 dark:text-gray-400 text-sm">
|
|
18
|
-
{{ data.country }}/{{ data.currency }}/{{ data.timeZone }}//{{ data.offsetMinute }}
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
</div>
|
|
2
|
+
|
|
3
|
+
<div class="w-full flex-col flex">
|
|
4
|
+
<title>{{ t("organization") }}</title>
|
|
5
|
+
<MobileToolbar class="bg-gray-600">
|
|
6
|
+
<template #center><TextTitle class="text-white">{{ t("organization") }}</TextTitle></template>
|
|
7
|
+
<template #end>
|
|
8
|
+
<ButtonText @click="showEditOrg = true" class="text-white"
|
|
9
|
+
><i class="pi pi-pencil"></i
|
|
10
|
+
></ButtonText>
|
|
11
|
+
</template>
|
|
12
|
+
</MobileToolbar>
|
|
13
|
+
|
|
14
|
+
<div class="w-full flex flex-row p-2 border-b border-gray-300 ">
|
|
15
|
+
<div class="p-4">
|
|
16
|
+
<div class="border w-12 h-12 md:w-24 md:h24"></div>
|
|
22
17
|
</div>
|
|
18
|
+
<div class="flex flex-col flex-1 ">
|
|
19
|
+
<TextTitle>{{ data.orgName }} / {{ data.orgCode }}</TextTitle>
|
|
20
|
+
<TextSubtitle>
|
|
21
|
+
{{ data.description }}
|
|
22
|
+
</TextSubtitle>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
>
|
|
34
|
-
</ListView>
|
|
26
|
+
<div class="w-full p-2 flex flex-col ">
|
|
27
|
+
|
|
28
|
+
<div class="flex flex-row justify-end">
|
|
29
|
+
<TextTitle class="flex-1 p-2">{{ t('branches') }}</TextTitle>
|
|
30
|
+
<div>
|
|
31
|
+
<ButtonPrimary @click="goBranch('new')">
|
|
32
|
+
<i class="pi pi-plus"></i> <span>{{ t("addBranches") }}</span>
|
|
33
|
+
</ButtonPrimary>
|
|
34
|
+
</div>
|
|
35
35
|
</div>
|
|
36
|
-
|
|
36
|
+
<ListView class="border rounded-lg border-gray-400 dark:border-gray-600"
|
|
37
|
+
:list="branchlist"
|
|
38
|
+
title-field="branchName"
|
|
39
|
+
sub-title-field="branchCode"
|
|
40
|
+
:url="getDocumentUrl('organization', id)"
|
|
41
|
+
#default="{item}"
|
|
42
|
+
>
|
|
43
|
+
<div class="flex flex-row">
|
|
44
|
+
<div class="flex-col flex flex-1">
|
|
45
|
+
<TextPrimary>{{ item.branchName }}</TextPrimary>
|
|
46
|
+
<TextSubtitle>{{ item.description }}</TextSubtitle>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="flex-col flex text-right">
|
|
49
|
+
<div>{{ item.branchCode }}</div>
|
|
50
|
+
<renderer-boolean v-model="item.active"></renderer-boolean>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
37
53
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
</ListView>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<OverlaySideBarCrud v-model="showEditOrg" close-event-name="organization">
|
|
58
|
+
<FormOrganization
|
|
59
|
+
:_id="getUserProfile()?.orgRecordId"
|
|
60
|
+
@after="afterOrganization"
|
|
61
|
+
></FormOrganization>
|
|
62
|
+
</OverlaySideBarCrud>
|
|
63
|
+
|
|
64
|
+
<OverlaySideBarCrud v-model="showEditBranch" close-event-name="branch">
|
|
65
|
+
<NuxtPage :_id="id"></NuxtPage>
|
|
66
|
+
</OverlaySideBarCrud>
|
|
45
67
|
</div>
|
|
46
68
|
</template>
|
|
47
69
|
|
|
@@ -56,12 +78,12 @@ import { FormCrudEvent, SimpleAppInputType } from "~/types";
|
|
|
56
78
|
import ConfirmPopup from "primevue/confirmpopup";
|
|
57
79
|
import { useConfirm } from "primevue/useconfirm";
|
|
58
80
|
const confirm = useConfirm();
|
|
59
|
-
const showEditOrg = ref<boolean>(false)
|
|
60
|
-
const showEditBranch = ref<boolean>(false)
|
|
81
|
+
const showEditOrg = ref<boolean>(false);
|
|
82
|
+
const showEditBranch = ref<boolean>(false);
|
|
61
83
|
|
|
62
84
|
const { $OrganizationDoc, $BranchDoc, $event, $listen } = useNuxtApp();
|
|
63
85
|
|
|
64
|
-
const orgId = computed(()
|
|
86
|
+
const orgId = computed(() => <string>getUserProfile()?.orgRecordId);
|
|
65
87
|
const doc = $OrganizationDoc();
|
|
66
88
|
const brancdoc = $BranchDoc();
|
|
67
89
|
const data = doc.getReactiveData();
|
|
@@ -69,7 +91,7 @@ const branchlist = ref([]);
|
|
|
69
91
|
const isReadOnly = ref(true);
|
|
70
92
|
const getCurrentOrg = async () => {
|
|
71
93
|
await doc.getById(orgId.value);
|
|
72
|
-
await fetchRecord()
|
|
94
|
+
await fetchRecord();
|
|
73
95
|
};
|
|
74
96
|
const fetchRecord = async () => {
|
|
75
97
|
//fetch org
|
|
@@ -79,41 +101,38 @@ const fetchRecord = async () => {
|
|
|
79
101
|
filter: { orgId: data.value.orgId },
|
|
80
102
|
});
|
|
81
103
|
|
|
82
|
-
console.log("reload data",branchlist)
|
|
104
|
+
console.log("reload data", branchlist);
|
|
83
105
|
};
|
|
84
106
|
|
|
85
107
|
const id = computed((): string => String(useRoute().params.id ?? ""));
|
|
86
108
|
|
|
87
|
-
|
|
88
109
|
definePageMeta({
|
|
89
110
|
menuPath: "setting/organization",
|
|
90
111
|
});
|
|
91
112
|
|
|
92
113
|
//branch record update then reload
|
|
93
114
|
$listen("RefreshDocumentList", async (data) => {
|
|
94
|
-
console.log("trigger RefreshDocumentList",data)
|
|
115
|
+
console.log("trigger RefreshDocumentList", data);
|
|
95
116
|
if (data.documentName == "branch" || data.documentName == "organization") {
|
|
96
117
|
await fetchRecord();
|
|
97
118
|
}
|
|
98
119
|
});
|
|
99
120
|
|
|
121
|
+
const showBranchDialogIfRequired = () => {
|
|
122
|
+
if (useRoute().path.includes("/new") || id.value) showEditBranch.value = true;
|
|
123
|
+
};
|
|
100
124
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const afterOrganization = (actionName:FormCrudEvent)=>{
|
|
107
|
-
if(actionName==FormCrudEvent.update){
|
|
108
|
-
showEditOrg.value=false
|
|
109
|
-
getCurrentOrg()
|
|
125
|
+
const afterOrganization = (actionName: FormCrudEvent) => {
|
|
126
|
+
if (actionName == FormCrudEvent.update) {
|
|
127
|
+
showEditOrg.value = false;
|
|
128
|
+
getCurrentOrg();
|
|
110
129
|
}
|
|
111
|
-
}
|
|
130
|
+
};
|
|
112
131
|
|
|
113
|
-
watch(
|
|
114
|
-
|
|
132
|
+
watch(
|
|
133
|
+
() => useRoute().path,
|
|
134
|
+
() => showBranchDialogIfRequired(),
|
|
135
|
+
);
|
|
136
|
+
onMounted(() => showBranchDialogIfRequired());
|
|
115
137
|
getCurrentOrg();
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
138
|
</script>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col w-full gap-4 p-4">
|
|
3
|
+
<TextTitle class="text-center">{{ t("pickGroup") }}</TextTitle>
|
|
4
|
+
<div v-for="(groupName, index) in getUserProfile()?.groups" :key="index">
|
|
5
|
+
<div
|
|
6
|
+
class="border rounded-lg bg-primary-500 text-white p-4 text-center"
|
|
7
|
+
@click="pickGroup(groupName)"
|
|
8
|
+
>
|
|
9
|
+
{{ t(groupName) }}
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<script lang="ts" setup>
|
|
15
|
+
/**
|
|
16
|
+
* This file was automatically generated by simpleapp generator during initialization. It is changable.
|
|
17
|
+
* --remove-this-line-to-prevent-override--
|
|
18
|
+
* last change 2024-04-09
|
|
19
|
+
* author: Ks Tan
|
|
20
|
+
*/
|
|
21
|
+
const pickGroup = async (groupName: string) => {
|
|
22
|
+
try{
|
|
23
|
+
useCookie('currentGroup').value= groupName
|
|
24
|
+
localStorage.setItem('currentGroup',groupName)
|
|
25
|
+
useNuxtApp().$userstore.currentGroup = groupName;
|
|
26
|
+
useNuxtApp().$event("pickGroup", groupName);
|
|
27
|
+
goTo("");
|
|
28
|
+
}catch(e){
|
|
29
|
+
alert("something wrong")
|
|
30
|
+
console.error(e)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
};
|
|
34
|
+
</script>
|
|
35
|
+
|