From 9cd1d932b1d5761b4e1546857fca7f5fd7f85a43 Mon Sep 17 00:00:00 2001 From: "pramod.mahajan" Date: Wed, 3 Dec 2025 11:33:23 +0530 Subject: [PATCH] added preview image inside challan, remove restric of payment date --- src/components/Expenses/Filelist.jsx | 2 +- .../purchase/DeliverChallanList.jsx | 6 +++--- src/components/purchase/DeliveryChallane.jsx | 14 +++++++++----- src/components/purchase/PurchaseList.jsx | 11 ++++++++++- src/components/purchase/PurchasePayment.jsx | 19 +++++-------------- src/pages/purchase/PurchasePage.jsx | 14 ++++++++++++++ 6 files changed, 42 insertions(+), 24 deletions(-) diff --git a/src/components/Expenses/Filelist.jsx b/src/components/Expenses/Filelist.jsx index 36a48565..eb606e7b 100644 --- a/src/components/Expenses/Filelist.jsx +++ b/src/components/Expenses/Filelist.jsx @@ -119,7 +119,7 @@ export const FileView = ({ file, viewFile }) => { {file.fileName} - + {" "} {file.fileSize ? formatFileSize(file.fileSize) : ""} diff --git a/src/components/purchase/DeliverChallanList.jsx b/src/components/purchase/DeliverChallanList.jsx index 45ecf033..a8bb4ab4 100644 --- a/src/components/purchase/DeliverChallanList.jsx +++ b/src/components/purchase/DeliverChallanList.jsx @@ -4,11 +4,11 @@ import { SpinnerLoader } from "../common/Loader"; import { formatUTCToLocalTime } from "../../utils/dateUtils"; import { FileView } from "../Expenses/Filelist"; -const DeliverChallanList = ({ purchaseId }) => { +const DeliverChallanList = ({ purchaseId, viewDocuments }) => { const { data, isLoading, isError, error } = useDeliverChallane(purchaseId); if (isLoading) { return ( -
+
); @@ -56,7 +56,7 @@ const DeliverChallanList = ({ purchaseId }) => {

{item.attachment?.preSignedUrl && ( - + )}
diff --git a/src/components/purchase/DeliveryChallane.jsx b/src/components/purchase/DeliveryChallane.jsx index 834f049d..d3448977 100644 --- a/src/components/purchase/DeliveryChallane.jsx +++ b/src/components/purchase/DeliveryChallane.jsx @@ -21,9 +21,11 @@ import SingleFileUploader from "../common/SigleFileUploader"; import { localToUtc } from "../../utils/appUtils"; import WarningBlock from "../InfoBlock/WarningBlock"; import { FILE_UPLOAD_INFO } from "../../utils/staticContent"; +import { usePurchaseContext } from "../../pages/purchase/PurchasePage"; const DeliveryChallane = ({ purchaseId }) => { const [file, setFile] = useState(null); + const {setDocumentView} = usePurchaseContext() const { register, @@ -174,14 +176,16 @@ const DeliveryChallane = ({ purchaseId }) => { />
-
- {!isUploaded && ( - - )} + {!isUploaded && }
@@ -190,7 +194,7 @@ const DeliveryChallane = ({ purchaseId }) => {

History

- +
diff --git a/src/components/purchase/PurchaseList.jsx b/src/components/purchase/PurchaseList.jsx index 5d7715b1..efbaf910 100644 --- a/src/components/purchase/PurchaseList.jsx +++ b/src/components/purchase/PurchaseList.jsx @@ -123,7 +123,16 @@ const PurchaseList = ({ searchString, isActive }) => { data?.data?.map((item, index) => ( {visibleColumns.map((col) => ( - + + setViewPurchase({ + isOpen: true, + purchaseId: item.id, + }) + } + > {col.render ? col.render(item) : item[col.key] || "NA"} ))} diff --git a/src/components/purchase/PurchasePayment.jsx b/src/components/purchase/PurchasePayment.jsx index 530110a0..121f77a5 100644 --- a/src/components/purchase/PurchasePayment.jsx +++ b/src/components/purchase/PurchasePayment.jsx @@ -20,7 +20,7 @@ import { SpinnerLoader } from "../common/Loader"; import { formatUTCToLocalTime } from "../../utils/dateUtils"; import Avatar from "../common/Avatar"; -const PurchasePayment = ({onClose, purchaseId }) => { +const PurchasePayment = ({ onClose, purchaseId }) => { const { data: Purchase, isLoading: isPurchaseLoading, @@ -93,16 +93,6 @@ const PurchasePayment = ({onClose, purchaseId }) => { size="md" name="paymentReceivedDate" control={control} - minDate={ - Purchase?.createdAt - ? new Date( - new Date(Purchase?.createdAt).setDate( - new Date(Purchase?.createdAt).getDate() + 1 - ) - ) - : null - } - maxDate={new Date()} /> {errors.paymentReceivedDate && ( @@ -283,9 +273,10 @@ const PurchasePayment = ({onClose, purchaseId }) => { {data?.length === 0 && (
- - -

You don't have any payment yet.

+ +

+ You don't have any payment yet. +

)} diff --git a/src/pages/purchase/PurchasePage.jsx b/src/pages/purchase/PurchasePage.jsx index 570a5945..2b56c5a0 100644 --- a/src/pages/purchase/PurchasePage.jsx +++ b/src/pages/purchase/PurchasePage.jsx @@ -9,6 +9,7 @@ import DeliveryChallane from "../../components/purchase/DeliveryChallane"; import PurchasePayment from "../../components/purchase/PurchasePayment"; import { useHasUserPermission } from "../../hooks/useHasUserPermission"; import { MANAGEPURCHASE_INVOICE } from "../../utils/constants"; +import PreviewDocument from "../../components/Expenses/PreviewDocument"; export const PurchaseContext = createContext(); export const usePurchaseContext = () => { @@ -40,6 +41,7 @@ const PurchasePage = () => { isOpen: false, purchaseId: null, }); + const [ViewDocument,setDocumentView] = useState({ IsOpen: false, Images: null }) const canCreatePurchase = useHasUserPermission(MANAGEPURCHASE_INVOICE); @@ -48,6 +50,7 @@ const PurchasePage = () => { setManagePurchase, setChallan, setAddPayment, + setDocumentView }; return ( @@ -170,6 +173,17 @@ const PurchasePage = () => { /> )} + + {ViewDocument.IsOpen && ( + setDocumentView({ IsOpen: false, Images: null })} + > + + + )} );