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 first_name: string
last_name: string last_name: string
email: string email: string
stationary_mode: boolean
limit_group?: number limit_group?: number
count_groups: number count_groups: number
} }

View File

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