done
This commit is contained in:
parent
206a9aab09
commit
df7b057580
|
@ -74,9 +74,9 @@ const propertySchema = mongoose.Schema({
|
||||||
type: Date,
|
type: Date,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
renovationRisk:{
|
renovationRisk: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true, // Set to true if this field is mandatory
|
required: true,
|
||||||
},
|
},
|
||||||
purchaseCost: {
|
purchaseCost: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script type="module" crossorigin src="/assets/index-BNrhHLuI.js"></script>
|
<script type="module" crossorigin src="/assets/index-BvZiYelZ.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-iEl-il0E.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-iEl-il0E.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ const Addproperty = () => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const { status, error } = useSelector((state) => state.property);
|
const { status, error } = useSelector((state) => state.property);
|
||||||
const { user } = useSelector((state) => ({ ...state.auth }));
|
const { user } = useSelector((state) => ({ ...state.auth }));
|
||||||
|
const renovationRiskOptions = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; // Array of options
|
||||||
|
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
propertyTaxInfo: [
|
propertyTaxInfo: [
|
||||||
|
@ -29,18 +30,7 @@ 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: [
|
renovationRisk: null,
|
||||||
{ 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: "" },
|
||||||
|
@ -1703,32 +1693,28 @@ Renovation Risk
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div className="col-md-7">
|
<div className="col-md-7">
|
||||||
{formData.renovationRisk.map((option, index) => (
|
{renovationRiskOptions.map((option) => (
|
||||||
<div className="form-check form-check-inline" key={index}>
|
<div className="form-check form-check-inline" key={option}>
|
||||||
<input
|
<input
|
||||||
className="form-check-input"
|
className="form-check-input"
|
||||||
type="radio"
|
type="radio"
|
||||||
name="renovationRisk"
|
name="renovationRisk"
|
||||||
id={`renovationRisk${option.title}`}
|
id={`renovationRisk${option}`}
|
||||||
value={option.title}
|
value={option}
|
||||||
checked={option.selected}
|
checked={formData.renovationRisk === option}
|
||||||
onChange={() => {
|
onChange={(e) => {
|
||||||
const updatedRenovationRisk = formData.renovationRisk.map((risk) =>
|
const value = parseInt(e.target.value, 10);
|
||||||
risk.title === option.title
|
|
||||||
? { ...risk, selected: true }
|
|
||||||
: { ...risk, selected: false }
|
|
||||||
);
|
|
||||||
setFormData({
|
setFormData({
|
||||||
...formData,
|
...formData,
|
||||||
renovationRisk: updatedRenovationRisk,
|
renovationRisk: value,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<label
|
<label
|
||||||
className="form-check-label"
|
className="form-check-label"
|
||||||
htmlFor={`renovationRisk${option.title}`}
|
htmlFor={`renovationRisk${option}`}
|
||||||
>
|
>
|
||||||
{option.title}
|
{option}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
Loading…
Reference in New Issue