release v2.0.0 #4
|
@ -9,7 +9,7 @@ const config = {
|
||||||
// Do not change required Modules !!
|
// Do not change required Modules !!
|
||||||
requiredModules: ['User'],
|
requiredModules: ['User'],
|
||||||
// here you can import plugins.
|
// here you can import plugins.
|
||||||
loadModules: []
|
loadModules: ['Balance']
|
||||||
};
|
};
|
||||||
|
|
||||||
// do not change anything here !!
|
// do not change anything here !!
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<template>
|
||||||
|
<q-page padding>
|
||||||
|
<h1>Add works</h1>
|
||||||
|
</q-page>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent } from '@vue/composition-api'
|
||||||
|
export default defineComponent({
|
||||||
|
// name: 'PageName'
|
||||||
|
})
|
||||||
|
</script>
|
|
@ -0,0 +1,48 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<q-page padding v-if="checkMain">
|
||||||
|
<q-card>
|
||||||
|
<q-card-section>
|
||||||
|
<q-list
|
||||||
|
v-for="(mainRoute, index) in mainRoutes"
|
||||||
|
:key="'mainRoute' + index"
|
||||||
|
>
|
||||||
|
<essential-link
|
||||||
|
v-for="(route, index2) in mainRoute.children"
|
||||||
|
:key="'route' + index2"
|
||||||
|
:title="route.title"
|
||||||
|
:icon="route.icon"
|
||||||
|
:link="route.name"
|
||||||
|
v-if="hasPermissions(route.permissions)"
|
||||||
|
/>
|
||||||
|
</q-list>
|
||||||
|
</q-card-section>
|
||||||
|
</q-card>
|
||||||
|
</q-page>
|
||||||
|
<router-view />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { computed, defineComponent } from '@vue/composition-api';
|
||||||
|
import EssentialLink from 'src/components/navigation/EssentialLink.vue';
|
||||||
|
import mainRoutes from 'src/plugins/balance/routes';
|
||||||
|
export default defineComponent({
|
||||||
|
// name: 'PageName'
|
||||||
|
components: { EssentialLink },
|
||||||
|
setup(_, { root }) {
|
||||||
|
const checkMain = computed(() => {
|
||||||
|
return root.$route.matched.length == 2;
|
||||||
|
});
|
||||||
|
function hasPermissions(permissions: FG.Permission[] | undefined) {
|
||||||
|
if (permissions) {
|
||||||
|
return permissions.every(permission => {
|
||||||
|
return root.$store.getters['user/permissions'].includes(permission)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return { checkMain, mainRoutes, hasPermissions };
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -0,0 +1,13 @@
|
||||||
|
import {Module} from 'vuex';
|
||||||
|
import {StateInterface} from "src/store";
|
||||||
|
import mainRoutes from "./routes"
|
||||||
|
import { FG_Plugin } from 'src/plugins';
|
||||||
|
|
||||||
|
const plugin: FG_Plugin.Plugin = {
|
||||||
|
name: 'Balance',
|
||||||
|
mainRoutes,
|
||||||
|
requiredModules: ['User'],
|
||||||
|
version: '0.0.1',
|
||||||
|
}
|
||||||
|
|
||||||
|
export default plugin;
|
|
@ -0,0 +1,43 @@
|
||||||
|
import {FG_Plugin} from 'src/plugins';
|
||||||
|
|
||||||
|
const permissions = {
|
||||||
|
// Show own and others balance
|
||||||
|
SHOW: "balance_show",
|
||||||
|
SHOW_OTHER: "balance_show_others",
|
||||||
|
// Credit balance
|
||||||
|
ADD: "balance_add",
|
||||||
|
// Debit balance
|
||||||
|
SUB: "balance_sub",
|
||||||
|
// Send from to other
|
||||||
|
SEND: "balance_send",
|
||||||
|
// Send from other to another
|
||||||
|
SEND_OTHER: "balance_send_others",
|
||||||
|
// Can set limit for users
|
||||||
|
SET_LIMIT: "balance_set_limit",
|
||||||
|
//Allow sending / sub while exceeding the set limit
|
||||||
|
EXCEED_LIMIT: "balance_exceed_limit"
|
||||||
|
}
|
||||||
|
|
||||||
|
const mainRoutes: FG_Plugin.PluginRouteConfig[] = [
|
||||||
|
{
|
||||||
|
title: 'Gerücht',
|
||||||
|
icon: 'mdi-cash-100',
|
||||||
|
path: 'balance',
|
||||||
|
name: 'balance',
|
||||||
|
component: () => import('../pages/MainPage.vue'),
|
||||||
|
meta: {permissions: ['user']},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: 'Anschreiben',
|
||||||
|
icon: 'mdi-cash-100',
|
||||||
|
path: 'balance-add',
|
||||||
|
name: 'balance-add',
|
||||||
|
shortcut: true,
|
||||||
|
meta: {permissions: [permissions.ADD, permissions.SHOW]},
|
||||||
|
component: () => import('../pages/Add.vue')
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
export default mainRoutes
|
Loading…
Reference in New Issue