This commit is contained in:
omkieit 2024-10-13 18:08:36 +05:30
parent e365da1c7a
commit ec25e4d637
4 changed files with 690 additions and 825 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-BiIJaVB0.js"></script> <script type="module" crossorigin src="/assets/index-CKYSXRdS.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

@ -209,7 +209,7 @@ const Addproperty = () => {
let value = e.target.value; let value = e.target.value;
// Remove the dollar sign before validating // Remove the dollar sign before validating
value = value.replace(/^\$/, '').trim(); // Remove '$' if it exists value = value.replace(/^\$/, "").trim(); // Remove '$' if it exists
// Use a regular expression to allow only numbers and decimals // Use a regular expression to allow only numbers and decimals
const isNumber = /^\d*\.?\d*$/.test(value); const isNumber = /^\d*\.?\d*$/.test(value);
@ -230,8 +230,7 @@ const Addproperty = () => {
); );
setFormData({ ...formData, costPaidAtoB: updatedCosts }); setFormData({ ...formData, costPaidAtoB: updatedCosts });
} }
}; };
const calculateTotalPurchaseCosts = () => { const calculateTotalPurchaseCosts = () => {
const totalCostsFromArray = formData.costPaidAtoB.reduce((total, cost) => { const totalCostsFromArray = formData.costPaidAtoB.reduce((total, cost) => {
@ -272,8 +271,6 @@ const Addproperty = () => {
const handleCreditPriceChange = (e, index) => { const handleCreditPriceChange = (e, index) => {
const value = e.target.value; const value = e.target.value;
// Regular expression to allow only numbers and optional decimals // Regular expression to allow only numbers and optional decimals
const isNumber = /^\d*\.?\d*$/.test(value); const isNumber = /^\d*\.?\d*$/.test(value);
@ -845,10 +842,10 @@ const Addproperty = () => {
return NetProfitBeforeFinancingCosts - FinancingCostClosingCost; return NetProfitBeforeFinancingCosts - FinancingCostClosingCost;
}; };
const calculaterateofreturn =() => { const calculaterateofreturn = () => {
const rateofreturn = calculateNetProfit(); const rateofreturn = calculateNetProfit();
return rateofreturn; return rateofreturn;
} };
const handleSubmit = () => { const handleSubmit = () => {
if ( if (
@ -945,7 +942,7 @@ const Addproperty = () => {
netBtoCsalevalue: netBtoCsalevalue, netBtoCsalevalue: netBtoCsalevalue,
netprofitbeforefinancingcosts: netprofitbeforefinancingcosts, netprofitbeforefinancingcosts: netprofitbeforefinancingcosts,
NetProfit: NetProfit, NetProfit: NetProfit,
rateofreturn:rateofreturn rateofreturn: rateofreturn,
}; };
// Check if propertyTaxInfo is an array and has values // Check if propertyTaxInfo is an array and has values
@ -1939,24 +1936,36 @@ const Addproperty = () => {
</div> </div>
<div> <div>
<p><span style={{ <p>
<span
style={{
color: "#fda417", color: "#fda417",
fontSize: "14px", fontSize: "14px",
fontWeight: "bold", fontWeight: "bold",
}}>[M-D-Y] </span>: <span style={{ }}
>
[M-D-Y]{" "}
</span>
:{" "}
<span
style={{
color: "#000000", color: "#000000",
fontSize: "14px", fontSize: "14px",
fontWeight: "normal", fontWeight: "normal",
}}>{new Date(formData.closeDateAtoB).toLocaleDateString('en-US', { }}
month: 'numeric', >
day: 'numeric', {new Date(formData.closeDateAtoB).toLocaleDateString(
year: 'numeric' "en-US",
})}</span></p> {
</div> month: "numeric",
day: "numeric",
year: "numeric",
}
)}
</span>
</p>
</div>
</div> </div>
<div className="row gy-3"> <div className="row gy-3">
{/* Close Date B to C */} {/* Close Date B to C */}
@ -1991,23 +2000,34 @@ const Addproperty = () => {
</div> </div>
<div> <div>
<p><span style={{ <p>
<span
style={{
color: "#fda417", color: "#fda417",
fontSize: "14px", fontSize: "14px",
fontWeight: "bold", fontWeight: "bold",
}}>[M-D-Y] : </span> }}
<span style={{ >
[M-D-Y] :{" "}
</span>
<span
style={{
color: "#000000", color: "#000000",
fontSize: "14px", fontSize: "14px",
fontWeight: "normal", fontWeight: "normal",
}}>{new Date(formData.closeDateBtoC).toLocaleDateString('en-US', { }}
month: 'numeric', >
day: 'numeric', {new Date(formData.closeDateBtoC).toLocaleDateString(
year: 'numeric' "en-US",
})}</span> {
month: "numeric",
day: "numeric",
year: "numeric",
}
)}
</span>
</p> </p>
</div> </div>
</div> </div>
<div className="row gy-3 align-items-center"> <div className="row gy-3 align-items-center">
@ -2081,10 +2101,7 @@ const Addproperty = () => {
</div> </div>
</div> </div>
<br /> <br />
<div className="row gy-3 align-items-center"> <div className="row gy-3 align-items-center">
<span <span
@ -2114,8 +2131,6 @@ const Addproperty = () => {
</div> </div>
<br /> <br />
<hr <hr
style={{ style={{
borderColor: "#fda417", // Set the color of the line borderColor: "#fda417", // Set the color of the line
@ -2125,7 +2140,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={{
@ -2139,11 +2154,13 @@ 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}`} // Display the dollar sign in the input value={`$ ${formData.purchaseCost}`} // Display the dollar sign in the input
name="purchaseCost" name="purchaseCost"
onChange={(e) => { onChange={(e) => {
let value = e.target.value.replace(/[^\d.]/g, ''); // Remove anything thats not a digit or decimal point let value = e.target.value.replace(/[^\d.]/g, ""); // Remove anything thats not a digit or decimal point
const isValid = /^\d*\.?\d*$/.test(value); // Regex to allow only numbers and decimal points const isValid = /^\d*\.?\d*$/.test(value); // Regex to allow only numbers and decimal points
setFormData({ setFormData({
...formData, ...formData,
@ -2172,9 +2189,7 @@ const Addproperty = () => {
</div> </div>
)} )}
</div> </div>
</div> </div>
<hr <hr
style={{ style={{
@ -2212,7 +2227,9 @@ const Addproperty = () => {
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : ""}`} className={`form-control ${
cost.isInvalid ? "is-invalid" : ""
}`}
value={`$ ${cost.price}`} value={`$ ${cost.price}`}
onChange={(e) => handlePriceChange(e, index)} onChange={(e) => handlePriceChange(e, index)}
placeholder="Price" placeholder="Price"
@ -2235,8 +2252,7 @@ const Addproperty = () => {
</button> </button>
</div> </div>
</div> </div>
))} ))}
<div className="col-md-4"> <div className="col-md-4">
<button <button
@ -2281,8 +2297,7 @@ const Addproperty = () => {
}} }}
required required
/> />
</div> </div>
</div> </div>
<hr <hr
style={{ style={{
@ -2320,7 +2335,8 @@ const Addproperty = () => {
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${credits.isInvalid ? "is-invalid" : "" className={`form-control ${
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
@ -2468,7 +2484,8 @@ const Addproperty = () => {
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : "" className={`form-control ${
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) =>
@ -2621,7 +2638,8 @@ const Addproperty = () => {
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : "" className={`form-control ${
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
@ -2730,7 +2748,8 @@ const Addproperty = () => {
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : "" className={`form-control ${
cost.isInvalid ? "is-invalid" : ""
}`} // Apply 'is-invalid' class when invalid }`} // Apply 'is-invalid' class when invalid
value={cost.price} value={cost.price}
onChange={(e) => handlecarryCostsChange(e, index)} // Use a new handler for price validation onChange={(e) => handlecarryCostsChange(e, index)} // Use a new handler for price validation
@ -2847,7 +2866,8 @@ const Addproperty = () => {
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : "" className={`form-control ${
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
@ -3024,7 +3044,8 @@ 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" : ""
}`} }`}
name="sellingPriceBtoC" name="sellingPriceBtoC"
value={formData.sellingPriceBtoC} value={formData.sellingPriceBtoC}
@ -3100,7 +3121,8 @@ const Addproperty = () => {
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : "" className={`form-control ${
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) =>
@ -3287,7 +3309,8 @@ const Addproperty = () => {
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : "" className={`form-control ${
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
@ -3438,7 +3461,8 @@ const Addproperty = () => {
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : "" className={`form-control ${
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
@ -3605,7 +3629,8 @@ const Addproperty = () => {
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${formData.isfundspriortoclosingInvalid ? "is-invalid" : "" className={`form-control ${
formData.isfundspriortoclosingInvalid ? "is-invalid" : ""
}`} }`}
value={formData.fundspriortoclosing} value={formData.fundspriortoclosing}
name="fundspriortoclosing" name="fundspriortoclosing"
@ -3680,7 +3705,8 @@ 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.shorttermrental} value={formData.shorttermrental}
name="shorttermrental" name="shorttermrental"
@ -3730,7 +3756,8 @@ 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.OtherIncome} value={formData.OtherIncome}
name="OtherIncome" name="OtherIncome"
@ -3780,7 +3807,8 @@ 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.InsuranceClaim} value={formData.InsuranceClaim}
name="InsuranceClaim" name="InsuranceClaim"
@ -3830,7 +3858,8 @@ 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.LongTermRental} value={formData.LongTermRental}
name="LongTermRental" name="LongTermRental"
@ -3911,7 +3940,8 @@ const Addproperty = () => {
<div className="col-md-4"> <div className="col-md-4">
<input <input
type="text" type="text"
className={`form-control ${formData.isFinancingCostClosingCostInvalid className={`form-control ${
formData.isFinancingCostClosingCostInvalid
? "is-invalid" ? "is-invalid"
: "" : ""
}`} }`}

File diff suppressed because it is too large Load Diff