| const deleteFileHandler = (stream_id) => { | const deleteFileHandler = (stream_id) => { | ||||
| dispatch(deleteFileReq({ id: stream_id })); | dispatch(deleteFileReq({ id: stream_id })); | ||||
| console.log(stream_id) | |||||
| console.log(file.fileStream) | |||||
| if(file !== null && stream_id === file.streamId){ | |||||
| setFile(null) | |||||
| if (file !== null && stream_id === file.streamId) { | |||||
| setFile(null); | |||||
| } | } | ||||
| }; | }; | ||||
| console.log(e, "error in file-viewer"); | console.log(e, "error in file-viewer"); | ||||
| }; | }; | ||||
| const displayFile = (fileStream,streamId) => { | |||||
| setFile({fileStream,streamId}); | |||||
| const displayFile = (fileStream, streamId) => { | |||||
| setFile({ fileStream, streamId }); | |||||
| }; | }; | ||||
| return isLoading ? ( | return isLoading ? ( | ||||
| <div> | <div> | ||||
| <div className="l-t-rectangle"></div> | <div className="l-t-rectangle"></div> | ||||
| <th>Tip dokumenta</th> | <th>Tip dokumenta</th> | ||||
| {file === null ? <th>Veličina dokumenta</th> : ""} | {file === null ? <th>Veličina dokumenta</th> : ""} | ||||
| <th>Obrisi dokument</th> | <th>Obrisi dokument</th> | ||||
| <th>Preuzmi dokument</th> | |||||
| </tr> | </tr> | ||||
| </thead> | </thead> | ||||
| <tbody> | <tbody> | ||||
| <tr | <tr | ||||
| key={index} | key={index} | ||||
| className="secondaryRow" | className="secondaryRow" | ||||
| onClick={() => displayFile(n.file_stream,n.stream_id)} | |||||
| onClick={() => displayFile(n.file_stream, n.stream_id)} | |||||
| > | > | ||||
| <td className="docs-name">{n.fileName}</td> | <td className="docs-name">{n.fileName}</td> | ||||
| <td className="docs-name">{n.title}</td> | <td className="docs-name">{n.title}</td> | ||||
| /> | /> | ||||
| </IconButton> | </IconButton> | ||||
| </td> | </td> | ||||
| <td> | |||||
| <div onClick={stopPropagation}> | |||||
| <a | |||||
| className="applicant-cv-button" | |||||
| style={{ | |||||
| width: "100px", | |||||
| height: "40px", | |||||
| padding: 8, | |||||
| }} | |||||
| download={n.title} | |||||
| href={`data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,${n.file_stream}`} | |||||
| > | |||||
| {t("common.download")} | |||||
| </a> | |||||
| </div> | |||||
| </td> | |||||
| </tr> | </tr> | ||||
| ))} | ))} | ||||
| </tbody> | </tbody> | ||||
| </div> | </div> | ||||
| )} | )} | ||||
| </div> | </div> | ||||
| {/* <a | |||||
| className="applicant-cv-button" | |||||
| download={"Proba2.docx"} | |||||
| href={`data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,${file2}`} | |||||
| title="Download pdf document" | |||||
| > | |||||
| {t("common.download")} file | |||||
| </a> */} | |||||
| <Pagination | <Pagination | ||||
| // size={matches ? "small" : "medium"} | // size={matches ? "small" : "medium"} | ||||
| size={"small"} | size={"small"} |