bug fix - bad merge

This commit is contained in:
patrol16d 2022-12-16 04:09:27 +01:00
parent 14a2fbc755
commit 075e792025
2 changed files with 15 additions and 16 deletions

View File

@ -12,6 +12,7 @@ export interface Leader {
first_name: string
last_name: string
email: string
stationary_mode: boolean
limit_group?: number
count_groups: number
}

View File

@ -7,6 +7,7 @@ import InputError from '../../components/InputError'
const AddLeader = () => {
const [isAlertVisible, setIsAlertVisible] = useState(false)
const [stationaryMode, setStationaryMode] = useState(false)
const {
register,
handleSubmit,
@ -20,6 +21,8 @@ const AddLeader = () => {
'createLeader',
(payload: Leader) => {
delete payload.limit_group
payload.stationary_mode = stationaryMode
console.log(payload)
return createLeader(payload)
},
{
@ -101,28 +104,23 @@ const AddLeader = () => {
<InputError>Email jest wymagany</InputError>
)}
</div>
<div className="form-control">
<label className="label" htmlFor="stationary_mode">
Tryb stacjonarny
<div className="flex">
<label className="label">
<input
type="checkbox"
className="checkbox checkbox-xs md:checkbox-md"
onChange={() => setStationaryMode(!stationaryMode)}
/>
<span className="ml-2 text-xs md:text-base">Tryb stacjonarny</span>
</label>
<input
className="input input-bordered"
id="stationary_mode"
type="checkbox"
{...register('stationary_mode', {
required: true,
})}
/>
{errors.email?.type === 'required' && (
<InputError>Email jest wymagany</InputError>
)}
</div>
<div className="form-control">
{/* <div className="form-control">
<label className="label" htmlFor="limit_group">
Limit grup
</label>
<input
className="input input-bordered"
value="3"
id="limit_group"
type="text"
{...register('limit_group', {
@ -133,7 +131,7 @@ const AddLeader = () => {
{errors.limit_group?.type === 'pattern' && (
<InputError>Limit grup musi być liczbą dodatnią</InputError>
)}
</div>
</div> */}
<button className="btn btn-success mt-4">Dodaj opiekuna</button>
</form>
)