@simitgroup/simpleapp-generator 1.0.46 → 1.0.48
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 +35 -1
- package/buildinschemas copy/docnoformat.docno.jsonschema.json +2 -20
- package/dist/buildinschemas/autoincreament.js +1 -1
- package/dist/buildinschemas/autoincreament.js.map +1 -1
- package/dist/buildinschemas/branch.js +1 -1
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/docnoformat.d.ts.map +1 -1
- package/dist/buildinschemas/docnoformat.js +12 -25
- package/dist/buildinschemas/docnoformat.js.map +1 -1
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +1 -0
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +11 -3
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +33 -22
- package/dist/generate.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
- package/dist/processors/jsonschemabuilder.js +10 -0
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/type.d.ts +115 -22
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/autoincreament.ts +1 -1
- package/src/buildinschemas/branch.ts +1 -1
- package/src/buildinschemas/docnoformat.ts +13 -27
- package/src/buildinschemas/user.ts +1 -0
- package/src/framework.ts +11 -3
- package/src/generate.ts +35 -22
- package/src/index.ts +1 -1
- package/src/processors/jsonschemabuilder.ts +14 -1
- package/src/type.ts +137 -22
- package/templates/basic/nest/processor.ts.eta +5 -3
- package/templates/basic/nest/service.ts.eta +2 -4
- package/templates/basic/nuxt/pages.crud.vue.eta +3 -2
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +18 -2
- package/templates/nest/src/app.controller.ts.eta +6 -0
- package/templates/nest/src/app.module.ts.eta +9 -1
- package/templates/nest/src/app.service.ts.eta +6 -0
- package/templates/nest/src/main.ts.eta +7 -0
- package/templates/nest/src/simpleapp/generate/apischemas/index.ts.eta +6 -2
- package/templates/nest/src/simpleapp/generate/commons/audittrail.service.ts.eta +17 -0
- package/templates/nest/src/simpleapp/generate/commons/decorators/appuser.decorator.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +14 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/foreignkeys.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +9 -3
- package/templates/nest/src/simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta +23 -3
- package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +52 -10
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/providers/workflow.provider.ts.etax +6 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.decorator.ts.eta +6 -1
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.guard.ts.eta +6 -1
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +15 -7
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/models/apievent.model.ts.eta +27 -0
- package/templates/nest/src/simpleapp/generate/models/perm.model.ts.eta +3 -4
- package/templates/nest/src/simpleapp/generate/models/tenant.model.ts.eta +3 -5
- package/templates/nest/src/simpleapp/generate/models/user.model.ts.eta +3 -4
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +54 -12
- package/templates/nest/src/simpleapp/generate/types/apievent.type.ts.eta +22 -0
- package/templates/nest/src/simpleapp/generate/types/index.ts.eta +6 -0
- package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +6 -0
- package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +6 -0
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +6 -0
- package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +6 -0
- package/templates/nest/src/simpleapp/services/autoinc.service.ts.eta +5 -6
- package/templates/nest/src/simpleapp/services/branch.service.ts.eta +50 -10
- package/templates/nest/src/simpleapp/services/docno.service.ts.eta +9 -10
- package/templates/nest/src/simpleapp/services/org.service.ts.eta +4 -6
- package/templates/nest/src/simpleapp/services/perm.service.ts.eta +6 -7
- package/templates/nest/src/simpleapp/services/tenant.service.ts.eta +5 -6
- package/templates/nest/src/simpleapp/services/user.service.ts.eta +5 -6
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +6 -8
- package/templates/nuxt/app.vue.eta +6 -1
- package/templates/nuxt/assets/css/style.css._eta +12 -0
- package/templates/nuxt/assets/css/tailwind.css._eta +10 -0
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +37 -0
- package/templates/nuxt/components/ButtonCreateTenant.vue.eta +68 -0
- package/templates/nuxt/components/ButtonHome.vue.eta +10 -0
- package/templates/nuxt/components/ButtonLogout.vue.eta +9 -0
- package/templates/nuxt/components/ButtonMenuPicker.vue.eta +55 -0
- package/templates/nuxt/components/ButtonPermissionInfo.vue.eta +113 -0
- package/templates/nuxt/components/ButtonProfile.vue.eta +52 -0
- package/templates/nuxt/components/CrudNestedDoc.vue.eta +16 -8
- package/templates/nuxt/components/CrudSimple.vue.eta +13 -11
- package/templates/nuxt/components/DebugDocumentData.vue.eta +1 -1
- package/templates/nuxt/components/HeaderBar.vue.eta +39 -0
- package/templates/nuxt/components/Invitation.vue.eta +2 -2
- package/templates/nuxt/components/ListView.vue.eta +52 -0
- package/templates/nuxt/components/Menus.vue.eta +6 -6
- package/templates/nuxt/components/SelectBranch.vue.eta +35 -0
- package/templates/nuxt/components/SimpleAppDatatable.vue.eta +0 -1
- package/templates/nuxt/components/SimpleAppDocumentNo.vue.eta +2 -2
- package/templates/nuxt/components/SimpleAppInputTable.vue.eta +2 -2
- package/templates/nuxt/components/SimpleFieldContainer.vue.eta +18 -12
- package/templates/nuxt/components/Spinner.vue.eta +9 -0
- package/templates/nuxt/composables/getMenus.generate.ts.eta +5 -4
- package/templates/nuxt/layouts/default.vue.eta +3 -12
- package/templates/nuxt/layouts/sidelistcrud.vue.eta +43 -0
- package/templates/nuxt/middleware/{10.acl.global.ts.eta → 30.acl.global.ts.eta} +6 -0
- package/templates/nuxt/nuxt.config.ts.eta +55 -12
- package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +274 -247
- package/templates/nuxt/pages/[xorg]/index.vue._eta +13 -0
- package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +89 -65
- package/templates/nuxt/pages/[xorg]/permission/index.vue.eta +7 -7
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +33 -33
- package/templates/nuxt/pages/index.vue.eta +10 -85
- package/templates/nuxt/pages/login.vue.eta +9 -3
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +16 -19
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +19 -3
- package/templates/nuxt/plugins/50.simpleapp-client.ts.eta +4 -4
- package/templates/nuxt/server/api/[xorg]/[...].ts.eta +4 -4
- package/templates/nuxt/server/api/auth/[...].ts.eta +6 -0
- package/templates/nuxt/server/api/auth/logout.ts.eta +6 -1
- package/templates/nuxt/server/api/profile/[...].ts.eta +4 -5
- package/templates/nuxt/server/api/profile/index.ts.eta +4 -6
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +9 -2
- package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +12 -3
- package/templates/nuxt/simpleapp/generate/commons/events.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/commons/groups.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +6 -0
- package/templates/nuxt/tailwind.config.ts._eta +66 -0
- package/templates/nuxt/types/index.ts.eta +22 -1
- package/templates/project/build.sh.eta +4 -4
- package/templates/project/schemas/category.ts.eta +40 -27
- package/templates/project/schemas/customer.ts.eta +35 -0
- package/templates/project/schemas/index.ts.eta +4 -4
- package/templates/project/schemas/invoice.ts.eta +56 -0
- package/templates/project/schemas/product.ts.eta +41 -57
- package/templates/project/sharelibs/index.ts.eta +2 -0
- package/templates/project/sharelibs/money.ts.eta +17 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/assets/css/tailwind.css.eta +0 -35
- package/templates/nuxt/components/PermissionInfo.vue.eta +0 -92
- package/templates/nuxt/pages/[xorg]/index.vue.eta +0 -36
- package/templates/nuxt/tailwind.config.ts.eta +0 -9
- package/templates/project/shares/index.ts.eta +0 -2
- /package/templates/nest/{.env.eta → .env._eta} +0 -0
- /package/templates/nuxt/{.env.eta → .env._eta} +0 -0
- /package/templates/nuxt/pages/[xorg]/branch/{index.vue.eta → index.vue.etax} +0 -0
- /package/templates/project/{config.json.eta → config.json._eta} +0 -0
- /package/templates/project/{shares → sharelibs}/hello.ts.eta +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator.
|
|
3
|
-
*
|
|
4
|
-
* last change 2023-
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
import { InjectModel } from '@nestjs/mongoose';
|
|
@@ -11,7 +11,7 @@ import { Injectable } from '@nestjs/common';
|
|
|
11
11
|
import { UserProcessor } from '../generate/processors/user.processor';
|
|
12
12
|
import { Permission } from '../generate/types/perm.type';
|
|
13
13
|
import { User } from '../generate/types/user.type';
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
export { User } from '../generate/types/user.type';
|
|
16
16
|
|
|
17
17
|
|
|
@@ -21,9 +21,8 @@ export class UserService extends UserProcessor {
|
|
|
21
21
|
constructor(
|
|
22
22
|
@InjectModel('User') mydoc: Model<User>,
|
|
23
23
|
@InjectModel('Permission') private permdoc: Model<Permission>,
|
|
24
|
-
docnogenerator: DocNumberFormatGenerator,
|
|
25
24
|
) {
|
|
26
|
-
super(mydoc
|
|
25
|
+
super(mydoc);
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
hook = async (appuser: UserContext, type: string, data?: any) => {
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
* This file was automatically generated by simpleapp generator.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* last change 2023-09-09
|
|
2
|
+
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
+
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
+
* last change 2023-10-28
|
|
7
5
|
* Author: Ks Tan
|
|
8
6
|
*/
|
|
9
7
|
import { Module } from '@nestjs/common';
|
|
10
8
|
import { MongooseModule } from '@nestjs/mongoose';
|
|
11
9
|
import {DocNumberFormatGenerator} from './generate/commons/docnogenerator.service'
|
|
12
|
-
|
|
10
|
+
import { AuditTrail } from './generate/commons/audittrail.service';
|
|
13
11
|
// auto import modules
|
|
14
12
|
<% for(let i=0;i<it.modules.length; i++){ %>
|
|
15
13
|
<% let obj = it.modules[i]%>
|
|
@@ -37,7 +35,7 @@ import { ProfileService } from './profile/profile.service';
|
|
|
37
35
|
]),
|
|
38
36
|
],
|
|
39
37
|
controllers: [<% for(let i=0;i<it.modules.length; i++){ %><%= it.modules[i].docname %>Controller,<%}%> ProfileController],
|
|
40
|
-
providers: [DocNumberFormatGenerator,<% for(let i=0;i<it.modules.length; i++){ %><%= it.modules[i].docname %>Service,<%}%> ProfileService,],
|
|
41
|
-
exports:[DocNumberFormatGenerator,<% for(let i=0;i<it.modules.length; i++){ %><%= it.modules[i].docname %>Service,<%}%> ProfileService,]
|
|
38
|
+
providers: [AuditTrail,DocNumberFormatGenerator,<% for(let i=0;i<it.modules.length; i++){ %><%= it.modules[i].docname %>Service,<%}%> ProfileService,],
|
|
39
|
+
exports:[AuditTrail,DocNumberFormatGenerator,<% for(let i=0;i<it.modules.length; i++){ %><%= it.modules[i].docname %>Service,<%}%> ProfileService,]
|
|
42
40
|
})
|
|
43
41
|
export class GenerateModule {}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { usePassThrough } from "primevue/passthrough";
|
|
2
|
+
import Tailwind from "primevue/passthrough/tailwind";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const CustomTailwind = usePassThrough(
|
|
6
|
+
Tailwind,
|
|
7
|
+
{
|
|
8
|
+
button:{
|
|
9
|
+
root:{
|
|
10
|
+
class:['p-2 m-2 border']
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
dialog:{
|
|
14
|
+
root:{
|
|
15
|
+
class:['bg-white border p-2' ]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
panel: {
|
|
19
|
+
root:{
|
|
20
|
+
class:['border']
|
|
21
|
+
},
|
|
22
|
+
title: {
|
|
23
|
+
class: ['leading-none font-light text-2xl']
|
|
24
|
+
},
|
|
25
|
+
header:{
|
|
26
|
+
class:['bg bg-gray-200 h-10 content-middle']
|
|
27
|
+
},
|
|
28
|
+
content:{
|
|
29
|
+
class:['']
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
export default CustomTailwind;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<Button class="btn-primary " @click="visible = true">
|
|
4
|
+
<i class="pi pi-sitemap mr-2"></i>Create My Company
|
|
5
|
+
</Button>
|
|
6
|
+
<Dialog
|
|
7
|
+
v-model:visible="visible"
|
|
8
|
+
modal
|
|
9
|
+
:header="createtitle"
|
|
10
|
+
class="crudsimple-dialog"
|
|
11
|
+
>
|
|
12
|
+
<form @submit.prevent="true" class="flex flex-col text-center">
|
|
13
|
+
<div v-if="errCreateTenant" class="text-error">
|
|
14
|
+
{{ errCreateTenant }}
|
|
15
|
+
</div>
|
|
16
|
+
<InputText
|
|
17
|
+
v-else
|
|
18
|
+
type="text"
|
|
19
|
+
autofocus="true"
|
|
20
|
+
v-model:model-value="data.tenantName"
|
|
21
|
+
placeholder="Organization Name"
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
<Button class=" btn-primary" type="submit" @click="createTenant" :loading="onhold">
|
|
25
|
+
Create <span class="pi pi-save"></span>
|
|
26
|
+
</Button>
|
|
27
|
+
</form>
|
|
28
|
+
</Dialog>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
</template>
|
|
32
|
+
<script setup lang="ts">
|
|
33
|
+
import {ref} from 'vue'
|
|
34
|
+
import {AxiosResponse} from 'axios'
|
|
35
|
+
const visible = ref(false);
|
|
36
|
+
const data = ref({tenantName: "",});
|
|
37
|
+
|
|
38
|
+
const createtitle = ref("Create My Company");
|
|
39
|
+
const errCreateTenant = ref();
|
|
40
|
+
const onhold = ref(false);
|
|
41
|
+
|
|
42
|
+
const createTenant = async () => {
|
|
43
|
+
onhold.value = true;
|
|
44
|
+
const { $axios, $listen } = useNuxtApp();
|
|
45
|
+
|
|
46
|
+
const openapi = getApi();
|
|
47
|
+
const apipath = `${useRuntimeConfig().public.API_URL}`;
|
|
48
|
+
let profileapi = new openapi.PROFILEApi(undefined, apipath, $axios);
|
|
49
|
+
|
|
50
|
+
profileapi
|
|
51
|
+
.createTenant(data.value)
|
|
52
|
+
.then((res:AxiosResponse) => {
|
|
53
|
+
if (res && res.status && res.status == 201) {
|
|
54
|
+
if (res.data && res.data["xOrg"]) {
|
|
55
|
+
const xorg = res.data["xOrg"];
|
|
56
|
+
navigateTo("/" + xorg, { external: true });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
.catch((err) => {
|
|
61
|
+
errCreateTenant.value = err["message"];
|
|
62
|
+
console.error("errCreateTenant", err);
|
|
63
|
+
})
|
|
64
|
+
.finally(() => {
|
|
65
|
+
onhold.value = false;
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button class="flex flex-row">
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
|
4
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" />
|
|
5
|
+
</svg>
|
|
6
|
+
|
|
7
|
+
<span>{{ getUserProfile().orgName }}</span>
|
|
8
|
+
|
|
9
|
+
</button>
|
|
10
|
+
</template>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button class="flex flex-row">
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
|
4
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15M12 9l-3 3m0 0l3 3m-3-3h12.75" />
|
|
5
|
+
</svg>
|
|
6
|
+
<span>logout</span>
|
|
7
|
+
|
|
8
|
+
</button>
|
|
9
|
+
</template>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import Dialog from 'primevue/dialog';
|
|
3
|
+
import {ref} from 'vue'
|
|
4
|
+
import {MenuData} from '~/types'
|
|
5
|
+
const visible = ref(false)
|
|
6
|
+
const menus = getMenus();
|
|
7
|
+
// const emit = defineEmits(['select'])
|
|
8
|
+
const selectMenu = (menu:MenuData) =>{
|
|
9
|
+
navigateTo(menu.url)
|
|
10
|
+
visible.value=false
|
|
11
|
+
// emit('select',menu)
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
<template>
|
|
15
|
+
<div>
|
|
16
|
+
|
|
17
|
+
<button class="text-center border-none cursor-pointer" v-if="useRoute().params.xorg" @click="visible=true">
|
|
18
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
|
19
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" />
|
|
20
|
+
</svg>
|
|
21
|
+
</button>
|
|
22
|
+
|
|
23
|
+
<Dialog v-model:visible="visible" modal header="Pick Document" >
|
|
24
|
+
<div class="desktop-shortcut-link">
|
|
25
|
+
|
|
26
|
+
<Button v-for="menu in menus[1].items" @click="selectMenu(menu)">
|
|
27
|
+
<div v-if="menu.isolationType == 'none'" class="adminmenu">
|
|
28
|
+
* {{ camelCaseToWords(menu.label) }}
|
|
29
|
+
</div>
|
|
30
|
+
<div v-else class="usermenu">{{ camelCaseToWords(menu.label) }}</div>
|
|
31
|
+
</Button>
|
|
32
|
+
</div>
|
|
33
|
+
</Dialog>
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
<style scoped>
|
|
40
|
+
.desktop-shortcut-link {
|
|
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
|
+
}
|
|
55
|
+
</style>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
|
|
3
|
+
<div>
|
|
4
|
+
<Button
|
|
5
|
+
class="btn-primary pi pi-question"
|
|
6
|
+
@click="previewPermission"
|
|
7
|
+
>
|
|
8
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
|
|
9
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z" />
|
|
10
|
+
</svg>
|
|
11
|
+
</Button>
|
|
12
|
+
<Sidebar
|
|
13
|
+
v-model:visible="showpermissioninfo"
|
|
14
|
+
modal
|
|
15
|
+
:header="permissiontitle"
|
|
16
|
+
position="right"
|
|
17
|
+
>
|
|
18
|
+
<SelectButton v-model="selectedgroup" @change="selectGroup" :options="grouplist" option-label="label" option-value="value"></SelectButton>
|
|
19
|
+
<div v-if="selectedgroup">
|
|
20
|
+
<div v-if="useRuntimeConfig().public.DEBUGDATA" class="flex flex-row gap-2 p-2">
|
|
21
|
+
<div class="flex align-items-center">
|
|
22
|
+
<RadioButton v-model="mode" inputId="modepreview" name="pizza" value="preview" />
|
|
23
|
+
<label for="modepreview" class="ml-2">Preview</label>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="flex align-items-center">
|
|
26
|
+
<RadioButton v-model="mode" inputId="modeedit" name="edit" value="edit" />
|
|
27
|
+
<label for="modeedit" class="ml-2">Edit</label>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="flex align-items-center">
|
|
30
|
+
<RadioButton v-model="mode" inputId="modejson" name="json" value="json" />
|
|
31
|
+
<label for="modejson" class="ml-2">JSON</label>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
</div>
|
|
35
|
+
<div v-if="mode=='json'">
|
|
36
|
+
<div class="flex-row">
|
|
37
|
+
<div><Button @click="copyText">copy</Button> </div>
|
|
38
|
+
<div class="text text-gray-400">{{ copied }}</div>
|
|
39
|
+
</div>
|
|
40
|
+
<pre id="permissionstr">
|
|
41
|
+
{{ permissions }}
|
|
42
|
+
</pre>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="permission-block flex flex-col m mt-4" v-for="res in allresources" v-else="showjson">
|
|
45
|
+
<div class="m mr-3 ">{{ res }}</div>
|
|
46
|
+
<div class="gap-4" v-if="allactions">
|
|
47
|
+
<SelectButton v-if="mode=='edit'" multiple :options="allactions[res]" v-model="permissions[res]"></SelectButton>
|
|
48
|
+
|
|
49
|
+
<span v-else v-for="actionname in allactions[res]" class="m m-1">
|
|
50
|
+
<Chip class="bg-primary" v-if="canPerformAction(selectedgroup,res,actionname)" severity="success" :label="actionname" ></Chip>
|
|
51
|
+
<Chip v-else :label="actionname" ></Chip>
|
|
52
|
+
</span>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</Sidebar>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
<script setup lang="ts">
|
|
62
|
+
import _ from "lodash";
|
|
63
|
+
import Chip from 'primevue/chip';
|
|
64
|
+
import RadioButton from 'primevue/radiobutton';
|
|
65
|
+
import {ref} from 'vue'
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
const showpermissioninfo = ref(false)
|
|
69
|
+
const permissiontitle = "Permission Information";
|
|
70
|
+
const selectedgroup = ref('')
|
|
71
|
+
const grouplist = getAllGroups().map((item)=>{return {value:item,label:_.capitalize(item)}})
|
|
72
|
+
const mode = ref('preview')
|
|
73
|
+
|
|
74
|
+
const allresources = getUniqueResource()
|
|
75
|
+
const allactions = ref()
|
|
76
|
+
const permissions=ref()
|
|
77
|
+
|
|
78
|
+
const activeroles = ref()
|
|
79
|
+
const copied = ref('')
|
|
80
|
+
|
|
81
|
+
const previewPermission = () => {
|
|
82
|
+
showpermissioninfo.value = true;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
const copyText = () => {
|
|
87
|
+
copied.value="copied!"
|
|
88
|
+
const storage = document.createElement('textarea');
|
|
89
|
+
storage.value = String(document.getElementById('permissionstr')?.innerHTML)
|
|
90
|
+
document.body.appendChild(storage);
|
|
91
|
+
storage.select();
|
|
92
|
+
storage.setSelectionRange(0, 99999);
|
|
93
|
+
document.execCommand('copy');
|
|
94
|
+
document.body.removeChild(storage);
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
const selectGroup = (selectedgroup:any) => {
|
|
100
|
+
const groupname = selectedgroup.value
|
|
101
|
+
activeroles.value= getGroupRoles(groupname)
|
|
102
|
+
allactions.value={}
|
|
103
|
+
permissions.value={}
|
|
104
|
+
for(let i=0; i< allresources.length; i++){
|
|
105
|
+
const r = allresources[i]
|
|
106
|
+
console.log(r)
|
|
107
|
+
const actions = getActionFromResource(r)
|
|
108
|
+
allactions.value[r]=actions
|
|
109
|
+
permissions.value[r]=getGroupResourcePermission(groupname,r).map(item=>item.action)
|
|
110
|
+
}
|
|
111
|
+
console.log(allactions.value,permissions.value)
|
|
112
|
+
}
|
|
113
|
+
</script>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Avatar from 'primevue/avatar';
|
|
3
|
+
import OverlayPanel from 'primevue/overlaypanel';
|
|
4
|
+
import {ref} from 'vue'
|
|
5
|
+
|
|
6
|
+
const userprofileoverlay = ref();
|
|
7
|
+
const toggle = (event:any) => {
|
|
8
|
+
userprofileoverlay.value.toggle(event);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div>
|
|
15
|
+
<div class=" w-[120px] truncate ...">
|
|
16
|
+
|
|
17
|
+
<div class="flex flex-row-reverse cursor-pointer border-none w-full" @click="toggle">
|
|
18
|
+
<p>{{ getUserProfile().fullName }}</p>
|
|
19
|
+
<Avatar :image="getUserStore().getAvatarLink(32)" class="" size="normal" shape="circle" />
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
</div>
|
|
23
|
+
<OverlayPanel ref="userprofileoverlay">
|
|
24
|
+
<div class="flex flex-col">
|
|
25
|
+
<div class="flex flex-row">
|
|
26
|
+
<div class="content-center border">
|
|
27
|
+
<Avatar :image="getUserStore().getAvatarLink(60)" class="mr-2" size="xlarge" shape="circle" />
|
|
28
|
+
</div>
|
|
29
|
+
<div>
|
|
30
|
+
<div class="text text-center border">
|
|
31
|
+
{{getUserProfile().fullName }}
|
|
32
|
+
</div>
|
|
33
|
+
<div class="text text-center text-sm border" >
|
|
34
|
+
{{getUserProfile().group }}
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</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>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
</div>
|
|
50
|
+
</OverlayPanel>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
@@ -53,7 +53,11 @@ defineShortcuts({
|
|
|
53
53
|
'ctrl_enter': () => newData()
|
|
54
54
|
})
|
|
55
55
|
const refresh = () => {
|
|
56
|
-
|
|
56
|
+
const searchbody: SearchBody = {
|
|
57
|
+
fields: props.listColumns.concat(['created']),
|
|
58
|
+
// sorts:props.sorts
|
|
59
|
+
}
|
|
60
|
+
obj.search(searchbody).then((res:any) => {
|
|
57
61
|
recordlist.value = res;
|
|
58
62
|
disabled.value=false
|
|
59
63
|
});
|
|
@@ -65,8 +69,8 @@ const newData = () => {
|
|
|
65
69
|
$event("newRecord")
|
|
66
70
|
};
|
|
67
71
|
|
|
68
|
-
const triggerEdit = (
|
|
69
|
-
let id =
|
|
72
|
+
const triggerEdit = (data: any) => {
|
|
73
|
+
let id = data._id.toString()
|
|
70
74
|
router.push({ path: `${props.path}/${id}` })
|
|
71
75
|
};
|
|
72
76
|
const editRecord = (id:string) => {
|
|
@@ -129,13 +133,17 @@ onNuxtReady(()=>{
|
|
|
129
133
|
<template>
|
|
130
134
|
<div class="simpleapp-crudnesteddocument">
|
|
131
135
|
<h1 v-if="systemwindows" class="error-text text-center">* It is system administration screen</h1>
|
|
132
|
-
<
|
|
136
|
+
<Button class="btn-primary" @click="newData" v-tooltip="'Add new(ctrl+enter)'" v-if="canPerform(resourcename,'create')">New</Button>
|
|
133
137
|
<SimpleAppDatatable
|
|
134
138
|
@row-dblclick="triggerEdit"
|
|
135
139
|
v-model="recordlist"
|
|
136
140
|
:setting="{}"
|
|
137
141
|
:columns="listColumns"
|
|
138
142
|
>
|
|
143
|
+
<Column header=" ">
|
|
144
|
+
<template #body="{index,data}">
|
|
145
|
+
<Button icon="pi pi-pencil" class="btn-primary" @click="triggerEdit(data)"></Button>
|
|
146
|
+
</template></Column>
|
|
139
147
|
</SimpleAppDatatable>
|
|
140
148
|
|
|
141
149
|
|
|
@@ -144,10 +152,10 @@ onNuxtReady(()=>{
|
|
|
144
152
|
<Dialog v-model:visible="visible" modal :header="popuptitle" class="crudsimple-dialog" :autoZIndex="false" :style="{zIndex:100, width: '80vw' }">
|
|
145
153
|
<SimpleAppForm :document="obj" #default="o">
|
|
146
154
|
<div class="simpleapp-tool-bar col-span-4 text-left gap-4" >
|
|
147
|
-
<
|
|
148
|
-
<
|
|
149
|
-
<
|
|
150
|
-
<
|
|
155
|
+
<Button class=" btn-default" :disabled="disabled" @click="newData" type="button" v-if="canPerform(resourcename,'create')">New</Button>
|
|
156
|
+
<Button class=" btn-primary" :disabled="disabled" @click="createData" type="button" v-if="canPerform(resourcename,'update') && data.created==''">Create</Button>
|
|
157
|
+
<Button class=" btn-primary" :disabled="disabled" @click="updateData" type="button" v-if="canPerform(resourcename,'update') && data.created!=''">Update</Button>
|
|
158
|
+
<Button class=" btn-danger" :disabled="disabled" @click="deleteData($event)" type="button" v-if="canPerform(resourcename,'delete') && data.created!=''">Delete</Button>
|
|
151
159
|
<ProgressSpinner v-if="disabled==true" style="width: 2rem; height: 2rem" ></ProgressSpinner>
|
|
152
160
|
<ConfirmPopup></ConfirmPopup>
|
|
153
161
|
|
|
@@ -70,8 +70,8 @@ const newData = () => {
|
|
|
70
70
|
$event("newRecord")
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
const triggerEdit = (
|
|
74
|
-
let id =
|
|
73
|
+
const triggerEdit = (data: any) => {
|
|
74
|
+
let id = data._id
|
|
75
75
|
router.push({ path: `${props.path}/${id}` })
|
|
76
76
|
};
|
|
77
77
|
const editRecord = (id:string) => {
|
|
@@ -140,15 +140,17 @@ onNuxtReady(()=>{
|
|
|
140
140
|
|
|
141
141
|
<template>
|
|
142
142
|
<div class="simpleapp-crudsimple">
|
|
143
|
-
<h1 v-if="systemwindows" class="error-text text-center">* system administration screen</h1>
|
|
144
|
-
|
|
145
|
-
<
|
|
146
|
-
<SimpleAppDatatable
|
|
147
|
-
@row-dblclick="triggerEdit"
|
|
143
|
+
<h1 v-if="systemwindows" class="error-text text-center">* system administration screen</h1>
|
|
144
|
+
<Button class=" btn-primary" @click="newData" v-tooltip="'Add new(ctrl+enter)'" v-if="canPerform(resourcename,'create')">New</Button>
|
|
145
|
+
<SimpleAppDatatable
|
|
148
146
|
v-model="recordlist"
|
|
149
147
|
:setting="{}"
|
|
150
148
|
:columns="listColumns"
|
|
151
149
|
>
|
|
150
|
+
<Column header=" ">
|
|
151
|
+
<template #body="{index,data}">
|
|
152
|
+
<Button icon="pi pi-pencil" class="btn-primary" @click="triggerEdit(data)"></Button>
|
|
153
|
+
</template></Column>
|
|
152
154
|
</SimpleAppDatatable>
|
|
153
155
|
|
|
154
156
|
<DebugDocumentData v-model="data"/>
|
|
@@ -157,10 +159,10 @@ onNuxtReady(()=>{
|
|
|
157
159
|
<Dialog v-model:visible="visible" modal :header="popuptitle" class="crudsimple-dialog" :autoZIndex="false" :style="{zIndex:100, width: '80vw' }">
|
|
158
160
|
<SimpleAppForm :document="obj" #default="o">
|
|
159
161
|
<div class="simpleapp-tool-bar col-span-4 text-left gap-4" >
|
|
160
|
-
<
|
|
161
|
-
<
|
|
162
|
-
<
|
|
163
|
-
<
|
|
162
|
+
<Button class=" btn-default" :disabled="disabled" @click="newData" type="button" v-if="canPerform(resourcename,'create')">New</Button>
|
|
163
|
+
<Button class=" btn-primary" :disabled="disabled" @click="createData" type="button" v-if="canPerform(resourcename,'create') && data.created==''">Create</Button>
|
|
164
|
+
<Button class=" btn-primary" :disabled="disabled" @click="updateData" type="button" v-if="canPerform(resourcename,'update') && data.created!=''">Update</Button>
|
|
165
|
+
<Button class=" btn-danger" :disabled="disabled" @click="deleteData($event)" type="button" v-if="canPerform(resourcename,'delete') && data.created!=''">Delete</Button>
|
|
164
166
|
<ProgressSpinner v-if="disabled==true" style="width: 2rem; height: 2rem" ></ProgressSpinner>
|
|
165
167
|
<ConfirmPopup></ConfirmPopup>
|
|
166
168
|
|
|
@@ -18,7 +18,7 @@ const label = ref(props.label??'Debug')
|
|
|
18
18
|
</script>
|
|
19
19
|
<template>
|
|
20
20
|
<div class="floatright" v-if="isdebug=='1'">
|
|
21
|
-
<
|
|
21
|
+
<Button @click="visible=true">{{ label }}</Button>
|
|
22
22
|
<Dialog v-model:visible="visible" modal header="Debug data" :style="{ width: '80vw' }">
|
|
23
23
|
<pre>{{ modelValue }}</pre>
|
|
24
24
|
</Dialog>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import ButtonMenuPicker from "./ButtonMenuPicker.vue"
|
|
3
|
+
|
|
4
|
+
import ButtonProfile from './ButtonProfile.vue';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
</script>
|
|
8
|
+
<template>
|
|
9
|
+
<!-- <header> -->
|
|
10
|
+
<!-- <MegaMenu :model="getMenus()" orientation="horizontal" /> -->
|
|
11
|
+
<div class="bg-white border-b-2 border-b-gray-300 h-10 flex flex-row">
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
<div class="flex-1 flex flex-row gap-2 p-2">
|
|
15
|
+
<div class="">
|
|
16
|
+
<ButtonMenuPicker/>
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
<div class="">
|
|
20
|
+
<ButtonHome @click="navigateTo(`/${getUserProfile().currentxorg}`)"/>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
</div>
|
|
24
|
+
<div class="flex-1 flex flex-row-reverse gap-2 p-2">
|
|
25
|
+
|
|
26
|
+
<div class=" text-right">
|
|
27
|
+
<ButtonProfile/>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div class="">
|
|
31
|
+
<SelectBranch/>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
</div>
|
|
38
|
+
<!-- </header> -->
|
|
39
|
+
</template>
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
<div class="text text-xs text-gray-500 italic">{{ item.created }}</div>
|
|
9
9
|
</div>
|
|
10
10
|
<div >
|
|
11
|
-
<
|
|
12
|
-
<
|
|
11
|
+
<Button class="btn-primary" @click="approve(item._id)">Approve</Button>
|
|
12
|
+
<Button class="btn-danger" @click="decline(item._id)">Decline</Button>
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
15
15
|
</div>
|