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
+39 -39
View File
@@ -6,17 +6,6 @@ import {isNumber, isRequired, maxLength, minLength} from "src/composables/form/r
import {commonProps} from "src/composables/inputs";
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({
defaultValues: {
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 = {
callSign: [isRequired, minLength(4), maxLength(8)],
seats: [isRequired, isNumber]
@@ -54,48 +54,48 @@ onMounted(() => {
<q-img :src="props.defaultValues.photoUrl" v-if="props.defaultValues.photoUrl"/>
<q-input
type="text"
:rules="rules.callSign"
v-model="formData.callSign"
label="Volací značka"
v-bind="commonProps"
type="text"
:rules="rules.callSign"
v-model="formData.callSign"
label="Volací značka"
v-bind="commonProps"
/>
<q-input
type="number"
v-model.number="formData.seats"
label="Počet míst (včetně pilota)"
min="1"
:rules="rules.seats"
v-bind="commonProps"
type="number"
v-model.number="formData.seats"
label="Počet míst (včetně pilota)"
min="1"
:rules="rules.seats"
v-bind="commonProps"
/>
<ComboboxInput
:options="organizations"
label="Organizace"
v-model="formData.organization"
v-bind="commonProps"
hint="Vyber provozovatele letadla. Tím se stane dostupné i pro ostatní členy vybrané organizace."
:options="organizations"
label="Organizace"
v-model="formData.organization"
v-bind="commonProps"
hint="Vyber provozovatele letadla. Tím se stane dostupné i pro ostatní členy vybrané organizace."
/>
<q-input
type="text"
v-model="formData.manufacturer"
label="Výrobce"
v-bind="commonProps"
type="text"
v-model="formData.manufacturer"
label="Výrobce"
v-bind="commonProps"
/>
<q-input
type="text"
v-model="formData.model"
label="Model"
v-bind="commonProps"
type="text"
v-model="formData.model"
label="Model"
v-bind="commonProps"
/>
<q-input
type="textarea"
v-model="formData.description"
label="Popis"
v-bind="commonProps"
type="textarea"
v-model="formData.description"
label="Popis"
v-bind="commonProps"
/>
<q-checkbox v-model="formData.isPublic" label="Veřejné?" v-bind="commonProps"/>
+5 -5
View File
@@ -2,12 +2,12 @@
import MapWithMarkers from "components/map/MapWithMarkers.vue";
import {ref} from "vue";
import {useEventsStore} from "stores/Events";
import {minutesToHumanReadable} from "../../composables/datetimeUtils";
import {pluralize} from "../../composables/utils";
import {minutesToHumanReadable} from "src/composables/datetimeUtils";
import {pluralize} from "src/composables/utils";
const props = defineProps({
event: {
type: Object,
eventId: {
type: Number,
required: true
},
onlyPublic: {
@@ -21,7 +21,7 @@ const totalTime = ref(0);
const totalFlights = ref(0);
useEventsStore().fetchFlightsTracks({
eventId: props.event.id,
eventId: props.eventId,
onlyPublic: props.onlyPublic
}).then((data) => {
if (!data.flights) return;
+2 -4
View File
@@ -14,7 +14,8 @@ import {useLoggedUserStore} from "stores/LoggedUser";
const props = defineProps({
event: {
type: Object
type: Object,
required: false,
},
isRequestPending: {
type: Boolean,
@@ -72,9 +73,6 @@ const loggedUser = storeToRefs(useLoggedUserStore()).user;
</div>
</div>
<RichTextEditor v-model="formData.description" v-bind="commonProps" label="Popis letu, poznámky, ..."/>
</FormWrapper>
</template>
+1 -1
View File
@@ -64,7 +64,7 @@ const loggedUser = storeToRefs(useLoggedUserStore()).user;
<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>
+4 -2
View File
@@ -7,13 +7,16 @@ import BasicInfoBanner from "components/banners/BasicInfoBanner.vue";
import {useFlightsStore} from "stores/Flights";
import {storeToRefs} from "pinia";
import {loadPage, paginationLimit} from "src/composables/pagination";
import {onMounted} from "vue";
useAppStore().setPageTitle("Moje lety");
const loadNextPage = (appendItems) => loadPage({
fetchFunc: useFlightsStore().fetch, appendItems
});
loadNextPage(false);
onMounted(() => {
loadNextPage(false);
});
const {flights, totalItemsCount, isQueryRunning} = storeToRefs(useFlightsStore());
</script>
@@ -36,7 +39,6 @@ const {flights, totalItemsCount, isQueryRunning} = storeToRefs(useFlightsStore()
:items-per-page="paginationLimit"
:total-items-count="totalItemsCount"
@load-more="loadNextPage(true)"
/>
<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"/>
<EventFlightsMap :event="event" :only-public="true"/>
<q-no-ssr>
<EventFlightsMap :event-id="event.id" :only-public="true"/>
</q-no-ssr>
<h3>Lety</h3>
+1 -1
View File
@@ -18,7 +18,7 @@ export default route(function ({ store }) {
Router.beforeEach(async (to, from) => {
if (from.name !== to.name) {
useAppStore(store).resetAfterRouteChange();
useAppStore(store).resetBeforeRouteChange();
}
});
+4 -3
View File
@@ -1,13 +1,13 @@
import {defineStore} from 'pinia'
import {ref} from "vue";
import {paginationLimit, paginationOffset} from "src/composables/pagination";
import {filters, paginationLimit, paginationOffset} from "src/composables/pagination";
export const useAppStore = defineStore('App', () => {
const pageTitle = ref(null);
const breadcrumbs = ref(null);
const appStatus = ref(200);
const resetAfterRouteChange = () => {
const resetBeforeRouteChange = () => {
pageTitle.value = null;
// appStatus.value = 200; // tohle dela problem pri renderu 404 na serveru
breadcrumbs.value = null;
@@ -15,6 +15,7 @@ export const useAppStore = defineStore('App', () => {
// reset strankovani po prechodu na strankach
paginationLimit.value = 10;
paginationOffset.value = 0;
filters.value = {};
};
const setPageTitle = (value) => {
@@ -28,6 +29,6 @@ export const useAppStore = defineStore('App', () => {
return {
pageTitle, breadcrumbs, appStatus,
resetAfterRouteChange, setPageTitle, setBreadcrumbs
resetBeforeRouteChange, setPageTitle, setBreadcrumbs
}
})