Update creating term of defences
This commit is contained in:
parent
cd5b7d4dbd
commit
6e90840af5
@ -84,11 +84,14 @@ export const createEvent = ({
|
||||
scheduleId: number
|
||||
project_supervisors: number[]
|
||||
}) => {
|
||||
return axiosInstance.post(`coordinator/enrollments/${scheduleId}/add`, {
|
||||
return axiosInstance.post(
|
||||
`coordinator/enrollments/${scheduleId}/add-term-of-defences/`,
|
||||
{
|
||||
start_date,
|
||||
end_date,
|
||||
project_supervisors,
|
||||
})
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
export const createSchedule = (
|
||||
|
@ -72,8 +72,8 @@ const EditSchedule = ({
|
||||
<form className="w-full flex flex-col " onSubmit={handleSubmit(onSubmit)}>
|
||||
<h3> Termin </h3>
|
||||
<p className="mb-2">
|
||||
{dayjs(eventData.start).format('YYYY-MM-DD HH:mm:ss')} -{' '}
|
||||
{dayjs(eventData.end).format('YYYY-MM-DD HH:mm:ss')}
|
||||
{dayjs(eventData.start).format('YYYY-MM-DD HH:mm')} -{' '}
|
||||
{dayjs(eventData.end).format('HH:mm')}
|
||||
</p>
|
||||
{eventData.resource?.members_of_committee?.length ? (
|
||||
<>
|
||||
|
@ -27,6 +27,8 @@ const customStyles = {
|
||||
bottom: 'auto',
|
||||
marginRight: '-50%',
|
||||
transform: 'translate(-50%, -50%)',
|
||||
width: '400px',
|
||||
height: '400px',
|
||||
},
|
||||
}
|
||||
type SelectValue = {
|
||||
@ -164,20 +166,7 @@ const Schedule = () => {
|
||||
|
||||
const handleSelectSlot = async (event: any) => {
|
||||
setSelectedDate(event)
|
||||
if (view === Views.MONTH) {
|
||||
setIsModalOpen(true)
|
||||
} else {
|
||||
// await mutateCreateEvent({
|
||||
// start_date: DateTime.fromJSDate(event.start).toFormat(
|
||||
// 'YYYY-MM-DD HH:mm:ss',
|
||||
// ),
|
||||
// end_date: DateTime.fromJSDate(event.end).toFormat(
|
||||
// 'YYYY-MM-DD HH:mm:ss',
|
||||
// ),
|
||||
// scheduleId: Number(id),
|
||||
// })
|
||||
// refetch()
|
||||
}
|
||||
}
|
||||
|
||||
const handleSelectEvent = useCallback(
|
||||
@ -200,16 +189,16 @@ const Schedule = () => {
|
||||
const onSubmit = async (data: any) => {
|
||||
// if (selectedDate && view === Views.MONTH) {
|
||||
if (selectedDate) {
|
||||
const from = data.from.split(':')
|
||||
const to = data.to.split(':')
|
||||
const from = dayjs(selectedDate.start).format('HH:mm').split(':')
|
||||
const to = dayjs(selectedDate.end).format('HH:mm').split(':')
|
||||
await mutateCreateEvent({
|
||||
start_date: dayjs(selectedDate.start)
|
||||
.set('hour', from[0])
|
||||
.set('minute', from[1])
|
||||
.set('hour', Number(from[0]))
|
||||
.set('minute', Number(from[1]))
|
||||
.format('YYYY-MM-DD HH:mm:ss'),
|
||||
end_date: dayjs(selectedDate.start)
|
||||
.set('hour', to[0])
|
||||
.set('minute', to[1])
|
||||
end_date: dayjs(selectedDate.end)
|
||||
.set('hour', Number(to[0]))
|
||||
.set('minute', Number(to[1]))
|
||||
.format('YYYY-MM-DD HH:mm:ss'),
|
||||
scheduleId: Number(id),
|
||||
project_supervisors: data?.project_supervisors,
|
||||
@ -264,7 +253,10 @@ const Schedule = () => {
|
||||
return (
|
||||
<div className="flex flex-col">
|
||||
<div>
|
||||
Start zapisów dla studentów: <label htmlFor="end_date">Od </label>
|
||||
Start zapisów dla studentów:{' '}
|
||||
<label className="ml-2" htmlFor="end_date">
|
||||
Od{' '}
|
||||
</label>
|
||||
<DateTimePicker
|
||||
onChange={setStartDate}
|
||||
value={startDate}
|
||||
@ -272,7 +264,9 @@ const Schedule = () => {
|
||||
locale={'pl'}
|
||||
disableClock
|
||||
/>
|
||||
<label htmlFor="end_date">Do </label>
|
||||
<label className="ml-2" htmlFor="end_date">
|
||||
Do{' '}
|
||||
</label>
|
||||
<DateTimePicker
|
||||
onChange={setEndDate}
|
||||
value={endDate}
|
||||
@ -310,7 +304,7 @@ const Schedule = () => {
|
||||
localizer={localizer}
|
||||
startAccessor="start"
|
||||
endAccessor="end"
|
||||
style={{ height: '85vh' }}
|
||||
style={{ height: '85vh', fontSize: '14px' }}
|
||||
selectable
|
||||
onSelectEvent={handleSelectEvent}
|
||||
onSelectSlot={handleSelectSlot}
|
||||
@ -335,24 +329,9 @@ const Schedule = () => {
|
||||
>
|
||||
<h3>Dostępne godziny</h3>
|
||||
<div className="form-control">
|
||||
<label className="label" htmlFor="from">
|
||||
Od
|
||||
</label>
|
||||
<input
|
||||
className="input input-bordered"
|
||||
id="from"
|
||||
type="text"
|
||||
{...register('from', { required: true })}
|
||||
/>
|
||||
<label className="label" htmlFor="to">
|
||||
Do
|
||||
</label>
|
||||
<input
|
||||
className="input input-bordered"
|
||||
id="to"
|
||||
type="text"
|
||||
{...register('to', { required: true })}
|
||||
/>
|
||||
<strong>{dayjs(selectedDate?.start).format('YYYY-MM-DD')}</strong>
|
||||
<p>Od {dayjs(selectedDate?.start).format('HH:mm')}</p>
|
||||
<p>Do {dayjs(selectedDate?.end).format('HH:mm')}</p>
|
||||
<label className="label" htmlFor="project_supervisors">
|
||||
Komisja
|
||||
</label>
|
||||
|
@ -25,7 +25,7 @@ const Enrollment = () => {
|
||||
<div className="flex items-center justify-between">
|
||||
<h2 className="text-xl font-bold">Opiekunowie:</h2>
|
||||
<div className="flex gap-3">
|
||||
<label className="label justify-start gap-2">
|
||||
{/* <label className="label justify-start gap-2">
|
||||
<input
|
||||
type="radio"
|
||||
className="radio radio-xs md:radio-md"
|
||||
@ -42,7 +42,7 @@ const Enrollment = () => {
|
||||
checked={!mode}
|
||||
/>
|
||||
<span className="text-xs md:text-base">Niestacjonarni</span>
|
||||
</label>
|
||||
</label> */}
|
||||
<label className="label">
|
||||
<input
|
||||
type="checkbox"
|
||||
|
@ -51,8 +51,8 @@ const ScheduleAddGroup = ({
|
||||
<div>
|
||||
<form className="w-full flex flex-col " onSubmit={handleSubmit(onSubmit)}>
|
||||
<h3>
|
||||
Termin {dayjs(eventData.start).format('YYYY-MM-DD HH:mm:ss')} -{' '}
|
||||
{dayjs(eventData.end).format('YYYY-MM-DD HH:mm:ss')}
|
||||
Termin {dayjs(eventData.start).format('YYYY-MM-DD HH:mm')} -{' '}
|
||||
{dayjs(eventData.end).format('HH:mm')}
|
||||
</h3>
|
||||
{eventData.resource?.members_of_committee?.length > 0 && (
|
||||
<>
|
||||
|
@ -116,7 +116,7 @@ const SupervisorSchedule = () => {
|
||||
},
|
||||
)
|
||||
const { mutateAsync: mutateAddAvailability } = useMutation(
|
||||
['createEvent'],
|
||||
['addAvailability'],
|
||||
(data: {
|
||||
project_supervisor_id: number
|
||||
start_date: string
|
||||
|
Loading…
Reference in New Issue
Block a user