9/14/2
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user