Update: 2026-05-08 14:05:50
This commit is contained in:
@@ -137,6 +137,9 @@ class CompaniesManagementView extends StatelessWidget {
|
||||
'company_name': company['name'],
|
||||
});
|
||||
break;
|
||||
case 'link_jofotara':
|
||||
_showLinkJoFotaraDialog(context, company, controller);
|
||||
break;
|
||||
case 'delete':
|
||||
_confirmDelete(context, controller, company['id'], company['name'] ?? '');
|
||||
break;
|
||||
@@ -145,6 +148,7 @@ class CompaniesManagementView extends StatelessWidget {
|
||||
itemBuilder: (context) => [
|
||||
const PopupMenuItem(value: 'edit', child: Row(children: [Icon(Icons.edit, size: 18), SizedBox(width: 8), Text('تعديل البيانات')])),
|
||||
const PopupMenuItem(value: 'stats', child: Row(children: [Icon(Icons.bar_chart, size: 18), SizedBox(width: 8), Text('الإحصائيات')])),
|
||||
const PopupMenuItem(value: 'link_jofotara', child: Row(children: [Icon(Icons.link, size: 18, color: Color(0xFF6366F1)), SizedBox(width: 8), Text('ربط جوفوترا', style: TextStyle(color: Color(0xFF6366F1)))])),
|
||||
const PopupMenuItem(value: 'delete', child: Row(children: [Icon(Icons.delete, size: 18, color: Colors.red), SizedBox(width: 8), Text('حذف', style: TextStyle(color: Colors.red))])),
|
||||
],
|
||||
),
|
||||
@@ -162,7 +166,7 @@ class CompaniesManagementView extends StatelessWidget {
|
||||
if (company['address'] != null && company['address'].toString().isNotEmpty)
|
||||
_chip(Icons.location_on, company['address'], Colors.orange),
|
||||
if (company['is_jofotara_linked'] == 1)
|
||||
_chip(Icons.verified, 'جوفتورة', const Color(0xFF6366F1)),
|
||||
_chip(Icons.verified, 'جوفوترا', const Color(0xFF6366F1)),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -298,4 +302,43 @@ class CompaniesManagementView extends StatelessWidget {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _showLinkJoFotaraDialog(BuildContext context, Map<String, dynamic> company, CompaniesManagementController controller) {
|
||||
final clientIdC = TextEditingController();
|
||||
final secretKeyC = TextEditingController();
|
||||
final sequenceC = TextEditingController();
|
||||
|
||||
Get.dialog(
|
||||
AlertDialog(
|
||||
title: const Text('ربط منصة جوفوترا', textAlign: TextAlign.center, style: TextStyle(color: Color(0xFF6366F1))),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text('أدخل بيانات الربط الخاصة بالشركة:', style: TextStyle(fontSize: 13, color: Colors.grey), textAlign: TextAlign.center),
|
||||
const SizedBox(height: 16),
|
||||
_editField('Client ID', clientIdC, Icons.vpn_key),
|
||||
_editField('Secret Key', secretKeyC, Icons.lock),
|
||||
_editField('Income Source Sequence (اختياري)', sequenceC, Icons.format_list_numbered),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Get.back(), child: const Text('إلغاء')),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
if (clientIdC.text.isEmpty || secretKeyC.text.isEmpty) {
|
||||
Get.snackbar('تنبيه', 'يجب إدخال الـ Client ID و Secret Key');
|
||||
return;
|
||||
}
|
||||
Get.back();
|
||||
controller.connectJoFotara(company['id'], clientIdC.text, secretKeyC.text, sequenceC.text);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(backgroundColor: const Color(0xFF6366F1)),
|
||||
child: const Text('ربط الآن', style: TextStyle(color: Colors.white)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user