This commit is contained in:
omkieit 2024-10-10 22:19:02 +05:30
parent 95d7c7b00b
commit c8d2af7902
3 changed files with 483 additions and 489 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-CJfbdL2a.js"></script> <script type="module" crossorigin src="/assets/index-qn9aVrHm.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

@ -67,46 +67,63 @@ const Addproperty = () => {
{ title: "Real Estates fees", price: "0" }, { title: "Real Estates fees", price: "0" },
], ],
renovationCost: [ renovationCost: [
{ title: "Demolition: Removing existing structures or finishes", price: "0"}, {
{ title: "Framing: Making structural changes or additions", price: "0"}, title: "Demolition: Removing existing structures or finishes",
{ title: "Plumbing: Installing or modifying plumbing systems", price: "0"}, price: "0",
},
{ title: "Framing: Making structural changes or additions", price: "0" },
{
title: "Plumbing: Installing or modifying plumbing systems",
price: "0",
},
{ title: "Electrical: Updating wiring and fixtures", price: "0" }, { title: "Electrical: Updating wiring and fixtures", price: "0" },
{ title: "HVAC: Installing or upgrading heating and cooling systems", price: "0"}, {
title: "HVAC: Installing or upgrading heating and cooling systems",
price: "0",
},
{ title: "Insulation: Adding or replacing insulation", price: "0" }, { title: "Insulation: Adding or replacing insulation", price: "0" },
{ title: "Drywall: Hanging and finishing drywall", price: "0" }, { title: "Drywall: Hanging and finishing drywall", price: "0" },
{ title: "Interior Finishes: Painting, flooring, cabinetry, and fixtures", price: "0"}, {
{ title:"Exterior Work: Addressing siding, roofing, or landscaping, if applicable", price: "0"}, title: "Interior Finishes: Painting, flooring, cabinetry, and fixtures",
{ title: "Final Inspections: Ensuring everything meets codes", price: "0"}, price: "0",
},
{
title:
"Exterior Work: Addressing siding, roofing, or landscaping, if applicable",
price: "0",
},
{
title: "Final Inspections: Ensuring everything meets codes",
price: "0",
},
{ title: "Punch List: Completing any remaining task", price: "0" }, { title: "Punch List: Completing any remaining task", price: "0" },
], ],
sellingPriceBtoC:"0", sellingPriceBtoC: "0",
costPaidOutofClosing:[ costPaidOutofClosing: [
{ title: "Buyers Agent Commission", price: "0"}, { title: "Buyers Agent Commission", price: "0" },
{ title: "Sellers Agent Commission", price: "0"}, { title: "Sellers Agent Commission", price: "0" },
{ title: "Home Warranty", price: "0"}, { title: "Home Warranty", price: "0" },
{ title: "Document Preparation", price: "0"}, { title: "Document Preparation", price: "0" },
{ title: "Excise Tax", price: "0"}, { title: "Excise Tax", price: "0" },
{ title: "Legal Fees", price: "0"}, { title: "Legal Fees", price: "0" },
{ title: "Wire Fees/courier Fees", price: "0"}, { title: "Wire Fees/courier Fees", price: "0" },
{ title: "County Taxes", price: "0"}, { title: "County Taxes", price: "0" },
{ title: "HOA Fee", price: "0"}, { title: "HOA Fee", price: "0" },
{ title: "Payoff of 1st Mortgage", price: "0"}, { title: "Payoff of 1st Mortgage", price: "0" },
{ title: "Payoff of 2nd Mortgage", price: "0"}, { title: "Payoff of 2nd Mortgage", price: "0" },
{ title: "Payoff 3rd Mortgage", price: "0"}, { title: "Payoff 3rd Mortgage", price: "0" },
], ],
adjustments:[ adjustments: [{ title: "adjustments", price: "0" }],
{ title: "adjustments", price: "0"}, incomestatement: [
{ title: "income statement", price: "0" },
{ title: "income statement", price: "0" },
], ],
incomestatement:[ fundspriortoclosing: "0",
{ title: "income statement", price: "0"}, shorttermrental: "0",
{ title: "income statement", price: "0"}, OtherIncome: "0",
], InsuranceClaim: "0",
fundspriortoclosing:"0", LongTermRental: "0",
shorttermrental:"0", FinancingCostClosingCost: "0",
OtherIncome:"0",
InsuranceClaim:"0",
LongTermRental:"0",
FinancingCostClosingCost:"0",
}); });
const [submitted, setSubmitted] = useState(false); const [submitted, setSubmitted] = useState(false);
@ -358,16 +375,15 @@ const Addproperty = () => {
}, 0); }, 0);
}; };
const calculateTotalCashRequiredonSettlement= () => { const calculateTotalCashRequiredonSettlement = () => {
const totalcashAdjustments = calculatecashAdjustments(); const totalcashAdjustments = calculatecashAdjustments();
const totalcredits = calculateTotalCredits(); const totalcredits = calculateTotalCredits();
const totalPurchaseCosts= calculateTotalPurchaseCosts(); const totalPurchaseCosts = calculateTotalPurchaseCosts();
// Sum up all the values from the three functions // Sum up all the values from the three functions
return totalcashAdjustments + totalcredits + totalPurchaseCosts; return totalcashAdjustments + totalcredits + totalPurchaseCosts;
}; };
const addincidentalCost = () => { const addincidentalCost = () => {
setFormData((prevData) => ({ setFormData((prevData) => ({
...prevData, ...prevData,
@ -437,9 +453,7 @@ const Addproperty = () => {
}; };
const deletecarryCosts = (index) => { const deletecarryCosts = (index) => {
const updatedcarryCosts = formData.carryCosts.filter( const updatedcarryCosts = formData.carryCosts.filter((_, i) => i !== index);
(_, i) => i !== index
);
setFormData((prevData) => ({ setFormData((prevData) => ({
...prevData, ...prevData,
carryCosts: updatedcarryCosts, carryCosts: updatedcarryCosts,
@ -448,7 +462,7 @@ const Addproperty = () => {
// Function to handle changes to incidentalCost title and price // Function to handle changes to incidentalCost title and price
const handlecarryCostsTitle = (index, field, value) => { const handlecarryCostsTitle = (index, field, value) => {
const updatedcarryCosts= [...formData.carryCosts]; const updatedcarryCosts = [...formData.carryCosts];
updatedcarryCosts[index][field] = value; updatedcarryCosts[index][field] = value;
setFormData((prevData) => ({ setFormData((prevData) => ({
...prevData, ...prevData,
@ -464,21 +478,19 @@ const Addproperty = () => {
// If valid number, update state, otherwise show the alert // If valid number, update state, otherwise show the alert
if (isNumber || value === "") { if (isNumber || value === "") {
const updatedcarryCosts = formData.carryCosts.map( const updatedcarryCosts = formData.carryCosts.map((carryCosts, i) =>
(carryCosts, i) =>
i === index i === index
? { ...carryCosts, price: value, isInvalid: false } // Reset isInvalid if valid number ? { ...carryCosts, price: value, isInvalid: false } // Reset isInvalid if valid number
: carryCosts : carryCosts
); );
setFormData({ ...formData, carryCosts: updatedcarryCosts }); setFormData({ ...formData, carryCosts: updatedcarryCosts });
} else { } else {
const updatedcarryCosts = formData.carryCosts.map( const updatedcarryCosts = formData.carryCosts.map((carryCosts, i) =>
(carryCosts, i) =>
i === index i === index
? { ...carryCosts, isInvalid: true } // Set isInvalid true for invalid input ? { ...carryCosts, isInvalid: true } // Set isInvalid true for invalid input
: carryCosts : carryCosts
); );
setFormData({ ...formData, carryCosts: updatedcarryCosts}); setFormData({ ...formData, carryCosts: updatedcarryCosts });
} }
}; };
@ -560,20 +572,23 @@ const Addproperty = () => {
return totalIncidentalCost + totalcarryCosts + totalRenovationCost; return totalIncidentalCost + totalcarryCosts + totalRenovationCost;
}; };
const calculatetotalCoststoBuyAtoB =() => { const calculatetotalCoststoBuyAtoB = () => {
const totalRenovationsandHoldingCost = calculatetotalRenovationsandHoldingCost(); const totalRenovationsandHoldingCost =
const totalCashRequiredonSettlement = calculateTotalCashRequiredonSettlement(); calculatetotalRenovationsandHoldingCost();
const totalCashRequiredonSettlement =
calculateTotalCashRequiredonSettlement();
// Sum up all the values from the three functions // Sum up all the values from the three functions
return totalRenovationsandHoldingCost + totalCashRequiredonSettlement; return totalRenovationsandHoldingCost + totalCashRequiredonSettlement;
}; };
const addcostPaidOutofClosing = () => { const addcostPaidOutofClosing = () => {
setFormData((prevData) => ({ setFormData((prevData) => ({
...prevData, ...prevData,
costPaidOutofClosing: [...prevData.costPaidOutofClosing, { title: "", price: "" }], costPaidOutofClosing: [
...prevData.costPaidOutofClosing,
{ title: "", price: "" },
],
})); }));
}; };
@ -611,7 +626,10 @@ const Addproperty = () => {
? { ...costPaidOutofClosing, price: value, isInvalid: false } // Reset isInvalid if valid number ? { ...costPaidOutofClosing, price: value, isInvalid: false } // Reset isInvalid if valid number
: costPaidOutofClosing : costPaidOutofClosing
); );
setFormData({ ...formData, costPaidOutofClosing: updatedcostPaidOutofClosing }); setFormData({
...formData,
costPaidOutofClosing: updatedcostPaidOutofClosing,
});
} else { } else {
const updatedcostPaidOutofClosing = formData.costPaidOutofClosing.map( const updatedcostPaidOutofClosing = formData.costPaidOutofClosing.map(
(costPaidOutofClosing, i) => (costPaidOutofClosing, i) =>
@ -619,27 +637,30 @@ const Addproperty = () => {
? { ...costPaidOutofClosing, isInvalid: true } // Set isInvalid true for invalid input ? { ...costPaidOutofClosing, isInvalid: true } // Set isInvalid true for invalid input
: costPaidOutofClosing : costPaidOutofClosing
); );
setFormData({ ...formData, costPaidOutofClosing: updatedcostPaidOutofClosing }); setFormData({
...formData,
costPaidOutofClosing: updatedcostPaidOutofClosing,
});
} }
}; };
// Calculate total from costPaidOutofClosing array // Calculate total from costPaidOutofClosing array
const calculateTotalcostPaidOutofClosing = () => { const calculateTotalcostPaidOutofClosing = () => {
return formData.costPaidOutofClosing.reduce((total, costPaidOutofClosing) => { return formData.costPaidOutofClosing.reduce(
(total, costPaidOutofClosing) => {
const price = parseFloat(costPaidOutofClosing.price); const price = parseFloat(costPaidOutofClosing.price);
return total + (isNaN(price) ? 0 : price); // Ensure only valid numbers are added return total + (isNaN(price) ? 0 : price); // Ensure only valid numbers are added
}, 0); },
0
);
}; };
const calculateTotalCosttoSellBtoC = () => {
const calculateTotalCosttoSellBtoC =() => { const sekkingPriceBtoC = formData.sellingPriceBtoC;
const sekkingPriceBtoC= formData.sellingPriceBtoC;
const costPaidOutofClosing = calculateTotalcostPaidOutofClosing(); const costPaidOutofClosing = calculateTotalcostPaidOutofClosing();
return sekkingPriceBtoC - costPaidOutofClosing; return sekkingPriceBtoC - costPaidOutofClosing;
}; };
const addadjustments = () => { const addadjustments = () => {
setFormData((prevData) => ({ setFormData((prevData) => ({
...prevData, ...prevData,
@ -675,16 +696,14 @@ const Addproperty = () => {
// If valid number, update state, otherwise show the alert // If valid number, update state, otherwise show the alert
if (isNumber || value === "") { if (isNumber || value === "") {
const updatedadjustments = formData.adjustments.map( const updatedadjustments = formData.adjustments.map((adjustments, i) =>
(adjustments, i) =>
i === index i === index
? { ...adjustments, price: value, isInvalid: false } // Reset isInvalid if valid number ? { ...adjustments, price: value, isInvalid: false } // Reset isInvalid if valid number
: adjustments : adjustments
); );
setFormData({ ...formData, adjustments: updatedadjustments }); setFormData({ ...formData, adjustments: updatedadjustments });
} else { } else {
const updatedadjustments = formData.adjustments.map( const updatedadjustments = formData.adjustments.map((adjustments, i) =>
(adjustments, i) =>
i === index i === index
? { ...adjustments, isInvalid: true } // Set isInvalid true for invalid input ? { ...adjustments, isInvalid: true } // Set isInvalid true for invalid input
: adjustments : adjustments
@ -701,14 +720,12 @@ const Addproperty = () => {
}, 0); }, 0);
}; };
const calculatefundsavailablefordistribution =() => { const calculatefundsavailablefordistribution = () => {
const sellingPriceBtoC= calculateTotalCosttoSellBtoC(); const sellingPriceBtoC = calculateTotalCosttoSellBtoC();
const totaladjustments = calculateTotaladjustments(); const totaladjustments = calculateTotaladjustments();
return sellingPriceBtoC + totaladjustments; return sellingPriceBtoC + totaladjustments;
}; };
const addincomestatement = () => { const addincomestatement = () => {
setFormData((prevData) => ({ setFormData((prevData) => ({
...prevData, ...prevData,
@ -744,7 +761,7 @@ const Addproperty = () => {
// If valid number, update state, otherwise show the alert // If valid number, update state, otherwise show the alert
if (isNumber || value === "") { if (isNumber || value === "") {
const updatedincomestatement= formData.incomestatement.map( const updatedincomestatement = formData.incomestatement.map(
(incomestatement, i) => (incomestatement, i) =>
i === index i === index
? { ...incomestatement, price: value, isInvalid: false } // Reset isInvalid if valid number ? { ...incomestatement, price: value, isInvalid: false } // Reset isInvalid if valid number
@ -752,7 +769,7 @@ const Addproperty = () => {
); );
setFormData({ ...formData, incomestatement: updatedincomestatement }); setFormData({ ...formData, incomestatement: updatedincomestatement });
} else { } else {
const updatedincomestatement= formData.incomestatement.map( const updatedincomestatement = formData.incomestatement.map(
(incomestatement, i) => (incomestatement, i) =>
i === index i === index
? { ...incomestatement, isInvalid: true } // Set isInvalid true for invalid input ? { ...incomestatement, isInvalid: true } // Set isInvalid true for invalid input
@ -770,32 +787,57 @@ const Addproperty = () => {
}, 0); }, 0);
}; };
const calculatenetBtoCsalevalue = () => {
const calculatenetBtoCsalevalue = () =>{ const totalincomestatement = calculateTotalincomestatement();
const totalincomestatement= calculateTotalincomestatement(); const totalcosttosellbtoc = calculateTotalCosttoSellBtoC();
const totalcosttosellbtoc= calculateTotalCosttoSellBtoC();
return totalincomestatement + totalcosttosellbtoc; return totalincomestatement + totalcosttosellbtoc;
} };
const calculateNetProfitBeforeFinancingCosts = () => { const calculateNetProfitBeforeFinancingCosts = () => {
const netBtoCsalevalue = calculatenetBtoCsalevalue(); // const netBtoCsalevalue = parseFloat(calculatenetBtoCsalevalue());
const shorttermrental= formData.shorttermrental; // const shorttermrental = parseFloat(formData.shorttermrental);
const OtherIncome = formData.OtherIncome; // const OtherIncome = parseFloat(formData.OtherIncome);
const InsuranceClaim = formData.InsuranceClaim; // const InsuranceClaim = parseFloat(formData.InsuranceClaim);
const LongTermRental= formData.LongTermRental; // const LongTermRental = parseFloat(formData.LongTermRental);
const totalCoststoBuyAtoB=calculatetotalCoststoBuyAtoB(); // const totalCoststoBuyAtoB = parseFloat(calculatetotalCoststoBuyAtoB());
return netBtoCsalevalue + shorttermrental + OtherIncome + InsuranceClaim + LongTermRental - totalCoststoBuyAtoB; const netBtoCsalevalue = isNaN(parseFloat(calculatenetBtoCsalevalue()))
} ? 0
: parseFloat(calculatenetBtoCsalevalue());
const shorttermrental = isNaN(parseFloat(formData.shorttermrental))
? 0
: parseFloat(formData.shorttermrental);
const OtherIncome = isNaN(parseFloat(formData.OtherIncome))
? 0
: parseFloat(formData.OtherIncome);
const InsuranceClaim = isNaN(parseFloat(formData.InsuranceClaim))
? 0
: parseFloat(formData.InsuranceClaim);
const LongTermRental = isNaN(parseFloat(formData.LongTermRental))
? 0
: parseFloat(formData.LongTermRental);
const totalCoststoBuyAtoB = isNaN(
parseFloat(calculatetotalCoststoBuyAtoB())
)
? 0
: parseFloat(calculatetotalCoststoBuyAtoB());
// Calculate the sum first, then subtract the total costs
const totalIncome =
netBtoCsalevalue +
shorttermrental +
OtherIncome +
InsuranceClaim +
LongTermRental;
const netProfitBeforeFinancingCosts = totalIncome - totalCoststoBuyAtoB;
return netProfitBeforeFinancingCosts;
};
const calculateNetProfit = () => { const calculateNetProfit = () => {
const NetProfitBeforeFinancingCosts = calculateNetProfitBeforeFinancingCosts(); const NetProfitBeforeFinancingCosts =
const FinancingCostClosingCost = formData.FinancingCostClosingCost ; calculateNetProfitBeforeFinancingCosts();
const FinancingCostClosingCost = formData.FinancingCostClosingCost;
return NetProfitBeforeFinancingCosts - FinancingCostClosingCost; return NetProfitBeforeFinancingCosts - FinancingCostClosingCost;
} };
const handleSubmit = () => { const handleSubmit = () => {
if ( if (
@ -839,23 +881,28 @@ const calculatenetBtoCsalevalue = () =>{
formData.FinancingCostClosingCost formData.FinancingCostClosingCost
) { ) {
const totalPurchaseCosts = calculateTotalPurchaseCosts(); const totalPurchaseCosts = calculateTotalPurchaseCosts();
const totalPurchaseCostsaftercredits = calculateTotalPurchaseCostsWithCredits(); const totalPurchaseCostsaftercredits =
calculateTotalPurchaseCostsWithCredits();
const totalcashAdjustments = calculatecashAdjustments(); const totalcashAdjustments = calculatecashAdjustments();
const totalincidentalCost = calculateTotalincidentalCost(); const totalincidentalCost = calculateTotalincidentalCost();
const totalcredits = calculateTotalCredits(); const totalcredits = calculateTotalCredits();
const totalcashrequiredonsettlement = calculateTotalCashRequiredonSettlement(); const totalcashrequiredonsettlement =
calculateTotalCashRequiredonSettlement();
const totalcarryCosts = calculatetotalcarryCosts(); const totalcarryCosts = calculatetotalcarryCosts();
const totalrenovationCost = calculaterenovationCost(); const totalrenovationCost = calculaterenovationCost();
const totalRenovationsandHoldingCost = calculatetotalRenovationsandHoldingCost(); const totalRenovationsandHoldingCost =
calculatetotalRenovationsandHoldingCost();
const totalCoststoBuyAtoB = calculatetotalCoststoBuyAtoB(); const totalCoststoBuyAtoB = calculatetotalCoststoBuyAtoB();
const costPaidOutofClosing = calculateTotalcostPaidOutofClosing(); const costPaidOutofClosing = calculateTotalcostPaidOutofClosing();
const totaladjustments = calculateTotaladjustments(); const totaladjustments = calculateTotaladjustments();
const fundsavailablefordistribution = calculatefundsavailablefordistribution(); const fundsavailablefordistribution =
calculatefundsavailablefordistribution();
const grossproceedsperHUD = calculateTotalCosttoSellBtoC(); const grossproceedsperHUD = calculateTotalCosttoSellBtoC();
const totalCosttoSellBtoC = calculateTotalCosttoSellBtoC(); const totalCosttoSellBtoC = calculateTotalCosttoSellBtoC();
const totalincomestatement = calculateTotalincomestatement(); const totalincomestatement = calculateTotalincomestatement();
const netBtoCsalevalue = calculatenetBtoCsalevalue(); const netBtoCsalevalue = calculatenetBtoCsalevalue();
const netprofitbeforefinancingcosts = calculateNetProfitBeforeFinancingCosts(); const netprofitbeforefinancingcosts =
calculateNetProfitBeforeFinancingCosts();
const NetProfit = calculateNetProfit(); const NetProfit = calculateNetProfit();
// Add user info to formData, including the propertyTaxInfo array // Add user info to formData, including the propertyTaxInfo array
@ -871,21 +918,21 @@ const calculatenetBtoCsalevalue = () =>{
totalcredits: totalcredits, totalcredits: totalcredits,
totalPurchaseCostsaftercredits: totalPurchaseCostsaftercredits, totalPurchaseCostsaftercredits: totalPurchaseCostsaftercredits,
totalcashAdjustments: totalcashAdjustments, totalcashAdjustments: totalcashAdjustments,
totalcashrequiredonsettlement:totalcashrequiredonsettlement, totalcashrequiredonsettlement: totalcashrequiredonsettlement,
totalincidentalCost: totalincidentalCost, totalincidentalCost: totalincidentalCost,
totalcarryCosts: totalcarryCosts, totalcarryCosts: totalcarryCosts,
totalrenovationCost: totalrenovationCost, totalrenovationCost: totalrenovationCost,
totalRenovationsandHoldingCost: totalRenovationsandHoldingCost, totalRenovationsandHoldingCost: totalRenovationsandHoldingCost,
totalCoststoBuyAtoB: totalCoststoBuyAtoB, totalCoststoBuyAtoB: totalCoststoBuyAtoB,
costPaidOutofClosing:costPaidOutofClosing, costPaidOutofClosing: costPaidOutofClosing,
totaladjustments:totaladjustments, totaladjustments: totaladjustments,
fundsavailablefordistribution:fundsavailablefordistribution, fundsavailablefordistribution: fundsavailablefordistribution,
grossproceedsperHUD:grossproceedsperHUD, grossproceedsperHUD: grossproceedsperHUD,
totalCosttoSellBtoC:totalCosttoSellBtoC, totalCosttoSellBtoC: totalCosttoSellBtoC,
totalincomestatement:totalincomestatement, totalincomestatement: totalincomestatement,
netBtoCsalevalue:netBtoCsalevalue, netBtoCsalevalue: netBtoCsalevalue,
netprofitbeforefinancingcosts:netprofitbeforefinancingcosts, netprofitbeforefinancingcosts: netprofitbeforefinancingcosts,
NetProfit:NetProfit NetProfit: NetProfit,
}; };
// Check if propertyTaxInfo is an array and has values // Check if propertyTaxInfo is an array and has values
@ -948,7 +995,6 @@ const calculatenetBtoCsalevalue = () =>{
} }
}; };
return ( return (
<> <>
<div className="container tabs-wrap"> <div className="container tabs-wrap">
@ -1878,11 +1924,11 @@ const calculatenetBtoCsalevalue = () =>{
required required
/> />
</div> </div>
</div> </div>
<br /> <br />
<div className="row gy-3"> <div className="row gy-3">
{/* Close Date B to C */} {/* Close Date B to C */}
<div className="col-md-4"> <div className="col-md-4">
<input <input
@ -1913,11 +1959,11 @@ const calculatenetBtoCsalevalue = () =>{
required required
/> />
</div> </div>
</div> </div>
<br /> <br />
<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={{
@ -1954,7 +2000,7 @@ const calculatenetBtoCsalevalue = () =>{
fontWeight: "bold", fontWeight: "bold",
}} }}
> >
Renovation Risk Renovation Risk
</span> </span>
<div className="col-md-7"> <div className="col-md-7">
@ -1984,7 +2030,7 @@ Renovation Risk
</div> </div>
))} ))}
</div> </div>
</div> </div>
<hr <hr
style={{ style={{
@ -1995,8 +2041,7 @@ Renovation Risk
}} }}
/> />
<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={{
@ -2010,8 +2055,7 @@ Renovation Risk
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${formData.isPurchaseCostInvalid ? "is-invalid" : ""
formData.isPurchaseCostInvalid ? "is-invalid" : ""
}`} }`}
value={formData.purchaseCost} value={formData.purchaseCost}
name="purchaseCost" name="purchaseCost"
@ -2083,8 +2127,7 @@ Renovation Risk
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${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) => handlePriceChange(e, index)} // Use a new handler for price validation onChange={(e) => handlePriceChange(e, index)} // Use a new handler for price validation
@ -2191,8 +2234,7 @@ Renovation Risk
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${credits.isInvalid ? "is-invalid" : ""
credits.isInvalid ? "is-invalid" : ""
}`} // Apply 'is-invalid' class when invalid }`} // Apply 'is-invalid' class when invalid
value={credits.price} value={credits.price}
onChange={(e) => handleCreditPriceChange(e, index)} // New handler for price validation onChange={(e) => handleCreditPriceChange(e, index)} // New handler for price validation
@ -2340,8 +2382,7 @@ Renovation Risk
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${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) =>
@ -2425,8 +2466,7 @@ Renovation Risk
}} }}
/> />
<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={{
@ -2455,8 +2495,6 @@ Renovation Risk
</div> </div>
</div> </div>
<hr <hr
style={{ style={{
borderColor: "#fda417", // Set the color of the line borderColor: "#fda417", // Set the color of the line
@ -2497,8 +2535,7 @@ Renovation Risk
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${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) => handleincidentalCostChange(e, index)} // Use a new handler for price validation onChange={(e) => handleincidentalCostChange(e, index)} // Use a new handler for price validation
@ -2598,11 +2635,7 @@ Renovation Risk
className="form-control" className="form-control"
value={cost.title} value={cost.title}
onChange={(e) => onChange={(e) =>
handlecarryCostsTitle( handlecarryCostsTitle(index, "title", e.target.value)
index,
"title",
e.target.value
)
} }
placeholder="Title" placeholder="Title"
required required
@ -2611,13 +2644,10 @@ Renovation Risk
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${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) => handlecarryCostsChange(e, index)} // Use a new handler for price validation
handlecarryCostsChange(e, index)
} // Use a new handler for price validation
placeholder="Price" placeholder="Price"
style={{ textAlign: "right" }} style={{ textAlign: "right" }}
required required
@ -2731,8 +2761,7 @@ Renovation Risk
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${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) => handlerenovationCostChange(e, index)} // Use a new handler for price validation onChange={(e) => handlerenovationCostChange(e, index)} // Use a new handler for price validation
@ -2895,8 +2924,7 @@ Renovation Risk
}} }}
/> />
<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={{
@ -2910,8 +2938,7 @@ Renovation Risk
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${formData.isPurchaseCostInvalid ? "is-invalid" : ""
formData.isPurchaseCostInvalid ? "is-invalid" : ""
}`} }`}
name="sellingPriceBtoC" name="sellingPriceBtoC"
value={formData.sellingPriceBtoC} value={formData.sellingPriceBtoC}
@ -2956,9 +2983,7 @@ Renovation Risk
}} }}
/> />
<span
<span
style={{ style={{
color: "#fda417", color: "#fda417",
fontSize: "14px", fontSize: "14px",
@ -2989,11 +3014,12 @@ Renovation Risk
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${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) => handlecostPaidOutofClosingChange(e, index)} // Use a new handler for price validation onChange={(e) =>
handlecostPaidOutofClosingChange(e, index)
} // Use a new handler for price validation
placeholder="Price" placeholder="Price"
style={{ textAlign: "right" }} style={{ textAlign: "right" }}
required required
@ -3072,7 +3098,6 @@ Renovation Risk
}} }}
/> />
<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"
@ -3111,8 +3136,7 @@ Renovation Risk
}} }}
/> />
<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={{
@ -3150,8 +3174,6 @@ Renovation Risk
}} }}
/> />
<span <span
style={{ style={{
color: "#fda417", color: "#fda417",
@ -3170,11 +3192,7 @@ Renovation Risk
className="form-control" className="form-control"
value={cost.title} value={cost.title}
onChange={(e) => onChange={(e) =>
handleadjustmentsTitle( handleadjustmentsTitle(index, "title", e.target.value)
index,
"title",
e.target.value
)
} }
placeholder="Title" placeholder="Title"
required required
@ -3183,8 +3201,7 @@ Renovation Risk
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${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) => handleadjustmentsChange(e, index)} // Use a new handler for price validation onChange={(e) => handleadjustmentsChange(e, index)} // Use a new handler for price validation
@ -3266,8 +3283,7 @@ Renovation Risk
}} }}
/> />
<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={{
@ -3296,7 +3312,6 @@ Renovation Risk
</div> </div>
</div> </div>
<hr <hr
style={{ style={{
borderColor: "#fda417", // Set the color of the line borderColor: "#fda417", // Set the color of the line
@ -3313,7 +3328,7 @@ Renovation Risk
fontWeight: "bold", fontWeight: "bold",
}} }}
> >
Income Statement Adjustments: Income Statement Adjustments:
</span> </span>
{formData.incomestatement.map((cost, index) => ( {formData.incomestatement.map((cost, index) => (
@ -3337,8 +3352,7 @@ Income Statement Adjustments:
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${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) => handleincomestatementChange(e, index)} // Use a new handler for price validation onChange={(e) => handleincomestatementChange(e, index)} // Use a new handler for price validation
@ -3420,8 +3434,6 @@ Income Statement Adjustments:
}} }}
/> />
<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"
@ -3448,7 +3460,6 @@ Income Statement Adjustments:
// placeholder="Total Incidental Cost" // placeholder="Total Incidental Cost"
required required
/> />
</div> </div>
</div> </div>
<hr <hr
@ -3460,9 +3471,6 @@ Income Statement Adjustments:
}} }}
/> />
<span <span
style={{ style={{
color: "#fda417", color: "#fda417",
@ -3473,7 +3481,7 @@ Income Statement Adjustments:
Net Profit Computation Net Profit Computation
</span> </span>
<div className="row gy-3 align-items-center"> <div className="row gy-3 align-items-center">
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
@ -3493,11 +3501,11 @@ Income Statement Adjustments:
required required
/> />
</div> </div>
</div> </div>
<br /> <br />
<div className="row gy-3"> <div className="row gy-3">
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
@ -3511,8 +3519,7 @@ Income Statement Adjustments:
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${formData.isfundspriortoclosingInvalid ? "is-invalid" : ""
formData.isfundspriortoclosingInvalid ? "is-invalid" : ""
}`} }`}
value={formData.fundspriortoclosing} value={formData.fundspriortoclosing}
name="fundspriortoclosing" name="fundspriortoclosing"
@ -3545,10 +3552,10 @@ Income Statement Adjustments:
</div> </div>
)} )}
</div> </div>
</div> </div>
<br /> <br />
<div className="row gy-3"> <div className="row gy-3">
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
@ -3569,11 +3576,11 @@ Income Statement Adjustments:
required required
/> />
</div> </div>
</div> </div>
<br /> <br />
<div className="row gy-3"> <div className="row gy-3">
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
@ -3585,11 +3592,9 @@ Income Statement Adjustments:
</div> </div>
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${formData.isPurchaseCostInvalid ? "is-invalid" : ""
formData.isPurchaseCostInvalid ? "is-invalid" : ""
}`} }`}
value={formData.shorttermrental} value={formData.shorttermrental}
name="shorttermrental" name="shorttermrental"
@ -3621,12 +3626,11 @@ Income Statement Adjustments:
Please enter a valid number. Please enter a valid number.
</div> </div>
)} )}
</div> </div>
</div> </div>
<br /> <br />
<div className="row gy-3"> <div className="row gy-3">
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
@ -3640,8 +3644,7 @@ Income Statement Adjustments:
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${formData.isPurchaseCostInvalid ? "is-invalid" : ""
formData.isPurchaseCostInvalid ? "is-invalid" : ""
}`} }`}
value={formData.OtherIncome} value={formData.OtherIncome}
name="OtherIncome" name="OtherIncome"
@ -3674,10 +3677,10 @@ Income Statement Adjustments:
</div> </div>
)} )}
</div> </div>
</div> </div>
<br /> <br />
<div className="row gy-3"> <div className="row gy-3">
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
@ -3691,8 +3694,7 @@ Income Statement Adjustments:
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${formData.isPurchaseCostInvalid ? "is-invalid" : ""
formData.isPurchaseCostInvalid ? "is-invalid" : ""
}`} }`}
value={formData.InsuranceClaim} value={formData.InsuranceClaim}
name="InsuranceClaim" name="InsuranceClaim"
@ -3725,10 +3727,10 @@ Income Statement Adjustments:
</div> </div>
)} )}
</div> </div>
</div> </div>
<br /> <br />
<div className="row gy-3"> <div className="row gy-3">
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
@ -3742,8 +3744,7 @@ Income Statement Adjustments:
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${formData.isPurchaseCostInvalid ? "is-invalid" : ""
formData.isPurchaseCostInvalid ? "is-invalid" : ""
}`} }`}
value={formData.LongTermRental} value={formData.LongTermRental}
name="LongTermRental" name="LongTermRental"
@ -3776,10 +3777,10 @@ Income Statement Adjustments:
</div> </div>
)} )}
</div> </div>
</div> </div>
<br /> <br />
<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={{
@ -3808,9 +3809,9 @@ Income Statement Adjustments:
</div> </div>
</div> </div>
<br /> <br />
<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={{
@ -3824,8 +3825,9 @@ Income Statement Adjustments:
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${ className={`form-control ${formData.isFinancingCostClosingCostInvalid
formData.isFinancingCostClosingCostInvalid ? "is-invalid" : "" ? "is-invalid"
: ""
}`} }`}
value={formData.FinancingCostClosingCost} value={formData.FinancingCostClosingCost}
name="FinancingCostClosingCost" name="FinancingCostClosingCost"
@ -3860,10 +3862,9 @@ Income Statement Adjustments:
</div> </div>
</div> </div>
<br /> <br />
<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={{
@ -3889,16 +3890,9 @@ Income Statement Adjustments:
// placeholder="Total Incidental Cost" // placeholder="Total Incidental Cost"
required required
/> />
</div> </div>
</div> </div>
<div className="col-md-4"> <div className="col-md-4">
<button <button
className="btn btn-primary back" className="btn btn-primary back"