Files
intaleq_admin/lib/controller/drivers/driver_not_active_controller.dart
2026-01-20 23:39:59 +03:00

38 lines
1.0 KiB
Dart

import 'package:get/get.dart';
import '../../constant/links.dart';
import '../functions/crud.dart';
class DriverController extends GetxController {
List drivers = [];
Map driverDetails = {};
// جلب السائقين pending
getDriversPending() async {
var res = await CRUD().post(
link: AppLink.getDriversPending, // رابط drivers_pending_list.php
payload: {},
);
if (res != 'failure') {
drivers = (res)['message'];
update(['drivers']); // تحديث الـ UI
} else {
Get.snackbar('Error', 'Failed to load drivers');
}
}
// جلب تفاصيل سائق واحد
getDriverDetails(String driverId) async {
var res = await CRUD().post(
link: AppLink.getDriverDetails, // رابط driver_details.php
payload: {"id": driverId},
);
if (res != 'failure') {
driverDetails = (res)['message'];
update(['driverDetails']); // تحديث صفحة التفاصيل
} else {
Get.snackbar('Error', 'Failed to load driver details');
}
}
}