done
This commit is contained in:
parent
6c3f66fd35
commit
206a9aab09
|
@ -74,6 +74,10 @@ const propertySchema = mongoose.Schema({
|
||||||
type: Date,
|
type: Date,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
renovationRisk:{
|
||||||
|
type: Number,
|
||||||
|
required: true, // Set to true if this field is mandatory
|
||||||
|
},
|
||||||
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-BMPA1Ced.js"></script>
|
<script type="module" crossorigin src="/assets/index-BNrhHLuI.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-iEl-il0E.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-iEl-il0E.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,18 @@ const Addproperty = () => {
|
||||||
],
|
],
|
||||||
images: [{ title: "", file: "" }], // Array to hold image objects
|
images: [{ title: "", file: "" }], // Array to hold image objects
|
||||||
googleMapLink: "", // Field for Google Maps link
|
googleMapLink: "", // Field for Google Maps link
|
||||||
|
renovationRisk: [
|
||||||
|
{ title: "1", selected: false },
|
||||||
|
{ title: "2", selected: false },
|
||||||
|
{ title: "3", selected: false },
|
||||||
|
{ title: "4", selected: false },
|
||||||
|
{ title: "5", selected: false },
|
||||||
|
{ title: "6", selected: false },
|
||||||
|
{ title: "7", selected: false },
|
||||||
|
{ title: "8", selected: false },
|
||||||
|
{ title: "9", selected: false },
|
||||||
|
{ title: "10", selected: false },
|
||||||
|
],
|
||||||
purchaseCost: "",
|
purchaseCost: "",
|
||||||
costPaidAtoB: [
|
costPaidAtoB: [
|
||||||
{ title: "Closing Fees - Settlement Fee", price: "" },
|
{ title: "Closing Fees - Settlement Fee", price: "" },
|
||||||
|
@ -586,6 +598,7 @@ const Addproperty = () => {
|
||||||
formData.extwall &&
|
formData.extwall &&
|
||||||
formData.roofing &&
|
formData.roofing &&
|
||||||
formData.totalSqft &&
|
formData.totalSqft &&
|
||||||
|
formData.renovationRisk &&
|
||||||
formData.totalcashsurplus &&
|
formData.totalcashsurplus &&
|
||||||
formData.sellpricebtoc &&
|
formData.sellpricebtoc &&
|
||||||
formData.closeDateAtoB &&
|
formData.closeDateAtoB &&
|
||||||
|
@ -659,6 +672,28 @@ const Addproperty = () => {
|
||||||
}
|
}
|
||||||
}, [status, error, submitted]);
|
}, [status, error, submitted]);
|
||||||
|
|
||||||
|
const [turnTime, setTurnTime] = useState("0 days"); // Store the calculated turn time
|
||||||
|
|
||||||
|
const calculateTurnTime = (closeDateAtoB, closeDateBtoC) => {
|
||||||
|
if (closeDateAtoB && closeDateBtoC) {
|
||||||
|
const dateA = new Date(closeDateAtoB);
|
||||||
|
const dateB = new Date(closeDateBtoC);
|
||||||
|
|
||||||
|
// Calculate difference in time
|
||||||
|
const diffTime = Math.abs(dateB - dateA);
|
||||||
|
|
||||||
|
// Calculate difference in days
|
||||||
|
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
||||||
|
|
||||||
|
// Update state with the calculated turn time
|
||||||
|
// setTurnTime(diffDays);
|
||||||
|
setTurnTime(`${diffDays} days`);
|
||||||
|
} else {
|
||||||
|
setTurnTime("0 days"); // Reset if dates are not available
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="container tabs-wrap">
|
<div className="container tabs-wrap">
|
||||||
|
@ -797,6 +832,7 @@ const Addproperty = () => {
|
||||||
<option value="South Dakota">South Dakota</option>
|
<option value="South Dakota">South Dakota</option>
|
||||||
<option value="Tennessee">Tennessee</option>
|
<option value="Tennessee">Tennessee</option>
|
||||||
<option value="Texas">Texas</option>
|
<option value="Texas">Texas</option>
|
||||||
|
<option value="Texas">Travis</option>
|
||||||
<option value="Utah">Utah</option>
|
<option value="Utah">Utah</option>
|
||||||
<option value="Virginia">Virginia</option>
|
<option value="Virginia">Virginia</option>
|
||||||
<option value="Vermont">Vermont</option>
|
<option value="Vermont">Vermont</option>
|
||||||
|
@ -1347,7 +1383,7 @@ const Addproperty = () => {
|
||||||
</div>
|
</div>
|
||||||
<div className="col-md-2">
|
<div className="col-md-2">
|
||||||
<div className="form-floating mb-2">
|
<div className="form-floating mb-2">
|
||||||
Owed Year
|
Owned Year
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
className="form-control"
|
className="form-control"
|
||||||
|
@ -1555,12 +1591,10 @@ const Addproperty = () => {
|
||||||
borderRadius: "8px",
|
borderRadius: "8px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|
||||||
<div className="row gy-3">
|
<div className="row gy-3">
|
||||||
|
{/* Close Date A to B */}
|
||||||
<div className="col-md-4">
|
<div className="col-md-4">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -1582,6 +1616,7 @@ const Addproperty = () => {
|
||||||
...formData,
|
...formData,
|
||||||
closeDateAtoB: value,
|
closeDateAtoB: value,
|
||||||
});
|
});
|
||||||
|
calculateTurnTime(value, formData.closeDateBtoC);
|
||||||
}}
|
}}
|
||||||
placeholder="Close Date A to B"
|
placeholder="Close Date A to B"
|
||||||
style={{ textAlign: "right" }}
|
style={{ textAlign: "right" }}
|
||||||
|
@ -1593,6 +1628,7 @@ const Addproperty = () => {
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<div className="row gy-3">
|
<div className="row gy-3">
|
||||||
|
{/* Close Date B to C */}
|
||||||
<div className="col-md-4">
|
<div className="col-md-4">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -1615,6 +1651,7 @@ const Addproperty = () => {
|
||||||
...formData,
|
...formData,
|
||||||
closeDateBtoC: value,
|
closeDateBtoC: value,
|
||||||
});
|
});
|
||||||
|
calculateTurnTime(formData.closeDateAtoB, value);
|
||||||
}}
|
}}
|
||||||
placeholder="Close Date B to C"
|
placeholder="Close Date B to C"
|
||||||
style={{ textAlign: "right" }}
|
style={{ textAlign: "right" }}
|
||||||
|
@ -1623,7 +1660,80 @@ const Addproperty = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<div className="row gy-3 align-items-center">
|
||||||
|
<span
|
||||||
|
className="col-md-4"
|
||||||
|
style={{
|
||||||
|
color: "#fda417",
|
||||||
|
fontSize: "14px",
|
||||||
|
fontWeight: "bold",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Turn Time
|
||||||
|
</span>
|
||||||
|
<div className="col-md-4">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
value={turnTime}
|
||||||
|
readOnly
|
||||||
|
style={{
|
||||||
|
borderColor: "#fda417", // Custom border color for the input field
|
||||||
|
color: "#fda417", // Optionally apply text color to the input text
|
||||||
|
textAlign: "right",
|
||||||
|
}}
|
||||||
|
placeholder="Total Costs to Buy A to B"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div className="row gy-3 align-items-center">
|
||||||
|
<span
|
||||||
|
className="col-md-4"
|
||||||
|
style={{
|
||||||
|
color: "#fda417",
|
||||||
|
fontSize: "14px",
|
||||||
|
fontWeight: "bold",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Renovation Risk
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div className="col-md-7">
|
||||||
|
{formData.renovationRisk.map((option, index) => (
|
||||||
|
<div className="form-check form-check-inline" key={index}>
|
||||||
|
<input
|
||||||
|
className="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="renovationRisk"
|
||||||
|
id={`renovationRisk${option.title}`}
|
||||||
|
value={option.title}
|
||||||
|
checked={option.selected}
|
||||||
|
onChange={() => {
|
||||||
|
const updatedRenovationRisk = formData.renovationRisk.map((risk) =>
|
||||||
|
risk.title === option.title
|
||||||
|
? { ...risk, selected: true }
|
||||||
|
: { ...risk, selected: false }
|
||||||
|
);
|
||||||
|
setFormData({
|
||||||
|
...formData,
|
||||||
|
renovationRisk: updatedRenovationRisk,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
className="form-check-label"
|
||||||
|
htmlFor={`renovationRisk${option.title}`}
|
||||||
|
>
|
||||||
|
{option.title}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr
|
<hr
|
||||||
style={{
|
style={{
|
||||||
|
|
Loading…
Reference in New Issue