Fix nacitani spatnych dat do mapy u udalosti

This commit is contained in:
Michal Kváček
2024-02-29 08:19:24 +01:00
parent 7a45a0133e
commit f0a4c439dc
8 changed files with 59 additions and 56 deletions
+11 -11
View File
@@ -6,17 +6,6 @@ import {isNumber, isRequired, maxLength, minLength} from "src/composables/form/r
import {commonProps} from "src/composables/inputs"; import {commonProps} from "src/composables/inputs";
import ComboboxInput from "components/inputs/ComboboxInput.vue"; import ComboboxInput from "components/inputs/ComboboxInput.vue";
const formData = reactive({
id: null,
callSign: "",
model: "",
seats: null,
manufacturer: "",
description: "",
organization: null,
isPublic: false
});
const props = defineProps({ const props = defineProps({
defaultValues: { defaultValues: {
type: Object, type: Object,
@@ -34,6 +23,17 @@ const props = defineProps({
} }
}); });
const formData = reactive({
id: null,
callSign: "",
model: "",
seats: null,
manufacturer: "",
description: "",
organization: null,
isPublic: false
});
const rules = { const rules = {
callSign: [isRequired, minLength(4), maxLength(8)], callSign: [isRequired, minLength(4), maxLength(8)],
seats: [isRequired, isNumber] seats: [isRequired, isNumber]
+5 -5
View File
@@ -2,12 +2,12 @@
import MapWithMarkers from "components/map/MapWithMarkers.vue"; import MapWithMarkers from "components/map/MapWithMarkers.vue";
import {ref} from "vue"; import {ref} from "vue";
import {useEventsStore} from "stores/Events"; import {useEventsStore} from "stores/Events";
import {minutesToHumanReadable} from "../../composables/datetimeUtils"; import {minutesToHumanReadable} from "src/composables/datetimeUtils";
import {pluralize} from "../../composables/utils"; import {pluralize} from "src/composables/utils";
const props = defineProps({ const props = defineProps({
event: { eventId: {
type: Object, type: Number,
required: true required: true
}, },
onlyPublic: { onlyPublic: {
@@ -21,7 +21,7 @@ const totalTime = ref(0);
const totalFlights = ref(0); const totalFlights = ref(0);
useEventsStore().fetchFlightsTracks({ useEventsStore().fetchFlightsTracks({
eventId: props.event.id, eventId: props.eventId,
onlyPublic: props.onlyPublic onlyPublic: props.onlyPublic
}).then((data) => { }).then((data) => {
if (!data.flights) return; if (!data.flights) return;
+2 -4
View File
@@ -14,7 +14,8 @@ import {useLoggedUserStore} from "stores/LoggedUser";
const props = defineProps({ const props = defineProps({
event: { event: {
type: Object type: Object,
required: false,
}, },
isRequestPending: { isRequestPending: {
type: Boolean, type: Boolean,
@@ -72,9 +73,6 @@ const loggedUser = storeToRefs(useLoggedUserStore()).user;
</div> </div>
</div> </div>
<RichTextEditor v-model="formData.description" v-bind="commonProps" label="Popis letu, poznámky, ..."/> <RichTextEditor v-model="formData.description" v-bind="commonProps" label="Popis letu, poznámky, ..."/>
</FormWrapper> </FormWrapper>
</template> </template>
+1 -1
View File
@@ -64,7 +64,7 @@ const loggedUser = storeToRefs(useLoggedUserStore()).user;
<article class="q-my-lg" v-html="event.description"/> <article class="q-my-lg" v-html="event.description"/>
<EventFlightsMap :event="event" :only-public="false" /> <EventFlightsMap :event-id="eventId" :only-public="false" />
<h3>Lety</h3> <h3>Lety</h3>
+3 -1
View File
@@ -7,13 +7,16 @@ import BasicInfoBanner from "components/banners/BasicInfoBanner.vue";
import {useFlightsStore} from "stores/Flights"; import {useFlightsStore} from "stores/Flights";
import {storeToRefs} from "pinia"; import {storeToRefs} from "pinia";
import {loadPage, paginationLimit} from "src/composables/pagination"; import {loadPage, paginationLimit} from "src/composables/pagination";
import {onMounted} from "vue";
useAppStore().setPageTitle("Moje lety"); useAppStore().setPageTitle("Moje lety");
const loadNextPage = (appendItems) => loadPage({ const loadNextPage = (appendItems) => loadPage({
fetchFunc: useFlightsStore().fetch, appendItems fetchFunc: useFlightsStore().fetch, appendItems
}); });
onMounted(() => {
loadNextPage(false); loadNextPage(false);
});
const {flights, totalItemsCount, isQueryRunning} = storeToRefs(useFlightsStore()); const {flights, totalItemsCount, isQueryRunning} = storeToRefs(useFlightsStore());
</script> </script>
@@ -36,7 +39,6 @@ const {flights, totalItemsCount, isQueryRunning} = storeToRefs(useFlightsStore()
:items-per-page="paginationLimit" :items-per-page="paginationLimit"
:total-items-count="totalItemsCount" :total-items-count="totalItemsCount"
@load-more="loadNextPage(true)" @load-more="loadNextPage(true)"
/> />
<FAB mode="add" :router-link="{name: 'addFlight'}"/> <FAB mode="add" :router-link="{name: 'addFlight'}"/>
@@ -60,7 +60,9 @@ const {flights, totalItemsCount, isQueryRunning: areFlightsLoading} = storeToRef
<article class="q-my-lg" v-html="event.description"/> <article class="q-my-lg" v-html="event.description"/>
<EventFlightsMap :event="event" :only-public="true"/> <q-no-ssr>
<EventFlightsMap :event-id="event.id" :only-public="true"/>
</q-no-ssr>
<h3>Lety</h3> <h3>Lety</h3>
+1 -1
View File
@@ -18,7 +18,7 @@ export default route(function ({ store }) {
Router.beforeEach(async (to, from) => { Router.beforeEach(async (to, from) => {
if (from.name !== to.name) { if (from.name !== to.name) {
useAppStore(store).resetAfterRouteChange(); useAppStore(store).resetBeforeRouteChange();
} }
}); });
+4 -3
View File
@@ -1,13 +1,13 @@
import {defineStore} from 'pinia' import {defineStore} from 'pinia'
import {ref} from "vue"; import {ref} from "vue";
import {paginationLimit, paginationOffset} from "src/composables/pagination"; import {filters, paginationLimit, paginationOffset} from "src/composables/pagination";
export const useAppStore = defineStore('App', () => { export const useAppStore = defineStore('App', () => {
const pageTitle = ref(null); const pageTitle = ref(null);
const breadcrumbs = ref(null); const breadcrumbs = ref(null);
const appStatus = ref(200); const appStatus = ref(200);
const resetAfterRouteChange = () => { const resetBeforeRouteChange = () => {
pageTitle.value = null; pageTitle.value = null;
// appStatus.value = 200; // tohle dela problem pri renderu 404 na serveru // appStatus.value = 200; // tohle dela problem pri renderu 404 na serveru
breadcrumbs.value = null; breadcrumbs.value = null;
@@ -15,6 +15,7 @@ export const useAppStore = defineStore('App', () => {
// reset strankovani po prechodu na strankach // reset strankovani po prechodu na strankach
paginationLimit.value = 10; paginationLimit.value = 10;
paginationOffset.value = 0; paginationOffset.value = 0;
filters.value = {};
}; };
const setPageTitle = (value) => { const setPageTitle = (value) => {
@@ -28,6 +29,6 @@ export const useAppStore = defineStore('App', () => {
return { return {
pageTitle, breadcrumbs, appStatus, pageTitle, breadcrumbs, appStatus,
resetAfterRouteChange, setPageTitle, setBreadcrumbs resetBeforeRouteChange, setPageTitle, setBreadcrumbs
} }
}) })