|
1 | 1 | import React, {useState} from 'react' |
2 | 2 | import { Link, useParams, useNavigate } from "react-router-dom" |
3 | | -import { Form } from "react-bootstrap" |
| 3 | +import { Form, Dropdown } from "react-bootstrap" |
| 4 | +import MultiSelect from "react-bootstrap-multiselect" |
| 5 | +import 'react-bootstrap-multiselect/css/bootstrap-multiselect.css' |
4 | 6 |
|
5 | 7 | import { useEngine, useGetDegree, useIndexExam, usePostDegree, usePatchDegree } from '../modules/engine' |
6 | 8 | import Card from '../components/Card' |
@@ -177,12 +179,58 @@ export function EditDegreePage() { |
177 | 179 | } |
178 | 180 |
|
179 | 181 | function DegreeForm({ mutate, degree, exams }) { |
| 182 | + const options = [ |
| 183 | + { label: 'Mela', value: 'mela' }, |
| 184 | + { label: 'Banana', value: 'banana' }, |
| 185 | + { label: 'Arancia', value: 'arancia' } |
| 186 | + ]; |
| 187 | + |
| 188 | + const handleChange = (selectedOptions) => { |
| 189 | + console.log('Selezionato:', selectedOptions); |
| 190 | + }; |
| 191 | + |
| 192 | + return ( |
| 193 | + <div className="container mt-5"> |
| 194 | + <h3>Frutta preferita</h3> |
| 195 | + <MultiSelect |
| 196 | + multiple |
| 197 | + onChange={handleChange} |
| 198 | + enableFiltering |
| 199 | + includeSelectAllOption |
| 200 | + buttonClass="btn btn-primary" |
| 201 | + > |
| 202 | + {options.map(option => |
| 203 | + <option key={option.value} value={option.value}>{option.label}</option>)} |
| 204 | + </MultiSelect> |
| 205 | + </div> |
| 206 | + ); |
| 207 | + } |
| 208 | + |
| 209 | +function DegreeForm_({mutate,degree,exams}) { |
180 | 210 | const [data, setData] = useState(degree) |
181 | 211 | const [validation, setValidation] = useState<any>({}) |
182 | 212 | const engine = useEngine() |
183 | 213 | const navigate = useNavigate() |
184 | 214 | const current_year = new Date().getFullYear() |
185 | 215 |
|
| 216 | + const [selectedOptions, setSelectedOptions] = useState([]); |
| 217 | + const options = [ |
| 218 | + { value: 'One', selected: true }, |
| 219 | + { value: 'Two' }, |
| 220 | + { value: 'Three' } |
| 221 | + ]; |
| 222 | + |
| 223 | + const handleChange = (selected) => { |
| 224 | + setSelectedOptions(selected); |
| 225 | + }; |
| 226 | + return ( |
| 227 | + <MultiSelect |
| 228 | + onChange={handleChange} |
| 229 | + data={options} |
| 230 | + multiple |
| 231 | + /> |
| 232 | + ); |
| 233 | + |
186 | 234 | return <Card> |
187 | 235 | <Group |
188 | 236 | validationError={validation.name} |
@@ -230,6 +278,23 @@ function DegreeForm({ mutate, degree, exams }) { |
230 | 278 | </Group> |
231 | 279 | <h4>gruppi di esami</h4> |
232 | 280 |
|
| 281 | + <Dropdown> |
| 282 | + <Dropdown.Toggle variant="success" id="dropdown-basic"> |
| 283 | + Select Options |
| 284 | + </Dropdown.Toggle> |
| 285 | + <Dropdown.Menu> |
| 286 | + {["A","B","C"].map((option, index) => ( |
| 287 | + <Dropdown.Item |
| 288 | + key={index} |
| 289 | + onClick={() => {}} |
| 290 | + active={["B"].includes(option)} |
| 291 | + > |
| 292 | + {option} |
| 293 | + </Dropdown.Item> |
| 294 | + ))} |
| 295 | + </Dropdown.Menu> |
| 296 | + </Dropdown> |
| 297 | + |
233 | 298 | <Group |
234 | 299 | validationError={validation.default_group} |
235 | 300 | controlId="default_group" |
|
0 commit comments