Initial commit for Tripz Admin

This commit is contained in:
Hamza-Ayed
2026-01-21 17:31:10 +03:00
parent 5919554eaa
commit 1da2357124
31 changed files with 1812 additions and 980 deletions

View File

@@ -20,6 +20,7 @@ import '../../controller/functions/gemeni.dart';
import '../../print.dart';
import '../widgets/my_scafold.dart';
import 'captain/captain.dart';
import 'dashboard_widget.dart';
import 'drivers/driver_the_best.dart';
import 'packages.dart';
import 'passenger/passenger.dart';
@@ -29,432 +30,352 @@ import 'wallet/wallet.dart';
class AdminHomePage extends StatelessWidget {
const AdminHomePage({super.key});
int _calculateCrossAxisCount(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
if (screenWidth > 1200) {
// Large desktops
return 5;
} else if (screenWidth > 900) {
// Desktops / Large Tablets
return 4;
} else if (screenWidth > 600) {
// Tablets
return 3;
} else {
// Phones
return 2;
}
}
// Helper to format currency (assuming '₵' is your currency symbol)
String _formatCurrency(dynamic value) {
final number = double.tryParse(value.toString());
if (number != null) {
return '${number.toStringAsFixed(2)}';
}
return value.toString(); // Fallback to original string if not a number
}
@override
Widget build(BuildContext context) {
Get.put(DashboardController());
return MyScafolld(
title: 'Admin Home Page',
action: IconButton(
onPressed: () async {
await Get.find<DashboardController>().getDashBoard();
},
icon: const Icon(
Icons.refresh,
color: AppColor.greenColor,
),
title: 'Admin Home Page',
action: IconButton(
onPressed: () async {
await Get.find<DashboardController>().getDashBoard();
},
icon: const Icon(
Icons.refresh,
color: AppColor.greenColor,
),
body: [
GetBuilder<DashboardController>(builder: (dashboardController) {
return dashboardController.dashbord.isEmpty
? const MyCircularProgressIndicator()
: Padding(
padding: const EdgeInsets.all(8.0),
child: ListView(
// crossAxisAlignment: WrapCrossAlignment.center,
// alignment: WrapAlignment.center,
children: [
Container(
width: Get.width,
height: Get.height * .6,
decoration: AppStyle.boxDecoration1,
child: Wrap(
spacing: 6,
alignment: WrapAlignment.spaceBetween,
runAlignment: WrapAlignment.spaceBetween,
children: [
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'Sms',
style: AppStyle.title,
),
Text(dashboardController.creditSMS
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'Passengers',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['countPassengers']
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'Drivers',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['countDriver']
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'Rides this month',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['countRideThisMonth']
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'avg costs',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['avg_passenger_price']
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'completed ride',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['completed_rides']
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'cancelled ride',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['cancelled_rides']
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'payments to driver',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['payments']
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'sefer wallet',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['seferWallet']
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'count of transfer',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['transfer_from_count']
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'Morning',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['morning_ride_count']
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'evening',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['evening_ride_count']
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'night',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['night_ride_count']
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'comfort',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['comfort']
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'Speed',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['speed']
.toString()),
],
),
)),
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'Lady',
style: AppStyle.title,
),
Text(dashboardController.dashbord[0]
['lady']
.toString()),
],
),
)),
],
)),
AdminWidgetsDashBoard(
title: 'Passengers',
onPressed: () => Get.to(() => Passengrs(),
transition: Transition.topLevel)),
AdminWidgetsDashBoard(
title: 'Captains',
onPressed: () => Get.to(() => Captain(),
transition: Transition.size)),
AdminWidgetsDashBoard(
title: 'Wallet',
onPressed: () => Get.to(() => Wallet(),
transition: Transition.fade)),
AdminWidgetsDashBoard(
title: 'Rides',
onPressed: () => Get.to(() => Rides(),
transition: Transition.downToUp)),
AdminWidgetsDashBoard(
title: 'Static',
onPressed: () async {
await Get.put(StaticController()).getAll();
),
body: [
// This is a List<Widget> for MyScafolld
GetBuilder<DashboardController>(builder: (dashboardController) {
return dashboardController.dashbord.isEmpty
? const MyCircularProgressIndicator()
: Padding(
// This Padding wraps the entire content for this section
padding: const EdgeInsets.all(8.0),
child: ListView(
// Changed from a direct ListView for the whole page
// to a ListView that contains the stats grid and then other items.
children: [
// --- Statistics Grid Section ---
Container(
// width: Get.width, // Not needed in ListView
// height: Get.height * .6, // Let GridView determine its height
padding: const EdgeInsets.all(
8.0), // Padding for the grid container
decoration: AppStyle.boxDecoration1.copyWith(
// Optional: slightly different background for the grid area
// color: (AppStyle.boxDecoration1.color as Color?)?.withAlpha(200) ?? Theme.of(context).cardColor.withAlpha(200),
boxShadow: [] // Remove shadow if cards have them, or use a very subtle one
),
child: GridView.count(
crossAxisCount: _calculateCrossAxisCount(context),
shrinkWrap: true,
physics:
const NeverScrollableScrollPhysics(), // Grid shouldn't scroll independently
mainAxisSpacing: 10.0,
crossAxisSpacing: 10.0,
childAspectRatio:
1.7, // Adjust for desired card W/H ratio (e.g. 1.5 to 2.0)
children: [
DashboardStatCard(
title: 'SMS Credits',
value: dashboardController.creditSMS.toString(),
icon: Icons.sms_outlined,
iconColor: Colors.lightBlueAccent,
),
DashboardStatCard(
title: 'Passengers',
value: dashboardController.dashbord[0]
['countPassengers']
.toString(),
icon: Icons.people_alt_outlined,
iconColor: Colors.teal,
),
DashboardStatCard(
title: 'Drivers',
value: dashboardController.dashbord[0]
['countDriver']
.toString(),
icon: Icons.sports_motorsports_outlined,
iconColor: Colors.orangeAccent,
),
DashboardStatCard(
title: 'Rides (Month)',
value: dashboardController.dashbord[0]
['countRideThisMonth']
.toString(),
icon: Icons.calendar_month_outlined,
iconColor: Colors.purpleAccent,
),
DashboardStatCard(
title: 'Avg. Ride Cost',
value: _formatCurrency(dashboardController
.dashbord[0]['avg_passenger_price']),
icon: Icons.monetization_on_outlined,
iconColor: Colors.green,
valueColor: Colors.green.shade700,
),
DashboardStatCard(
title: 'Completed Rides',
value: dashboardController.dashbord[0]
['completed_rides']
.toString(),
icon: Icons.check_circle_outline,
iconColor: AppColor.greenColor,
),
DashboardStatCard(
title: 'Cancelled Rides',
value: dashboardController.dashbord[0]
['cancelled_rides']
.toString(),
icon: Icons.cancel_outlined,
iconColor: AppColor.redColor,
),
DashboardStatCard(
title: 'Driver Payments',
value: _formatCurrency(
dashboardController.dashbord[0]['payments']),
icon: Icons.payments_outlined,
iconColor: Colors.indigoAccent,
valueColor: Colors.indigo.shade700,
),
DashboardStatCard(
title: 'Tripz Wallet',
value: _formatCurrency(dashboardController
.dashbord[0]['seferWallet']),
icon: Icons.account_balance_wallet_outlined,
iconColor: Colors.deepOrangeAccent,
valueColor: Colors.deepOrange.shade700,
),
DashboardStatCard(
title: 'Transfers Count',
value: dashboardController.dashbord[0]
['transfer_from_count']
.toString(),
icon: Icons.swap_horiz_outlined,
iconColor: Colors.brown,
),
DashboardStatCard(
title: 'Morning Rides',
value: dashboardController.dashbord[0]
['morning_ride_count']
.toString(),
icon: Icons.wb_sunny_outlined,
iconColor: Colors.amberAccent,
),
DashboardStatCard(
title: 'Evening Rides',
value: dashboardController.dashbord[0]
['evening_ride_count']
.toString(),
icon: Icons.brightness_4_outlined,
iconColor: Colors.blueGrey,
),
DashboardStatCard(
title: 'Night Rides',
value: dashboardController.dashbord[0]
['night_ride_count']
.toString(),
icon: Icons.nightlight_round_outlined,
iconColor: Colors.black54,
),
DashboardStatCard(
title: 'Comfort Type',
value: dashboardController.dashbord[0]['comfort']
.toString(),
icon: Icons.event_seat_outlined,
iconColor: Colors.cyan,
),
DashboardStatCard(
title: 'Speed Type',
value: dashboardController.dashbord[0]['speed']
.toString(),
icon: Icons.speed_outlined,
iconColor: Colors.red,
),
DashboardStatCard(
title: 'Lady Type',
value: dashboardController.dashbord[0]['lady']
.toString(),
icon: Icons.woman_2_outlined,
iconColor: Colors.pinkAccent,
),
],
),
),
// --- End of Statistics Grid Section ---
Get.to(() => const StaticDash());
},
),
AdminWidgetsDashBoard(
title: 'send Whatsapp to Drivers',
onPressed: () async {
Get.defaultDialog(
title: 'Are you sure to send by WhatsApp ?',
middleText: '',
confirm: MyElevatedButton(
title: 'Ok',
kolor: AppColor.greenColor,
onPressed: () async {
Log.print(
'CRUD().phoneDriversTest.: ${CRUD().phoneDriversTest}');
for (var phoneNumber
in CRUD().phoneDrivers) {
await CRUD().sendWhatsAppAuth(
phoneNumber.toString());
}
}),
cancel: MyElevatedButton(
title: 'cancel',
kolor: AppColor.redColor,
onPressed: () => Get.back()));
}),
AdminWidgetsDashBoard(
title: 'send notification Drivers',
onPressed: () async {
await Get.put(NotificationController())
.getTokensDrivers();
}),
AdminWidgetsDashBoard(
title: 'send SMS Drivers',
onPressed: () async {
Get.defaultDialog(
title: 'Are you sure to send SMS ?',
middleText: '',
content: Padding(
padding: const EdgeInsets.all(8.0),
child: Form(
key: dashboardController.formKey,
child: MyTextForm(
controller:
dashboardController.smsText,
label: 'label',
hint: 'hint',
type: TextInputType.name)),
),
confirm: MyElevatedButton(
title: 'Ok',
kolor: AppColor.greenColor,
onPressed: () async {
dashboardController.sendSMSMethod();
}),
cancel: MyElevatedButton(
title: 'cancel',
kolor: AppColor.redColor,
onPressed: () => Get.back()));
}),
AdminWidgetsDashBoard(
title: 'send notification Passengers',
onPressed: () async {
await Get.put(NotificationController())
.getTokensPassengers();
}),
AdminWidgetsDashBoard(
title: 'register captain'.tr,
// --- Your AdminWidgetsDashBoard items follow ---
AdminWidgetsDashBoard(
title: 'Passengers',
icon: Icons.people_outline,
onPressed: () => Get.to(() => Passengrs(),
transition: Transition.topLevel)),
AdminWidgetsDashBoard(
title: 'Captains',
icon: Icons.sports_motorsports_outlined,
onPressed: () => Get.to(() => Captain(),
transition: Transition.size)),
// ... (Add all your other AdminWidgetsDashBoard items here with icons)
AdminWidgetsDashBoard(
title: 'Wallet',
icon: Icons.account_balance_wallet_outlined,
onPressed: () => Get.to(() => Wallet(),
transition: Transition.fade)),
AdminWidgetsDashBoard(
title: 'Rides',
icon: Icons.directions_car_filled_outlined,
onPressed: () => Get.to(() => Rides(),
transition: Transition.downToUp)),
AdminWidgetsDashBoard(
title: 'Static',
icon: Icons.bar_chart_outlined,
onPressed: () async {
await Get.put(StaticController()).getAll();
Get.to(() => const StaticDash());
},
),
AdminWidgetsDashBoard(
title: 'send Whatsapp to Drivers',
icon: Icons.message_outlined,
iconColor: Colors.green,
onPressed: () async {
await Get.put(RegisterCaptainController())
.getDriverNotCompleteRegistration();
Get.to(() => const DriversCantRegister());
},
),
AdminWidgetsDashBoard(
title: 'update packages'.tr,
Get.defaultDialog(
title: 'Are you sure to send by WhatsApp ?',
middleText: '',
confirm: MyElevatedButton(
title: 'Ok',
kolor: AppColor.greenColor,
onPressed: () async {
Log.print(
'CRUD().phoneDriversTest.: ${CRUD().phoneDriversTest}');
for (var phoneNumber
in CRUD().phoneDrivers) {
await CRUD().sendWhatsAppAuth(
phoneNumber.toString());
}
}),
cancel: MyElevatedButton(
title: 'cancel',
kolor: AppColor.redColor,
onPressed: () => Get.back()));
}),
AdminWidgetsDashBoard(
title: 'send notification Drivers',
icon: Icons.notifications_active_outlined,
onPressed: () async {
Get.to(() => PackageUpdateScreen());
},
),
AdminWidgetsDashBoard(
title: 'Employee'.tr,
await Get.put(NotificationController())
.getTokensDrivers();
}),
AdminWidgetsDashBoard(
title: 'send SMS Drivers',
icon: Icons.sms_outlined,
onPressed: () async {
Get.to(() => EmployeePage());
},
),
AdminWidgetsDashBoard(
title: 'Drivers the best'.tr,
Get.defaultDialog(
title: 'Are you sure to send SMS ?',
middleText: '',
content: Padding(
padding: const EdgeInsets.all(8.0),
child: Form(
key: dashboardController.formKey,
child: MyTextForm(
controller:
dashboardController.smsText,
label: 'label',
hint: 'hint',
type: TextInputType.name)),
),
confirm: MyElevatedButton(
title: 'Ok',
kolor: AppColor.greenColor,
onPressed: () async {
dashboardController.sendSMSMethod();
}),
cancel: MyElevatedButton(
title: 'cancel',
kolor: AppColor.redColor,
onPressed: () => Get.back()));
}),
AdminWidgetsDashBoard(
title: 'send notification Passengers',
icon: Icons.notification_important_outlined,
onPressed: () async {
Get.to(() => DriverTheBest());
},
),
// AdminWidgetsDashBoard(
// title: 'Llama',
// onPressed: () =>
// CarRegistrationRecognizerController().scanText()),
AdminWidgetsDashBoard(
title: 'Add device to be Admin',
onPressed: () async {
// Map device = DeviceInfoPlus.deviceData;
await CRUD()
.post(link: AppLink.addAdminUser, payload: {
// 'deviceNumber': device['serialNumber'].toString(),
'name': 'b',
});
}),
],
),
);
})
],
isleading: false);
await Get.put(NotificationController())
.getTokensPassengers();
}),
AdminWidgetsDashBoard(
title: 'register captain'.tr,
icon: Icons.person_add_alt_1_outlined,
onPressed: () async {
await Get.put(RegisterCaptainController())
.getDriverNotCompleteRegistration();
Get.to(() => const DriversCantRegister());
},
),
AdminWidgetsDashBoard(
title: 'update packages'.tr,
icon: Icons.inventory_2_outlined,
onPressed: () async {
Get.to(() => PackageUpdateScreen());
},
),
AdminWidgetsDashBoard(
title: 'Employee'.tr,
icon: Icons.badge_outlined,
onPressed: () async {
Get.to(() => EmployeePage());
},
),
AdminWidgetsDashBoard(
title: 'Drivers the best'.tr,
icon: Icons.star_outline,
onPressed: () async {
Get.to(() => DriverTheBest());
},
),
AdminWidgetsDashBoard(
title: 'Add device to be Admin',
icon: Icons.admin_panel_settings_outlined,
onPressed: () async {
await CRUD()
.post(link: AppLink.addAdminUser, payload: {
'name': 'b',
});
}),
],
),
);
})
],
isleading: false,
);
}
}
@@ -463,25 +384,76 @@ class AdminWidgetsDashBoard extends StatelessWidget {
super.key,
required this.title,
required this.onPressed,
this.icon, // Optional icon
this.iconColor,
this.backgroundColor,
});
final String title;
final Callback onPressed;
final IconData? icon;
final Color? iconColor;
final Color? backgroundColor;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.symmetric(vertical: 6.0, horizontal: 12.0),
child: InkWell(
onTap: onPressed,
borderRadius:
BorderRadius.circular(12.0), // Rounded corners for tap effect
child: Container(
decoration: AppStyle.boxDecoration,
height: 50,
width: Get.width * .4,
child: Center(
child: Text(
title.tr,
style: AppStyle.title,
),
padding: const EdgeInsets.symmetric(
horizontal: 16.0, vertical: 16.0), // Increased padding
decoration: BoxDecoration(
color: backgroundColor ??
Theme.of(context).cardColor, // Use provided or theme card color
borderRadius: BorderRadius.circular(12.0),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.15),
spreadRadius: 1,
blurRadius: 8,
offset: const Offset(0, 2), // changes position of shadow
),
],
// If you want to use AppStyle.boxDecoration as a base and modify it:
// ...AppStyle.boxDecoration.copyWith(
// color: backgroundColor ?? AppStyle.boxDecoration.color,
// // Potentially override other properties of AppStyle.boxDecoration if needed
// ),
),
child: Row(
children: [
if (icon != null) ...[
Icon(
icon,
size: 28, // Slightly larger icon
color: iconColor ??
AppColor.primaryColor, // Use primary color or provided
),
const SizedBox(width: 16),
],
Expanded(
child: Text(
title.tr,
style: AppStyle.title.copyWith(
fontSize: 16, // Adjust font size for better readability
fontWeight: FontWeight.w500, // Medium weight
color: Theme.of(context)
.textTheme
.bodyLarge
?.color, // Use theme text color
),
),
),
const Icon(
Icons.arrow_forward_ios,
size: 18,
color: Colors.grey, // Subtle indicator for navigation
),
],
),
),
),

View File

@@ -4,6 +4,7 @@ import 'package:get/get.dart';
import '../../../constant/colors.dart';
import '../../../constant/style.dart';
import '../../../controller/admin/captain_admin_controller.dart';
import '../../../controller/functions/encrypt_decrypt.dart';
import '../../widgets/elevated_btn.dart';
import '../../widgets/my_scafold.dart';
import '../../widgets/my_textField.dart';
@@ -153,7 +154,7 @@ class Captain extends StatelessWidget {
.spaceBetween,
children: [
Text(
'Name : ${user['first_name']} ${user['last_name']}',
'Name : ${(user['first_name'])} ${(user['last_name'])}',
style: AppStyle.title,
),
Text(

View File

@@ -0,0 +1,94 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart'; // For Get.width if needed, and .tr
import 'package:sefer_admin1/constant/colors.dart'; // Assuming AppColor is here
import 'package:sefer_admin1/constant/style.dart'; // Assuming AppStyle is here
class DashboardStatCard extends StatelessWidget {
final String title;
final String value;
final IconData? icon;
final Color? iconColor;
final Color? backgroundColor;
final Color? valueColor;
const DashboardStatCard({
Key? key,
required this.title,
required this.value,
this.icon,
this.iconColor,
this.backgroundColor,
this.valueColor,
}) : super(key: key);
@override
Widget build(BuildContext context) {
// Attempt to use AppStyle.boxDecoration1 properties if it's a BoxDecoration
BoxDecoration? baseDecoration = AppStyle.boxDecoration1;
Color? finalBackgroundColor =
backgroundColor ?? baseDecoration?.color ?? Theme.of(context).cardColor;
BorderRadius? finalBorderRadius =
baseDecoration?.borderRadius?.resolve(Directionality.of(context)) ??
BorderRadius.circular(12.0);
return Container(
padding: const EdgeInsets.symmetric(horizontal: 14.0, vertical: 12.0),
decoration: BoxDecoration(
color: finalBackgroundColor,
borderRadius: finalBorderRadius,
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.1),
spreadRadius: 1,
blurRadius: 6,
offset: const Offset(0, 2),
),
],
// If AppStyle.boxDecoration1 includes a border, you might want to add it here too
// border: baseDecoration?.border,
),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center, // Center content vertically
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
child: Text(
title.tr,
style: AppStyle.title.copyWith(
fontSize: 13,
fontWeight: FontWeight.w500,
color: Theme.of(context).textTheme.bodySmall?.color,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
if (icon != null)
Icon(
icon,
size: 24,
color: iconColor ?? AppColor.primaryColor.withOpacity(0.7),
),
],
),
const SizedBox(height: 6),
Text(
value,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: valueColor ?? AppColor.primaryColor,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
);
}
}

View File

@@ -0,0 +1,69 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sefer_admin1/constant/links.dart';
import 'package:sefer_admin1/controller/functions/crud.dart';
import 'package:sefer_admin1/controller/functions/wallet.dart';
import 'package:sefer_admin1/views/widgets/my_scafold.dart';
import '../../../controller/drivers/driverthebest.dart';
class DriverTheBestAlexandria extends StatelessWidget {
const DriverTheBestAlexandria({super.key});
@override
Widget build(BuildContext context) {
Get.put(DriverTheBestAlexandriaController(), permanent: true);
return MyScafolld(
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(
((driver['driver_count'] * 5) / 3600)
.toStringAsFixed(0),
),
),
title: Text(driver['name_arabic'] ?? 'Unknown Name'),
subtitle: Text('Phone: ${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());
await CRUD().post(
link: AppLink.deleteRecord,
payload: {
'driver_id': driver['id'].toString()
});
driverthebest.driver.removeAt(index);
driverthebest.update();
},
onCancel: () => Get.back());
},
icon: const Icon(Icons.wallet_giftcard_rounded),
),
);
},
)
: const Center(
child: Text('No drivers available.'),
);
})
],
isleading: true,
);
}
}

View File

@@ -1,54 +1,96 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sefer_admin1/constant/links.dart';
import 'package:sefer_admin1/controller/functions/crud.dart';
import 'package:sefer_admin1/controller/functions/encrypt_decrypt.dart';
import 'package:sefer_admin1/controller/functions/wallet.dart';
import 'package:sefer_admin1/views/admin/wallet/wallet.dart';
import 'package:sefer_admin1/views/widgets/elevated_btn.dart';
import 'package:sefer_admin1/views/widgets/my_scafold.dart';
import '../../../controller/drivers/driverthebest.dart';
import 'alexandria.dart';
import 'giza.dart';
class DriverTheBest extends StatelessWidget {
const DriverTheBest({super.key});
@override
Widget build(BuildContext context) {
Get.put(Driverthebest());
Get.put(Driverthebest(), permanent: true);
return MyScafolld(
title: 'Best Drivers'.tr,
body: [
GetBuilder<Driverthebest>(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(
((driver['driver_count'] * 5) / 3600)
.toStringAsFixed(0),
),
),
title: Text(driver['name_arabic'] ?? 'Unknown Name'),
subtitle: Text('Phone: ${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('200',
driver['id'].toString(), driver['token']);
await wallet.addSeferWallet(
'200', driver['id'].toString());
? Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
MyElevatedButton(
title: 'Giza',
onPressed: () {
Get.to(() => DriverTheBestGiza());
}),
MyElevatedButton(
title: 'Alexandria',
onPressed: () {
Get.to(() => DriverTheBestAlexandria());
}),
],
),
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), // Perform division first, then convert to string
),
),
title:
Text((driver['name_arabic']) ?? 'Unknown Name'),
subtitle:
Text('Phone: ${(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(
'200',
driver['id'].toString(),
driver['token']);
await wallet.addSeferWallet(
'200', driver['id'].toString());
await CRUD().post(
link: AppLink.deleteRecord,
payload: {
'driver_id': driver['id'].toString()
});
driverthebest.driver.removeAt(index);
driverthebest.update();
Get.back();
},
onCancel: () => Get.back());
},
onCancel: () => Get.back());
icon: const Icon(Icons.wallet_giftcard_rounded),
),
);
},
icon: const Icon(Icons.wallet_giftcard_rounded),
),
);
},
),
],
)
: const Center(
child: Text('No drivers available.'),

View File

@@ -0,0 +1,69 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sefer_admin1/constant/links.dart';
import 'package:sefer_admin1/controller/functions/crud.dart';
import 'package:sefer_admin1/controller/functions/wallet.dart';
import 'package:sefer_admin1/views/widgets/my_scafold.dart';
import '../../../controller/drivers/driverthebest.dart';
class DriverTheBestGiza extends StatelessWidget {
const DriverTheBestGiza({super.key});
@override
Widget build(BuildContext context) {
Get.put(DriverTheBestGizaController(), permanent: true);
return MyScafolld(
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(
((driver['driver_count'] * 5) / 3600)
.toStringAsFixed(0),
),
),
title: Text(driver['name_arabic'] ?? 'Unknown Name'),
subtitle: Text('Phone: ${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());
await CRUD().post(
link: AppLink.deleteRecord,
payload: {
'driver_id': driver['id'].toString()
});
driverthebest.driver.removeAt(index);
driverthebest.update();
},
onCancel: () => Get.back());
},
icon: const Icon(Icons.wallet_giftcard_rounded),
),
);
},
)
: const Center(
child: Text('No drivers available.'),
);
})
],
isleading: true,
);
}
}

View File

@@ -165,7 +165,8 @@ class EmployeeDetails extends StatelessWidget {
height: 200,
width: 400,
child: Image.network(
'https://sefer.click/sefer/card_image/idFrontEmployee-${employeeController.employee[index]['id']}.jpg'),
// https: //server.sefer.click/sefer.click/sefer/card_image/idFrontEmployee-GC15188P.jpg
'https://server.sefer.click/sefer.click/sefer/card_image/idFrontEmployee-${employeeController.employee[index]['id']}.jpg'),
),
const SizedBox(
height: 10,
@@ -174,7 +175,7 @@ class EmployeeDetails extends StatelessWidget {
height: 200,
width: 400,
child: Image.network(
'https://sefer.click/sefer/card_image/idFrontEmployee-${employeeController.employee[index]['id']}.jpg'),
'https://server.sefer.click/sefer.click/sefer/card_image/idFrontEmployee-${employeeController.employee[index]['id']}.jpg'),
)
],
);

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sefer_admin1/controller/functions/encrypt_decrypt.dart';
import '../../../constant/style.dart';
import '../../../controller/admin/passenger_admin_controller.dart';
@@ -136,7 +137,7 @@ class Passengrs extends StatelessWidget {
.spaceBetween,
children: [
Text(
'Name : ${user['first_name']} ${user['last_name']}',
'Name : ${(user['first_name'])} ${(user['last_name'])}',
style: AppStyle.title,
),
Text(