68 lines
1.7 KiB
JavaScript
68 lines
1.7 KiB
JavaScript
import { Button } from "antd";
|
|
import React from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
export default function JobsDocumentsGallerySelectAllComponent({
|
|
galleryImages,
|
|
setGalleryImages,
|
|
}) {
|
|
const { t } = useTranslation();
|
|
|
|
const handleSelectAll = () => {
|
|
setGalleryImages({
|
|
...galleryImages,
|
|
other: galleryImages.other.map((i) => {
|
|
return { ...i, isSelected: true };
|
|
}),
|
|
images: galleryImages.images.map((i) => {
|
|
return { ...i, isSelected: true };
|
|
}),
|
|
});
|
|
};
|
|
const handleSelectAllImages = () => {
|
|
setGalleryImages({
|
|
...galleryImages,
|
|
|
|
images: galleryImages.images.map((i) => {
|
|
return { ...i, isSelected: true };
|
|
}),
|
|
});
|
|
};
|
|
const handleSelectAllDocuments = () => {
|
|
setGalleryImages({
|
|
...galleryImages,
|
|
other: galleryImages.other.map((i) => {
|
|
return { ...i, isSelected: true };
|
|
}),
|
|
});
|
|
};
|
|
const handleDeselectAll = () => {
|
|
setGalleryImages({
|
|
...galleryImages,
|
|
other: galleryImages.other.map((i) => {
|
|
return { ...i, isSelected: false };
|
|
}),
|
|
images: galleryImages.images.map((i) => {
|
|
return { ...i, isSelected: false };
|
|
}),
|
|
});
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<Button onClick={handleSelectAll}>
|
|
{t("general.actions.selectall")}
|
|
</Button>
|
|
<Button onClick={handleSelectAllImages}>
|
|
{t("documents.actions.selectallimages")}
|
|
</Button>
|
|
<Button onClick={handleSelectAllDocuments}>
|
|
{t("documents.actions.selectallotherdocuments")}
|
|
</Button>
|
|
<Button onClick={handleDeselectAll}>
|
|
{t("general.actions.deselectall")}
|
|
</Button>
|
|
</>
|
|
);
|
|
}
|