Otaceni fotek
This commit is contained in:
@@ -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"
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user