added preview image inside challan, remove restric of payment date
This commit is contained in:
parent
3e3ff189c9
commit
9cd1d932b1
@ -119,7 +119,7 @@ export const FileView = ({ file, viewFile }) => {
|
||||
<span className="text-muted small text-truncate mb-n4">
|
||||
{file.fileName}
|
||||
</span>
|
||||
<span className="text-body-secondary small">
|
||||
<span className="text-body-secondary small mt-2">
|
||||
<Tooltip text={"Click on file"}>
|
||||
{" "}
|
||||
{file.fileSize ? formatFileSize(file.fileSize) : ""}
|
||||
|
||||
@ -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 (
|
||||
<div className="d-flex justify-content-center align-items-center text-center vh-50">
|
||||
<div className="d-flex justify-content-center align-items-center text-center vh-50">
|
||||
<SpinnerLoader />
|
||||
</div>
|
||||
);
|
||||
@ -56,7 +56,7 @@ const DeliverChallanList = ({ purchaseId }) => {
|
||||
</p>
|
||||
|
||||
{item.attachment?.preSignedUrl && (
|
||||
<FileView file={item.attachment} />
|
||||
<FileView file={item.attachment} viewFile={viewDocuments} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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 }) => {
|
||||
/>
|
||||
|
||||
<div className="col-12 text-end my-3">
|
||||
<button type="submit" className="btn btn-sm btn-primary px-4">
|
||||
<button
|
||||
type="submit"
|
||||
className="btn btn-sm btn-primary px-4"
|
||||
disabled={isPending}
|
||||
>
|
||||
{isPending ? "Please Wait..." : "Submit"}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{!isUploaded && (
|
||||
<WarningBlock content={FILE_UPLOAD_INFO} />
|
||||
)}
|
||||
{!isUploaded && <WarningBlock content={FILE_UPLOAD_INFO} />}
|
||||
</div>
|
||||
|
||||
<div className="col-md-6 text-start">
|
||||
@ -190,7 +194,7 @@ const DeliveryChallane = ({ purchaseId }) => {
|
||||
<p className="fw-medium mb-0">History</p>
|
||||
</div>
|
||||
<div className="overflow-auto " style={{ maxHeight: "420px" }}>
|
||||
<DeliverChallanList purchaseId={purchaseId} />
|
||||
<DeliverChallanList purchaseId={purchaseId} viewDocuments={setDocumentView} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -123,7 +123,16 @@ const PurchaseList = ({ searchString, isActive }) => {
|
||||
data?.data?.map((item, index) => (
|
||||
<tr key={item?.id || index}>
|
||||
{visibleColumns.map((col) => (
|
||||
<td key={col.key} className={col.className || ""}>
|
||||
<td
|
||||
key={col.key}
|
||||
className={`${col.className} cursor-pointer` || ""}
|
||||
onClick={() =>
|
||||
setViewPurchase({
|
||||
isOpen: true,
|
||||
purchaseId: item.id,
|
||||
})
|
||||
}
|
||||
>
|
||||
{col.render ? col.render(item) : item[col.key] || "NA"}
|
||||
</td>
|
||||
))}
|
||||
|
||||
@ -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 && (
|
||||
<small className="danger-text">
|
||||
@ -283,9 +273,10 @@ const PurchasePayment = ({onClose, purchaseId }) => {
|
||||
{data?.length === 0 && (
|
||||
<div className="d-flex justify-content-center algin-items-center text-center">
|
||||
<div>
|
||||
|
||||
<i className='bx bx-box'></i>
|
||||
<p className="text-secondary">You don't have any payment yet.</p>
|
||||
<i className="bx bx-box"></i>
|
||||
<p className="text-secondary">
|
||||
You don't have any payment yet.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@ -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 (
|
||||
<PurchaseContext.Provider value={contextValue}>
|
||||
@ -170,6 +173,17 @@ const PurchasePage = () => {
|
||||
/>
|
||||
</GlobalModel>
|
||||
)}
|
||||
|
||||
{ViewDocument.IsOpen && (
|
||||
<GlobalModel
|
||||
isOpen
|
||||
size="md"
|
||||
key={ViewDocument.Images ?? "doc"}
|
||||
closeModal={() => setDocumentView({ IsOpen: false, Images: null })}
|
||||
>
|
||||
<PreviewDocument files={ViewDocument.Images} />
|
||||
</GlobalModel>
|
||||
)}
|
||||
</div>
|
||||
</PurchaseContext.Provider>
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user