@@ -96,7 +96,11 @@ const Dashboard: React.FC = () => {
9696 try {
9797 // Generate PDF blob first
9898 const blob = await pdf ( < PDFDocument members = { members } tasks = { tasks } /> ) . toBlob ( ) ;
99- const fileName = `تقرير-Enjaz-${ new Date ( ) . toLocaleDateString ( 'ar-EG' ) . replace ( / \/ / g, '-' ) } .pdf` ;
99+
100+ // Use standard date format for filename to avoid OS path issues
101+ const date = new Date ( ) ;
102+ const dateStr = `${ date . getFullYear ( ) } -${ String ( date . getMonth ( ) + 1 ) . padStart ( 2 , '0' ) } -${ String ( date . getDate ( ) ) . padStart ( 2 , '0' ) } ` ;
103+ const fileName = `Enjaz-Report-${ dateStr } .pdf` ;
100104
101105 // Try to use Tauri dialog
102106 try {
@@ -116,10 +120,11 @@ const Dashboard: React.FC = () => {
116120 const arrayBuffer = await blob . arrayBuffer ( ) ;
117121 const uint8Array = new Uint8Array ( arrayBuffer ) ;
118122 await writeFile ( filePath , uint8Array ) ;
119- console . log ( 'PDF saved successfully to:' , filePath ) ;
123+ alert ( `تم حفظ الملف بنجاح في: ${ filePath } ` ) ;
120124 }
121125 } catch ( tauriError ) {
122- console . warn ( 'Tauri dialog not available, using browser download:' , tauriError ) ;
126+ console . warn ( 'Tauri dialog error:' , tauriError ) ;
127+ alert ( `حدث خطأ أثناء حفظ الملف: ${ tauriError } ` ) ;
123128 // Fallback to browser download
124129 const url = URL . createObjectURL ( blob ) ;
125130 const link = document . createElement ( 'a' ) ;
@@ -132,6 +137,7 @@ const Dashboard: React.FC = () => {
132137 }
133138 } catch ( error ) {
134139 console . error ( 'Error generating PDF:' , error ) ;
140+ alert ( 'حدث خطأ غير متوقع أثناء إنشاء الملف.' ) ;
135141 }
136142
137143 setIsExporting ( false ) ;
@@ -375,7 +381,10 @@ const Dashboard: React.FC = () => {
375381 const wb = XLSX . utils . book_new ( ) ;
376382 XLSX . utils . book_append_sheet ( wb , ws , 'تقرير الفريق' ) ;
377383
378- const fileName = `Enjaz-Report-${ new Date ( ) . toLocaleDateString ( 'ar-EG' ) . replace ( / \/ / g, '-' ) } .xlsx` ;
384+ // Use standard date format for filename
385+ const date = new Date ( ) ;
386+ const dateStr = `${ date . getFullYear ( ) } -${ String ( date . getMonth ( ) + 1 ) . padStart ( 2 , '0' ) } -${ String ( date . getDate ( ) ) . padStart ( 2 , '0' ) } ` ;
387+ const fileName = `Enjaz-Report-${ dateStr } .xlsx` ;
379388
380389 // Try to use Tauri dialog first
381390 try {
@@ -402,10 +411,12 @@ const Dashboard: React.FC = () => {
402411 } ) ;
403412 const uint8Array = new Uint8Array ( excelBuffer ) ;
404413 await writeFile ( filePath , uint8Array ) ;
405- console . log ( 'Excel file saved successfully to:' , filePath ) ;
414+ alert ( `تم حفظ الملف بنجاح في: ${ filePath } ` ) ;
406415 }
407416 } catch ( tauriError ) {
408- console . warn ( 'Tauri dialog not available, using browser download:' , tauriError ) ;
417+ console . warn ( 'Tauri dialog error:' , tauriError ) ;
418+ alert ( `حدث خطأ أثناء حفظ الملف: ${ tauriError } ` ) ;
419+
409420 // Fallback to browser download with cell styles
410421 XLSX . writeFile ( wb , fileName , {
411422 cellStyles : true ,
0 commit comments