#6654 sticky class #165

Merged
jorgep merged 6 commits from 6654-stickySubToolbar into dev 2024-01-31 07:50:58 +00:00
11 changed files with 97 additions and 104 deletions

View File

@ -49,7 +49,6 @@ onMounted(async () => {
() => $props.url, () => $props.url,
async (newUrl, lastUrl) => { async (newUrl, lastUrl) => {
if (newUrl == lastUrl) return; if (newUrl == lastUrl) return;
entity.value = null;
Review

No se puede modificar el valor de una propiedad computed, esto no está haciendo nada. (Lo he comprobado de todas maneras)

No se puede modificar el valor de una propiedad computed, esto no está haciendo nada. (Lo he comprobado de todas maneras)
await getData(); await getData();
} }
); );
@ -62,7 +61,6 @@ async function getData() {
skip: 0, skip: 0,
}); });
const { data } = await arrayData.fetch({ append: false, updateRouter: false }); const { data } = await arrayData.fetch({ append: false, updateRouter: false });
entity.value = data;
Review

No se puede modificar el valor de una propiedad computed, esto no está haciendo nada (Lo he comprobado de todas maneras)

No se puede modificar el valor de una propiedad computed, esto no está haciendo nada (Lo he comprobado de todas maneras)
emit('onFetch', data); emit('onFetch', data);
} }
const emit = defineEmits(['onFetch']); const emit = defineEmits(['onFetch']);

View File

@ -1,6 +1,7 @@
<script setup> <script setup>
import { onMounted, onUnmounted, ref } from 'vue'; import { onMounted, onUnmounted } from 'vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
const stateStore = useStateStore(); const stateStore = useStateStore();
onMounted(() => { onMounted(() => {
@ -13,9 +14,25 @@ onUnmounted(() => {
</script> </script>
<template> <template>
<QToolbar class="bg-vn-dark justify-end"> <QToolbar class="bg-vn-dark justify-end sticky">
<slot name="st-data">
<div id="st-data"></div> <div id="st-data"></div>
</slot>
<QSpace /> <QSpace />
<slot name="st-actions">
<div id="st-actions"></div> <div id="st-actions"></div>
</slot>
</QToolbar> </QToolbar>
</template> </template>
<style lang="scss" scoped>
.sticky {
position: sticky;
top: 61px;

He puesto 62 porque con 60 hace un ligero scroll.

He puesto 62 porque con 60 hace un ligero scroll.

y porque pone 61?

y porque pone 61?

porque había un ligero hueco con 62px. Por eso lo he cambiado a 61

porque había un ligero hueco con 62px. Por eso lo he cambiado a 61
z-index: 1;
}
@media (max-width: $breakpoint-sm) {
.sticky {
top: 90px;
}
}
</style>

View File

@ -4,5 +4,5 @@ import { useI18n } from 'vue-i18n';
export function tMobile(...args) { export function tMobile(...args) {
const quasar = useQuasar(); const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
if (!quasar.platform.is.mobile) return t(...args); if (!quasar.screen.xs) return t(...args);
} }

View File

@ -1,27 +1,13 @@
<script setup> <script setup>
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import { getUrl } from 'composables/getUrl';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import ClaimDescriptor from './ClaimDescriptor.vue'; import ClaimDescriptor from './ClaimDescriptor.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute();
const $props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
});
const entityId = computed(() => {
return $props.id || route.params.id;
});
</script> </script>
<template> <template>
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()"> <Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">

View File

@ -4,12 +4,11 @@ import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useArrayData } from 'composables/useArrayData';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useArrayData } from 'composables/useArrayData';
import { toDate, toCurrency, toPercentage } from 'filters/index';
import CrudModel from 'components/CrudModel.vue'; import CrudModel from 'components/CrudModel.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import { toDate, toCurrency, toPercentage } from 'filters/index';
import VnDiscount from 'components/common/vnDiscount.vue'; import VnDiscount from 'components/common/vnDiscount.vue';
import ClaimLinesImport from './ClaimLinesImport.vue'; import ClaimLinesImport from './ClaimLinesImport.vue';
@ -158,7 +157,6 @@ function showImportDialog() {
</script> </script>
<template> <template>
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()"> <Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()">
<QToolbar>
<div class="row q-gutter-md"> <div class="row q-gutter-md">
<div> <div>
{{ t('Amount') }} {{ t('Amount') }}
@ -174,7 +172,6 @@ function showImportDialog() {
</QChip> </QChip>
</div> </div>
</div> </div>
</QToolbar>
</Teleport> </Teleport>
<FetchData <FetchData

View File

@ -12,6 +12,7 @@ import CustomerNotificationsFilter from './CustomerDefaulterFilter.vue';
import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue'; import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue'; import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
const { t } = useI18n(); const { t } = useI18n();
@ -206,8 +207,8 @@ const refreshData = () => {
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<QToolbar class="bg-vn-dark"> <VnSubToolbar class="bg-vn-dark">
<div id="st-data" class="row"> <template #st-data>
<CustomerBalanceDueTotal :amount="balanceDueTotal" /> <CustomerBalanceDueTotal :amount="balanceDueTotal" />
<div class="flex items-center q-ml-lg"> <div class="flex items-center q-ml-lg">
<QBtn <QBtn
@ -217,8 +218,8 @@ const refreshData = () => {
@click.stop="viewAddObservation(selected)" @click.stop="viewAddObservation(selected)"
/> />
</div> </div>
</div> </template>
</QToolbar> </VnSubToolbar>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QTable <QTable

View File

@ -9,6 +9,7 @@ import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorP
import CustomerExtendedListActions from './CustomerExtendedListActions.vue'; import CustomerExtendedListActions from './CustomerExtendedListActions.vue';
import CustomerExtendedListFilter from './CustomerExtendedListFilter.vue'; import CustomerExtendedListFilter from './CustomerExtendedListFilter.vue';
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue'; import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
@ -499,9 +500,8 @@ const selectSalesPersonId = (id) => {
/> />
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<VnSubToolbar>
<QToolbar class="bg-vn-dark"> <template #st-actions>
<div id="st-data">
<TableVisibleColumns <TableVisibleColumns
:all-columns="allColumnNames" :all-columns="allColumnNames"
table-code="clientsDetail" table-code="clientsDetail"
@ -510,10 +510,8 @@ const selectSalesPersonId = (id) => {
visibleColumns = ['customerStatus', ...$event, 'actions'] visibleColumns = ['customerStatus', ...$event, 'actions']
" "
/> />
</div> </template>
<QSpace /> </VnSubToolbar>
<div id="st-actions"></div>
</QToolbar>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QTable <QTable

View File

@ -11,6 +11,7 @@ import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import InvoiceOutFilter from './InvoiceOutFilter.vue'; import InvoiceOutFilter from './InvoiceOutFilter.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue'; import CardList from 'src/components/ui/CardList.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const selectedCards = ref(new Map()); const selectedCards = ref(new Map());
@ -129,8 +130,8 @@ const downloadCsv = () => {
url="InvoiceOuts/filter" url="InvoiceOuts/filter"
> >
<template #body="{ rows }"> <template #body="{ rows }">
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar class="bg-vn-dark justify-end">
<div id="st-actions"> <template #st-actions>
<QBtn <QBtn
@click="downloadCsv()" @click="downloadCsv()"
class="q-mr-xl" class="q-mr-xl"
@ -178,8 +179,8 @@ const downloadCsv = () => {
:model-value="selectedCards.size === rows.length" :model-value="selectedCards.size === rows.length"
class="q-mr-md" class="q-mr-md"
/> />
</div> </template>
</QToolbar> </VnSubToolbar>
<div class="flex flex-center q-pa-md"> <div class="flex flex-center q-pa-md">
<div class="card-list"> <div class="card-list">
<CardList <CardList

View File

@ -15,6 +15,7 @@ import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
import RouteFilter from 'pages/Route/Card/RouteFilter.vue'; import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import RouteSummaryDialog from 'pages/Route/Card/RouteSummaryDialog.vue'; import RouteSummaryDialog from 'pages/Route/Card/RouteSummaryDialog.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
@ -228,8 +229,8 @@ function previewRoute(id) {
<FetchData url="AgencyModes" @on-fetch="(data) => (agencyList = data)" auto-load /> <FetchData url="AgencyModes" @on-fetch="(data) => (agencyList = data)" auto-load />
<FetchData url="Vehicles" @on-fetch="(data) => (vehicleList = data)" auto-load /> <FetchData url="Vehicles" @on-fetch="(data) => (vehicleList = data)" auto-load />
<QPage class="column items-center"> <QPage class="column items-center">
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar class="bg-vn-dark justify-end">
<div id="st-actions" class="q-pa-sm"> <template #st-actions>
<QBtn <QBtn
icon="vn:clone" icon="vn:clone"
color="primary" color="primary"
@ -249,8 +250,8 @@ function previewRoute(id) {
> >
<QTooltip>{{ t('Mark as served') }}</QTooltip> <QTooltip>{{ t('Mark as served') }}</QTooltip>
</QBtn> </QBtn>
</div> </template>
</QToolbar> </VnSubToolbar>
<div class="route-list"> <div class="route-list">
<VnPaginate <VnPaginate
:key="refreshKey" :key="refreshKey"

View File

@ -3,19 +3,19 @@ import { useRoute } from 'vue-router';
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import axios from 'axios';
import { useStateStore } from 'stores/useStateStore';
import { usePrintService } from 'composables/usePrintService';
import useNotify from 'src/composables/useNotify.js';
import { toDate, toDateString } from 'src/filters';
import { dashIfEmpty } from 'src/filters';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import FetchedTags from 'components/ui/FetchedTags.vue'; import FetchedTags from 'components/ui/FetchedTags.vue';
import SendEmailDialog from 'components/common/SendEmailDialog.vue'; import SendEmailDialog from 'components/common/SendEmailDialog.vue';
import { toDate, toDateString } from 'src/filters';
import { dashIfEmpty } from 'src/filters';
import { usePrintService } from 'composables/usePrintService';
import useNotify from 'src/composables/useNotify.js';
import axios from 'axios';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const stateStore = useStateStore();
const { openReport, sendEmail } = usePrintService(); const { openReport, sendEmail } = usePrintService();
const quasar = useQuasar(); const quasar = useQuasar();
const { notify } = useNotify(); const { notify } = useNotify();
@ -88,9 +88,8 @@ const sendCampaignMetricsEmail = ({ address }) => {
}); });
}; };
const calculateTotal = (buysArray) => { const calculateTotal = (buysArray) =>
return buysArray.reduce((accumulator, { total }) => accumulator + total, 0); buysArray.reduce((accumulator, { total }) => accumulator + total, 0);
};
</script> </script>
<template> <template>
@ -104,8 +103,7 @@ const calculateTotal = (buysArray) => {
:params="userParams" :params="userParams"
auto-load auto-load
/> />
<QToolbar class="bg-vn-dark justify-end"> <Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()">
<div id="st-data">
<QBtn <QBtn
v-if="userParams.from && userParams.to" v-if="userParams.from && userParams.to"
color="primary" color="primary"
@ -129,10 +127,7 @@ const calculateTotal = (buysArray) => {
{{ t('Send to email') }} {{ t('Send to email') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
</div> </Teleport>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QTable <QTable
:rows="rows" :rows="rows"

View File

@ -17,6 +17,7 @@ import { useArrayData } from 'composables/useArrayData';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
import { usePrintService } from 'composables/usePrintService'; import { usePrintService } from 'composables/usePrintService';
import travelService from 'src/services/travel.service'; import travelService from 'src/services/travel.service';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const router = useRouter(); const router = useRouter();
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -259,10 +260,8 @@ onMounted(async () => {
/> />
</Teleport> </Teleport>
</template> </template>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar class="bg-vn-dark justify-end">
<div id="st-data"></div> <template #st-actions>
<QSpace />
<div id="st-actions">
<QBtn <QBtn
color="primary" color="primary"
icon-right="picture_as_pdf" icon-right="picture_as_pdf"
@ -273,8 +272,8 @@ onMounted(async () => {
{{ t('Open as PDF') }} {{ t('Open as PDF') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
</div> </template>
</QToolbar> </VnSubToolbar>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above> <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<ExtraCommunityFilter data-key="ExtraCommunity" /> <ExtraCommunityFilter data-key="ExtraCommunity" />