- 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>
63 lines
1.6 KiB
Dart
63 lines
1.6 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:get/get.dart';
|
|
import 'package:Tripz/constant/style.dart';
|
|
import 'package:Tripz/views/widgets/elevated_btn.dart';
|
|
|
|
import '../../constant/box_name.dart';
|
|
import '../../constant/links.dart';
|
|
import '../../main.dart';
|
|
import '../functions/crud.dart';
|
|
|
|
class NotificationCaptainController extends GetxController {
|
|
bool isLoading = false;
|
|
Map notificationData = {};
|
|
|
|
getNotifications() async {
|
|
isLoading = true;
|
|
update();
|
|
var res = await CRUD().get(
|
|
link: AppLink.getNotificationCaptain,
|
|
payload: {'driverID': box.read(BoxName.driverID)});
|
|
if (res == "failure") {
|
|
Get.defaultDialog(
|
|
title: 'There is no notification yet'.tr,
|
|
titleStyle: AppStyle.title,
|
|
middleText: '',
|
|
confirm: MyElevatedButton(
|
|
title: 'Back',
|
|
onPressed: () {
|
|
Get.back();
|
|
Get.back();
|
|
}));
|
|
}
|
|
notificationData = jsonDecode(res);
|
|
// sql.insertData(notificationData['message'], TableName.captainNotification);
|
|
|
|
isLoading = false;
|
|
update();
|
|
}
|
|
|
|
updateNotification(String id) async {
|
|
await CRUD().post(
|
|
link: AppLink.updateNotificationCaptain,
|
|
payload: {'isShown': true, 'id': id},
|
|
);
|
|
}
|
|
|
|
addNotificationCaptain(String driverId, title, body, isPin) async {
|
|
await CRUD().post(link: AppLink.addNotificationCaptain, payload: {
|
|
'driverID': driverId,
|
|
'title': title,
|
|
'body': body,
|
|
'isPin': isPin
|
|
});
|
|
}
|
|
|
|
@override
|
|
void onInit() {
|
|
getNotifications();
|
|
super.onInit();
|
|
}
|
|
}
|