Update: 2026-05-08 00:26:39

This commit is contained in:
Hamza-Ayed
2026-05-08 00:26:40 +03:00
parent 51d1d42f75
commit 08e2a87c10
24 changed files with 1743 additions and 210 deletions

View File

@@ -89,4 +89,48 @@ class InvoiceDetailController extends GetxController {
AppSnackbar.showWarning('عذراً', 'لا توجد صورة مرتبطة بهذه الفاتورة');
}
}
Future<void> submitToJoFotara() async {
// Confirmation dialog
final confirmed = await Get.dialog<bool>(
AlertDialog(
title: const Text('تأكيد الإرسال'),
content: const Text(
'هل أنت متأكد من إرسال هذه الفاتورة لمنظومة جوفتورة؟\nلا يمكن التراجع عن هذا الإجراء.'),
actions: [
TextButton(
onPressed: () => Get.back(result: false),
child: const Text('إلغاء'),
),
ElevatedButton(
onPressed: () => Get.back(result: true),
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF6366F1),
),
child: const Text('إرسال', style: TextStyle(color: Colors.white)),
),
],
),
);
if (confirmed != true) return;
try {
AppSnackbar.showInfo('جاري الإرسال', 'يتم إرسال الفاتورة لمنظومة جوفتورة...');
final res = await DioClient().client.post(
'invoices/submit-jofotara',
data: {'invoice_id': invoiceId},
);
if (res.data['success'] == true) {
AppSnackbar.showSuccess('تم الإرسال', 'تم تقديم الفاتورة لجوفتورة بنجاح');
fetchInvoiceDetails(); // Refresh to show JoFotara status
} else {
AppSnackbar.showError('خطأ', res.data['message'] ?? 'فشل الإرسال');
}
} catch (e) {
AppLogger.error('Failed to submit to JoFotara', e);
AppSnackbar.showError('خطأ', 'فشل إرسال الفاتورة لجوفتورة');
}
}
}

View File

@@ -80,6 +80,7 @@ class InvoicesController extends GetxController {
'approved',
'extracted',
'uploaded',
'submitted',
'rejected',
};