This commit is contained in:
omkieit 2024-10-08 21:53:59 +05:30
parent 63d13247c1
commit 3148ade7c0
4 changed files with 217 additions and 172 deletions

View File

@ -66,6 +66,12 @@ const propertySchema = mongoose.Schema({
type: Number, type: Number,
default: new Date().getFullYear(), default: new Date().getFullYear(),
}, },
closeDataAtoB:{
type: Number,
},
closeDataBtoC:{
type: Number,
},
purchaseCost: { purchaseCost: {
type: Number, type: Number,
required: true, // Set to true if this field is mandatory required: true, // Set to true if this field is mandatory

File diff suppressed because one or more lines are too long

View File

@ -45,7 +45,7 @@
<script type="module" crossorigin src="/assets/index-C-cZIHwO.js"></script> <script type="module" crossorigin src="/assets/index-BbbEpMBr.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

@ -65,16 +65,35 @@ const Addproperty = () => {
{ title: "Real Estates fees", price: "" }, { title: "Real Estates fees", price: "" },
], ],
renovationCost: [ renovationCost: [
{ title: "Demolition: Removing existing structures or finishes", price: "" }, {
title: "Demolition: Removing existing structures or finishes",
price: "",
},
{ title: "Framing: Making structural changes or additions", price: "" }, { title: "Framing: Making structural changes or additions", price: "" },
{ title: "Plumbing: Installing or modifying plumbing systems", price: "" }, {
title: "Plumbing: Installing or modifying plumbing systems",
price: "",
},
{ title: "Electrical: Updating wiring and fixtures", price: "" }, { title: "Electrical: Updating wiring and fixtures", price: "" },
{ title: "HVAC: Installing or upgrading heating and cooling systems", price: "" }, {
title: "HVAC: Installing or upgrading heating and cooling systems",
price: "",
},
{ title: "Insulation: Adding or replacing insulation", price: "" }, { title: "Insulation: Adding or replacing insulation", price: "" },
{ title: "Drywall: Hanging and finishing drywall", price: "" }, { title: "Drywall: Hanging and finishing drywall", price: "" },
{ title: "Interior Finishes: Painting, flooring, cabinetry, and fixtures", price: "" }, {
{ title: "Exterior Work: Addressing siding, roofing, or landscaping, if applicable", price: "" }, title: "Interior Finishes: Painting, flooring, cabinetry, and fixtures",
{ title: "Final Inspections: Ensuring everything meets codes", price: "" }, price: "",
},
{
title:
"Exterior Work: Addressing siding, roofing, or landscaping, if applicable",
price: "",
},
{
title: "Final Inspections: Ensuring everything meets codes",
price: "",
},
{ title: "Punch List: Completing any remaining task", price: "" }, { title: "Punch List: Completing any remaining task", price: "" },
], ],
}); });
@ -389,7 +408,6 @@ const Addproperty = () => {
}, 0); }, 0);
}; };
const addutilMaintenanceCost = () => { const addutilMaintenanceCost = () => {
setFormData((prevData) => ({ setFormData((prevData) => ({
...prevData, ...prevData,
@ -451,14 +469,6 @@ const Addproperty = () => {
}, 0); }, 0);
}; };
const addrenovationCost = () => { const addrenovationCost = () => {
setFormData((prevData) => ({ setFormData((prevData) => ({
...prevData, ...prevData,
@ -520,7 +530,6 @@ const Addproperty = () => {
}, 0); }, 0);
}; };
const calculatecostsAfterPropertyAcquisition = () => { const calculatecostsAfterPropertyAcquisition = () => {
const totalIncidentalCost = calculateTotalincidentalCost(); const totalIncidentalCost = calculateTotalincidentalCost();
const totalUtilMaintenanceCost = calculatetotalutilMaintenanceCost(); const totalUtilMaintenanceCost = calculatetotalutilMaintenanceCost();
@ -530,14 +539,6 @@ const Addproperty = () => {
return totalIncidentalCost + totalUtilMaintenanceCost + totalRenovationCost; return totalIncidentalCost + totalUtilMaintenanceCost + totalRenovationCost;
}; };
const handleNumericInput = (e) => { const handleNumericInput = (e) => {
const value = e.target.value; const value = e.target.value;
@ -586,7 +587,9 @@ const Addproperty = () => {
formData.roofing && formData.roofing &&
formData.totalSqft && formData.totalSqft &&
formData.totalcashsurplus && formData.totalcashsurplus &&
formData.sellpricebtoc formData.sellpricebtoc &&
formData.closeDataAtoB &&
formData.closeDataBtoC
) { ) {
const totalCostsAtoB = calculateTotalCosts(); const totalCostsAtoB = calculateTotalCosts();
const totalCostsAtoBaftercredits = calculateTotalCostsWithCredits(); const totalCostsAtoBaftercredits = calculateTotalCostsWithCredits();
@ -595,7 +598,8 @@ const Addproperty = () => {
const totalcredits = calculateTotalCredits(); const totalcredits = calculateTotalCredits();
const totalutilMaintenanceCost = calculatetotalutilMaintenanceCost(); const totalutilMaintenanceCost = calculatetotalutilMaintenanceCost();
const totalrenovationCost = calculaterenovationCost(); const totalrenovationCost = calculaterenovationCost();
const costsAfterPropertyAcquisition= calculatecostsAfterPropertyAcquisition(); const costsAfterPropertyAcquisition =
calculatecostsAfterPropertyAcquisition();
// Add user info to formData, including the propertyTaxInfo array // Add user info to formData, including the propertyTaxInfo array
const formDataWithUserInfo = { const formDataWithUserInfo = {
@ -1551,38 +1555,80 @@ const Addproperty = () => {
borderRadius: "8px", borderRadius: "8px",
}} }}
> >
<h3
style={{
color: "#fda417",
border: "#fda417",
fontSize: "20px",
fontWeight: "normal",
}}
>
Property Acquisition A to B:
</h3>
<br /> <br />
{/* <div className="form-floating mb-3">
<span style={{ <div className="row gy-3">
color: "#fda417", <div className="col-md-4">
fontSize: "14px",
fontWeight: "bold",
}}>Purchase Cost</span>
<input <input
type="text" type="text"
className="form-control" className="form-control"
value={formData.purchaseCost} placeholder="Close Date A to B"
onChange={(e) => required
setFormData({ disabled
...formData, />
purchaseCost: e.target.value, </div>
}) <div className="col-md-4">
} <input
placeholder="Enter Purchase Cost" type="date"
className="form-control"
value={formData.closeDataAtoB}
placeholder="Close Date A to B"
style={{ textAlign: "right" }}
required required
/> />
</div> */} </div>
</div>
<br />
<div className="row gy-3">
<div className="col-md-4">
<input
type="text"
className="form-control"
placeholder="Close Date B to C"
required
disabled
/>
</div>
<div className="col-md-4">
<input
type="date"
className="form-control"
value={formData.closeDataBtoC}
placeholder="Close Date B to C"
style={{ textAlign: "right" }}
required
/>
</div>
</div>
<hr
style={{
borderColor: "#fda417", // Set the color of the line
borderWidth: "1px", // Optional: Adjust the thickness of the line
backgroundColor: "#fda417", // Optional: Apply color if using for background
height: "1px", // Optional: Set height to match the border width
}}
/>
<span
style={{
color: "#fda417",
fontSize: "14px",
fontWeight: "bold",
}}
>
Property Acquisition A to B:
</span>
<br />
<div className="row gy-3"> <div className="row gy-3">
<div className="col-md-4"> <div className="col-md-4">
<input <input
@ -1596,7 +1642,9 @@ const Addproperty = () => {
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${formData.isPurchaseCostInvalid ? "is-invalid" : ""}`} className={`form-control ${
formData.isPurchaseCostInvalid ? "is-invalid" : ""
}`}
value={formData.purchaseCost} value={formData.purchaseCost}
onChange={(e) => { onChange={(e) => {
const value = e.target.value; const value = e.target.value;
@ -1628,7 +1676,6 @@ const Addproperty = () => {
</div> </div>
)} )}
</div> </div>
</div> </div>
<hr <hr
style={{ style={{
@ -2285,8 +2332,6 @@ const Addproperty = () => {
}} }}
/> />
<span <span
style={{ style={{
color: "#fda417", color: "#fda417",
@ -2305,7 +2350,11 @@ const Addproperty = () => {
className="form-control" className="form-control"
value={cost.title} value={cost.title}
onChange={(e) => onChange={(e) =>
handlerenovationCostTitle(index, "title", e.target.value) handlerenovationCostTitle(
index,
"title",
e.target.value
)
} }
placeholder="Title" placeholder="Title"
required required
@ -2322,9 +2371,7 @@ const Addproperty = () => {
cost.isInvalid ? "is-invalid" : "" cost.isInvalid ? "is-invalid" : ""
}`} // Apply 'is-invalid' class when invalid }`} // Apply 'is-invalid' class when invalid
value={cost.price} value={cost.price}
onChange={(e) => onChange={(e) => handlerenovationCostChange(e, index)} // Use a new handler for price validation
handlerenovationCostChange(e, index)
} // Use a new handler for price validation
placeholder="Price" placeholder="Price"
style={{ textAlign: "right" }} style={{ textAlign: "right" }}
required required
@ -2441,7 +2488,6 @@ const Addproperty = () => {
}} }}
/> />
<div className="row gy-3 align-items-center"> <div className="row gy-3 align-items-center">
<span <span
className="col-md-4" className="col-md-4"
@ -2456,7 +2502,9 @@ const Addproperty = () => {
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${formData.isInvalid ? "is-invalid" : ""}`} className={`form-control ${
formData.isInvalid ? "is-invalid" : ""
}`}
name="sellpricebtoc" name="sellpricebtoc"
value={formData.sellpricebtoc} value={formData.sellpricebtoc}
onChange={(e) => { onChange={(e) => {
@ -2489,10 +2537,6 @@ const Addproperty = () => {
</div> </div>
)} )}
</div> </div>
</div> </div>
<hr <hr
@ -2504,11 +2548,6 @@ const Addproperty = () => {
}} }}
/> />
<div className="col-md-4"> <div className="col-md-4">
<button <button
className="btn btn-primary back" className="btn btn-primary back"