Added select and deselect all to gallery images IO-410

This commit is contained in:
Patrick Fic
2020-12-08 10:36:22 -08:00
parent 4ae344f33e
commit 79910f6725
6 changed files with 91 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next";
import DocumentsUploadComponent from "../documents-upload/documents-upload.component";
import JobsDocumentsDownloadButton from "./jobs-document-gallery.download.component";
import JobsDocumentsDeleteButton from "./jobs-documents-gallery.delete.component";
import JobsDocumentsGallerySelectAllComponent from "./jobs-documents-gallery.selectall.component";
function JobsDocumentsComponent({
data,
@@ -72,6 +73,10 @@ function JobsDocumentsComponent({
callbackAfterUpload={billsCallback || refetch}
tagsArray={["test"]}
/>
<JobsDocumentsGallerySelectAllComponent
galleryImages={galleryImages}
setGalleryImages={setgalleryImages}
/>
<JobsDocumentsDownloadButton galleryImages={galleryImages} />
<JobsDocumentsDeleteButton
galleryImages={galleryImages}

View File

@@ -0,0 +1,37 @@
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,
images: galleryImages.images.map((i) => {
return { ...i, isSelected: true };
}),
});
};
const handleDeselectAll = () => {
setGalleryImages({
...galleryImages,
images: galleryImages.images.map((i) => {
return { ...i, isSelected: false };
}),
});
};
return (
<>
<Button onClick={handleSelectAll}>
{t("general.actions.selectall")}
</Button>
<Button onClick={handleDeselectAll}>
{t("general.actions.deselectall")}
</Button>
</>
);
}