[Vue3] can now compile
This commit is contained in:
parent
8f8da5ffd1
commit
ee2a6a71eb
|
@ -16,8 +16,8 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ref, computed, defineComponent, onBeforeMount } from 'vue';
|
import { ref, computed, defineComponent, onBeforeMount } from 'vue';
|
||||||
import UserSelector from 'src/plugins/user/components/UserSelector.vue';
|
import UserSelector from 'src/plugins/user/components/UserSelector.vue';
|
||||||
import { StateInterfaceBalance } from '../store/balance';
|
import { StateInterfaceBalance, UserBalance } from '../store/balance';
|
||||||
import { Store, useStore } from 'vuex';
|
import { Store, useStore, mapGetters } from 'vuex';
|
||||||
import { UserStateInterface } from 'src/plugins/user/store/user';
|
import { UserStateInterface } from 'src/plugins/user/store/user';
|
||||||
import { StateInterface } from 'src/store';
|
import { StateInterface } from 'src/store';
|
||||||
|
|
||||||
|
@ -29,15 +29,22 @@ export default defineComponent({
|
||||||
name: 'BalanceHeader',
|
name: 'BalanceHeader',
|
||||||
components: { UserSelector },
|
components: { UserSelector },
|
||||||
props: ['showSelector'],
|
props: ['showSelector'],
|
||||||
setup(props: Props, { root, emit }) {
|
setup(_, { emit }) {
|
||||||
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 store = useStore<StateInterfaceBalance>();
|
const store = useStore<StateInterfaceBalance>();
|
||||||
|
const userGetters = mapGetters('users', ['currentUser']);
|
||||||
|
const balanceGetters = mapGetters('balance', ['balances']);
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||||
const user = ref(<FG.User>store.state.user.currentUser);
|
//const user = ref(<FG.User>store.state.user.currentUser);
|
||||||
|
const user = computed(() => <FG.User>userGetters.currentUser());
|
||||||
const balance = computed(() => {
|
const balance = computed(() => {
|
||||||
const balances = store.state.balance.balances;
|
return (
|
||||||
return balances.get(user.value.userid) || { balance: 0, limit: null };
|
(<Map<string, UserBalance>>balanceGetters.balances()).get(user.value.userid) || {
|
||||||
|
balance: 0,
|
||||||
|
limit: null,
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const isLocked = computed(
|
const isLocked = computed(
|
||||||
|
@ -46,7 +53,8 @@ export default defineComponent({
|
||||||
|
|
||||||
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;
|
//TODO:!!
|
||||||
|
//user.value = selectedUser;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||||
emit('update:user', selectedUser);
|
emit('update:user', selectedUser);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,23 +29,22 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, ref, defineComponent } from 'vue';
|
import { computed, ref, defineComponent } from 'vue';
|
||||||
import { hasPermission } from 'src/utils/permission';
|
import { hasPermission } from 'src/utils/permission';
|
||||||
import { StateInterfaceBalance } from '../store/balance';
|
import { mapGetters, Store, useStore } from 'vuex';
|
||||||
import { Store, useStore } from 'vuex';
|
|
||||||
import UserSelector from 'src/plugins/user/components/UserSelector.vue';
|
import UserSelector from 'src/plugins/user/components/UserSelector.vue';
|
||||||
import BalanceHeader from '../components/BalanceHeader.vue';
|
import BalanceHeader from '../components/BalanceHeader.vue';
|
||||||
import PERMISSIONS from '../permissions';
|
import PERMISSIONS from '../permissions';
|
||||||
import { UserStateInterface } from 'src/plugins/user/store/user';
|
import { StateInterface } from 'src/store';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'BalanceTransfer',
|
name: 'BalanceTransfer',
|
||||||
components: { BalanceHeader, UserSelector },
|
components: { BalanceHeader, UserSelector },
|
||||||
setup(_, { root, emit }) {
|
setup(_, { emit }) {
|
||||||
//const store: Store<StateInterfaceBalance> = <Store<StateInterfaceBalance>>root.$store;
|
//const store: Store<StateInterfaceBalance> = <Store<StateInterfaceBalance>>root.$store;
|
||||||
const store = useStore<Store<StateInterface>>();
|
const store = useStore<Store<StateInterface>>();
|
||||||
const userState = <UserStateInterface>store.state.user;
|
const userGetters = mapGetters('users', ['currentUser']);
|
||||||
|
|
||||||
const showSelector = computed(() => hasPermission(PERMISSIONS.SEND_OTHER, store));
|
const showSelector = computed(() => hasPermission(PERMISSIONS.SEND_OTHER));
|
||||||
const sender = ref(userState.currentUser);
|
const sender = computed(() => <FG.User>userGetters.currentUser());
|
||||||
const receiver = ref<FG.User | undefined>(undefined);
|
const receiver = ref<FG.User | undefined>(undefined);
|
||||||
const amount = ref<number>(0);
|
const amount = ref<number>(0);
|
||||||
|
|
||||||
|
@ -60,7 +59,8 @@ export default defineComponent({
|
||||||
|
|
||||||
function senderUpdated(selectedUser: FG.User) {
|
function senderUpdated(selectedUser: FG.User) {
|
||||||
console.log(selectedUser);
|
console.log(selectedUser);
|
||||||
sender.value = selectedUser;
|
//TOOD:!!
|
||||||
|
//sender.value = selectedUser;
|
||||||
}
|
}
|
||||||
function receiverUpdated(selectedUser: FG.User) {
|
function receiverUpdated(selectedUser: FG.User) {
|
||||||
receiver.value = selectedUser;
|
receiver.value = selectedUser;
|
||||||
|
|
|
@ -33,8 +33,7 @@
|
||||||
import { ref, computed, defineComponent, onUnmounted, onMounted } from 'vue';
|
import { ref, computed, defineComponent, onUnmounted, onMounted } from 'vue';
|
||||||
import { hasPermission } from 'src/utils/permission';
|
import { hasPermission } from 'src/utils/permission';
|
||||||
import { formatDateTime } from 'src/utils/datetime';
|
import { formatDateTime } from 'src/utils/datetime';
|
||||||
import { StateInterfaceBalance } from 'src/plugins/balance/store/balance';
|
import { mapGetters, Store, useStore } from 'vuex';
|
||||||
import { Store, useStore } from 'vuex';
|
|
||||||
import { StateInterface } from 'src/store';
|
import { StateInterface } from 'src/store';
|
||||||
import { UserStateInterface } from 'src/plugins/user/store/user';
|
import { UserStateInterface } from 'src/plugins/user/store/user';
|
||||||
|
|
||||||
|
@ -51,25 +50,26 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: { transaction: 'refreshText' },
|
watch: { transaction: 'refreshText' },
|
||||||
setup(props: Props, { root, emit }) {
|
setup(props, { emit }) {
|
||||||
const now = ref(Date.now());
|
const now = ref(Date.now());
|
||||||
const ival = setInterval(() => (now.value = Date.now()), 1000);
|
const ival = setInterval(() => (now.value = Date.now()), 1000);
|
||||||
//const store: Store<StateInterfaceBalance> = <Store<StateInterfaceBalance>>root.$store;
|
//const store: Store<StateInterfaceBalance> = <Store<StateInterfaceBalance>>root.$store;
|
||||||
const store = useStore<Store<StateInterface>>();
|
const store = useStore<Store<StateInterface>>();
|
||||||
const userState = <UserStateInterface>store.state.user;
|
const userGetters = mapGetters('users', ['currentUser']);
|
||||||
const text = ref('');
|
const text = ref('');
|
||||||
|
|
||||||
onUnmounted(() => clearInterval(ival));
|
onUnmounted(() => clearInterval(ival));
|
||||||
onMounted(() => refreshText());
|
onMounted(() => refreshText());
|
||||||
|
|
||||||
const isNegative = () => props.transaction.sender_id === userState.currentUser?.userid;
|
const isNegative = () =>
|
||||||
|
props.transaction.sender_id === (<FG.User>userGetters.currentUser())?.userid;
|
||||||
|
|
||||||
const refreshText = async () => {
|
const refreshText = async () => {
|
||||||
if (isNegative()) {
|
if (isNegative()) {
|
||||||
text.value = 'Anschreiben';
|
text.value = 'Anschreiben';
|
||||||
if (props.transaction.receiver_id !== null) {
|
if (props.transaction.receiver_id !== null) {
|
||||||
const user = <FG.User>await store.dispatch('user/getUser', {
|
const user = <FG.User>await store.dispatch('user/getUser', {
|
||||||
userid: props.transaction.receiver_id,
|
userid: <number>props.transaction.receiver_id,
|
||||||
});
|
});
|
||||||
text.value = `Gesendet an ${user.display_name}`;
|
text.value = `Gesendet an ${user.display_name}`;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ export default defineComponent({
|
||||||
text.value = 'Gutschrift';
|
text.value = 'Gutschrift';
|
||||||
if (props.transaction.sender_id !== null) {
|
if (props.transaction.sender_id !== null) {
|
||||||
const user = <FG.User>await store.dispatch('user/getUser', {
|
const user = <FG.User>await store.dispatch('user/getUser', {
|
||||||
userid: props.transaction.sender_id,
|
userid: <number>props.transaction.sender_id,
|
||||||
});
|
});
|
||||||
text.value = `Bekommen von ${user.display_name}`;
|
text.value = `Bekommen von ${user.display_name}`;
|
||||||
}
|
}
|
||||||
|
@ -91,9 +91,9 @@ export default defineComponent({
|
||||||
const canReverse = computed(
|
const canReverse = computed(
|
||||||
() =>
|
() =>
|
||||||
!isReversed.value &&
|
!isReversed.value &&
|
||||||
(hasPermission('balance_reversal', store) ||
|
(hasPermission('balance_reversal') ||
|
||||||
(props.transaction.sender_id === userState.currentUser?.userid &&
|
(props.transaction.sender_id === (<FG.User>userGetters.currentUser())?.userid &&
|
||||||
now.value - props.transaction.time.getTime() < 10000))
|
now.value - (<Date>props.transaction.time).getTime() < 10000))
|
||||||
);
|
);
|
||||||
|
|
||||||
function reverse() {
|
function reverse() {
|
||||||
|
@ -107,7 +107,7 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
const timeStr = computed(() => {
|
const timeStr = computed(() => {
|
||||||
const elapsed = (now.value - props.transaction.time.getTime()) / 1000;
|
const elapsed = (now.value - (<Date>props.transaction.time).getTime()) / 1000;
|
||||||
if (elapsed < 60) return `Vor ${elapsed.toFixed()} s`;
|
if (elapsed < 60) return `Vor ${elapsed.toFixed()} s`;
|
||||||
return formatDateTime(props.transaction.time, elapsed > 12 * 60 * 60, true, true) + ' Uhr';
|
return formatDateTime(props.transaction.time, elapsed > 12 * 60 * 60, true, true) + ' Uhr';
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,13 +8,18 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, onBeforeMount } from 'vue';
|
import { computed, defineComponent, onBeforeMount } from 'vue';
|
||||||
import { BalanceInterface, StateInterfaceBalance } from 'src/plugins/balance/store/balance';
|
import {
|
||||||
import { Store, useStore } from 'vuex';
|
BalanceInterface,
|
||||||
|
StateInterfaceBalance,
|
||||||
|
UserBalance,
|
||||||
|
} from 'src/plugins/balance/store/balance';
|
||||||
|
import { mapGetters, Store, useStore } from 'vuex';
|
||||||
import { UserStateInterface } from 'src/plugins/user/store/user';
|
import { UserStateInterface } from 'src/plugins/user/store/user';
|
||||||
|
import { StateInterface } from 'src/store';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'BalanceWidget',
|
name: 'BalanceWidget',
|
||||||
setup(_, { root }) {
|
setup() {
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
store.dispatch('balance/getBalance').catch((err) => {
|
store.dispatch('balance/getBalance').catch((err) => {
|
||||||
console.warn(err);
|
console.warn(err);
|
||||||
|
@ -23,11 +28,14 @@ export default defineComponent({
|
||||||
|
|
||||||
//const store = <Store<StateInterfaceBalance>>root.$store;
|
//const store = <Store<StateInterfaceBalance>>root.$store;
|
||||||
const store = useStore<Store<StateInterface>>();
|
const store = useStore<Store<StateInterface>>();
|
||||||
const balanceState = <BalanceInterface>store.state.balance;
|
const balanceGetters = mapGetters('balance', ['balances']);
|
||||||
const userState = <UserStateInterface>store.state.user;
|
const userGetters = mapGetters('user', ['currentUser']);
|
||||||
|
|
||||||
const balance = computed(
|
const balance = computed(
|
||||||
() => balanceState.balances.get(userState.currentUser.userid)?.balance || NaN
|
() =>
|
||||||
|
(<Map<string, UserBalance>>balanceGetters.balances()).get(
|
||||||
|
(<FG.User>userGetters.currentUser()).userid
|
||||||
|
)?.balance || NaN
|
||||||
);
|
);
|
||||||
|
|
||||||
return { balance };
|
return { balance };
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { StateInterfaceBalance, BalancesResponse } from '../store/balance';
|
||||||
import { Store, useStore } from 'vuex';
|
import { Store, useStore } from 'vuex';
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
// name: 'PageName'
|
// name: 'PageName'
|
||||||
setup(_, { root }) {
|
setup() {
|
||||||
//const store = <Store<StateInterfaceBalance>>root.$store;
|
//const store = <Store<StateInterfaceBalance>>root.$store;
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, ref, onMounted } from 'vue';
|
import { computed, defineComponent, ref, onMounted } from 'vue';
|
||||||
import { Store, useStore } from 'vuex';
|
import { mapGetters, Store, useStore } from 'vuex';
|
||||||
import { hasPermissions, hasSomePermissions } from 'src/utils/permission';
|
import { hasPermissions, hasSomePermissions } from 'src/utils/permission';
|
||||||
import PERMISSIONS from '../permissions';
|
import PERMISSIONS from '../permissions';
|
||||||
import { Screen } from 'quasar';
|
import { Screen } from 'quasar';
|
||||||
|
@ -76,14 +76,15 @@ import BalanceAdd from '../components/BalanceAdd.vue';
|
||||||
import BalanceTransfer from '../components/BalanceTransfer.vue';
|
import BalanceTransfer from '../components/BalanceTransfer.vue';
|
||||||
import Transaction from '../components/Transaction.vue';
|
import Transaction from '../components/Transaction.vue';
|
||||||
import { BalanceInterface, StateInterfaceBalance } from '../store/balance';
|
import { BalanceInterface, StateInterfaceBalance } from '../store/balance';
|
||||||
|
import { StateInterface } from 'src/store';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'BalanceManage',
|
name: 'BalanceManage',
|
||||||
components: { BalanceAdd, BalanceTransfer, Transaction },
|
components: { BalanceAdd, BalanceTransfer, Transaction },
|
||||||
setup(_, { root }) {
|
setup() {
|
||||||
//const store = <Store<StateInterfaceBalance>>root.$store;
|
//const store = <Store<StateInterfaceBalance>>root.$store;
|
||||||
const store = useStore<Store<StateInterface>>();
|
const store = useStore<Store<StateInterface>>();
|
||||||
const balanceState = <BalanceInterface>store.state.balance;
|
const balanceGetters = mapGetters('balance', ['balances', 'transactions']);
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
void store.dispatch('balance/getTransactions', {
|
void store.dispatch('balance/getTransactions', {
|
||||||
|
@ -91,7 +92,7 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
const transactions = computed(() => {
|
const transactions = computed(() => {
|
||||||
const a = balanceState.transactions
|
const a = (<FG.Transaction[]>balanceGetters.transactions())
|
||||||
.filter((t) => t.original_id == undefined)
|
.filter((t) => t.original_id == undefined)
|
||||||
.filter((t) => t.time > new Date(now.getFullYear(), now.getMonth(), now.getDate()))
|
.filter((t) => t.time > new Date(now.getFullYear(), now.getMonth(), now.getDate()))
|
||||||
.sort((a, b) => (a.time >= b.time ? -1 : 1));
|
.sort((a, b) => (a.time >= b.time ? -1 : 1));
|
||||||
|
@ -100,7 +101,7 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
|
|
||||||
const canAdd = () =>
|
const canAdd = () =>
|
||||||
hasSomePermissions([PERMISSIONS.DEBIT, PERMISSIONS.CREDIT, PERMISSIONS.DEBIT_OWN], store);
|
hasSomePermissions([PERMISSIONS.DEBIT, PERMISSIONS.CREDIT, PERMISSIONS.DEBIT_OWN]);
|
||||||
|
|
||||||
interface Tab {
|
interface Tab {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -109,7 +110,7 @@ export default defineComponent({
|
||||||
|
|
||||||
const tabs: Tab[] = [
|
const tabs: Tab[] = [
|
||||||
...(canAdd() ? [{ name: 'add', label: 'Anschreiben' }] : []),
|
...(canAdd() ? [{ name: 'add', label: 'Anschreiben' }] : []),
|
||||||
...(hasSomePermissions([PERMISSIONS.SEND, PERMISSIONS.SEND_OTHER], store)
|
...(hasSomePermissions([PERMISSIONS.SEND, PERMISSIONS.SEND_OTHER])
|
||||||
? [{ name: 'transfer', label: 'Übertragen' }]
|
? [{ name: 'transfer', label: 'Übertragen' }]
|
||||||
: []),
|
: []),
|
||||||
];
|
];
|
||||||
|
|
|
@ -33,19 +33,24 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, onMounted, ref } from 'vue';
|
import { computed, defineComponent, onMounted, ref } from 'vue';
|
||||||
import { BalanceInterface, StateInterfaceBalance, TransactionsResponse } from '../store/balance';
|
import {
|
||||||
import { Store, useStore } from 'vuex';
|
BalanceInterface,
|
||||||
|
StateInterfaceBalance,
|
||||||
|
TransactionsResponse,
|
||||||
|
UserBalance,
|
||||||
|
} from '../store/balance';
|
||||||
|
import { mapGetters, Store, useStore } from 'vuex';
|
||||||
import { formatDateTime } from 'src/utils/datetime';
|
import { formatDateTime } from 'src/utils/datetime';
|
||||||
import { StateInterface } from 'src/store';
|
import { StateInterface } from 'src/store';
|
||||||
import { UserStateInterface } from 'src/plugins/user/store/user';
|
import { UserStateInterface } from 'src/plugins/user/store/user';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
// name: 'PageName'
|
// name: 'PageName'
|
||||||
setup(_, { root }) {
|
setup() {
|
||||||
//const store = <Store<StateInterfaceBalance>>root.$store;
|
//const store = <Store<StateInterfaceBalance>>root.$store;
|
||||||
const store = useStore<Store<StateInterface>>();
|
const store = useStore<Store<StateInterface>>();
|
||||||
const userState = <UserStateInterface>store.state.user;
|
const userGetters = mapGetters('users', ['currentUser', 'users']);
|
||||||
const balanceState = <BalanceInterface>store.state.balance;
|
const balanceGetters = mapGetters('balace', ['balances', 'transactions']);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
void store.dispatch('balance/getBalance');
|
void store.dispatch('balance/getBalance');
|
||||||
|
@ -107,7 +112,10 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
const balance = computed(
|
const balance = computed(
|
||||||
() => balanceState.balances.get(userState.currentUser.userid)?.balance || NaN
|
() =>
|
||||||
|
(<Map<string, UserBalance>>balanceGetters.balances()).get(
|
||||||
|
(<FG.User>userGetters.currentUser()).userid
|
||||||
|
)?.balance || NaN
|
||||||
);
|
);
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
|
@ -141,7 +149,8 @@ export default defineComponent({
|
||||||
else {
|
else {
|
||||||
if (row.receiver_id == null) return 'Angeschrieben';
|
if (row.receiver_id == null) return 'Angeschrieben';
|
||||||
else {
|
else {
|
||||||
if (row.receiver_id === userState.currentUser?.userid) return 'Bekommen von X';
|
if (row.receiver_id === (<FG.User>userGetters.currentUser())?.userid)
|
||||||
|
return 'Bekommen von X';
|
||||||
else return 'Gesendet an X';
|
else return 'Gesendet an X';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,7 +167,7 @@ export default defineComponent({
|
||||||
label: 'Benutzer',
|
label: 'Benutzer',
|
||||||
field: 'author_id',
|
field: 'author_id',
|
||||||
format: (val: string) => {
|
format: (val: string) => {
|
||||||
const user = userState.users.filter((x) => x.userid == val);
|
const user = (<FG.User[]>userGetters.users()).filter((x) => x.userid == val);
|
||||||
if (user.length > 0) return user[0].display_name;
|
if (user.length > 0) return user[0].display_name;
|
||||||
else return val;
|
else return val;
|
||||||
},
|
},
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
import { defineComponent, ref, onBeforeMount, computed } from 'vue';
|
import { defineComponent, ref, onBeforeMount, computed } from 'vue';
|
||||||
import IsoDateInput from 'src/components/utils/IsoDateInput.vue';
|
import IsoDateInput from 'src/components/utils/IsoDateInput.vue';
|
||||||
import Job from './Job.vue';
|
import Job from './Job.vue';
|
||||||
import { Store, useStore } from 'vuex';
|
import { mapGetters, Store, useStore } from 'vuex';
|
||||||
import { StateInterface } from 'src/store';
|
import { StateInterface } from 'src/store';
|
||||||
import { ScheduleInterface } from '../../store/schedule';
|
import { ScheduleInterface } from '../../store/schedule';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
|
@ -75,11 +75,11 @@ import { date } from 'quasar';
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'CreateEvent',
|
name: 'CreateEvent',
|
||||||
components: { IsoDateInput, Job },
|
components: { IsoDateInput, Job },
|
||||||
setup(_, { root }) {
|
setup() {
|
||||||
//const store = <Store<StateInterface>>root.$store;
|
//const store = <Store<StateInterface>>root.$store;
|
||||||
const store = useStore<Store<StateInterface>>();
|
const store = useStore<Store<StateInterface>>();
|
||||||
const state = <ScheduleInterface>store.state.schedule;
|
const scheduleGetters = mapGetters('schedule', ['eventTypes']);
|
||||||
const eventtypes = computed(() => state.eventTypes);
|
const eventtypes = computed(() => <FG.EventType[]>scheduleGetters.eventTypes());
|
||||||
const jobDeleteDisabled = computed(() => event.value.jobs.length < 2);
|
const jobDeleteDisabled = computed(() => event.value.jobs.length < 2);
|
||||||
|
|
||||||
const newJob = ref<FG.Job>(({
|
const newJob = ref<FG.Job>(({
|
||||||
|
|
|
@ -46,16 +46,16 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, ref, computed, onBeforeMount } from 'vue';
|
import { defineComponent, ref, computed, onBeforeMount } from 'vue';
|
||||||
import { Store, useStore } from 'vuex';
|
import { mapGetters, Store, useStore } from 'vuex';
|
||||||
import { StateInterface } from 'src/store';
|
import { StateInterface } from 'src/store';
|
||||||
import { ScheduleInterface, EventType } from '../../store/schedule';
|
import { ScheduleInterface, EventType } from '../../store/schedule';
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'EventTypes',
|
name: 'EventTypes',
|
||||||
components: {},
|
components: {},
|
||||||
setup(_, { root }) {
|
setup() {
|
||||||
//const store = <Store<StateInterface>>root.$store;
|
//const store = <Store<StateInterface>>root.$store;
|
||||||
const store = useStore<Store<StateInterface>>();
|
const store = useStore<Store<StateInterface>>();
|
||||||
const state = <ScheduleInterface>store.state.schedule;
|
const scheduleGetters = mapGetters('schedule', ['eventTypes']);
|
||||||
const newEventType = ref('');
|
const newEventType = ref('');
|
||||||
const edittype = ref(false);
|
const edittype = ref(false);
|
||||||
const emptyEvent: EventType = { id: -1, name: '' };
|
const emptyEvent: EventType = { id: -1, name: '' };
|
||||||
|
@ -69,7 +69,7 @@ export default defineComponent({
|
||||||
console.log(store);
|
console.log(store);
|
||||||
});
|
});
|
||||||
|
|
||||||
const rows = computed(() => state.eventTypes);
|
const rows = computed(() => <FG.EventType[]>scheduleGetters.eventTypes());
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, computed, ref } from 'vue';
|
import { defineComponent, computed, ref } from 'vue';
|
||||||
import IsoDateInput from 'src/components/utils/IsoDateInput.vue';
|
import IsoDateInput from 'src/components/utils/IsoDateInput.vue';
|
||||||
import { Store, useStore } from 'vuex';
|
import { mapGetters, Store, useStore } from 'vuex';
|
||||||
import { StateInterface } from 'src/store';
|
import { StateInterface } from 'src/store';
|
||||||
import { ScheduleInterface } from '../../store/schedule';
|
import { ScheduleInterface } from '../../store/schedule';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
|
@ -83,19 +83,12 @@ export default defineComponent({
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
setup(props, { emit }) {
|
||||||
job: function () {
|
|
||||||
// this.type.name = this.type.name;
|
|
||||||
this.$props.job.type = this.$props.job.type;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
setup(props: Props, { root, emit }) {
|
|
||||||
//const store = <Store<StateInterface>>root.$store;
|
//const store = <Store<StateInterface>>root.$store;
|
||||||
const store = useStore<Store<StateInterafce>>();
|
const store = useStore<Store<StateInterface>>();
|
||||||
const state = <ScheduleInterface>store.state.schedule;
|
const scheduleGetters = mapGetters('schedule', ['jobTypes']);
|
||||||
const jobtypes = computed(() => state.jobTypes);
|
const jobtypes = computed(() => <FG.JobType[]>scheduleGetters.jobTypes());
|
||||||
// job = computed(() => job);
|
|
||||||
function setStart(value: Date) {
|
function setStart(value: Date) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||||
emit('set-start', { job: props.job, value });
|
emit('set-start', { job: props.job, value });
|
||||||
|
@ -137,8 +130,8 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
function isAfterDate(val: Date) {
|
function isAfterDate(val: Date) {
|
||||||
console.log('isAfterDate', props.job.start, val);
|
console.log('isAfterDate', (<FG.Job>props.job).start, val);
|
||||||
return props.job.start < new Date(val) || 'Ende muss hinter dem Start liegen';
|
return (<FG.Job>props.job).start < new Date(val) || 'Ende muss hinter dem Start liegen';
|
||||||
}
|
}
|
||||||
|
|
||||||
const refreshKey = ref(0);
|
const refreshKey = ref(0);
|
||||||
|
|
|
@ -46,16 +46,16 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, ref, computed, onBeforeMount } from 'vue';
|
import { defineComponent, ref, computed, onBeforeMount } from 'vue';
|
||||||
import { Store, useStore } from 'vuex';
|
import { mapGetters, Store, useStore } from 'vuex';
|
||||||
import { StateInterface } from 'src/store';
|
import { StateInterface } from 'src/store';
|
||||||
import { ScheduleInterface, JobType } from '../../store/schedule';
|
import { ScheduleInterface, JobType } from '../../store/schedule';
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'JobTypes',
|
name: 'JobTypes',
|
||||||
components: {},
|
components: {},
|
||||||
setup(_, { root }) {
|
setup() {
|
||||||
//const store = <Store<StateInterface>>root.$store;
|
//const store = <Store<StateInterface>>root.$store;
|
||||||
const store = useStore<Store<StateInterface>>();
|
const store = useStore<Store<StateInterface>>();
|
||||||
const state = <ScheduleInterface>store.state.schedule;
|
const scheduleGetters = mapGetters('schedule', ['jobTypes']);
|
||||||
const newJob = ref('');
|
const newJob = ref('');
|
||||||
const edittype = ref(false);
|
const edittype = ref(false);
|
||||||
const emptyJob: JobType = { id: -1, name: '' };
|
const emptyJob: JobType = { id: -1, name: '' };
|
||||||
|
@ -66,7 +66,7 @@ export default defineComponent({
|
||||||
void store.dispatch('schedule/getJobTypes');
|
void store.dispatch('schedule/getJobTypes');
|
||||||
});
|
});
|
||||||
|
|
||||||
const rows = computed(() => state.jobTypes);
|
const rows = computed(() => <FG.JobType[]>scheduleGetters.jobTypes());
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
import { computed, defineComponent } from 'vue';
|
import { computed, defineComponent } from 'vue';
|
||||||
import EssentialLink from 'src/components/navigation/EssentialLink.vue';
|
import EssentialLink from 'src/components/navigation/EssentialLink.vue';
|
||||||
import mainRoutes from 'src/plugins/schedule/routes';
|
import mainRoutes from 'src/plugins/schedule/routes';
|
||||||
import { Store, useStore } from 'vuex';
|
import { mapGetters, Store, useStore } from 'vuex';
|
||||||
import { BalanceInterface } from 'src/plugins/balance/store/balance';
|
import { BalanceInterface } from 'src/plugins/balance/store/balance';
|
||||||
import setLoadingBar from 'src/utils/loading';
|
import setLoadingBar from 'src/utils/loading';
|
||||||
import { StateInterface } from 'src/store';
|
import { StateInterface } from 'src/store';
|
||||||
|
@ -35,9 +35,10 @@ export default defineComponent({
|
||||||
setup(_) {
|
setup(_) {
|
||||||
//const store = <Store<StateInterface>>root.$store;
|
//const store = <Store<StateInterface>>root.$store;
|
||||||
const store = useStore<Store<StateInterface>>();
|
const store = useStore<Store<StateInterface>>();
|
||||||
|
const balanceGetters = mapGetters('balance', ['loading']);
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const loading = computed(() => {
|
const loading = computed(() => {
|
||||||
return (<BalanceInterface>store.state.balance).loading > 0;
|
return balanceGetters.loading() > 0;
|
||||||
});
|
});
|
||||||
const checkMain = computed(() => {
|
const checkMain = computed(() => {
|
||||||
return route.matched.length == 2;
|
return route.matched.length == 2;
|
||||||
|
|
Loading…
Reference in New Issue