done
This commit is contained in:
parent
63d13247c1
commit
3148ade7c0
|
@ -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
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
@ -594,8 +597,9 @@ const Addproperty = () => {
|
||||||
const totalincidentalCost = calculateTotalincidentalCost();
|
const totalincidentalCost = calculateTotalincidentalCost();
|
||||||
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 = {
|
||||||
|
@ -612,8 +616,8 @@ const Addproperty = () => {
|
||||||
totalcashAdjustments: totalcashAdjustments,
|
totalcashAdjustments: totalcashAdjustments,
|
||||||
totalincidentalCost: totalincidentalCost,
|
totalincidentalCost: totalincidentalCost,
|
||||||
totalutilMaintenanceCost: totalutilMaintenanceCost,
|
totalutilMaintenanceCost: totalutilMaintenanceCost,
|
||||||
totalrenovationCost:totalrenovationCost,
|
totalrenovationCost: totalrenovationCost,
|
||||||
costsAfterPropertyAcquisition:costsAfterPropertyAcquisition,
|
costsAfterPropertyAcquisition: costsAfterPropertyAcquisition,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check if propertyTaxInfo is an array and has values
|
// Check if propertyTaxInfo is an array and has values
|
||||||
|
@ -1551,38 +1555,80 @@ const Addproperty = () => {
|
||||||
borderRadius: "8px",
|
borderRadius: "8px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<h3
|
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
|
||||||
|
<div className="row gy-3">
|
||||||
|
<div className="col-md-4">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
placeholder="Close Date A to B"
|
||||||
|
required
|
||||||
|
disabled
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="col-md-4">
|
||||||
|
<input
|
||||||
|
type="date"
|
||||||
|
className="form-control"
|
||||||
|
value={formData.closeDataAtoB}
|
||||||
|
placeholder="Close Date A to B"
|
||||||
|
style={{ textAlign: "right" }}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</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={{
|
style={{
|
||||||
color: "#fda417",
|
color: "#fda417",
|
||||||
border: "#fda417",
|
fontSize: "14px",
|
||||||
fontSize: "20px",
|
fontWeight: "bold",
|
||||||
fontWeight: "normal",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Property Acquisition A to B:
|
Property Acquisition A to B:
|
||||||
</h3>
|
</span>
|
||||||
<br />
|
|
||||||
|
|
||||||
{/* <div className="form-floating mb-3">
|
<br />
|
||||||
<span style={{
|
|
||||||
color: "#fda417",
|
|
||||||
fontSize: "14px",
|
|
||||||
fontWeight: "bold",
|
|
||||||
}}>Purchase Cost</span>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="form-control"
|
|
||||||
value={formData.purchaseCost}
|
|
||||||
onChange={(e) =>
|
|
||||||
setFormData({
|
|
||||||
...formData,
|
|
||||||
purchaseCost: e.target.value,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
placeholder="Enter Purchase Cost"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div> */}
|
|
||||||
<div className="row gy-3">
|
<div className="row gy-3">
|
||||||
<div className="col-md-4">
|
<div className="col-md-4">
|
||||||
<input
|
<input
|
||||||
|
@ -1594,41 +1640,42 @@ const Addproperty = () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<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 ${
|
||||||
value={formData.purchaseCost}
|
formData.isPurchaseCostInvalid ? "is-invalid" : ""
|
||||||
onChange={(e) => {
|
}`}
|
||||||
const value = e.target.value;
|
value={formData.purchaseCost}
|
||||||
const isValid = /^\d*\.?\d*$/.test(value); // Regex to allow only numbers and decimal points
|
onChange={(e) => {
|
||||||
setFormData({
|
const value = e.target.value;
|
||||||
...formData,
|
const isValid = /^\d*\.?\d*$/.test(value); // Regex to allow only numbers and decimal points
|
||||||
purchaseCost: value,
|
setFormData({
|
||||||
isPurchaseCostInvalid: !isValid, // Set isPurchaseCostInvalid to true if the value is not a valid number
|
...formData,
|
||||||
});
|
purchaseCost: value,
|
||||||
}}
|
isPurchaseCostInvalid: !isValid, // Set isPurchaseCostInvalid to true if the value is not a valid number
|
||||||
onKeyPress={(e) => {
|
});
|
||||||
const charCode = e.charCode;
|
}}
|
||||||
// Allow only numbers and decimal points
|
onKeyPress={(e) => {
|
||||||
if ((charCode < 48 || charCode > 57) && charCode !== 46) {
|
const charCode = e.charCode;
|
||||||
e.preventDefault(); // Prevent non-numeric input
|
// Allow only numbers and decimal points
|
||||||
setFormData({
|
if ((charCode < 48 || charCode > 57) && charCode !== 46) {
|
||||||
...formData,
|
e.preventDefault(); // Prevent non-numeric input
|
||||||
isPurchaseCostInvalid: true, // Set isPurchaseCostInvalid to true to show the alert
|
setFormData({
|
||||||
});
|
...formData,
|
||||||
}
|
isPurchaseCostInvalid: true, // Set isPurchaseCostInvalid to true to show the alert
|
||||||
}}
|
});
|
||||||
placeholder="Enter Purchase Cost"
|
}
|
||||||
style={{ textAlign: "right" }}
|
}}
|
||||||
required
|
placeholder="Enter Purchase Cost"
|
||||||
/>
|
style={{ textAlign: "right" }}
|
||||||
{formData.isPurchaseCostInvalid && (
|
required
|
||||||
<div className="invalid-feedback">
|
/>
|
||||||
Please enter a valid number.
|
{formData.isPurchaseCostInvalid && (
|
||||||
</div>
|
<div className="invalid-feedback">
|
||||||
)}
|
Please enter a valid number.
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr
|
<hr
|
||||||
style={{
|
style={{
|
||||||
|
@ -2285,9 +2332,7 @@ const Addproperty = () => {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<span
|
||||||
|
|
||||||
<span
|
|
||||||
style={{
|
style={{
|
||||||
color: "#fda417",
|
color: "#fda417",
|
||||||
fontSize: "14px",
|
fontSize: "14px",
|
||||||
|
@ -2299,21 +2344,25 @@ const Addproperty = () => {
|
||||||
|
|
||||||
{formData.renovationCost.map((cost, index) => (
|
{formData.renovationCost.map((cost, index) => (
|
||||||
<div key={index} className="row gy-3 align-items-center">
|
<div key={index} className="row gy-3 align-items-center">
|
||||||
<div className="col-md-4">
|
<div className="col-md-4">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
className="form-control"
|
className="form-control"
|
||||||
value={cost.title}
|
value={cost.title}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
handlerenovationCostTitle(index, "title", e.target.value)
|
handlerenovationCostTitle(
|
||||||
}
|
index,
|
||||||
placeholder="Title"
|
"title",
|
||||||
required
|
e.target.value
|
||||||
style={{
|
)
|
||||||
fontSize: "10px", // Set the desired font size
|
}
|
||||||
}}
|
placeholder="Title"
|
||||||
/>
|
required
|
||||||
</div>
|
style={{
|
||||||
|
fontSize: "10px", // Set the desired font size
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="col-md-4">
|
<div className="col-md-4">
|
||||||
<input
|
<input
|
||||||
|
@ -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
|
||||||
|
@ -2403,7 +2450,7 @@ 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"
|
||||||
style={{
|
style={{
|
||||||
|
@ -2441,8 +2488,7 @@ 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"
|
||||||
style={{
|
style={{
|
||||||
|
@ -2454,45 +2500,43 @@ const Addproperty = () => {
|
||||||
Selling Price B to C
|
Selling Price B to C
|
||||||
</span>
|
</span>
|
||||||
<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 ${
|
||||||
name="sellpricebtoc"
|
formData.isInvalid ? "is-invalid" : ""
|
||||||
value={formData.sellpricebtoc}
|
}`}
|
||||||
onChange={(e) => {
|
name="sellpricebtoc"
|
||||||
const value = e.target.value;
|
value={formData.sellpricebtoc}
|
||||||
const isValid = /^\d*\.?\d*$/.test(value); // Allow only numbers and decimal points
|
onChange={(e) => {
|
||||||
setFormData({
|
const value = e.target.value;
|
||||||
...formData,
|
const isValid = /^\d*\.?\d*$/.test(value); // Allow only numbers and decimal points
|
||||||
sellpricebtoc: value,
|
setFormData({
|
||||||
isInvalid: !isValid, // Set isInvalid to true if the value is not a valid number
|
...formData,
|
||||||
});
|
sellpricebtoc: value,
|
||||||
}}
|
isInvalid: !isValid, // Set isInvalid to true if the value is not a valid number
|
||||||
onKeyPress={(e) => {
|
});
|
||||||
const charCode = e.charCode;
|
}}
|
||||||
// Allow only numbers and decimal point
|
onKeyPress={(e) => {
|
||||||
if ((charCode < 48 || charCode > 57) && charCode !== 46) {
|
const charCode = e.charCode;
|
||||||
e.preventDefault(); // Prevent non-numeric input
|
// Allow only numbers and decimal point
|
||||||
setFormData({
|
if ((charCode < 48 || charCode > 57) && charCode !== 46) {
|
||||||
...formData,
|
e.preventDefault(); // Prevent non-numeric input
|
||||||
isInvalid: true, // Set isInvalid to true to show the alert
|
setFormData({
|
||||||
});
|
...formData,
|
||||||
}
|
isInvalid: true, // Set isInvalid to true to show the alert
|
||||||
}}
|
});
|
||||||
placeholder="Selling Price B to C"
|
}
|
||||||
style={{ textAlign: "right" }}
|
}}
|
||||||
required
|
placeholder="Selling Price B to C"
|
||||||
/>
|
style={{ textAlign: "right" }}
|
||||||
{formData.isInvalid && (
|
required
|
||||||
<div className="invalid-feedback">
|
/>
|
||||||
Please enter a valid number.
|
{formData.isInvalid && (
|
||||||
</div>
|
<div className="invalid-feedback">
|
||||||
)}
|
Please enter a valid number.
|
||||||
</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"
|
||||||
|
|
Loading…
Reference in New Issue