25-5-9/1
This commit is contained in:
@@ -15,6 +15,12 @@ class AK {
|
||||
static final String anthropicAIkeySeferNewHamzaayedpython =
|
||||
X.r(X.r(X.r(Env.anthropicAIkeySeferNewHamzaayedpython, cn), cC), cs);
|
||||
static final String emailService = (Env.emailService);
|
||||
static final String allowed = Env.allowed;
|
||||
static final String passnpassenger = X
|
||||
.r(X.r(X.r(Env.passnpassenger, cn), cC), cs)
|
||||
.toString()
|
||||
.split(Env.addd)[0];
|
||||
static final String newId = Env.newId;
|
||||
|
||||
///////////
|
||||
static final String keyOfApp = X.r(X.r(X.r(Env.keyOfApp, cn), cC), cs);
|
||||
|
||||
@@ -2,7 +2,13 @@ class BoxName {
|
||||
static const String driverID = "driverID";
|
||||
static const String countryCode = "countryCode";
|
||||
static const String googlaMapApp = "googlaMapApp";
|
||||
|
||||
static const String keyOfApp = 'keyOfApp';
|
||||
static const String initializationVector = 'initializationVector';
|
||||
static const String firstTimeLoadKey = 'firstTimeLoadKey';
|
||||
static const String jwt = "jwt";
|
||||
static const String fingerPrint = "fingerPrint";
|
||||
static const String payMobApikey = "payMobApikey";
|
||||
static const String refreshToken = "refreshToken";
|
||||
static const String tokenParent = "tokenParent";
|
||||
static const String lang = "lang";
|
||||
static const String gender = "gender";
|
||||
@@ -77,3 +83,11 @@ class BoxName {
|
||||
static const String tripData = 'tripData';
|
||||
static const String parentTripSelected = 'parentTripSelected';
|
||||
}
|
||||
|
||||
class Service {
|
||||
static const String driverPass = 'MG6DEJZSczBT6Rx0jOlehQ==';
|
||||
static const String payMobApikey = 'payMobApikey';
|
||||
static const String initializationVector = 'initializationVector';
|
||||
static const String keyOfApp = 'keyOfApp';
|
||||
static const String FCM_PRIVATE_KEY = 'FCM_PRIVATE_KEY';
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ class AppInformation {
|
||||
static const String email = 'hamzaayed@mobile-app.store';
|
||||
static const String complaintPrompt =
|
||||
'for this data for complaint from driver or passenger i collect all data i want you analyze this complaint and show what is reason and what is solution .this data collected from many table to find solution if payment in visa not complete and if ride status is finished it will be paymnet in payment table if ride status is not finished there is no need to pay and payment table is null for this ride and if paymentFromPaymentTable not null and visa type not cash the payment sucssessed . if ratingpassenger is low or passengr rating drivers low grade then dont mine of this passenger ,look at driver too like passengerratingdriver with rating or ratingtopassenger .in json add status of complaint and message to passenger and message to driver and message to call center write in arabic in json output with key in english .for output please just json i want';
|
||||
static const String addd = 'BlBlNl';
|
||||
|
||||
static const String privacyPolicy = '''
|
||||
|
||||
|
||||
@@ -10,9 +10,12 @@ class AppLink {
|
||||
static final String seferCairoServer = Env.seferCairoServer;
|
||||
static final String seferGizaServer = Env.seferGizaServer;
|
||||
// static final String server = Env.serverPHP;
|
||||
static String getBestDriver = "$server/Admin/driver/getBestDriver.php";
|
||||
static const String server = 'https://server.sefer.live/sefer.click/sefer';
|
||||
static const String jwtService = '$server/jwtService.php';
|
||||
|
||||
static final String endPoint = box.read(BoxName.serverChosen);
|
||||
static final String server = Env.seferCairoServer;
|
||||
// static final String server = Env.seferCairoServer;
|
||||
// static const String server = "https://sefer.click/sefer/sefer";
|
||||
static String googleMapsLink = 'https://maps.googleapis.com/maps/api/';
|
||||
static String llama = 'https://api.llama-api.com/chat/completions';
|
||||
@@ -55,8 +58,14 @@ class AppLink {
|
||||
static String addNotesDriver = "$serviceApp/addNotesDriver.php";
|
||||
static String getCarPlateNotEdit = "$serviceApp/getCarPlateNotEdit.php";
|
||||
static String getdriverWithoutCar = "$serviceApp/getdriverWithoutCar.php";
|
||||
static String getBestDriverGiza =
|
||||
"https://gizasefer.online/sefer/Admin/driver/getBestDriver.php";
|
||||
static String getBestDriverAlexandria =
|
||||
"$seferAlexandriaServer/Admin/driver/getBestDriver.php";
|
||||
static String addNotesPassenger = "$serviceApp/addNotesPassenger.php";
|
||||
static String editCarPlate = "$serviceApp/editCarPlate.php";
|
||||
static String addDriverWantWork = "$serviceApp/work/addDriverWantWork.php";
|
||||
static String addCarWantWork = "$serviceApp/work/addCarWantWork.php";
|
||||
static String getComplaintAllData = "$serviceApp/getComplaintAllData.php";
|
||||
static String getComplaintAllDataForDriver =
|
||||
"$serviceApp/getComplaintAllDataForDriver.php";
|
||||
|
||||
@@ -1,30 +1,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../main.dart';
|
||||
import 'box_name.dart';
|
||||
import 'colors.dart';
|
||||
|
||||
class AppStyle {
|
||||
static TextStyle headTitle = const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 40,
|
||||
color: AppColor.accentColor,
|
||||
);
|
||||
static TextStyle headTitle2 = const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 26,
|
||||
color: AppColor.writeColor,
|
||||
);
|
||||
static TextStyle headTitle = TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 36,
|
||||
color: AppColor.accentColor,
|
||||
fontFamily: box.read(BoxName.lang) == 'ar'
|
||||
// ?GoogleFonts.markaziText().fontFamily
|
||||
? GoogleFonts.markaziText().fontFamily
|
||||
: GoogleFonts.inter().fontFamily);
|
||||
static TextStyle headTitle2 = TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 24,
|
||||
color: AppColor.writeColor,
|
||||
fontFamily: box.read(BoxName.lang) == 'ar'
|
||||
? GoogleFonts.markaziText().fontFamily
|
||||
: GoogleFonts.inter().fontFamily);
|
||||
static TextStyle title = TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: box.read(BoxName.lang) == 'ar' ? 14 : 16,
|
||||
color: AppColor.writeColor,
|
||||
);
|
||||
static TextStyle subtitle = const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13,
|
||||
color: AppColor.writeColor,
|
||||
);
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 16,
|
||||
color: AppColor.writeColor,
|
||||
fontFamily: box.read(BoxName.lang) == 'ar'
|
||||
? GoogleFonts.markaziText().fontFamily
|
||||
: GoogleFonts.inter().fontFamily);
|
||||
static TextStyle subtitle = TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
color: AppColor.writeColor,
|
||||
fontFamily: box.read(BoxName.lang) == 'ar'
|
||||
? GoogleFonts.markaziText().fontFamily
|
||||
: GoogleFonts.inter().fontFamily);
|
||||
static TextStyle number = const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
|
||||
71
lib/controller/best_driver_controllers.dart
Normal file
71
lib/controller/best_driver_controllers.dart
Normal file
@@ -0,0 +1,71 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../print.dart';
|
||||
import 'functions/crud.dart';
|
||||
|
||||
class Driverthebest extends GetxController {
|
||||
bool isLoading = false;
|
||||
List driver = [];
|
||||
getBestDriver() async {
|
||||
var res = await CRUD().get(link: AppLink.getBestDriver, payload: {});
|
||||
if (res != 'failure') {
|
||||
driver = jsonDecode(res)['message'];
|
||||
// Log.print('driver: ${driver}');
|
||||
update();
|
||||
} else {
|
||||
Get.snackbar('error', '', backgroundColor: AppColor.redColor);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
getBestDriver();
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
|
||||
class DriverTheBestGizaController extends GetxController {
|
||||
bool isLoading = false;
|
||||
List driver = [];
|
||||
getBestDriver() async {
|
||||
var res = await CRUD().get(link: AppLink.getBestDriverGiza, payload: {});
|
||||
if (res != 'failure') {
|
||||
driver = jsonDecode(res)['message'];
|
||||
|
||||
update();
|
||||
} else {
|
||||
Get.snackbar('error', '', backgroundColor: AppColor.redColor);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
getBestDriver();
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
|
||||
class DriverTheBestAlexandriaController extends GetxController {
|
||||
bool isLoading = false;
|
||||
List driver = [];
|
||||
getBestDriver() async {
|
||||
var res =
|
||||
await CRUD().get(link: AppLink.getBestDriverAlexandria, payload: {});
|
||||
if (res != 'failure') {
|
||||
driver = jsonDecode(res)['message'];
|
||||
update();
|
||||
} else {
|
||||
Get.snackbar('error', '', backgroundColor: AppColor.redColor);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
getBestDriver();
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,52 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:jwt_decoder/jwt_decoder.dart';
|
||||
import 'package:secure_string_operations/secure_string_operations.dart';
|
||||
import 'package:service/constant/char_map.dart';
|
||||
|
||||
import '../../constant/api_key.dart';
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/info.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import 'encrypt_decrypt.dart';
|
||||
import 'initilize.dart';
|
||||
|
||||
class CRUD {
|
||||
var dev;
|
||||
getJWT() async {
|
||||
var dev = Platform.isAndroid ? 'android' : 'ios';
|
||||
var payload = {
|
||||
'password': AK.passnpassenger,
|
||||
// 'email': box.read(BoxName.email),
|
||||
'aud': '${AK.allowed}$dev',
|
||||
};
|
||||
// if (box.read(BoxName.firstTimeLoadKey).toString() != 'false') {
|
||||
var response0 = await http.post(
|
||||
Uri.parse(AppLink.jwtService),
|
||||
body: payload,
|
||||
);
|
||||
|
||||
if (response0.statusCode == 200) {
|
||||
final decodedResponse1 = jsonDecode(response0.body);
|
||||
|
||||
final jwt = decodedResponse1['jwt'];
|
||||
box.write(BoxName.jwt, X.c(X.c(X.c(jwt, cn), cC), cs));
|
||||
|
||||
await AppInitializer().getAIKey(Service.keyOfApp);
|
||||
await AppInitializer().getAIKey(Service.initializationVector);
|
||||
await Future.delayed(Duration.zero);
|
||||
await EncryptionHelper.initialize();
|
||||
|
||||
await AppInitializer().getAIKey(Service.FCM_PRIVATE_KEY);
|
||||
box.write(BoxName.firstTimeLoadKey, 'false');
|
||||
// await AppInitializer().getKey();
|
||||
} else {}
|
||||
}
|
||||
|
||||
Future<dynamic> get({
|
||||
required String link,
|
||||
Map<String, dynamic>? payload,
|
||||
@@ -16,18 +54,24 @@ class CRUD {
|
||||
var url = Uri.parse(
|
||||
link,
|
||||
);
|
||||
bool isTokenExpired = JwtDecoder.isExpired(X
|
||||
.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs)
|
||||
.toString()
|
||||
.split(AppInformation.addd)[0]);
|
||||
|
||||
if (isTokenExpired) {
|
||||
await getJWT();
|
||||
}
|
||||
var response = await http.post(
|
||||
url,
|
||||
body: payload,
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
|
||||
'Bearer ${X.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs).toString().split(AppInformation.addd)[0]}'
|
||||
},
|
||||
);
|
||||
Log.print('response: ${response.body}');
|
||||
Log.print('response: ${response.request}');
|
||||
Log.print('payload: $payload');
|
||||
print(response.body);
|
||||
// if (response.statusCode == 200) {
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (jsonData['status'] == 'success') {
|
||||
@@ -49,18 +93,14 @@ class CRUD {
|
||||
|
||||
String imagePathFull =
|
||||
'${AppLink.server}/card_image/$imagePath-$driverID.jpg';
|
||||
Log.print('imagePathFull: $imagePathFull');
|
||||
var request = http.Request(
|
||||
'POST',
|
||||
Uri.parse(
|
||||
'https://eastus.api.cognitive.microsoft.com/computervision/imageanalysis:analyze?features=caption,read&model-version=latest&language=en&api-version=2024-02-01'));
|
||||
request.body = json.encode({"url": imagePathFull});
|
||||
Log.print('request.body: ${request.body}');
|
||||
request.headers.addAll(headers);
|
||||
Log.print('request.headers: ${request.headers}');
|
||||
|
||||
http.StreamedResponse response = await request.send();
|
||||
Log.print('response: ${response}');
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return await response.stream.bytesToString();
|
||||
@@ -131,27 +171,29 @@ class CRUD {
|
||||
var url = Uri.parse(
|
||||
link,
|
||||
);
|
||||
bool isTokenExpired = JwtDecoder.isExpired(X
|
||||
.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs)
|
||||
.toString()
|
||||
.split(AppInformation.addd)[0]);
|
||||
|
||||
if (isTokenExpired) {
|
||||
await getJWT();
|
||||
}
|
||||
var response = await http.post(
|
||||
url,
|
||||
body: payload,
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
|
||||
'Bearer ${X.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs).toString().split(AppInformation.addd)[0]}'
|
||||
},
|
||||
);
|
||||
Log.print('payload: ${payload}');
|
||||
Log.print('response.request: ${response.request}');
|
||||
Log.print('response.body: ${response.body}');
|
||||
Log.print('response.reasonPhrase: ${response.reasonPhrase}');
|
||||
// print(response.statusCode);
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
if (jsonData['status'] == 'success') {
|
||||
return response.body;
|
||||
} else {
|
||||
String errorMessage = jsonData['message'];
|
||||
Log.print('errorMessage: ${errorMessage}');
|
||||
// Get.snackbar('Error'.tr, errorMessage.tr,
|
||||
// backgroundColor: AppColor.redColor);
|
||||
return (jsonData['status']);
|
||||
|
||||
68
lib/controller/functions/encrypt_decrypt.dart
Normal file
68
lib/controller/functions/encrypt_decrypt.dart
Normal file
@@ -0,0 +1,68 @@
|
||||
import 'package:encrypt/encrypt.dart' as encrypt;
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../main.dart';
|
||||
|
||||
class EncryptionHelper {
|
||||
static EncryptionHelper? _instance;
|
||||
|
||||
late final encrypt.Key key;
|
||||
late final encrypt.IV iv;
|
||||
|
||||
EncryptionHelper._(this.key, this.iv);
|
||||
static EncryptionHelper get instance {
|
||||
if (_instance == null) {
|
||||
throw Exception(
|
||||
"EncryptionHelper is not initialized. Call `await EncryptionHelper.initialize()` in main.");
|
||||
}
|
||||
return _instance!;
|
||||
}
|
||||
|
||||
/// Initializes and stores the instance globally
|
||||
static Future<void> initialize() async {
|
||||
if (_instance != null) {
|
||||
debugPrint("EncryptionHelper is already initialized.");
|
||||
return; // Prevent re-initialization
|
||||
}
|
||||
debugPrint("Initializing EncryptionHelper...");
|
||||
// Read stored keys
|
||||
String? keyOfApp = await storage.read(key: BoxName.keyOfApp);
|
||||
// Log.print('keyOfApp: ${keyOfApp}');
|
||||
String? initializationVector =
|
||||
await storage.read(key: BoxName.initializationVector);
|
||||
// Log.print('initializationVector: ${initializationVector}');
|
||||
// Set the global instance
|
||||
_instance = EncryptionHelper._(
|
||||
encrypt.Key.fromUtf8(keyOfApp!),
|
||||
encrypt.IV.fromUtf8(initializationVector!),
|
||||
);
|
||||
debugPrint("EncryptionHelper initialized successfully.");
|
||||
}
|
||||
|
||||
/// Encrypts a string
|
||||
String encryptData(String plainText) {
|
||||
try {
|
||||
final encrypter =
|
||||
encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.cbc));
|
||||
final encrypted = encrypter.encrypt(plainText, iv: iv);
|
||||
return encrypted.base64;
|
||||
} catch (e) {
|
||||
debugPrint('Encryption Error: $e');
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/// Decrypts a string
|
||||
String decryptData(String encryptedText) {
|
||||
try {
|
||||
final encrypter =
|
||||
encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.cbc));
|
||||
final encrypted = encrypt.Encrypted.fromBase64(encryptedText);
|
||||
return encrypter.decrypt(encrypted, iv: iv);
|
||||
} catch (e) {
|
||||
debugPrint('Decryption Error: $e');
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
44
lib/controller/functions/initilize.dart
Normal file
44
lib/controller/functions/initilize.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:jwt_decoder/jwt_decoder.dart';
|
||||
import 'package:secure_string_operations/secure_string_operations.dart';
|
||||
import 'package:service/controller/functions/crud.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/char_map.dart';
|
||||
import '../../constant/info.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../env/env.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
|
||||
class AppInitializer {
|
||||
List<Map<String, dynamic>> links = [];
|
||||
|
||||
Future<void> initializeApp() async {
|
||||
if (box.read(BoxName.jwt) == null) {
|
||||
await CRUD().getJWT();
|
||||
} else {
|
||||
bool isTokenExpired = JwtDecoder.isExpired(X
|
||||
.r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs)
|
||||
.toString()
|
||||
.split(AppInformation.addd)[0]);
|
||||
if (isTokenExpired) {
|
||||
await CRUD().getJWT();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getAIKey(String key1) async {
|
||||
if (box.read(BoxName.firstTimeLoadKey) == null) {
|
||||
var res =
|
||||
await CRUD().get(link: Env.getapiKey, payload: {"keyName": key1});
|
||||
if (res != 'failure') {
|
||||
var d = jsonDecode(res)['message'];
|
||||
Log.print('d: ${d}');
|
||||
await storage.write(key: key1, value: d[key1].toString());
|
||||
await Future.delayed(Duration.zero);
|
||||
} else {}
|
||||
}
|
||||
}
|
||||
}
|
||||
76
lib/controller/functions/launch.dart
Normal file
76
lib/controller/functions/launch.dart
Normal file
@@ -0,0 +1,76 @@
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'dart:io';
|
||||
|
||||
void showInBrowser(String url) async {
|
||||
if (await canLaunchUrl(Uri.parse(url))) {
|
||||
launchUrl(Uri.parse(url));
|
||||
} else {}
|
||||
}
|
||||
|
||||
Future<void> makePhoneCall(String phoneNumber) async {
|
||||
final Uri launchUri = Uri(
|
||||
scheme: 'tel',
|
||||
path: phoneNumber,
|
||||
);
|
||||
await launchUrl(launchUri);
|
||||
}
|
||||
|
||||
void launchCommunication(
|
||||
String method, String contactInfo, String message) async {
|
||||
String url;
|
||||
|
||||
if (Platform.isIOS) {
|
||||
switch (method) {
|
||||
case 'phone':
|
||||
url = 'tel:$contactInfo';
|
||||
break;
|
||||
case 'sms':
|
||||
url = 'sms:$contactInfo?body=${Uri.encodeComponent(message)}';
|
||||
break;
|
||||
case 'whatsapp':
|
||||
url =
|
||||
'https://api.whatsapp.com/send?phone=$contactInfo&text=${Uri.encodeComponent(message)}';
|
||||
break;
|
||||
case 'email':
|
||||
url =
|
||||
'mailto:$contactInfo?subject=Subject&body=${Uri.encodeComponent(message)}';
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
} else if (Platform.isAndroid) {
|
||||
switch (method) {
|
||||
case 'phone':
|
||||
url = 'tel:$contactInfo';
|
||||
break;
|
||||
case 'sms':
|
||||
url = 'sms:$contactInfo?body=${Uri.encodeComponent(message)}';
|
||||
break;
|
||||
case 'whatsapp':
|
||||
// Check if WhatsApp is installed
|
||||
final bool whatsappInstalled =
|
||||
await canLaunchUrl(Uri.parse('whatsapp://'));
|
||||
if (whatsappInstalled) {
|
||||
url =
|
||||
'whatsapp://send?phone=$contactInfo&text=${Uri.encodeComponent(message)}';
|
||||
} else {
|
||||
// Provide an alternative action, such as opening the WhatsApp Web API
|
||||
url =
|
||||
'https://api.whatsapp.com/send?phone=$contactInfo&text=${Uri.encodeComponent(message)}';
|
||||
}
|
||||
break;
|
||||
case 'email':
|
||||
url =
|
||||
'mailto:$contactInfo?subject=Subject&body=${Uri.encodeComponent(message)}';
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (await canLaunchUrl(Uri.parse(url))) {
|
||||
await launchUrl(Uri.parse(url));
|
||||
} else {}
|
||||
}
|
||||
@@ -8,149 +8,95 @@ import '../themes/themes.dart';
|
||||
class LocaleController extends GetxController {
|
||||
Locale? language;
|
||||
String countryCode = '';
|
||||
void restartApp() {
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
ThemeData appTheme = themeEnglish;
|
||||
ThemeData appTheme = lightThemeEnglish;
|
||||
|
||||
changeLang(String langcode) {
|
||||
void changeLang(String langcode) {
|
||||
Locale locale;
|
||||
switch (langcode) {
|
||||
case "ar":
|
||||
locale = const Locale("ar");
|
||||
appTheme = themeArabic;
|
||||
appTheme = lightThemeArabic;
|
||||
box.write(BoxName.lang, 'ar');
|
||||
break;
|
||||
case "en":
|
||||
locale = const Locale("en");
|
||||
appTheme = themeEnglish;
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'en');
|
||||
break;
|
||||
case "tr":
|
||||
locale = const Locale("tr");
|
||||
appTheme = themeEnglish;
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'tr');
|
||||
break;
|
||||
case "fr":
|
||||
locale = const Locale("fr");
|
||||
appTheme = themeEnglish;
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'fr');
|
||||
break;
|
||||
case "it":
|
||||
locale = const Locale("it");
|
||||
appTheme = themeEnglish;
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'it');
|
||||
break;
|
||||
case "de":
|
||||
locale = const Locale("de");
|
||||
appTheme = themeEnglish;
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'de');
|
||||
break;
|
||||
case "el":
|
||||
locale = const Locale("el");
|
||||
appTheme = themeEnglish;
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'el');
|
||||
break;
|
||||
case "es":
|
||||
locale = const Locale("es");
|
||||
appTheme = themeEnglish;
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'es');
|
||||
break;
|
||||
case "fa":
|
||||
locale = const Locale("fa");
|
||||
appTheme = themeEnglish;
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'fa');
|
||||
break;
|
||||
case "zh":
|
||||
locale = const Locale("zh");
|
||||
appTheme = themeEnglish;
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'zh');
|
||||
break;
|
||||
case "ru":
|
||||
locale = const Locale("ru");
|
||||
appTheme = themeEnglish;
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'ru');
|
||||
break;
|
||||
case "hi":
|
||||
locale = const Locale("hi");
|
||||
appTheme = themeEnglish;
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'hi');
|
||||
break;
|
||||
default:
|
||||
locale = Locale(Get.deviceLocale!.languageCode);
|
||||
box.write(BoxName.lang, Get.deviceLocale!.languageCode);
|
||||
appTheme = themeEnglish;
|
||||
appTheme = lightThemeEnglish;
|
||||
break;
|
||||
}
|
||||
|
||||
box.write(BoxName.lang, langcode);
|
||||
// box.write(BoxName.lang, langcode);
|
||||
Get.changeTheme(appTheme);
|
||||
Get.updateLocale(locale);
|
||||
restartApp();
|
||||
update();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
String storedLang = box.read(BoxName.lang) ?? "";
|
||||
switch (storedLang) {
|
||||
case "ar":
|
||||
language = const Locale("ar");
|
||||
appTheme = themeArabic;
|
||||
break;
|
||||
case "en":
|
||||
language = const Locale("en");
|
||||
appTheme = themeEnglish;
|
||||
break;
|
||||
case "tr":
|
||||
language = const Locale("tr");
|
||||
appTheme = themeEnglish;
|
||||
break;
|
||||
case "fr":
|
||||
language = const Locale("fr");
|
||||
appTheme = themeEnglish;
|
||||
break;
|
||||
case "it":
|
||||
language = const Locale("it");
|
||||
appTheme = themeEnglish;
|
||||
break;
|
||||
case "de":
|
||||
language = const Locale("de");
|
||||
appTheme = themeEnglish;
|
||||
break;
|
||||
case "el":
|
||||
language = const Locale("el");
|
||||
appTheme = themeEnglish;
|
||||
break;
|
||||
case "es":
|
||||
language = const Locale("es");
|
||||
appTheme = themeEnglish;
|
||||
break;
|
||||
case "fa":
|
||||
language = const Locale("fa");
|
||||
appTheme = themeArabic;
|
||||
break;
|
||||
case "zh":
|
||||
language = const Locale("zh");
|
||||
appTheme = themeEnglish;
|
||||
break;
|
||||
case "ru":
|
||||
language = const Locale("ru");
|
||||
appTheme = themeEnglish;
|
||||
break;
|
||||
case "hi":
|
||||
language = const Locale("hi");
|
||||
appTheme = themeEnglish;
|
||||
break;
|
||||
default:
|
||||
language = Locale(Get.deviceLocale!.languageCode);
|
||||
// language = Locale(Get.deviceLocale!.languageCode);
|
||||
appTheme = themeEnglish;
|
||||
break;
|
||||
String? storedLang = box.read(BoxName.lang);
|
||||
if (storedLang == null) {
|
||||
// Use device language if no language is stored
|
||||
storedLang = Get.deviceLocale!.languageCode;
|
||||
box.write(BoxName.lang, storedLang);
|
||||
}
|
||||
|
||||
changeLang(storedLang);
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,25 @@ class MyTranslation extends Translations {
|
||||
"yellow": "أصفر",
|
||||
"purple": "أرجواني",
|
||||
"orange": "برتقالي",
|
||||
"pink": "وردي",
|
||||
"pink": "وردي", "best driver": "أفضل سائق",
|
||||
"brown": "بني",
|
||||
'Insert site of Owner': "أدخل موقع المالك",
|
||||
'Insert site of Driver': "أدخل موقع السائق",
|
||||
'Insert registration_date of Car': "أدخل تاريخ تسجيل السيارة",
|
||||
'Insert phone of Owner': "أدخل هاتف المالك",
|
||||
'Insert Name of Owner': "أدخل اسم المالك",
|
||||
'Insert year of Car': "أدخل سنة السيارة",
|
||||
'Insert registration_date of Driver': "",
|
||||
'Insert car_type of Driver': "أدخل نوع السيارة للسائق",
|
||||
'Insert car_model of Driver': "أدخل طراز السيارة للسائق",
|
||||
'Insert car_number of Driver': "أدخل رقم سيارة السائق",
|
||||
"Add Car Who Wants to Work": "أضف السيارة التي ترغب في العمل",
|
||||
"Add Driver Who Wants to Work": "إضافة سائق يرغب في العمل",
|
||||
"Insert Name of Driver": "أدخل اسم السائق",
|
||||
'Insert national ID of Driver': "أدخل الرقم الوطني للسائق",
|
||||
'Insert phone of Driver': "أدخل رقم هاتف السائق",
|
||||
"Insert license type of Driver": "أدخل نوع رخصة السائق",
|
||||
'Insert birth_date of Driver': "أدخل تاريخ ميلاد السائق",
|
||||
"gray": "رمادي",
|
||||
"cyan": "سماوي",
|
||||
"magenta": "بنفسجي",
|
||||
|
||||
@@ -19,14 +19,15 @@ class LoginController extends GetxController {
|
||||
|
||||
void login() async {
|
||||
String? storedEmail = await storage.read(key: 'email');
|
||||
String? storedPassword = await storage.read(key: 'password');
|
||||
|
||||
if (storedEmail != null) {
|
||||
Get.off(() => Main());
|
||||
} else {
|
||||
if (formKey.currentState!.validate()) {
|
||||
var res = await CRUD().get(link: AppLink.login, payload: {
|
||||
"email": email.text,
|
||||
"password": password.text,
|
||||
"email": storedEmail ?? email.text,
|
||||
"password": storedPassword ?? password.text,
|
||||
});
|
||||
|
||||
if (res != 'failure') {
|
||||
@@ -36,6 +37,7 @@ class LoginController extends GetxController {
|
||||
await storage.write(key: 'email', value: d['data']['email']);
|
||||
await storage.write(key: 'name', value: d['data']['first_name']);
|
||||
await storage.write(key: 'driverID', value: d['data']['id']);
|
||||
await storage.write(key: 'password', value: password.text);
|
||||
|
||||
Get.off(() => Main());
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:service/constant/box_name.dart';
|
||||
import 'package:service/constant/colors.dart';
|
||||
import 'package:service/constant/links.dart';
|
||||
import 'package:service/controller/functions/crud.dart';
|
||||
import 'package:service/controller/mainController/pages/driver_page.dart';
|
||||
import 'package:service/main.dart';
|
||||
import 'package:service/views/widgets/my_dialog.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
@@ -26,6 +28,20 @@ class MainController extends GetxController {
|
||||
TextEditingController expirationDateController = TextEditingController();
|
||||
TextEditingController yearController = TextEditingController();
|
||||
TextEditingController ownerController = TextEditingController();
|
||||
TextEditingController carOwnerWorkController = TextEditingController();
|
||||
TextEditingController driverNameController = TextEditingController();
|
||||
TextEditingController nationalIdController = TextEditingController();
|
||||
TextEditingController birthDateController = TextEditingController();
|
||||
TextEditingController licenseTypeController = TextEditingController();
|
||||
TextEditingController phoneController = TextEditingController();
|
||||
TextEditingController phoneCarController = TextEditingController();
|
||||
TextEditingController carNumberController = TextEditingController();
|
||||
TextEditingController manufactureYearController = TextEditingController();
|
||||
TextEditingController carModelController = TextEditingController();
|
||||
TextEditingController carTypeController = TextEditingController();
|
||||
TextEditingController siteCarController = TextEditingController();
|
||||
TextEditingController siteDriverController = TextEditingController();
|
||||
TextEditingController registrationDateController = TextEditingController();
|
||||
Map passengerData = {};
|
||||
Map driverData = {};
|
||||
List filteredDrivers = [];
|
||||
@@ -308,6 +324,7 @@ class MainController extends GetxController {
|
||||
"model": model,
|
||||
"expiration_date": expirationDate.toString(),
|
||||
"owner": owner,
|
||||
"employee": storage.read(key: 'name').toString(),
|
||||
});
|
||||
Log.print('res: ${res}');
|
||||
if (res != 'failure') {
|
||||
|
||||
@@ -3,14 +3,14 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:service/constant/style.dart';
|
||||
import 'package:service/controller/mainController/pages/edit_car.dart';
|
||||
import 'package:service/controller/functions/launch.dart';
|
||||
import 'package:service/views/widgets/my_scafold.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/links.dart';
|
||||
import '../../../print.dart';
|
||||
import '../../../views/widgets/my_textField.dart';
|
||||
import '../../functions/crud.dart';
|
||||
import '../../functions/encrypt_decrypt.dart';
|
||||
import '../../functions/image.dart';
|
||||
import '../main_controller.dart';
|
||||
|
||||
class AddCar extends StatelessWidget {
|
||||
@@ -40,7 +40,8 @@ class AddCar extends StatelessWidget {
|
||||
},
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Text(carData['name_arabic'])),
|
||||
child: Text(EncryptionHelper.instance
|
||||
.decryptData(carData['name_arabic']))),
|
||||
),
|
||||
);
|
||||
}),
|
||||
@@ -59,126 +60,149 @@ class AddCarForm extends StatelessWidget {
|
||||
Get.put(MainController());
|
||||
|
||||
return GetBuilder<MainController>(builder: (mainController) {
|
||||
return MyScaffold(title: 'Add Car', isleading: true, body: [
|
||||
ListView(
|
||||
children: [
|
||||
Column(
|
||||
return MyScaffold(
|
||||
title: 'Add Car',
|
||||
action: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
makePhoneCall(carData['phone']);
|
||||
},
|
||||
icon: const Icon(Icons.phone),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
launchCommunication('whatsapp', carData['phone'], '');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.message,
|
||||
color: AppColor.greenColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
isleading: true,
|
||||
body: [
|
||||
ListView(
|
||||
children: [
|
||||
Image.network(
|
||||
'https://sefer.click/sefer/card_image/car_front-${carData['id']}.jpg',
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
Image.network(
|
||||
'https://sefer.click/sefer/card_image/car_back-${carData['id']}.jpg',
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 9),
|
||||
Form(
|
||||
key: mainController.formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .6,
|
||||
child: MyTextForm(
|
||||
controller: mainController.carplateController,
|
||||
label: 'car plate'.tr,
|
||||
hint: 'car plate'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
if (mainController.formKey.currentState!.validate()) {
|
||||
await mainController
|
||||
.addRegistrationCarEgyptHandling(
|
||||
driverId: carData['id'].toString(),
|
||||
carPlate: mainController.carplateController.text,
|
||||
color: mainController.colorController.text,
|
||||
colorHex:
|
||||
mainController.colorHex.value.toString(),
|
||||
year: mainController.yearController.text,
|
||||
make: mainController.makeController.text,
|
||||
model: mainController.modelController.text,
|
||||
expirationDate:
|
||||
mainController.expirationDateController.text,
|
||||
owner: mainController.ownerController.text,
|
||||
);
|
||||
}
|
||||
Column(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onLongPress: () async {
|
||||
await ImageController().choosImage(
|
||||
AppLink.uploadEgypt, carData['id'], 'car_front');
|
||||
},
|
||||
child: Image.network(
|
||||
'https://sefer.click/sefer/card_image/car_front-${carData['id']}.jpg',
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fill,
|
||||
errorBuilder: (BuildContext context, Object exception,
|
||||
StackTrace? stackTrace) {
|
||||
// If the image fails to load, use the _copy version
|
||||
return Image.network(
|
||||
'https://sefer.click/sefer/card_image/car_front-${carData['id']}_copy.jpg',
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fill,
|
||||
);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.upload_outlined,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// Other fields
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
),
|
||||
GestureDetector(
|
||||
onLongPress: () async {
|
||||
await ImageController().choosImage(
|
||||
AppLink.uploadEgypt, carData['id'], 'car_back');
|
||||
},
|
||||
child: Image.network(
|
||||
'https://sefer.click/sefer/card_image/car_back-${carData['id']}.jpg',
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fill,
|
||||
errorBuilder: (BuildContext context, Object exception,
|
||||
StackTrace? stackTrace) {
|
||||
// If the image fails to load, use the _copy version
|
||||
return Image.network(
|
||||
'https://sefer.click/sefer/card_image/car_back-${carData['id']}_copy.jpg',
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fill,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 9),
|
||||
Form(
|
||||
key: mainController.formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.yearController,
|
||||
label: 'Year'.tr,
|
||||
hint: 'Year'.tr,
|
||||
type: TextInputType.number,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: DropdownButtonFormField<String>(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Color'.tr, // Localized label
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .6,
|
||||
child: MyTextForm(
|
||||
controller: mainController.carplateController,
|
||||
label: 'car plate'.tr,
|
||||
hint: 'car plate'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
),
|
||||
value: mainController.colorHex.value.isEmpty
|
||||
? null
|
||||
: mainController.colorHex
|
||||
.value, // Use the hex value as the current value
|
||||
items: [
|
||||
{'red'.tr: '#FF0000'},
|
||||
{'green'.tr: '#008000'},
|
||||
{'blue'.tr: '#0000FF'},
|
||||
{'black'.tr: '#000000'},
|
||||
{'white'.tr: '#FFFFFF'},
|
||||
{'yellow'.tr: '#FFFF00'},
|
||||
{'purple'.tr: '#800080'},
|
||||
{'orange'.tr: '#FFA500'},
|
||||
{'pink'.tr: '#FFC0CB'},
|
||||
{'brown'.tr: '#A52A2A'},
|
||||
{'gray'.tr: '#808080'},
|
||||
{'cyan'.tr: '#00FFFF'},
|
||||
{'magenta'.tr: '#FF00FF'},
|
||||
{'lime'.tr: '#00FF00'},
|
||||
{'indigo'.tr: '#4B0082'},
|
||||
{'violet'.tr: '#EE82EE'},
|
||||
{'gold'.tr: '#FFD700'},
|
||||
{'silver'.tr: '#C0C0C0'},
|
||||
{'teal'.tr: '#008080'},
|
||||
{'navy'.tr: '#000080'},
|
||||
].map((colorMap) {
|
||||
String colorName = colorMap.keys.first;
|
||||
String colorValue = colorMap.values.first;
|
||||
return DropdownMenuItem<String>(
|
||||
value: colorValue,
|
||||
child: Text(colorName),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
// Find the selected color name based on the hex value
|
||||
String selectedColorName = '';
|
||||
for (var colorMap in [
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
if (mainController.formKey.currentState!
|
||||
.validate()) {
|
||||
await mainController
|
||||
.addRegistrationCarEgyptHandling(
|
||||
driverId: carData['id'].toString(),
|
||||
carPlate:
|
||||
mainController.carplateController.text,
|
||||
color: mainController.colorController.text,
|
||||
colorHex:
|
||||
mainController.colorHex.value.toString(),
|
||||
year: mainController.yearController.text,
|
||||
make: mainController.makeController.text,
|
||||
model: mainController.modelController.text,
|
||||
expirationDate: mainController
|
||||
.expirationDateController.text,
|
||||
owner: mainController.ownerController.text,
|
||||
);
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.upload_outlined,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// Other fields
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.yearController,
|
||||
label: 'Year'.tr,
|
||||
hint: 'Year'.tr,
|
||||
type: TextInputType.number,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: DropdownButtonFormField<String>(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Color'.tr, // Localized label
|
||||
),
|
||||
value: mainController.colorHex.value.isEmpty
|
||||
? null
|
||||
: mainController.colorHex
|
||||
.value, // Use the hex value as the current value
|
||||
items: [
|
||||
{'red'.tr: '#FF0000'},
|
||||
{'green'.tr: '#008000'},
|
||||
{'blue'.tr: '#0000FF'},
|
||||
@@ -199,120 +223,157 @@ class AddCarForm extends StatelessWidget {
|
||||
{'silver'.tr: '#C0C0C0'},
|
||||
{'teal'.tr: '#008080'},
|
||||
{'navy'.tr: '#000080'},
|
||||
]) {
|
||||
if (colorMap.values.first == value) {
|
||||
selectedColorName = colorMap.keys.first;
|
||||
break;
|
||||
].map((colorMap) {
|
||||
String colorName = colorMap.keys.first;
|
||||
String colorValue = colorMap.values.first;
|
||||
return DropdownMenuItem<String>(
|
||||
value: colorValue,
|
||||
child: Text(colorName),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
// Find the selected color name based on the hex value
|
||||
String selectedColorName = '';
|
||||
for (var colorMap in [
|
||||
{'red'.tr: '#FF0000'},
|
||||
{'green'.tr: '#008000'},
|
||||
{'blue'.tr: '#0000FF'},
|
||||
{'black'.tr: '#000000'},
|
||||
{'white'.tr: '#FFFFFF'},
|
||||
{'yellow'.tr: '#FFFF00'},
|
||||
{'purple'.tr: '#800080'},
|
||||
{'orange'.tr: '#FFA500'},
|
||||
{'pink'.tr: '#FFC0CB'},
|
||||
{'brown'.tr: '#A52A2A'},
|
||||
{'gray'.tr: '#808080'},
|
||||
{'cyan'.tr: '#00FFFF'},
|
||||
{'magenta'.tr: '#FF00FF'},
|
||||
{'lime'.tr: '#00FF00'},
|
||||
{'indigo'.tr: '#4B0082'},
|
||||
{'violet'.tr: '#EE82EE'},
|
||||
{'gold'.tr: '#FFD700'},
|
||||
{'silver'.tr: '#C0C0C0'},
|
||||
{'teal'.tr: '#008080'},
|
||||
{'navy'.tr: '#000080'},
|
||||
]) {
|
||||
if (colorMap.values.first == value) {
|
||||
selectedColorName = colorMap.keys.first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mainController.colorController.text =
|
||||
selectedColorName;
|
||||
mainController.colorHex.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
mainController.colorController.text =
|
||||
selectedColorName;
|
||||
mainController.colorHex.value = value;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.makeController,
|
||||
label: 'Make'.tr,
|
||||
hint: 'Make'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.modelController,
|
||||
label: 'Model'.tr,
|
||||
hint: 'Model'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: TextField(
|
||||
controller: mainController.expirationDateController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Expiration Date'.tr,
|
||||
hintText: 'Expiration Date'.tr,
|
||||
},
|
||||
),
|
||||
),
|
||||
readOnly:
|
||||
true, // Make the field read-only to prevent manual input
|
||||
onTap: () async {
|
||||
DateTime pickedDate =
|
||||
DateTime.now(); // Declare the variable here
|
||||
|
||||
await showCupertinoModalPopup<void>(
|
||||
context: context,
|
||||
builder: (context) => Container(
|
||||
height: 250,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 150,
|
||||
child: CupertinoDatePicker(
|
||||
initialDateTime: pickedDate,
|
||||
minimumDate: DateTime(
|
||||
1955), // Set the starting date
|
||||
maximumDate: DateTime(
|
||||
2034), // Set the ending date
|
||||
mode: CupertinoDatePickerMode.date,
|
||||
onDateTimeChanged: (DateTime dateTime) {
|
||||
pickedDate = dateTime;
|
||||
},
|
||||
),
|
||||
),
|
||||
CupertinoButton(
|
||||
child: Text('Done'.tr),
|
||||
onPressed: () {
|
||||
String formattedDate =
|
||||
DateFormat('yyyy-MM-dd')
|
||||
.format(pickedDate);
|
||||
mainController.expirationDateController
|
||||
.text = formattedDate.toString();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.ownerController,
|
||||
label: 'Owner'.tr,
|
||||
hint: 'Owner'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.makeController,
|
||||
label: 'Make'.tr,
|
||||
hint: 'Make'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.modelController,
|
||||
label: 'Model'.tr,
|
||||
hint: 'Model'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: TextField(
|
||||
controller:
|
||||
mainController.expirationDateController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Expiration Date'.tr,
|
||||
hintText: 'Expiration Date'.tr,
|
||||
),
|
||||
readOnly:
|
||||
true, // Make the field read-only to prevent manual input
|
||||
onTap: () async {
|
||||
DateTime pickedDate =
|
||||
DateTime.now(); // Declare the variable here
|
||||
|
||||
await showCupertinoModalPopup<void>(
|
||||
context: context,
|
||||
builder: (context) => Container(
|
||||
height: 250,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 150,
|
||||
child: CupertinoDatePicker(
|
||||
initialDateTime: pickedDate,
|
||||
minimumDate: DateTime(
|
||||
1955), // Set the starting date
|
||||
maximumDate: DateTime(
|
||||
2034), // Set the ending date
|
||||
mode: CupertinoDatePickerMode.date,
|
||||
onDateTimeChanged:
|
||||
(DateTime dateTime) {
|
||||
pickedDate = dateTime;
|
||||
},
|
||||
),
|
||||
),
|
||||
CupertinoButton(
|
||||
child: Text('Done'.tr),
|
||||
onPressed: () {
|
||||
String formattedDate =
|
||||
DateFormat('yyyy-MM-dd')
|
||||
.format(pickedDate);
|
||||
mainController
|
||||
.expirationDateController
|
||||
.text =
|
||||
formattedDate.toString();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.ownerController,
|
||||
label: 'Owner'.tr,
|
||||
hint: 'Owner'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
]);
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:service/views/widgets/my_scafold.dart';
|
||||
|
||||
import '../../best_driver_controllers.dart';
|
||||
import '../../functions/encrypt_decrypt.dart';
|
||||
|
||||
class DriverTheBestAlexandria extends StatelessWidget {
|
||||
const DriverTheBestAlexandria({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(DriverTheBestAlexandriaController(), permanent: true);
|
||||
return MyScaffold(
|
||||
title: 'Alexandria'.tr,
|
||||
body: [
|
||||
GetBuilder<DriverTheBestAlexandriaController>(builder: (driverthebest) {
|
||||
return driverthebest.driver.isNotEmpty
|
||||
? ListView.builder(
|
||||
itemCount: driverthebest.driver.length,
|
||||
itemBuilder: (context, index) {
|
||||
final driver = driverthebest.driver[index];
|
||||
return ListTile(
|
||||
leading: CircleAvatar(
|
||||
child: Text(
|
||||
(int.parse(driver['driver_count'] * 5) / 3600)
|
||||
.toStringAsFixed(0),
|
||||
),
|
||||
),
|
||||
title: Text(EncryptionHelper.instance
|
||||
.decryptData(driver['name_arabic']) ??
|
||||
'Unknown Name'),
|
||||
subtitle: Text(
|
||||
'Phone: ${EncryptionHelper.instance.decryptData(driver['phone']) ?? 'N/A'}'),
|
||||
trailing: IconButton(
|
||||
onPressed: () async {
|
||||
Get.defaultDialog(
|
||||
title:
|
||||
'are you sure to pay to this driver gift'.tr,
|
||||
middleText: '',
|
||||
onConfirm: () async {},
|
||||
onCancel: () => Get.back());
|
||||
},
|
||||
icon: const Icon(Icons.wallet_giftcard_rounded),
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: const Center(
|
||||
child: Text('No drivers available.'),
|
||||
);
|
||||
})
|
||||
],
|
||||
isleading: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
112
lib/controller/mainController/pages/best_driver_page.dart
Normal file
112
lib/controller/mainController/pages/best_driver_page.dart
Normal file
@@ -0,0 +1,112 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:service/controller/functions/encrypt_decrypt.dart';
|
||||
import 'package:service/views/widgets/my_scafold.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/links.dart';
|
||||
import '../../../views/widgets/elevated_btn.dart';
|
||||
import '../../functions/crud.dart';
|
||||
import 'alexandria_besr_driver.dart';
|
||||
import 'giza_best_driver.dart';
|
||||
|
||||
class DriverTheBest extends StatelessWidget {
|
||||
const DriverTheBest({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(Driverthebest());
|
||||
return MyScaffold(
|
||||
title: 'Best Drivers'.tr,
|
||||
body: [
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
MyElevatedButton(
|
||||
title: 'Giza',
|
||||
onPressed: () {
|
||||
Get.to(() => DriverTheBestGiza());
|
||||
}),
|
||||
MyElevatedButton(
|
||||
title: 'Alexandria',
|
||||
onPressed: () {
|
||||
Get.to(() => DriverTheBestAlexandria());
|
||||
}),
|
||||
],
|
||||
),
|
||||
GetBuilder<Driverthebest>(builder: (driverthebest) {
|
||||
return driverthebest.driver.isNotEmpty
|
||||
? SizedBox(
|
||||
height: Get.height * .7,
|
||||
child: ListView.builder(
|
||||
itemCount: driverthebest.driver.length,
|
||||
itemBuilder: (context, index) {
|
||||
final driver = driverthebest.driver[index];
|
||||
return ListTile(
|
||||
leading: CircleAvatar(
|
||||
child: Text(
|
||||
((int.parse(driver['driver_count']) * 5) / 3600)
|
||||
.toStringAsFixed(0),
|
||||
),
|
||||
),
|
||||
title: Text(EncryptionHelper.instance
|
||||
.decryptData(driver['name_arabic']) ??
|
||||
'Unknown Name'),
|
||||
subtitle: Text(
|
||||
'Phone: ${EncryptionHelper.instance.decryptData(driver['phone']) ?? 'N/A'}'),
|
||||
trailing: IconButton(
|
||||
onPressed: () async {
|
||||
// Get.defaultDialog(
|
||||
// title:
|
||||
// 'are you sure to pay to this driver gift'.tr,
|
||||
// middleText: '',
|
||||
// onConfirm: () async {
|
||||
// // final wallet = Get.put(WalletController());
|
||||
// // await wallet.addPaymentToDriver('100',
|
||||
// // driver['id'].toString(), driver['token']);
|
||||
// // await wallet.addSeferWallet(
|
||||
// // '100', driver['id'].toString());
|
||||
// },
|
||||
// onCancel: () => Get.back());
|
||||
},
|
||||
icon: const Icon(Icons.wallet_giftcard_rounded),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
: const Center(
|
||||
child: Text('No drivers available.'),
|
||||
);
|
||||
}),
|
||||
],
|
||||
)
|
||||
],
|
||||
isleading: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Driverthebest extends GetxController {
|
||||
bool isLoading = false;
|
||||
List driver = [];
|
||||
getBestDriver() async {
|
||||
var res = await CRUD().get(link: AppLink.getBestDriver, payload: {});
|
||||
if (res != 'failure') {
|
||||
driver = jsonDecode(res)['message'];
|
||||
update();
|
||||
} else {
|
||||
Get.snackbar('error', '', backgroundColor: AppColor.redColor);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
getBestDriver();
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
13071
lib/controller/mainController/pages/contact_page.dart
Normal file
13071
lib/controller/mainController/pages/contact_page.dart
Normal file
File diff suppressed because it is too large
Load Diff
@@ -44,16 +44,16 @@ class DriverPage extends StatelessWidget {
|
||||
return CupertinoListSection.insetGrouped(
|
||||
header: Text('Driver Information'.tr),
|
||||
children: [
|
||||
_buildInfoRow('Name'.tr, data['name_arabic']),
|
||||
_buildInfoRow('Name (English)'.tr, data['name_english']),
|
||||
_buildInfoRow('Phone'.tr, data['phone']),
|
||||
_buildInfoRow('Email'.tr, data['email']),
|
||||
_buildInfoRow('Gender'.tr, data['gender']),
|
||||
_buildInfoRow('Birthdate'.tr, data['birthdate']),
|
||||
_buildInfoRow('National Number'.tr, data['national_number']),
|
||||
_buildInfoRow('Religion'.tr, data['religion']),
|
||||
_buildInfoRow('Occupation'.tr, data['occupation']),
|
||||
_buildInfoRow('Education'.tr, data['education']),
|
||||
_buildInfoRow('Name'.tr, data['name_arabic'].toString()),
|
||||
_buildInfoRow('Name (English)'.tr, data['name_english'].toString()),
|
||||
_buildInfoRow('Phone'.tr, data['phone'].toString()),
|
||||
_buildInfoRow('Email'.tr, data['email'].toString()),
|
||||
_buildInfoRow('Gender'.tr, data['gender'].toString()),
|
||||
_buildInfoRow('Birthdate'.tr, data['birthdate'].toString()),
|
||||
_buildInfoRow('National Number'.tr, data['national_number'].toString()),
|
||||
_buildInfoRow('Religion'.tr, data['religion'].toString()),
|
||||
_buildInfoRow('Occupation'.tr, data['occupation'].toString()),
|
||||
_buildInfoRow('Education'.tr, data['education'].toString()),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -80,16 +80,17 @@ class DriverPage extends StatelessWidget {
|
||||
return CupertinoListSection.insetGrouped(
|
||||
header: Text('Vehicle Information'.tr),
|
||||
children: [
|
||||
_buildInfoRow('VIN'.tr, data['vin']),
|
||||
_buildInfoRow('Plate Number'.tr, data['car_plate']),
|
||||
_buildInfoRow('Make'.tr, data['make']),
|
||||
_buildInfoRow('Model'.tr, data['model']),
|
||||
_buildInfoRow('Year'.tr, data['year']),
|
||||
_buildInfoRow('Color'.tr, data['color']),
|
||||
_buildInfoRow('Fuel Type'.tr, data['fuel']),
|
||||
_buildInfoRow('Displacement'.tr, data['displacement']),
|
||||
_buildInfoRow('Registration Date'.tr, data['registration_date']),
|
||||
_buildInfoRow('Expiration Date'.tr, data['expiration_date']),
|
||||
_buildInfoRow('VIN'.tr, data['vin'].toString()),
|
||||
_buildInfoRow('Plate Number'.tr, data['car_plate'].toString()),
|
||||
_buildInfoRow('Make'.tr, data['make'].toString()),
|
||||
_buildInfoRow('Model'.tr, data['model'].toString()),
|
||||
_buildInfoRow('Year'.tr, data['year'].toString()),
|
||||
_buildInfoRow('Color'.tr, data['color'].toString()),
|
||||
_buildInfoRow('Fuel Type'.tr, data['fuel'].toString()),
|
||||
_buildInfoRow('Displacement'.tr, data['displacement'].toString()),
|
||||
_buildInfoRow(
|
||||
'Registration Date'.tr, data['registration_date'].toString()),
|
||||
_buildInfoRow('Expiration Date'.tr, data['expiration_date'].toString()),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -98,11 +99,11 @@ class DriverPage extends StatelessWidget {
|
||||
return CupertinoListSection.insetGrouped(
|
||||
header: Text('License Information'.tr),
|
||||
children: [
|
||||
_buildInfoRow('License Type'.tr, data['license_type']),
|
||||
_buildInfoRow('Card ID'.tr, data['card_id']),
|
||||
_buildInfoRow('Issue Date'.tr, data['issue_date']),
|
||||
_buildInfoRow('Expiry Date'.tr, data['expiry_date']),
|
||||
_buildInfoRow('Categories'.tr, data['license_categories']),
|
||||
_buildInfoRow('License Type'.tr, data['license_type'].toString()),
|
||||
_buildInfoRow('Card ID'.tr, data['card_id'].toString()),
|
||||
_buildInfoRow('Issue Date'.tr, data['issue_date'].toString()),
|
||||
_buildInfoRow('Expiry Date'.tr, data['expiry_date'].toString()),
|
||||
_buildInfoRow('Categories'.tr, data['license_categories'].toString()),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -111,8 +112,8 @@ class DriverPage extends StatelessWidget {
|
||||
return CupertinoListSection.insetGrouped(
|
||||
header: Text('Bank Information'.tr),
|
||||
children: [
|
||||
_buildInfoRow('Account Number'.tr, data['accountBank']),
|
||||
_buildInfoRow('Bank Code'.tr, data['bankCode']),
|
||||
_buildInfoRow('Account Number'.tr, data['accountBank'].toString()),
|
||||
_buildInfoRow('Bank Code'.tr, data['bankCode'].toString()),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:service/constant/colors.dart';
|
||||
import 'package:service/controller/functions/encrypt_decrypt.dart';
|
||||
import 'package:service/controller/mainController/main_controller.dart';
|
||||
import 'package:service/views/widgets/my_scafold.dart';
|
||||
|
||||
@@ -56,14 +57,15 @@ class DriversCantRegister extends StatelessWidget {
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text(driver['phone_number']),
|
||||
Text(EncryptionHelper.instance
|
||||
.decryptData(driver['phone_number'])),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
String message = "مرحباً،\n\n"
|
||||
"نلاحظ أنك لم تكمل عملية التسجيل في خدمة سفر درايفر. نود تذكيرك بأن إكمال التسجيل يتيح لك فرصة الانضمام إلى فريق سفر والاستفادة من خدماتنا المتنوعة.\n\n"
|
||||
"نلاحظ أنك لم تكمل عملية التسجيل في خدمة Tripz درايفر. نود تذكيرك بأن إكمال التسجيل يتيح لك فرصة الانضمام إلى فريق Tripz والاستفادة من خدماتنا المتنوعة.\n\n"
|
||||
"إذا كنت بحاجة إلى أي مساعدة أو لديك أي استفسارات، لا تتردد في الاتصال بنا. نحن هنا لمساعدتك.\n\n"
|
||||
"للاتصال بنا، يرجى الاتصال على الرقم التالي: +20 101 880 5430\n\n"
|
||||
"مع تحيات فريق سفر.";
|
||||
"مع تحيات فريق Tripz.";
|
||||
|
||||
mainController.launchCommunication(
|
||||
'whatsapp',
|
||||
|
||||
@@ -6,7 +6,10 @@ import 'package:service/controller/mainController/main_controller.dart';
|
||||
import 'package:service/views/widgets/my_scafold.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/links.dart';
|
||||
import '../../../views/widgets/my_textField.dart';
|
||||
import '../../functions/image.dart';
|
||||
import '../../functions/launch.dart';
|
||||
|
||||
class EditCar extends StatelessWidget {
|
||||
final Map carData;
|
||||
@@ -16,143 +19,145 @@ class EditCar extends StatelessWidget {
|
||||
Get.put(MainController());
|
||||
|
||||
return GetBuilder<MainController>(builder: (mainController) {
|
||||
return MyScaffold(title: 'Edit', isleading: true, body: [
|
||||
ListView(
|
||||
children: [
|
||||
Column(
|
||||
return MyScaffold(
|
||||
title: 'Edit',
|
||||
isleading: true,
|
||||
action: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
makePhoneCall(carData['phone']);
|
||||
},
|
||||
icon: const Icon(Icons.phone),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
launchCommunication('whatsapp', carData['phone'], '');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.message,
|
||||
color: AppColor.greenColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: [
|
||||
ListView(
|
||||
children: [
|
||||
Image.network(
|
||||
'https://sefer.click/sefer/card_image/car_front-${carData['driverID']}.jpg',
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fill,
|
||||
errorBuilder: (BuildContext context, Object exception,
|
||||
StackTrace? stackTrace) {
|
||||
// If the image fails to load, use the _copy version
|
||||
return Image.network(
|
||||
'https://sefer.click/sefer/card_image/car_front-${carData['driverID']}_copy.jpg',
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fill,
|
||||
);
|
||||
},
|
||||
),
|
||||
Image.network(
|
||||
'https://sefer.click/sefer/card_image/car_back-${carData['driverID']}.jpg',
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fill,
|
||||
errorBuilder: (BuildContext context, Object exception,
|
||||
StackTrace? stackTrace) {
|
||||
// If the image fails to load, use the _copy version
|
||||
return Image.network(
|
||||
'https://sefer.click/sefer/card_image/car_back-${carData['driverID']}_copy.jpg',
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fill,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 9),
|
||||
Form(
|
||||
key: mainController.formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .6,
|
||||
child: MyTextForm(
|
||||
controller: mainController.carplateController,
|
||||
label: 'car plate'.tr,
|
||||
hint: 'car plate'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
if (mainController.formKey.currentState!.validate()) {
|
||||
await mainController.editCarPlateNotEdit(
|
||||
carData['driverID'].toString(),
|
||||
mainController.carplateController.text,
|
||||
mainController.colorController.text,
|
||||
mainController.colorHex.value.toString(),
|
||||
mainController.yearController.text,
|
||||
mainController.makeController.text,
|
||||
mainController.modelController.text,
|
||||
mainController.expirationDateController.text,
|
||||
mainController.ownerController.text,
|
||||
);
|
||||
}
|
||||
Column(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onLongPress: () async {
|
||||
await ImageController().choosImage(AppLink.uploadEgypt,
|
||||
carData['driverID'], 'car_front');
|
||||
},
|
||||
child: Image.network(
|
||||
'https://sefer.click/sefer/card_image/car_front-${carData['driverID']}.jpg',
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fill,
|
||||
errorBuilder: (BuildContext context, Object exception,
|
||||
StackTrace? stackTrace) {
|
||||
// If the image fails to load, use the _copy version
|
||||
return Image.network(
|
||||
'https://sefer.click/sefer/card_image/car_front-${carData['driverID']}_copy.jpg',
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fill,
|
||||
);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.upload_outlined,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// Other fields
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
),
|
||||
GestureDetector(
|
||||
onLongPress: () async {
|
||||
await ImageController().choosImage(
|
||||
AppLink.uploadEgypt, carData['id'], 'car_back');
|
||||
},
|
||||
child: Image.network(
|
||||
'https://sefer.click/sefer/card_image/car_back-${carData['driverID']}.jpg',
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fill,
|
||||
errorBuilder: (BuildContext context, Object exception,
|
||||
StackTrace? stackTrace) {
|
||||
// If the image fails to load, use the _copy version
|
||||
return Image.network(
|
||||
'https://sefer.click/sefer/card_image/car_back-${carData['driverID']}_copy.jpg',
|
||||
height: 200,
|
||||
width: double.maxFinite,
|
||||
fit: BoxFit.fill,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 9),
|
||||
Form(
|
||||
key: mainController.formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.yearController,
|
||||
label: 'Year'.tr,
|
||||
hint: 'Year'.tr,
|
||||
type: TextInputType.number,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: DropdownButtonFormField<String>(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Color'.tr, // Localized label
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .6,
|
||||
child: MyTextForm(
|
||||
controller: mainController.carplateController,
|
||||
label: 'car plate'.tr,
|
||||
hint: 'car plate'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
),
|
||||
value: mainController.colorHex.value.isEmpty
|
||||
? null
|
||||
: mainController.colorHex
|
||||
.value, // Use the hex value as the current value
|
||||
items: [
|
||||
{'red'.tr: '#FF0000'},
|
||||
{'green'.tr: '#008000'},
|
||||
{'blue'.tr: '#0000FF'},
|
||||
{'black'.tr: '#000000'},
|
||||
{'white'.tr: '#FFFFFF'},
|
||||
{'yellow'.tr: '#FFFF00'},
|
||||
{'purple'.tr: '#800080'},
|
||||
{'orange'.tr: '#FFA500'},
|
||||
{'pink'.tr: '#FFC0CB'},
|
||||
{'brown'.tr: '#A52A2A'},
|
||||
{'gray'.tr: '#808080'},
|
||||
{'cyan'.tr: '#00FFFF'},
|
||||
{'magenta'.tr: '#FF00FF'},
|
||||
{'lime'.tr: '#00FF00'},
|
||||
{'indigo'.tr: '#4B0082'},
|
||||
{'violet'.tr: '#EE82EE'},
|
||||
{'gold'.tr: '#FFD700'},
|
||||
{'silver'.tr: '#C0C0C0'},
|
||||
{'teal'.tr: '#008080'},
|
||||
{'navy'.tr: '#000080'},
|
||||
].map((colorMap) {
|
||||
String colorName = colorMap.keys.first;
|
||||
String colorValue = colorMap.values.first;
|
||||
return DropdownMenuItem<String>(
|
||||
value: colorValue,
|
||||
child: Text(colorName),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
// Find the selected color name based on the hex value
|
||||
String selectedColorName = '';
|
||||
for (var colorMap in [
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
if (mainController.formKey.currentState!
|
||||
.validate()) {
|
||||
await mainController.editCarPlateNotEdit(
|
||||
carData['driverID'].toString(),
|
||||
mainController.carplateController.text,
|
||||
mainController.colorController.text,
|
||||
mainController.colorHex.value.toString(),
|
||||
mainController.yearController.text,
|
||||
mainController.makeController.text,
|
||||
mainController.modelController.text,
|
||||
mainController.expirationDateController.text,
|
||||
mainController.ownerController.text,
|
||||
);
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.upload_outlined,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// Other fields
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.yearController,
|
||||
label: 'Year'.tr,
|
||||
hint: 'Year'.tr,
|
||||
type: TextInputType.number,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: DropdownButtonFormField<String>(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Color'.tr, // Localized label
|
||||
),
|
||||
value: mainController.colorHex.value.isEmpty
|
||||
? null
|
||||
: mainController.colorHex
|
||||
.value, // Use the hex value as the current value
|
||||
items: [
|
||||
{'red'.tr: '#FF0000'},
|
||||
{'green'.tr: '#008000'},
|
||||
{'blue'.tr: '#0000FF'},
|
||||
@@ -173,120 +178,157 @@ class EditCar extends StatelessWidget {
|
||||
{'silver'.tr: '#C0C0C0'},
|
||||
{'teal'.tr: '#008080'},
|
||||
{'navy'.tr: '#000080'},
|
||||
]) {
|
||||
if (colorMap.values.first == value) {
|
||||
selectedColorName = colorMap.keys.first;
|
||||
break;
|
||||
].map((colorMap) {
|
||||
String colorName = colorMap.keys.first;
|
||||
String colorValue = colorMap.values.first;
|
||||
return DropdownMenuItem<String>(
|
||||
value: colorValue,
|
||||
child: Text(colorName),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
// Find the selected color name based on the hex value
|
||||
String selectedColorName = '';
|
||||
for (var colorMap in [
|
||||
{'red'.tr: '#FF0000'},
|
||||
{'green'.tr: '#008000'},
|
||||
{'blue'.tr: '#0000FF'},
|
||||
{'black'.tr: '#000000'},
|
||||
{'white'.tr: '#FFFFFF'},
|
||||
{'yellow'.tr: '#FFFF00'},
|
||||
{'purple'.tr: '#800080'},
|
||||
{'orange'.tr: '#FFA500'},
|
||||
{'pink'.tr: '#FFC0CB'},
|
||||
{'brown'.tr: '#A52A2A'},
|
||||
{'gray'.tr: '#808080'},
|
||||
{'cyan'.tr: '#00FFFF'},
|
||||
{'magenta'.tr: '#FF00FF'},
|
||||
{'lime'.tr: '#00FF00'},
|
||||
{'indigo'.tr: '#4B0082'},
|
||||
{'violet'.tr: '#EE82EE'},
|
||||
{'gold'.tr: '#FFD700'},
|
||||
{'silver'.tr: '#C0C0C0'},
|
||||
{'teal'.tr: '#008080'},
|
||||
{'navy'.tr: '#000080'},
|
||||
]) {
|
||||
if (colorMap.values.first == value) {
|
||||
selectedColorName = colorMap.keys.first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mainController.colorController.text =
|
||||
selectedColorName;
|
||||
mainController.colorHex.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
mainController.colorController.text =
|
||||
selectedColorName;
|
||||
mainController.colorHex.value = value;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.makeController,
|
||||
label: 'Make'.tr,
|
||||
hint: 'Make'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.modelController,
|
||||
label: 'Model'.tr,
|
||||
hint: 'Model'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: TextField(
|
||||
controller: mainController.expirationDateController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Expiration Date'.tr,
|
||||
hintText: 'Expiration Date'.tr,
|
||||
},
|
||||
),
|
||||
),
|
||||
readOnly:
|
||||
true, // Make the field read-only to prevent manual input
|
||||
onTap: () async {
|
||||
DateTime pickedDate =
|
||||
DateTime.now(); // Declare the variable here
|
||||
|
||||
await showCupertinoModalPopup<void>(
|
||||
context: context,
|
||||
builder: (context) => Container(
|
||||
height: 250,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 150,
|
||||
child: CupertinoDatePicker(
|
||||
initialDateTime: pickedDate,
|
||||
minimumDate: DateTime(
|
||||
1955), // Set the starting date
|
||||
maximumDate: DateTime(
|
||||
2034), // Set the ending date
|
||||
mode: CupertinoDatePickerMode.date,
|
||||
onDateTimeChanged: (DateTime dateTime) {
|
||||
pickedDate = dateTime;
|
||||
},
|
||||
),
|
||||
),
|
||||
CupertinoButton(
|
||||
child: Text('Done'.tr),
|
||||
onPressed: () {
|
||||
String formattedDate =
|
||||
DateFormat('yyyy-MM-dd')
|
||||
.format(pickedDate);
|
||||
mainController.expirationDateController
|
||||
.text = formattedDate.toString();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.ownerController,
|
||||
label: 'Owner'.tr,
|
||||
hint: 'Owner'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.makeController,
|
||||
label: 'Make'.tr,
|
||||
hint: 'Make'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.modelController,
|
||||
label: 'Model'.tr,
|
||||
hint: 'Model'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: TextField(
|
||||
controller:
|
||||
mainController.expirationDateController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Expiration Date'.tr,
|
||||
hintText: 'Expiration Date'.tr,
|
||||
),
|
||||
readOnly:
|
||||
true, // Make the field read-only to prevent manual input
|
||||
onTap: () async {
|
||||
DateTime pickedDate =
|
||||
DateTime.now(); // Declare the variable here
|
||||
|
||||
await showCupertinoModalPopup<void>(
|
||||
context: context,
|
||||
builder: (context) => Container(
|
||||
height: 250,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 150,
|
||||
child: CupertinoDatePicker(
|
||||
initialDateTime: pickedDate,
|
||||
minimumDate: DateTime(
|
||||
1955), // Set the starting date
|
||||
maximumDate: DateTime(
|
||||
2034), // Set the ending date
|
||||
mode: CupertinoDatePickerMode.date,
|
||||
onDateTimeChanged:
|
||||
(DateTime dateTime) {
|
||||
pickedDate = dateTime;
|
||||
},
|
||||
),
|
||||
),
|
||||
CupertinoButton(
|
||||
child: Text('Done'.tr),
|
||||
onPressed: () {
|
||||
String formattedDate =
|
||||
DateFormat('yyyy-MM-dd')
|
||||
.format(pickedDate);
|
||||
mainController
|
||||
.expirationDateController
|
||||
.text =
|
||||
formattedDate.toString();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyTextForm(
|
||||
controller: mainController.ownerController,
|
||||
label: 'Owner'.tr,
|
||||
hint: 'Owner'.tr,
|
||||
type: TextInputType.name,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
]);
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:service/constant/colors.dart';
|
||||
import 'package:service/constant/style.dart';
|
||||
import 'package:service/controller/mainController/pages/edit_car.dart';
|
||||
import 'package:service/views/widgets/elevated_btn.dart';
|
||||
import 'package:service/views/widgets/my_scafold.dart';
|
||||
import 'package:service/views/widgets/my_textField.dart';
|
||||
|
||||
import '../../functions/encrypt_decrypt.dart';
|
||||
import '../main_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -39,7 +36,8 @@ class EditCarPlate extends StatelessWidget {
|
||||
},
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Text(carData['owner'])),
|
||||
child: Text(EncryptionHelper.instance
|
||||
.decryptData(carData['owner']))),
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
||||
57
lib/controller/mainController/pages/giza_best_driver.dart
Normal file
57
lib/controller/mainController/pages/giza_best_driver.dart
Normal file
@@ -0,0 +1,57 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:service/views/widgets/my_scafold.dart';
|
||||
|
||||
import '../../best_driver_controllers.dart';
|
||||
import '../../functions/encrypt_decrypt.dart';
|
||||
|
||||
class DriverTheBestGiza extends StatelessWidget {
|
||||
const DriverTheBestGiza({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(DriverTheBestGizaController(), permanent: true);
|
||||
return MyScaffold(
|
||||
title: 'Giza'.tr,
|
||||
body: [
|
||||
GetBuilder<DriverTheBestGizaController>(builder: (driverthebest) {
|
||||
return driverthebest.driver.isNotEmpty
|
||||
? ListView.builder(
|
||||
itemCount: driverthebest.driver.length,
|
||||
itemBuilder: (context, index) {
|
||||
final driver = driverthebest.driver[index];
|
||||
return ListTile(
|
||||
leading: CircleAvatar(
|
||||
child: Text(
|
||||
(int.parse(driver['driver_count'] * 5) / 3600)
|
||||
.toStringAsFixed(0),
|
||||
),
|
||||
),
|
||||
title: Text(EncryptionHelper.instance
|
||||
.decryptData(driver['name_arabic']) ??
|
||||
'Unknown Name'),
|
||||
subtitle: Text(
|
||||
'Phone: ${EncryptionHelper.instance.decryptData(driver['phone']) ?? 'N/A'}'),
|
||||
trailing: IconButton(
|
||||
onPressed: () async {
|
||||
Get.defaultDialog(
|
||||
title:
|
||||
'are you sure to pay to this driver gift'.tr,
|
||||
middleText: '',
|
||||
onConfirm: () async {},
|
||||
onCancel: () => Get.back());
|
||||
},
|
||||
icon: const Icon(Icons.wallet_giftcard_rounded),
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: const Center(
|
||||
child: Text('No drivers available.'),
|
||||
);
|
||||
})
|
||||
],
|
||||
isleading: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import 'package:get/get.dart';
|
||||
import 'package:service/controller/mainController/main_controller.dart';
|
||||
import 'package:service/views/widgets/my_scafold.dart';
|
||||
|
||||
import '../../functions/encrypt_decrypt.dart';
|
||||
|
||||
class PassengersCantRegister extends StatelessWidget {
|
||||
PassengersCantRegister({super.key});
|
||||
|
||||
@@ -31,7 +33,8 @@ class PassengersCantRegister extends StatelessWidget {
|
||||
child: CupertinoFormRow(
|
||||
prefix: Text('Phone Number'.tr),
|
||||
child: CupertinoTextFormFieldRow(
|
||||
initialValue: passenger['phone_number'],
|
||||
initialValue: EncryptionHelper.instance
|
||||
.decryptData((passenger['phone_number'])),
|
||||
readOnly: true,
|
||||
placeholder: 'Phone Number'.tr,
|
||||
),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
@@ -12,13 +13,17 @@ import '../../constant/links.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import '../../views/widgets/mycircular.dart';
|
||||
import '../functions/crud.dart';
|
||||
import '../functions/image.dart';
|
||||
import '../functions/launch.dart';
|
||||
|
||||
enum DocumentType {
|
||||
carLicenseFront,
|
||||
carLicenseBack,
|
||||
idCardFront,
|
||||
nonIdCardFront,
|
||||
nonIdCardBack,
|
||||
idCardBack,
|
||||
driverLicense,
|
||||
unknown,
|
||||
@@ -31,6 +36,7 @@ class RegisterCaptainController extends GetxController {
|
||||
String? driverId;
|
||||
String? email;
|
||||
String? phone;
|
||||
bool isEgypt = true;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@@ -47,6 +53,12 @@ class RegisterCaptainController extends GetxController {
|
||||
initArguments();
|
||||
}
|
||||
|
||||
changeNationality() {
|
||||
isEgypt = !isEgypt;
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void initArguments() {
|
||||
if (arguments != null) {
|
||||
driverId = arguments!['driverId'];
|
||||
@@ -67,6 +79,8 @@ class RegisterCaptainController extends GetxController {
|
||||
Map<String, dynamic> responseIdEgyptFront = {};
|
||||
Map<String, dynamic> responseCriminalRecordEgypt = {};
|
||||
Map<String, dynamic> responseIdEgyptBack = {};
|
||||
Map<String, dynamic> responseNonIdCardFront = {};
|
||||
Map<String, dynamic> responseNonIdCardBack = {};
|
||||
Map<String, dynamic> responseIdEgyptDriverLicense = {};
|
||||
String? responseIdCardDriverEgypt1;
|
||||
bool isloading = false;
|
||||
@@ -180,21 +194,21 @@ class RegisterCaptainController extends GetxController {
|
||||
String expectedDocument = getExpectedDocument(imagePath);
|
||||
String detectedDocument = getDetectedDocument(detectedType);
|
||||
|
||||
bool isCorrectDocument = (detectedType == getExpectedType(imagePath));
|
||||
if (!isCorrectDocument) {
|
||||
Get.defaultDialog(
|
||||
title: 'incorrect_document_title'.tr,
|
||||
middleText:
|
||||
'${'expected'.tr}: $expectedDocument\n${'detected'.tr}: $detectedDocument',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'OK'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
} else {
|
||||
// Process the correct document
|
||||
await anthropicAI(textValues, prompt, imagePath);
|
||||
}
|
||||
// bool isCorrectDocument = (detectedType == getExpectedType(imagePath));
|
||||
// if (!isCorrectDocument) {
|
||||
// Get.defaultDialog(
|
||||
// title: 'incorrect_document_title'.tr,
|
||||
// middleText:
|
||||
// '${'expected'.tr}: $expectedDocument\n${'detected'.tr}: $detectedDocument',
|
||||
// confirm: MyElevatedButton(
|
||||
// title: 'OK'.tr,
|
||||
// onPressed: () {
|
||||
// Get.back();
|
||||
// }));
|
||||
// } else {
|
||||
// Process the correct document
|
||||
await anthropicAI(textValues, prompt, imagePath);
|
||||
// }
|
||||
isLoading = false;
|
||||
update();
|
||||
}
|
||||
@@ -417,6 +431,8 @@ class RegisterCaptainController extends GetxController {
|
||||
|
||||
String extractDOB(String nationalNumber) {
|
||||
if (nationalNumber.length != 14) {
|
||||
Get.snackbar('National number must be 14 digits long.', 'message',
|
||||
backgroundColor: AppColor.redColor);
|
||||
throw ArgumentError('National number must be 14 digits long.');
|
||||
}
|
||||
|
||||
@@ -448,11 +464,120 @@ class RegisterCaptainController extends GetxController {
|
||||
return dob;
|
||||
}
|
||||
|
||||
String generatePassword({int length = 8}) {
|
||||
const String upperCaseLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
const String lowerCaseLetters = 'abcdefghijklmnopqrstuvwxyz';
|
||||
const String digits = '0123456789';
|
||||
const String specialCharacters = '!@#\$%^&*()-_=+[]{}|;:,.<>?';
|
||||
|
||||
const String allChars =
|
||||
upperCaseLetters + lowerCaseLetters + digits + specialCharacters;
|
||||
final Random random = Random();
|
||||
|
||||
// Generate a random password of the specified length
|
||||
String password = List.generate(length, (index) {
|
||||
int randomIndex = random.nextInt(allChars.length);
|
||||
return allChars[randomIndex];
|
||||
}).join();
|
||||
|
||||
return password;
|
||||
}
|
||||
|
||||
Future<void> addDriverForeign() async {
|
||||
isLoading = true;
|
||||
update();
|
||||
var added = await storage.read(key: 'name');
|
||||
String newPassword = generatePassword();
|
||||
print('Generated Password: $newPassword');
|
||||
var payload = {
|
||||
'first_name':
|
||||
responseNonIdCardFront['full_name']?.toString().split(' ')[0] ??
|
||||
'Not specified',
|
||||
'last_name':
|
||||
responseNonIdCardFront['full_name']?.toString().split(' ').last ??
|
||||
'Not specified',
|
||||
'email': box.read(BoxName.emailDriver)?.toString() ?? 'Not specified',
|
||||
'phone': box.read(BoxName.phoneDriver)?.toString() ?? 'Not specified',
|
||||
'id': box.read(BoxName.driverID)?.toString() ?? 'Not specified',
|
||||
'password': newPassword.toString() ?? '123456',
|
||||
'gender': responseNonIdCardFront['gender']?.toString() ?? 'Not specified',
|
||||
'license_type': 'Foreign',
|
||||
'national_number':
|
||||
responseNonIdCardFront['passport_no']?.toString() ?? 'Not specified',
|
||||
'name_arabic':
|
||||
responseNonIdCardFront['full_name']?.toString() ?? 'Not specified',
|
||||
'name_english': 'Not specified',
|
||||
'issue_date':
|
||||
responseNonIdCardBack['issueDate']?.toString() ?? 'Not specified',
|
||||
'expiry_date':
|
||||
responseNonIdCardBack['residencyExpirationDate']?.toString() ??
|
||||
'Not specified',
|
||||
'license_categories': responseIdEgyptDriverLicense['license_categories']
|
||||
is List
|
||||
? responseIdEgyptDriverLicense['license_categories'].join(', ')
|
||||
: responseIdEgyptDriverLicense['license_categories']?.toString() ??
|
||||
'Not specified',
|
||||
'address':
|
||||
responseNonIdCardFront['address']?.toString() ?? 'Not specified',
|
||||
'card_id':
|
||||
responseNonIdCardFront['card_id']?.toString() ?? 'Not specified',
|
||||
'occupation':
|
||||
responseNonIdCardBack['workStatus']?.toString() ?? 'Not specified',
|
||||
'education': 'Not specified',
|
||||
'licenseIssueDate':
|
||||
responseNonIdCardBack['issueDate']?.toString() ?? 'Not specified',
|
||||
'religion':
|
||||
responseNonIdCardFront['country']?.toString() ?? 'Not specified',
|
||||
'status': 'yet',
|
||||
'birthdate':
|
||||
responseNonIdCardFront['birthdate']?.toString() ?? 'Not specified',
|
||||
'maritalStatus': added.toString(),
|
||||
'site': responseNonIdCardFront['address']?.toString() ?? 'Not specified',
|
||||
'employmentType':
|
||||
responseNonIdCardBack['residencyType']?.toString() ?? 'Not specified',
|
||||
};
|
||||
|
||||
try {
|
||||
var res = await CRUD().post(link: AppLink.signUpCaptin, payload: payload);
|
||||
|
||||
var status1;
|
||||
try {
|
||||
status1 = jsonDecode(res);
|
||||
} catch (e) {
|
||||
throw FormatException("Invalid JSON response: $res");
|
||||
}
|
||||
|
||||
isLoading = false;
|
||||
update();
|
||||
|
||||
if (status1['status'] == 'success') {
|
||||
isDriverSaved = true;
|
||||
CRUD().post(
|
||||
link: '${AppLink.seferGizaServer}/auth/captin/register.php',
|
||||
payload: payload);
|
||||
CRUD().post(
|
||||
link: '${AppLink.seferAlexandriaServer}/auth/captin/register.php',
|
||||
payload: payload);
|
||||
mySnackbarSuccess('Foreign driver data saved successfully');
|
||||
} else {
|
||||
mySnackeBarError(
|
||||
'${'Failed to save driver data'.tr}: ${status1['message']}');
|
||||
}
|
||||
} catch (e) {
|
||||
isLoading = false;
|
||||
update();
|
||||
mySnackeBarError(
|
||||
'An error occurred while saving driver data'.tr,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> addDriverEgypt() async {
|
||||
isLoading = true;
|
||||
update();
|
||||
var added = await storage.read(key: 'name');
|
||||
|
||||
String newPassword = generatePassword();
|
||||
print('Generated Password: $newPassword');
|
||||
var payload = {
|
||||
'first_name': responseIdEgyptDriverLicense['firstName']?.toString() ??
|
||||
'Not specified',
|
||||
@@ -461,7 +586,7 @@ class RegisterCaptainController extends GetxController {
|
||||
'email': email?.toString() ?? 'Not specified',
|
||||
'phone': phone?.toString() ?? 'Not specified',
|
||||
'id': driverId?.toString() ?? 'Not specified',
|
||||
'password': '123456',
|
||||
'password': newPassword.toString() ?? '123456',
|
||||
'gender': responseIdEgyptBack['gender']?.toString() ?? 'Not specified',
|
||||
'license_type':
|
||||
responseIdEgyptDriverLicense['license_type']?.toString() ??
|
||||
@@ -520,6 +645,8 @@ class RegisterCaptainController extends GetxController {
|
||||
Log.print('res: ${res1}');
|
||||
Get.snackbar('Success', 'Driver data saved successfully',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
launchCommunication('whatsapp', phone.toString(),
|
||||
'you have seuccessfully registered in SEFER\n\n\n*Email* is *$email*\n\n*id* is *$driverId*\n\n*password* is *$newPassword*');
|
||||
} else {
|
||||
Get.snackbar('Error', 'Failed to save driver data',
|
||||
backgroundColor: Colors.red);
|
||||
@@ -529,6 +656,7 @@ class RegisterCaptainController extends GetxController {
|
||||
Future<void> addDriverEgyptHanding() async {
|
||||
isLoading = true;
|
||||
update();
|
||||
String newPassword = generatePassword();
|
||||
var added = await storage.read(key: 'name');
|
||||
var payload = {
|
||||
'first_name': firstName.value.isNotEmpty
|
||||
@@ -540,7 +668,7 @@ class RegisterCaptainController extends GetxController {
|
||||
'email': email?.toString() ?? 'Not specified',
|
||||
'phone': phone?.toString() ?? 'Not specified',
|
||||
'id': driverId?.toString() ?? 'Not specified',
|
||||
'password': '123456',
|
||||
'password': newPassword.toString() ?? '123456',
|
||||
'gender': gender.value.isNotEmpty
|
||||
? gender.value
|
||||
: responseIdEgyptBack['gender'],
|
||||
@@ -590,6 +718,11 @@ class RegisterCaptainController extends GetxController {
|
||||
: extractDOB(
|
||||
responseIdEgyptDriverLicense['national_number'].toString()),
|
||||
'maritalStatus': added.toString(),
|
||||
'fullNameMaritial': firstName.value.isNotEmpty
|
||||
? firstName.value
|
||||
: responseIdEgyptDriverLicense['firstName'] +
|
||||
'_' +
|
||||
newPassword.toString(),
|
||||
'site': site.value.isNotEmpty
|
||||
? site.value
|
||||
: responseIdEgyptDriverLicense['address'],
|
||||
@@ -614,6 +747,8 @@ class RegisterCaptainController extends GetxController {
|
||||
payload: payload);
|
||||
Get.snackbar('Success', 'Driver data saved successfully',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
launchCommunication('whatsapp', phone.toString(),
|
||||
'you have seuccessfully registered in SEFER\n\n\n*Email* is *$email*\n\n*id* is *$driverId*\n\n*password* is *$newPassword*');
|
||||
} else {
|
||||
Get.snackbar('Error', 'Failed to save driver data',
|
||||
backgroundColor: Colors.red);
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/style.dart';
|
||||
|
||||
ThemeData themeEnglish = ThemeData(
|
||||
fontFamily: "PlayfairDisplay",
|
||||
ThemeData lightThemeEnglish = ThemeData(
|
||||
brightness: Brightness.light,
|
||||
fontFamily: "SFPro",
|
||||
textTheme: TextTheme(
|
||||
displaySmall: AppStyle.title,
|
||||
displayLarge: AppStyle.title,
|
||||
displayMedium: AppStyle.title,
|
||||
bodyLarge: AppStyle.title,
|
||||
bodyMedium: AppStyle.title),
|
||||
displaySmall: AppStyle.title,
|
||||
displayLarge: AppStyle.headTitle,
|
||||
displayMedium: AppStyle.headTitle2,
|
||||
bodyLarge: AppStyle.title,
|
||||
bodyMedium: AppStyle.subtitle,
|
||||
),
|
||||
primarySwatch: Colors.blue,
|
||||
dialogTheme: DialogTheme(
|
||||
backgroundColor: AppColor.secondaryColor,
|
||||
contentTextStyle: AppStyle.title,
|
||||
titleTextStyle: AppStyle.title,
|
||||
titleTextStyle: AppStyle.headTitle2,
|
||||
),
|
||||
appBarTheme: AppBarTheme(
|
||||
elevation: 0,
|
||||
@@ -25,35 +26,122 @@ ThemeData themeEnglish = ThemeData(
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
toolbarTextStyle: TextTheme(
|
||||
titleSmall: AppStyle.subtitle,
|
||||
headlineSmall: AppStyle.title,
|
||||
titleLarge: AppStyle.headTitle2)
|
||||
.bodyMedium,
|
||||
titleSmall: AppStyle.subtitle,
|
||||
headlineSmall: AppStyle.title,
|
||||
titleLarge: AppStyle.headTitle2,
|
||||
).bodyMedium,
|
||||
titleTextStyle: TextTheme(
|
||||
titleSmall: AppStyle.subtitle,
|
||||
headlineSmall: AppStyle.title,
|
||||
titleLarge: AppStyle.headTitle2)
|
||||
.titleLarge,
|
||||
titleSmall: AppStyle.subtitle,
|
||||
headlineSmall: AppStyle.title,
|
||||
titleLarge: AppStyle.headTitle2,
|
||||
).titleLarge,
|
||||
),
|
||||
);
|
||||
|
||||
ThemeData themeArabic = ThemeData(
|
||||
fontFamily: "Cairo",
|
||||
textTheme: const TextTheme(
|
||||
displayLarge: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 22,
|
||||
color: AppColor.primaryColor),
|
||||
displayMedium: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 26,
|
||||
color: AppColor.primaryColor),
|
||||
bodyLarge: TextStyle(
|
||||
height: 2,
|
||||
color: AppColor.accentColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14),
|
||||
bodyMedium:
|
||||
TextStyle(height: 2, color: AppColor.accentColor, fontSize: 14)),
|
||||
ThemeData darkThemeEnglish = ThemeData(
|
||||
brightness: Brightness.dark,
|
||||
fontFamily: "SFPro",
|
||||
textTheme: TextTheme(
|
||||
displaySmall: AppStyle.title,
|
||||
displayLarge: AppStyle.headTitle,
|
||||
displayMedium: AppStyle.headTitle2,
|
||||
bodyLarge: AppStyle.title,
|
||||
bodyMedium: AppStyle.subtitle,
|
||||
),
|
||||
primarySwatch: Colors.blue,
|
||||
dialogTheme: DialogTheme(
|
||||
backgroundColor: AppColor.secondaryColor,
|
||||
contentTextStyle: AppStyle.title,
|
||||
titleTextStyle: AppStyle.headTitle2,
|
||||
),
|
||||
appBarTheme: AppBarTheme(
|
||||
elevation: 0,
|
||||
color: AppColor.secondaryColor,
|
||||
centerTitle: true,
|
||||
iconTheme: const IconThemeData(
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
toolbarTextStyle: TextTheme(
|
||||
titleSmall: AppStyle.subtitle,
|
||||
headlineSmall: AppStyle.title,
|
||||
titleLarge: AppStyle.headTitle2,
|
||||
).bodyMedium,
|
||||
titleTextStyle: TextTheme(
|
||||
titleSmall: AppStyle.subtitle,
|
||||
headlineSmall: AppStyle.title,
|
||||
titleLarge: AppStyle.headTitle2,
|
||||
).titleLarge,
|
||||
),
|
||||
);
|
||||
|
||||
ThemeData lightThemeArabic = ThemeData(
|
||||
brightness: Brightness.light,
|
||||
fontFamily: 'SFArabic',
|
||||
textTheme: TextTheme(
|
||||
displaySmall: AppStyle.title,
|
||||
displayLarge: AppStyle.headTitle,
|
||||
displayMedium: AppStyle.headTitle2,
|
||||
bodyLarge: AppStyle.title,
|
||||
bodyMedium: AppStyle.subtitle,
|
||||
),
|
||||
primarySwatch: Colors.blue,
|
||||
dialogTheme: DialogTheme(
|
||||
backgroundColor: AppColor.secondaryColor,
|
||||
contentTextStyle: AppStyle.title,
|
||||
titleTextStyle: AppStyle.headTitle2,
|
||||
),
|
||||
appBarTheme: AppBarTheme(
|
||||
elevation: 0,
|
||||
color: AppColor.secondaryColor,
|
||||
centerTitle: true,
|
||||
iconTheme: const IconThemeData(
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
toolbarTextStyle: TextTheme(
|
||||
titleSmall: AppStyle.subtitle,
|
||||
headlineSmall: AppStyle.title,
|
||||
titleLarge: AppStyle.headTitle2,
|
||||
).bodyMedium,
|
||||
titleTextStyle: TextTheme(
|
||||
titleSmall: AppStyle.subtitle,
|
||||
headlineSmall: AppStyle.title,
|
||||
titleLarge: AppStyle.headTitle2,
|
||||
).titleLarge,
|
||||
),
|
||||
);
|
||||
|
||||
ThemeData darkThemeArabic = ThemeData(
|
||||
brightness: Brightness.dark,
|
||||
fontFamily: 'SFArabic',
|
||||
textTheme: TextTheme(
|
||||
displaySmall: AppStyle.title,
|
||||
displayLarge: AppStyle.headTitle,
|
||||
displayMedium: AppStyle.headTitle2,
|
||||
bodyLarge: AppStyle.title,
|
||||
bodyMedium: AppStyle.subtitle,
|
||||
),
|
||||
primarySwatch: Colors.blue,
|
||||
dialogTheme: DialogTheme(
|
||||
backgroundColor: AppColor.secondaryColor,
|
||||
contentTextStyle: AppStyle.title,
|
||||
titleTextStyle: AppStyle.headTitle2,
|
||||
),
|
||||
appBarTheme: AppBarTheme(
|
||||
elevation: 0,
|
||||
color: AppColor.secondaryColor,
|
||||
centerTitle: true,
|
||||
iconTheme: const IconThemeData(
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
toolbarTextStyle: TextTheme(
|
||||
titleSmall: AppStyle.subtitle,
|
||||
headlineSmall: AppStyle.title,
|
||||
titleLarge: AppStyle.headTitle2,
|
||||
).bodyMedium,
|
||||
titleTextStyle: TextTheme(
|
||||
titleSmall: AppStyle.subtitle,
|
||||
headlineSmall: AppStyle.title,
|
||||
titleLarge: AppStyle.headTitle2,
|
||||
).titleLarge,
|
||||
),
|
||||
);
|
||||
|
||||
15
lib/env/env.dart
vendored
15
lib/env/env.dart
vendored
@@ -4,6 +4,21 @@ part 'env.g.dart';
|
||||
|
||||
@Envied()
|
||||
abstract class Env {
|
||||
@EnviedField(varName: 'addd', obfuscate: true)
|
||||
static final String addd = _Env.addd;
|
||||
|
||||
@EnviedField(varName: 'getapiKey', obfuscate: true)
|
||||
static final String getapiKey = _Env.getapiKey;
|
||||
|
||||
@EnviedField(varName: 'passnpassenger', obfuscate: true)
|
||||
static final String passnpassenger = _Env.passnpassenger;
|
||||
|
||||
@EnviedField(varName: 'newId', obfuscate: true)
|
||||
static final String newId = _Env.newId;
|
||||
|
||||
@EnviedField(varName: 'allowed', obfuscate: true)
|
||||
static final String allowed = _Env.allowed;
|
||||
|
||||
@EnviedField(varName: 'basicAuthCredentials', obfuscate: true)
|
||||
static final String basicAuthCredentials = _Env.basicAuthCredentials;
|
||||
|
||||
|
||||
2663
lib/env/env.g.dart
vendored
2663
lib/env/env.g.dart
vendored
File diff suppressed because it is too large
Load Diff
@@ -8,11 +8,12 @@ import 'package:get/get.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
|
||||
import 'controller/firebase.dart';
|
||||
import 'controller/functions/encrypt_decrypt.dart';
|
||||
import 'controller/functions/initilize.dart';
|
||||
import 'controller/local/local_controller.dart';
|
||||
import 'controller/local/translations.dart';
|
||||
import 'firebase_options.dart';
|
||||
import 'login_page.dart';
|
||||
import 'views/home/main.dart';
|
||||
|
||||
final box = GetStorage();
|
||||
const storage = FlutterSecureStorage();
|
||||
@@ -38,6 +39,12 @@ void main() async {
|
||||
// DeviceOrientation.portraitDown,
|
||||
// ]);
|
||||
// }
|
||||
final AppInitializer initializer = AppInitializer();
|
||||
|
||||
await initializer.initializeApp();
|
||||
await Future.delayed(Duration.zero);
|
||||
await EncryptionHelper.initialize();
|
||||
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
|
||||
146
lib/models/sql
146
lib/models/sql
@@ -32,7 +32,7 @@ SELECT
|
||||
FROM
|
||||
`driver` d
|
||||
WHERE
|
||||
d.`maritalStatus` IN('Maryam', 'Salma', 'Mena') AND DATE(d.created_at) = CURDATE()
|
||||
d.`maritalStatus` IN('Maryam', 'rawda', 'Mena') AND DATE(d.created_at) = CURDATE()
|
||||
GROUP BY
|
||||
d.`maritalStatus`
|
||||
ORDER BY
|
||||
@@ -63,4 +63,146 @@ WHERE
|
||||
|
||||
----- driver
|
||||
SELECT phone,email,name_arabic,national_number FROM `driver` WHERE national_number ='29209290106392'
|
||||
ORDER BY `driver`.`created_at` DESC
|
||||
ORDER BY `driver`.`created_at` DESC
|
||||
|
||||
|
||||
|
||||
------- driver work
|
||||
|
||||
SELECT
|
||||
COUNT(`car_locations`.driver_id),
|
||||
driver.id,
|
||||
driver.phone,
|
||||
driver.name_arabic
|
||||
FROM
|
||||
`car_locations`
|
||||
LEFT JOIN driver ON driver.id = car_locations.driver_id
|
||||
WHERE
|
||||
`car_locations`. created_at > TIMESTAMP(
|
||||
DATE_SUB(NOW(), INTERVAL 10 MINUTE))
|
||||
GROUP BY
|
||||
driver_id
|
||||
ORDER BY
|
||||
COUNT(driver_id)
|
||||
DESC
|
||||
;
|
||||
|
||||
|
||||
------ get count of year cars
|
||||
SELECT
|
||||
CASE
|
||||
WHEN `year` > 2017 THEN 'After 2017'
|
||||
WHEN `year` BETWEEN 2000 AND 2016 THEN '2000-2016'
|
||||
ELSE 'Before 2000'
|
||||
END AS `year_group`,
|
||||
COUNT(*) AS `count`
|
||||
FROM `carPlateEdit`
|
||||
GROUP BY `year_group`
|
||||
ORDER BY `year_group` ASC;
|
||||
|
||||
|
||||
|
||||
-- delete location 1 day
|
||||
|
||||
DELETE
|
||||
FROM
|
||||
`car_locations`
|
||||
WHERE
|
||||
DATE(`created_at`) < CURDATE();
|
||||
SELECT
|
||||
COUNT(`car_locations`.driver_id),
|
||||
driver.id,
|
||||
driver.phone,
|
||||
driver.name_arabic
|
||||
FROM
|
||||
`car_locations`
|
||||
LEFT JOIN driver ON driver.id = car_locations.driver_id
|
||||
WHERE
|
||||
`car_locations`.created_at > TIMESTAMP(
|
||||
DATE_SUB(NOW(), INTERVAL 10 MINUTE))
|
||||
GROUP BY
|
||||
driver_id
|
||||
ORDER BY
|
||||
COUNT(driver_id)
|
||||
DESC
|
||||
;
|
||||
|
||||
|
||||
-- driver register by hours for employee
|
||||
SELECT
|
||||
d.`maritalStatus` AS NAME,
|
||||
HOUR(d.created_at) AS hour,
|
||||
COUNT(*) AS `count`
|
||||
FROM
|
||||
`driver` d
|
||||
WHERE
|
||||
d.`maritalStatus` IN ('Maryam', 'rawda', 'Mena')
|
||||
AND DATE(d.created_at) = CURDATE()
|
||||
GROUP BY
|
||||
d.`maritalStatus`, HOUR(d.created_at)
|
||||
ORDER BY
|
||||
hour, `count` DESC;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---- monthly
|
||||
SELECT
|
||||
MONTH(d.created_at) AS month,
|
||||
COUNT(d.id) AS `count`
|
||||
FROM
|
||||
`driver` d
|
||||
WHERE
|
||||
YEAR(d.created_at) = YEAR(CURDATE())
|
||||
GROUP BY
|
||||
MONTH(d.created_at)
|
||||
ORDER BY
|
||||
month,
|
||||
`count`
|
||||
DESC
|
||||
;
|
||||
-----AI request
|
||||
|
||||
|
||||
SELECT
|
||||
f.id,
|
||||
f.passengerId,
|
||||
f.feedBack,
|
||||
f.datecreated,
|
||||
r.id AS ride_id,
|
||||
r.start_location,
|
||||
r.end_location,
|
||||
r.date,
|
||||
r.price,
|
||||
r.status,
|
||||
r.paymentMethod,
|
||||
r.distance,
|
||||
r.carType,
|
||||
r.rideTimeFinish,
|
||||
r.rideTimeStart,
|
||||
r.DriverIsGoingToPassenger,
|
||||
COUNT(rp.id) AS countRateFromPassengerToDrivers,
|
||||
COUNT(rd.id) AS countRateFromDriverToPassengers,
|
||||
MAX(rp.rating) AS rateFromPassengerToDriver,
|
||||
MAX(rd.rating) AS rateFromDriversToPassengers,
|
||||
MAX(rp.comment) AS commentFromPassengerToDriver,
|
||||
MAX(rd.comment) AS commentFromDriverToPassenger
|
||||
FROM
|
||||
`feedBack` f
|
||||
LEFT JOIN ride r ON
|
||||
r.passenger_id = f.passengerId
|
||||
LEFT JOIN ratingPassenger rp ON
|
||||
rp.passenger_id = r.passenger_id
|
||||
LEFT JOIN ratingDriver rd ON
|
||||
rd.driver_id = r.driver_id
|
||||
WHERE
|
||||
r.passenger_id = '113172279072358305645'
|
||||
GROUP BY
|
||||
f.id, f.passengerId, f.feedBack, f.datecreated,
|
||||
r.id, r.start_location, r.end_location, r.date, r.price,
|
||||
r.status, r.paymentMethod, r.distance, r.carType,
|
||||
r.rideTimeFinish, r.rideTimeStart, r.DriverIsGoingToPassenger
|
||||
ORDER BY
|
||||
r.date DESC
|
||||
LIMIT 1;
|
||||
99
lib/models/vshost.md
Normal file
99
lib/models/vshost.md
Normal file
@@ -0,0 +1,99 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
{{ssl_certificate_key}}
|
||||
{{ssl_certificate}}
|
||||
server_name www.sefer.click;
|
||||
return 301 https://sefer.click$request_uri;
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
{{ssl_certificate_key}}
|
||||
{{ssl_certificate}}
|
||||
server_name sefer.click www1.sefer.click;
|
||||
{{root}}
|
||||
{{nginx_access_log}}
|
||||
{{nginx_error_log}}
|
||||
|
||||
# Set the maximum request body size
|
||||
|
||||
client_max_body_size 10m;
|
||||
if ($scheme != "https") {
|
||||
rewrite ^ https://$host$uri permanent;
|
||||
}
|
||||
location ~ /.well-known {
|
||||
auth_basic off;
|
||||
allow all;
|
||||
}
|
||||
|
||||
# Security headers
|
||||
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline';" always;
|
||||
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
||||
add_header Permissions-Policy "geolocation=(), microphone=()" always;
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
|
||||
{{settings}}
|
||||
location / {
|
||||
{{varnish_proxy_pass}}
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_hide_header X-Varnish;
|
||||
proxy_redirect off;
|
||||
proxy_max_temp_file_size 0;
|
||||
proxy_connect_timeout 720;
|
||||
proxy_send_timeout 720;
|
||||
proxy_read_timeout 720;
|
||||
proxy_buffer_size 128k;
|
||||
proxy_buffers 4 256k;
|
||||
proxy_busy_buffers_size 256k;
|
||||
proxy_temp_file_write_size 256k;
|
||||
}
|
||||
location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf|map|mjs)$ {
|
||||
add_header Access-Control-Allow-Origin "\*";
|
||||
expires max;
|
||||
access_log off;
|
||||
}
|
||||
location ~ /\.(ht|svn|git) {
|
||||
deny all;
|
||||
}
|
||||
if (-f $request_filename) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
server {
|
||||
listen 8080;
|
||||
listen [::]:8080;
|
||||
server_name sefer.click www1.sefer.click;
|
||||
{{root}}
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
index index.php index.html;
|
||||
location ~ \.php$ {
|
||||
include fastcgi_params;
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
try_files $uri =404;
|
||||
fastcgi_read_timeout 3600;
|
||||
fastcgi_send_timeout 3600;
|
||||
proxy_read_timeout 3600;
|
||||
proxy_send_timeout 3600;
|
||||
fastcgi_param HTTPS "on";
|
||||
fastcgi_param SERVER_PORT 443;
|
||||
fastcgi_pass 127.0.0.1:{{php_fpm_port}};
|
||||
fastcgi_param PHP_VALUE "{{php_settings}}";
|
||||
}
|
||||
if (-f $request_filename) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//above for cairo server
|
||||
222
lib/translations_ar.json
Normal file
222
lib/translations_ar.json
Normal file
@@ -0,0 +1,222 @@
|
||||
{
|
||||
"Insert Name of Driver": "",
|
||||
"raw gray": "",
|
||||
"Expiration Date": "",
|
||||
"Insert site of Driver": "",
|
||||
"Insert Name of Owner": "",
|
||||
"Insert car_type of Driver": "",
|
||||
"car_license_front": "",
|
||||
"Alexandria": "",
|
||||
"navy": "",
|
||||
"Displacement": "",
|
||||
"Insert birth_date of Driver": "",
|
||||
"Criminal Record": "",
|
||||
"Model": "",
|
||||
"License Type": "",
|
||||
"Birthdate": "",
|
||||
"Notes": "",
|
||||
"s License": "",
|
||||
"Complaints": "",
|
||||
"Full Name": "",
|
||||
"Next": "",
|
||||
"Full Name (Marital)": "",
|
||||
"Non Egypt": "",
|
||||
"Giza": "",
|
||||
";\n static const String stripePublishableKey = ": "",
|
||||
"magenta": "",
|
||||
"An error occurred while saving driver data": "",
|
||||
"Email": "",
|
||||
"My documents have expired": "",
|
||||
"Vehicle Information": "",
|
||||
"Education": "",
|
||||
"Capture an Image of Your ID Document Back": "",
|
||||
"Personal Information": "",
|
||||
"Vehicle Details Front": "",
|
||||
"Tax Expiry Date": "",
|
||||
"Insert site of Owner": "",
|
||||
"ID Documents Back": "",
|
||||
"settings": "",
|
||||
"car_license_back": "",
|
||||
"OK": "",
|
||||
"Price": "",
|
||||
"Country": "",
|
||||
"orange": "",
|
||||
"pink": "",
|
||||
"DOB": "",
|
||||
"Insert license type of Driver": "",
|
||||
"Card ID": "",
|
||||
"inspection\",\n \"Capture an Image of Your car license back\":\n \"Capturez une image de votre permis de voiture\",\n \"Capture an Image of Your Driver’s License\":\n \"Capturez une image de votre permis de conduire\",\n \"Sign in with Google for easier email and name entry\":\n \"Connectez-vous avec Google pour faciliter la saisie de votre adresse e-mail et de votre nom\",\n \"You will choose allow all the time to be ready receive orders\":\n \"Vous choisirez de permettre à tout moment d": "",
|
||||
"are you sure to pay to this driver gift": "",
|
||||
"gold": "",
|
||||
">Arabic (Egypt)</span>\n </div>\n </div>\n <span title=": "",
|
||||
"Name (Arabic)": "",
|
||||
"Driver Information": "",
|
||||
"Success": "",
|
||||
"insert passenger phone": "",
|
||||
"yellow": "",
|
||||
"Phone": "",
|
||||
"National ID": "",
|
||||
"thanks": "",
|
||||
"Make": "",
|
||||
"Not found any image": "",
|
||||
"Save Notes": "",
|
||||
"cyan": "",
|
||||
"Insert registration_date of Car": "",
|
||||
"Bank Information": "",
|
||||
"best driver": "",
|
||||
"indigo": "",
|
||||
"peach": "",
|
||||
"Ride ID": "",
|
||||
"Edit car details": "",
|
||||
"IssueDate": "",
|
||||
"Fuel Type": "",
|
||||
"Birth Date": "",
|
||||
"Marital Status": "",
|
||||
"Color": "",
|
||||
"Name": "",
|
||||
"Created At": "",
|
||||
"Registration Date": "",
|
||||
"View complaint": "",
|
||||
"Enter notes after call": "",
|
||||
"silver": "",
|
||||
"Phone Number": "",
|
||||
"Cropper": "",
|
||||
"End Time": "",
|
||||
"Enter notes here...": "",
|
||||
"ID Documents Front": "",
|
||||
"unknown_document": "",
|
||||
": ": "",
|
||||
"CardID": "",
|
||||
"Insert national ID of Driver": "",
|
||||
"Insert car_model of Driver": "",
|
||||
"mocha": "",
|
||||
"Capture an Image of Your Driver License": "",
|
||||
"maroon": "",
|
||||
"InspectionResult": "",
|
||||
"Expired Driver’s License": "",
|
||||
"Failed to save driver data": "",
|
||||
"Upload": "",
|
||||
"Wallet Information": "",
|
||||
"Drivers Cant Register": "",
|
||||
"For Egypt": "",
|
||||
"Driver Statistics": "",
|
||||
"Hand Inserting": "",
|
||||
"navy blue": "",
|
||||
"Add car": "",
|
||||
"Bank Code": "",
|
||||
"Please enter a valid email.": "",
|
||||
"Religion": "",
|
||||
"Welcome call": "",
|
||||
"Non-Egyptian ID Front": "",
|
||||
"FullName": "",
|
||||
"Call Driver": "",
|
||||
"Occupation": "",
|
||||
"Plate Number": "",
|
||||
"Inspection Date": "",
|
||||
"turquoise": "",
|
||||
"Date": "",
|
||||
"red ochre": "",
|
||||
"gray": "",
|
||||
"Edit car plate": "",
|
||||
"tawny": "",
|
||||
"License Categories": "",
|
||||
"car plate": "",
|
||||
"Image Upload Failed": "",
|
||||
"incorrect_document_title": "",
|
||||
"Expiry Date": "",
|
||||
"Gender": "",
|
||||
"Owner Name": "",
|
||||
"License Information": "",
|
||||
"Sefer Service": "",
|
||||
"Add": "",
|
||||
"expected": "",
|
||||
"Name (English)": "",
|
||||
"Distance": "",
|
||||
"Capture an Image of Your car license back": "",
|
||||
"Account Number": "",
|
||||
"I don't have a suitable vehicle": "",
|
||||
"black": "",
|
||||
"First Name": "",
|
||||
"Total Rides": "",
|
||||
"NationalID": "",
|
||||
"Avg Passenger Rating": "",
|
||||
"Notes:": "",
|
||||
"teal": "",
|
||||
"National Number": "",
|
||||
"green": "",
|
||||
"Chassis": "",
|
||||
"Insert year of Car": "",
|
||||
"Average Rating": "",
|
||||
"Driver details by phone": "",
|
||||
"Insert all fields": "",
|
||||
"champagne": "",
|
||||
"Add Driver Who Wants to Work": "",
|
||||
"Add Car Who Wants to Work": "",
|
||||
"I'm not ready yet": "",
|
||||
"Car Type": "",
|
||||
"Capture an Image of Your ID Document front": "",
|
||||
"Capture an Image of Your Criminal Record": "",
|
||||
"License Expiry Date": "",
|
||||
"blue": "",
|
||||
"Done": "",
|
||||
"Passengers Cant Register": "",
|
||||
"Fuel": "",
|
||||
"Total Payments": "",
|
||||
"red": "",
|
||||
"Cancel": "",
|
||||
"Additional comments": "",
|
||||
"Vehicle Details Back": "",
|
||||
"detected": "",
|
||||
"violet": "",
|
||||
"Capture Image of Non-Egyptian ID Front": "",
|
||||
"lime": "",
|
||||
"I need more help understanding the app": "",
|
||||
"id_card_front": "",
|
||||
"Payment Method": "",
|
||||
"Ok": "",
|
||||
"Wallet Balance": "",
|
||||
"Last Payment Amount": "",
|
||||
"Owner": "",
|
||||
"Order": "",
|
||||
"Year": "",
|
||||
"Capture an Image of Your car license front": "",
|
||||
"Scam Reports": "",
|
||||
"Welcome Drivers": "",
|
||||
"Search by phone number": "",
|
||||
"verdi": "",
|
||||
"Please enter a valid phone number.": "",
|
||||
"Save Changes": "",
|
||||
"Employment": "",
|
||||
"Issue Date": "",
|
||||
"passenger details by phone": "",
|
||||
"Insert car_number of Driver": "",
|
||||
"hand inserting": "",
|
||||
"driver_license": "",
|
||||
"Error": "",
|
||||
"Car Details": "",
|
||||
"uploaded sucssefuly": "",
|
||||
"Start Time": "",
|
||||
"I'll register when the app is fully launched": "",
|
||||
"Passport No": "",
|
||||
"Please enter": "",
|
||||
"Address": "",
|
||||
"Documents check": "",
|
||||
"Categories": "",
|
||||
"Status": "",
|
||||
"insert Driver phone": "",
|
||||
"brown": "",
|
||||
"Best Drivers": "",
|
||||
"Apply Ride": "",
|
||||
"Latest Ride": "",
|
||||
"purple": "",
|
||||
"No Car found yet": "",
|
||||
"Insert phone of Driver": "",
|
||||
"Passengers Rated": "",
|
||||
"Last Payment Method": "",
|
||||
"Insert phone of Owner": "",
|
||||
"VIN": "",
|
||||
"bronze": "",
|
||||
"dark blue": "",
|
||||
"white": "",
|
||||
"id_card_back": ""
|
||||
}
|
||||
222
lib/translations_en.json
Normal file
222
lib/translations_en.json
Normal file
@@ -0,0 +1,222 @@
|
||||
{
|
||||
"Insert Name of Driver": "",
|
||||
"raw gray": "",
|
||||
"Expiration Date": "",
|
||||
"Insert site of Driver": "",
|
||||
"Insert Name of Owner": "",
|
||||
"Insert car_type of Driver": "",
|
||||
"car_license_front": "",
|
||||
"Alexandria": "",
|
||||
"navy": "",
|
||||
"Displacement": "",
|
||||
"Insert birth_date of Driver": "",
|
||||
"Criminal Record": "",
|
||||
"Model": "",
|
||||
"License Type": "",
|
||||
"Birthdate": "",
|
||||
"Notes": "",
|
||||
"s License": "",
|
||||
"Complaints": "",
|
||||
"Full Name": "",
|
||||
"Next": "",
|
||||
"Full Name (Marital)": "",
|
||||
"Non Egypt": "",
|
||||
"Giza": "",
|
||||
";\n static const String stripePublishableKey = ": "",
|
||||
"magenta": "",
|
||||
"An error occurred while saving driver data": "",
|
||||
"Email": "",
|
||||
"My documents have expired": "",
|
||||
"Vehicle Information": "",
|
||||
"Education": "",
|
||||
"Capture an Image of Your ID Document Back": "",
|
||||
"Personal Information": "",
|
||||
"Vehicle Details Front": "",
|
||||
"Tax Expiry Date": "",
|
||||
"Insert site of Owner": "",
|
||||
"ID Documents Back": "",
|
||||
"settings": "",
|
||||
"car_license_back": "",
|
||||
"OK": "",
|
||||
"Price": "",
|
||||
"Country": "",
|
||||
"orange": "",
|
||||
"pink": "",
|
||||
"DOB": "",
|
||||
"Insert license type of Driver": "",
|
||||
"Card ID": "",
|
||||
"inspection\",\n \"Capture an Image of Your car license back\":\n \"Capturez une image de votre permis de voiture\",\n \"Capture an Image of Your Driver’s License\":\n \"Capturez une image de votre permis de conduire\",\n \"Sign in with Google for easier email and name entry\":\n \"Connectez-vous avec Google pour faciliter la saisie de votre adresse e-mail et de votre nom\",\n \"You will choose allow all the time to be ready receive orders\":\n \"Vous choisirez de permettre à tout moment d": "",
|
||||
"are you sure to pay to this driver gift": "",
|
||||
"gold": "",
|
||||
">Arabic (Egypt)</span>\n </div>\n </div>\n <span title=": "",
|
||||
"Name (Arabic)": "",
|
||||
"Driver Information": "",
|
||||
"Success": "",
|
||||
"insert passenger phone": "",
|
||||
"yellow": "",
|
||||
"Phone": "",
|
||||
"National ID": "",
|
||||
"thanks": "",
|
||||
"Make": "",
|
||||
"Not found any image": "",
|
||||
"Save Notes": "",
|
||||
"cyan": "",
|
||||
"Insert registration_date of Car": "",
|
||||
"Bank Information": "",
|
||||
"best driver": "",
|
||||
"indigo": "",
|
||||
"peach": "",
|
||||
"Ride ID": "",
|
||||
"Edit car details": "",
|
||||
"IssueDate": "",
|
||||
"Fuel Type": "",
|
||||
"Birth Date": "",
|
||||
"Marital Status": "",
|
||||
"Color": "",
|
||||
"Name": "",
|
||||
"Created At": "",
|
||||
"Registration Date": "",
|
||||
"View complaint": "",
|
||||
"Enter notes after call": "",
|
||||
"silver": "",
|
||||
"Phone Number": "",
|
||||
"Cropper": "",
|
||||
"End Time": "",
|
||||
"Enter notes here...": "",
|
||||
"ID Documents Front": "",
|
||||
"unknown_document": "",
|
||||
": ": "",
|
||||
"CardID": "",
|
||||
"Insert national ID of Driver": "",
|
||||
"Insert car_model of Driver": "",
|
||||
"mocha": "",
|
||||
"Capture an Image of Your Driver License": "",
|
||||
"maroon": "",
|
||||
"InspectionResult": "",
|
||||
"Expired Driver’s License": "",
|
||||
"Failed to save driver data": "",
|
||||
"Upload": "",
|
||||
"Wallet Information": "",
|
||||
"Drivers Cant Register": "",
|
||||
"For Egypt": "",
|
||||
"Driver Statistics": "",
|
||||
"Hand Inserting": "",
|
||||
"navy blue": "",
|
||||
"Add car": "",
|
||||
"Bank Code": "",
|
||||
"Please enter a valid email.": "",
|
||||
"Religion": "",
|
||||
"Welcome call": "",
|
||||
"Non-Egyptian ID Front": "",
|
||||
"FullName": "",
|
||||
"Call Driver": "",
|
||||
"Occupation": "",
|
||||
"Plate Number": "",
|
||||
"Inspection Date": "",
|
||||
"turquoise": "",
|
||||
"Date": "",
|
||||
"red ochre": "",
|
||||
"gray": "",
|
||||
"Edit car plate": "",
|
||||
"tawny": "",
|
||||
"License Categories": "",
|
||||
"car plate": "",
|
||||
"Image Upload Failed": "",
|
||||
"incorrect_document_title": "",
|
||||
"Expiry Date": "",
|
||||
"Gender": "",
|
||||
"Owner Name": "",
|
||||
"License Information": "",
|
||||
"Sefer Service": "",
|
||||
"Add": "",
|
||||
"expected": "",
|
||||
"Name (English)": "",
|
||||
"Distance": "",
|
||||
"Capture an Image of Your car license back": "",
|
||||
"Account Number": "",
|
||||
"I don't have a suitable vehicle": "",
|
||||
"black": "",
|
||||
"First Name": "",
|
||||
"Total Rides": "",
|
||||
"NationalID": "",
|
||||
"Avg Passenger Rating": "",
|
||||
"Notes:": "",
|
||||
"teal": "",
|
||||
"National Number": "",
|
||||
"green": "",
|
||||
"Chassis": "",
|
||||
"Insert year of Car": "",
|
||||
"Average Rating": "",
|
||||
"Driver details by phone": "",
|
||||
"Insert all fields": "",
|
||||
"champagne": "",
|
||||
"Add Driver Who Wants to Work": "",
|
||||
"Add Car Who Wants to Work": "",
|
||||
"I'm not ready yet": "",
|
||||
"Car Type": "",
|
||||
"Capture an Image of Your ID Document front": "",
|
||||
"Capture an Image of Your Criminal Record": "",
|
||||
"License Expiry Date": "",
|
||||
"blue": "",
|
||||
"Done": "",
|
||||
"Passengers Cant Register": "",
|
||||
"Fuel": "",
|
||||
"Total Payments": "",
|
||||
"red": "",
|
||||
"Cancel": "",
|
||||
"Additional comments": "",
|
||||
"Vehicle Details Back": "",
|
||||
"detected": "",
|
||||
"violet": "",
|
||||
"Capture Image of Non-Egyptian ID Front": "",
|
||||
"lime": "",
|
||||
"I need more help understanding the app": "",
|
||||
"id_card_front": "",
|
||||
"Payment Method": "",
|
||||
"Ok": "",
|
||||
"Wallet Balance": "",
|
||||
"Last Payment Amount": "",
|
||||
"Owner": "",
|
||||
"Order": "",
|
||||
"Year": "",
|
||||
"Capture an Image of Your car license front": "",
|
||||
"Scam Reports": "",
|
||||
"Welcome Drivers": "",
|
||||
"Search by phone number": "",
|
||||
"verdi": "",
|
||||
"Please enter a valid phone number.": "",
|
||||
"Save Changes": "",
|
||||
"Employment": "",
|
||||
"Issue Date": "",
|
||||
"passenger details by phone": "",
|
||||
"Insert car_number of Driver": "",
|
||||
"hand inserting": "",
|
||||
"driver_license": "",
|
||||
"Error": "",
|
||||
"Car Details": "",
|
||||
"uploaded sucssefuly": "",
|
||||
"Start Time": "",
|
||||
"I'll register when the app is fully launched": "",
|
||||
"Passport No": "",
|
||||
"Please enter": "",
|
||||
"Address": "",
|
||||
"Documents check": "",
|
||||
"Categories": "",
|
||||
"Status": "",
|
||||
"insert Driver phone": "",
|
||||
"brown": "",
|
||||
"Best Drivers": "",
|
||||
"Apply Ride": "",
|
||||
"Latest Ride": "",
|
||||
"purple": "",
|
||||
"No Car found yet": "",
|
||||
"Insert phone of Driver": "",
|
||||
"Passengers Rated": "",
|
||||
"Last Payment Method": "",
|
||||
"Insert phone of Owner": "",
|
||||
"VIN": "",
|
||||
"bronze": "",
|
||||
"dark blue": "",
|
||||
"white": "",
|
||||
"id_card_back": ""
|
||||
}
|
||||
@@ -1,14 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:service/constant/colors.dart';
|
||||
import 'package:service/constant/links.dart';
|
||||
import 'package:service/controller/functions/crud.dart';
|
||||
import 'package:service/controller/mainController/main_controller.dart';
|
||||
import 'package:service/controller/mainController/pages/best_driver_page.dart';
|
||||
import 'package:service/controller/mainController/pages/complaint.dart';
|
||||
import 'package:service/controller/mainController/pages/edit_car_plate.dart';
|
||||
import 'package:service/controller/mainController/pages/passengers_cant_regster.dart';
|
||||
import 'package:service/views/widgets/elevated_btn.dart';
|
||||
import 'package:service/views/widgets/my_dialog.dart';
|
||||
import 'package:service/views/widgets/my_textField.dart';
|
||||
|
||||
import '../../constant/style.dart';
|
||||
import '../../controller/mainController/pages/add_car.dart';
|
||||
import '../../controller/mainController/pages/contact_page.dart';
|
||||
import '../../controller/mainController/pages/drivers_cant_register.dart';
|
||||
import '../../controller/mainController/pages/welcome_call.dart';
|
||||
import '../widgets/my_scafold.dart';
|
||||
@@ -217,6 +223,252 @@ class Main extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
await mainController.getNewDriverRegister();
|
||||
// if (mainController.carPlateNotEdit.isNotEmpty) {
|
||||
Get.to(() => DriverTheBest());
|
||||
// }
|
||||
},
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
"best driver".tr,
|
||||
style: AppStyle.title,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: "Add Driver Who Wants to Work".tr,
|
||||
content: SizedBox(
|
||||
width: Get.width * .7,
|
||||
height: 300,
|
||||
child: Form(
|
||||
key: mainController.formKey,
|
||||
child: ListView(
|
||||
children: [
|
||||
MyTextForm(
|
||||
controller: mainController.driverNameController,
|
||||
label: 'Insert Name of Driver'.tr,
|
||||
hint: 'Insert Name of Driver'.tr,
|
||||
type: TextInputType.name),
|
||||
MyTextForm(
|
||||
controller: mainController.nationalIdController,
|
||||
label: 'Insert national ID of Driver'.tr,
|
||||
hint: 'Insert national ID of Driver'.tr,
|
||||
type: TextInputType.number),
|
||||
MyTextForm(
|
||||
controller: mainController.phoneController,
|
||||
label: 'Insert phone of Driver'.tr,
|
||||
hint: 'Insert phone of Driver'.tr,
|
||||
type: TextInputType.phone),
|
||||
MyTextForm(
|
||||
controller: mainController.licenseTypeController,
|
||||
label: 'Insert license type of Driver'.tr,
|
||||
hint: 'Insert license type of Driver'.tr,
|
||||
type: TextInputType.name),
|
||||
MyTextForm(
|
||||
controller: mainController.siteDriverController,
|
||||
label: 'Insert site of Driver'.tr,
|
||||
hint: 'Insert site of Driver'.tr,
|
||||
type: TextInputType.name),
|
||||
MyTextForm(
|
||||
controller: mainController.birthDateController,
|
||||
label: 'Insert birth_date of Driver'.tr,
|
||||
hint: 'Insert license type of Driver'.tr,
|
||||
type: TextInputType.number),
|
||||
],
|
||||
)),
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Add'.tr,
|
||||
onPressed: () async {
|
||||
if (mainController.formKey.currentState!.validate()) {
|
||||
var res = await CRUD()
|
||||
.post(link: AppLink.addDriverWantWork, payload: {
|
||||
"driver_name": mainController.driverNameController.text,
|
||||
"national_id": mainController.nationalIdController.text,
|
||||
"birth_date": mainController.birthDateController.text,
|
||||
"site": mainController.siteDriverController.text,
|
||||
"license_type":
|
||||
mainController.licenseTypeController.text,
|
||||
"phone": mainController.phoneController.text,
|
||||
});
|
||||
if (res != 'failure') {
|
||||
Get.back();
|
||||
mainController.driverNameController.clear();
|
||||
mainController.nationalIdController.clear();
|
||||
mainController.birthDateController.clear();
|
||||
mainController.licenseTypeController.clear();
|
||||
mainController.siteDriverController.clear();
|
||||
mainController.phoneController.clear();
|
||||
Get.snackbar('done', '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
}
|
||||
}
|
||||
},
|
||||
kolor: AppColor.greenColor,
|
||||
),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'Cancel'.tr,
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
"Add Driver Who Wants to Work".tr,
|
||||
style: AppStyle.title,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: "Add Car Who Wants to Work".tr,
|
||||
content: SizedBox(
|
||||
width: Get.width * .7,
|
||||
height: 300,
|
||||
child: Form(
|
||||
key: mainController.formKey,
|
||||
child: ListView(
|
||||
children: [
|
||||
MyTextForm(
|
||||
controller: mainController.carOwnerWorkController,
|
||||
label: 'Insert Name of Owner'.tr,
|
||||
hint: 'Insert Name of Owner'.tr,
|
||||
type: TextInputType.name),
|
||||
MyTextForm(
|
||||
controller: mainController.carNumberController,
|
||||
label: 'Insert car_number of Driver'.tr,
|
||||
hint: 'Insert car_number of Driver'.tr,
|
||||
type: TextInputType.name),
|
||||
MyTextForm(
|
||||
controller: mainController.phoneCarController,
|
||||
label: 'Insert phone of Owner'.tr,
|
||||
hint: 'Insert phone of Owner'.tr,
|
||||
type: TextInputType.phone),
|
||||
MyTextForm(
|
||||
controller:
|
||||
mainController.manufactureYearController,
|
||||
label: 'Insert year of Car'.tr,
|
||||
hint: 'Insert year of Car'.tr,
|
||||
type: TextInputType.number),
|
||||
MyTextForm(
|
||||
controller: mainController.carModelController,
|
||||
label: 'Insert car_model of Driver'.tr,
|
||||
hint: 'Insert car_model of Driver'.tr,
|
||||
type: TextInputType.name),
|
||||
MyTextForm(
|
||||
controller: mainController.siteCarController,
|
||||
label: 'Insert site of Owner'.tr,
|
||||
hint: 'Insert site of Owner'.tr,
|
||||
type: TextInputType.name),
|
||||
MyTextForm(
|
||||
controller: mainController.carTypeController,
|
||||
label: 'Insert car_type of Driver'.tr,
|
||||
hint: 'Insert car_type of Driver'.tr,
|
||||
type: TextInputType.name),
|
||||
MyTextForm(
|
||||
controller:
|
||||
mainController.registrationDateController,
|
||||
label: 'Insert registration_date of Car'.tr,
|
||||
hint: 'Insert registration_date of Car'.tr,
|
||||
type: TextInputType.datetime),
|
||||
],
|
||||
)),
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Add'.tr,
|
||||
onPressed: () async {
|
||||
if (mainController.formKey.currentState!.validate()) {
|
||||
var res = await CRUD()
|
||||
.post(link: AppLink.addCarWantWork, payload: {
|
||||
"owner_name":
|
||||
mainController.carOwnerWorkController.text,
|
||||
"car_number": mainController.carNumberController.text,
|
||||
"manufacture_year":
|
||||
mainController.manufactureYearController.text,
|
||||
"car_model": mainController.carModelController.text,
|
||||
"car_type": mainController.carTypeController.text,
|
||||
"site": mainController.siteCarController.text,
|
||||
"registration_date":
|
||||
mainController.registrationDateController.text,
|
||||
"phone": mainController.phoneCarController.text,
|
||||
});
|
||||
if (res != 'failure') {
|
||||
Get.back();
|
||||
mainController.ownerController.clear();
|
||||
mainController.carNumberController.clear();
|
||||
mainController.manufactureYearController.clear();
|
||||
mainController.carModelController.clear();
|
||||
mainController.siteCarController.clear();
|
||||
mainController.carTypeController.clear();
|
||||
mainController.registrationDateController.clear();
|
||||
mainController.phoneController.clear();
|
||||
Get.snackbar('done', '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
}
|
||||
}
|
||||
},
|
||||
kolor: AppColor.greenColor,
|
||||
),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'Cancel'.tr,
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
"Add Car Who Wants to Work".tr,
|
||||
style: AppStyle.title,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// Get.to(() => const ContactPage());
|
||||
// },
|
||||
// child: Container(
|
||||
// decoration: AppStyle.boxDecoration,
|
||||
// child: const Center(child: Text('contact')),
|
||||
// ),
|
||||
// )
|
||||
],
|
||||
)
|
||||
]);
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
|
||||
class MyCircularProgressIndicator extends StatelessWidget {
|
||||
final Color backgroundColor;
|
||||
@@ -35,3 +40,121 @@ class MyCircularProgressIndicator extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SnackbarConfig {
|
||||
static const duration = Duration(seconds: 3);
|
||||
static const animationDuration = Duration(milliseconds: 300);
|
||||
static const margin = EdgeInsets.symmetric(horizontal: 16, vertical: 10);
|
||||
static const borderRadius = 12.0;
|
||||
static const elevation = 6.0;
|
||||
|
||||
static final BoxShadow shadow = BoxShadow(
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 2),
|
||||
);
|
||||
}
|
||||
|
||||
SnackbarController mySnackeBarError(String message) {
|
||||
// Trigger error haptic feedback
|
||||
HapticFeedback.mediumImpact();
|
||||
|
||||
return Get.snackbar(
|
||||
'Error'.tr,
|
||||
message,
|
||||
backgroundColor: AppColor.redColor.withOpacity(0.95),
|
||||
colorText: AppColor.secondaryColor,
|
||||
icon: const Icon(
|
||||
Icons.error_outline_rounded,
|
||||
color: AppColor.secondaryColor,
|
||||
size: 28,
|
||||
),
|
||||
shouldIconPulse: true,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
margin: SnackbarConfig.margin,
|
||||
borderRadius: SnackbarConfig.borderRadius,
|
||||
duration: SnackbarConfig.duration,
|
||||
animationDuration: SnackbarConfig.animationDuration,
|
||||
forwardAnimationCurve: Curves.easeOutCirc,
|
||||
reverseAnimationCurve: Curves.easeInCirc,
|
||||
boxShadows: [SnackbarConfig.shadow],
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
titleText: Text(
|
||||
'Error'.tr,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
letterSpacing: 0.2,
|
||||
),
|
||||
),
|
||||
messageText: Text(
|
||||
message,
|
||||
style: TextStyle(
|
||||
color: Colors.white.withOpacity(0.95),
|
||||
fontSize: 14,
|
||||
height: 1.3,
|
||||
),
|
||||
),
|
||||
onTap: (_) {
|
||||
HapticFeedback.lightImpact();
|
||||
Get.closeCurrentSnackbar();
|
||||
},
|
||||
isDismissible: true,
|
||||
dismissDirection: DismissDirection.horizontal,
|
||||
overlayBlur: 0.8,
|
||||
overlayColor: Colors.black12,
|
||||
);
|
||||
}
|
||||
|
||||
SnackbarController mySnackbarSuccess(String message) {
|
||||
// Trigger success haptic feedback
|
||||
HapticFeedback.lightImpact();
|
||||
|
||||
return Get.snackbar(
|
||||
'Success'.tr,
|
||||
message,
|
||||
backgroundColor: AppColor.greenColor.withOpacity(0.95),
|
||||
colorText: AppColor.secondaryColor,
|
||||
icon: const Icon(
|
||||
Icons.check_circle_outline_rounded,
|
||||
color: AppColor.secondaryColor,
|
||||
size: 28,
|
||||
),
|
||||
shouldIconPulse: true,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
margin: SnackbarConfig.margin,
|
||||
borderRadius: SnackbarConfig.borderRadius,
|
||||
duration: SnackbarConfig.duration,
|
||||
animationDuration: SnackbarConfig.animationDuration,
|
||||
forwardAnimationCurve: Curves.easeOutCirc,
|
||||
reverseAnimationCurve: Curves.easeInCirc,
|
||||
boxShadows: [SnackbarConfig.shadow],
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
titleText: Text(
|
||||
'Success'.tr,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
letterSpacing: 0.2,
|
||||
),
|
||||
),
|
||||
messageText: Text(
|
||||
message,
|
||||
style: TextStyle(
|
||||
color: Colors.white.withOpacity(0.95),
|
||||
fontSize: 14,
|
||||
height: 1.3,
|
||||
),
|
||||
),
|
||||
onTap: (_) {
|
||||
HapticFeedback.lightImpact();
|
||||
Get.closeCurrentSnackbar();
|
||||
},
|
||||
isDismissible: true,
|
||||
dismissDirection: DismissDirection.horizontal,
|
||||
overlayBlur: 0.8,
|
||||
overlayColor: Colors.black12,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user