Upravy UI, refaktoring, davkove upravy a mazani fotek

This commit is contained in:
Michal Kváček
2023-08-28 22:02:24 +02:00
parent dcc3230cbe
commit dd248d4432
53 changed files with 636 additions and 357 deletions
+12 -2
View File
@@ -8,11 +8,21 @@ export const confirmObject = (message, title) => ({
export const successObject = (message) => ({
message,
position: "top",
color: "positive"
color: "positive",
progress: true,
});
export const warningObject = (message) => ({
message,
position: "top",
color: "warning",
});
export const errorObject = (message) => ({
message,
position: "top",
color: "negative"
color: "negative",
timeout: 5 * 60 * 1000,
actions: [{ icon: 'close', color: 'white', round: true, handler: () => { }}]
})
+2
View File
@@ -21,3 +21,5 @@ export const fetchAircrafts = () => {
loading.value = true;
useAircraftsStore().fetch().finally(() => loading.value = false);
}
export const isRequestPending = storeToRefs(useAircraftsStore).isMutationRunning;
+2
View File
@@ -19,3 +19,5 @@ export const fetchCopilots = () => {
loading.value = true;
return useCopilotsStore().fetch().finally(() => loading.value = false);
}
export const isRequestPending = storeToRefs(useCopilotsStore()).isMutationRunning;
+2
View File
@@ -43,3 +43,5 @@ export const handleDeleteFlight = ($q, flightId, onOkCallback = () => {
useFlightsStore().delete(flightId).then(onOkCallback);
});
};
export const isRequestPending = storeToRefs(useFlightsStore()).isRequestPending;
+30
View File
@@ -0,0 +1,30 @@
import {ref} from "vue";
import {usePhotosStore} from "stores/Photo";
import {fetchFlight} from "src/composables/objects/flight";
export const openBatchEdit = ref(false);
export const editBatchPhotos = ref([]);
export const openBatchPhotoForm = (photos) => {
openBatchEdit.value = true;
editBatchPhotos.value = photos;
}
export const handleBatchPhotoEdit = (flightId, data) => {
const photoIds = data.photoIds;
delete data.photoIds;
delete data.id;
const promises = [];
for (const id of photoIds) {
const updateData = {};
if (data.name !== '') updateData.name = data.name;
if (data.description !== '') updateData.description = data.description;
if (data.pointOfInterest) updateData.pointOfInterest = data.pointOfInterest;
if (Object.keys(updateData).length === 0) continue;
promises.push(usePhotosStore().update(id, updateData));
}
Promise.all(promises).finally(() => fetchFlight(flightId))
}
+22
View File
@@ -0,0 +1,22 @@
import {usePhotosStore} from "stores/Photo";
import {fetchFlight} from "src/composables/objects/flight";
import {usePointsOfInterestStore} from "stores/PointsOfInterest";
import {ref} from "vue";
export const handlePhotoUpdate = (flightId, formData) => {
const photoId = formData.id;
delete formData.id;
usePhotosStore().update(photoId, formData).then((data) => {
fetchFlight(flightId); // nenacita se mi nove vytvoreny POI z comboboxu
usePointsOfInterestStore().fetch();
});
};
export const openEdit = ref(false);
export const editPhoto = ref(null);
export const openPhotoEdit = (photo) => {
openEdit.value = true;
editPhoto.value = photo;
};