feat: Gemini AI (doc OCR + face match) + role-assignment endpoints
- GeminiService (integrations/gemini, @Global): extractDocument (OCR fields) + faceMatch; graceful if no GEMINI_API_KEY - documents: face-match now real via Gemini; POST /admin/documents/:id/ocr extracts fields for CS auto-fill - roles: PATCH /admin/users/:id/role (admin) + POST /platform/users/role (bootstrap via x-platform-secret) - config: gemini + platform.secret; .env.example entries Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:sefer_driver/views/widgets/elevated_btn.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sefer_driver/constant/box_name.dart';
|
||||
import 'package:sefer_driver/constant/links.dart';
|
||||
import 'package:sefer_driver/controller/functions/crud.dart';
|
||||
import 'package:sefer_driver/main.dart';
|
||||
import 'package:sefer_driver/views/widgets/mydialoug.dart';
|
||||
|
||||
class DriverWalletHistoryController extends GetxController {
|
||||
bool isLoading = false;
|
||||
List archive = [];
|
||||
List weeklyList = [];
|
||||
|
||||
getArchivePayment() async {
|
||||
isLoading = true;
|
||||
update();
|
||||
|
||||
var res = await CRUD().getWallet(
|
||||
link: AppLink.getWalletByDriver,
|
||||
payload: {'driverID': box.read(BoxName.driverID)});
|
||||
|
||||
// 1. فحص الفشل
|
||||
if (res == 'failure') {
|
||||
MyDialog().getDialog(
|
||||
'There is no data yet.'.tr,
|
||||
'',
|
||||
() {
|
||||
Get.back();
|
||||
// Get.back(); // تأكد من عدد مرات الرجوع المطلوبة
|
||||
},
|
||||
);
|
||||
|
||||
// ✅ [الحل]: يجب إيقاف الدالة هنا وتحديث الواجهة
|
||||
isLoading = false;
|
||||
update();
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. فحص النجاح (لن يصل هنا إلا إذا كان JSON صحيح)
|
||||
try {
|
||||
var decoded = jsonDecode(res);
|
||||
archive = decoded['message'] ?? []; // حماية من null
|
||||
} catch (e) {
|
||||
print("Error parsing wallet data: $e");
|
||||
archive = [];
|
||||
}
|
||||
|
||||
isLoading = false;
|
||||
update();
|
||||
}
|
||||
|
||||
getWeekllyArchivePayment() async {
|
||||
isLoading = true;
|
||||
update();
|
||||
var res = await CRUD().getWallet(
|
||||
link: AppLink.getDriverWeekPaymentMove,
|
||||
payload: {'driverID': box.read(BoxName.driverID)});
|
||||
if (res == 'failure') {
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'There is no data yet.'.tr,
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Back'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
// Get.back();
|
||||
},
|
||||
));
|
||||
} else {
|
||||
weeklyList = jsonDecode(res)['message'];
|
||||
}
|
||||
|
||||
isLoading = false;
|
||||
update();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
getArchivePayment();
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user