This commit is contained in:
omkieit 2024-10-09 10:26:53 +05:30
parent 206a9aab09
commit df7b057580
5 changed files with 100 additions and 114 deletions

View File

@ -76,7 +76,7 @@ const propertySchema = mongoose.Schema({
},
renovationRisk: {
type: Number,
required: true, // Set to true if this field is mandatory
required: true,
},
purchaseCost: {
type: Number,

File diff suppressed because one or more lines are too long

85
ef-ui/dist/assets/index-BvZiYelZ.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

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

View File

@ -22,6 +22,7 @@ const Addproperty = () => {
const dispatch = useDispatch();
const { status, error } = useSelector((state) => state.property);
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({
propertyTaxInfo: [
@ -29,18 +30,7 @@ const Addproperty = () => {
],
images: [{ title: "", file: "" }], // Array to hold image objects
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 },
],
renovationRisk: null,
purchaseCost: "",
costPaidAtoB: [
{ title: "Closing Fees - Settlement Fee", price: "" },
@ -1703,32 +1693,28 @@ Renovation Risk
</span>
<div className="col-md-7">
{formData.renovationRisk.map((option, index) => (
<div className="form-check form-check-inline" key={index}>
{renovationRiskOptions.map((option) => (
<div className="form-check form-check-inline" key={option}>
<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 }
);
id={`renovationRisk${option}`}
value={option}
checked={formData.renovationRisk === option}
onChange={(e) => {
const value = parseInt(e.target.value, 10);
setFormData({
...formData,
renovationRisk: updatedRenovationRisk,
renovationRisk: value,
});
}}
/>
<label
className="form-check-label"
htmlFor={`renovationRisk${option.title}`}
htmlFor={`renovationRisk${option}`}
>
{option.title}
{option}
</label>
</div>
))}