🚀 Phase 3 Complete: Fix staff list, PDF preview, and functional Settings/Profile
This commit is contained in:
@@ -373,25 +373,17 @@ export const InvoicesPage = () => {
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div className="flex-1 overflow-auto bg-slate-950 p-8 flex justify-center items-start">
|
||||
<div className="bg-white rounded-lg overflow-hidden shadow-2xl">
|
||||
<img
|
||||
src={`${apiClient.defaults.baseURL}/invoices/${viewingInvoice.id}/file?token=${localStorage.getItem('access_token')}`}
|
||||
alt="Invoice"
|
||||
className="max-w-full h-auto"
|
||||
onError={(e) => {
|
||||
e.currentTarget.style.display = 'none';
|
||||
const token = localStorage.getItem('access_token');
|
||||
e.currentTarget.parentElement!.innerHTML = `
|
||||
<div class="p-20 text-center bg-slate-900 text-slate-300 w-[600px]">
|
||||
<FileText class="w-16 h-16 text-slate-700 mx-auto mb-4" />
|
||||
<h4 class="text-xl font-bold text-white mb-2">تعذر عرض الملف</h4>
|
||||
<p class="text-slate-500 mb-8">قد يكون الملف PDF أو حدث خطأ في التحميل.</p>
|
||||
<a href="${apiClient.defaults.baseURL}/invoices/${viewingInvoice.id}/file?token=${token}" target="_blank" class="px-8 py-3 bg-emerald-500 text-slate-950 font-bold rounded-xl inline-block">تحميل الملف لفتحه</a>
|
||||
</div>
|
||||
`;
|
||||
}}
|
||||
<div className="flex-1 overflow-auto bg-slate-950 p-8 flex justify-center items-center">
|
||||
<div className="w-full h-full max-w-4xl bg-white rounded-xl overflow-hidden shadow-2xl relative">
|
||||
<iframe
|
||||
src={`${apiClient.defaults.baseURL}/invoices/${viewingInvoice.id}/file?token=${localStorage.getItem('access_token')}#toolbar=0`}
|
||||
className="w-full h-full border-none"
|
||||
title="Invoice Preview"
|
||||
/>
|
||||
{/* Fallback overlay in case of loading issues */}
|
||||
<div className="absolute inset-0 pointer-events-none flex items-center justify-center bg-slate-900/10 backdrop-blur-[2px] opacity-0 hover:opacity-100 transition-opacity">
|
||||
<p className="bg-slate-900/80 text-white px-4 py-2 rounded-lg text-xs">جاري عرض الفاتورة...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user