This commit is contained in:
omkieit 2024-10-14 12:14:54 +05:30
parent c6bea888ad
commit c243bc83de
4 changed files with 71 additions and 64 deletions

File diff suppressed because one or more lines are too long

View File

@ -45,7 +45,7 @@
<script type="module" crossorigin src="/assets/index-CJacNAWv.js"></script> <script type="module" crossorigin src="/assets/index-7mv97drX.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-iEl-il0E.css"> <link rel="stylesheet" crossorigin href="/assets/index-iEl-il0E.css">
</head> </head>

View File

@ -28,7 +28,7 @@ const Addproperty = () => {
propertyTaxInfo: [ propertyTaxInfo: [
{ propertytaxowned: "0", ownedyear: "0", taxassessed: "0", taxyear: "0" }, { propertytaxowned: "0", ownedyear: "0", taxassessed: "0", taxyear: "0" },
], ],
images: [{ title: "", file: "" }], // Array to hold image objects images: [{ title: "", file: "" }],
googleMapLink: "", // Field for Google Maps link googleMapLink: "", // Field for Google Maps link
renovationRisk: null, renovationRisk: null,
purchaseCost: "0", purchaseCost: "0",
@ -129,6 +129,7 @@ const Addproperty = () => {
const [submitted, setSubmitted] = useState(false); const [submitted, setSubmitted] = useState(false);
const handleImageChange = (file, index) => { const handleImageChange = (file, index) => {
console.log("File received:", file); // Debugging log to check the file object
const updatedImages = [...formData.images]; const updatedImages = [...formData.images];
updatedImages[index].file = file.base64; // store base64 format of image updatedImages[index].file = file.base64; // store base64 format of image
setFormData({ ...formData, images: updatedImages }); setFormData({ ...formData, images: updatedImages });
@ -1805,21 +1806,27 @@ const Addproperty = () => {
className="btn btn-danger" className="btn btn-danger"
onClick={() => handleDeleteImage(index)} onClick={() => handleDeleteImage(index)}
style={{ style={{
marginLeft: "5px", // Adjust this to minimize space between the buttons marginLeft: "5px",
}} }}
> >
Delete Delete
</button> </button>
</div> </div>
{/* Check if image.file contains valid base64 data */}
{image.file && ( {image.file && (
<>
<p>Base64 Data:</p> {/* Debugging base64 data */}
<pre>{image.file.slice(0, 100)}...</pre> {/* Display first 100 characters for debugging */}
<div className="col-md-12"> <div className="col-md-12">
<img <img
src={image.file} src={image.file}
alt="uploaded" alt="uploaded"
style={{ width: "150px", height: "150px" }} style={{ width: "150px", height: "150px", objectFit: "cover" }}
/> />
</div> </div>
</>
)} )}
</div> </div>
))} ))}

View File

@ -34,7 +34,7 @@ const UserProperties = () => {
<div className="row p-2 bg-white border rounded mt-2"> <div className="row p-2 bg-white border rounded mt-2">
<div className="col-md-3 mt-1"> <div className="col-md-3 mt-1">
<img <img
src={propertydummy} src={property.images[0].file || propertydummy}
className="w-70" className="w-70"
alt="Img" alt="Img"
style={{ style={{