Merge branch 'next' of groeger-clan.duckdns.org:newgeruecht-vue into next

This commit is contained in:
Dominik 2021-01-26 20:49:33 +01:00
commit aba0046c84
8 changed files with 30 additions and 24 deletions

View File

@ -39,7 +39,10 @@ declare namespace FG {
type: EventType; type: EventType;
jobs: Array<Job>; jobs: Array<Job>;
} }
type EventType = string; interface EventType {
id: number;
name: string;
}
interface Job { interface Job {
id: number; id: number;
start: Date; start: Date;

View File

@ -1,10 +1,8 @@
<template> <template>
<q-page padding class="fit row justify-center items-center content-center"> <q-page padding class="fit row justify-center items-center content-center">
<q-card class="col-xs-11 col-sm-8 col-md-6 col-lg-4 justify-center items-center content-center"> <q-card class="col-xs-11 col-sm-8 col-md-6 col-lg-4 justify-center items-center content-center">
<q-toolbar class="bg-primary text-white"> <q-toolbar class="bg-primary text-white">
<q-toolbar-title> <q-toolbar-title> Passwort vergessen </q-toolbar-title>
Passwort vergessen
</q-toolbar-title>
</q-toolbar> </q-toolbar>
<q-card-section> <q-card-section>
@ -43,8 +41,6 @@ import { AxiosResponse } from 'axios';
export default defineComponent({ export default defineComponent({
// name: 'PageName' // name: 'PageName'
setup(_, { root }) { setup(_, { root }) {
const mainRoute = { name: 'dashboard' };
const password = ref(''); const password = ref('');
const password2 = ref(''); const password2 = ref('');

View File

@ -13,11 +13,11 @@
<script lang="ts"> <script lang="ts">
import { ref, computed, defineComponent, onBeforeMount } from '@vue/composition-api'; import { ref, computed, defineComponent, onBeforeMount } from '@vue/composition-api';
import UserSelector from 'src/plugins/user/components/UserSelector.vue'; import UserSelector from 'src/plugins/user/components/UserSelector.vue';
import { StateInterfaceBalance, UserBalance } from '../store/balance'; import { StateInterfaceBalance } from '../store/balance';
import { Store } from 'vuex'; import { Store } from 'vuex';
interface Props { interface Props {
showSelector: boolean; showSelector: boolean;
} }
export default defineComponent({ export default defineComponent({
@ -28,14 +28,19 @@ export default defineComponent({
onBeforeMount(() => void store.dispatch('balance/getBalance')); onBeforeMount(() => void store.dispatch('balance/getBalance'));
const store = <Store<StateInterfaceBalance>>root.$store; const store = <Store<StateInterfaceBalance>>root.$store;
const user = ref(<FG.User>store.state.user.currentUser); const user = ref(<FG.User>store.state.user.currentUser);
const balance = computed(() => {const balances = store.state.balance.balances; return balances.get(user.value.userid) || {balance: 0, limit: null} ;}); const balance = computed(() => {
const balances = store.state.balance.balances;
return balances.get(user.value.userid) || { balance: 0, limit: null };
});
const isLocked = computed(() => balance.value.limit !== null && balance.value.balance >= balance.value.limit); const isLocked = computed(
() => balance.value.limit !== null && balance.value.balance >= balance.value.limit
);
function userUpdated(selectedUser: FG.User) { function userUpdated(selectedUser: FG.User) {
void store.dispatch('balance/getBalance', selectedUser); void store.dispatch('balance/getBalance', selectedUser);
user.value = selectedUser; user.value = selectedUser;
emit('update:user', selectedUser); emit('update:user', selectedUser);
} }
return { user, balance, isLocked, userUpdated }; return { user, balance, isLocked, userUpdated };

View File

@ -8,7 +8,7 @@
<script lang="ts"> <script lang="ts">
import { computed, defineComponent, onBeforeMount } from '@vue/composition-api'; import { computed, defineComponent, onBeforeMount } from '@vue/composition-api';
import { StateInterfaceBalance, UserBalance } from 'src/plugins/balance/store/balance'; import { StateInterfaceBalance } from 'src/plugins/balance/store/balance';
import { Store } from 'vuex'; import { Store } from 'vuex';
export default defineComponent({ export default defineComponent({

View File

@ -115,7 +115,7 @@ export default defineComponent({
const eventname = ref(''); const eventname = ref('');
const eventdescription = ref(''); const eventdescription = ref('');
const eventdate = ref<Date>(); const eventdate = ref<Date>();
const eventtype = ref<FG.EventType | null>(''); // const eventtype = ref<FG.EventType | null>('');
const eventtypes = computed(() => state.eventTypes); const eventtypes = computed(() => state.eventTypes);
const jobtypes = computed(() => state.jobTypes); const jobtypes = computed(() => state.jobTypes);
let jobnum = 1; let jobnum = 1;
@ -142,7 +142,7 @@ export default defineComponent({
id: NaN, id: NaN,
start: new Date(), start: new Date(),
description: '', description: '',
type: '', type: { id: NaN, name: '' },
jobs: [newJob] jobs: [newJob]
}); });
@ -166,7 +166,7 @@ export default defineComponent({
} }
} }
function save() { function save() {
console.log('Eventtype:', eventtype); // console.log('Eventtype:', eventtype);
console.log('Event:', event); console.log('Event:', event);
store.dispatch('schedule/addEvent', event.value).catch(error => { store.dispatch('schedule/addEvent', event.value).catch(error => {
console.warn(error); console.warn(error);
@ -188,7 +188,6 @@ export default defineComponent({
eventname, eventname,
eventdescription, eventdescription,
eventdate, eventdate,
eventtype,
jobs, jobs,
addJob, addJob,
eventtypes, eventtypes,

View File

@ -1,6 +1,6 @@
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from 'src/plugins';
import mainRoutes from './routes'; import mainRoutes from './routes';
import store from './store/schedule'; import store, { ScheduleInterface } from './store/schedule';
import { Module } from 'vuex'; import { Module } from 'vuex';
import { StateInterface } from 'src/store'; import { StateInterface } from 'src/store';
@ -10,7 +10,7 @@ const plugin: FG_Plugin.Plugin = {
requiredModules: ['User'], requiredModules: ['User'],
requiredBackendModules: ['schedule'], requiredBackendModules: ['schedule'],
version: '0.0.1', version: '0.0.1',
store: new Map<string, Module<any, StateInterface>>([['schedule', store]]), store: new Map<string, Module<ScheduleInterface, StateInterface>>([['schedule', store]]),
widgets: [ widgets: [
{ {
priority: 0, priority: 0,

View File

@ -1,6 +1,6 @@
import { Module } from 'vuex'; import { Module } from 'vuex';
import userStore from './store/user'; import userStore, { UserStateInterface } from './store/user';
import sessionsStore from './store/session'; import sessionsStore, { SessionInterface } from './store/session';
import routes from './routes'; import routes from './routes';
import { StateInterface } from 'src/store'; import { StateInterface } from 'src/store';
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from 'src/plugins';
@ -11,7 +11,10 @@ const plugin: FG_Plugin.Plugin = {
requiredModules: [], requiredModules: [],
requiredBackendModules: ['auth'], requiredBackendModules: ['auth'],
version: '0.0.1', version: '0.0.1',
store: new Map<string, Module<any, StateInterface>>([ store: new Map<
string,
Module<UserStateInterface, StateInterface> | Module<SessionInterface, StateInterface>
>([
['user', userStore], ['user', userStore],
['session', sessionsStore] ['session', sessionsStore]
]), ]),