2487 lines
79 KiB
Vue
2487 lines
79 KiB
Vue
<script setup lang="ts">
|
|
import { getDisplayLocale } from "../i18n";
|
|
import { useI18n } from "vue-i18n";
|
|
const { t } = useI18n();
|
|
import { computed, onMounted, reactive, ref } from "vue";
|
|
import {
|
|
Calendar,
|
|
CircleCheck,
|
|
Clock,
|
|
Plus,
|
|
Refresh,
|
|
Search,
|
|
Tickets,
|
|
UserFilled,
|
|
} from "@element-plus/icons-vue";
|
|
import http, { apiErrorMessage } from "../api/http";
|
|
import { useAuthStore } from "../stores/auth";
|
|
import {
|
|
academicTermLabel,
|
|
academicTermOptionClass,
|
|
defaultAcademicTermId,
|
|
} from "../utils/academicTerms";
|
|
|
|
const auth = useAuthStore();
|
|
const managerRoles = ["SuperAdmin", "AcademicAdmin", "CollegeAdmin"];
|
|
const isManager = computed(
|
|
() => auth.user?.roles.some((role) => managerRoles.includes(role)) ?? false,
|
|
);
|
|
const canManageRounds = computed(
|
|
() =>
|
|
auth.user?.roles.some((role) =>
|
|
["SuperAdmin", "AcademicAdmin"].includes(role),
|
|
) ?? false,
|
|
);
|
|
const isStudent = computed(
|
|
() => auth.user?.roles.includes("Student") && !isManager.value,
|
|
);
|
|
const terms = ref<any[]>([]);
|
|
const gradeOptions = ref<number[]>([]);
|
|
const rounds = ref<any[]>([]);
|
|
const selectedRound = ref<any | null>(null);
|
|
const offerings = ref<any[]>([]);
|
|
const tasks = ref<any[]>([]);
|
|
const enrollments = ref<any[]>([]);
|
|
const loading = ref(false);
|
|
const detailLoading = ref(false);
|
|
const roundDialog = ref(false);
|
|
const offeringDialog = ref(false);
|
|
const rosterDrawer = ref(false);
|
|
const proxyDialog = ref(false);
|
|
const editingRoundId = ref("");
|
|
const editingOfferingId = ref("");
|
|
const roster = ref<any | null>(null);
|
|
const rosterLoading = ref(false);
|
|
const rosterKeyword = ref("");
|
|
const rosterGrade = ref<number | undefined>();
|
|
const rosterMajorId = ref<string | undefined>();
|
|
const rosterClassId = ref<string | undefined>();
|
|
const rosterStudentPage = ref(1);
|
|
const rosterWaitlistPage = ref(1);
|
|
const rosterPageSize = 20;
|
|
const eligibleStudents = ref<any[]>([]);
|
|
const eligibleTotal = ref(0);
|
|
const eligiblePage = ref(1);
|
|
const eligibleLoading = ref(false);
|
|
const proxySubmitting = ref(false);
|
|
const studentKeyword = ref("");
|
|
const selectedStudentIds = ref<string[]>([]);
|
|
const offeringKeyword = ref("");
|
|
const offeringStatus = ref("All");
|
|
const previewOfferingId = ref("");
|
|
const roundForm = reactive<Record<string, any>>({});
|
|
const offeringForm = reactive<Record<string, any>>({});
|
|
|
|
const statusLabels = computed<Record<string, string>>(() => ({
|
|
Draft: t("courseSelectionScript.draft"),
|
|
Open: t("courseSelectionScript.open"),
|
|
Closed: t("courseSelectionScript.closed2"),
|
|
}));
|
|
const scopeLabels = computed<Record<string, string>>(() => ({
|
|
All: t("courseSelectionScript.generalEnrollment"),
|
|
RetakeOnly: t("courseSelectionScript.retakesOnly"),
|
|
}));
|
|
const patternLabels = computed<Record<string, string>>(() => ({
|
|
All: t("courseSelectionScript.everyWeek"),
|
|
Odd: t("courseSelectionScript.oddWeeks"),
|
|
Even: t("courseSelectionScript.evenWeeks"),
|
|
}));
|
|
const weekdayLabels = computed(() => [
|
|
"",
|
|
t("courseSelectionScript.mon"),
|
|
t("courseSelectionScript.tue"),
|
|
t("courseSelectionScript.wed"),
|
|
t("courseSelectionScript.thu"),
|
|
t("courseSelectionScript.fri"),
|
|
t("courseSelectionScript.sat"),
|
|
t("courseSelectionScript.sun"),
|
|
]);
|
|
const selectedCredits = computed(() =>
|
|
offerings.value
|
|
.filter((item) => item.enrollmentStatus === "Enrolled")
|
|
.reduce((sum, item) => sum + Number(item.credits), 0),
|
|
);
|
|
const creditPercent = computed(() => {
|
|
const maximum = Number(selectedRound.value?.maxCredits || 1);
|
|
return Math.min(100, Math.round((selectedCredits.value / maximum) * 100));
|
|
});
|
|
const selectedCount = computed(
|
|
() =>
|
|
offerings.value.filter((item) => item.enrollmentStatus === "Enrolled")
|
|
.length,
|
|
);
|
|
const selectedOfferings = computed(() =>
|
|
offerings.value.filter((item) => item.enrollmentStatus === "Enrolled"),
|
|
);
|
|
const previewOffering = computed(
|
|
() =>
|
|
offerings.value.find((item) => item.id === previewOfferingId.value) ?? null,
|
|
);
|
|
const rosterClasses = computed(() =>
|
|
(roster.value?.filterOptions?.classes ?? []).filter(
|
|
(item: any) => !rosterMajorId.value || item.majorId === rosterMajorId.value,
|
|
),
|
|
);
|
|
const selectableTasks = computed(() => {
|
|
const usedTaskIds = new Set(
|
|
offerings.value
|
|
.filter((item) => item.id !== editingOfferingId.value)
|
|
.map((item) => item.teachingTaskId),
|
|
);
|
|
return tasks.value.filter((item) => !usedTaskIds.has(item.id));
|
|
});
|
|
|
|
function includesWeek(schedule: any, week: number) {
|
|
return (
|
|
schedule.weekPattern === "All" ||
|
|
(schedule.weekPattern === "Odd" && week % 2 === 1) ||
|
|
(schedule.weekPattern === "Even" && week % 2 === 0)
|
|
);
|
|
}
|
|
|
|
function schedulesOverlap(first: any, second: any) {
|
|
if (first.dayOfWeek !== second.dayOfWeek) return false;
|
|
const periodsOverlap =
|
|
first.startPeriod < second.startPeriod + second.periodCount &&
|
|
second.startPeriod < first.startPeriod + first.periodCount;
|
|
if (!periodsOverlap) return false;
|
|
const startWeek = Math.max(first.startWeek, second.startWeek);
|
|
const endWeek = Math.min(first.endWeek, second.endWeek);
|
|
for (let week = startWeek; week <= endWeek; week += 1) {
|
|
if (includesWeek(first, week) && includesWeek(second, week)) return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function conflictingSelectedCourses(offering: any) {
|
|
if (offering.enrollmentStatus === "Enrolled" || offering.isFlexible)
|
|
return [];
|
|
return selectedOfferings.value
|
|
.filter(
|
|
(selected) =>
|
|
selected.id !== offering.id &&
|
|
(selected.schedules ?? []).some((existing: any) =>
|
|
(offering.schedules ?? []).some((candidate: any) =>
|
|
schedulesOverlap(candidate, existing),
|
|
),
|
|
),
|
|
)
|
|
.map((item) => item.courseName);
|
|
}
|
|
|
|
function offeringEligibilityReason(offering: any) {
|
|
if (["Enrolled", "Waitlisted"].includes(offering.enrollmentStatus)) return "";
|
|
if (!selectedRound.value?.isAvailableNow)
|
|
return t("courseSelectionScript.enrollmentIsNotCurrentlyOpen");
|
|
if (!offering.isFlexible && !(offering.schedules ?? []).length)
|
|
return t("courseSelectionScript.theOfficialTimetableHasNotBeenPublished");
|
|
if (
|
|
!offering.isRetake &&
|
|
selectedOfferings.value.some(
|
|
(item) =>
|
|
item.id !== offering.id && item.courseCode === offering.courseCode,
|
|
)
|
|
)
|
|
return t("courseSelectionScript.youAlreadySelectedThisCourseThisTerm");
|
|
if (
|
|
selectedRound.value.maxCourseCount &&
|
|
selectedCount.value >= Number(selectedRound.value.maxCourseCount)
|
|
) {
|
|
return t("courseSelectionScript.maxCourses", {
|
|
count: selectedRound.value.maxCourseCount,
|
|
});
|
|
}
|
|
if (
|
|
selectedCredits.value + Number(offering.credits) >
|
|
Number(selectedRound.value.maxCredits)
|
|
) {
|
|
return t("courseSelectionScript.maxCredits", {
|
|
count: selectedRound.value.maxCredits,
|
|
});
|
|
}
|
|
const conflicts = conflictingSelectedCourses(offering);
|
|
if (conflicts.length) {
|
|
if (!offering.isRetake)
|
|
return t("courseSelectionScript.conflict", {
|
|
courses: conflicts.join(", "),
|
|
});
|
|
// Retake: calculate overlap (client-side rough estimate)
|
|
if (!calcRetakeOverlapOk(offering))
|
|
return t(
|
|
"courseSelectionScript.retakeTimeConflictsExceed50EnrollmentIsUnavailable",
|
|
);
|
|
return ""; // retake with acceptable overlap
|
|
}
|
|
return "";
|
|
}
|
|
|
|
function effectiveCapacity(offering: any) {
|
|
return offering.isRetake
|
|
? Math.ceil(offering.capacity * 1.15)
|
|
: offering.capacity;
|
|
}
|
|
|
|
function isOfferingFull(offering: any) {
|
|
return offering.enrolledCount >= effectiveCapacity(offering);
|
|
}
|
|
|
|
function offeringBlockReason(offering: any) {
|
|
const eligibilityReason = offeringEligibilityReason(offering);
|
|
if (eligibilityReason) return eligibilityReason;
|
|
if (isOfferingFull(offering))
|
|
return t("courseSelectionScript.thisClassIsFullYouCanJoinTheWaitlist");
|
|
return "";
|
|
}
|
|
|
|
function calcRetakeOverlapOk(offering: any): boolean {
|
|
let totalPeriods = 0,
|
|
overlapPeriods = 0;
|
|
for (const candidate of offering.schedules ?? []) {
|
|
totalPeriods += candidate.periodCount;
|
|
for (const selected of selectedOfferings.value) {
|
|
for (const existing of selected.schedules ?? []) {
|
|
if (candidate.dayOfWeek !== existing.dayOfWeek) continue;
|
|
const overlapStart = Math.max(
|
|
candidate.startPeriod,
|
|
existing.startPeriod,
|
|
);
|
|
const overlapEnd = Math.min(
|
|
candidate.startPeriod + candidate.periodCount,
|
|
existing.startPeriod + existing.periodCount,
|
|
);
|
|
if (overlapEnd > overlapStart)
|
|
overlapPeriods += overlapEnd - overlapStart;
|
|
}
|
|
}
|
|
}
|
|
return totalPeriods === 0 || (overlapPeriods / totalPeriods) * 100 <= 50;
|
|
}
|
|
|
|
const filteredOfferings = computed(() => {
|
|
const keyword = offeringKeyword.value.trim().toLocaleLowerCase();
|
|
return offerings.value.filter((offering) => {
|
|
const matchesKeyword =
|
|
!keyword ||
|
|
[
|
|
offering.courseCode,
|
|
offering.courseName,
|
|
offering.taskNumber,
|
|
...(offering.teacherNames ?? []),
|
|
].some((value) =>
|
|
String(value ?? "")
|
|
.toLocaleLowerCase()
|
|
.includes(keyword),
|
|
);
|
|
if (!matchesKeyword) return false;
|
|
if (offeringStatus.value === "Selected") {
|
|
return offering.enrollmentStatus === "Enrolled";
|
|
}
|
|
if (offeringStatus.value === "Waitlisted") {
|
|
return offering.enrollmentStatus === "Waitlisted";
|
|
}
|
|
if (offeringStatus.value === "Retake") {
|
|
return (
|
|
offering.isRetake &&
|
|
!["Enrolled", "Waitlisted"].includes(offering.enrollmentStatus)
|
|
);
|
|
}
|
|
const blocked = Boolean(offeringEligibilityReason(offering));
|
|
if (offeringStatus.value === "Selectable") {
|
|
return (
|
|
!["Enrolled", "Waitlisted"].includes(offering.enrollmentStatus) &&
|
|
!blocked
|
|
);
|
|
}
|
|
if (offeringStatus.value === "Blocked") {
|
|
return (
|
|
!["Enrolled", "Waitlisted"].includes(offering.enrollmentStatus) &&
|
|
blocked
|
|
);
|
|
}
|
|
return true;
|
|
});
|
|
});
|
|
|
|
const timetableOfferings = computed(() => {
|
|
const result = [...selectedOfferings.value];
|
|
if (
|
|
previewOffering.value &&
|
|
previewOffering.value.enrollmentStatus !== "Enrolled"
|
|
) {
|
|
result.push(previewOffering.value);
|
|
}
|
|
return result;
|
|
});
|
|
|
|
const timetablePeriodCount = computed(() =>
|
|
Math.max(
|
|
12,
|
|
...timetableOfferings.value.flatMap((offering) =>
|
|
offering.schedules.map(
|
|
(schedule: any) => schedule.startPeriod + schedule.periodCount - 1,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
const timetablePeriods = computed(() =>
|
|
Array.from({ length: timetablePeriodCount.value }, (_, index) => index + 1),
|
|
);
|
|
const timetableCells = computed(() =>
|
|
timetablePeriods.value.flatMap((period) =>
|
|
Array.from({ length: 7 }, (_, index) => ({
|
|
key: `${index + 1}-${period}`,
|
|
dayOfWeek: index + 1,
|
|
period,
|
|
})),
|
|
),
|
|
);
|
|
const timetableGroups = computed(() => {
|
|
const entriesByDay = new Map<number, any[]>();
|
|
timetableOfferings.value.forEach((offering, offeringIndex) => {
|
|
offering.schedules.forEach((schedule: any) => {
|
|
const dayEntries = entriesByDay.get(schedule.dayOfWeek) ?? [];
|
|
dayEntries.push({
|
|
...schedule,
|
|
courseName: offering.courseName,
|
|
taskNumber: offering.taskNumber,
|
|
isPreview: offering.id === previewOfferingId.value,
|
|
hasConflict:
|
|
offering.id === previewOfferingId.value &&
|
|
conflictingSelectedCourses(offering).length > 0,
|
|
tone: offeringIndex % 5,
|
|
});
|
|
entriesByDay.set(schedule.dayOfWeek, dayEntries);
|
|
});
|
|
});
|
|
const groups: any[] = [];
|
|
entriesByDay.forEach((entries, dayOfWeek) => {
|
|
entries
|
|
.sort(
|
|
(first, second) =>
|
|
first.startPeriod - second.startPeriod ||
|
|
first.periodCount - second.periodCount,
|
|
)
|
|
.forEach((entry) => {
|
|
const endPeriod = entry.startPeriod + entry.periodCount;
|
|
const current = groups.at(-1);
|
|
if (
|
|
current &&
|
|
current.dayOfWeek === dayOfWeek &&
|
|
entry.startPeriod < current.endPeriod
|
|
) {
|
|
current.endPeriod = Math.max(current.endPeriod, endPeriod);
|
|
current.periodCount = current.endPeriod - current.startPeriod;
|
|
current.entries.push(entry);
|
|
return;
|
|
}
|
|
groups.push({
|
|
key: `${dayOfWeek}-${entry.startPeriod}-${groups.length}`,
|
|
dayOfWeek,
|
|
startPeriod: entry.startPeriod,
|
|
endPeriod,
|
|
periodCount: entry.periodCount,
|
|
entries: [entry],
|
|
});
|
|
});
|
|
});
|
|
return groups;
|
|
});
|
|
const flexibleTimetableOfferings = computed(() =>
|
|
timetableOfferings.value.filter((offering) => offering.isFlexible),
|
|
);
|
|
const previewConflictNames = computed(() =>
|
|
previewOffering.value
|
|
? conflictingSelectedCourses(previewOffering.value)
|
|
: [],
|
|
);
|
|
|
|
function formatDateTime(value: string) {
|
|
if (!value) return "—";
|
|
return new Intl.DateTimeFormat(getDisplayLocale(), {
|
|
month: "2-digit",
|
|
day: "2-digit",
|
|
hour: "2-digit",
|
|
minute: "2-digit",
|
|
hour12: false,
|
|
}).format(new Date(value));
|
|
}
|
|
|
|
function roundGradeLabel(round: any) {
|
|
const grades = (round?.eligibleGrades ?? []).map(Number);
|
|
return grades.length
|
|
? grades
|
|
.map((grade: number) =>
|
|
t("courseSelectionScript.year", { year: grade }),
|
|
)
|
|
.join("、")
|
|
: t("courseSelectionScript.allYears");
|
|
}
|
|
|
|
function roundLimitLabel(round: any) {
|
|
const courseLimit = round?.maxCourseCount
|
|
? t("courseSelectionScript.courseLimit", { count: round.maxCourseCount })
|
|
: t("courseSelectionScript.noCourseCountLimit");
|
|
return t("courseSelectionScript.round", {
|
|
grades: roundGradeLabel(round),
|
|
limit: courseLimit,
|
|
credits: round.maxCredits,
|
|
});
|
|
}
|
|
|
|
function toPickerValue(value: string) {
|
|
if (!value) return "";
|
|
const date = new Date(value);
|
|
const pad = (number: number) => String(number).padStart(2, "0");
|
|
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:00`;
|
|
}
|
|
|
|
function toIso(value: string) {
|
|
return new Date(value.replace(" ", "T")).toISOString();
|
|
}
|
|
|
|
function formatSchedule(schedule: any) {
|
|
const periods =
|
|
schedule.periodCount === 1
|
|
? t("courseSelectionScript.onePeriod", { start: schedule.startPeriod })
|
|
: t("courseSelectionScript.periods", {
|
|
start: schedule.startPeriod,
|
|
end: schedule.startPeriod + schedule.periodCount - 1,
|
|
});
|
|
return t("courseSelectionScript.schedule", {
|
|
day: weekdayLabels.value[schedule.dayOfWeek],
|
|
periods,
|
|
start: schedule.startWeek,
|
|
end: schedule.endWeek,
|
|
pattern:
|
|
schedule.weekPattern === "All"
|
|
? ""
|
|
: ` · ${patternLabels.value[schedule.weekPattern]}`,
|
|
room: schedule.classroomName,
|
|
});
|
|
}
|
|
|
|
async function loadRounds(keepSelection = true) {
|
|
loading.value = true;
|
|
try {
|
|
rounds.value = (await http.get("/course-selections/rounds")).data;
|
|
const previousId = keepSelection ? selectedRound.value?.id : undefined;
|
|
const preferred =
|
|
rounds.value.find((item) => item.id === previousId) ??
|
|
rounds.value.find((item) => item.isAvailableNow && item.termIsCurrent) ??
|
|
rounds.value.find((item) => item.termIsCurrent) ??
|
|
rounds.value.find((item) => item.isAvailableNow) ??
|
|
rounds.value[0];
|
|
if (preferred) await selectRound(preferred);
|
|
else {
|
|
selectedRound.value = null;
|
|
offerings.value = [];
|
|
}
|
|
} catch (error) {
|
|
ElMessage.error(apiErrorMessage(error));
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
}
|
|
|
|
async function selectRound(round: any) {
|
|
selectedRound.value = round;
|
|
offerings.value = [];
|
|
enrollments.value = [];
|
|
previewOfferingId.value = "";
|
|
detailLoading.value = true;
|
|
try {
|
|
if (isStudent.value) {
|
|
const [optionResponse, enrollmentResponse] = await Promise.all([
|
|
http.get("/course-selections/student/options", {
|
|
params: { roundId: round.id },
|
|
}),
|
|
http.get("/course-selections/student/enrollments", {
|
|
params: { academicTermId: round.academicTermId },
|
|
}),
|
|
]);
|
|
offerings.value = optionResponse.data.offerings;
|
|
enrollments.value = enrollmentResponse.data;
|
|
} else {
|
|
offerings.value = (
|
|
await http.get(`/course-selections/rounds/${round.id}/offerings`)
|
|
).data;
|
|
if (round.status === "Draft") await loadTasks(round.academicTermId);
|
|
}
|
|
} catch (error) {
|
|
ElMessage.error(apiErrorMessage(error));
|
|
} finally {
|
|
detailLoading.value = false;
|
|
}
|
|
}
|
|
|
|
async function loadTasks(academicTermId: string) {
|
|
const { data } = await http.get("/teaching-tasks/options", {
|
|
params: {
|
|
academicTermId,
|
|
status: "Published",
|
|
},
|
|
});
|
|
tasks.value = data;
|
|
}
|
|
|
|
function openRound(round?: any) {
|
|
editingRoundId.value = round?.id ?? "";
|
|
const now = new Date();
|
|
const ends = new Date(now.getTime() + 7 * 86400000);
|
|
const withdrawal = new Date(now.getTime() + 14 * 86400000);
|
|
Object.assign(roundForm, {
|
|
academicTermId: round?.academicTermId ?? defaultAcademicTermId(terms.value),
|
|
name: round?.name ?? "",
|
|
startsAt: round
|
|
? toPickerValue(round.startsAt)
|
|
: toPickerValue(now.toISOString()),
|
|
endsAt: round
|
|
? toPickerValue(round.endsAt)
|
|
: toPickerValue(ends.toISOString()),
|
|
withdrawalEndsAt: round
|
|
? toPickerValue(round.withdrawalEndsAt)
|
|
: toPickerValue(withdrawal.toISOString()),
|
|
maxCredits: round?.maxCredits ?? 30,
|
|
maxCourseCount: round?.maxCourseCount ?? undefined,
|
|
scope: round?.scope ?? "All",
|
|
eligibleGrades: [...(round?.eligibleGrades ?? [])],
|
|
notes: round?.notes ?? "",
|
|
});
|
|
roundDialog.value = true;
|
|
}
|
|
|
|
async function saveRound() {
|
|
if (!roundForm.academicTermId || !roundForm.name?.trim()) {
|
|
ElMessage.warning(
|
|
t("courseSelectionScript.selectATermAndEnterTheRoundName"),
|
|
);
|
|
return;
|
|
}
|
|
try {
|
|
const payload = {
|
|
...roundForm,
|
|
maxCourseCount: roundForm.maxCourseCount || null,
|
|
eligibleGrades: roundForm.eligibleGrades ?? [],
|
|
startsAt: toIso(roundForm.startsAt),
|
|
endsAt: toIso(roundForm.endsAt),
|
|
withdrawalEndsAt: toIso(roundForm.withdrawalEndsAt),
|
|
};
|
|
if (editingRoundId.value) {
|
|
await http.put(
|
|
`/course-selections/rounds/${editingRoundId.value}`,
|
|
payload,
|
|
);
|
|
} else {
|
|
await http.post("/course-selections/rounds", payload);
|
|
}
|
|
roundDialog.value = false;
|
|
ElMessage.success(
|
|
editingRoundId.value
|
|
? t("courseSelectionScript.enrollmentRoundUpdated")
|
|
: t("courseSelectionScript.enrollmentRoundDraftCreated"),
|
|
);
|
|
await loadRounds(false);
|
|
} catch (error) {
|
|
ElMessage.error(apiErrorMessage(error));
|
|
}
|
|
}
|
|
|
|
async function deleteRound(round: any) {
|
|
try {
|
|
await ElMessageBox.confirm(
|
|
t("courseSelectionScript.delete", { name: round.name }),
|
|
t("courseSelectionScript.deleteDraft"),
|
|
{
|
|
type: "warning",
|
|
},
|
|
);
|
|
await http.delete(`/course-selections/rounds/${round.id}`);
|
|
await loadRounds(false);
|
|
} catch (error: any) {
|
|
if (error !== "cancel" && error !== "close")
|
|
ElMessage.error(apiErrorMessage(error));
|
|
}
|
|
}
|
|
|
|
async function openSelection(round: any) {
|
|
try {
|
|
await ElMessageBox.confirm(
|
|
t(
|
|
"courseSelectionScript.openingLocksTheRoundAndClassSettingsStudentsCanEnrollDuringTheConfiguredWindow",
|
|
),
|
|
t("courseSelectionScript.openEnrollment"),
|
|
{
|
|
type: "warning",
|
|
confirmButtonText: t("courseSelectionScript.confirmOpening"),
|
|
cancelButtonText: t("courseSelectionScript.cancel"),
|
|
},
|
|
);
|
|
await http.post(`/course-selections/rounds/${round.id}/open`);
|
|
ElMessage.success(t("courseSelectionScript.enrollmentRoundOpened"));
|
|
await loadRounds();
|
|
} catch (error: any) {
|
|
if (error !== "cancel" && error !== "close")
|
|
ElMessage.error(apiErrorMessage(error));
|
|
}
|
|
}
|
|
|
|
async function closeSelection(round: any) {
|
|
try {
|
|
await ElMessageBox.confirm(
|
|
t(
|
|
"courseSelectionScript.afterClosingStudentsCannotEnrollOrWithdrawParticipantsWillReceiveTheirFinalResults",
|
|
),
|
|
t("courseSelectionScript.closeEnrollment"),
|
|
{
|
|
type: "warning",
|
|
confirmButtonText: t("courseSelectionScript.confirmClosing"),
|
|
cancelButtonText: t("courseSelectionScript.cancel"),
|
|
},
|
|
);
|
|
const { data } = await http.post(
|
|
`/course-selections/rounds/${round.id}/close`,
|
|
);
|
|
ElMessage.success(
|
|
t("courseSelectionScript.closed", { count: data.notifiedStudentCount }),
|
|
);
|
|
await loadRounds();
|
|
} catch (error: any) {
|
|
if (error !== "cancel" && error !== "close")
|
|
ElMessage.error(apiErrorMessage(error));
|
|
}
|
|
}
|
|
|
|
function openOffering(offering?: any) {
|
|
editingOfferingId.value = offering?.id ?? "";
|
|
Object.assign(offeringForm, {
|
|
teachingTaskId: offering?.teachingTaskId,
|
|
capacity: offering?.capacity ?? 60,
|
|
isOpenToAll: offering?.isOpenToAll ?? false,
|
|
notes: offering?.notes ?? "",
|
|
});
|
|
offeringDialog.value = true;
|
|
}
|
|
|
|
function onTaskChanged(taskId: string) {
|
|
const task = tasks.value.find((item) => item.id === taskId);
|
|
if (task) offeringForm.capacity = task.capacity;
|
|
}
|
|
|
|
async function saveOffering() {
|
|
if (!offeringForm.teachingTaskId) {
|
|
ElMessage.warning(
|
|
t("courseSelectionScript.selectATeachingClassToAddToEnrollment"),
|
|
);
|
|
return;
|
|
}
|
|
try {
|
|
const base = `/course-selections/rounds/${selectedRound.value.id}/offerings`;
|
|
if (editingOfferingId.value) {
|
|
await http.put(`${base}/${editingOfferingId.value}`, offeringForm);
|
|
} else {
|
|
await http.post(base, offeringForm);
|
|
}
|
|
offeringDialog.value = false;
|
|
ElMessage.success(
|
|
editingOfferingId.value
|
|
? t("courseSelectionScript.teachingClassSettingsUpdated")
|
|
: t("courseSelectionScript.teachingClassAddedToThisRound"),
|
|
);
|
|
await selectRound(selectedRound.value);
|
|
await loadRounds();
|
|
} catch (error) {
|
|
ElMessage.error(apiErrorMessage(error));
|
|
}
|
|
}
|
|
|
|
async function deleteOffering(offering: any) {
|
|
try {
|
|
await ElMessageBox.confirm(
|
|
t("courseSelectionScript.removeOffering", { name: offering.taskName }),
|
|
t("courseSelectionScript.removeTeachingClass"),
|
|
{
|
|
type: "warning",
|
|
},
|
|
);
|
|
await http.delete(
|
|
`/course-selections/rounds/${selectedRound.value.id}/offerings/${offering.id}`,
|
|
);
|
|
await selectRound(selectedRound.value);
|
|
} catch (error: any) {
|
|
if (error !== "cancel" && error !== "close")
|
|
ElMessage.error(apiErrorMessage(error));
|
|
}
|
|
}
|
|
|
|
async function showRoster(offering: any) {
|
|
rosterKeyword.value = "";
|
|
rosterGrade.value = undefined;
|
|
rosterMajorId.value = undefined;
|
|
rosterClassId.value = undefined;
|
|
rosterStudentPage.value = 1;
|
|
rosterWaitlistPage.value = 1;
|
|
rosterDrawer.value = true;
|
|
await loadRoster(offering.id);
|
|
}
|
|
|
|
async function loadRoster(offeringId: string) {
|
|
rosterLoading.value = true;
|
|
try {
|
|
roster.value = (
|
|
await http.get(`/course-selections/offerings/${offeringId}/roster`, {
|
|
params: {
|
|
keyword: rosterKeyword.value.trim() || undefined,
|
|
grade: rosterGrade.value,
|
|
majorId: rosterMajorId.value,
|
|
administrativeClassId: rosterClassId.value,
|
|
studentPage: rosterStudentPage.value,
|
|
studentPageSize: rosterPageSize,
|
|
waitlistPage: rosterWaitlistPage.value,
|
|
waitlistPageSize: rosterPageSize,
|
|
},
|
|
})
|
|
).data;
|
|
} catch (error) {
|
|
ElMessage.error(apiErrorMessage(error));
|
|
} finally {
|
|
rosterLoading.value = false;
|
|
}
|
|
}
|
|
|
|
function filterRoster() {
|
|
rosterStudentPage.value = 1;
|
|
rosterWaitlistPage.value = 1;
|
|
if (roster.value) void loadRoster(roster.value.id);
|
|
}
|
|
|
|
async function openProxyEnrollment() {
|
|
studentKeyword.value = "";
|
|
selectedStudentIds.value = [];
|
|
eligiblePage.value = 1;
|
|
proxyDialog.value = true;
|
|
await loadEligibleStudents();
|
|
}
|
|
|
|
async function loadEligibleStudents(page = eligiblePage.value) {
|
|
if (!roster.value) return;
|
|
eligibleLoading.value = true;
|
|
eligiblePage.value = page;
|
|
try {
|
|
const { data } = await http.get(
|
|
`/course-selections/offerings/${roster.value.id}/eligible-students`,
|
|
{
|
|
params: {
|
|
keyword: studentKeyword.value.trim() || undefined,
|
|
page,
|
|
pageSize: 20,
|
|
},
|
|
},
|
|
);
|
|
eligibleStudents.value = data.items;
|
|
eligibleTotal.value = data.total;
|
|
} catch (error) {
|
|
ElMessage.error(apiErrorMessage(error));
|
|
} finally {
|
|
eligibleLoading.value = false;
|
|
}
|
|
}
|
|
|
|
function onEligibleSelectionChanged(rows: any[]) {
|
|
selectedStudentIds.value = rows.map((item) => item.id);
|
|
}
|
|
|
|
async function proxyEnroll() {
|
|
if (!roster.value || selectedStudentIds.value.length === 0) {
|
|
ElMessage.warning(t("courseSelectionScript.selectAtLeastOneStudent"));
|
|
return;
|
|
}
|
|
proxySubmitting.value = true;
|
|
try {
|
|
const { data } = await http.post(
|
|
`/course-selections/offerings/${roster.value.id}/admin-enrollments`,
|
|
{ studentIds: selectedStudentIds.value },
|
|
);
|
|
ElMessage.success(
|
|
t("courseSelectionScript.enrolled", { count: data.enrolledCount }),
|
|
);
|
|
proxyDialog.value = false;
|
|
await loadRoster(roster.value.id);
|
|
if (selectedRound.value) await selectRound(selectedRound.value);
|
|
} catch (error) {
|
|
ElMessage.error(apiErrorMessage(error));
|
|
} finally {
|
|
proxySubmitting.value = false;
|
|
}
|
|
}
|
|
|
|
const forceDialog = ref(false);
|
|
const forceSubmitting = ref(false);
|
|
|
|
function openForceEnrollment() {
|
|
studentKeyword.value = "";
|
|
selectedStudentIds.value = [];
|
|
eligiblePage.value = 1;
|
|
forceDialog.value = true;
|
|
loadForceEligibleStudents();
|
|
}
|
|
|
|
async function loadForceEligibleStudents(page = eligiblePage.value) {
|
|
if (!roster.value) return;
|
|
eligibleLoading.value = true;
|
|
eligiblePage.value = page;
|
|
try {
|
|
const { data } = await http.get(
|
|
`/course-selections/offerings/${roster.value.id}/eligible-students`,
|
|
{
|
|
params: {
|
|
keyword: studentKeyword.value.trim() || undefined,
|
|
page,
|
|
pageSize: 20,
|
|
forceMode: true,
|
|
},
|
|
},
|
|
);
|
|
eligibleStudents.value = data.items;
|
|
eligibleTotal.value = data.total;
|
|
} catch (error) {
|
|
ElMessage.error(apiErrorMessage(error));
|
|
} finally {
|
|
eligibleLoading.value = false;
|
|
}
|
|
}
|
|
|
|
async function forceEnrollSubmit() {
|
|
if (!roster.value || selectedStudentIds.value.length === 0) {
|
|
ElMessage.warning(t("courseSelectionScript.selectAtLeastOneStudent"));
|
|
return;
|
|
}
|
|
forceSubmitting.value = true;
|
|
try {
|
|
const { data } = await http.post(
|
|
`/course-selections/offerings/${roster.value.id}/force-enroll`,
|
|
{ studentIds: selectedStudentIds.value },
|
|
);
|
|
ElMessage.success(
|
|
t("courseSelectionScript.forced", { count: data.enrolledCount }),
|
|
);
|
|
forceDialog.value = false;
|
|
await loadRoster(roster.value.id);
|
|
if (selectedRound.value) await selectRound(selectedRound.value);
|
|
} catch (error) {
|
|
ElMessage.error(apiErrorMessage(error));
|
|
} finally {
|
|
forceSubmitting.value = false;
|
|
}
|
|
}
|
|
|
|
async function removeFromRoster(student: any) {
|
|
if (!roster.value) return;
|
|
try {
|
|
await ElMessageBox.confirm(
|
|
t("courseSelectionScript.removeStudent", {
|
|
number: student.studentNumber,
|
|
name: student.name,
|
|
course: roster.value.courseName,
|
|
}),
|
|
t("courseSelectionScript.adjustClassRoster"),
|
|
{
|
|
type: "warning",
|
|
confirmButtonText: t("courseSelectionScript.confirmRemoval"),
|
|
cancelButtonText: t("courseSelectionScript.cancel"),
|
|
},
|
|
);
|
|
await http.delete(
|
|
`/course-selections/offerings/${roster.value.id}/admin-enrollments/${student.id}`,
|
|
);
|
|
ElMessage.success(t("courseSelectionScript.removedFromTheClassRoster"));
|
|
await loadRoster(roster.value.id);
|
|
if (selectedRound.value) await selectRound(selectedRound.value);
|
|
} catch (error: any) {
|
|
if (error !== "cancel" && error !== "close")
|
|
ElMessage.error(apiErrorMessage(error));
|
|
}
|
|
}
|
|
|
|
async function removeFromWaitlist(student: any) {
|
|
if (!roster.value) return;
|
|
try {
|
|
await ElMessageBox.confirm(
|
|
t("courseSelectionScript.removeWaitlist", {
|
|
number: student.studentNumber,
|
|
name: student.name,
|
|
course: roster.value.courseName,
|
|
}),
|
|
t("courseSelectionScript.adjustWaitlist"),
|
|
{
|
|
type: "warning",
|
|
confirmButtonText: t("courseSelectionScript.confirmRemoval"),
|
|
cancelButtonText: t("courseSelectionScript.cancel"),
|
|
},
|
|
);
|
|
await http.delete(
|
|
`/course-selections/offerings/${roster.value.id}/waitlist/${student.id}`,
|
|
);
|
|
ElMessage.success(t("courseSelectionScript.removedFromTheWaitlist"));
|
|
await loadRoster(roster.value.id);
|
|
if (selectedRound.value) await selectRound(selectedRound.value);
|
|
} catch (error: any) {
|
|
if (error !== "cancel" && error !== "close")
|
|
ElMessage.error(apiErrorMessage(error));
|
|
}
|
|
}
|
|
|
|
async function enroll(offering: any) {
|
|
try {
|
|
await http.post("/course-selections/student/enrollments", {
|
|
offeringId: offering.id,
|
|
});
|
|
ElMessage.success(
|
|
t("courseSelectionScript.selected", { course: offering.courseName }),
|
|
);
|
|
await selectRound(selectedRound.value);
|
|
} catch (error) {
|
|
ElMessage.error(apiErrorMessage(error));
|
|
}
|
|
}
|
|
|
|
async function joinWaitlist(offering: any) {
|
|
try {
|
|
const { data } = await http.post("/course-selections/student/waitlist", {
|
|
offeringId: offering.id,
|
|
});
|
|
ElMessage.success(
|
|
t("courseSelectionScript.waitlisted", {
|
|
course: offering.courseName,
|
|
position: data.position,
|
|
}),
|
|
);
|
|
await selectRound(selectedRound.value);
|
|
} catch (error) {
|
|
ElMessage.error(apiErrorMessage(error));
|
|
}
|
|
}
|
|
|
|
function togglePreview(offering: any) {
|
|
previewOfferingId.value =
|
|
previewOfferingId.value === offering.id ? "" : offering.id;
|
|
}
|
|
|
|
async function withdraw(offering: any) {
|
|
const enrollment = enrollments.value.find(
|
|
(item) =>
|
|
item.courseSelectionOfferingId === offering.id &&
|
|
item.status === "Enrolled",
|
|
);
|
|
if (!enrollment) return;
|
|
try {
|
|
await ElMessageBox.confirm(
|
|
t("courseSelectionScript.withdraw", { course: offering.courseName }),
|
|
t("courseSelectionScript.confirmWithdrawal"),
|
|
{
|
|
type: "warning",
|
|
confirmButtonText: t("courseSelectionScript.confirmWithdrawal2"),
|
|
cancelButtonText: t("courseSelectionScript.keepEnrollment"),
|
|
},
|
|
);
|
|
await http.delete(
|
|
`/course-selections/student/enrollments/${enrollment.id}`,
|
|
);
|
|
ElMessage.success(t("enrollmentManagement.statuses.Withdrawn"));
|
|
await selectRound(selectedRound.value);
|
|
} catch (error: any) {
|
|
if (error !== "cancel" && error !== "close")
|
|
ElMessage.error(apiErrorMessage(error));
|
|
}
|
|
}
|
|
|
|
async function cancelWaitlist(offering: any) {
|
|
const enrollment = enrollments.value.find(
|
|
(item) =>
|
|
item.courseSelectionOfferingId === offering.id &&
|
|
item.status === "Waitlisted",
|
|
);
|
|
if (!enrollment) return;
|
|
try {
|
|
await ElMessageBox.confirm(
|
|
t("courseSelectionScript.cancelWaitlist", {
|
|
course: offering.courseName,
|
|
}),
|
|
t("courseSelectionScript.cancelWaitlist2"),
|
|
{
|
|
type: "warning",
|
|
confirmButtonText: t("courseSelectionScript.confirmCancellation"),
|
|
cancelButtonText: t("courseSelectionScript.stayOnWaitlist"),
|
|
},
|
|
);
|
|
await http.delete(
|
|
`/course-selections/student/enrollments/${enrollment.id}`,
|
|
);
|
|
ElMessage.success(t("courseSelectionScript.waitlistCancelled"));
|
|
await selectRound(selectedRound.value);
|
|
} catch (error: any) {
|
|
if (error !== "cancel" && error !== "close")
|
|
ElMessage.error(apiErrorMessage(error));
|
|
}
|
|
}
|
|
|
|
onMounted(async () => {
|
|
try {
|
|
if (isManager.value) {
|
|
const [termResponse, optionResponse] = await Promise.all([
|
|
http.get("/base-data/terms"),
|
|
canManageRounds.value
|
|
? http.get("/course-selections/configuration-options")
|
|
: Promise.resolve({ data: { grades: [] } }),
|
|
]);
|
|
terms.value = termResponse.data;
|
|
gradeOptions.value = optionResponse.data.grades;
|
|
}
|
|
await loadRounds(false);
|
|
} catch (error) {
|
|
ElMessage.error(apiErrorMessage(error));
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div class="page-stack selection-page">
|
|
<section class="page-intro">
|
|
<div>
|
|
<span class="section-kicker">COURSE REGISTRATION</span>
|
|
<h2>
|
|
{{
|
|
isStudent
|
|
? t("selectionTemplate.courseSelection")
|
|
: t("dashboard.admin.actions.selections.label")
|
|
}}
|
|
</h2>
|
|
<p v-if="isStudent">
|
|
{{
|
|
t(
|
|
"selectionTemplate.selectCoursesDuringTheOpenWindowCapacityCreditsAndScheduleConflictsAreCheckedInRealTime",
|
|
)
|
|
}}
|
|
</p>
|
|
<p v-else>
|
|
{{
|
|
t(
|
|
"selectionTemplate.setSelectionWindowsOfferTeachingClassesAndMonitorCapacityUsingLiveRosters",
|
|
)
|
|
}}
|
|
</p>
|
|
</div>
|
|
<el-button
|
|
v-if="canManageRounds"
|
|
type="primary"
|
|
:icon="Plus"
|
|
@click="openRound()"
|
|
>
|
|
{{ t("selectionTemplate.newSelectionRound") }}
|
|
</el-button>
|
|
<el-button v-else :icon="Refresh" @click="loadRounds()">{{
|
|
t("selectionTemplate.refreshAvailability")
|
|
}}</el-button>
|
|
</section>
|
|
|
|
<section
|
|
v-if="rounds.length"
|
|
class="selection-round-strip"
|
|
v-loading="loading"
|
|
>
|
|
<button
|
|
v-for="round in rounds"
|
|
:key="round.id"
|
|
type="button"
|
|
:class="{
|
|
active: selectedRound?.id === round.id,
|
|
'historical-record': !round.termIsCurrent && !round.termIsArchived,
|
|
'archived-record': round.termIsArchived,
|
|
}"
|
|
@click="selectRound(round)"
|
|
>
|
|
<span>{{ round.termName }}</span>
|
|
<b>{{ round.name }}</b>
|
|
<small
|
|
>{{ formatDateTime(round.startsAt) }} —
|
|
{{ formatDateTime(round.endsAt) }}</small
|
|
>
|
|
<small>{{ roundLimitLabel(round) }}</small>
|
|
<small>{{
|
|
scopeLabels[round.scope] ?? t("selectionTemplate.regularSelection")
|
|
}}</small>
|
|
<i :class="round.status.toLowerCase()">{{
|
|
statusLabels[round.status]
|
|
}}</i>
|
|
</button>
|
|
</section>
|
|
|
|
<template v-if="selectedRound">
|
|
<section class="selection-window">
|
|
<div class="window-seal">
|
|
<el-icon><Clock /></el-icon>
|
|
<span>{{
|
|
selectedRound.isAvailableNow
|
|
? t("selectionTemplate.openNow")
|
|
: statusLabels[selectedRound.status]
|
|
}}</span>
|
|
</div>
|
|
<div class="window-copy">
|
|
<span>SELECTION WINDOW · {{ selectedRound.termName }}</span>
|
|
<h3>{{ selectedRound.name }}</h3>
|
|
<p>
|
|
{{ t("calendar.kinds.course") }}
|
|
{{ formatDateTime(selectedRound.startsAt) }}—{{
|
|
formatDateTime(selectedRound.endsAt)
|
|
}}
|
|
<em>{{
|
|
t("selectionTemplate.withdrawalDeadlineTime", {
|
|
time: formatDateTime(selectedRound.withdrawalEndsAt),
|
|
})
|
|
}}</em>
|
|
<em>{{ roundLimitLabel(selectedRound) }}</em>
|
|
<em>{{
|
|
scopeLabels[selectedRound.scope] ??
|
|
t("selectionTemplate.regularSelection")
|
|
}}</em>
|
|
</p>
|
|
</div>
|
|
<div v-if="isStudent" class="credit-meter">
|
|
<div>
|
|
<span>{{ t("selectionTemplate.selectedCredits") }}</span>
|
|
<b>{{ selectedCredits }}</b>
|
|
<small>/ {{ selectedRound.maxCredits }}</small>
|
|
</div>
|
|
<div class="credit-track">
|
|
<i :style="{ width: `${creditPercent}%` }" />
|
|
</div>
|
|
<p>
|
|
{{
|
|
t("selectionTemplate.selectedMaxCoursesCreditsCreditsRemaining", {
|
|
selected: selectedCount,
|
|
max: selectedRound.maxCourseCount
|
|
? ` / ${selectedRound.maxCourseCount}`
|
|
: "",
|
|
credits: Math.max(
|
|
0,
|
|
selectedRound.maxCredits - selectedCredits,
|
|
),
|
|
})
|
|
}}
|
|
</p>
|
|
</div>
|
|
<div v-else class="round-actions">
|
|
<el-button
|
|
v-if="canManageRounds && selectedRound.status === 'Draft'"
|
|
@click="openRound(selectedRound)"
|
|
>{{ t("selectionTemplate.editRound") }}</el-button
|
|
>
|
|
<el-button
|
|
v-if="canManageRounds && selectedRound.status === 'Draft'"
|
|
type="success"
|
|
@click="openSelection(selectedRound)"
|
|
>{{ t("selectionTemplate.openSelection") }}</el-button
|
|
>
|
|
<el-button
|
|
v-if="canManageRounds && selectedRound.status === 'Open'"
|
|
type="warning"
|
|
@click="closeSelection(selectedRound)"
|
|
>{{ t("selectionTemplate.closeSelection") }}</el-button
|
|
>
|
|
<el-button
|
|
v-if="canManageRounds && selectedRound.status === 'Draft'"
|
|
type="danger"
|
|
plain
|
|
@click="deleteRound(selectedRound)"
|
|
>{{ t("workflowBatch.deleteDraft") }}</el-button
|
|
>
|
|
</div>
|
|
</section>
|
|
|
|
<section v-if="isManager" class="data-card" v-loading="detailLoading">
|
|
<div class="selection-ledger-head">
|
|
<div>
|
|
<span>OFFERING LEDGER</span>
|
|
<h3>{{ t("selectionTemplate.teachingClassesInThisRound") }}</h3>
|
|
<p>
|
|
{{
|
|
t(
|
|
"selectionTemplate.countTeachingClassesConfigurationLocksAfterOpeningRostersUpdateAsStudentsAddOrDropCourses",
|
|
{ count: offerings.length },
|
|
)
|
|
}}
|
|
</p>
|
|
</div>
|
|
<el-button
|
|
v-if="selectedRound.status === 'Draft'"
|
|
type="primary"
|
|
:icon="Plus"
|
|
@click="openOffering()"
|
|
>{{ t("selectionTemplate.addTeachingClass") }}</el-button
|
|
>
|
|
</div>
|
|
<el-table :data="offerings" class="data-table">
|
|
<el-table-column
|
|
:label="t('batchBusiness.teachingClassCourse')"
|
|
min-width="260"
|
|
>
|
|
<template #default="{ row }">
|
|
<div class="course-name">
|
|
<b>{{ row.taskName }}</b>
|
|
<span
|
|
>{{ row.taskNumber }} · {{ row.courseCode }}
|
|
{{ row.courseName }}</span
|
|
>
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
:label="t('selectionTemplate.instructorAdministrativeClass')"
|
|
min-width="200"
|
|
>
|
|
<template #default="{ row }">
|
|
<div class="course-name">
|
|
<b>{{
|
|
row.teacherNames.join(t("academicPlanning.separator")) ||
|
|
t("selectionTemplate.notAssigned")
|
|
}}</b>
|
|
<span>
|
|
{{
|
|
row.isOpenToAll
|
|
? t("courseStats.universityStudents")
|
|
: row.classNames.join(t("academicPlanning.separator"))
|
|
}}
|
|
· {{ roundGradeLabel(selectedRound) }}
|
|
</span>
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
:label="t('businessLabels.credits')"
|
|
width="75"
|
|
prop="credits"
|
|
/>
|
|
<el-table-column
|
|
:label="t('batchBusiness.rosterCapacity')"
|
|
width="145"
|
|
>
|
|
<template #default="{ row }">
|
|
<b class="capacity-number"
|
|
>{{ row.enrolledCount }} / {{ row.capacity }}</b
|
|
>
|
|
<small v-if="row.waitlistedCount" class="waitlist-count">
|
|
{{
|
|
t("selectionTemplate.countWaitlisted", {
|
|
count: row.waitlistedCount,
|
|
})
|
|
}}
|
|
</small>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
:label="t('businessLabels.actions')"
|
|
width="190"
|
|
fixed="right"
|
|
>
|
|
<template #default="{ row }">
|
|
<el-button link type="primary" @click="showRoster(row)">{{
|
|
t("selectionTemplate.manageRoster")
|
|
}}</el-button>
|
|
<el-button
|
|
v-if="selectedRound.status === 'Draft'"
|
|
link
|
|
type="primary"
|
|
@click="openOffering(row)"
|
|
>{{ t("businessLabels.edit") }}</el-button
|
|
>
|
|
<el-button
|
|
v-if="selectedRound.status === 'Draft'"
|
|
link
|
|
type="danger"
|
|
@click="deleteOffering(row)"
|
|
>{{ t("businessLabels.remove") }}</el-button
|
|
>
|
|
</template>
|
|
</el-table-column>
|
|
<template #empty
|
|
><el-empty
|
|
:description="
|
|
t('batchBusiness.noTeachingClassesAddedToThisRound')
|
|
"
|
|
/></template>
|
|
</el-table>
|
|
</section>
|
|
|
|
<template v-else>
|
|
<section
|
|
class="data-card selection-timetable-card"
|
|
v-loading="detailLoading"
|
|
>
|
|
<div class="selection-timetable-head">
|
|
<div>
|
|
<span>WEEKLY ARRANGEMENT</span>
|
|
<h3>{{ t("selectionTemplate.selectedTimetable") }}</h3>
|
|
<p>
|
|
{{
|
|
selectedCount
|
|
? t("selectionTemplate.countCoursesScheduled", {
|
|
count: selectedCount,
|
|
})
|
|
: t(
|
|
"selectionTemplate.selectCoursesToBuildAWeeklyTimetableHere",
|
|
)
|
|
}}
|
|
<template v-if="previewOffering">
|
|
{{
|
|
t("selectionTemplate.previewingName", {
|
|
name: previewOffering.courseName,
|
|
})
|
|
}}
|
|
</template>
|
|
</p>
|
|
</div>
|
|
<el-button
|
|
v-if="previewOffering"
|
|
plain
|
|
@click="previewOfferingId = ''"
|
|
>{{ t("selectionTemplate.endPreview") }}</el-button
|
|
>
|
|
</div>
|
|
<el-alert
|
|
v-if="previewConflictNames.length"
|
|
class="selection-preview-alert"
|
|
type="error"
|
|
:closable="false"
|
|
:title="
|
|
t(
|
|
'selectionTemplate.thePreviewConflictsWithNamesTheyCannotBeSelectedTogether',
|
|
{
|
|
names: previewConflictNames.join(
|
|
t('academicPlanning.separator'),
|
|
),
|
|
},
|
|
)
|
|
"
|
|
/>
|
|
<div class="selection-timetable-scroll">
|
|
<div
|
|
class="selection-timetable-grid"
|
|
:style="{
|
|
gridTemplateRows: `42px repeat(${timetablePeriodCount}, 64px)`,
|
|
}"
|
|
>
|
|
<div class="timetable-corner">
|
|
<el-icon><Calendar /></el-icon>
|
|
{{ t("attendanceBatch.period") }}
|
|
</div>
|
|
<div
|
|
v-for="day in 7"
|
|
:key="`day-${day}`"
|
|
class="timetable-day"
|
|
:style="{ gridColumn: day + 1, gridRow: 1 }"
|
|
>
|
|
{{ weekdayLabels[day] }}
|
|
</div>
|
|
<div
|
|
v-for="period in timetablePeriods"
|
|
:key="`period-${period}`"
|
|
class="timetable-period"
|
|
:style="{ gridColumn: 1, gridRow: period + 1 }"
|
|
>
|
|
<b>{{ period }}</b>
|
|
<span>{{
|
|
t("selectionTemplate.periodPeriod", { period })
|
|
}}</span>
|
|
</div>
|
|
<div
|
|
v-for="cell in timetableCells"
|
|
:key="cell.key"
|
|
class="timetable-cell"
|
|
:style="{
|
|
gridColumn: cell.dayOfWeek + 1,
|
|
gridRow: cell.period + 1,
|
|
}"
|
|
/>
|
|
<div
|
|
v-for="group in timetableGroups"
|
|
:key="group.key"
|
|
:class="[
|
|
'timetable-course',
|
|
{ multiple: group.entries.length > 1 },
|
|
]"
|
|
:style="{
|
|
gridColumn: group.dayOfWeek + 1,
|
|
gridRow: `${group.startPeriod + 1} / span ${group.periodCount}`,
|
|
}"
|
|
>
|
|
<article
|
|
v-for="entry in group.entries"
|
|
:key="`${entry.taskNumber}-${entry.startWeek}-${entry.weekPattern}`"
|
|
:class="[
|
|
`tone-${entry.tone}`,
|
|
{ preview: entry.isPreview, conflict: entry.hasConflict },
|
|
]"
|
|
>
|
|
<b>{{ entry.courseName }}</b>
|
|
<span>
|
|
{{
|
|
t("selectionTemplate.weeksStartEnd", {
|
|
start: entry.startWeek,
|
|
end: entry.endWeek,
|
|
})
|
|
}}
|
|
{{
|
|
entry.weekPattern === "All"
|
|
? ""
|
|
: patternLabels[entry.weekPattern]
|
|
}}
|
|
</span>
|
|
<small>{{ entry.classroomName }}</small>
|
|
</article>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div
|
|
v-if="flexibleTimetableOfferings.length"
|
|
class="flexible-course-row"
|
|
>
|
|
<b>{{ t("workflowBatch.flexibleCourse") }}</b>
|
|
<span
|
|
v-for="offering in flexibleTimetableOfferings"
|
|
:key="offering.id"
|
|
:class="{ preview: offering.id === previewOfferingId }"
|
|
>
|
|
{{
|
|
t("selectionTemplate.courseNoFixedPeriodOrClassroom", {
|
|
course: offering.courseName,
|
|
})
|
|
}}
|
|
</span>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="data-card selection-catalog">
|
|
<div class="selection-catalog-head">
|
|
<div>
|
|
<span>AVAILABLE CLASSES</span>
|
|
<h3>{{ t("selectionTemplate.availableTeachingClasses") }}</h3>
|
|
<p>
|
|
{{
|
|
t(
|
|
"selectionTemplate.previewSchedulesBeforeSelectingUseRetakeEligibleToFindCoursesPreviouslyFailedAndNotYetPassedTheServerChecksAgainOnSubmission",
|
|
)
|
|
}}
|
|
</p>
|
|
</div>
|
|
<b>{{ filteredOfferings.length }} / {{ offerings.length }}</b>
|
|
</div>
|
|
<div class="selection-catalog-filter">
|
|
<el-input
|
|
v-model="offeringKeyword"
|
|
:prefix-icon="Search"
|
|
clearable
|
|
:placeholder="
|
|
t(
|
|
'batchBusiness.searchCourseCodeCourseNameTeachingClassOrInstructor',
|
|
)
|
|
"
|
|
/>
|
|
<el-segmented
|
|
v-model="offeringStatus"
|
|
:options="[
|
|
{ label: t('selectionTemplate.all'), value: 'All' },
|
|
{
|
|
label: t('selectionTemplate.available'),
|
|
value: 'Selectable',
|
|
},
|
|
{
|
|
label: t('selectionTemplate.retakeEligible'),
|
|
value: 'Retake',
|
|
},
|
|
{ label: t('selectionTemplate.waitlist'), value: 'Waitlisted' },
|
|
{ label: t('selectionTemplate.selected'), value: 'Selected' },
|
|
{ label: t('selectionTemplate.restricted'), value: 'Blocked' },
|
|
]"
|
|
/>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="offering-grid" v-loading="detailLoading">
|
|
<article
|
|
v-for="offering in filteredOfferings"
|
|
:key="offering.id"
|
|
:class="[
|
|
'offering-ticket',
|
|
{
|
|
selected: offering.enrollmentStatus === 'Enrolled',
|
|
waitlisted: offering.enrollmentStatus === 'Waitlisted',
|
|
previewing: offering.id === previewOfferingId,
|
|
blocked:
|
|
!['Enrolled', 'Waitlisted'].includes(
|
|
offering.enrollmentStatus,
|
|
) && offeringEligibilityReason(offering),
|
|
},
|
|
]"
|
|
>
|
|
<header>
|
|
<div>
|
|
<span
|
|
>{{ offering.courseCode }} · {{ offering.taskNumber }}</span
|
|
>
|
|
<h3>{{ offering.courseName }}</h3>
|
|
<p>
|
|
{{
|
|
t("selectionTemplate.teachersCreditsCredits", {
|
|
teachers:
|
|
offering.teacherNames.join(
|
|
t("academicPlanning.separator"),
|
|
) || t("selectionTemplate.instructorToBeAssigned"),
|
|
credits: offering.credits,
|
|
})
|
|
}}
|
|
<el-tag
|
|
v-if="
|
|
offering.isRetake &&
|
|
offering.enrollmentStatus !== 'Enrolled'
|
|
"
|
|
size="small"
|
|
type="warning"
|
|
effect="plain"
|
|
style="margin-left: 6px"
|
|
>{{ t("selectionTemplate.retakeEligible") }}</el-tag
|
|
>
|
|
</p>
|
|
</div>
|
|
<i
|
|
v-if="offering.enrollmentStatus === 'Enrolled'"
|
|
class="selected-mark"
|
|
>
|
|
<el-icon><CircleCheck /></el-icon>
|
|
{{ t("selectionTemplate.selected") }}
|
|
</i>
|
|
<el-tag
|
|
v-else-if="offering.enrollmentStatus === 'Waitlisted'"
|
|
type="warning"
|
|
effect="dark"
|
|
>{{
|
|
t("selectionTemplate.waitlistPositionPosition", {
|
|
position: offering.waitlistPosition,
|
|
})
|
|
}}</el-tag
|
|
>
|
|
</header>
|
|
<div class="ticket-schedules">
|
|
<div
|
|
v-for="schedule in offering.schedules ?? []"
|
|
:key="formatSchedule(schedule)"
|
|
>
|
|
<el-icon><Tickets /></el-icon>
|
|
<span>{{ formatSchedule(schedule) }}</span>
|
|
</div>
|
|
<span v-if="offering.isFlexible" class="schedule-missing">
|
|
{{ t("selectionTemplate.flexibleCourseNoFixedTimeOrRoom") }}
|
|
</span>
|
|
<span
|
|
v-else-if="!(offering.schedules ?? []).length"
|
|
class="schedule-missing"
|
|
>{{ t("selectionTemplate.timetableNotYetPublished") }}</span
|
|
>
|
|
</div>
|
|
<div
|
|
v-if="
|
|
!['Enrolled', 'Waitlisted'].includes(
|
|
offering.enrollmentStatus,
|
|
) && offeringBlockReason(offering)
|
|
"
|
|
class="selection-block-reason"
|
|
>
|
|
{{ offeringBlockReason(offering) }}
|
|
</div>
|
|
<footer>
|
|
<div class="seat-meter">
|
|
<template
|
|
v-if="
|
|
offering.isRetake &&
|
|
offering.enrollmentStatus !== 'Enrolled'
|
|
"
|
|
>
|
|
<span>{{
|
|
t(
|
|
"selectionTemplate.remainingCapacitySeatsLeftRetakeExpansion",
|
|
{
|
|
remaining: Math.max(
|
|
0,
|
|
Math.ceil(offering.capacity * 1.15) -
|
|
offering.enrolledCount,
|
|
),
|
|
capacity: Math.ceil(offering.capacity * 1.15),
|
|
},
|
|
)
|
|
}}</span>
|
|
<div>
|
|
<i
|
|
:style="{
|
|
width: `${Math.min(100, (offering.enrolledCount / Math.ceil(offering.capacity * 1.15)) * 100)}%`,
|
|
}"
|
|
/>
|
|
</div>
|
|
</template>
|
|
<template v-else>
|
|
<span>{{
|
|
t("selectionTemplate.remainingCapacitySeatsLeft", {
|
|
remaining: Math.max(
|
|
0,
|
|
offering.capacity - offering.enrolledCount,
|
|
),
|
|
capacity: offering.capacity,
|
|
})
|
|
}}</span>
|
|
<div>
|
|
<i
|
|
:style="{
|
|
width: `${Math.min(100, (offering.enrolledCount / offering.capacity) * 100)}%`,
|
|
}"
|
|
/>
|
|
</div>
|
|
</template>
|
|
<small v-if="offering.waitlistedCount">
|
|
{{
|
|
t("selectionTemplate.countCurrentlyWaitlisted", {
|
|
count: offering.waitlistedCount,
|
|
})
|
|
}}
|
|
</small>
|
|
</div>
|
|
<el-button
|
|
v-if="(offering.schedules ?? []).length || offering.isFlexible"
|
|
text
|
|
:type="
|
|
offering.id === previewOfferingId ? 'warning' : 'primary'
|
|
"
|
|
@click="togglePreview(offering)"
|
|
>{{
|
|
offering.id === previewOfferingId
|
|
? t("selectionTemplate.cancelPreview")
|
|
: t("selectionTemplate.previewTimetable")
|
|
}}</el-button
|
|
>
|
|
<el-button
|
|
v-if="offering.enrollmentStatus === 'Enrolled'"
|
|
type="danger"
|
|
plain
|
|
:disabled="selectedRound.status !== 'Open'"
|
|
@click="withdraw(offering)"
|
|
>{{ t("enrollmentManagement.withdraw") }}</el-button
|
|
>
|
|
<el-button
|
|
v-else-if="offering.enrollmentStatus === 'Waitlisted'"
|
|
type="warning"
|
|
plain
|
|
:disabled="selectedRound.status !== 'Open'"
|
|
@click="cancelWaitlist(offering)"
|
|
>{{ t("selectionTemplate.cancelWaitlist") }}</el-button
|
|
>
|
|
<el-button
|
|
v-else-if="
|
|
isOfferingFull(offering) &&
|
|
!offeringEligibilityReason(offering)
|
|
"
|
|
type="warning"
|
|
@click="joinWaitlist(offering)"
|
|
>{{
|
|
offering.isRetake
|
|
? t("selectionTemplate.joinRetakeWaitlist")
|
|
: t("selectionTemplate.joinWaitlist")
|
|
}}</el-button
|
|
>
|
|
<el-button
|
|
v-else
|
|
type="primary"
|
|
:disabled="Boolean(offeringEligibilityReason(offering))"
|
|
@click="enroll(offering)"
|
|
>{{
|
|
offering.enrollmentStatus === "Withdrawn"
|
|
? t("selectionTemplate.selectAgain")
|
|
: offering.isRetake
|
|
? t("selectionTemplate.selectForRetake")
|
|
: t("selectionTemplate.selectCourse")
|
|
}}</el-button
|
|
>
|
|
</footer>
|
|
</article>
|
|
<el-empty
|
|
v-if="!filteredOfferings.length"
|
|
:description="
|
|
offerings.length
|
|
? t('selectionTemplate.noTeachingClassesMatchTheFilters')
|
|
: t(
|
|
'selectionTemplate.noCoursesInThisRoundAreAvailableToYourClass',
|
|
)
|
|
"
|
|
/>
|
|
</section>
|
|
</template>
|
|
</template>
|
|
|
|
<el-empty
|
|
v-else-if="!loading"
|
|
:description="t('batchBusiness.noCourseSelectionRounds')"
|
|
/>
|
|
|
|
<el-dialog
|
|
v-model="roundDialog"
|
|
:title="
|
|
editingRoundId
|
|
? t('selectionTemplate.editSelectionRound')
|
|
: t('selectionTemplate.newSelectionRound')
|
|
"
|
|
width="720px"
|
|
>
|
|
<el-form label-position="top">
|
|
<div class="form-grid">
|
|
<el-form-item :label="t('batchBusiness.offeringTerm')" required>
|
|
<el-select v-model="roundForm.academicTermId">
|
|
<el-option
|
|
v-for="term in terms"
|
|
:key="term.id"
|
|
:label="academicTermLabel(term)"
|
|
:value="term.id"
|
|
:class="academicTermOptionClass(term)"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="t('businessLabels.batchName')" required>
|
|
<el-input
|
|
v-model="roundForm.name"
|
|
:placeholder="
|
|
t('selectionTemplate.forExampleFirstSelectionRound')
|
|
"
|
|
/>
|
|
</el-form-item>
|
|
</div>
|
|
<el-form-item :label="t('batchBusiness.selectionType')" required>
|
|
<el-radio-group v-model="roundForm.scope">
|
|
<el-radio value="All">{{
|
|
t("selectionTemplate.regularSelection")
|
|
}}</el-radio>
|
|
<el-radio value="RetakeOnly">{{
|
|
t("selectionTemplate.retakeOnly")
|
|
}}</el-radio>
|
|
</el-radio-group>
|
|
<div class="form-hint">
|
|
{{
|
|
t(
|
|
"selectionTemplate.retakeOnlyRoundsOpenAndCloseOnTheirOwnScheduleAndAreVisibleOnlyToStudentsWhoPreviouslyFailedAndHaveNotYetPassed",
|
|
)
|
|
}}
|
|
</div>
|
|
</el-form-item>
|
|
<div class="form-grid">
|
|
<el-form-item :label="t('batchBusiness.selectionStartTime')" required>
|
|
<el-date-picker
|
|
v-model="roundForm.startsAt"
|
|
type="datetime"
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item :label="t('batchBusiness.selectionEndTime')" required>
|
|
<el-date-picker
|
|
v-model="roundForm.endsAt"
|
|
type="datetime"
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
/>
|
|
</el-form-item>
|
|
</div>
|
|
<div class="form-grid">
|
|
<el-form-item
|
|
:label="t('batchBusiness.courseWithdrawalDeadline')"
|
|
required
|
|
>
|
|
<el-date-picker
|
|
v-model="roundForm.withdrawalEndsAt"
|
|
type="datetime"
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item :label="t('batchBusiness.creditLimitForThisRound')">
|
|
<el-input-number
|
|
v-model="roundForm.maxCredits"
|
|
:min="0.5"
|
|
:max="99"
|
|
:step="0.5"
|
|
/>
|
|
</el-form-item>
|
|
</div>
|
|
<div class="form-grid">
|
|
<el-form-item :label="t('equivalency.grade')">
|
|
<el-select
|
|
v-model="roundForm.eligibleGrades"
|
|
multiple
|
|
collapse-tags
|
|
collapse-tags-tooltip
|
|
clearable
|
|
:placeholder="t('batchBusiness.leaveEmptyForAllEnrollmentYears')"
|
|
>
|
|
<el-option
|
|
v-for="grade in gradeOptions"
|
|
:key="grade"
|
|
:label="t('selectionTemplate.enrolledYear', { year: grade })"
|
|
:value="grade"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="t('batchBusiness.maximumCourses')">
|
|
<el-input-number
|
|
v-model="roundForm.maxCourseCount"
|
|
:min="1"
|
|
:max="100"
|
|
:placeholder="t('batchBusiness.noLimit')"
|
|
/>
|
|
</el-form-item>
|
|
</div>
|
|
<el-alert
|
|
type="info"
|
|
:closable="false"
|
|
:title="
|
|
t(
|
|
'selectionTemplate.eligibleEnrollmentYearsRestrictRoundVisibilitySelfSelectionWaitlistsAdministrativeEnrollmentAndAutomaticPromotionLeaveEmptyForAllYears',
|
|
)
|
|
"
|
|
/>
|
|
<el-form-item :label="t('businessLabels.description')">
|
|
<el-input v-model="roundForm.notes" type="textarea" :rows="3" />
|
|
</el-form-item>
|
|
</el-form>
|
|
<template #footer>
|
|
<el-button @click="roundDialog = false">{{
|
|
t("businessLabels.cancel")
|
|
}}</el-button>
|
|
<el-button type="primary" @click="saveRound">{{
|
|
t("workflowBatch.saveDraft")
|
|
}}</el-button>
|
|
</template>
|
|
</el-dialog>
|
|
|
|
<el-dialog
|
|
v-model="offeringDialog"
|
|
:title="
|
|
editingOfferingId
|
|
? t('selectionTemplate.editTeachingClassConfiguration')
|
|
: t('selectionTemplate.addTeachingClass')
|
|
"
|
|
width="620px"
|
|
>
|
|
<el-form label-position="top">
|
|
<el-form-item
|
|
:label="t('batchBusiness.publishedTeachingClasses')"
|
|
required
|
|
>
|
|
<el-select
|
|
v-model="offeringForm.teachingTaskId"
|
|
filterable
|
|
@change="onTaskChanged"
|
|
>
|
|
<el-option
|
|
v-for="task in selectableTasks"
|
|
:key="task.id"
|
|
:label="`${task.taskNumber} · ${task.courseCode} ${task.courseName}${task.schedulingMode === 'Flexible' ? t('selectionTemplate.flexible') : ''}`"
|
|
:value="task.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<div class="form-grid compact">
|
|
<el-form-item :label="t('batchBusiness.selectionCapacity')">
|
|
<el-input-number v-model="offeringForm.capacity" :min="1" />
|
|
</el-form-item>
|
|
<el-form-item :label="t('batchBusiness.eligibleStudents')">
|
|
<el-switch
|
|
v-model="offeringForm.isOpenToAll"
|
|
:active-text="t('courseStats.universityStudents')"
|
|
:inactive-text="
|
|
t('selectionTemplate.classesAssociatedWithTheTeachingTask')
|
|
"
|
|
/>
|
|
</el-form-item>
|
|
</div>
|
|
<el-form-item :label="t('businessLabels.description')">
|
|
<el-input v-model="offeringForm.notes" type="textarea" :rows="2" />
|
|
</el-form-item>
|
|
</el-form>
|
|
<template #footer>
|
|
<el-button @click="offeringDialog = false">{{
|
|
t("businessLabels.cancel")
|
|
}}</el-button>
|
|
<el-button type="primary" @click="saveOffering">{{
|
|
t("businessLabels.save")
|
|
}}</el-button>
|
|
</template>
|
|
</el-dialog>
|
|
|
|
<el-drawer
|
|
v-model="rosterDrawer"
|
|
:title="t('batchBusiness.teachingClassRosterManagement')"
|
|
size="720px"
|
|
>
|
|
<template v-if="roster">
|
|
<div class="roster-summary">
|
|
<el-icon><UserFilled /></el-icon>
|
|
<div>
|
|
<span>{{ roster.courseCode }} · {{ roster.taskNumber }}</span>
|
|
<b>{{ roster.taskName }}</b>
|
|
<small>
|
|
{{ t("appUpdates.channels.Production") }}
|
|
{{ roster.enrolledCount }} / {{ roster.capacity }}
|
|
{{ t("graduationAudits.people") }}
|
|
<template v-if="roster.waitlistedCount">{{
|
|
t("selectionTemplate.countWaitlisted2", {
|
|
count: roster.waitlistedCount,
|
|
})
|
|
}}</template>
|
|
</small>
|
|
</div>
|
|
<div class="roster-actions">
|
|
<el-button
|
|
v-if="roster.canProxyEnroll"
|
|
type="primary"
|
|
:icon="Plus"
|
|
@click="openProxyEnrollment"
|
|
>{{ t("selectionTemplate.enrollStudents") }}</el-button
|
|
>
|
|
<el-button
|
|
v-if="isManager"
|
|
type="danger"
|
|
plain
|
|
:icon="Plus"
|
|
@click="openForceEnrollment"
|
|
>{{ t("selectionTemplate.forceEnrollment") }}</el-button
|
|
>
|
|
</div>
|
|
</div>
|
|
<el-alert
|
|
v-if="roster.canProxyEnroll"
|
|
class="roster-notice"
|
|
type="info"
|
|
:closable="false"
|
|
:title="
|
|
t(
|
|
'selectionTemplate.universityAcademicStaffMayEnrollStudentsInPublicRequiredCoursesYearEligibilityCapacityCourseAndCreditLimitsDuplicatesAndConflictsAreStillChecked',
|
|
)
|
|
"
|
|
/>
|
|
<el-alert
|
|
v-if="isManager"
|
|
class="roster-notice force-notice"
|
|
type="warning"
|
|
:closable="false"
|
|
:title="
|
|
t(
|
|
'selectionTemplate.forcedEnrollmentDirectlyAddsStudentsIgnoringCapacityScheduleConflictsCreditLimitsAndDuplicateCourseRestrictions',
|
|
)
|
|
"
|
|
/>
|
|
<div class="roster-filter">
|
|
<el-input
|
|
v-model="rosterKeyword"
|
|
clearable
|
|
:placeholder="
|
|
t('batchBusiness.filterByStudentNumberNameOrAdministrativeClass')
|
|
"
|
|
@keyup.enter="filterRoster"
|
|
@clear="filterRoster"
|
|
/>
|
|
<el-select
|
|
v-model="rosterGrade"
|
|
clearable
|
|
:placeholder="t('businessLabels.allGrades')"
|
|
@change="filterRoster"
|
|
>
|
|
<el-option
|
|
v-for="grade in roster.filterOptions?.grades"
|
|
:key="grade"
|
|
:label="t('selectionTemplate.enrolledYear', { year: grade })"
|
|
:value="grade"
|
|
/>
|
|
</el-select>
|
|
<el-select
|
|
v-model="rosterMajorId"
|
|
clearable
|
|
:placeholder="t('businessLabels.allMajors')"
|
|
@change="
|
|
() => {
|
|
rosterClassId = undefined;
|
|
filterRoster();
|
|
}
|
|
"
|
|
>
|
|
<el-option
|
|
v-for="major in roster.filterOptions?.majors"
|
|
:key="major.majorId"
|
|
:label="major.majorName"
|
|
:value="major.majorId"
|
|
/>
|
|
</el-select>
|
|
<el-select
|
|
v-model="rosterClassId"
|
|
clearable
|
|
:placeholder="t('businessLabels.allClasses')"
|
|
@change="filterRoster"
|
|
>
|
|
<el-option
|
|
v-for="item in rosterClasses"
|
|
:key="item.classId"
|
|
:label="item.className"
|
|
:value="item.classId"
|
|
/>
|
|
</el-select>
|
|
<el-button :icon="Search" @click="filterRoster">{{
|
|
t("businessLabels.search")
|
|
}}</el-button>
|
|
</div>
|
|
<el-table v-loading="rosterLoading" :data="roster.students">
|
|
<el-table-column
|
|
prop="studentNumber"
|
|
:label="t('businessLabels.studentNumber')"
|
|
width="130"
|
|
/>
|
|
<el-table-column
|
|
prop="name"
|
|
:label="t('businessLabels.name')"
|
|
width="90"
|
|
/>
|
|
<el-table-column :label="t('businessLabels.grade')" width="80">
|
|
<template #default="{ row }">{{
|
|
t("selectionTemplate.enrolledYear", { year: row.grade })
|
|
}}</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="className"
|
|
:label="t('businessLabels.administrativeClass')"
|
|
min-width="150"
|
|
/>
|
|
<el-table-column
|
|
:label="t('batchBusiness.selectionTime')"
|
|
min-width="130"
|
|
>
|
|
<template #default="{ row }">{{
|
|
formatDateTime(row.enrolledAt)
|
|
}}</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
v-if="roster.canProxyEnroll"
|
|
:label="t('businessLabels.actions')"
|
|
width="80"
|
|
fixed="right"
|
|
>
|
|
<template #default="{ row }">
|
|
<el-button link type="danger" @click="removeFromRoster(row)">{{
|
|
t("selectionTemplate.remove")
|
|
}}</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<template #empty
|
|
><el-empty :description="t('batchBusiness.noEnrolledStudents')"
|
|
/></template>
|
|
</el-table>
|
|
<el-pagination
|
|
v-if="roster.studentTotal > rosterPageSize"
|
|
small
|
|
background
|
|
layout="total, prev, pager, next"
|
|
:current-page="rosterStudentPage"
|
|
:page-size="rosterPageSize"
|
|
:total="roster.studentTotal"
|
|
@current-change="
|
|
(page: number) => {
|
|
rosterStudentPage = page;
|
|
loadRoster(roster.id);
|
|
}
|
|
"
|
|
/>
|
|
<section class="waitlist-panel">
|
|
<div class="waitlist-panel-head">
|
|
<div>
|
|
<span>WAITLIST</span>
|
|
<b>{{ t("selectionTemplate.waitlist2") }}</b>
|
|
</div>
|
|
<small>{{
|
|
t(
|
|
"selectionTemplate.whenASeatIsReleasedWaitlistedStudentsAreRecheckedAndPromotedInOrder",
|
|
)
|
|
}}</small>
|
|
</div>
|
|
<el-table :data="roster.waitlist">
|
|
<el-table-column
|
|
prop="position"
|
|
:label="t('batchBusiness.queuePosition')"
|
|
width="70"
|
|
/>
|
|
<el-table-column
|
|
prop="studentNumber"
|
|
:label="t('businessLabels.studentNumber')"
|
|
width="130"
|
|
/>
|
|
<el-table-column
|
|
prop="name"
|
|
:label="t('businessLabels.name')"
|
|
width="90"
|
|
/>
|
|
<el-table-column :label="t('businessLabels.grade')" width="80">
|
|
<template #default="{ row }">{{
|
|
t("selectionTemplate.enrolledYear", { year: row.grade })
|
|
}}</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="className"
|
|
:label="t('businessLabels.administrativeClass')"
|
|
min-width="150"
|
|
/>
|
|
<el-table-column
|
|
:label="t('batchBusiness.waitlistTime')"
|
|
min-width="130"
|
|
>
|
|
<template #default="{ row }">{{
|
|
formatDateTime(row.waitlistedAt)
|
|
}}</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
v-if="roster.canManageWaitlist"
|
|
:label="t('businessLabels.actions')"
|
|
width="80"
|
|
fixed="right"
|
|
>
|
|
<template #default="{ row }">
|
|
<el-button
|
|
link
|
|
type="danger"
|
|
@click="removeFromWaitlist(row)"
|
|
>{{ t("selectionTemplate.remove") }}</el-button
|
|
>
|
|
</template>
|
|
</el-table-column>
|
|
<template #empty
|
|
><el-empty :description="t('batchBusiness.noWaitlistedStudents')"
|
|
/></template>
|
|
</el-table>
|
|
<el-pagination
|
|
v-if="roster.waitlistTotal > rosterPageSize"
|
|
small
|
|
background
|
|
layout="total, prev, pager, next"
|
|
:current-page="rosterWaitlistPage"
|
|
:page-size="rosterPageSize"
|
|
:total="roster.waitlistTotal"
|
|
@current-change="
|
|
(page: number) => {
|
|
rosterWaitlistPage = page;
|
|
loadRoster(roster.id);
|
|
}
|
|
"
|
|
/>
|
|
</section>
|
|
</template>
|
|
</el-drawer>
|
|
|
|
<el-dialog
|
|
v-model="proxyDialog"
|
|
:title="t('batchBusiness.enrollStudentsInPublicRequiredCourses')"
|
|
width="760px"
|
|
>
|
|
<template v-if="roster">
|
|
<div class="proxy-course-note">
|
|
<b>{{ roster.courseName }}</b>
|
|
<span
|
|
>{{ roster.taskNumber
|
|
}}{{
|
|
t("selectionTemplate.countCurrently", {
|
|
count: `${roster.enrolledCount} / ${roster.capacity}`,
|
|
})
|
|
}}</span
|
|
>
|
|
</div>
|
|
<div class="proxy-search">
|
|
<el-input
|
|
v-model="studentKeyword"
|
|
clearable
|
|
:placeholder="
|
|
t('batchBusiness.enterStudentNumberNameOrAdministrativeClass')
|
|
"
|
|
@keyup.enter="loadEligibleStudents(1)"
|
|
@clear="loadEligibleStudents(1)"
|
|
/>
|
|
<el-button type="primary" @click="loadEligibleStudents(1)">{{
|
|
t("selectionTemplate.searchStudents")
|
|
}}</el-button>
|
|
</div>
|
|
<el-table
|
|
v-loading="eligibleLoading"
|
|
:data="eligibleStudents"
|
|
row-key="id"
|
|
height="360"
|
|
@selection-change="onEligibleSelectionChanged"
|
|
>
|
|
<el-table-column type="selection" width="48" />
|
|
<el-table-column
|
|
prop="studentNumber"
|
|
:label="t('businessLabels.studentNumber')"
|
|
width="130"
|
|
/>
|
|
<el-table-column
|
|
prop="name"
|
|
:label="t('businessLabels.name')"
|
|
width="90"
|
|
/>
|
|
<el-table-column :label="t('businessLabels.grade')" width="80">
|
|
<template #default="{ row }">{{
|
|
t("selectionTemplate.enrolledYear", { year: row.grade })
|
|
}}</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="className"
|
|
:label="t('businessLabels.administrativeClass')"
|
|
min-width="150"
|
|
/>
|
|
<el-table-column
|
|
prop="majorName"
|
|
:label="t('businessLabels.major')"
|
|
min-width="150"
|
|
/>
|
|
<template #empty
|
|
><el-empty
|
|
:description="t('batchBusiness.noEligibleEnrolledStudents')"
|
|
/></template>
|
|
</el-table>
|
|
<el-pagination
|
|
v-if="eligibleTotal > 20"
|
|
class="proxy-pagination"
|
|
layout="prev, pager, next, total"
|
|
:current-page="eligiblePage"
|
|
:page-size="20"
|
|
:total="eligibleTotal"
|
|
@current-change="loadEligibleStudents"
|
|
/>
|
|
</template>
|
|
<template #footer>
|
|
<div class="proxy-dialog-footer">
|
|
<span class="proxy-selected-count"
|
|
>{{ t("notificationBatch.selected") }}
|
|
{{ selectedStudentIds.length }}
|
|
{{ t("graduationAudits.people") }}</span
|
|
>
|
|
<el-button @click="proxyDialog = false">{{
|
|
t("businessLabels.cancel")
|
|
}}</el-button>
|
|
<el-button
|
|
type="primary"
|
|
:loading="proxySubmitting"
|
|
:disabled="selectedStudentIds.length === 0"
|
|
@click="proxyEnroll"
|
|
>{{ t("selectionTemplate.confirmEnrollment") }}</el-button
|
|
>
|
|
</div>
|
|
</template>
|
|
</el-dialog>
|
|
|
|
<el-dialog
|
|
v-model="forceDialog"
|
|
:title="t('batchBusiness.forceEnrollmentIgnoreAllRestrictions')"
|
|
width="760px"
|
|
>
|
|
<template v-if="roster">
|
|
<div class="proxy-course-note">
|
|
<b>{{ roster.courseName }}</b>
|
|
<span
|
|
>{{ roster.taskNumber
|
|
}}{{
|
|
t("selectionTemplate.countCurrently", {
|
|
count: `${roster.enrolledCount} / ${roster.capacity}`,
|
|
})
|
|
}}</span
|
|
>
|
|
</div>
|
|
<el-alert
|
|
class="roster-notice"
|
|
type="error"
|
|
:closable="false"
|
|
:title="
|
|
t(
|
|
'selectionTemplate.forcedEnrollmentIgnoresAllRestrictionsIncludingCapacityConflictsCreditLimitsAndDuplicateCoursesProceedCarefully',
|
|
)
|
|
"
|
|
/>
|
|
<div class="proxy-search" style="margin-top: 12px">
|
|
<el-input
|
|
v-model="studentKeyword"
|
|
clearable
|
|
:prefix-icon="Search"
|
|
:placeholder="t('batchBusiness.studentNumberNameOrClass')"
|
|
@keyup.enter="loadForceEligibleStudents(1)"
|
|
@clear="loadForceEligibleStudents(1)"
|
|
/>
|
|
<el-button type="primary" @click="loadForceEligibleStudents(1)">{{
|
|
t("selectionTemplate.searchStudents")
|
|
}}</el-button>
|
|
</div>
|
|
<el-table
|
|
v-loading="eligibleLoading"
|
|
:data="eligibleStudents"
|
|
row-key="id"
|
|
height="360"
|
|
@selection-change="onEligibleSelectionChanged"
|
|
>
|
|
<el-table-column type="selection" width="48" />
|
|
<el-table-column
|
|
prop="studentNumber"
|
|
:label="t('businessLabels.studentNumber')"
|
|
width="130"
|
|
/>
|
|
<el-table-column
|
|
prop="name"
|
|
:label="t('businessLabels.name')"
|
|
width="90"
|
|
/>
|
|
<el-table-column :label="t('businessLabels.grade')" width="80">
|
|
<template #default="{ row }">{{
|
|
t("selectionTemplate.enrolledYear", { year: row.grade })
|
|
}}</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="className"
|
|
:label="t('businessLabels.administrativeClass')"
|
|
min-width="150"
|
|
/>
|
|
<el-table-column
|
|
prop="collegeName"
|
|
:label="t('businessLabels.college')"
|
|
min-width="120"
|
|
/>
|
|
<template #empty
|
|
><el-empty
|
|
:description="
|
|
t(
|
|
'batchBusiness.noEnrolledStudentsAvailableForForcedEnrollment',
|
|
)
|
|
"
|
|
/></template>
|
|
</el-table>
|
|
<el-pagination
|
|
v-if="eligibleTotal > 20"
|
|
class="proxy-pagination"
|
|
layout="prev, pager, next, total"
|
|
:current-page="eligiblePage"
|
|
:page-size="20"
|
|
:total="eligibleTotal"
|
|
@current-change="loadForceEligibleStudents"
|
|
/>
|
|
</template>
|
|
<template #footer>
|
|
<div class="proxy-dialog-footer">
|
|
<span class="proxy-selected-count"
|
|
>{{ t("notificationBatch.selected") }}
|
|
{{ selectedStudentIds.length }}
|
|
{{ t("graduationAudits.people") }}</span
|
|
>
|
|
<el-button @click="forceDialog = false">{{
|
|
t("businessLabels.cancel")
|
|
}}</el-button>
|
|
<el-button
|
|
type="danger"
|
|
:loading="forceSubmitting"
|
|
:disabled="selectedStudentIds.length === 0"
|
|
@click="forceEnrollSubmit"
|
|
>{{ t("selectionTemplate.confirmForcedEnrollment") }}</el-button
|
|
>
|
|
</div>
|
|
</template>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.roster-actions {
|
|
display: flex;
|
|
gap: 8px;
|
|
}
|
|
.force-notice {
|
|
margin-top: 8px;
|
|
}
|
|
.waitlist-count {
|
|
display: block;
|
|
margin-top: 3px;
|
|
color: #b7791f;
|
|
}
|
|
.offering-ticket.waitlisted {
|
|
border-color: #e6a23c;
|
|
box-shadow: 0 10px 28px rgb(230 162 60 / 10%);
|
|
}
|
|
.seat-meter > small {
|
|
display: block;
|
|
margin-top: 5px;
|
|
color: #b7791f;
|
|
}
|
|
.waitlist-panel {
|
|
margin-top: 22px;
|
|
padding-top: 18px;
|
|
border-top: 1px solid var(--line);
|
|
}
|
|
.roster-filter {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 8px;
|
|
margin: 14px 0;
|
|
}
|
|
.roster-filter .el-input {
|
|
max-width: 260px;
|
|
}
|
|
.roster-filter .el-select {
|
|
width: 140px;
|
|
}
|
|
.roster-summary ~ :deep(.el-pagination),
|
|
.waitlist-panel :deep(.el-pagination) {
|
|
justify-content: flex-end;
|
|
margin-top: 10px;
|
|
}
|
|
.waitlist-panel-head {
|
|
display: flex;
|
|
align-items: end;
|
|
justify-content: space-between;
|
|
gap: 16px;
|
|
margin-bottom: 12px;
|
|
}
|
|
.waitlist-panel-head div {
|
|
display: grid;
|
|
gap: 3px;
|
|
}
|
|
.waitlist-panel-head span {
|
|
color: #b7791f;
|
|
font:
|
|
700 9px/1 Consolas,
|
|
monospace;
|
|
letter-spacing: 0.16em;
|
|
}
|
|
.waitlist-panel-head b {
|
|
font-size: 17px;
|
|
}
|
|
.waitlist-panel-head small {
|
|
color: var(--muted);
|
|
text-align: right;
|
|
}
|
|
|
|
@media (max-width: 640px) {
|
|
.roster-filter {
|
|
align-items: stretch;
|
|
flex-direction: column;
|
|
}
|
|
.roster-filter .el-input,
|
|
.roster-filter .el-select {
|
|
width: 100%;
|
|
max-width: none;
|
|
}
|
|
.waitlist-panel-head {
|
|
align-items: start;
|
|
flex-direction: column;
|
|
}
|
|
.waitlist-panel-head small {
|
|
text-align: left;
|
|
}
|
|
}
|
|
</style>
|