"use client"
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
faPenToSquare,
faChevronDown,
faCalendarAlt,
faFileText,
faMoneyBillWave,
faUser,
faInfoCircle,
faCheckCircle,
faTimesCircle
} from '@fortawesome/free-solid-svg-icons';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import applicationsData from '@/data/applications.json';
interface TableCellProps {
children: React.ReactNode;
className?: string;
}
const TableCell = ({ children, className = "" }: TableCellProps) => (
{children}
|
);
const CompletedBadge = ({ completed }: { completed: string }) => {
const { t } = useTranslation();
if (completed === t('yes', 'Да')) {
return (
);
} else {
return (
);
}
};
const FeeBadge = ({ fee }: { fee: string }) => {
const feeValue = parseFloat(fee.replace(',', '.'));
if (feeValue === 0) {
return (
{fee}
);
} else {
return (
{fee}
);
}
};
export default function ApplicationsPage() {
const { t } = useTranslation();
const [selectedSession, setSelectedSession] = useState(applicationsData.currentSession.id);
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const currentSessionData = applicationsData.examSessions.find(s => s.id === selectedSession) || applicationsData.currentSession;
const { applications } = applicationsData;
return (
{/* Header */}
{t('applications_header', 'Пријави')}
{t('applications_subheader', 'Електронски пријави за испити')}
{/* Session Selection */}
{t('select_exam_session', 'Избери испитна сесија:')}
{isDropdownOpen && (
{applicationsData.examSessions.map((session) => (
))}
)}
{/* Applications Section */}
{t('registered_exams', 'Пријавени испити')}
| # |
{t('serial_number', 'Сериски број')} |
{t('code', 'Код')} |
{t('subject', 'Предмет')} |
{t('completed', 'Завршена')} |
{t('fee', 'Таксени')} |
{t('date', 'Датум')} |
{t('instructor', 'Наставник')} |
{t('decade', 'Декада')} |
{applications.map((application) => (
{application.id}
{application.serviceNumber}
{application.code}
{t(application.subject, application.subject)}
{application.date}
{t(application.instructor, application.instructor)}
{application.decade}
))}
{/* Important Note */}
{t('important_note', 'Важна забелешка')}
{t('applications_important_note_text')}
{/* Statistics Cards */}
{t('registered_exams', 'Пријавени испити')}
{applications.length}
{t('completed', 'Завршени')}
{applications.filter(app => app.completed === t('yes', 'Да')).length}
{t('total_fee', 'Вкупна такса')}
{applications.reduce((sum, app) => sum + parseFloat(app.fee.replace(',', '.')), 0).toFixed(2)}
);
}