2021-10-23 21:34:02 +02:00
|
|
|
<template>
|
|
|
|
<div id="admin">
|
|
|
|
<div class="container" v-if="!userLoading">
|
2021-10-24 20:13:28 +02:00
|
|
|
<router-view
|
2021-10-23 21:34:02 +02:00
|
|
|
v-if="isAuthUserAmin"
|
2021-10-24 20:13:28 +02:00
|
|
|
:appConfig="appConfig"
|
2021-10-23 21:34:02 +02:00
|
|
|
:appStatistics="appStatistics"
|
|
|
|
/>
|
|
|
|
<NotFound v-else />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { computed, ComputedRef, defineComponent, onBeforeMount } from 'vue'
|
|
|
|
|
|
|
|
import NotFound from '@/components/Common/NotFound.vue'
|
|
|
|
import { ROOT_STORE, USER_STORE } from '@/store/constants'
|
2021-10-24 20:13:28 +02:00
|
|
|
import { TAppConfig, IAppStatistics } from '@/types/application'
|
2021-10-23 21:34:02 +02:00
|
|
|
import { useStore } from '@/use/useStore'
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
name: 'Admin',
|
|
|
|
components: {
|
|
|
|
NotFound,
|
|
|
|
},
|
|
|
|
setup() {
|
|
|
|
const store = useStore()
|
|
|
|
|
|
|
|
onBeforeMount(() =>
|
|
|
|
store.dispatch(ROOT_STORE.ACTIONS.GET_APPLICATION_STATS)
|
|
|
|
)
|
|
|
|
|
|
|
|
const appLoading: ComputedRef<boolean> = computed(
|
|
|
|
() => store.getters[ROOT_STORE.GETTERS.APP_LOADING]
|
|
|
|
)
|
2021-10-24 20:13:28 +02:00
|
|
|
const appConfig: ComputedRef<TAppConfig> = computed(
|
|
|
|
() => store.getters[ROOT_STORE.GETTERS.APP_CONFIG]
|
|
|
|
)
|
2021-10-23 21:34:02 +02:00
|
|
|
const appStatistics: ComputedRef<IAppStatistics> = computed(
|
|
|
|
() => store.getters[ROOT_STORE.GETTERS.APP_STATS]
|
|
|
|
)
|
|
|
|
const isAuthUserAmin: ComputedRef<boolean> = computed(
|
|
|
|
() => store.getters[USER_STORE.GETTERS.IS_ADMIN]
|
|
|
|
)
|
|
|
|
const userLoading: ComputedRef<boolean> = computed(
|
|
|
|
() => store.getters[USER_STORE.GETTERS.USER_LOADING]
|
|
|
|
)
|
|
|
|
|
2021-10-24 20:13:28 +02:00
|
|
|
return {
|
|
|
|
appConfig,
|
|
|
|
appLoading,
|
|
|
|
appStatistics,
|
|
|
|
isAuthUserAmin,
|
|
|
|
userLoading,
|
|
|
|
}
|
2021-10-23 21:34:02 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import '~@/scss/base.scss';
|
2021-10-24 20:13:28 +02:00
|
|
|
|
|
|
|
#admin {
|
|
|
|
.admin-card {
|
|
|
|
width: 100%;
|
|
|
|
::v-deep(.card) {
|
|
|
|
.admin-form {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
label {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
margin: $default-margin 0;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
|
|
input {
|
|
|
|
width: 50%;
|
|
|
|
font-size: 0.9em;
|
|
|
|
margin-right: $default-margin * 5;
|
|
|
|
@media screen and (max-width: $medium-limit) {
|
|
|
|
margin-right: 0;
|
|
|
|
}
|
|
|
|
@media screen and (max-width: $small-limit) {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:disabled {
|
|
|
|
-webkit-appearance: none;
|
|
|
|
-moz-appearance: textfield;
|
|
|
|
background-color: white;
|
|
|
|
border-color: white;
|
|
|
|
color: var(--app-color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.form-buttons {
|
|
|
|
display: flex;
|
|
|
|
gap: $default-padding;
|
|
|
|
margin-bottom: $default-margin;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-10-23 21:34:02 +02:00
|
|
|
</style>
|