This commit is contained in:
Zuev
2026-10-02 04:07:56 +03:00
parent 97bf3cc50a
commit fc5801d683
42 changed files with 1201 additions and 305 deletions

View File

@@ -1,4 +1,5 @@
import { useEffect, useRef, useState } from 'react';
import { CustomSelect } from '../../shared/ui/CustomSelect.jsx';
import { readUrlState, readUrlValues, writeUrlState } from '../../../admin/js/url-state.js';
import { trackUxEvent } from '../../../telemetry.js';
@@ -134,6 +135,8 @@ export function GroupsTab() {
}, []);
async function loadGroups(nextState) {
stateRef.current = nextState;
setState(nextState);
const currentRequest = requestNumber.current + 1;
requestNumber.current = currentRequest;
setTableLoading(true);
@@ -174,6 +177,7 @@ export function GroupsTab() {
}
function resetFilters() {
window.clearTimeout(searchTimer.current);
setSearchInput('');
void loadGroups({
...stateRef.current,
@@ -546,7 +550,7 @@ export function GroupsTab() {
</div>
<div className="form-group">
<label htmlFor="new-group-ef">Форма обучения</label>
<select
<CustomSelect
id="new-group-ef"
value={createForm.educationFormId}
onChange={event => updateCreateForm({ educationFormId: event.target.value })}
@@ -554,11 +558,11 @@ export function GroupsTab() {
{(educationForms || []).map(form => (
<option key={form.id} value={form.id}>{form.name}</option>
))}
</select>
</CustomSelect>
</div>
<div className="form-group">
<label htmlFor="new-group-department">Кафедра</label>
<select
<CustomSelect
id="new-group-department"
value={createForm.departmentId}
onChange={event => updateCreateForm({ departmentId: event.target.value })}
@@ -569,7 +573,7 @@ export function GroupsTab() {
{departmentOptionLabel(department)}
</option>
))}
</select>
</CustomSelect>
</div>
<div className="form-group">
<label htmlFor="new-group-yearStartStudy">Год начала обучения</label>
@@ -586,7 +590,7 @@ export function GroupsTab() {
</div>
<div className="form-group">
<label htmlFor="new-group-speciality-code">Специальность</label>
<select
<CustomSelect
id="new-group-speciality-code"
value={createForm.specialtyId}
onChange={event => updateCreateForm({ specialtyId: event.target.value, specialtyProfileId: '' })}
@@ -597,11 +601,11 @@ export function GroupsTab() {
{specialityLabel(specialties, speciality.id)}
</option>
))}
</select>
</CustomSelect>
</div>
<div className="form-group">
<label htmlFor="new-group-profile">Профиль обучения</label>
<select
<CustomSelect
id="new-group-profile"
value={createForm.specialtyProfileId}
onChange={event => updateCreateForm({ specialtyProfileId: event.target.value })}
@@ -616,7 +620,7 @@ export function GroupsTab() {
) : (
<option value="">Нет профилей</option>
)}
</select>
</CustomSelect>
</div>
<button type="submit" className="btn btn-md btn-primary">Создать</button>
</div>
@@ -654,7 +658,7 @@ export function GroupsTab() {
</div>
<div className="form-group">
<label htmlFor="groups-sort">Сортировка</label>
<select
<CustomSelect
id="groups-sort"
value={state.sort}
onChange={event => applyState({ sort: event.target.value, page: 0 })}
@@ -662,7 +666,7 @@ export function GroupsTab() {
{GROUP_SORT_OPTIONS.map(option => (
<option key={option.value} value={option.value}>{option.label}</option>
))}
</select>
</CustomSelect>
</div>
<button type="button" className="btn btn-md btn-ghost" onClick={resetFilters}>Сбросить фильтры</button>
</div>
@@ -819,7 +823,7 @@ export function GroupsTab() {
</div>
<div className="form-group">
<label htmlFor="edit-group-ef">Форма обучения</label>
<select
<CustomSelect
id="edit-group-ef"
value={editModal.form.educationFormId}
onChange={event => setEditModal(current => (
@@ -829,13 +833,13 @@ export function GroupsTab() {
{(educationForms || []).map(form => (
<option key={form.id} value={form.id}>{form.name}</option>
))}
</select>
</CustomSelect>
</div>
</div>
<div className="form-row edit-group-form-row edit-group-form-row-details">
<div className="form-group">
<label htmlFor="edit-group-department">Кафедра</label>
<select
<CustomSelect
id="edit-group-department"
value={editModal.form.departmentId}
onChange={event => setEditModal(current => (
@@ -848,7 +852,7 @@ export function GroupsTab() {
{departmentOptionLabel(department)}
</option>
))}
</select>
</CustomSelect>
</div>
<div className="form-group">
<label htmlFor="edit-group-yearStartStudy">Год начала обучения</label>
@@ -866,7 +870,7 @@ export function GroupsTab() {
</div>
<div className="form-group">
<label htmlFor="edit-group-speciality-code">Специальность</label>
<select
<CustomSelect
id="edit-group-speciality-code"
value={editModal.form.specialtyId}
onChange={event => setEditModal(current => (
@@ -881,11 +885,11 @@ export function GroupsTab() {
{specialityLabel(specialties, speciality.id)}
</option>
))}
</select>
</CustomSelect>
</div>
<div className="form-group">
<label htmlFor="edit-group-profile">Профиль обучения</label>
<select
<CustomSelect
id="edit-group-profile"
value={editModal.form.specialtyProfileId}
onChange={event => setEditModal(current => (
@@ -902,7 +906,7 @@ export function GroupsTab() {
) : (
<option value="">Нет профилей</option>
)}
</select>
</CustomSelect>
</div>
<div className="form-group edit-group-submit">
<button type="submit" className="btn btn-md btn-primary">Сохранить</button>
@@ -949,7 +953,7 @@ export function GroupsTab() {
<div className="subgroup-config-grid">
<div className="form-group subgroup-count-field">
<label htmlFor="manage-subgroup-count">Количество подгрупп</label>
<select
<CustomSelect
id="manage-subgroup-count"
value={subgroupsModal.count}
onChange={event => changeSubgroupCount(event.target.value)}
@@ -957,7 +961,7 @@ export function GroupsTab() {
{SUBGROUP_COUNT_OPTIONS.map(option => (
<option key={option.value} value={option.value}>{option.label}</option>
))}
</select>
</CustomSelect>
</div>
<div className={`subgroup-capacity-fields subgroup-capacity-fields-${subgroupsModal.count}`}>
{subgroupsModal.capacities.map((value, index) => (
@@ -1074,7 +1078,7 @@ export function GroupsTab() {
<div className="form-row form-row--bottom">
<div className="form-group form-group--flush">
<label htmlFor="manage-calendar-year">Учебный год</label>
<select
<CustomSelect
id="manage-calendar-year"
required
value={calendarModal.yearId}
@@ -1084,7 +1088,7 @@ export function GroupsTab() {
{(academicYears || []).map(year => (
<option key={year.id} value={year.id}>{year.title}</option>
))}
</select>
</CustomSelect>
</div>
<div className="form-group form-group--flush form-group--wide">
<label htmlFor="manage-calendar-id">Календарный график</label>