This commit is contained in:
Hamza-Ayed
2024-09-14 23:19:25 +03:00
parent ba3a9850c2
commit 02bb9fc7f7
23 changed files with 2407 additions and 1020 deletions

View File

@@ -12,6 +12,8 @@ class AK {
static final String ocpApimSubscriptionKey = Env.ocpApimSubscriptionKey;
static final String anthropicAIkeySeferNew =
X.r(X.r(X.r(Env.anthropicAIkeySeferNew, cn), cC), cs);
static final String anthropicAIkeySeferNewHamzaayedpython =
X.r(X.r(X.r(Env.anthropicAIkeySeferNewHamzaayedpython, cn), cC), cs);
static final String emailService = (Env.emailService);
///////////

View File

@@ -6,6 +6,7 @@ class BoxName {
static const String tokenParent = "tokenParent";
static const String lang = "lang";
static const String gender = "gender";
static const String serverChosen = "serverChosen";
static const String carType = "carType";
static const String carPlate = "carPlate";
static const String isVerified = '0';

View File

@@ -1,7 +1,19 @@
import '../env/env.dart';
import '../main.dart';
import 'box_name.dart';
class AppLink {
static final String server = Env.serverPHP;
// static final String seferPaymentServer = Env.seferPaymentServer;
// // static final String seferPaymentServer = '${Env.seferCairoServer}/ride';
static final String seferAlexandriaServer = Env.seferAlexandriaServer;
static final String seferCairoServer = Env.seferCairoServer;
static final String seferGizaServer = Env.seferGizaServer;
// static final String server = Env.serverPHP;
static final String endPoint = box.read(BoxName.serverChosen);
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';
static String getTokens = "$server/ride/firebase/get.php";
@@ -30,7 +42,7 @@ class AppLink {
static String updateAccountBank = "$authCaptin/updateAccountBank.php";
static String getAccount = "$authCaptin/getAccount.php";
static String test = "$server/test.php";
static String serviceApp = "$server/serviceApp";
static String serviceApp = "$server/serviceapp";
static String getPassengersByPhone =
"$server/serviceApp/getPassengersByPhone.php";
static String getDriverByPhone = "$serviceApp/getDriverByPhone.php";
@@ -42,6 +54,7 @@ class AppLink {
"$serviceApp/getPassengersNotCompleteRegistration.php";
static String addNotesDriver = "$serviceApp/addNotesDriver.php";
static String getCarPlateNotEdit = "$serviceApp/getCarPlateNotEdit.php";
static String getdriverWithoutCar = "$serviceApp/getdriverWithoutCar.php";
static String addNotesPassenger = "$serviceApp/addNotesPassenger.php";
static String editCarPlate = "$serviceApp/editCarPlate.php";
static String getComplaintAllData = "$serviceApp/getComplaintAllData.php";
@@ -50,6 +63,7 @@ class AppLink {
static String addCriminalDocuments = "$authCaptin/addCriminalDocuments.php";
static String ride = '$server/ride';
static String addRegisrationCar = "$ride/RegisrationCar/add.php";
static String addCartoDriver = "$serviceApp/addCartoDriver.php";
static String getRegisrationCar = "$ride/RegisrationCar/get.php";
static String updateRegisrationCar = "$ride/RegisrationCar/update.php";
}

View File

@@ -143,6 +143,7 @@ class CRUD {
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) {
@@ -150,6 +151,7 @@ class CRUD {
return response.body;
} else {
String errorMessage = jsonData['message'];
Log.print('errorMessage: ${errorMessage}');
// Get.snackbar('Error'.tr, errorMessage.tr,
// backgroundColor: AppColor.redColor);
return (jsonData['status']);

View File

@@ -14,19 +14,24 @@ class MyTranslation extends Translations {
"orange": "برتقالي",
"pink": "وردي",
"brown": "بني",
"gray": "رمادي", "Eggplant": "باذنجان",
"Dark Red": "نبيتي",
"Sky Blue": "ازرق سماوي",
"Mocha": "موكا",
"gray": "رمادي",
"cyan": "سماوي",
"magenta": "أرجواني داكن",
"magenta": "بنفسجي",
"lime": "ليموني",
"indigo": "نيلي",
"violet": "بنفسجي",
"raw gray": "رمادي ",
"gold": "ذهبي",
"silver": "فضي",
"teal": "تركوازي",
"navy": "كحلي",
"Eggplant": "باذنجان",
"Dark Red": "نبيتي",
"Sky Blue": "أزرق سماوي",
"Mocha": "موكا",
"Champagne": "شامبان",
"Bronze": "برونزي",
"Maroon": "ماروني",
"Capture an Image of Your Criminal Record":
"التقط صورة لسجلك الجنائي",
"IssueDate": "تاريخ الإصدار",

View File

@@ -2,32 +2,40 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:service/constant/api_key.dart';
import 'package:service/constant/box_name.dart';
import 'package:service/constant/links.dart';
import 'package:service/controller/functions/crud.dart';
import 'package:service/main.dart';
import '../views/home/main.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class LoginController extends GetxController {
var email = TextEditingController();
var password = TextEditingController();
final formKey = GlobalKey<FormState>();
// Use FlutterSecureStorage instead of GetStorage
final FlutterSecureStorage storage = const FlutterSecureStorage();
void login() async {
if (box.read(BoxName.email) == AK.emailService) {
Get.off(Main());
String? storedEmail = await storage.read(key: 'email');
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,
});
if (res != 'failure') {
var d = jsonDecode(res);
if (d['message'] == "Login successful") {
box.write(BoxName.email, email.text);
// Save data securely in FlutterSecureStorage
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']);
Get.off(() => Main());
}

View File

@@ -202,6 +202,91 @@ class MainController extends GetxController {
}
}
List driverWithoutCar = [];
getdriverWithoutCar() async {
var res = await CRUD().get(link: AppLink.getdriverWithoutCar, payload: {});
if (res != 'failure') {
var d = jsonDecode(res)['message'];
driverWithoutCar = d;
update();
} else {
MyDialog().getDialog('No Car found yet'.tr, 'thanks'.tr, const SizedBox(),
() {
Get.back();
});
}
}
Future<void> addRegistrationCarEgyptHandling({
required String driverId,
required String carPlate,
required String color,
required String colorHex,
required String year,
required String make,
required String model,
required String expirationDate,
required String owner,
}) async {
try {
isLoading = true;
update();
var payload = {
'driverID': driverId,
'vin': 'vin',
'car_plate': carPlate,
'make': make,
'model': model,
'year': year,
'expiration_date': expirationDate,
'color': color,
'owner': owner,
'color_hex': colorHex,
'address': 'addressCar',
'displacement': 'displacement',
'fuel': 'fuel',
'registration_date': '2024-09-06',
};
Log.print('Payload: $payload');
var res =
await CRUD().post(link: AppLink.addCartoDriver, payload: payload);
isLoading = false;
update();
var status = jsonDecode(res);
Log.print('res: $res');
Log.print('status: $status');
if (status['status'] == 'success') {
await Future.wait([
CRUD().post(
link:
'${AppLink.seferAlexandriaServer}/ride/RegisrationCar/add.php',
payload: payload),
CRUD().post(
link: '${AppLink.seferGizaServer}/ride/RegisrationCar/add.php',
payload: payload),
]);
Get.snackbar('Success', 'Registration successful',
backgroundColor: AppColor.greenColor);
Get.back();
} else {
Log.print('Error: Unexpected status: ${status['status']}');
Get.snackbar('Error', 'Registration failed',
backgroundColor: Colors.red);
}
} catch (e) {
Log.print('Error: $e');
Get.snackbar('Error', 'An error occurred during registration',
backgroundColor: Colors.red);
}
}
editCarPlateNotEdit(
String driverId,
String carPlate,
@@ -226,13 +311,14 @@ class MainController extends GetxController {
});
Log.print('res: ${res}');
if (res != 'failure') {
Get.snackbar(res, '', backgroundColor: AppColor.greenColor);
// Get.snackbar(res, '', backgroundColor: AppColor.greenColor);
Get.back();
carplateController.clear();
yearController.clear();
makeController.clear();
modelController.clear();
ownerController.clear();
Get.back();
await getCarPlateNotEdit();
update();
} else {

View File

@@ -0,0 +1,318 @@
import 'package:flutter/cupertino.dart';
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/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 '../main_controller.dart';
class AddCar extends StatelessWidget {
const AddCar({super.key});
@override
Widget build(BuildContext context) {
Get.put(MainController());
return GetBuilder<MainController>(builder: (mainController) {
return MyScaffold(
title: 'Edit car details'.tr,
isleading: true,
body: [
Expanded(
child: ListView.builder(
padding: const EdgeInsets.all(16.0),
itemCount: mainController
.driverWithoutCar.length, // 10 fields + 1 save button
itemBuilder: (context, index) {
var carData = mainController.driverWithoutCar[index];
return Padding(
padding: const EdgeInsets.all(8.0),
child: InkWell(
onTap: () {
Get.to(AddCarForm(carData: carData));
},
child: Container(
decoration: AppStyle.boxDecoration1,
child: Text(carData['name_arabic'])),
),
);
}),
),
],
);
});
}
}
class AddCarForm extends StatelessWidget {
final Map carData;
const AddCarForm({super.key, required this.carData});
@override
Widget build(BuildContext context) {
Get.put(MainController());
return GetBuilder<MainController>(builder: (mainController) {
return MyScaffold(title: 'Add Car', isleading: true, body: [
ListView(
children: [
Column(
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,
);
}
},
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'},
{'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 [
{'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;
}
},
),
),
],
),
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,
),
),
],
),
],
),
)
],
)
]);
});
}
}

View File

@@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
@@ -21,16 +22,36 @@ class EditCar extends StatelessWidget {
Column(
children: [
Image.network(
'https://api.sefer.live/sefer/card_image/car_front-${carData['driverID']}.jpg',
'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://api.sefer.live/sefer/card_image/car_back-${carData['driverID']}.jpg',
'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,
);
},
),
],
),
@@ -198,33 +219,55 @@ class EditCar extends StatelessWidget {
children: [
SizedBox(
width: Get.width * .4,
child: 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 = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate:
DateTime(2000), // Set the starting date
lastDate: DateTime(2101), // Set the ending date
);
if (pickedDate != null) {
String formattedDate =
DateFormat('yyyy-MM-dd').format(pickedDate);
mainController.expirationDateController.text =
formattedDate.toString();
}
},
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(

View File

@@ -451,6 +451,7 @@ class RegisterCaptainController extends GetxController {
Future<void> addDriverEgypt() async {
isLoading = true;
update();
var added = await storage.read(key: 'name');
var payload = {
'first_name': responseIdEgyptDriverLicense['firstName']?.toString() ??
@@ -495,8 +496,7 @@ class RegisterCaptainController extends GetxController {
'status': 'yet',
'birthdate': extractDOB(
responseIdEgyptDriverLicense['national_number'].toString()),
'maritalStatus':
responseIdEgyptBack['maritalStatus']?.toString() ?? 'Not specified',
'maritalStatus': added.toString(),
'site': responseIdEgyptDriverLicense['address']?.toString() ??
'Not specified',
'employmentType':
@@ -510,6 +510,14 @@ class RegisterCaptainController extends GetxController {
// Handle response
if (status1['status'] == 'success') {
isDriverSaved = true;
var res = CRUD().post(
link: '${AppLink.seferGizaServer}/auth/captin/register.php',
payload: payload);
Log.print('res: ${res}');
var res1 = CRUD().post(
link: '${AppLink.seferAlexandriaServer}/auth/captin/register.php',
payload: payload);
Log.print('res: ${res1}');
Get.snackbar('Success', 'Driver data saved successfully',
backgroundColor: AppColor.greenColor);
} else {
@@ -521,7 +529,7 @@ class RegisterCaptainController extends GetxController {
Future<void> addDriverEgyptHanding() async {
isLoading = true;
update();
var added = await storage.read(key: 'name');
var payload = {
'first_name': firstName.value.isNotEmpty
? firstName.value
@@ -581,9 +589,7 @@ class RegisterCaptainController extends GetxController {
? extractDOB(responseIdEgyptBack['nationalID'])
: extractDOB(
responseIdEgyptDriverLicense['national_number'].toString()),
'maritalStatus': maritalStatus.value.isNotEmpty
? maritalStatus.value
: responseIdEgyptBack['maritalStatus'],
'maritalStatus': added.toString(),
'site': site.value.isNotEmpty
? site.value
: responseIdEgyptDriverLicense['address'],
@@ -600,6 +606,12 @@ class RegisterCaptainController extends GetxController {
// Handle response
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);
Get.snackbar('Success', 'Driver data saved successfully',
backgroundColor: AppColor.greenColor);
} else {
@@ -616,6 +628,22 @@ class RegisterCaptainController extends GetxController {
});
if (res != 'failure') {
Get.snackbar('uploaded sucssefuly'.tr, '');
CRUD().post(
link:
'${AppLink.seferAlexandriaServer}/auth/captin/addCriminalDocuments.php',
payload: {
"driverId": box.read(BoxName.driverID),
"IssueDate": responseCriminalRecordEgypt['IssueDate'],
"InspectionResult": responseCriminalRecordEgypt['InspectionResult'],
});
CRUD().post(
link:
'${AppLink.seferGizaServer}/auth/captin/addCriminalDocuments.php',
payload: {
"driverId": box.read(BoxName.driverID),
"IssueDate": responseCriminalRecordEgypt['IssueDate'],
"InspectionResult": responseCriminalRecordEgypt['InspectionResult'],
});
}
}
@@ -686,6 +714,54 @@ class RegisterCaptainController extends GetxController {
var status = jsonDecode(res);
if (status['status'] == 'success') {
isCarSaved = true;
CRUD().post(
link:
'${AppLink.seferAlexandriaServer}/ride/RegisrationCar/add.php',
payload: {
'driverID': driverId,
'vin': responseIdCardDriverEgyptBack['chassis'].toString(),
'car_plate':
responseIdCardDriverEgyptFront['car_plate'].toString(),
'make': responseIdCardDriverEgyptBack['make'].toString(),
'model': responseIdCardDriverEgyptBack['model'],
'year': responseIdCardDriverEgyptBack['year'].toString(),
'expiration_date':
responseIdCardDriverEgyptFront['LicenseExpirationDate']
.toString(),
'color': responseIdCardDriverEgyptBack['color'],
'owner': responseIdCardDriverEgyptFront['owner'],
'color_hex':
responseIdCardDriverEgyptBack['color_hex'].toString(),
'address': responseIdCardDriverEgyptFront['address'].toString(),
'displacement':
responseIdCardDriverEgyptBack['engine'].toString(),
'fuel': responseIdCardDriverEgyptBack['fuel'].toString(),
'registration_date': '$inspectionDateTime',
});
CRUD().post(
link: '${AppLink.seferGizaServer}/ride/RegisrationCar/add.php',
payload: {
'driverID': driverId,
'vin': responseIdCardDriverEgyptBack['chassis'].toString(),
'car_plate':
responseIdCardDriverEgyptFront['car_plate'].toString(),
'make': responseIdCardDriverEgyptBack['make'].toString(),
'model': responseIdCardDriverEgyptBack['model'],
'year': responseIdCardDriverEgyptBack['year'].toString(),
'expiration_date':
responseIdCardDriverEgyptFront['LicenseExpirationDate']
.toString(),
'color': responseIdCardDriverEgyptBack['color'],
'owner': responseIdCardDriverEgyptFront['owner'],
'color_hex':
responseIdCardDriverEgyptBack['color_hex'].toString(),
'address': responseIdCardDriverEgyptFront['address'].toString(),
'displacement':
responseIdCardDriverEgyptBack['engine'].toString(),
'fuel': responseIdCardDriverEgyptBack['fuel'].toString(),
'registration_date': '$inspectionDateTime',
});
Get.snackbar('Success', 'message',
backgroundColor: AppColor.greenColor);
}
@@ -758,6 +834,14 @@ class RegisterCaptainController extends GetxController {
if (status['status'] == 'success') {
isCarSaved = true;
CRUD().post(
link:
'${AppLink.seferAlexandriaServer}/ride/RegisrationCar/add.php',
payload: payload);
CRUD().post(
link: '${AppLink.seferGizaServer}/ride/RegisrationCar/add.php',
payload: payload);
Get.snackbar('Success', 'Registration successful',
backgroundColor: AppColor.greenColor);
Get.back();
@@ -775,30 +859,31 @@ class RegisterCaptainController extends GetxController {
String getColorHex(String colorName) {
Map<String, String> colorMap = {
'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',
'maroon'.tr: '#800000', // Nabeeti
'red'.tr: '#FF0000',
'gray'.tr: '#808080',
'cyan'.tr: '#00FFFF',
'magenta'.tr: '#FF00FF',
'lime'.tr: '#00FF00',
'indigo'.tr: '#4B0082',
'violet'.tr: '#EE82EE',
'gold'.tr: '#FFD700',
'green'.tr: '#008000',
'navy blue'.tr: '#000080',
'pink'.tr: '#FFC0CB',
'black'.tr: '#000000',
'dark blue'.tr: '#003366',
'turquoise'.tr: '#40E0D0',
'blue'.tr: '#0000FF',
'red ochre'.tr: '#C72C48',
'silver'.tr: '#C0C0C0',
'teal'.tr: '#008080',
'navy'.tr: '#000080',
'Eggplant'.tr: '#800000', // Eggplant
'Dark Red'.tr: '#8B0000', // Dark Red (Maroon)
'Sky Blue'.tr: '#87CEEB', // Sky Blue
'Mocha'.tr: '#C3B091', // Mocha
'mocha'.tr: '#3B2E2A',
'tawny'.tr: '#D2B48C',
'gold'.tr: '#FFD700',
'verdi'.tr: '#008000',
'orange'.tr: '#FFA500',
'peach'.tr: '#FFDAB9',
'brown'.tr: '#A52A2A',
'raw gray'.tr: '#6C6E6E',
'champagne'.tr: '#F7E7CE', // Champagne
'bronze'.tr: '#CD7F32', // Bronze
'red'.tr: '#FF0000', // Red
'maroon'.tr: '#800000' // Maroon
};
return colorMap[colorName.toLowerCase()] ??
@@ -879,15 +964,16 @@ class RegisterCaptainController extends GetxController {
final response = await http.post(
Uri.parse('https://api.anthropic.com/v1/messages'),
headers: {
'x-api-key': AK.anthropicAIkeySeferNew,
'x-api-key': AK.anthropicAIkeySeferNewHamzaayedpython,
'anthropic-version': '2023-06-01',
'content-type': 'application/json'
},
body: requestBody,
);
Log.print('responseData: ${response.body}');
if (response.statusCode == 200) {
var responseData = jsonDecode(utf8.decode(response.bodyBytes));
Log.print('responseData: ${responseData}');
// Process the responseData as needed
if (idType == 'car_back') {
responseIdCardDriverEgyptBack =

17
lib/env/env.dart vendored
View File

@@ -19,9 +19,26 @@ abstract class Env {
@EnviedField(varName: 'serverPHP', obfuscate: true)
static final String serverPHP = _Env.serverPHP;
@EnviedField(varName: 'seferAlexandriaServer', obfuscate: true)
static final String seferAlexandriaServer = _Env.seferAlexandriaServer;
@EnviedField(varName: 'seferPaymentServer', obfuscate: true)
static final String seferPaymentServer = _Env.seferPaymentServer;
@EnviedField(varName: 'seferCairoServer', obfuscate: true)
static final String seferCairoServer = _Env.seferCairoServer;
@EnviedField(varName: 'seferGizaServer', obfuscate: true)
static final String seferGizaServer = _Env.seferGizaServer;
@EnviedField(varName: 'anthropicAIkeySeferNew', obfuscate: true)
static final String anthropicAIkeySeferNew = _Env.anthropicAIkeySeferNew;
@EnviedField(
varName: 'anthropicAIkeySeferNewHamzaayedpython', obfuscate: true)
static final String anthropicAIkeySeferNewHamzaayedpython =
_Env.anthropicAIkeySeferNewHamzaayedpython;
@EnviedField(varName: 'A', obfuscate: true)
static final String A = _Env.A;

2025
lib/env/env.g.dart vendored

File diff suppressed because it is too large Load Diff

View File

@@ -19,25 +19,25 @@ const storage = FlutterSecureStorage();
void main() async {
WidgetsFlutterBinding.ensureInitialized();
if (Platform.isAndroid || Platform.isIOS) {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
await FirebaseMessagesController().requestFirebaseMessagingPermission();
// if (Platform.isAndroid || Platform.isIOS) {
// await Firebase.initializeApp(
// options: DefaultFirebaseOptions.currentPlatform,
// );
// await FirebaseMessagesController().requestFirebaseMessagingPermission();
// FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
// // FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
List<Future> initializationTasks = [
FirebaseMessagesController().getNotificationSettings(),
FirebaseMessagesController().getToken(),
];
// cameras = await availableCameras();
await Future.wait(initializationTasks);
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
}
// List<Future> initializationTasks = [
// FirebaseMessagesController().getNotificationSettings(),
// FirebaseMessagesController().getToken(),
// ];
// // cameras = await availableCameras();
// await Future.wait(initializationTasks);
// SystemChrome.setPreferredOrientations([
// DeviceOrientation.portraitUp,
// DeviceOrientation.portraitDown,
// ]);
// }
runApp(MyApp());
}

115
lib/models/cloudpanel.md Normal file
View File

@@ -0,0 +1,115 @@
## Site
IP Address: 92.113.25.174
Domain Name: https://sefer.click
Site User: sefer
Password: katm5g2LLY55a7SJcnxK
## Database
Host: 127.0.0.1
Port: 3306
Database Name: sefer
Database User Name: sefer
Database User Password: la7CdYFwa9uxwnozk7ok
## WordPress
Admin E-Mail: admin@sefer.click
Admin User Name: admin
Admin Password: F12WeBpJLY4z1qHsFqMt
Admin Url: https://sefer.click/wp-admin/
ssh password is malDEV@2101mehmet
giza hostinger kvm2 pass gizaDEV@2101
contabo cloud panel new
Site
---
IP Address: 100.42.191.131
Domain Name: https://seferalexandria.site
Site User: seferalexandria
Password: x91LgGr2Q8IervoVgcgc
## Database
Host: 127.0.0.1
Port: 3306
Database Name: seferalexandria
Database User Name: seferalexandria
Database User Password: 812UvStGfCfNLMCsRR9a
## WordPress
Admin E-Mail: admin@seferalexandria.site
Admin User Name: admin
Admin Password: N9gv90TdnoOdjVch5V3J
Admin Url: https://seferalexandria.site/wp-admin/
##### alexandria
86IU5xU2HSiNNSAU5cwF username db ==>> alexandriadbUsername vps 2 100.42.191.131
- JCndq5xXLnoYOTuRqnZA for ssh alexandria ssh user
seferalexandria userAdmin cloudPanel 49prvH5MGGupjWrDPLGm
# cloudpanel username is sefercairo and pass is malDEV@2101
#####
oMnEK3IbvCbQ5G5FfK9W username db ==>> seferdbUsername vps 3 185.209.230.169 # db name is sefercairodb
H6JIiEOpyDVoMBBi5cCH sefercairoadmin
Q6MikBy4ktZn9zumyPli sefercairo ssh user 85.209.230.169
# cloudpanel username is sefercairo and pass is malDEV@2101
##### wallet
qG6Bn1P9IRvwk0tLW85v username db ==>> walletdbUsername vps 2 156.67.82.188 # db name is seferPaymentDB
- JCndq5xXLnoYOTuRqnZA for ssh wallet ssh user
seferwallet userAdmin cloudPanel 49prvH5MGGupjWrDPLGm
# cloudpanel username is seferpayment and pass is dKsmZkbdWP9hj13qjNiY and seferpayment@sefer.live
#####
##### giza
TE6VUrMcjnIsipqP9yQj username db ==>> gizaUsername vps 1 31.220.94.107 db name is sefergizaDB
- rylDg624ifiDXsWmaMST for ssh sefergizacp ssh user
# cloudpanel username is sefergiza and pass is 4O2IUSbwZxVnMJYaRTog gizasefer.online
####
#AaPOFHEwHVyXG6AgZ7i password test kvm1
4zB9qoYfxCn7uHx7i5cgUl7JR password contabo vps 3 alexandria
SLqWj2QTD66Gr password contabo vps 1 payment
uREd8QKKzpHXGL25UVi3quK password contabo vps 2 cairo sefer.click user cloud panel is
uREd8QKKzpHXGL25UVi3quK password contabo vps 1 payment seferpw.website user cloud panel is seferpayment
C3vGlIV7VM0priWXgdzc password contabo vps 2 giza seferpw.website user cloud panel is seferpayment
==================================================================
Congratulations! Installed successfully!
==================================================================
webmin Internal Address: https://31.220.94.106:10000/
username: seferpayment
password: d7b064c3
Warning:
If you cannot access the panel,
release the following port (32368|888|80|443|20|21) in the security group
Database user profile
User:
Password: 38d7a66a0e435
==================================================================

66
lib/models/sql Normal file
View File

@@ -0,0 +1,66 @@
-- to check duplicate CarRegistration
SELECT
`driverID`,
COUNT(*) AS `count`,created_at
FROM
`CarRegistration`
GROUP BY
`driverID`
HAVING
COUNT(*) > 1;
--
-- to delete duplicate
WITH CTE AS (
SELECT
MIN(`id`) AS `min_id`
FROM
`CarRegistration`
GROUP BY
`driverID`
)
DELETE FROM
`CarRegistration`
WHERE
`id` NOT IN (SELECT `min_id` FROM CTE);
-- get for employee
SELECT
d.`maritalStatus` AS NAME,
COUNT(*) AS `count`
FROM
`driver` d
WHERE
d.`maritalStatus` IN('Maryam', 'Salma', 'Mena') AND DATE(d.created_at) = CURDATE()
GROUP BY
d.`maritalStatus`
ORDER BY
COUNT
DESC
-- get driver without cars
SELECT
d.id, d.phone
FROM
`driver` d
WHERE
d.id NOT IN (SELECT driverID FROM CarRegistration);
-- car without drivers
SELECT
cr.created_at, cr.driverID
FROM
`CarRegistration` cr
WHERE
cr.driverID NOT IN (SELECT id FROM driver);
----- driver
SELECT phone,email,name_arabic,national_number FROM `driver` WHERE national_number ='29209290106392'
ORDER BY `driver`.`created_at` DESC

View File

@@ -8,6 +8,7 @@ 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/drivers_cant_register.dart';
import '../../controller/mainController/pages/welcome_call.dart';
import '../widgets/my_scafold.dart';
@@ -134,11 +135,30 @@ class Main extends StatelessWidget {
const SizedBox(
height: 20,
),
InkWell(
onTap: () async {
await mainController.getdriverWithoutCar();
if (mainController.driverWithoutCar.isNotEmpty) {
Get.to(() => const AddCar());
}
},
child: Container(
decoration: AppStyle.boxDecoration,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Add car'.tr,
style: AppStyle.title,
textAlign: TextAlign.center,
),
),
),
),
InkWell(
onTap: () async {
await mainController.getCarPlateNotEdit();
if (mainController.carPlateNotEdit.isNotEmpty) {
Get.to(() => EditCarPlate());
Get.to(() => const EditCarPlate());
}
},
child: Container(
@@ -160,7 +180,7 @@ class Main extends StatelessWidget {
onTap: () async {
// await mainController.getCarPlateNotEdit();
// if (mainController.carPlateNotEdit.isNotEmpty) {
Get.to(() => Complaint());
Get.to(() => const Complaint());
// }
},
child: Container(