Fixed rounding bug on invoice total calculation BOD-120. Added documents viewing to edit invoice BOD-75 BOD-63.
This commit is contained in:
@@ -4,9 +4,15 @@ import DocumentsUploadContainer from "../documents-upload/documents-upload.conta
|
||||
import JobsDocumentsDownloadButton from "./jobs-document-gallery.download.component";
|
||||
import JobsDocumentsDeleteButton from "./jobs-documents-gallery.delete.component";
|
||||
|
||||
function JobsDocumentsComponent({ data, jobId, refetch }) {
|
||||
function JobsDocumentsComponent({
|
||||
data,
|
||||
jobId,
|
||||
refetch,
|
||||
invoiceId,
|
||||
invoicesCallback,
|
||||
}) {
|
||||
const [galleryImages, setgalleryImages] = useState([]);
|
||||
|
||||
console.log("Gallery Data", data);
|
||||
useEffect(() => {
|
||||
setgalleryImages(
|
||||
data.reduce((acc, value) => {
|
||||
@@ -28,17 +34,18 @@ function JobsDocumentsComponent({ data, jobId, refetch }) {
|
||||
}, [data, setgalleryImages]);
|
||||
|
||||
return (
|
||||
<div className='clearfix'>
|
||||
<div className="clearfix">
|
||||
<DocumentsUploadContainer
|
||||
jobId={jobId}
|
||||
callbackAfterUpload={refetch}
|
||||
invoiceId={invoiceId}
|
||||
callbackAfterUpload={invoicesCallback || refetch}
|
||||
tagsArray={["test"]}
|
||||
/>
|
||||
|
||||
<JobsDocumentsDownloadButton galleryImages={galleryImages} />
|
||||
<JobsDocumentsDeleteButton
|
||||
galleryImages={galleryImages}
|
||||
deletionCallback={refetch}
|
||||
deletionCallback={invoicesCallback || refetch}
|
||||
/>
|
||||
|
||||
<Gallery
|
||||
|
||||
@@ -5,14 +5,28 @@ import AlertComponent from "../alert/alert.component";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import JobDocuments from "./jobs-documents-gallery.component";
|
||||
|
||||
export default function JobsDocumentsContainer({ jobId }) {
|
||||
export default function JobsDocumentsContainer({
|
||||
jobId,
|
||||
invoiceId,
|
||||
documentsList,
|
||||
invoicesCallback,
|
||||
}) {
|
||||
const { loading, error, data, refetch } = useQuery(GET_DOCUMENTS_BY_JOB, {
|
||||
variables: { jobId: jobId },
|
||||
fetchPolicy: "network-only"
|
||||
fetchPolicy: "network-only",
|
||||
skip: !!invoiceId,
|
||||
});
|
||||
|
||||
if (loading) return <LoadingSpinner />;
|
||||
if (error) return <AlertComponent type="error" message={error.message} />;
|
||||
|
||||
return <JobDocuments data={data.documents} jobId={jobId} refetch={refetch} />;
|
||||
return (
|
||||
<JobDocuments
|
||||
data={(data && data.documents) || documentsList || []}
|
||||
invoiceId={invoiceId}
|
||||
jobId={jobId}
|
||||
refetch={refetch}
|
||||
invoicesCallback={invoicesCallback}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user