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">
</head>

View File

@ -209,7 +209,7 @@ const Addproperty = () => {
let value = e.target.value;
// 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
const isNumber = /^\d*\.?\d*$/.test(value);
@ -232,7 +232,6 @@ const Addproperty = () => {
}
};
const calculateTotalPurchaseCosts = () => {
const totalCostsFromArray = formData.costPaidAtoB.reduce((total, cost) => {
const price = parseFloat(cost.price) || 0; // Convert price to number
@ -272,8 +271,6 @@ const Addproperty = () => {
const handleCreditPriceChange = (e, index) => {
const value = e.target.value;
// Regular expression to allow only numbers and optional decimals
const isNumber = /^\d*\.?\d*$/.test(value);
@ -848,7 +845,7 @@ const Addproperty = () => {
const calculaterateofreturn = () => {
const rateofreturn = calculateNetProfit();
return rateofreturn;
}
};
const handleSubmit = () => {
if (
@ -945,7 +942,7 @@ const Addproperty = () => {
netBtoCsalevalue: netBtoCsalevalue,
netprofitbeforefinancingcosts: netprofitbeforefinancingcosts,
NetProfit: NetProfit,
rateofreturn:rateofreturn
rateofreturn: rateofreturn,
};
// Check if propertyTaxInfo is an array and has values
@ -1939,25 +1936,37 @@ const Addproperty = () => {
</div>
<div>
<p><span style={{
<p>
<span
style={{
color: "#fda417",
fontSize: "14px",
fontWeight: "bold",
}}>[M-D-Y] </span>: <span style={{
}}
>
[M-D-Y]{" "}
</span>
:{" "}
<span
style={{
color: "#000000",
fontSize: "14px",
fontWeight: "normal",
}}>{new Date(formData.closeDateAtoB).toLocaleDateString('en-US', {
month: 'numeric',
day: 'numeric',
year: 'numeric'
})}</span></p>
}}
>
{new Date(formData.closeDateAtoB).toLocaleDateString(
"en-US",
{
month: "numeric",
day: "numeric",
year: "numeric",
}
)}
</span>
</p>
</div>
</div>
<div className="row gy-3">
{/* Close Date B to C */}
<div className="col-md-4">
@ -1991,21 +2000,32 @@ const Addproperty = () => {
</div>
<div>
<p><span style={{
<p>
<span
style={{
color: "#fda417",
fontSize: "14px",
fontWeight: "bold",
}}>[M-D-Y] : </span>
<span style={{
}}
>
[M-D-Y] :{" "}
</span>
<span
style={{
color: "#000000",
fontSize: "14px",
fontWeight: "normal",
}}>{new Date(formData.closeDateBtoC).toLocaleDateString('en-US', {
month: 'numeric',
day: 'numeric',
year: 'numeric'
})}</span>
}}
>
{new Date(formData.closeDateBtoC).toLocaleDateString(
"en-US",
{
month: "numeric",
day: "numeric",
year: "numeric",
}
)}
</span>
</p>
</div>
</div>
@ -2083,9 +2103,6 @@ const Addproperty = () => {
<br />
<div className="row gy-3 align-items-center">
<span
className="col-md-4"
@ -2114,8 +2131,6 @@ const Addproperty = () => {
</div>
<br />
<hr
style={{
borderColor: "#fda417", // Set the color of the line
@ -2139,11 +2154,13 @@ const Addproperty = () => {
<div className="col-md-4">
<input
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
name="purchaseCost"
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
setFormData({
...formData,
@ -2174,8 +2191,6 @@ const Addproperty = () => {
</div>
</div>
<hr
style={{
borderColor: "#fda417", // Set the color of the line
@ -2212,7 +2227,9 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : ""}`}
className={`form-control ${
cost.isInvalid ? "is-invalid" : ""
}`}
value={`$ ${cost.price}`}
onChange={(e) => handlePriceChange(e, index)}
placeholder="Price"
@ -2237,7 +2254,6 @@ const Addproperty = () => {
</div>
))}
<div className="col-md-4">
<button
onClick={addCost}
@ -2282,7 +2298,6 @@ const Addproperty = () => {
required
/>
</div>
</div>
<hr
style={{
@ -2320,7 +2335,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${credits.isInvalid ? "is-invalid" : ""
className={`form-control ${
credits.isInvalid ? "is-invalid" : ""
}`} // Apply 'is-invalid' class when invalid
value={credits.price}
onChange={(e) => handleCreditPriceChange(e, index)} // New handler for price validation
@ -2468,7 +2484,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : ""
className={`form-control ${
cost.isInvalid ? "is-invalid" : ""
}`} // Apply 'is-invalid' class when invalid
value={cost.price}
onChange={(e) =>
@ -2621,7 +2638,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : ""
className={`form-control ${
cost.isInvalid ? "is-invalid" : ""
}`} // Apply 'is-invalid' class when invalid
value={cost.price}
onChange={(e) => handleincidentalCostChange(e, index)} // Use a new handler for price validation
@ -2730,7 +2748,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : ""
className={`form-control ${
cost.isInvalid ? "is-invalid" : ""
}`} // Apply 'is-invalid' class when invalid
value={cost.price}
onChange={(e) => handlecarryCostsChange(e, index)} // Use a new handler for price validation
@ -2847,7 +2866,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : ""
className={`form-control ${
cost.isInvalid ? "is-invalid" : ""
}`} // Apply 'is-invalid' class when invalid
value={cost.price}
onChange={(e) => handlerenovationCostChange(e, index)} // Use a new handler for price validation
@ -3024,7 +3044,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${formData.isPurchaseCostInvalid ? "is-invalid" : ""
className={`form-control ${
formData.isPurchaseCostInvalid ? "is-invalid" : ""
}`}
name="sellingPriceBtoC"
value={formData.sellingPriceBtoC}
@ -3100,7 +3121,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : ""
className={`form-control ${
cost.isInvalid ? "is-invalid" : ""
}`} // Apply 'is-invalid' class when invalid
value={cost.price}
onChange={(e) =>
@ -3287,7 +3309,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : ""
className={`form-control ${
cost.isInvalid ? "is-invalid" : ""
}`} // Apply 'is-invalid' class when invalid
value={cost.price}
onChange={(e) => handleadjustmentsChange(e, index)} // Use a new handler for price validation
@ -3438,7 +3461,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${cost.isInvalid ? "is-invalid" : ""
className={`form-control ${
cost.isInvalid ? "is-invalid" : ""
}`} // Apply 'is-invalid' class when invalid
value={cost.price}
onChange={(e) => handleincomestatementChange(e, index)} // Use a new handler for price validation
@ -3605,7 +3629,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${formData.isfundspriortoclosingInvalid ? "is-invalid" : ""
className={`form-control ${
formData.isfundspriortoclosingInvalid ? "is-invalid" : ""
}`}
value={formData.fundspriortoclosing}
name="fundspriortoclosing"
@ -3680,7 +3705,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${formData.isPurchaseCostInvalid ? "is-invalid" : ""
className={`form-control ${
formData.isPurchaseCostInvalid ? "is-invalid" : ""
}`}
value={formData.shorttermrental}
name="shorttermrental"
@ -3730,7 +3756,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${formData.isPurchaseCostInvalid ? "is-invalid" : ""
className={`form-control ${
formData.isPurchaseCostInvalid ? "is-invalid" : ""
}`}
value={formData.OtherIncome}
name="OtherIncome"
@ -3780,7 +3807,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${formData.isPurchaseCostInvalid ? "is-invalid" : ""
className={`form-control ${
formData.isPurchaseCostInvalid ? "is-invalid" : ""
}`}
value={formData.InsuranceClaim}
name="InsuranceClaim"
@ -3830,7 +3858,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${formData.isPurchaseCostInvalid ? "is-invalid" : ""
className={`form-control ${
formData.isPurchaseCostInvalid ? "is-invalid" : ""
}`}
value={formData.LongTermRental}
name="LongTermRental"
@ -3911,7 +3940,8 @@ const Addproperty = () => {
<div className="col-md-4">
<input
type="text"
className={`form-control ${formData.isFinancingCostClosingCostInvalid
className={`form-control ${
formData.isFinancingCostClosingCostInvalid
? "is-invalid"
: ""
}`}

File diff suppressed because it is too large Load Diff