9/21/1
This commit is contained in:
66
lib/controller/home/captin/help/assurance_controller.dart
Normal file
66
lib/controller/home/captin/help/assurance_controller.dart
Normal file
@@ -0,0 +1,66 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/links.dart';
|
||||
import 'package:SEFER/controller/functions/crud.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../constant/colors.dart';
|
||||
|
||||
class AssuranceHealthController extends GetxController {
|
||||
bool isLoading = false;
|
||||
Map tripCount = {};
|
||||
|
||||
Future getTripCountByCaptain() async {
|
||||
var res = await CRUD().get(link: AppLink.getTripCountByCaptain, payload: {
|
||||
"driver_id": box.read(BoxName.driverID).toString(),
|
||||
});
|
||||
if (res != 'failure') {
|
||||
tripCount = jsonDecode(res)['message'];
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> addDriverHealthAssurance({
|
||||
String? driverId,
|
||||
String? assured,
|
||||
required String healthInsuranceProvider,
|
||||
}) async {
|
||||
// Define the URL to your PHP backend
|
||||
|
||||
// Data to be sent to the backend
|
||||
Map<String, String> data = {
|
||||
"driver_id": box.read(BoxName.driverID).toString(),
|
||||
"assured": '1',
|
||||
"health_insurance_provider": healthInsuranceProvider,
|
||||
};
|
||||
|
||||
try {
|
||||
// Send the POST request to your backend
|
||||
var response = await CRUD()
|
||||
.post(link: AppLink.addHealthInsuranceProvider, payload: data);
|
||||
|
||||
if (response != 'failure') {
|
||||
// Handle success (e.g., show a success message)
|
||||
print("Health assurance data saved successfully");
|
||||
Get.snackbar(
|
||||
"Success".tr,
|
||||
"You have successfully opted for health insurance.".tr,
|
||||
backgroundColor: AppColor.greenColor,
|
||||
);
|
||||
} else {
|
||||
// Handle failure (e.g., show an error message)
|
||||
print("Failed to save health assurance data");
|
||||
Get.snackbar(
|
||||
"Error".tr,
|
||||
"Please enter a health insurance status.".tr,
|
||||
backgroundColor: AppColor.redColor,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
// Handle any errors
|
||||
print("Error: $e");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,28 @@ class MyTranslation extends Translations {
|
||||
'إذا كنت بحاجة إلى أي مساعدة أو لديك أي أسئلة، فهذا هو المكان المناسب لذلك. أهلاً وسهلاً بك!',
|
||||
'ID Mismatch': "عدم تطابق الرقم التعريفي",
|
||||
"face detect": "كشف الوجه",
|
||||
"Would you like to proceed with health insurance?":
|
||||
"هل ترغب في الاستمرار مع التأمين الصحي؟",
|
||||
"Confirmation": "تأكيد",
|
||||
"Enter Health Insurance Provider": "أدخل مزود التأمين الصحي",
|
||||
"Yes": "نعم",
|
||||
"No": "لا",
|
||||
"You need to complete 500 trips": "يجب عليك إكمال 500 رحلة",
|
||||
"Please enter a valid insurance provider":
|
||||
"الرجاء إدخال مزود تأمين صالح",
|
||||
"Opted out": "اختيار عدم الاستمرار",
|
||||
"You have chosen not to proceed with health insurance.":
|
||||
"لقد اخترت عدم الاستمرار مع التأمين الصحي.",
|
||||
"Do you have a disease for a long time?":
|
||||
"هل لديك مرض منذ فترة طويلة؟",
|
||||
|
||||
"When you complete 500 trips, you will be eligible for exclusive health insurance offers.":
|
||||
"عند إكمال 500 رحلة، ستكون مؤهلاً للحصول على عروض حصرية للتأمين الصحي.",
|
||||
"We have partnered with health insurance providers to offer you special health coverage. Complete 500 trips and receive a 20% discount on health insurance premiums.":
|
||||
"لقد عقدنا شراكة مع مزودي التأمين الصحي لتقديم تغطية صحية خاصة لك. أكمل 500 رحلة واحصل على خصم 20% على أقساط التأمين الصحي.",
|
||||
"Show health insurance providers near me":
|
||||
"اعرض مزودي التأمين الصحي القريبين مني",
|
||||
"Health Insurance": "التأمين الصحي",
|
||||
'An error occurred while saving driver data':
|
||||
"حدث خطأ أثناء حفظ بيانات السائق",
|
||||
"Face Detection Result": "نتيجة كشف الوجه",
|
||||
@@ -127,6 +149,17 @@ class MyTranslation extends Translations {
|
||||
"Afternoon Promo Rides": "رحلات بونص بعد الظهر",
|
||||
"Heading your way now. Please be ready.":
|
||||
"في طريقي إليك الآن. يرجى الاستعداد.",
|
||||
"Alert": "تنبيه",
|
||||
"You have successfully opted for health insurance.":
|
||||
"لقد اخترت التأمين الصحي بنجاح.",
|
||||
"Please enter a health insurance status.":
|
||||
"يرجى إدخال حالة التأمين الصحي",
|
||||
"The 3000 points equal 3000 L.E for you \nSo go and gain your money":
|
||||
"3000 نقطة تساوي 3000 جنيه لك \nلذا اذهب واحصل على أموالك",
|
||||
"Info": "معلومات",
|
||||
"You dont have money in your Wallet": "ليس لديك أموال في محفظتك",
|
||||
"You dont have money in your Wallet or you should less transfer 5 LE to activate":
|
||||
"ليس لديك أموال في محفظتك أو يجب عليك تحويل 5 جنيهات على الأقل لتفعيل الحساب",
|
||||
"Approaching your area. Should be there in 3 minutes.":
|
||||
"اقترب من منطقتك. يجب أن أكون هناك خلال 3 دقائق.",
|
||||
"There's heavy traffic here. Can you suggest an alternate pickup point?":
|
||||
|
||||
Reference in New Issue
Block a user