@simitgroup/simpleapp-generator 1.0.59 → 1.0.60
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/organization.d.ts.map +1 -1
- package/dist/buildinschemas/organization.js +1 -0
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/buildinschemas/permission.js +1 -1
- package/dist/buildinschemas/permission.js.map +1 -1
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +4 -1
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/framework.js +1 -1
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +6 -1
- package/dist/generate.js.map +1 -1
- package/dist/type.d.ts +1 -0
- package/dist/type.d.ts.map +1 -1
- package/docs/jsonschema.md +1 -0
- package/package.json +1 -1
- package/src/buildinschemas/branch.ts +1 -0
- package/src/buildinschemas/organization.ts +1 -0
- package/src/buildinschemas/permission.ts +1 -1
- package/src/buildinschemas/user.ts +4 -1
- package/src/framework.ts +1 -1
- package/src/generate.ts +6 -1
- package/src/type.ts +1 -0
- package/templates/basic/nest/controller.ts.eta +5 -3
- package/templates/basic/nest/model.ts.eta +32 -7
- package/templates/basic/nuxt/pages.crud.vue.eta +59 -163
- package/templates/basic/nuxt/pages.index.vue.eta +225 -0
- package/templates/nest/.env._eta +1 -0
- package/templates/nest/src/simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta +1 -1
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +1 -1
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +127 -22
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +1 -1
- package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +25 -2
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +20 -2
- package/templates/nest/src/simpleapp/services/branch.service.ts.eta +41 -40
- package/templates/nest/src/simpleapp/services/user.service.ts.eta +10 -9
- package/templates/nuxt/app.vue.eta +2 -1
- package/templates/nuxt/assets/css/style.css._eta +3 -12
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +24 -20
- package/templates/nuxt/components/ButtonCreateTenant.vue.eta +30 -23
- package/templates/nuxt/components/ButtonHome.vue.eta +15 -2
- package/templates/nuxt/components/ButtonMenuPicker.vue.eta +5 -20
- package/templates/nuxt/components/ButtonPermissionInfo.vue.eta +5 -7
- package/templates/nuxt/components/ButtonProfile.vue.eta +42 -25
- package/templates/nuxt/components/CrudSimple.vue.eta +1 -1
- package/templates/nuxt/components/EventDecision.vue.eta +115 -0
- package/templates/nuxt/components/EventNotification.vue.eta +157 -0
- package/templates/nuxt/components/HeaderBar.vue.eta +2 -2
- package/templates/nuxt/components/Invitation.vue.eta +3 -3
- package/templates/nuxt/components/SelectBranch.vue.eta +5 -2
- package/templates/nuxt/components/SimpleAppDatatable.vue.eta +151 -5
- package/templates/nuxt/components/TenantPicker.vue.eta +75 -0
- package/templates/nuxt/components/UserProfileListItem.vue.eta +65 -0
- package/templates/nuxt/components/renderers/BooleanRender.vue.eta +7 -0
- package/templates/nuxt/components/renderers/DateRender.vue.eta +6 -0
- package/templates/nuxt/components/renderers/ForeignKeyRender.vue.eta +10 -0
- package/templates/nuxt/components/renderers/MoneyRender.vue.eta +7 -0
- package/templates/nuxt/components/renderers/MultiTextRender.vue.eta +11 -0
- package/templates/nuxt/composables/getDocument.generate.ts.eta +4 -0
- package/templates/nuxt/composables/getMenus.generate.ts.eta +35 -31
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +6 -1
- package/templates/nuxt/composables/goTo.generate.ts.eta +15 -0
- package/templates/nuxt/composables/notifications.generate.ts.eta +21 -0
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +11 -1
- package/templates/nuxt/error.vue._eta +20 -5
- package/templates/nuxt/layouts/documentlist.vue.eta +166 -0
- package/templates/nuxt/middleware/30.acl.global.ts.eta +4 -1
- package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +4 -4
- package/templates/nuxt/pages/[xorg]/profile.vue.eta +6 -0
- package/templates/nuxt/pages/[xorg]/user/[id].vue.eta +6 -0
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +211 -377
- package/templates/nuxt/pages/[xorg]/user.vue.eta +197 -0
- package/templates/nuxt/pages/index.vue._eta +101 -0
- package/templates/nuxt/pages/profile.vue.eta +94 -0
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +4 -4
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +11 -10
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +69 -17
- package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +6 -3
- package/templates/nuxt/tailwind.config.ts._eta +10 -0
- package/templates/nuxt/types/documentlist.ts.eta +9 -0
- package/templates/nuxt/types/events.ts.eta +20 -0
- package/templates/nuxt/types/index.ts.eta +6 -79
- package/templates/nuxt/types/notifications.ts.eta +16 -0
- package/templates/nuxt/types/others.ts.eta +42 -0
- package/templates/nuxt/types/user.ts.eta +44 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nest/src/simpleapp/generate/models/perm.model.ts.eta +0 -52
- package/templates/nest/src/simpleapp/generate/models/tenant.model.ts.eta +0 -43
- package/templates/nest/src/simpleapp/generate/models/user.model.ts.eta +0 -56
- package/templates/nuxt/components/EventMonitor.vue.eta +0 -85
- package/templates/nuxt/pages/[xorg]/tenant/index.vue.eta +0 -89
- package/templates/nuxt/pages/index.vue.eta +0 -116
- package/templates/nuxt/simpleapp/generate/commons/events.ts.eta +0 -11
|
@@ -21,13 +21,12 @@ const selectMenu = (menu:MenuData) =>{
|
|
|
21
21
|
</button>
|
|
22
22
|
|
|
23
23
|
<Dialog v-model:visible="visible" modal header="Pick Document" >
|
|
24
|
-
<div class="
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<div v-if="menu.isolationType == 'none'" class="adminmenu">
|
|
24
|
+
<div class="">
|
|
25
|
+
<Button v-for="menu in menus" @click="selectMenu(menu)">
|
|
26
|
+
<div v-if="menu.isolationType == 'none'" class="">
|
|
28
27
|
* {{ camelCaseToWords(menu.label) }}
|
|
29
28
|
</div>
|
|
30
|
-
<div v-else class="
|
|
29
|
+
<div v-else class="">{{ camelCaseToWords(menu.label) }}</div>
|
|
31
30
|
</Button>
|
|
32
31
|
</div>
|
|
33
32
|
</Dialog>
|
|
@@ -37,19 +36,5 @@ const selectMenu = (menu:MenuData) =>{
|
|
|
37
36
|
</div>
|
|
38
37
|
</template>
|
|
39
38
|
<style scoped>
|
|
40
|
-
|
|
41
|
-
@apply m-2 p-2 space-x-2 rounded-sm text-center grid grid-cols-4 gap-4;
|
|
42
|
-
}
|
|
43
|
-
.desktop-shortcut-link .adminmenu {
|
|
44
|
-
@apply bg-red-300 p-2;
|
|
45
|
-
}
|
|
46
|
-
.desktop-shortcut-link .adminmenu:hover {
|
|
47
|
-
@apply bg-red-600 p-2;
|
|
48
|
-
}
|
|
49
|
-
.desktop-shortcut-link .usermenu {
|
|
50
|
-
@apply bg-teal-300 p-2;
|
|
51
|
-
}
|
|
52
|
-
.desktop-shortcut-link .usermenu:hover {
|
|
53
|
-
@apply bg-teal-600 p-2;
|
|
54
|
-
}
|
|
39
|
+
|
|
55
40
|
</style>
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
3
|
<div>
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
>
|
|
8
|
-
</Button>
|
|
4
|
+
<button class="" @click="previewPermission">
|
|
5
|
+
<i class="pi pi-question-circle" ></i>
|
|
6
|
+
</button>
|
|
9
7
|
<Sidebar
|
|
10
8
|
v-model:visible="showpermissioninfo"
|
|
11
|
-
modal
|
|
9
|
+
modal
|
|
12
10
|
:header="permissiontitle"
|
|
13
11
|
position="right"
|
|
14
12
|
>
|
|
15
13
|
<SelectButton v-model="selectedgroup" @change="selectGroup" :options="grouplist" option-label="label" option-value="value"></SelectButton>
|
|
16
14
|
<div v-if="selectedgroup">
|
|
17
|
-
<div v-if="useRuntimeConfig().public.DEBUGDATA" class="flex flex-row gap-2 p-2">
|
|
15
|
+
<div v-if="useRuntimeConfig().public.DEBUGDATA" class="flex flex-row gap-2 p-2 ">
|
|
18
16
|
<div class="flex align-items-center">
|
|
19
17
|
<RadioButton v-model="mode" inputId="modepreview" name="pizza" value="preview" />
|
|
20
18
|
<label for="modepreview" class="ml-2">Preview</label>
|
|
@@ -5,7 +5,21 @@ import {ref} from 'vue'
|
|
|
5
5
|
|
|
6
6
|
const userprofileoverlay = ref();
|
|
7
7
|
const toggle = (event:any) => {
|
|
8
|
-
userprofileoverlay.value.toggle(event);
|
|
8
|
+
userprofileoverlay.value.toggle(event);
|
|
9
|
+
}
|
|
10
|
+
const toProfile = ()=>{
|
|
11
|
+
userprofileoverlay.value.toggle();
|
|
12
|
+
|
|
13
|
+
if(getCurrentXorg()){
|
|
14
|
+
navigateTo(`/${getCurrentXorg()}/profile`)
|
|
15
|
+
}else{
|
|
16
|
+
navigateTo(`/profile`)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
const toFrontpage = () =>{
|
|
21
|
+
userprofileoverlay.value.toggle();
|
|
22
|
+
navigateTo('/')
|
|
9
23
|
}
|
|
10
24
|
|
|
11
25
|
</script>
|
|
@@ -16,37 +30,40 @@ const toggle = (event:any) => {
|
|
|
16
30
|
|
|
17
31
|
<div class="flex flex-row-reverse cursor-pointer border-none w-full" @click="toggle">
|
|
18
32
|
<p>{{ getUserProfile().fullName }}</p>
|
|
19
|
-
<Avatar :image="getUserStore().getAvatarLink(32)" class="" size="normal" shape="circle" />
|
|
33
|
+
<!-- <Avatar :image="getUserStore().getAvatarLink(32)" class="" size="normal" shape="circle" /> -->
|
|
34
|
+
<div class="w-8 h-8 bg-cover bg-center rounded-md">
|
|
35
|
+
<img :src="getAvatarLink(getUserProfile().email,32)" alt="" class="h-full w-full overflow-hidden object-cover rounded-full border-2 border-white dark:border-gray-700 shadow" />
|
|
36
|
+
</div>
|
|
20
37
|
</div>
|
|
21
38
|
|
|
22
39
|
</div>
|
|
23
|
-
<OverlayPanel ref="userprofileoverlay">
|
|
24
|
-
<div
|
|
25
|
-
<div class="
|
|
26
|
-
<div class="
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
<OverlayPanel :pt="{root:{class:'w w-80'}}" ref="userprofileoverlay">
|
|
41
|
+
<div>
|
|
42
|
+
<div class="py-2 transition duration-150 ease-in-out z-10 absolute top-0 right-0 bottom-0 left-0" id="modal">
|
|
43
|
+
<div role="alert" class="container mx-auto w-full md:w-full max-w-lg">
|
|
44
|
+
<div class="relative p-4 md:p-8 bg-white dark:bg-gray-800 shadow-md rounded border border-gray-400">
|
|
45
|
+
<div class="w-full flex items-center justify-start text-gray-600 dark:text-gray-400 mb-5 cursor-pointer" @click="toProfile">
|
|
46
|
+
<div class="w-12 h-12 bg-cover bg-center rounded-md">
|
|
47
|
+
<img :src="getAvatarLink(getUserProfile().email,32)" alt="" class="h-full w-full overflow-hidden object-cover rounded-full border-2 border-white dark:border-gray-700 shadow" />
|
|
48
|
+
</div>
|
|
49
|
+
<div class="flex flex-col cursor-pointer" >
|
|
50
|
+
<h1 class="text-left text-gray-800 dark:text-gray-100 font-lg font-bold tracking-normal leading-tight ml-2">{{ getUserProfile().fullName }}</h1>
|
|
51
|
+
<p class="text-gray-400 dark:text-gray-100 font-normal text-base tracking-normal ml-2 mr-4">{{getUserProfile().group }}</p>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div class="flex items-center justify-start w-full">
|
|
57
|
+
<button class="focus:outline-none transition duration-150 ease-in-out hover:bg-gray-600 bg-gray-700 rounded text-white px-8 py-2 text-sm" @click="toFrontpage">Tenant</button>
|
|
58
|
+
<!-- <button class="focus:outline-none transition duration-150 ease-in-out bg-gray-600 rounded text-white px-8 py-2 text-sm" @click="toFrontpage">Pick Tenant</button> -->
|
|
59
|
+
<button class="focus:outline-none ml-3 bg-warning-100 dark:bg-warning-700 dark:border-warning-700 dark:hover:bg-warning-600 transition duration-150 text-gray-600 dark:text-gray-400 ease-in-out hover:border-gray-400 hover:bg-gray-300 border rounded px-8 py-2 text-sm" @click="logout()">Logout</button>
|
|
60
|
+
</div>
|
|
35
61
|
</div>
|
|
36
62
|
</div>
|
|
37
63
|
</div>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<div class="flex flex-row gap-2 border">
|
|
41
|
-
<Button class="border">
|
|
42
|
-
<i class="pi pi-user"></i>profile
|
|
43
|
-
</Button>
|
|
44
|
-
<Button class="border" @click="logout()">
|
|
45
|
-
<i class="pi pi-sign-out"></i>logout
|
|
46
|
-
</Button>
|
|
64
|
+
|
|
47
65
|
</div>
|
|
48
|
-
|
|
49
|
-
</div>
|
|
66
|
+
|
|
50
67
|
</OverlayPanel>
|
|
51
68
|
</div>
|
|
52
69
|
</template>
|
|
@@ -156,7 +156,7 @@ onNuxtReady(()=>{
|
|
|
156
156
|
<DebugDocumentData v-model="data"/>
|
|
157
157
|
</div>
|
|
158
158
|
|
|
159
|
-
<Dialog v-model:visible="visible" modal :header="popuptitle" class="crudsimple-dialog" :autoZIndex="false" :
|
|
159
|
+
<Dialog v-model:visible="visible" modal :header="popuptitle" class="crudsimple-dialog" :autoZIndex="false" :pt="{root:{class:'h-full w-full bg-white'}}">
|
|
160
160
|
<SimpleAppForm :document="obj" #default="o">
|
|
161
161
|
<div class="simpleapp-tool-bar col-span-4 text-left gap-4" >
|
|
162
162
|
<Button class=" btn-default" :disabled="disabled" @click="newData" type="button" v-if="canPerform(resourcename,'create')">New</Button>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by simpleapp generator during initialization.
|
|
4
|
+
* DO NOT MODIFY IT BY HAND.
|
|
5
|
+
* last change 2023-09-09
|
|
6
|
+
* author: Ks Tan
|
|
7
|
+
*/
|
|
8
|
+
import {Notification, EventType} from '~/types'
|
|
9
|
+
import { useToast, } from 'primevue/usetoast';
|
|
10
|
+
import type { ToastMessageOptions } from 'primevue/toast';
|
|
11
|
+
import Toast from 'primevue/toast';
|
|
12
|
+
import { stringify } from 'ajv';
|
|
13
|
+
import {upperFirst, last } from 'lodash'
|
|
14
|
+
|
|
15
|
+
// const toast = useToast();
|
|
16
|
+
// const { $event,$listen } = useNuxtApp()
|
|
17
|
+
// WildcardHandler<Record<EventType, unknown>>
|
|
18
|
+
// let resmsg:ToastMessageOptions = {} as ToastMessageOptions
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
// $listen('*',(type:key of EventType,data:any)=>{
|
|
22
|
+
// console.log("Event type",type,'data',data)
|
|
23
|
+
// let arrupdate = type.split(':')
|
|
24
|
+
// let eventdata = data
|
|
25
|
+
// let duration = 3000
|
|
26
|
+
// let severity:typeof resmsg['severity']
|
|
27
|
+
// let isshow=true
|
|
28
|
+
// let toastgroup='default'
|
|
29
|
+
// let eventname = arrupdate[1]
|
|
30
|
+
// let eventtype = arrupdate[0]
|
|
31
|
+
// let title = ''
|
|
32
|
+
// if(type.indexOf('error')>=0){
|
|
33
|
+
// duration = 0
|
|
34
|
+
// severity='error'
|
|
35
|
+
// title=upperFirst(eventname) +' failed'
|
|
36
|
+
// }
|
|
37
|
+
// else if(type.indexOf('warn')>=0){
|
|
38
|
+
// duration = 10000
|
|
39
|
+
// severity='warn'
|
|
40
|
+
// title=upperFirst(eventname) +' with warning'
|
|
41
|
+
// }
|
|
42
|
+
// else if(type.indexOf('info')>=0){
|
|
43
|
+
// duration = 3000
|
|
44
|
+
// severity='info'
|
|
45
|
+
// isshow=false
|
|
46
|
+
// title='Info'
|
|
47
|
+
// }
|
|
48
|
+
// else if(type.indexOf('success')>=0){
|
|
49
|
+
// duration = 3000
|
|
50
|
+
// severity='success'
|
|
51
|
+
// title= upperFirst(eventname) +' successfully'
|
|
52
|
+
// }
|
|
53
|
+
// if(Array.isArray(data)){
|
|
54
|
+
// toastgroup='list'
|
|
55
|
+
// }else if(typeof data == 'object'){
|
|
56
|
+
// // title = camelCaseToWords(useCamelCase(title.replace(":","-")))
|
|
57
|
+
// eventdata = data.message
|
|
58
|
+
// }
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
// if(isshow && severity){
|
|
62
|
+
// console.log("isshow",isshow,"event:",severity,eventdata)
|
|
63
|
+
// toast.removeAllGroups()
|
|
64
|
+
// resmsg = { severity: severity, summary: title, detail :eventdata, life: duration, group:toastgroup}
|
|
65
|
+
// toast.add(resmsg)
|
|
66
|
+
// }
|
|
67
|
+
// isshow=false
|
|
68
|
+
|
|
69
|
+
// })
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
// const getFieldName = (path:string)=>{
|
|
73
|
+
// const lastword :string= last<string>(path.split('/'))??''
|
|
74
|
+
// return camelCaseToWords(lastword)
|
|
75
|
+
// // const lastField = path.split
|
|
76
|
+
// }
|
|
77
|
+
</script>
|
|
78
|
+
<template>
|
|
79
|
+
<div></div>
|
|
80
|
+
<!-- <Toast group="default" :pt="{}">
|
|
81
|
+
<template #message="p">
|
|
82
|
+
<div class="bg-gray-200 dark:bg-gray-900 h-full w-full border">
|
|
83
|
+
<div class=" flex content content-end w-full">
|
|
84
|
+
<div role="alert" class="w-full bg-white dark:bg-gray-800 shadow-lg rounded flex flex-row transition duration-150 ease-in-out" id="notification">
|
|
85
|
+
<div class=" flex items-center justify-center bg-primary-500 sm:rounded-tl sm:rounded-bl h-12 sm:h-auto sm:w-auto text-white">
|
|
86
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" fill="currentColor">
|
|
87
|
+
<path class="heroicon-ui" d="M12 22a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm-2.3-8.7l1.3 1.29 3.3-3.3a1 1 0 0 1 1.4 1.42l-4 4a1 1 0 0 1-1.4 0l-2-2a1 1 0 0 1 1.4-1.42z" />
|
|
88
|
+
</svg>
|
|
89
|
+
</div>
|
|
90
|
+
<div class="flex flex-col justify-center pl-4 xl:pl-1 w-96 pt-4 sm:pb-4 pb-2">
|
|
91
|
+
<p class="text-lg text-gray-800 dark:text-gray-100 font-semibold pb-1">{{ p.message.summary }}</p>
|
|
92
|
+
<p class="text-sm text-gray-600 dark:text-gray-400 font-normal"></p>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="flex sm:flex-col sm:justify-center sm:border-l dark:border-gray-700 w w-36 items-center border-gray-300 pl-4">
|
|
95
|
+
<div class="sm:pt-4 pb-4 sm:border-b dark:border-gray-700 border-gray-300 w w-full flex sm:justify-center">
|
|
96
|
+
<span class="sm:text-sm text-xs text-green-400 font-bold mr-4 sm:mr-0 cursor-pointer">View</span>
|
|
97
|
+
</div>
|
|
98
|
+
<div class="sm:pt-4 pb-4 flex sm:justify-center w w-full cursor-pointer" >
|
|
99
|
+
<span class="sm:text-sm text-xs text-gray-600 dark:text-gray-400 cursor-pointer" @click="toast.remove(p.message)">Dismiss</span>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</template>
|
|
106
|
+
</Toast>
|
|
107
|
+
<Toast group="list">
|
|
108
|
+
<template #message="p">
|
|
109
|
+
|
|
110
|
+
<ol>
|
|
111
|
+
<li v-for="(item,index) in p.message.detail" :key="index"><b>{{getFieldName(item.instancePath)}}</b>: {{ item.message }}</li>
|
|
112
|
+
</ol>
|
|
113
|
+
</template>
|
|
114
|
+
</Toast> -->
|
|
115
|
+
</template>
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by simpleapp generator during initialization.
|
|
4
|
+
* DO NOT MODIFY IT BY HAND.
|
|
5
|
+
* last change 2023-09-09
|
|
6
|
+
* author: Ks Tan
|
|
7
|
+
*/
|
|
8
|
+
import {Notification, NotificationStatus} from '~/types'
|
|
9
|
+
import { useToast, } from 'primevue/usetoast';
|
|
10
|
+
import type { ToastMessageOptions } from 'primevue/toast';
|
|
11
|
+
import Toast from 'primevue/toast';
|
|
12
|
+
import { stringify } from 'ajv';
|
|
13
|
+
import {upperFirst, last } from 'lodash'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const toast = useToast();
|
|
17
|
+
const { $event,$listen } = useNuxtApp()
|
|
18
|
+
// WildcardHandler<Record<EventType, unknown>>
|
|
19
|
+
let resmsg:ToastMessageOptions = {} as ToastMessageOptions
|
|
20
|
+
|
|
21
|
+
$listen("Notification",(data:Notification)=>{
|
|
22
|
+
// $listen('*',(type:key of EventType,data:any)=>{
|
|
23
|
+
console.log("Event type",'data',data)
|
|
24
|
+
const type:NotificationStatus = data.status
|
|
25
|
+
// let arrupdate = type.split(':')
|
|
26
|
+
// let eventdata = data
|
|
27
|
+
let duration = 3000
|
|
28
|
+
// let severity:typeof resmsg['severity']
|
|
29
|
+
// let isshow=true
|
|
30
|
+
let toastgroup='default'
|
|
31
|
+
// let eventname = arrupdate[1]
|
|
32
|
+
// let eventtype = arrupdate[0]
|
|
33
|
+
// let title = ''
|
|
34
|
+
switch(type){
|
|
35
|
+
case NotificationStatus.success:
|
|
36
|
+
duration = 3000
|
|
37
|
+
break;
|
|
38
|
+
case NotificationStatus.danger:
|
|
39
|
+
duration = 0
|
|
40
|
+
break;
|
|
41
|
+
case NotificationStatus.warning:
|
|
42
|
+
duration = 5000
|
|
43
|
+
break;
|
|
44
|
+
case NotificationStatus.info:
|
|
45
|
+
duration = 3000
|
|
46
|
+
break;
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
// if(type=='error'){
|
|
50
|
+
// duration = 0
|
|
51
|
+
// severity='error'
|
|
52
|
+
// title=upperFirst(eventname) +' failed'
|
|
53
|
+
// }
|
|
54
|
+
// else if(type.indexOf('warn')>=0){
|
|
55
|
+
// duration = 10000
|
|
56
|
+
// severity='warn'
|
|
57
|
+
// title=upperFirst(eventname) +' with warning'
|
|
58
|
+
// }
|
|
59
|
+
// else if(type.indexOf('info')>=0){
|
|
60
|
+
// duration = 3000
|
|
61
|
+
// severity='info'
|
|
62
|
+
// isshow=false
|
|
63
|
+
// title='Info'
|
|
64
|
+
// }
|
|
65
|
+
// else if(type.indexOf('success')>=0){
|
|
66
|
+
// duration = 3000
|
|
67
|
+
// severity='success'
|
|
68
|
+
// title= upperFirst(eventname) +' successfully'
|
|
69
|
+
// }
|
|
70
|
+
// if(Array.isArray(data)){
|
|
71
|
+
// toastgroup='list'
|
|
72
|
+
// }else if(typeof data == 'object'){
|
|
73
|
+
// // title = camelCaseToWords(useCamelCase(title.replace(":","-")))
|
|
74
|
+
// eventdata = data.message
|
|
75
|
+
// }
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
// if(isshow && severity){
|
|
79
|
+
// console.log("isshow",isshow,"event:",severity,eventdata)
|
|
80
|
+
toast.removeAllGroups()
|
|
81
|
+
resmsg = { severity: type as typeof resmsg['severity'], summary: data.summary, detail :data.data, life: duration, group:toastgroup}
|
|
82
|
+
toast.add(resmsg)
|
|
83
|
+
// }
|
|
84
|
+
// isshow=false
|
|
85
|
+
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
const getFieldName = (path:string)=>{
|
|
90
|
+
const lastword :string= last<string>(path.split('/'))??''
|
|
91
|
+
return camelCaseToWords(lastword)
|
|
92
|
+
// const lastField = path.split
|
|
93
|
+
}
|
|
94
|
+
</script>
|
|
95
|
+
<template>
|
|
96
|
+
<Toast group="default" :pt="{}">
|
|
97
|
+
<template #message="p">
|
|
98
|
+
<div class="bg-gray-200 dark:bg-gray-900 h-full w-full border">
|
|
99
|
+
<div class=" flex content content-end w-full">
|
|
100
|
+
<div role="alert" class="w-full bg-white dark:bg-gray-800 shadow-lg rounded flex flex-row transition duration-150 ease-in-out" id="notification">
|
|
101
|
+
<div :class="'flex items-center justify-center sm:rounded-tl sm:rounded-bl h-12 sm:h-auto sm:w-auto text-white'+getStatusColor(p.message.severity)">
|
|
102
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" fill="currentColor">
|
|
103
|
+
<path class="heroicon-ui" d="M12 22a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm-2.3-8.7l1.3 1.29 3.3-3.3a1 1 0 0 1 1.4 1.42l-4 4a1 1 0 0 1-1.4 0l-2-2a1 1 0 0 1 1.4-1.42z" />
|
|
104
|
+
</svg>
|
|
105
|
+
</div>
|
|
106
|
+
<div class="flex flex-col justify-center pl-4 xl:pl-1 w-96 pt-4 sm:pb-4 pb-2">
|
|
107
|
+
<p class="text-lg text-gray-800 dark:text-gray-100 font-semibold pb-1">{{ p.message.summary }}</p>
|
|
108
|
+
|
|
109
|
+
<div v-if="p.message.detail">
|
|
110
|
+
<p v-if="Array.isArray(p.message.detail)"
|
|
111
|
+
v-for="item in p.message.detail"
|
|
112
|
+
class="text-sm text-gray-600 dark:text-gray-400 font-normal">
|
|
113
|
+
<span v-if="item.instancePath">{{ item.instancePath }} </span>
|
|
114
|
+
<span v-if="item.message"> {{ item.message }} </span>
|
|
115
|
+
|
|
116
|
+
</p>
|
|
117
|
+
<p v-else-if="typeof p.message.detail == 'string'" class="text-sm text-gray-600 dark:text-gray-400 font-normal">{{ p.message.detail }}</p>
|
|
118
|
+
<p v-else></p>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
<div class="rounded m m-6"><button @click="toast.remove(p.message)" class="text-gray-800 hover:text-gray-300 "><i class="pi pi-times"></i></button></div>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</template>
|
|
126
|
+
</Toast>
|
|
127
|
+
<!-- <Toast group="list">
|
|
128
|
+
<template #message="p">
|
|
129
|
+
<div class="bg-gray-200 dark:bg-gray-900 h-full">
|
|
130
|
+
<div class="relative mx-auto flex justify-center sm:justify-end pt-16 sm:pt-6 pb-6 sm:pb-16 h-64 overflow-x-hidden">
|
|
131
|
+
<div role="alert" class="sm:mr-6 mt-16 sm:mt-6 mb-6 sm:mb-0 xl:w-5/12 mx-auto absolute left-0 sm:left-auto right-0 sm:top-0 sm:w-6/12 md:w-3/5 justify-between w-11/12 bg-white dark:bg-gray-800 shadow-lg rounded flex sm:flex-row flex-col transition duration-150 ease-in-out" id="notification">
|
|
132
|
+
<div class="sm:px-6 p-2 flex mt-4 sm:mt-0 ml-4 sm:ml-0 items-center justify-center bg-green-400 sm:rounded-tl sm:rounded-bl w-12 h-12 sm:h-auto sm:w-auto text-white">
|
|
133
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40" fill="currentColor">
|
|
134
|
+
<path class="heroicon-ui" d="M12 22a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm-2.3-8.7l1.3 1.29 3.3-3.3a1 1 0 0 1 1.4 1.42l-4 4a1 1 0 0 1-1.4 0l-2-2a1 1 0 0 1 1.4-1.42z" />
|
|
135
|
+
</svg>
|
|
136
|
+
</div>
|
|
137
|
+
<div class="flex flex-col justify-center xl:-ml-4 pl-4 xl:pl-1 sm:w-3/5 pt-4 sm:pb-4 pb-2">
|
|
138
|
+
<p class="text-lg text-gray-800 dark:text-gray-100 font-semibold pb-1">Action Completed</p>
|
|
139
|
+
<p class="text-sm text-gray-600 dark:text-gray-400 font-normal">You have successfully completed the survey. You will soon receive a reward email. Stay tuned.</p>
|
|
140
|
+
</div>
|
|
141
|
+
<div class="flex sm:flex-col sm:justify-center sm:border-l dark:border-gray-700 items-center border-gray-300 sm:w-1/6 pl-4 sm:pl-0">
|
|
142
|
+
<div class="sm:pt-4 pb-4 sm:border-b dark:border-gray-700 border-gray-300 sm:w-full flex sm:justify-center">
|
|
143
|
+
<span class="sm:text-sm text-xs text-green-400 font-bold mr-4 sm:mr-0 cursor-pointer">View</span>
|
|
144
|
+
</div>
|
|
145
|
+
<div class="sm:pt-4 pb-4 flex sm:justify-center w-full cursor-pointer" @click="toast.remove(p.message)">
|
|
146
|
+
<span class="sm:text-sm text-xs text-gray-600 dark:text-gray-400 cursor-pointer">Dismiss</span>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
<ol>
|
|
153
|
+
<li v-for="(item,index) in p.message.detail" :key="index"><b>{{getFieldName(item.instancePath)}}</b>: {{ item.message }}</li>
|
|
154
|
+
</ol>
|
|
155
|
+
</template>
|
|
156
|
+
</Toast> -->
|
|
157
|
+
</template>
|
|
@@ -8,7 +8,7 @@ import ButtonProfile from './ButtonProfile.vue';
|
|
|
8
8
|
<template>
|
|
9
9
|
<!-- <header> -->
|
|
10
10
|
<!-- <MegaMenu :model="getMenus()" orientation="horizontal" /> -->
|
|
11
|
-
<div class="bg-white
|
|
11
|
+
<div class="bg-white border-b-gray-300 h-10 flex flex-row">
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
<div class="flex-1 flex flex-row gap-2 p-2">
|
|
@@ -17,7 +17,7 @@ import ButtonProfile from './ButtonProfile.vue';
|
|
|
17
17
|
|
|
18
18
|
</div>
|
|
19
19
|
<div class="">
|
|
20
|
-
<ButtonHome
|
|
20
|
+
<ButtonHome/>
|
|
21
21
|
</div>
|
|
22
22
|
|
|
23
23
|
</div>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<script setup lang="ts">
|
|
19
19
|
import Dialog from 'primevue/dialog';
|
|
20
20
|
import {onMounted, ref} from 'vue'
|
|
21
|
-
import {
|
|
21
|
+
import {EventType} from '../types'
|
|
22
22
|
import ProgressSpinner from 'primevue/progressspinner'
|
|
23
23
|
const {$userstore,$event}= useNuxtApp()
|
|
24
24
|
const disabled = ref(false)
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
|
|
38
38
|
// await reloadUserStore()
|
|
39
39
|
await $userstore.decideInvitation(id,'accept')
|
|
40
|
-
$event(
|
|
40
|
+
$event('InvitationAccepted',id)
|
|
41
41
|
visible.value=false
|
|
42
42
|
}
|
|
43
43
|
const decline = async (id:string) => {
|
|
44
44
|
// await reloadUserStore()
|
|
45
45
|
await $userstore.decideInvitation(id,'reject')
|
|
46
|
-
$event(
|
|
46
|
+
$event('InvitationRejected',id)
|
|
47
47
|
visible.value=false
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import _ from 'lodash'
|
|
3
3
|
import {ref} from 'vue'
|
|
4
4
|
|
|
5
|
-
const selectedbranch = ref(
|
|
5
|
+
const selectedbranch = ref(getCurrentXorg())
|
|
6
6
|
const currentTenant=ref(getUserProfile().tenantId)
|
|
7
7
|
console.log("currentTenant",currentTenant.value)
|
|
8
8
|
type Org = {orgId:number, label:string,_id:string}
|
|
@@ -23,10 +23,13 @@ const getBranchesForOrg = (org:Org)=>{
|
|
|
23
23
|
const switchXorg = ()=>{
|
|
24
24
|
navigateTo(`/${selectedbranch.value}`,{external:true})
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
console.log("selectedbranch",selectedbranch.value)
|
|
26
28
|
</script>
|
|
27
29
|
<template>
|
|
28
30
|
<div>
|
|
29
|
-
|
|
31
|
+
|
|
32
|
+
<select v-if="selectedbranch" v-model="selectedbranch" class=" text-right" @change="switchXorg()">
|
|
30
33
|
<optgroup v-for="o in orgList" :label="o.label">
|
|
31
34
|
<option v-for="b in getBranchesForOrg(o)" :value="b['xOrg']">{{ b['branch']['branchCode']}} </option>
|
|
32
35
|
</optgroup>
|