0
0
Fork 0

Compare commits

...

5 Commits

4 changed files with 34 additions and 7 deletions

View File

@ -8,7 +8,7 @@ import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import ClaimDescriptor from './ClaimDescriptor.vue'; import ClaimDescriptor from './ClaimDescriptor.vue';
import { onMounted } from 'vue'; import { onMounted, onUnmounted } from 'vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -22,6 +22,18 @@ const $props = defineProps({
const entityId = computed(() => { const entityId = computed(() => {
return $props.id || route.params.id; return $props.id || route.params.id;
}); });
onMounted(() => {
console.log('MOUNTED', stateStore.isSubToolbarShown());
stateStore.toggleSubToolbar();
console.log('MOUNTED', stateStore.isSubToolbarShown());
});
onUnmounted(() => {
console.log('MOUNTED', stateStore.isSubToolbarShown());
stateStore.toggleSubToolbar();
console.log('MOUNTED', stateStore.isSubToolbarShown());
});
</script> </script>
<template> <template>
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()"> <Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">

View File

@ -18,6 +18,7 @@ const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
const subToolbarLoaded = computed(() => stateStore.isSubToolbarShown());
const arrayData = useArrayData('ClaimLines'); const arrayData = useArrayData('ClaimLines');
const store = arrayData.store; const store = arrayData.store;
@ -43,8 +44,8 @@ async function onFetchClaim(data) {
fetchMana(); fetchMana();
} }
const amount = ref(0); const amount = ref();
const amountClaimed = ref(0); const amountClaimed = ref();
async function onFetch(rows) { async function onFetch(rows) {
if (!rows || !rows.length) return; if (!rows || !rows.length) return;
amount.value = rows.reduce( amount.value = rows.reduce(
@ -152,8 +153,12 @@ function showImportDialog() {
}) })
.onOk(() => claimLinesForm.value.reload()); .onOk(() => claimLinesForm.value.reload());
} }
function isSubToolbarShown() {
return amount.value && amountClaimed;
}
</script> </script>
<template> <template>
{{ subToolbarLoaded }}
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()"> <Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()">
<QToolbar> <QToolbar>
<div class="row q-gutter-md"> <div class="row q-gutter-md">

View File

@ -5,10 +5,17 @@ import { useRoute } from 'vue-router';
import CustomerDescriptor from './CustomerDescriptor.vue'; import CustomerDescriptor from './CustomerDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { onMounted } from 'vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
onMounted(() => {
console.log('MOUNTED', stateStore.isSubToolbarShown());
stateStore.toggleSubToolbar();
console.log('MOUNTED', stateStore.isSubToolbarShown());
});
</script> </script>
<template> <template>
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()"> <Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">

View File

@ -5,6 +5,7 @@ export const useStateStore = defineStore('stateStore', () => {
const isMounted = ref(false); const isMounted = ref(false);
const leftDrawer = ref(false); const leftDrawer = ref(false);
const rightDrawer = ref(false); const rightDrawer = ref(false);
const subToolbar = ref(false);
function toggleLeftDrawer() { function toggleLeftDrawer() {
leftDrawer.value = !leftDrawer.value; leftDrawer.value = !leftDrawer.value;
@ -14,6 +15,10 @@ export const useStateStore = defineStore('stateStore', () => {
rightDrawer.value = !rightDrawer.value; rightDrawer.value = !rightDrawer.value;
} }
function toggleSubToolbar() {
subToolbar.value = !subToolbar.value;
}
function setMounted() { function setMounted() {
isMounted.value = true; isMounted.value = true;
} }
@ -31,10 +36,7 @@ export const useStateStore = defineStore('stateStore', () => {
} }
function isSubToolbarShown() { function isSubToolbarShown() {
return ( return subToolbar.value;
!!document.querySelector('#st-data') &&
!!document.querySelector('#st-actions')
);
} }
return { return {
@ -47,5 +49,6 @@ export const useStateStore = defineStore('stateStore', () => {
isLeftDrawerShown, isLeftDrawerShown,
isRightDrawerShown, isRightDrawerShown,
isSubToolbarShown, isSubToolbarShown,
toggleSubToolbar,
}; };
}); });