Otaceni fotek

This commit is contained in:
Michal Kváček
2023-09-21 09:39:22 +02:00
parent d1baec342f
commit b64c426179
6 changed files with 85 additions and 21 deletions
@@ -100,6 +100,28 @@ const deletePhoto = (id) => {
flight.value.photos.splice(_findPhotoIndex(data.id), 1);
});
}
const rotatePhotos = ({photos, angle}) => {
const promises = [];
for (const photo of photos) {
promises.push(usePhotosStore().rotate(photo.id, angle));
}
let success = 0;
Promise.allSettled(promises).then(result => {
for (const updatedPhoto of result) {
const {status, value} = updatedPhoto;
if (status === 'fulfilled') success++;
const idx =_findPhotoIndex(value.id);
value.thumbnailUrl += "?t=" + (new Date()).getTime();
flight.value.photos[idx] = value;
}
if (success > 0)
$q.notify(successObject("Otočeno " + success + " fotek"));
});
}
</script>
<template>
@@ -143,6 +165,7 @@ const deletePhoto = (id) => {
:photos="flight.photos"
@edit="openPhotoEdit"
@batch-edit="openBatchPhotoForm"
@batch-rotate="rotatePhotos"
@delete="deletePhoto"
/>
@@ -31,14 +31,25 @@ onMounted(() => {
<template>
<h3>Členové</h3>
<BasicListSkeleton :items-count-min="1" :items-count-max="5" v-if="loading || !organization"/>
<div class="q-my-md">
<q-btn color="positive" @click="addToOrganization(organizationId)" v-if="!myOrganizationIds.includes(organizationId)">
<q-icon name="add"/>
Přidat se
</q-btn>
<q-btn color="warning" @click="removeFromOrganization(organizationId)" v-else>
<q-icon name="remove"/>
Opustit organizaci
</q-btn>
</div>
<BasicListSkeleton :items-count-min="1" :items-count-max="5" v-if="loading || !organization"/>
<template v-else>
<q-list bordered separator v-if="organization.users.length > 0">
<q-item v-for="user in organization.users" :key="user">
<q-item-section avatar>
<AvatarFromPhoto :src="user.avatarImageUrl" v-if="user.avatarImageUrl" size="50"/>
<q-avatar icon="person" v-else class="bg-primary text-white" />
<q-avatar icon="person" v-else class="bg-primary text-white"/>
</q-item-section>
<q-item-section>
{{ user.name || user.email }}
@@ -49,19 +60,12 @@ onMounted(() => {
<BasicInfoBanner v-else>
Zatím nikdo...
</BasicInfoBanner>
</template>
<q-btn color="positive" @click="addToOrganization(organizationId)" v-if="!myOrganizationIds.includes(organizationId)">
<q-icon name="add"/>
Přidat se
</q-btn>
<q-btn color="warning" size="lg" @click="removeFromOrganization(organizationId)" v-else>
<q-icon name="remove"/>
Opustit organizaci
</q-btn>
<h3>Letadla</h3>
<h3>Letadla</h3>
<BasicListSkeleton :items-count-min="1" :items-count-max="5" v-if="loading"/>
<BasicListSkeleton :items-count-min="1" :items-count-max="5" v-if="loading || !organization"/>
<template v-else>
<AircraftsList :items="organization.aircrafts" v-if="organization.aircrafts.length > 0"/>
<BasicInfoBanner v-else>
Žádné letadlo