INIT commit

This commit is contained in:
Michal Kváček
2023-05-31 20:44:10 +02:00
commit a3e8917db5
73 changed files with 5405 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
<script setup>
import {useAircraftsStore} from "stores/Aircrafts";
import {computed, onMounted, ref} from "vue";
import {storeToRefs} from "pinia";
import AircraftsList from "components/aircrafts/AircraftsList.vue";
import AddFAB from "components/AddFAB.vue";
const aircraftStore = useAircraftsStore();
const aircrafts = storeToRefs(aircraftStore).items;
const aircraftsComputed = computed(() => aircraftStore.items);
const refetch = () => {
loading.value = true
aircraftStore.fetch().then(data => console.log("data", data)).finally(() => {
console.log("after fetch");
loading.value = false
});
}
let loading = ref(false);
onMounted(() => {
refetch();
})
</script>
<template>
<q-skeleton v-if="loading">Loading (sem pridat skeleton)</q-skeleton>
<AircraftsList :items="aircrafts" v-if="!loading"/>
<q-btn @click="refetch()">Fetch</q-btn>
{{ aircrafts }}
<br>
{{ aircraftsComputed }}
<br>
{{ aircraftStore.items }}
<AddFAB :router-link="{name: 'addAircraft'}"/>
</template>
+76
View File
@@ -0,0 +1,76 @@
<script setup>
import {computed, onMounted} from "vue";
import {useFlightsStore} from "stores/Flights";
import {minutesToHumanReadable} from "src/composables/timeUtils";
import {useMeta, useQuasar} from "quasar";
useMeta({title: "Moje lety"});
const flightsStore = useFlightsStore();
onMounted(() => {
flightsStore.fetch();
})
const totalFlightTime = computed(() => {
return flightsStore.items.reduce((acc, flight) => acc + flight.flightDurationMinutes, 0);
})
const $q = useQuasar();
const deleteFlight = (flightId) => {
$q.dialog({
title: 'Potvrzení',
message: 'Opravdu chceš smazat tento let?',
cancel: true,
persistent: true
}).onOk(() => {
flightsStore.deleteItem(flightId);
})
}
</script>
<template>
<div class="row">
<div class="col-12 col-md-4 col-lg-3" v-for="flight of flightsStore.items" :key="flight">
<q-card class="q-my-sm q-mx-sm">
<q-img :src="flight.titlePhotoUrl" v-if="flight.titlePhotoUrl">
<div class="absolute-bottom text-center text-h6">
<router-link :to="{name: 'flightDetail', params:{id: flight.id}}" class="text-white">
{{ flight.takeOffLocation }} - {{ flight.landingLocation }}
</router-link>
</div>
</q-img>
<q-card-section>
<div class="text-h6" v-if="!flight.titlePhotoUrl">
<router-link :to="{name: 'flightDetail', params:{id: flight.id}}">
{{ flight.takeOffLocation }} - {{ flight.landingLocation }}
</router-link>
</div>
<div class="text-subtitle2">{{ minutesToHumanReadable(flight.flightDurationMinutes) }}</div>
<div class="text-secondary">
<q-icon name="today"/>
{{ flight.date }}
</div>
<div class="text-secondary">
<q-icon name="plane"/>
{{ flight.aircraft.name }}
</div>
</q-card-section>
<q-separator/>
<q-card-actions align="right">
<!-- <q-btn flat icon="visibility"></q-btn>-->
<!-- <q-btn flat icon="edit" :to="{name: 'flightEdit', params:{id: flight.id}}"></q-btn>-->
<q-btn flat icon="delete" color="red" @click="deleteFlight(flight.id)"></q-btn>
</q-card-actions>
</q-card>
</div>
</div>
Total: {{ minutesToHumanReadable(totalFlightTime) }}
<q-page-sticky location="bottom" :offset="[30, 30]">
<q-fab icon="add" color="primary" label="Add flight" @click="$router.push({name: 'addFlight'})"/>
</q-page-sticky>
</template>
@@ -0,0 +1,31 @@
<script setup>
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
import {computed, onMounted, ref} from "vue";
import {storeToRefs} from "pinia";
const poiStore = usePointsOfInterestStore();
onMounted(() => {
poiStore.fetch();
})
const pointsOfInterest = computed(() => poiStore.groupByTypes);
const availableTypes = computed(() => Object.keys(pointsOfInterest.value));
</script>
<template>
{{ pointsOfInterest }}
<div v-for="type of availableTypes" :key="type">
<h2>{{ poiStore.pointTypeName(type) }}</h2>
<q-list bordered separator>
<q-item clickable v-ripple v-for="poi of pointsOfInterest[type]" :key="poi">
<q-item-section>
<router-link :to="{name: 'poiDetail', params: {id: poi.id}}">
{{ poi.name }}
</router-link>
</q-item-section>
</q-item>
</q-list>
</div>
</template>
@@ -0,0 +1,29 @@
<script setup>
import {storeToRefs} from "pinia";
import {useSecondPilotsStore} from "stores/SecondPilots";
import {onMounted} from "vue";
const pilotsStore = useSecondPilotsStore();
onMounted(() => {
pilotsStore.fetch();
})
const secondPilots = storeToRefs(pilotsStore).items;
</script>
<template>
<q-list bordered separator>
<q-item clickable v-ripple v-for="pilot of secondPilots" :key="pilot">
<q-item-label>
<router-link :to="{name: 'pilotDetail', params: {id: pilot.id }}">
{{ pilot.name }}
</router-link>
</q-item-label>
<q-item-section>
section
</q-item-section>
</q-item>
</q-list>
</template>