merge branch and add student_groups table and change logic of endpoint what use group model
This commit is contained in:
parent
afffc78537
commit
f71c917c61
@ -41,7 +41,7 @@ def create_term_of_defence(examination_schedule_id: int, data: dict) -> dict:
|
|||||||
start_date = data['start_date']
|
start_date = data['start_date']
|
||||||
end_date = data['end_date']
|
end_date = data['end_date']
|
||||||
|
|
||||||
if not (ex.start_date.timestamp() < start_date.timestamp() and ex.end_date.timestamp() > end_date.timestamp()):
|
if not (ex.start_date.timestamp() <= start_date.timestamp() and ex.end_date.timestamp() >= end_date.timestamp()):
|
||||||
abort(400, "Invalid date range!")
|
abort(400, "Invalid date range!")
|
||||||
|
|
||||||
if end_date <= start_date:
|
if end_date <= start_date:
|
||||||
@ -97,8 +97,7 @@ def update_term_of_defence(examination_schedule_id: int, term_of_defence_id: int
|
|||||||
|
|
||||||
start_date = data['start_date']
|
start_date = data['start_date']
|
||||||
end_date = data['end_date']
|
end_date = data['end_date']
|
||||||
|
if not (ex.start_date.timestamp() <= start_date.timestamp() and ex.end_date.timestamp() >= end_date.timestamp()):
|
||||||
if not (ex.start_date.timestamp() < start_date.timestamp() and ex.end_date.timestamp() > end_date.timestamp()):
|
|
||||||
abort(400, "Invalid date range!")
|
abort(400, "Invalid date range!")
|
||||||
|
|
||||||
if end_date <= start_date:
|
if end_date <= start_date:
|
||||||
|
@ -62,10 +62,11 @@ def create_group(year_group_id: int, data: dict) -> dict:
|
|||||||
|
|
||||||
group = Group(name=name, project_supervisor_id=project_supervisor_id, year_group_id=year_group_id)
|
group = Group(name=name, project_supervisor_id=project_supervisor_id, year_group_id=year_group_id)
|
||||||
|
|
||||||
students_without_groups = db.session.query(Student).join(Group, isouter=True) \
|
students_without_groups = db.session.query(Student, Group). \
|
||||||
.filter(Group.id.is_(None)).filter(Student.index.in_(students_indexes)).count()
|
join(Group, Student.groups). \
|
||||||
|
filter(Group.year_group_id == year_group_id). \
|
||||||
if students_without_groups != len(students_indexes):
|
filter(db.or_(*[Student.index == idx for idx in students_indexes])).all()
|
||||||
|
if len(students_without_groups) > 0:
|
||||||
abort(400, "One or more students have already belonged to group!")
|
abort(400, "One or more students have already belonged to group!")
|
||||||
|
|
||||||
db.session.add(group)
|
db.session.add(group)
|
||||||
@ -73,8 +74,7 @@ def create_group(year_group_id: int, data: dict) -> dict:
|
|||||||
|
|
||||||
students = db.session.query(Student).filter(Student.index.in_(students_indexes)).all()
|
students = db.session.query(Student).filter(Student.index.in_(students_indexes)).all()
|
||||||
for student in students:
|
for student in students:
|
||||||
student.group_id = group.id
|
group.students.append(student)
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
return {"message": "Group was created!"}
|
return {"message": "Group was created!"}
|
||||||
@ -96,10 +96,7 @@ def delete_group(id: int) -> dict:
|
|||||||
if group is None:
|
if group is None:
|
||||||
abort(400, f"Group with id {id} doesn't exist!")
|
abort(400, f"Group with id {id} doesn't exist!")
|
||||||
|
|
||||||
students = db.session.query(Student).filter_by(group_id=id).all()
|
group.students = []
|
||||||
for student in students:
|
|
||||||
student.group_id = None
|
|
||||||
|
|
||||||
db.session.delete(group)
|
db.session.delete(group)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return {"message": "Group was deleted!"}
|
return {"message": "Group was deleted!"}
|
||||||
|
@ -92,7 +92,7 @@ def delete_project_supervisor(id: int) -> dict:
|
|||||||
filter(ProjectSupervisor.id == id).group_by(ProjectSupervisor.id)
|
filter(ProjectSupervisor.id == id).group_by(ProjectSupervisor.id)
|
||||||
|
|
||||||
if count_groups is not None:
|
if count_groups is not None:
|
||||||
abort(400, f"Project Supervisor with id {id} has groups!")
|
abort(400, "Project Supervisor has at least one group!")
|
||||||
|
|
||||||
db.session.delete(project_supervisor)
|
db.session.delete(project_supervisor)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
@ -147,7 +147,6 @@ def add_project_supervisor_to_year_group(id: int, year_group_id: int, data: dict
|
|||||||
|
|
||||||
|
|
||||||
@bp.delete("/<int:id>/year-group/<int:year_group_id>")
|
@bp.delete("/<int:id>/year-group/<int:year_group_id>")
|
||||||
@bp.input(ProjectSupervisorYearGroupSchema)
|
|
||||||
@bp.output(MessageSchema)
|
@bp.output(MessageSchema)
|
||||||
def delete_project_supervisor_to_year_group(id: int, year_group_id: int) -> dict:
|
def delete_project_supervisor_to_year_group(id: int, year_group_id: int) -> dict:
|
||||||
project_supervisor = ProjectSupervisor.query.filter(ProjectSupervisor.id == id). \
|
project_supervisor = ProjectSupervisor.query.filter(ProjectSupervisor.id == id). \
|
||||||
|
@ -40,7 +40,7 @@ def list_students(year_group_id: int, query: dict) -> dict:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@bp.get("/<int:index>/")
|
@bp.get("/<int:index>/detail/")
|
||||||
@bp.output(StudentSchema)
|
@bp.output(StudentSchema)
|
||||||
def detail_student(index: int) -> Student:
|
def detail_student(index: int) -> Student:
|
||||||
student = Student.query.filter_by(index=index).first()
|
student = Student.query.filter_by(index=index).first()
|
||||||
@ -86,10 +86,10 @@ def create_student(data: dict) -> dict:
|
|||||||
index = data['index']
|
index = data['index']
|
||||||
yg_id = data['year_group_id']
|
yg_id = data['year_group_id']
|
||||||
del data['year_group_id']
|
del data['year_group_id']
|
||||||
student = Student.query.filter_by(index=index).first()
|
|
||||||
if student is not None:
|
|
||||||
abort(400, "Student has already exists!")
|
|
||||||
|
|
||||||
|
student = Student.query.filter_by(index=index).join(Student.year_groups).first()
|
||||||
|
if student is None:
|
||||||
|
# abort(400, "Student has already exists!")
|
||||||
dummy_email = f'student{randint(1, 300_000)}@gmail.com'
|
dummy_email = f'student{randint(1, 300_000)}@gmail.com'
|
||||||
student = Student(**data, email=dummy_email)
|
student = Student(**data, email=dummy_email)
|
||||||
db.session.add(student)
|
db.session.add(student)
|
||||||
@ -98,6 +98,8 @@ def create_student(data: dict) -> dict:
|
|||||||
year_group = YearGroup.query.filter(YearGroup.id == yg_id).first()
|
year_group = YearGroup.query.filter(YearGroup.id == yg_id).first()
|
||||||
if year_group is None:
|
if year_group is None:
|
||||||
abort(400, "Year group doesn't exist!")
|
abort(400, "Year group doesn't exist!")
|
||||||
|
if any((year_group.id == yg.id for yg in student.year_groups)):
|
||||||
|
abort(400, "You are assigned to this year group!")
|
||||||
ygs = YearGroupStudents(student_index=student.index, year_group_id=year_group.id)
|
ygs = YearGroupStudents(student_index=student.index, year_group_id=year_group.id)
|
||||||
db.session.add(ygs)
|
db.session.add(ygs)
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@ bp = APIBlueprint("year_group", __name__, url_prefix="/year-group")
|
|||||||
@bp.output(MessageSchema, status_code=200)
|
@bp.output(MessageSchema, status_code=200)
|
||||||
def create_year_group(data: dict) -> dict:
|
def create_year_group(data: dict) -> dict:
|
||||||
name = data['name']
|
name = data['name']
|
||||||
year_group = YearGroup.query.filter(YearGroup.name == name).first()
|
mode = data['mode']
|
||||||
|
year_group = YearGroup.query.filter(YearGroup.name == name, YearGroup.mode == mode).first()
|
||||||
if year_group is not None:
|
if year_group is not None:
|
||||||
abort(400, "Year group has already exists!")
|
abort(400, "Year group has already exists!")
|
||||||
|
|
||||||
@ -54,6 +55,12 @@ def update_year_of_group(id: int, data: dict) -> dict:
|
|||||||
if year_group is None:
|
if year_group is None:
|
||||||
abort(404, 'Not found year group!')
|
abort(404, 'Not found year group!')
|
||||||
|
|
||||||
|
name = data['name']
|
||||||
|
mode = data['mode']
|
||||||
|
year_group = YearGroup.query.filter(YearGroup.name == name, YearGroup.mode == mode, YearGroup.id != id).first()
|
||||||
|
if year_group is not None:
|
||||||
|
abort(400, "Year group has already exists!")
|
||||||
|
|
||||||
year_group_query.update(data)
|
year_group_query.update(data)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class ProjectSupervisorCreateSchema(Schema):
|
|||||||
class ProjectSupervisorEditSchema(Schema):
|
class ProjectSupervisorEditSchema(Schema):
|
||||||
first_name = fields.Str(validate=validate.Length(min=1, max=255), required=True)
|
first_name = fields.Str(validate=validate.Length(min=1, max=255), required=True)
|
||||||
last_name = fields.Str(validate=validate.Length(min=1, max=255), required=True)
|
last_name = fields.Str(validate=validate.Length(min=1, max=255), required=True)
|
||||||
email = fields.Str(validate=validate.Length(min=0, max=11), required=True)
|
email = fields.Str(validate=validate.Length(min=0, max=255), required=True)
|
||||||
|
|
||||||
|
|
||||||
class ProjectSupervisorYearGroupSchema(Schema):
|
class ProjectSupervisorYearGroupSchema(Schema):
|
||||||
|
@ -20,7 +20,7 @@ class GroupSchema(ma.SQLAlchemyAutoSchema):
|
|||||||
|
|
||||||
|
|
||||||
class StudentSchema(ma.SQLAlchemyAutoSchema):
|
class StudentSchema(ma.SQLAlchemyAutoSchema):
|
||||||
group = fields.Nested(GroupSchema)
|
groups = fields.List(fields.Nested(GroupSchema))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Student
|
model = Student
|
||||||
|
@ -6,7 +6,7 @@ class ExaminationSchedule(Base):
|
|||||||
__tablename__ = 'examination_schedules'
|
__tablename__ = 'examination_schedules'
|
||||||
|
|
||||||
title = db.Column(db.String(100), unique=True, nullable=False)
|
title = db.Column(db.String(100), unique=True, nullable=False)
|
||||||
duration_time = db.Column(db.Integer) # in minutes
|
duration_time = db.Column(db.Integer, nullable=False) # in minutes
|
||||||
start_date_for_enrollment_students = db.Column(db.DateTime)
|
start_date_for_enrollment_students = db.Column(db.DateTime)
|
||||||
end_date_for_enrollment_students = db.Column(db.DateTime)
|
end_date_for_enrollment_students = db.Column(db.DateTime)
|
||||||
start_date = db.Column(db.DateTime, nullable=False)
|
start_date = db.Column(db.DateTime, nullable=False)
|
||||||
|
@ -18,11 +18,20 @@ class YearGroupStudents(Base):
|
|||||||
class YearGroup(Base):
|
class YearGroup(Base):
|
||||||
__tablename__ = 'year_groups'
|
__tablename__ = 'year_groups'
|
||||||
|
|
||||||
name = db.Column(db.String(50), unique=True, nullable=False)
|
name = db.Column(db.String(50), nullable=False)
|
||||||
mode = db.Column(db.String(1), unique=True, nullable=False)
|
mode = db.Column(db.String(1), nullable=False)
|
||||||
created_at = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
created_at = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
||||||
students = db.relationship("YearGroupStudents")
|
students = db.relationship("YearGroupStudents")
|
||||||
|
|
||||||
|
__table__args = (
|
||||||
|
db.UniqueConstraint('name', 'mode', name='uc_name_mode_year_group')
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
students_groups = db.Table('students_groups',
|
||||||
|
db.Column('group_id', db.ForeignKey('groups.id'), nullable=False),
|
||||||
|
db.Column('student_index', db.ForeignKey('students.index'), nullable=False))
|
||||||
|
|
||||||
|
|
||||||
class Group(Base):
|
class Group(Base):
|
||||||
__tablename__ = "groups"
|
__tablename__ = "groups"
|
||||||
@ -37,6 +46,7 @@ class Group(Base):
|
|||||||
year_group = db.relationship('YearGroup', backref='groups', lazy=True)
|
year_group = db.relationship('YearGroup', backref='groups', lazy=True)
|
||||||
points_for_first_term = db.Column(db.Integer, default=0, nullable=False)
|
points_for_first_term = db.Column(db.Integer, default=0, nullable=False)
|
||||||
points_for_second_term = db.Column(db.Integer, default=0, nullable=False)
|
points_for_second_term = db.Column(db.Integer, default=0, nullable=False)
|
||||||
|
students = db.relationship('Student', secondary=students_groups, back_populates='groups')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def search_by_name(cls, year_group_id: int, search_name: str = None) -> BaseQuery:
|
def search_by_name(cls, year_group_id: int, search_name: str = None) -> BaseQuery:
|
||||||
@ -53,8 +63,7 @@ class Student(Person):
|
|||||||
|
|
||||||
pesel = db.Column(db.String(11), default='')
|
pesel = db.Column(db.String(11), default='')
|
||||||
index = db.Column(db.Integer, primary_key=True)
|
index = db.Column(db.Integer, primary_key=True)
|
||||||
group_id = db.Column(db.Integer, db.ForeignKey('groups.id'))
|
groups = db.relationship('Group', secondary=students_groups, back_populates='students')
|
||||||
groups = db.relationship('Group', backref='students', lazy=True)
|
|
||||||
year_groups = db.relationship("YearGroupStudents")
|
year_groups = db.relationship("YearGroupStudents")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -24,27 +24,27 @@ def assign_your_group_to_term_of_defence(examination_schedule_id: int, term_of_d
|
|||||||
################
|
################
|
||||||
term_of_defence = TermOfDefence.query.filter(TermOfDefence.id == term_of_defence_id,
|
term_of_defence = TermOfDefence.query.filter(TermOfDefence.id == term_of_defence_id,
|
||||||
TermOfDefence.examination_schedule_id == examination_schedule_id).first()
|
TermOfDefence.examination_schedule_id == examination_schedule_id).first()
|
||||||
|
ex = term_of_defence.examination_schedule
|
||||||
if term_of_defence is None:
|
if term_of_defence is None or ex is None:
|
||||||
abort(400, "Term of defence not found!")
|
abort(400, "Term of defence not found!")
|
||||||
|
|
||||||
st = Student.query.join(Group).join(ProjectSupervisor).filter(Student.index == student.index).first()
|
g = Group.query.join(ProjectSupervisor).filter(Group.year_group_id == examination_schedule_id). \
|
||||||
if st is None or st.groups.project_supervisor is None:
|
join(Group.students).filter_by(index=student.index).first()
|
||||||
|
if g is None or g.project_supervisor is None:
|
||||||
abort(400, "You don't have a group or your group doesn't have an assigned project supervisor!")
|
abort(400, "You don't have a group or your group doesn't have an assigned project supervisor!")
|
||||||
|
|
||||||
defence = TermOfDefence.query.filter(TermOfDefence.group_id == st.groups.id,
|
defence = TermOfDefence.query.filter(TermOfDefence.group_id == g.id,
|
||||||
TermOfDefence.examination_schedule_id == examination_schedule_id).first()
|
TermOfDefence.examination_schedule_id == examination_schedule_id).first()
|
||||||
if defence is not None:
|
if defence is not None:
|
||||||
abort(400, "Your group has already assigned to any exam date!")
|
abort(400, "Your group has already assigned to any exam date!")
|
||||||
|
|
||||||
g = Group.query.filter(Group.id == st.group_id).first()
|
|
||||||
td = TermOfDefence.query.join(TermOfDefence.members_of_committee). \
|
td = TermOfDefence.query.join(TermOfDefence.members_of_committee). \
|
||||||
filter_by(id=g.project_supervisor_id).first()
|
filter_by(id=g.project_supervisor_id).first()
|
||||||
|
|
||||||
if td is None:
|
if td is None:
|
||||||
abort(400, "Your project supervisor is not in committee!")
|
abort(400, "Your project supervisor is not in committee!")
|
||||||
|
|
||||||
term_of_defence.group_id = st.groups.id
|
term_of_defence.group_id = g.id
|
||||||
db.session.add(term_of_defence)
|
db.session.add(term_of_defence)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return {"message": "You have just assigned the group for this exam date!"}
|
return {"message": "You have just assigned the group for this exam date!"}
|
||||||
@ -60,13 +60,16 @@ def delete_your_group_from_term_of_defence(examination_schedule_id: int, term_of
|
|||||||
abort(404, "Student doesn't exist!")
|
abort(404, "Student doesn't exist!")
|
||||||
################
|
################
|
||||||
|
|
||||||
term_of_defence = TermOfDefence.query.filter(TermOfDefence.id == term_of_defence_id). \
|
term_of_defence = TermOfDefence.query.join(ExaminationSchedule).filter(TermOfDefence.id == term_of_defence_id). \
|
||||||
filter(TermOfDefence.examination_schedule_id == examination_schedule_id).first()
|
filter(TermOfDefence.examination_schedule_id == examination_schedule_id).first()
|
||||||
|
|
||||||
|
ex = term_of_defence.examination_schedule
|
||||||
if term_of_defence is None:
|
if term_of_defence is None:
|
||||||
abort(404, "Term of defence doesn't exist!")
|
abort(404, "Term of defence doesn't exist!")
|
||||||
|
|
||||||
if student.groups.id != term_of_defence.group_id:
|
group = Group.query.filter(Group.year_group_id == ex.year_group_id). \
|
||||||
|
join(Group.students).filter_by(index=student.index).first()
|
||||||
|
if group.id != term_of_defence.group_id:
|
||||||
abort(400, "You are not assigned to this group!")
|
abort(400, "You are not assigned to this group!")
|
||||||
|
|
||||||
term_of_defence.group_id = None
|
term_of_defence.group_id = None
|
||||||
|
@ -37,10 +37,17 @@ class ExaminationScheduleListSchema(Schema):
|
|||||||
examination_schedules = fields.List(fields.Nested(ExaminationScheduleSchema))
|
examination_schedules = fields.List(fields.Nested(ExaminationScheduleSchema))
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectSupervisorCommitteeSchema(Schema):
|
||||||
|
id = fields.Integer()
|
||||||
|
first_name = fields.Str()
|
||||||
|
last_name = fields.Str()
|
||||||
|
|
||||||
|
|
||||||
class TermOfDefenceStudentItemSchema(Schema):
|
class TermOfDefenceStudentItemSchema(Schema):
|
||||||
id = fields.Integer()
|
id = fields.Integer()
|
||||||
start_date = fields.DateTime()
|
start_date = fields.DateTime()
|
||||||
end_date = fields.DateTime()
|
end_date = fields.DateTime()
|
||||||
|
members_of_committee = fields.List(fields.Nested(ProjectSupervisorCommitteeSchema))
|
||||||
|
|
||||||
|
|
||||||
class TermOfDefenceStudentListSchema(Schema):
|
class TermOfDefenceStudentListSchema(Schema):
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
"""empty message
|
|
||||||
|
|
||||||
Revision ID: 5c3c4c4e1a72
|
|
||||||
Revises: a96f91e5b556
|
|
||||||
Create Date: 2022-11-12 11:48:38.377516
|
|
||||||
|
|
||||||
"""
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision = '5c3c4c4e1a72'
|
|
||||||
down_revision = 'a96f91e5b556'
|
|
||||||
branch_labels = None
|
|
||||||
depends_on = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.add_column('examination_schedules', sa.Column('duration_time', sa.Integer(), nullable=True))
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.drop_column('examination_schedules', 'duration_time')
|
|
||||||
# ### end Alembic commands ###
|
|
@ -1,8 +1,8 @@
|
|||||||
"""empty message
|
"""empty message
|
||||||
|
|
||||||
Revision ID: a96f91e5b556
|
Revision ID: 7deb011753b2
|
||||||
Revises:
|
Revises:
|
||||||
Create Date: 2022-11-12 11:34:01.223667
|
Create Date: 2022-11-16 22:48:36.220156
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from alembic import op
|
from alembic import op
|
||||||
@ -10,7 +10,7 @@ import sqlalchemy as sa
|
|||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = 'a96f91e5b556'
|
revision = '7deb011753b2'
|
||||||
down_revision = None
|
down_revision = None
|
||||||
branch_labels = None
|
branch_labels = None
|
||||||
depends_on = None
|
depends_on = None
|
||||||
@ -28,23 +28,33 @@ def upgrade():
|
|||||||
)
|
)
|
||||||
op.create_index(op.f('ix_project_supervisors_first_name'), 'project_supervisors', ['first_name'], unique=False)
|
op.create_index(op.f('ix_project_supervisors_first_name'), 'project_supervisors', ['first_name'], unique=False)
|
||||||
op.create_index(op.f('ix_project_supervisors_last_name'), 'project_supervisors', ['last_name'], unique=False)
|
op.create_index(op.f('ix_project_supervisors_last_name'), 'project_supervisors', ['last_name'], unique=False)
|
||||||
|
op.create_table('students',
|
||||||
|
sa.Column('first_name', sa.String(length=255), nullable=False),
|
||||||
|
sa.Column('last_name', sa.String(length=255), nullable=False),
|
||||||
|
sa.Column('email', sa.String(length=120), nullable=True),
|
||||||
|
sa.Column('pesel', sa.String(length=11), nullable=True),
|
||||||
|
sa.Column('index', sa.Integer(), nullable=False),
|
||||||
|
sa.PrimaryKeyConstraint('index'),
|
||||||
|
sa.UniqueConstraint('email')
|
||||||
|
)
|
||||||
|
op.create_index(op.f('ix_students_first_name'), 'students', ['first_name'], unique=False)
|
||||||
|
op.create_index(op.f('ix_students_last_name'), 'students', ['last_name'], unique=False)
|
||||||
op.create_table('year_groups',
|
op.create_table('year_groups',
|
||||||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
||||||
sa.Column('name', sa.String(length=50), nullable=False),
|
sa.Column('name', sa.String(length=50), nullable=False),
|
||||||
sa.Column('mode', sa.String(length=1), nullable=False),
|
sa.Column('mode', sa.String(length=1), nullable=False),
|
||||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||||
sa.PrimaryKeyConstraint('id'),
|
sa.PrimaryKeyConstraint('id')
|
||||||
sa.UniqueConstraint('mode'),
|
|
||||||
sa.UniqueConstraint('name')
|
|
||||||
)
|
)
|
||||||
op.create_table('examination_schedules',
|
op.create_table('examination_schedules',
|
||||||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
||||||
sa.Column('title', sa.String(length=100), nullable=False),
|
sa.Column('title', sa.String(length=100), nullable=False),
|
||||||
sa.Column('year_group_id', sa.Integer(), nullable=False),
|
sa.Column('duration_time', sa.Integer(), nullable=False),
|
||||||
sa.Column('start_date_for_enrollment_students', sa.DateTime(), nullable=True),
|
sa.Column('start_date_for_enrollment_students', sa.DateTime(), nullable=True),
|
||||||
sa.Column('end_date_for_enrollment_students', sa.DateTime(), nullable=True),
|
sa.Column('end_date_for_enrollment_students', sa.DateTime(), nullable=True),
|
||||||
sa.Column('start_date', sa.DateTime(), nullable=False),
|
sa.Column('start_date', sa.DateTime(), nullable=False),
|
||||||
sa.Column('end_date', sa.DateTime(), nullable=False),
|
sa.Column('end_date', sa.DateTime(), nullable=False),
|
||||||
|
sa.Column('year_group_id', sa.Integer(), nullable=False),
|
||||||
sa.ForeignKeyConstraint(['year_group_id'], ['year_groups.id'], ),
|
sa.ForeignKeyConstraint(['year_group_id'], ['year_groups.id'], ),
|
||||||
sa.PrimaryKeyConstraint('id'),
|
sa.PrimaryKeyConstraint('id'),
|
||||||
sa.UniqueConstraint('title')
|
sa.UniqueConstraint('title')
|
||||||
@ -72,19 +82,20 @@ def upgrade():
|
|||||||
sa.ForeignKeyConstraint(['year_group_id'], ['year_groups.id'], ),
|
sa.ForeignKeyConstraint(['year_group_id'], ['year_groups.id'], ),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
op.create_table('students',
|
op.create_table('year_group_students',
|
||||||
sa.Column('first_name', sa.String(length=255), nullable=False),
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
||||||
sa.Column('last_name', sa.String(length=255), nullable=False),
|
sa.Column('year_group_id', sa.Integer(), nullable=True),
|
||||||
sa.Column('email', sa.String(length=120), nullable=True),
|
sa.Column('student_index', sa.Integer(), nullable=True),
|
||||||
sa.Column('pesel', sa.String(length=11), nullable=True),
|
sa.ForeignKeyConstraint(['student_index'], ['students.index'], ondelete='CASCADE'),
|
||||||
sa.Column('index', sa.Integer(), nullable=False),
|
sa.ForeignKeyConstraint(['year_group_id'], ['year_groups.id'], ondelete='CASCADE'),
|
||||||
sa.Column('group_id', sa.Integer(), nullable=True),
|
sa.PrimaryKeyConstraint('id')
|
||||||
sa.ForeignKeyConstraint(['group_id'], ['groups.id'], ),
|
)
|
||||||
sa.PrimaryKeyConstraint('index'),
|
op.create_table('students_groups',
|
||||||
sa.UniqueConstraint('email')
|
sa.Column('group_id', sa.Integer(), nullable=False),
|
||||||
|
sa.Column('student_index', sa.Integer(), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['group_id'], ['groups.id'], ),
|
||||||
|
sa.ForeignKeyConstraint(['student_index'], ['students.index'], )
|
||||||
)
|
)
|
||||||
op.create_index(op.f('ix_students_first_name'), 'students', ['first_name'], unique=False)
|
|
||||||
op.create_index(op.f('ix_students_last_name'), 'students', ['last_name'], unique=False)
|
|
||||||
op.create_table('temporary_availabilities',
|
op.create_table('temporary_availabilities',
|
||||||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
||||||
sa.Column('start_date', sa.DateTime(), nullable=False),
|
sa.Column('start_date', sa.DateTime(), nullable=False),
|
||||||
@ -111,30 +122,23 @@ def upgrade():
|
|||||||
sa.ForeignKeyConstraint(['project_supervisor_id'], ['project_supervisors.id'], ),
|
sa.ForeignKeyConstraint(['project_supervisor_id'], ['project_supervisors.id'], ),
|
||||||
sa.ForeignKeyConstraint(['term_of_defence_id'], ['term_of_defences.id'], )
|
sa.ForeignKeyConstraint(['term_of_defence_id'], ['term_of_defences.id'], )
|
||||||
)
|
)
|
||||||
op.create_table('year_group_students',
|
|
||||||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
|
||||||
sa.Column('year_group_id', sa.Integer(), nullable=True),
|
|
||||||
sa.Column('student_index', sa.Integer(), nullable=True),
|
|
||||||
sa.ForeignKeyConstraint(['student_index'], ['students.index'], ondelete='CASCADE'),
|
|
||||||
sa.ForeignKeyConstraint(['year_group_id'], ['year_groups.id'], ondelete='CASCADE'),
|
|
||||||
sa.PrimaryKeyConstraint('id')
|
|
||||||
)
|
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
op.drop_table('year_group_students')
|
|
||||||
op.drop_table('committees')
|
op.drop_table('committees')
|
||||||
op.drop_table('term_of_defences')
|
op.drop_table('term_of_defences')
|
||||||
op.drop_table('temporary_availabilities')
|
op.drop_table('temporary_availabilities')
|
||||||
op.drop_index(op.f('ix_students_last_name'), table_name='students')
|
op.drop_table('students_groups')
|
||||||
op.drop_index(op.f('ix_students_first_name'), table_name='students')
|
op.drop_table('year_group_students')
|
||||||
op.drop_table('students')
|
|
||||||
op.drop_table('year_group_project_supervisors')
|
op.drop_table('year_group_project_supervisors')
|
||||||
op.drop_table('groups')
|
op.drop_table('groups')
|
||||||
op.drop_table('examination_schedules')
|
op.drop_table('examination_schedules')
|
||||||
op.drop_table('year_groups')
|
op.drop_table('year_groups')
|
||||||
|
op.drop_index(op.f('ix_students_last_name'), table_name='students')
|
||||||
|
op.drop_index(op.f('ix_students_first_name'), table_name='students')
|
||||||
|
op.drop_table('students')
|
||||||
op.drop_index(op.f('ix_project_supervisors_last_name'), table_name='project_supervisors')
|
op.drop_index(op.f('ix_project_supervisors_last_name'), table_name='project_supervisors')
|
||||||
op.drop_index(op.f('ix_project_supervisors_first_name'), table_name='project_supervisors')
|
op.drop_index(op.f('ix_project_supervisors_first_name'), table_name='project_supervisors')
|
||||||
op.drop_table('project_supervisors')
|
op.drop_table('project_supervisors')
|
1
frontend/.env.example
Normal file
1
frontend/.env.example
Normal file
@ -0,0 +1 @@
|
|||||||
|
REACT_APP_BASE_URL=http://localhost:5000/api/
|
2
frontend/.gitignore
vendored
2
frontend/.gitignore
vendored
@ -21,3 +21,5 @@
|
|||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
|
||||||
|
.env
|
212
frontend/package-lock.json
generated
212
frontend/package-lock.json
generated
@ -21,6 +21,7 @@
|
|||||||
"luxon": "^3.0.4",
|
"luxon": "^3.0.4",
|
||||||
"react": "^18.1.0",
|
"react": "^18.1.0",
|
||||||
"react-big-calendar": "^1.5.0",
|
"react-big-calendar": "^1.5.0",
|
||||||
|
"react-date-picker": "^9.1.0",
|
||||||
"react-dom": "^18.1.0",
|
"react-dom": "^18.1.0",
|
||||||
"react-hook-form": "^7.31.3",
|
"react-hook-form": "^7.31.3",
|
||||||
"react-modal": "^3.16.1",
|
"react-modal": "^3.16.1",
|
||||||
@ -29,6 +30,7 @@
|
|||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"react-select": "^5.3.2",
|
"react-select": "^5.3.2",
|
||||||
"typescript": "^4.6.4",
|
"typescript": "^4.6.4",
|
||||||
|
"use-local-storage-state": "^18.1.1",
|
||||||
"web-vitals": "^2.1.4"
|
"web-vitals": "^2.1.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -3887,6 +3889,14 @@
|
|||||||
"@types/react": "*"
|
"@types/react": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/react-calendar": {
|
||||||
|
"version": "3.9.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/react-calendar/-/react-calendar-3.9.0.tgz",
|
||||||
|
"integrity": "sha512-KpAu1MKAGFw5hNwlDnWsHWqI9i/igAB+8jH97YV7QpC2v7rlwNEU5i6VMFb73lGRacuejM/Zd2LklnEzkFV3XA==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/react": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/react-dom": {
|
"node_modules/@types/react-dom": {
|
||||||
"version": "18.0.4",
|
"version": "18.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.4.tgz",
|
||||||
@ -4344,6 +4354,14 @@
|
|||||||
"@xtuc/long": "4.2.2"
|
"@xtuc/long": "4.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@wojtekmaj/date-utils": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@wojtekmaj/date-utils/-/date-utils-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-1VPkkTBk07gMR1fjpBtse4G+oJqpmE+0gUFB0dg3VIL7qJmUVaBoD/vlzMm/jNeOPfvlmerl1lpnsZyBUFIRuw==",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/wojtekmaj/date-utils?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@xtuc/ieee754": {
|
"node_modules/@xtuc/ieee754": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
|
||||||
@ -6411,6 +6429,11 @@
|
|||||||
"npm": "1.2.8000 || >= 1.4.16"
|
"npm": "1.2.8000 || >= 1.4.16"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/detect-element-overflow": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/detect-element-overflow/-/detect-element-overflow-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-Jtr9ivYPhpd9OJux+hjL0QjUKiS1Ghgy8tvIufUjFslQgIWvgGr4mn57H190APbKkiOmXnmtMI6ytaKzMusecg=="
|
||||||
|
},
|
||||||
"node_modules/detect-newline": {
|
"node_modules/detect-newline": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz",
|
||||||
@ -8261,6 +8284,17 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/get-user-locale": {
|
||||||
|
"version": "1.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-user-locale/-/get-user-locale-1.5.1.tgz",
|
||||||
|
"integrity": "sha512-WiNpoFRcHn1qxP9VabQljzGwkAQDrcpqUtaP0rNBEkFxJdh4f3tik6MfZsMYZc+UgQJdGCxWEjL9wnCUlRQXag==",
|
||||||
|
"dependencies": {
|
||||||
|
"lodash.memoize": "^4.1.1"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/wojtekmaj/get-user-locale?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/glob": {
|
"node_modules/glob": {
|
||||||
"version": "7.2.3",
|
"version": "7.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
||||||
@ -11577,6 +11611,14 @@
|
|||||||
"semver": "bin/semver.js"
|
"semver": "bin/semver.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/make-event-props": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/make-event-props/-/make-event-props-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-oWiDZMcVB1/A487251hEWza1xzgCzl6MXxe9aF24l5Bt9N9UEbqTqKumEfuuLhmlhRZYnc+suVvW4vUs8bwO7Q==",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/wojtekmaj/make-event-props?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/makeerror": {
|
"node_modules/makeerror": {
|
||||||
"version": "1.0.12",
|
"version": "1.0.12",
|
||||||
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz",
|
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz",
|
||||||
@ -13854,6 +13896,47 @@
|
|||||||
"resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz",
|
||||||
"integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw=="
|
"integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw=="
|
||||||
},
|
},
|
||||||
|
"node_modules/react-calendar": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-calendar/-/react-calendar-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-y9Q5Oo3Mq869KExbOCP3aJ3hEnRZKZ0TqUa9QU1wJGgDZFrW1qTaWp5v52oZpmxTTrpAMTUcUGaC0QJcO1f8Nw==",
|
||||||
|
"dependencies": {
|
||||||
|
"@wojtekmaj/date-utils": "^1.0.2",
|
||||||
|
"clsx": "^1.2.1",
|
||||||
|
"get-user-locale": "^1.2.0",
|
||||||
|
"prop-types": "^15.6.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/wojtekmaj/react-calendar?sponsor=1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
||||||
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/react-date-picker": {
|
||||||
|
"version": "9.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-date-picker/-/react-date-picker-9.1.0.tgz",
|
||||||
|
"integrity": "sha512-wj9SoOhEgQTzJsDRLePpNzUDNrcSiCpj1TFSwiAnLlOuJvvkk10I9rdvIyHmeJg/G17hyP5wSwTppCZHqOTHhA==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/react-calendar": "^3.0.0",
|
||||||
|
"@wojtekmaj/date-utils": "^1.0.3",
|
||||||
|
"clsx": "^1.2.1",
|
||||||
|
"get-user-locale": "^1.2.0",
|
||||||
|
"make-event-props": "^1.1.0",
|
||||||
|
"prop-types": "^15.6.0",
|
||||||
|
"react-calendar": "^4.0.0",
|
||||||
|
"react-fit": "^1.4.0",
|
||||||
|
"update-input-width": "^1.2.2"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/wojtekmaj/react-date-picker?sponsor=1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
||||||
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-dev-utils": {
|
"node_modules/react-dev-utils": {
|
||||||
"version": "12.0.1",
|
"version": "12.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz",
|
||||||
@ -13988,6 +14071,23 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz",
|
||||||
"integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg=="
|
"integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg=="
|
||||||
},
|
},
|
||||||
|
"node_modules/react-fit": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-fit/-/react-fit-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-cf9sFKbr1rlTB9fNIKE5Uy4NCMUOqrX2mdJ69V4RtmV4KubPdtnbIP1tEar16GXaToCRr7I7c9d2wkTNk9TV5g==",
|
||||||
|
"dependencies": {
|
||||||
|
"detect-element-overflow": "^1.2.0",
|
||||||
|
"prop-types": "^15.6.0",
|
||||||
|
"tiny-warning": "^1.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/wojtekmaj/react-fit?sponsor=1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^15.5.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
|
||||||
|
"react-dom": "^15.5.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-hook-form": {
|
"node_modules/react-hook-form": {
|
||||||
"version": "7.31.3",
|
"version": "7.31.3",
|
||||||
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.31.3.tgz",
|
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.31.3.tgz",
|
||||||
@ -15700,6 +15800,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz",
|
||||||
"integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA=="
|
"integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA=="
|
||||||
},
|
},
|
||||||
|
"node_modules/tiny-warning": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
|
||||||
|
},
|
||||||
"node_modules/tmpl": {
|
"node_modules/tmpl": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
|
||||||
@ -15999,6 +16104,14 @@
|
|||||||
"yarn": "*"
|
"yarn": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/update-input-width": {
|
||||||
|
"version": "1.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/update-input-width/-/update-input-width-1.2.2.tgz",
|
||||||
|
"integrity": "sha512-6QwD9ZVSXb96PxOZ01DU0DJTPwQGY7qBYgdniZKJN02Xzom2m+9J6EPxMbefskqtj4x78qbe5psDSALq9iNEYg==",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/wojtekmaj/update-input-width?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/uri-js": {
|
"node_modules/uri-js": {
|
||||||
"version": "4.4.1",
|
"version": "4.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||||
@ -16007,6 +16120,21 @@
|
|||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/use-local-storage-state": {
|
||||||
|
"version": "18.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/use-local-storage-state/-/use-local-storage-state-18.1.1.tgz",
|
||||||
|
"integrity": "sha512-09bl6q3mkSlkEt8KeBPCmdPEWEojWYF70Qbz+7wkfQX1feaFITM9m84+h0Jr6Cnf/IvpahkFh7UbX2VNN3ioTQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/astoilkov"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": ">=18",
|
||||||
|
"react-dom": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/util-deprecate": {
|
"node_modules/util-deprecate": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
@ -19682,6 +19810,14 @@
|
|||||||
"@types/react": "*"
|
"@types/react": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@types/react-calendar": {
|
||||||
|
"version": "3.9.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/react-calendar/-/react-calendar-3.9.0.tgz",
|
||||||
|
"integrity": "sha512-KpAu1MKAGFw5hNwlDnWsHWqI9i/igAB+8jH97YV7QpC2v7rlwNEU5i6VMFb73lGRacuejM/Zd2LklnEzkFV3XA==",
|
||||||
|
"requires": {
|
||||||
|
"@types/react": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@types/react-dom": {
|
"@types/react-dom": {
|
||||||
"version": "18.0.4",
|
"version": "18.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.4.tgz",
|
||||||
@ -20036,6 +20172,11 @@
|
|||||||
"@xtuc/long": "4.2.2"
|
"@xtuc/long": "4.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@wojtekmaj/date-utils": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@wojtekmaj/date-utils/-/date-utils-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-1VPkkTBk07gMR1fjpBtse4G+oJqpmE+0gUFB0dg3VIL7qJmUVaBoD/vlzMm/jNeOPfvlmerl1lpnsZyBUFIRuw=="
|
||||||
|
},
|
||||||
"@xtuc/ieee754": {
|
"@xtuc/ieee754": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
|
||||||
@ -21551,6 +21692,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
||||||
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg=="
|
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg=="
|
||||||
},
|
},
|
||||||
|
"detect-element-overflow": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/detect-element-overflow/-/detect-element-overflow-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-Jtr9ivYPhpd9OJux+hjL0QjUKiS1Ghgy8tvIufUjFslQgIWvgGr4mn57H190APbKkiOmXnmtMI6ytaKzMusecg=="
|
||||||
|
},
|
||||||
"detect-newline": {
|
"detect-newline": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz",
|
||||||
@ -22902,6 +23048,14 @@
|
|||||||
"get-intrinsic": "^1.1.1"
|
"get-intrinsic": "^1.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"get-user-locale": {
|
||||||
|
"version": "1.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-user-locale/-/get-user-locale-1.5.1.tgz",
|
||||||
|
"integrity": "sha512-WiNpoFRcHn1qxP9VabQljzGwkAQDrcpqUtaP0rNBEkFxJdh4f3tik6MfZsMYZc+UgQJdGCxWEjL9wnCUlRQXag==",
|
||||||
|
"requires": {
|
||||||
|
"lodash.memoize": "^4.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"glob": {
|
"glob": {
|
||||||
"version": "7.2.3",
|
"version": "7.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
||||||
@ -25317,6 +25471,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"make-event-props": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/make-event-props/-/make-event-props-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-oWiDZMcVB1/A487251hEWza1xzgCzl6MXxe9aF24l5Bt9N9UEbqTqKumEfuuLhmlhRZYnc+suVvW4vUs8bwO7Q=="
|
||||||
|
},
|
||||||
"makeerror": {
|
"makeerror": {
|
||||||
"version": "1.0.12",
|
"version": "1.0.12",
|
||||||
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz",
|
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz",
|
||||||
@ -26825,6 +26984,33 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"react-calendar": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-calendar/-/react-calendar-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-y9Q5Oo3Mq869KExbOCP3aJ3hEnRZKZ0TqUa9QU1wJGgDZFrW1qTaWp5v52oZpmxTTrpAMTUcUGaC0QJcO1f8Nw==",
|
||||||
|
"requires": {
|
||||||
|
"@wojtekmaj/date-utils": "^1.0.2",
|
||||||
|
"clsx": "^1.2.1",
|
||||||
|
"get-user-locale": "^1.2.0",
|
||||||
|
"prop-types": "^15.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"react-date-picker": {
|
||||||
|
"version": "9.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-date-picker/-/react-date-picker-9.1.0.tgz",
|
||||||
|
"integrity": "sha512-wj9SoOhEgQTzJsDRLePpNzUDNrcSiCpj1TFSwiAnLlOuJvvkk10I9rdvIyHmeJg/G17hyP5wSwTppCZHqOTHhA==",
|
||||||
|
"requires": {
|
||||||
|
"@types/react-calendar": "^3.0.0",
|
||||||
|
"@wojtekmaj/date-utils": "^1.0.3",
|
||||||
|
"clsx": "^1.2.1",
|
||||||
|
"get-user-locale": "^1.2.0",
|
||||||
|
"make-event-props": "^1.1.0",
|
||||||
|
"prop-types": "^15.6.0",
|
||||||
|
"react-calendar": "^4.0.0",
|
||||||
|
"react-fit": "^1.4.0",
|
||||||
|
"update-input-width": "^1.2.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"react-dev-utils": {
|
"react-dev-utils": {
|
||||||
"version": "12.0.1",
|
"version": "12.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz",
|
||||||
@ -26925,6 +27111,16 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz",
|
||||||
"integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg=="
|
"integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg=="
|
||||||
},
|
},
|
||||||
|
"react-fit": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-fit/-/react-fit-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-cf9sFKbr1rlTB9fNIKE5Uy4NCMUOqrX2mdJ69V4RtmV4KubPdtnbIP1tEar16GXaToCRr7I7c9d2wkTNk9TV5g==",
|
||||||
|
"requires": {
|
||||||
|
"detect-element-overflow": "^1.2.0",
|
||||||
|
"prop-types": "^15.6.0",
|
||||||
|
"tiny-warning": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"react-hook-form": {
|
"react-hook-form": {
|
||||||
"version": "7.31.3",
|
"version": "7.31.3",
|
||||||
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.31.3.tgz",
|
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.31.3.tgz",
|
||||||
@ -28194,6 +28390,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz",
|
||||||
"integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA=="
|
"integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA=="
|
||||||
},
|
},
|
||||||
|
"tiny-warning": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
|
||||||
|
},
|
||||||
"tmpl": {
|
"tmpl": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
|
||||||
@ -28416,6 +28617,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz",
|
||||||
"integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg=="
|
"integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg=="
|
||||||
},
|
},
|
||||||
|
"update-input-width": {
|
||||||
|
"version": "1.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/update-input-width/-/update-input-width-1.2.2.tgz",
|
||||||
|
"integrity": "sha512-6QwD9ZVSXb96PxOZ01DU0DJTPwQGY7qBYgdniZKJN02Xzom2m+9J6EPxMbefskqtj4x78qbe5psDSALq9iNEYg=="
|
||||||
|
},
|
||||||
"uri-js": {
|
"uri-js": {
|
||||||
"version": "4.4.1",
|
"version": "4.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||||
@ -28424,6 +28630,12 @@
|
|||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"use-local-storage-state": {
|
||||||
|
"version": "18.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/use-local-storage-state/-/use-local-storage-state-18.1.1.tgz",
|
||||||
|
"integrity": "sha512-09bl6q3mkSlkEt8KeBPCmdPEWEojWYF70Qbz+7wkfQX1feaFITM9m84+h0Jr6Cnf/IvpahkFh7UbX2VNN3ioTQ==",
|
||||||
|
"requires": {}
|
||||||
|
},
|
||||||
"util-deprecate": {
|
"util-deprecate": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"luxon": "^3.0.4",
|
"luxon": "^3.0.4",
|
||||||
"react": "^18.1.0",
|
"react": "^18.1.0",
|
||||||
"react-big-calendar": "^1.5.0",
|
"react-big-calendar": "^1.5.0",
|
||||||
|
"react-date-picker": "^9.1.0",
|
||||||
"react-dom": "^18.1.0",
|
"react-dom": "^18.1.0",
|
||||||
"react-hook-form": "^7.31.3",
|
"react-hook-form": "^7.31.3",
|
||||||
"react-modal": "^3.16.1",
|
"react-modal": "^3.16.1",
|
||||||
@ -24,6 +25,7 @@
|
|||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"react-select": "^5.3.2",
|
"react-select": "^5.3.2",
|
||||||
"typescript": "^4.6.4",
|
"typescript": "^4.6.4",
|
||||||
|
"use-local-storage-state": "^18.1.1",
|
||||||
"web-vitals": "^2.1.4"
|
"web-vitals": "^2.1.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from 'axios'
|
||||||
|
|
||||||
const axiosInstance = axios.create({});
|
const axiosInstance = axios.create({
|
||||||
|
baseURL: process.env.REACT_APP_BASE_URL,
|
||||||
|
})
|
||||||
|
|
||||||
export default axiosInstance;
|
export default axiosInstance
|
||||||
|
@ -2,6 +2,7 @@ import axiosInstance from './axiosInstance'
|
|||||||
|
|
||||||
export const getEnrollmentList = (
|
export const getEnrollmentList = (
|
||||||
params: Partial<{
|
params: Partial<{
|
||||||
|
year_group_id: number
|
||||||
page: number
|
page: number
|
||||||
per_page: number
|
per_page: number
|
||||||
name: string
|
name: string
|
||||||
@ -17,6 +18,6 @@ export const getEnrollmentList = (
|
|||||||
email: string
|
email: string
|
||||||
mode: number
|
mode: number
|
||||||
}[]
|
}[]
|
||||||
}>('http://127.0.0.1:5000/api/students/registrations/', {
|
}>(`students/registrations/${params.year_group_id}`, {
|
||||||
params,
|
params,
|
||||||
})
|
})
|
||||||
|
@ -20,22 +20,21 @@ export interface Group {
|
|||||||
|
|
||||||
export const getGroups = (
|
export const getGroups = (
|
||||||
params: Partial<{
|
params: Partial<{
|
||||||
|
year_group_id: number
|
||||||
page: number
|
page: number
|
||||||
per_page: number
|
per_page: number
|
||||||
name: string
|
name: string
|
||||||
}>,
|
}>,
|
||||||
) =>
|
) =>
|
||||||
axiosInstance.get<{ max_pages: number; groups: Group[] }>(
|
axiosInstance.get<{ max_pages: number; groups: Group[] }>(
|
||||||
'http://127.0.0.1:5000/api/coordinator/groups/',
|
`coordinator/groups/${params.year_group_id}`,
|
||||||
{
|
{
|
||||||
params,
|
params,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
export const createGroup = (payload: CreateGroup) =>
|
export const createGroup = (year_group_id: number, payload: CreateGroup) =>
|
||||||
axiosInstance.post('http://127.0.0.1:5000/api/coordinator/groups/', payload)
|
axiosInstance.post(`coordinator/groups/${year_group_id}`, payload)
|
||||||
|
|
||||||
export const deleteGroup = (id: number) =>
|
export const deleteGroup = (id: number) =>
|
||||||
axiosInstance.delete(
|
axiosInstance.delete(`coordinator/groups/${id}/`)
|
||||||
`http://127.0.0.1:5000/api/coordinator/groups/${id}/`,
|
|
||||||
)
|
|
||||||
|
@ -19,6 +19,7 @@ export interface Leader {
|
|||||||
|
|
||||||
export const getLeaders = (
|
export const getLeaders = (
|
||||||
params: Partial<{
|
params: Partial<{
|
||||||
|
year_group_id: number
|
||||||
fullname: string
|
fullname: string
|
||||||
order_by_first_name: OrderType
|
order_by_first_name: OrderType
|
||||||
order_by_last_name: OrderType
|
order_by_last_name: OrderType
|
||||||
@ -27,17 +28,12 @@ export const getLeaders = (
|
|||||||
}> = {},
|
}> = {},
|
||||||
) =>
|
) =>
|
||||||
axiosInstance.get<LeaderResponse>(
|
axiosInstance.get<LeaderResponse>(
|
||||||
'http://127.0.0.1:5000/api/coordinator/project_supervisor',
|
`coordinator/project_supervisor/${params.year_group_id}`,
|
||||||
{ params },
|
{ params },
|
||||||
)
|
)
|
||||||
|
|
||||||
export const createLeader = (payload: Leader) =>
|
export const createLeader = (payload: Leader) =>
|
||||||
axiosInstance.post(
|
axiosInstance.post('coordinator/project_supervisor/', payload)
|
||||||
'http://127.0.0.1:5000/api/coordinator/project_supervisor/',
|
|
||||||
payload,
|
|
||||||
)
|
|
||||||
|
|
||||||
export const deleteLeader = (id: number) =>
|
export const deleteLeader = (id: number) =>
|
||||||
axiosInstance.delete(
|
axiosInstance.delete(`coordinator/project_supervisor/${id}/`)
|
||||||
`http://127.0.0.1:5000/api/coordinator/project_supervisor/${id}/`,
|
|
||||||
)
|
|
||||||
|
@ -1,39 +1,35 @@
|
|||||||
import axiosInstance from './axiosInstance'
|
import axiosInstance from './axiosInstance'
|
||||||
|
|
||||||
export const getEvents = (scheduleId: number) => {
|
export const getTermsOfDefences = (scheduleId: number) => {
|
||||||
return axiosInstance.get<{
|
return axiosInstance.get<{
|
||||||
enrollments: {
|
term_of_defences: {
|
||||||
id: number
|
id: number
|
||||||
start_date: string
|
start_date: string
|
||||||
end_date: string
|
end_date: string
|
||||||
title: string
|
title: string
|
||||||
committee: {
|
members_of_committee: {
|
||||||
members: { first_name: string; last_name: string }[]
|
members: { first_name: string; last_name: string }[]
|
||||||
}
|
}
|
||||||
group: { name: string }
|
group: { name: string }
|
||||||
}[]
|
}[]
|
||||||
}>(
|
}>(`coordinator/enrollments/${scheduleId}/term-of-defences/`)
|
||||||
`http://127.0.0.1:5000/api/examination_schedule/enrollments/${scheduleId}/coordinator-view/?per_page=10000`,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getStudentsSchedule = (scheduleId: number) => {
|
export const getStudentsTermsOfDefences = (scheduleId: number) => {
|
||||||
return axiosInstance.get<{
|
return axiosInstance.get<{
|
||||||
enrollments: {
|
term_of_defences: {
|
||||||
id: number
|
id: number
|
||||||
start_date: string
|
start_date: string
|
||||||
end_date: string
|
end_date: string
|
||||||
title: string
|
title: string
|
||||||
committee: {
|
members_of_committee: {
|
||||||
members: { first_name: string; last_name: string }[]
|
members: { first_name: string; last_name: string }[]
|
||||||
}
|
}
|
||||||
group: { name: string }
|
group: { name: string }
|
||||||
}[]
|
}[]
|
||||||
}>(
|
}>(`students/examination-schedule/${scheduleId}/enrollments/`)
|
||||||
`http://127.0.0.1:5000/api/examination_schedule/enrollments/${scheduleId}/student-view?per_page=10000`,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
export const getSchedules = () => {
|
export const getSchedules = (year_group_id: number = 1) => {
|
||||||
return axiosInstance.get<{
|
return axiosInstance.get<{
|
||||||
examination_schedules: {
|
examination_schedules: {
|
||||||
id: number
|
id: number
|
||||||
@ -42,36 +38,34 @@ export const getSchedules = () => {
|
|||||||
title: string
|
title: string
|
||||||
mode: boolean
|
mode: boolean
|
||||||
}[]
|
}[]
|
||||||
}>(
|
}>(`coordinator/examination_schedule/${year_group_id}?per_page=10000`)
|
||||||
'http://127.0.0.1:5000/api/coordinator/examination_schedule/?per_page=10000',
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createEvent = ({
|
export const createEvent = ({
|
||||||
start_date,
|
start_date,
|
||||||
end_date,
|
end_date,
|
||||||
scheduleId,
|
scheduleId,
|
||||||
|
project_supervisors,
|
||||||
}: {
|
}: {
|
||||||
start_date: string
|
start_date: string
|
||||||
end_date: string
|
end_date: string
|
||||||
scheduleId: number
|
scheduleId: number
|
||||||
|
project_supervisors: number[]
|
||||||
}) => {
|
}) => {
|
||||||
return axiosInstance.post(
|
return axiosInstance.post(`coordinator/enrollments/${scheduleId}/add`, {
|
||||||
`http://127.0.0.1:5000/api/coordinator/enrollments/${scheduleId}/`,
|
|
||||||
{
|
|
||||||
start_date,
|
start_date,
|
||||||
end_date,
|
end_date,
|
||||||
},
|
project_supervisors,
|
||||||
)
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createSchedule = (title: string) => {
|
export const createSchedule = (
|
||||||
|
year_group_id: number,
|
||||||
|
payload: { title: string; start_date: string; end_date: string },
|
||||||
|
) => {
|
||||||
return axiosInstance.post(
|
return axiosInstance.post(
|
||||||
'http://127.0.0.1:5000/api/coordinator/examination_schedule/',
|
`coordinator/examination_schedule/${year_group_id}/`,
|
||||||
{
|
payload,
|
||||||
title,
|
|
||||||
mode: true,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,13 +78,10 @@ export const setEventDate = ({
|
|||||||
start_date: string
|
start_date: string
|
||||||
end_date: string
|
end_date: string
|
||||||
}) => {
|
}) => {
|
||||||
return axiosInstance.put(
|
return axiosInstance.put(`coordinator/examination_schedule/${id}/date`, {
|
||||||
`http://127.0.0.1:5000/api/coordinator/examination_schedule/${id}/date`,
|
|
||||||
{
|
|
||||||
start_date,
|
start_date,
|
||||||
end_date,
|
end_date,
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const assignGroup = ({
|
export const assignGroup = ({
|
||||||
@ -103,7 +94,7 @@ export const assignGroup = ({
|
|||||||
studentIndex: number
|
studentIndex: number
|
||||||
}) => {
|
}) => {
|
||||||
return axiosInstance.post(
|
return axiosInstance.post(
|
||||||
`http://127.0.0.1:5000/api/students/${scheduleId}/enrollments/${enrollmentId}/`,
|
`students/${scheduleId}/enrollments/${enrollmentId}/`,
|
||||||
{
|
{
|
||||||
student_index: studentIndex,
|
student_index: studentIndex,
|
||||||
},
|
},
|
||||||
@ -120,7 +111,7 @@ export const assignSupervisor = ({
|
|||||||
supervisorId: number
|
supervisorId: number
|
||||||
}) => {
|
}) => {
|
||||||
return axiosInstance.post(
|
return axiosInstance.post(
|
||||||
`http://127.0.0.1:5000/api/project_supervisor/${scheduleId}/enrollments/${enrollmentId}/`,
|
`project_supervisor/${scheduleId}/enrollments/${enrollmentId}/`,
|
||||||
{
|
{
|
||||||
project_supervisor_id: supervisorId,
|
project_supervisor_id: supervisorId,
|
||||||
},
|
},
|
||||||
@ -129,7 +120,7 @@ export const assignSupervisor = ({
|
|||||||
|
|
||||||
export const downloadSchedule = (scheduleId: number) =>
|
export const downloadSchedule = (scheduleId: number) =>
|
||||||
axiosInstance.post(
|
axiosInstance.post(
|
||||||
`http://127.0.0.1:5000/api/coordinator/examination_schedule/${scheduleId}/download/`,
|
`coordinator/examination_schedule/${scheduleId}/download/`,
|
||||||
{
|
{
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
},
|
},
|
||||||
|
@ -18,6 +18,7 @@ export interface Student {
|
|||||||
|
|
||||||
export const getStudents = (
|
export const getStudents = (
|
||||||
params: Partial<{
|
params: Partial<{
|
||||||
|
year_group_id: number
|
||||||
fullname: string
|
fullname: string
|
||||||
order_by_first_name: OrderType
|
order_by_first_name: OrderType
|
||||||
order_by_last_name: OrderType
|
order_by_last_name: OrderType
|
||||||
@ -27,30 +28,20 @@ export const getStudents = (
|
|||||||
}> = {},
|
}> = {},
|
||||||
) =>
|
) =>
|
||||||
axiosInstance.get<StudentResponse>(
|
axiosInstance.get<StudentResponse>(
|
||||||
'http://127.0.0.1:5000/api/coordinator/students',
|
`coordinator/students/${params.year_group_id}`,
|
||||||
{ params },
|
{ params },
|
||||||
)
|
)
|
||||||
|
|
||||||
export const createStudent = (payload: Student) =>
|
export const createStudent = (payload: Student) =>
|
||||||
axiosInstance.post('http://127.0.0.1:5000/api/coordinator/students/', payload)
|
axiosInstance.post('coordinator/students/', payload)
|
||||||
|
|
||||||
export const uploadStudents = (payload: FormData) =>
|
export const uploadStudents = (payload: FormData) =>
|
||||||
axiosInstance.post(
|
axiosInstance.post('coordinator/students/upload/', payload)
|
||||||
'http://127.0.0.1:5000/api/coordinator/students/upload/',
|
|
||||||
payload,
|
|
||||||
)
|
|
||||||
|
|
||||||
export const deleteStudent = (index: number) =>
|
export const deleteStudent = (index: number) =>
|
||||||
axiosInstance.delete(
|
axiosInstance.delete(`coordinator/students/${index}/`)
|
||||||
`http://127.0.0.1:5000/api/coordinator/students/${index}/`,
|
|
||||||
)
|
|
||||||
|
|
||||||
export const downloadStudents = (mode: boolean) =>
|
export const downloadStudents = (mode: boolean) =>
|
||||||
axiosInstance.post(
|
axiosInstance.post(`coordinator/students/download/?mode=${Number(mode)}`, {
|
||||||
`http://127.0.0.1:5000/api/coordinator/students/download/?mode=${Number(
|
|
||||||
mode,
|
|
||||||
)}`,
|
|
||||||
{
|
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
},
|
})
|
||||||
)
|
|
||||||
|
22
frontend/src/utils/bigCalendarTranslations.ts
Normal file
22
frontend/src/utils/bigCalendarTranslations.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
const bigCalendarTranslations = {
|
||||||
|
date: 'Data',
|
||||||
|
time: 'Czas',
|
||||||
|
event: 'Event',
|
||||||
|
allDay: 'Cały dzień',
|
||||||
|
week: 'Tydzień',
|
||||||
|
work_week: 'Dni robocze',
|
||||||
|
day: 'Dzień',
|
||||||
|
month: 'Miesiąc',
|
||||||
|
previous: 'Cofnij',
|
||||||
|
next: 'Dalej',
|
||||||
|
yesterday: 'Wczoraj',
|
||||||
|
tomorrow: 'Jutro',
|
||||||
|
today: 'Dzisiaj',
|
||||||
|
agenda: 'Agenda',
|
||||||
|
|
||||||
|
noEventsInRange: 'Brak wydarzeń w tym czasie.',
|
||||||
|
|
||||||
|
showMore: (total: number) => `+${total} more`,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default bigCalendarTranslations
|
@ -1,6 +1,11 @@
|
|||||||
import { NavLink } from 'react-router-dom'
|
import { NavLink } from 'react-router-dom'
|
||||||
|
import useLocalStorageState from 'use-local-storage-state'
|
||||||
|
|
||||||
const Login = () => {
|
const Login = () => {
|
||||||
|
const [yearGroupId, setYearGroupId] = useLocalStorageState('yearGroupId', {
|
||||||
|
defaultValue: 1,
|
||||||
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="flex items-center bg-gray-300 mt-20 py-6 px-10 shadow">
|
<div className="flex items-center bg-gray-300 mt-20 py-6 px-10 shadow">
|
||||||
|
@ -6,6 +6,7 @@ import { createGroup, CreateGroup } from '../../api/groups'
|
|||||||
import InputError from '../../components/InputError'
|
import InputError from '../../components/InputError'
|
||||||
import Select from 'react-select'
|
import Select from 'react-select'
|
||||||
import { getLeaders } from '../../api/leaders'
|
import { getLeaders } from '../../api/leaders'
|
||||||
|
import useLocalStorageState from 'use-local-storage-state'
|
||||||
|
|
||||||
type SelectValue = {
|
type SelectValue = {
|
||||||
value: string | number
|
value: string | number
|
||||||
@ -14,6 +15,8 @@ type SelectValue = {
|
|||||||
|
|
||||||
const AddGroup = () => {
|
const AddGroup = () => {
|
||||||
const [isAlertVisible, setIsAlertVisible] = useState(false)
|
const [isAlertVisible, setIsAlertVisible] = useState(false)
|
||||||
|
const [yearGroupId] = useLocalStorageState('yearGroupId')
|
||||||
|
|
||||||
const {
|
const {
|
||||||
register,
|
register,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
@ -29,7 +32,8 @@ const AddGroup = () => {
|
|||||||
{
|
{
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
setStudentOptions(
|
setStudentOptions(
|
||||||
data?.data.students.filter(st => st.group === null)
|
data?.data.students
|
||||||
|
.filter((st) => st.group === null)
|
||||||
.map(({ first_name, last_name, index }) => {
|
.map(({ first_name, last_name, index }) => {
|
||||||
return {
|
return {
|
||||||
value: index,
|
value: index,
|
||||||
@ -46,12 +50,12 @@ const AddGroup = () => {
|
|||||||
{
|
{
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
setSupervisorOptions(
|
setSupervisorOptions(
|
||||||
data?.data.project_supervisors.filter(ld => ld.count_groups < ld.limit_group).map(
|
data?.data.project_supervisors
|
||||||
({ id, first_name, last_name }) => ({
|
.filter((ld) => ld.count_groups < ld.limit_group)
|
||||||
|
.map(({ id, first_name, last_name }) => ({
|
||||||
value: id,
|
value: id,
|
||||||
label: `${first_name} ${last_name}`,
|
label: `${first_name} ${last_name}`,
|
||||||
}),
|
})),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -59,7 +63,7 @@ const AddGroup = () => {
|
|||||||
|
|
||||||
const { mutate: mutateCreateGroup } = useMutation(
|
const { mutate: mutateCreateGroup } = useMutation(
|
||||||
'createGroup',
|
'createGroup',
|
||||||
(payload: CreateGroup) => createGroup(payload),
|
(payload: CreateGroup) => createGroup(Number(yearGroupId), payload),
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
setIsAlertVisible(true)
|
setIsAlertVisible(true)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { DateTime } from 'luxon'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { Controller, NestedValue, useForm } from 'react-hook-form'
|
import { Controller, NestedValue, useForm } from 'react-hook-form'
|
||||||
import { useMutation, useQuery } from 'react-query'
|
import { useMutation, useQuery } from 'react-query'
|
||||||
@ -24,7 +25,7 @@ const EditSchedule = ({
|
|||||||
scheduleId: string
|
scheduleId: string
|
||||||
}) => {
|
}) => {
|
||||||
const { register, handleSubmit, reset, control } = useForm<{
|
const { register, handleSubmit, reset, control } = useForm<{
|
||||||
committee: NestedValue<any[]>
|
members_of_committee: NestedValue<any[]>
|
||||||
}>({ mode: 'onBlur' })
|
}>({ mode: 'onBlur' })
|
||||||
const [committeeOptions, setCommitteeOptions] = useState<SelectValue[]>([])
|
const [committeeOptions, setCommitteeOptions] = useState<SelectValue[]>([])
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ const EditSchedule = ({
|
|||||||
)
|
)
|
||||||
|
|
||||||
const onSubmit = (data: any) => {
|
const onSubmit = (data: any) => {
|
||||||
data?.committee?.forEach((id: number) => {
|
data?.members_of_committee?.forEach((id: number) => {
|
||||||
mutateAssignSupervisor({
|
mutateAssignSupervisor({
|
||||||
scheduleId: Number(scheduleId),
|
scheduleId: Number(scheduleId),
|
||||||
enrollmentId: eventData.id,
|
enrollmentId: eventData.id,
|
||||||
@ -65,17 +66,40 @@ const EditSchedule = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ width: '300px', height: '250px' }}>
|
<div style={{ width: '330px', height: '250px' }}>
|
||||||
<form className="w-full flex flex-col " onSubmit={handleSubmit(onSubmit)}>
|
<form className="w-full flex flex-col " onSubmit={handleSubmit(onSubmit)}>
|
||||||
<h3> Termin </h3>
|
<h3> Termin </h3>
|
||||||
|
<p className="mb-2">
|
||||||
|
{DateTime.fromJSDate(eventData.start).toFormat('yyyy-LL-dd HH:mm:ss')}{' '}
|
||||||
|
- {DateTime.fromJSDate(eventData.end).toFormat('yyyy-LL-dd HH:mm:ss')}
|
||||||
|
</p>
|
||||||
|
{eventData.resource.committee.members.length ? (
|
||||||
|
<>
|
||||||
|
Komisja:{' '}
|
||||||
|
<ul className="list-disc">
|
||||||
|
{eventData.resource.committee.members.map((member: any) => (
|
||||||
|
<li
|
||||||
|
key={`${member.first_name} ${member.last_name}`}
|
||||||
|
className="ml-4"
|
||||||
|
>
|
||||||
|
{member.first_name} {member.last_name}
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
{eventData.resource.group && (
|
||||||
|
<p className="mt-4">Grupa: {eventData.resource.group.name}</p>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
<div className="form-control">
|
<div className="form-control">
|
||||||
<div className="form-control">
|
<div className="form-control">
|
||||||
<label className="label" htmlFor="committee">
|
<label className="label" htmlFor="members_of_committee">
|
||||||
Komisja
|
Komisja
|
||||||
</label>
|
</label>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="committee"
|
name="members_of_committee"
|
||||||
rules={{ required: true }}
|
rules={{ required: true }}
|
||||||
render={({ field: { onChange, onBlur } }) => (
|
render={({ field: { onChange, onBlur } }) => (
|
||||||
<Select
|
<Select
|
||||||
@ -100,6 +124,8 @@ const EditSchedule = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button className="btn btn-success mt-10">ZAPISZ</button>
|
<button className="btn btn-success mt-10">ZAPISZ</button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -2,6 +2,7 @@ import classNames from 'classnames'
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useMutation, useQuery } from 'react-query'
|
import { useMutation, useQuery } from 'react-query'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
import useLocalStorageState from 'use-local-storage-state'
|
||||||
import { deleteGroup, getGroups } from '../../api/groups'
|
import { deleteGroup, getGroups } from '../../api/groups'
|
||||||
import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg'
|
import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg'
|
||||||
|
|
||||||
@ -9,6 +10,7 @@ const Groups = () => {
|
|||||||
let navigate = useNavigate()
|
let navigate = useNavigate()
|
||||||
const [page, setPage] = useState(1)
|
const [page, setPage] = useState(1)
|
||||||
const [perPage, setPerPage] = useState(10)
|
const [perPage, setPerPage] = useState(10)
|
||||||
|
const [yearGroupId] = useLocalStorageState('yearGroupId')
|
||||||
|
|
||||||
const perPageOptions = [
|
const perPageOptions = [
|
||||||
{
|
{
|
||||||
@ -34,7 +36,7 @@ const Groups = () => {
|
|||||||
data: groups,
|
data: groups,
|
||||||
refetch: refetchGroups,
|
refetch: refetchGroups,
|
||||||
} = useQuery(['groups', page, perPage], () =>
|
} = useQuery(['groups', page, perPage], () =>
|
||||||
getGroups({ page, per_page: perPage }),
|
getGroups({ year_group_id: Number(yearGroupId), page, per_page: perPage }),
|
||||||
)
|
)
|
||||||
|
|
||||||
const { mutate: mutateDelete } = useMutation(
|
const { mutate: mutateDelete } = useMutation(
|
||||||
|
@ -4,11 +4,13 @@ import { useNavigate } from 'react-router-dom'
|
|||||||
import { getLeaders, deleteLeader } from '../../api/leaders'
|
import { getLeaders, deleteLeader } from '../../api/leaders'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg'
|
import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg'
|
||||||
|
import useLocalStorageState from 'use-local-storage-state'
|
||||||
|
|
||||||
const Leaders = () => {
|
const Leaders = () => {
|
||||||
let navigate = useNavigate()
|
let navigate = useNavigate()
|
||||||
const [page, setPage] = useState(1)
|
const [page, setPage] = useState(1)
|
||||||
const [perPage, setPerPage] = useState(10)
|
const [perPage, setPerPage] = useState(10)
|
||||||
|
const [yearGroupId] = useLocalStorageState('yearGroupId')
|
||||||
|
|
||||||
const perPageOptions = [
|
const perPageOptions = [
|
||||||
{
|
{
|
||||||
@ -34,7 +36,7 @@ const Leaders = () => {
|
|||||||
data: leaders,
|
data: leaders,
|
||||||
refetch: refetchLeaders,
|
refetch: refetchLeaders,
|
||||||
} = useQuery(['project_supervisors', page, perPage], () =>
|
} = useQuery(['project_supervisors', page, perPage], () =>
|
||||||
getLeaders({ page, per_page: perPage }),
|
getLeaders({ year_group_id: Number(yearGroupId), page, per_page: perPage }),
|
||||||
)
|
)
|
||||||
|
|
||||||
const { mutate: mutateDelete } = useMutation(
|
const { mutate: mutateDelete } = useMutation(
|
||||||
|
@ -2,11 +2,19 @@ import { Calendar, luxonLocalizer, Views } from 'react-big-calendar'
|
|||||||
import { DateTime, Settings } from 'luxon'
|
import { DateTime, Settings } from 'luxon'
|
||||||
import { useCallback, useState } from 'react'
|
import { useCallback, useState } from 'react'
|
||||||
import { useMutation, useQuery } from 'react-query'
|
import { useMutation, useQuery } from 'react-query'
|
||||||
import { createEvent, downloadSchedule, getEvents } from '../../api/schedule'
|
import {
|
||||||
|
createEvent,
|
||||||
|
downloadSchedule,
|
||||||
|
getTermsOfDefences,
|
||||||
|
} from '../../api/schedule'
|
||||||
import { useParams } from 'react-router-dom'
|
import { useParams } from 'react-router-dom'
|
||||||
import Modal from 'react-modal'
|
import Modal from 'react-modal'
|
||||||
import { useForm } from 'react-hook-form'
|
import { Controller, NestedValue, useForm } from 'react-hook-form'
|
||||||
import EditSchedule from './EditSchedule'
|
import EditSchedule from './EditSchedule'
|
||||||
|
import Select from 'react-select'
|
||||||
|
import { getLeaders } from '../../api/leaders'
|
||||||
|
import useLocalStorageState from 'use-local-storage-state'
|
||||||
|
import bigCalendarTranslations from '../../utils/bigCalendarTranslations'
|
||||||
|
|
||||||
const customStyles = {
|
const customStyles = {
|
||||||
content: {
|
content: {
|
||||||
@ -18,12 +26,17 @@ const customStyles = {
|
|||||||
transform: 'translate(-50%, -50%)',
|
transform: 'translate(-50%, -50%)',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
type SelectValue = {
|
||||||
|
value: string | number
|
||||||
|
label: string
|
||||||
|
}
|
||||||
|
|
||||||
const Schedule = () => {
|
const Schedule = () => {
|
||||||
Settings.defaultZone = DateTime.local().zoneName
|
Settings.defaultZone = DateTime.local().zoneName
|
||||||
Settings.defaultLocale = 'pl'
|
Settings.defaultLocale = 'pl'
|
||||||
|
|
||||||
const { id } = useParams<{ id: string }>()
|
const { id } = useParams<{ id: string }>()
|
||||||
|
const [yearGroupId] = useLocalStorageState('yearGroupId')
|
||||||
const [events, setEvents] = useState<
|
const [events, setEvents] = useState<
|
||||||
{
|
{
|
||||||
id: number
|
id: number
|
||||||
@ -47,41 +60,68 @@ const Schedule = () => {
|
|||||||
const [isEditModalOpen, setIsEditModalOpen] = useState(false)
|
const [isEditModalOpen, setIsEditModalOpen] = useState(false)
|
||||||
Modal.setAppElement('#root')
|
Modal.setAppElement('#root')
|
||||||
|
|
||||||
const { register, handleSubmit, reset } = useForm<{
|
const { register, handleSubmit, reset, control } = useForm<{
|
||||||
from: string
|
from: string
|
||||||
to: string
|
to: string
|
||||||
|
project_supervisors: NestedValue<any[]>
|
||||||
}>({ mode: 'onBlur' })
|
}>({ mode: 'onBlur' })
|
||||||
|
const [committeeOptions, setCommitteeOptions] = useState<SelectValue[]>([])
|
||||||
|
|
||||||
const { refetch } = useQuery(['schedules'], () => getEvents(Number(id)), {
|
const { isLoading: areLeadersLoading } = useQuery(
|
||||||
|
'leaders',
|
||||||
|
() => getLeaders({ year_group_id: Number(yearGroupId), per_page: 1000 }),
|
||||||
|
{
|
||||||
|
onSuccess: (data) => {
|
||||||
|
setCommitteeOptions(
|
||||||
|
data?.data.project_supervisors.map(
|
||||||
|
({ id, first_name, last_name }) => ({
|
||||||
|
value: id,
|
||||||
|
label: `${first_name} ${last_name}`,
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
const { refetch } = useQuery(
|
||||||
|
['schedules'],
|
||||||
|
() => getTermsOfDefences(Number(id)),
|
||||||
|
{
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
setEvents(
|
setEvents(
|
||||||
data.data.enrollments.map(
|
data.data.term_of_defences.map(
|
||||||
({
|
({
|
||||||
id,
|
id,
|
||||||
start_date,
|
start_date,
|
||||||
end_date,
|
end_date,
|
||||||
title = 'Obrona',
|
title = 'Obrona',
|
||||||
committee,
|
members_of_committee,
|
||||||
group,
|
group,
|
||||||
}) => {
|
}) => {
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
title: `Obrona ${group?.name ?? ''}`,
|
title: `${group?.name ?? '-'}`,
|
||||||
start: new Date(start_date),
|
start: new Date(start_date),
|
||||||
end: new Date(end_date),
|
end: new Date(end_date),
|
||||||
resource: {
|
resource: {
|
||||||
committee,
|
members_of_committee,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
})
|
},
|
||||||
|
)
|
||||||
const { mutateAsync: mutateCreateEvent } = useMutation(
|
const { mutateAsync: mutateCreateEvent } = useMutation(
|
||||||
['createEvent'],
|
['createEvent'],
|
||||||
(data: { start_date: string; end_date: string; scheduleId: number }) =>
|
(data: {
|
||||||
createEvent(data),
|
project_supervisors: number[]
|
||||||
|
start_date: string
|
||||||
|
end_date: string
|
||||||
|
scheduleId: number
|
||||||
|
}) => createEvent(data),
|
||||||
)
|
)
|
||||||
|
|
||||||
const { mutate: mutateDownload } = useMutation(
|
const { mutate: mutateDownload } = useMutation(
|
||||||
@ -104,16 +144,16 @@ const Schedule = () => {
|
|||||||
if (view === Views.MONTH) {
|
if (view === Views.MONTH) {
|
||||||
setIsModalOpen(true)
|
setIsModalOpen(true)
|
||||||
} else {
|
} else {
|
||||||
await mutateCreateEvent({
|
// await mutateCreateEvent({
|
||||||
start_date: DateTime.fromJSDate(event.start).toFormat(
|
// start_date: DateTime.fromJSDate(event.start).toFormat(
|
||||||
'yyyy-LL-dd HH:mm:ss',
|
// 'yyyy-LL-dd HH:mm:ss',
|
||||||
),
|
// ),
|
||||||
end_date: DateTime.fromJSDate(event.end).toFormat(
|
// end_date: DateTime.fromJSDate(event.end).toFormat(
|
||||||
'yyyy-LL-dd HH:mm:ss',
|
// 'yyyy-LL-dd HH:mm:ss',
|
||||||
),
|
// ),
|
||||||
scheduleId: Number(id),
|
// scheduleId: Number(id),
|
||||||
})
|
// })
|
||||||
refetch()
|
// refetch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,6 +186,7 @@ const Schedule = () => {
|
|||||||
.set({ hour: to[0], minute: to[1] })
|
.set({ hour: to[0], minute: to[1] })
|
||||||
.toFormat('yyyy-LL-dd HH:mm:ss'),
|
.toFormat('yyyy-LL-dd HH:mm:ss'),
|
||||||
scheduleId: Number(id),
|
scheduleId: Number(id),
|
||||||
|
project_supervisors: data?.project_supervisors,
|
||||||
})
|
})
|
||||||
refetch()
|
refetch()
|
||||||
reset()
|
reset()
|
||||||
@ -153,6 +194,20 @@ const Schedule = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const eventGetter = (event: any) => {
|
||||||
|
return event?.resource?.group
|
||||||
|
? {
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#3174ad',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#329f32',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<button
|
<button
|
||||||
@ -172,6 +227,10 @@ const Schedule = () => {
|
|||||||
events={events}
|
events={events}
|
||||||
onView={onView}
|
onView={onView}
|
||||||
view={view}
|
view={view}
|
||||||
|
eventPropGetter={eventGetter}
|
||||||
|
min={DateTime.fromObject({ hour: 8, minute: 0 }).toJSDate()}
|
||||||
|
max={DateTime.fromObject({ hour: 16, minute: 0 }).toJSDate()}
|
||||||
|
messages={bigCalendarTranslations}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
@ -204,6 +263,33 @@ const Schedule = () => {
|
|||||||
type="text"
|
type="text"
|
||||||
{...register('to', { required: true })}
|
{...register('to', { required: true })}
|
||||||
/>
|
/>
|
||||||
|
<label className="label" htmlFor="project_supervisors">
|
||||||
|
Komisja
|
||||||
|
</label>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name="project_supervisors"
|
||||||
|
rules={{ required: true }}
|
||||||
|
render={({ field: { onChange, onBlur } }) => (
|
||||||
|
<Select
|
||||||
|
closeMenuOnSelect={false}
|
||||||
|
options={committeeOptions}
|
||||||
|
placeholder="Wybierz komisje"
|
||||||
|
isMulti
|
||||||
|
onChange={(values) =>
|
||||||
|
onChange(values.map((value) => value.value))
|
||||||
|
}
|
||||||
|
onBlur={onBlur}
|
||||||
|
styles={{
|
||||||
|
control: (styles) => ({
|
||||||
|
...styles,
|
||||||
|
padding: '0.3rem',
|
||||||
|
borderRadius: '0.5rem',
|
||||||
|
}),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button className="btn btn-success mt-4">Dodaj termin</button>
|
<button className="btn btn-success mt-4">Dodaj termin</button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -2,11 +2,19 @@ import { useMutation, useQuery } from 'react-query'
|
|||||||
import { createSchedule, getSchedules } from '../../api/schedule'
|
import { createSchedule, getSchedules } from '../../api/schedule'
|
||||||
import { useForm } from 'react-hook-form'
|
import { useForm } from 'react-hook-form'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
|
import useLocalStorageState from 'use-local-storage-state'
|
||||||
|
import DatePicker from 'react-date-picker'
|
||||||
|
import { useState } from 'react'
|
||||||
|
|
||||||
const Schedules = () => {
|
const Schedules = () => {
|
||||||
const { register, handleSubmit } = useForm<{ title: string }>({
|
const { register, handleSubmit } = useForm<{
|
||||||
|
title: string
|
||||||
|
}>({
|
||||||
mode: 'onBlur',
|
mode: 'onBlur',
|
||||||
})
|
})
|
||||||
|
const [yearGroupId] = useLocalStorageState('yearGroupId')
|
||||||
|
const [startDate, setStartDate] = useState(new Date())
|
||||||
|
const [endDate, setEndDate] = useState(new Date())
|
||||||
|
|
||||||
const { data: schedules, refetch } = useQuery(['getSchedules'], () =>
|
const { data: schedules, refetch } = useQuery(['getSchedules'], () =>
|
||||||
getSchedules(),
|
getSchedules(),
|
||||||
@ -14,7 +22,8 @@ const Schedules = () => {
|
|||||||
|
|
||||||
const { mutate: mutateCreateSchedule } = useMutation(
|
const { mutate: mutateCreateSchedule } = useMutation(
|
||||||
['createSchedule'],
|
['createSchedule'],
|
||||||
({ title }: { title: string }) => createSchedule(title),
|
(payload: { title: string; start_date: string; end_date: string }) =>
|
||||||
|
createSchedule(Number(yearGroupId), payload),
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
refetch()
|
refetch()
|
||||||
@ -23,7 +32,11 @@ const Schedules = () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const onSubmit = (data: any) => {
|
const onSubmit = (data: any) => {
|
||||||
mutateCreateSchedule(data)
|
mutateCreateSchedule({
|
||||||
|
...data,
|
||||||
|
start_date: startDate.toISOString(),
|
||||||
|
end_date: endDate.toISOString(),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -42,6 +55,17 @@ const Schedules = () => {
|
|||||||
type="text"
|
type="text"
|
||||||
{...register('title', { required: true })}
|
{...register('title', { required: true })}
|
||||||
/>
|
/>
|
||||||
|
<label className="label" htmlFor="start_date">
|
||||||
|
Od
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<DatePicker onChange={setStartDate} value={startDate} />
|
||||||
|
|
||||||
|
<label className="label" htmlFor="end_date">
|
||||||
|
Do
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<DatePicker onChange={setEndDate} value={endDate} />
|
||||||
</div>
|
</div>
|
||||||
<button className="btn btn-success mt-4">Stwórz zapisy</button>
|
<button className="btn btn-success mt-4">Stwórz zapisy</button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
} from '../../api/students'
|
} from '../../api/students'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg'
|
import { ReactComponent as IconRemove } from '../../assets/svg/icon-remove.svg'
|
||||||
|
import useLocalStorageState from 'use-local-storage-state'
|
||||||
|
|
||||||
const Students = () => {
|
const Students = () => {
|
||||||
let navigate = useNavigate()
|
let navigate = useNavigate()
|
||||||
@ -16,6 +17,7 @@ const Students = () => {
|
|||||||
const [page, setPage] = useState(1)
|
const [page, setPage] = useState(1)
|
||||||
const [perPage, setPerPage] = useState(10)
|
const [perPage, setPerPage] = useState(10)
|
||||||
const [mode, setMode] = useState(true)
|
const [mode, setMode] = useState(true)
|
||||||
|
const [yearGroupId] = useLocalStorageState('yearGroupId')
|
||||||
|
|
||||||
const perPageOptions = [
|
const perPageOptions = [
|
||||||
{
|
{
|
||||||
@ -41,7 +43,12 @@ const Students = () => {
|
|||||||
data: students,
|
data: students,
|
||||||
refetch: refetchStudents,
|
refetch: refetchStudents,
|
||||||
} = useQuery(['students', page, perPage, mode], () =>
|
} = useQuery(['students', page, perPage, mode], () =>
|
||||||
getStudents({ page, per_page: perPage, mode }),
|
getStudents({
|
||||||
|
year_group_id: Number(yearGroupId),
|
||||||
|
page,
|
||||||
|
per_page: perPage,
|
||||||
|
mode,
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
const { mutate: mutateDownload } = useMutation(
|
const { mutate: mutateDownload } = useMutation(
|
||||||
|
@ -1,13 +1,21 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useQuery } from 'react-query'
|
import { useQuery } from 'react-query'
|
||||||
|
import useLocalStorageState from 'use-local-storage-state'
|
||||||
import { getEnrollmentList } from '../../api/enrollment'
|
import { getEnrollmentList } from '../../api/enrollment'
|
||||||
|
|
||||||
const Enrollment = () => {
|
const Enrollment = () => {
|
||||||
const [showAvailable, setShowAvailable] = useState(false)
|
const [showAvailable, setShowAvailable] = useState(false)
|
||||||
const [mode, setMode] = useState(true)
|
const [mode, setMode] = useState(true)
|
||||||
|
const [yearGroupId] = useLocalStorageState('yearGroupId')
|
||||||
|
|
||||||
const { isLoading, data: enrollmentData } = useQuery(
|
const { isLoading, data: enrollmentData } = useQuery(
|
||||||
['enrollment', mode],
|
['enrollment', mode],
|
||||||
() => getEnrollmentList({ per_page: 1000, mode }),
|
() =>
|
||||||
|
getEnrollmentList({
|
||||||
|
year_group_id: Number(yearGroupId),
|
||||||
|
per_page: 1000,
|
||||||
|
mode,
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return <div>Ładowanie</div>
|
return <div>Ładowanie</div>
|
||||||
|
@ -46,6 +46,8 @@ const ScheduleAddGroup = ({
|
|||||||
{DateTime.fromJSDate(eventData.start).toFormat('yyyy-LL-dd HH:mm:ss')}{' '}
|
{DateTime.fromJSDate(eventData.start).toFormat('yyyy-LL-dd HH:mm:ss')}{' '}
|
||||||
- {DateTime.fromJSDate(eventData.end).toFormat('yyyy-LL-dd HH:mm:ss')}
|
- {DateTime.fromJSDate(eventData.end).toFormat('yyyy-LL-dd HH:mm:ss')}
|
||||||
</h3>
|
</h3>
|
||||||
|
{eventData.resource.committee.members.length > 0 && (
|
||||||
|
<>
|
||||||
Komisja:{' '}
|
Komisja:{' '}
|
||||||
<ul className="list-disc">
|
<ul className="list-disc">
|
||||||
{eventData.resource.committee.members.map((member: any) => (
|
{eventData.resource.committee.members.map((member: any) => (
|
||||||
@ -57,6 +59,13 @@ const ScheduleAddGroup = ({
|
|||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{eventData.resource.group && (
|
||||||
|
<p className="mt-4">Grupa: {eventData.resource.group.name}</p>
|
||||||
|
)}
|
||||||
|
{!eventData.resource.group && (
|
||||||
|
<>
|
||||||
<div className="form-control">
|
<div className="form-control">
|
||||||
<label className="label" htmlFor="student_index">
|
<label className="label" htmlFor="student_index">
|
||||||
Indeks
|
Indeks
|
||||||
@ -69,6 +78,8 @@ const ScheduleAddGroup = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button className="btn btn-success mt-4">ZAPISZ</button>
|
<button className="btn btn-success mt-4">ZAPISZ</button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -2,11 +2,12 @@ import { Calendar, luxonLocalizer, Views } from 'react-big-calendar'
|
|||||||
import { DateTime, Settings } from 'luxon'
|
import { DateTime, Settings } from 'luxon'
|
||||||
import { useCallback, useState } from 'react'
|
import { useCallback, useState } from 'react'
|
||||||
import { useQuery } from 'react-query'
|
import { useQuery } from 'react-query'
|
||||||
import { getStudentsSchedule } from '../../api/schedule'
|
import { getStudentsTermsOfDefences } from '../../api/schedule'
|
||||||
import { useParams } from 'react-router-dom'
|
import { useParams } from 'react-router-dom'
|
||||||
import Modal from 'react-modal'
|
import Modal from 'react-modal'
|
||||||
import { useForm } from 'react-hook-form'
|
import { useForm } from 'react-hook-form'
|
||||||
import ScheduleAddGroup from './ScheduleAddGroup'
|
import ScheduleAddGroup from './ScheduleAddGroup'
|
||||||
|
import bigCalendarTranslations from '../../utils/bigCalendarTranslations'
|
||||||
|
|
||||||
const customStyles = {
|
const customStyles = {
|
||||||
content: {
|
content: {
|
||||||
@ -54,26 +55,27 @@ const StudentSchedule = () => {
|
|||||||
|
|
||||||
const { refetch } = useQuery(
|
const { refetch } = useQuery(
|
||||||
['studentSchedules'],
|
['studentSchedules'],
|
||||||
() => getStudentsSchedule(Number(id)),
|
() => getStudentsTermsOfDefences(Number(id)),
|
||||||
{
|
{
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
setEvents(
|
setEvents(
|
||||||
data.data.enrollments.map(
|
data.data.term_of_defences.map(
|
||||||
({
|
({
|
||||||
id,
|
id,
|
||||||
start_date,
|
start_date,
|
||||||
end_date,
|
end_date,
|
||||||
title = 'Obrona',
|
title = 'Obrona',
|
||||||
committee,
|
members_of_committee,
|
||||||
group,
|
group,
|
||||||
}) => {
|
}) => {
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
title: `Obrona ${group?.name ?? ''}`,
|
title: `${group?.name ?? '-'}`,
|
||||||
start: new Date(start_date),
|
start: new Date(start_date),
|
||||||
end: new Date(end_date),
|
end: new Date(end_date),
|
||||||
resource: {
|
resource: {
|
||||||
committee,
|
group,
|
||||||
|
members_of_committee,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -107,6 +109,20 @@ const StudentSchedule = () => {
|
|||||||
}
|
}
|
||||||
const onSubmit = async (data: any) => {}
|
const onSubmit = async (data: any) => {}
|
||||||
|
|
||||||
|
const eventGetter = (event: any) => {
|
||||||
|
return event?.resource?.group
|
||||||
|
? {
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#3174ad',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#329f32',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-2xl font-bold mb-2 text-center">
|
<h1 className="text-2xl font-bold mb-2 text-center">
|
||||||
@ -122,6 +138,10 @@ const StudentSchedule = () => {
|
|||||||
events={events}
|
events={events}
|
||||||
onView={onView}
|
onView={onView}
|
||||||
view={view}
|
view={view}
|
||||||
|
eventPropGetter={eventGetter}
|
||||||
|
min={DateTime.fromObject({ hour: 8, minute: 0 }).toJSDate()}
|
||||||
|
max={DateTime.fromObject({ hour: 16, minute: 0 }).toJSDate()}
|
||||||
|
messages={bigCalendarTranslations}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
|
Loading…
Reference in New Issue
Block a user