"use client"
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
faFilePdf,
faChevronDown,
faDownload,
faCheckCircle,
faMoneyBillWave,
faFileText,
faCalendarAlt,
faCommentDots,
faChevronLeft,
faChevronRight,
faAngleDoubleLeft,
faAngleDoubleRight
} from '@fortawesome/free-solid-svg-icons';
import { useState } from 'react';
import documentsData from '@/data/documents.json';
interface TableCellProps {
children: React.ReactNode;
className?: string;
}
const TableCell = ({ children, className = "" }: TableCellProps) => (
{children}
|
);
const StatusBadge = ({ status }: { status: string }) => {
if (status === "approved") {
return (
);
}
return (
);
};
const PriceBadge = ({ price }: { price: number }) => {
if (price === 0) {
return 0,00;
}
return {price.toFixed(2)};
};
export default function DocumentsPage() {
const [selectedDocumentType, setSelectedDocumentType] = useState("select_document");
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const [comment, setComment] = useState("");
const [currentPage, setCurrentPage] = useState(1);
const [recordsPerPage, setRecordsPerPage] = useState(15);
const selectedDocument = documentsData.documentTypes.find(d => d.id === selectedDocumentType);
const { documents, pagination, paymentInfo } = documentsData;
const totalPages = Math.ceil(documents.length / recordsPerPage);
const startIndex = (currentPage - 1) * recordsPerPage;
const endIndex = startIndex + recordsPerPage;
const currentDocuments = documents.slice(startIndex, endIndex);
return (
{/* Header */}
Документи
Барање и преглед на документи
{/* Document Request Form */}
Ново барање за документ
{/* Document Type Selection */}
{isDropdownOpen && (
{documentsData.documentTypes.map((docType) => (
))}
)}
{/* Comment Section */}
{/* Documents Table */}
Мои документи
| # |
Архива |
Датум |
Барање |
Цена |
Платено |
Документ |
Плати онлајн |
Статус |
Коментар |
{currentDocuments.map((document) => (
{document.id}
{document.archive}
{document.date}
{document.request}
{document.paid}
{document.payOnline ? (
) : (
—
)}
{document.comment || (
—
)}
))}
{/* Pagination */}
Прва
Последна
Вкупно: {documents.length}
{/* Payment Info */}
{/* Statistics Cards */}
Вкупно документи
{documents.length}
Одобрени
{documents.filter(doc => doc.status === "approved").length}
Вкупна цена
{documents.reduce((sum, doc) => sum + doc.price, 0).toFixed(2)} мкд
);
}