first commit
This commit is contained in:
378
lib/controller/mainController/pages/add_car.dart
Normal file
378
lib/controller/mainController/pages/add_car.dart
Normal file
@@ -0,0 +1,378 @@
|
||||
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/functions/launch.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/encrypt_decrypt.dart';
|
||||
import '../../functions/image.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',
|
||||
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: [
|
||||
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,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
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: [
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
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((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 {},
|
||||
onCancel: () => Get.back());
|
||||
},
|
||||
icon: const Icon(Icons.wallet_giftcard_rounded),
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: const Center(
|
||||
child: Text('No drivers available.'),
|
||||
);
|
||||
})
|
||||
],
|
||||
isleading: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
111
lib/controller/mainController/pages/best_driver_page.dart
Normal file
111
lib/controller/mainController/pages/best_driver_page.dart
Normal file
@@ -0,0 +1,111 @@
|
||||
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((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());
|
||||
// },
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
12
lib/controller/mainController/pages/complaint.dart
Normal file
12
lib/controller/mainController/pages/complaint.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:service/views/widgets/my_scafold.dart';
|
||||
|
||||
class Complaint extends StatelessWidget {
|
||||
const Complaint({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MyScaffold(title: "View complaint".tr, isleading: true, body: []);
|
||||
}
|
||||
}
|
||||
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
128
lib/controller/mainController/pages/driver_page.dart
Normal file
128
lib/controller/mainController/pages/driver_page.dart
Normal file
@@ -0,0 +1,128 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:service/views/widgets/my_scafold.dart';
|
||||
|
||||
import '../main_controller.dart';
|
||||
|
||||
class DriverPage extends StatelessWidget {
|
||||
DriverPage({super.key});
|
||||
MainController mainController = MainController();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: GetBuilder<MainController>(builder: (mainController) {
|
||||
Map data = mainController.driverData['message'][0];
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text('${data['first_name']} ${data['last_name']}'),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: CupertinoScrollbar(
|
||||
child: ListView(
|
||||
children: [
|
||||
_buildDriverInfoSection(
|
||||
mainController.driverData['message'][0]),
|
||||
_buildStatisticsSection(
|
||||
mainController.driverData['message'][0]),
|
||||
_buildCarInfoSection(mainController.driverData['message'][0]),
|
||||
_buildLicenseInfoSection(
|
||||
mainController.driverData['message'][0]),
|
||||
_buildBankInfoSection(
|
||||
mainController.driverData['message'][0]),
|
||||
// buildCarInfo(mainController.driverData['message'][0]),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDriverInfoSection(Map<String, dynamic> data) {
|
||||
return CupertinoListSection.insetGrouped(
|
||||
header: Text('Driver Information'.tr),
|
||||
children: [
|
||||
_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()),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatisticsSection(Map<String, dynamic> data) {
|
||||
return CupertinoListSection.insetGrouped(
|
||||
header: Text('Driver Statistics'.tr),
|
||||
children: [
|
||||
_buildInfoRow('Total Rides'.tr, data['countRide'].toString()),
|
||||
_buildInfoRow('Average Rating'.tr, data['rating'].toString()),
|
||||
_buildInfoRow('Total Payments'.tr, '\$${data['totalPayment']}'),
|
||||
_buildInfoRow('Wallet Balance'.tr, '\$${data['totalDriverWallet']}'),
|
||||
_buildInfoRow('Complaints'.tr, data['countComplaint'].toString()),
|
||||
_buildInfoRow('Scam Reports'.tr, data['countScam'].toString()),
|
||||
_buildInfoRow(
|
||||
'Passengers Rated'.tr, data['DRatingPassengersCount'].toString()),
|
||||
_buildInfoRow(
|
||||
'Avg Passenger Rating'.tr, data['avgDRatingPassenger'].toString()),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCarInfoSection(Map<String, dynamic> data) {
|
||||
return CupertinoListSection.insetGrouped(
|
||||
header: Text('Vehicle Information'.tr),
|
||||
children: [
|
||||
_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()),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLicenseInfoSection(Map<String, dynamic> data) {
|
||||
return CupertinoListSection.insetGrouped(
|
||||
header: Text('License Information'.tr),
|
||||
children: [
|
||||
_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()),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBankInfoSection(Map<String, dynamic> data) {
|
||||
return CupertinoListSection.insetGrouped(
|
||||
header: Text('Bank Information'.tr),
|
||||
children: [
|
||||
_buildInfoRow('Account Number'.tr, data['accountBank'].toString()),
|
||||
_buildInfoRow('Bank Code'.tr, data['bankCode'].toString()),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoRow(String label, String value) {
|
||||
return CupertinoListTile(
|
||||
title: Text(label),
|
||||
trailing: Text(value,
|
||||
style: const TextStyle(color: CupertinoColors.systemGrey)),
|
||||
);
|
||||
}
|
||||
}
|
||||
219
lib/controller/mainController/pages/drivers_cant_register.dart
Normal file
219
lib/controller/mainController/pages/drivers_cant_register.dart
Normal file
@@ -0,0 +1,219 @@
|
||||
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';
|
||||
|
||||
import 'registration_captain_page.dart';
|
||||
|
||||
class DriversCantRegister extends StatelessWidget {
|
||||
DriversCantRegister({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(MainController());
|
||||
return MyScaffold(
|
||||
title: 'Drivers Cant Register'.tr,
|
||||
isleading: true,
|
||||
body: [
|
||||
GetBuilder<MainController>(builder: (mainController) {
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: CupertinoSearchTextField(
|
||||
keyboardType: TextInputType.phone,
|
||||
onChanged: (value) => mainController.searchDrivers(value),
|
||||
placeholder: 'Search by phone number'.tr,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: mainController.filteredDrivers.length,
|
||||
itemBuilder: (context, index) {
|
||||
final driver = mainController.filteredDrivers[index];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
color: driver['note'] == null
|
||||
? AppColor.greenColor
|
||||
: AppColor.greyColor,
|
||||
child: CupertinoFormSection(
|
||||
header: Text(
|
||||
'Driver ID: ${driver['driverId']}',
|
||||
),
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => mainController
|
||||
.makePhoneCall(driver['phone_number']),
|
||||
child: Container(
|
||||
height: 40,
|
||||
color: driver['note'] != null
|
||||
? AppColor.greenColor
|
||||
: AppColor.greyColor,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text((driver['phone_number'])),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
String message = "مرحباً،\n\n"
|
||||
"نلاحظ أنك لم تكمل عملية التسجيل في خدمة Tripz درايفر. نود تذكيرك بأن إكمال التسجيل يتيح لك فرصة الانضمام إلى فريق Tripz والاستفادة من خدماتنا المتنوعة.\n\n"
|
||||
"إذا كنت بحاجة إلى أي مساعدة أو لديك أي استفسارات، لا تتردد في الاتصال بنا. نحن هنا لمساعدتك.\n\n"
|
||||
"للاتصال بنا، يرجى الاتصال على الرقم التالي: +20 101 880 5430\n\n"
|
||||
"مع تحيات فريق Tripz.";
|
||||
|
||||
mainController.launchCommunication(
|
||||
'whatsapp',
|
||||
'${driver['phone_number']}',
|
||||
message);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.send_time_extension_sharp,
|
||||
color: AppColor.secondaryColor,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Get.to(() => RegisterCaptain(),
|
||||
arguments: {
|
||||
"phone_number":
|
||||
driver['phone_number']
|
||||
.toString(),
|
||||
'driverId': driver['driverId']
|
||||
.toString(),
|
||||
'email':
|
||||
driver['email'].toString(),
|
||||
});
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.save,
|
||||
color: AppColor.gold,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
// CupertinoFormRow(
|
||||
// prefix: Text('Phone Number'.tr),
|
||||
// child: CupertinoTextFormFieldRow(
|
||||
// initialValue: driver['phone_number'],
|
||||
// readOnly: true,
|
||||
// placeholder: 'Phone Number'.tr,
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
),
|
||||
CupertinoFormRow(
|
||||
prefix: Text('Created At'.tr),
|
||||
child: CupertinoTextFormFieldRow(
|
||||
initialValue: driver['created_at'],
|
||||
readOnly: true,
|
||||
placeholder: 'Created At',
|
||||
),
|
||||
),
|
||||
CupertinoFormRow(
|
||||
prefix: Text('Status'.tr),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
showCupertinoModalPopup<void>(
|
||||
context: Get.context!,
|
||||
builder: (BuildContext context) =>
|
||||
Container(
|
||||
height: 216,
|
||||
padding: const EdgeInsets.only(top: 6.0),
|
||||
margin: EdgeInsets.only(
|
||||
bottom: MediaQuery.of(context)
|
||||
.viewInsets
|
||||
.bottom,
|
||||
),
|
||||
color: CupertinoColors.systemBackground
|
||||
.resolveFrom(context),
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
child: CupertinoPicker(
|
||||
magnification: 1.22,
|
||||
squeeze: 1.2,
|
||||
useMagnifier: true,
|
||||
itemExtent: 32.0,
|
||||
scrollController:
|
||||
FixedExtentScrollController(
|
||||
initialItem: mainController
|
||||
.selectedStatus
|
||||
.indexOf(mainController
|
||||
.selectedStatus),
|
||||
),
|
||||
onSelectedItemChanged:
|
||||
(int selectedItem) {
|
||||
mainController.setSelectedStatus(
|
||||
mainController
|
||||
.statusOptions[selectedItem]
|
||||
.tr);
|
||||
},
|
||||
children: List<Widget>.generate(
|
||||
mainController.statusOptions
|
||||
.length, (int index) {
|
||||
return Center(
|
||||
child: Text(mainController
|
||||
.statusOptions[index].tr),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: CupertinoFormRow(
|
||||
child: Text(
|
||||
mainController.selectedStatus.tr,
|
||||
style: TextStyle(
|
||||
color: CupertinoColors.label
|
||||
.resolveFrom(Get.context!)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
CupertinoFormRow(
|
||||
prefix: Text('Notes'.tr),
|
||||
child: CupertinoTextFormFieldRow(
|
||||
cursorColor: AppColor.blueColor,
|
||||
controller: mainController.notesController,
|
||||
placeholder:
|
||||
driver['note'] ?? "Additional comments".tr,
|
||||
),
|
||||
),
|
||||
CupertinoButton(
|
||||
child: Text('Save Notes'.tr),
|
||||
onPressed: () {
|
||||
// Save the notes for the driver
|
||||
String notes =
|
||||
mainController.notesController.text == ''
|
||||
? mainController.selectedStatus
|
||||
.toString()
|
||||
: mainController.notesController.text;
|
||||
|
||||
mainController
|
||||
.saveNoteForDriverNotCompleteRegistration(
|
||||
driver['phone_number'],
|
||||
'girls name',
|
||||
notes);
|
||||
print(
|
||||
'Notes for driver ${driver['id']}: $notes');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
334
lib/controller/mainController/pages/edit_car.dart
Normal file
334
lib/controller/mainController/pages/edit_car.dart
Normal file
@@ -0,0 +1,334 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
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;
|
||||
const EditCar({super.key, required this.carData});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(MainController());
|
||||
|
||||
return GetBuilder<MainController>(builder: (mainController) {
|
||||
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: [
|
||||
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,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
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: [
|
||||
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,
|
||||
);
|
||||
}
|
||||
},
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
48
lib/controller/mainController/pages/edit_car_plate.dart
Normal file
48
lib/controller/mainController/pages/edit_car_plate.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.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 '../../functions/encrypt_decrypt.dart';
|
||||
import '../main_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class EditCarPlate extends StatelessWidget {
|
||||
const EditCarPlate({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
|
||||
.carPlateNotEdit.length, // 10 fields + 1 save button
|
||||
itemBuilder: (context, index) {
|
||||
var carData = mainController.carPlateNotEdit[index];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.to(EditCar(carData: carData));
|
||||
},
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Text((carData['owner']))),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
56
lib/controller/mainController/pages/giza_best_driver.dart
Normal file
56
lib/controller/mainController/pages/giza_best_driver.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
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((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 {},
|
||||
onCancel: () => Get.back());
|
||||
},
|
||||
icon: const Icon(Icons.wallet_giftcard_rounded),
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: const Center(
|
||||
child: Text('No drivers available.'),
|
||||
);
|
||||
})
|
||||
],
|
||||
isleading: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
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});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(MainController());
|
||||
return MyScaffold(
|
||||
title: 'Passengers Cant Register'.tr,
|
||||
isleading: true,
|
||||
body: [
|
||||
GetBuilder<MainController>(builder: (mainController) {
|
||||
return ListView.builder(
|
||||
itemCount: mainController.passengerNotCompleteRegistration.length,
|
||||
itemBuilder: (context, index) {
|
||||
final passenger =
|
||||
mainController.passengerNotCompleteRegistration[index];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: CupertinoFormSection(
|
||||
header: Text('Passenger ID: ${passenger['id']}'),
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => mainController
|
||||
.makePhoneCall(passenger['phone_number']),
|
||||
child: CupertinoFormRow(
|
||||
prefix: Text('Phone Number'.tr),
|
||||
child: CupertinoTextFormFieldRow(
|
||||
initialValue: ((passenger['phone_number'])),
|
||||
readOnly: true,
|
||||
placeholder: 'Phone Number'.tr,
|
||||
),
|
||||
),
|
||||
),
|
||||
CupertinoFormRow(
|
||||
prefix: Text('Created At'.tr),
|
||||
child: CupertinoTextFormFieldRow(
|
||||
initialValue: passenger['created_at'],
|
||||
readOnly: true,
|
||||
placeholder: 'Created At',
|
||||
),
|
||||
),
|
||||
CupertinoFormRow(
|
||||
prefix: Text('Notes'.tr),
|
||||
child: CupertinoTextFormFieldRow(
|
||||
controller: mainController.notesController,
|
||||
placeholder:
|
||||
passenger['note'] ?? 'Enter notes after call'.tr,
|
||||
),
|
||||
),
|
||||
CupertinoButton(
|
||||
child: Text('Save Notes'.tr),
|
||||
onPressed: () {
|
||||
// Save the notes for the Passenger
|
||||
String notes = mainController.notesController.text;
|
||||
|
||||
mainController
|
||||
.saveNoteForPassengerNotCompleteRegistration(
|
||||
passenger['phone_number'], 'girls name', notes);
|
||||
print('Notes for Passenger ${passenger['id']}: $notes');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
133
lib/controller/mainController/pages/passengers_page.dart
Normal file
133
lib/controller/mainController/pages/passengers_page.dart
Normal file
@@ -0,0 +1,133 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:service/controller/mainController/main_controller.dart';
|
||||
import 'package:service/views/widgets/my_scafold.dart';
|
||||
|
||||
class PassengersPage extends StatelessWidget {
|
||||
PassengersPage({super.key});
|
||||
final MainController mainController = MainController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MainController>(builder: (mainController) {
|
||||
Map data = mainController.passengerData['message'][0];
|
||||
return MyScaffold(
|
||||
title: (data['first_name']?.toString() ?? '') +
|
||||
' ' +
|
||||
(data['last_name']?.toString() ?? ''),
|
||||
isleading: true,
|
||||
body: [
|
||||
ListView(
|
||||
children: [
|
||||
_buildPersonalInfoCard(data),
|
||||
_buildLatestRideCard(data),
|
||||
_buildWalletInfoCard(data),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildPersonalInfoCard(Map data) {
|
||||
return Card(
|
||||
margin: const EdgeInsets.all(16),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Personal Information'.tr,
|
||||
style:
|
||||
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 16),
|
||||
_buildInfoRow('Phone'.tr, data['phone']?.toString() ?? 'N/A'),
|
||||
_buildInfoRow('Email'.tr, data['email']?.toString() ?? 'N/A'),
|
||||
_buildInfoRow('Gender'.tr, data['gender']?.toString() ?? 'N/A'),
|
||||
_buildInfoRow(
|
||||
'Birthdate'.tr, data['birthdate']?.toString() ?? 'N/A'),
|
||||
_buildInfoRow(
|
||||
'Education'.tr, data['education']?.toString() ?? 'N/A'),
|
||||
_buildInfoRow(
|
||||
'Employment'.tr, data['employmentType']?.toString() ?? 'N/A'),
|
||||
_buildInfoRow('Marital Status'.tr,
|
||||
data['maritalStatus']?.toString() ?? 'N/A'),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLatestRideCard(Map data) {
|
||||
return Card(
|
||||
margin: const EdgeInsets.all(16),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Latest Ride'.tr,
|
||||
style:
|
||||
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 16),
|
||||
_buildInfoRow('Ride ID'.tr, data['ride_id']?.toString() ?? 'N/A'),
|
||||
_buildInfoRow('Date'.tr, data['ride_date']?.toString() ?? 'N/A'),
|
||||
_buildInfoRow(
|
||||
'Start Time'.tr, data['ride_time']?.toString() ?? 'N/A'),
|
||||
_buildInfoRow(
|
||||
'End Time'.tr, data['ride_endtime']?.toString() ?? 'N/A'),
|
||||
_buildInfoRow(
|
||||
'Price'.tr, '\$${data['price']?.toString() ?? 'N/A'}'),
|
||||
_buildInfoRow(
|
||||
'Status'.tr, data['ride_status']?.toString() ?? 'N/A'),
|
||||
_buildInfoRow('Payment Method'.tr,
|
||||
data['ride_payment_method']?.toString() ?? 'N/A'),
|
||||
_buildInfoRow('Car Type'.tr, data['car_type']?.toString() ?? 'N/A'),
|
||||
_buildInfoRow(
|
||||
'Distance'.tr,
|
||||
data['distance'] != null
|
||||
? '${data['distance'].toStringAsFixed(2)} km'
|
||||
: 'N/A'),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildWalletInfoCard(Map data) {
|
||||
return Card(
|
||||
margin: const EdgeInsets.all(16),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Wallet Information'.tr,
|
||||
style:
|
||||
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 16),
|
||||
_buildInfoRow('Wallet Balance'.tr,
|
||||
'\$${data['passenger_wallet_balance']?.toString() ?? 'N/A'}'),
|
||||
_buildInfoRow('Last Payment Amount'.tr,
|
||||
'\$${data['passenger_payment_amount']?.toString() ?? 'N/A'}'),
|
||||
_buildInfoRow('Last Payment Method'.tr,
|
||||
data['passenger_payment_method']?.toString() ?? 'N/A'),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoRow(String label, String value) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(label, style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
Text(value),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
2676
lib/controller/mainController/pages/registration_captain_page.dart
Normal file
2676
lib/controller/mainController/pages/registration_captain_page.dart
Normal file
File diff suppressed because it is too large
Load Diff
165
lib/controller/mainController/pages/welcome_call.dart
Normal file
165
lib/controller/mainController/pages/welcome_call.dart
Normal file
@@ -0,0 +1,165 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:service/constant/colors.dart';
|
||||
import 'package:service/constant/style.dart';
|
||||
import 'package:service/views/widgets/elevated_btn.dart';
|
||||
import 'package:service/views/widgets/my_scafold.dart';
|
||||
|
||||
import '../main_controller.dart';
|
||||
|
||||
class WelcomeCall extends StatelessWidget {
|
||||
const WelcomeCall({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(MainController());
|
||||
return MyScaffold(
|
||||
title: 'Welcome Drivers'.tr,
|
||||
isleading: true,
|
||||
body: [
|
||||
GetBuilder<MainController>(builder: (mainController) {
|
||||
return Expanded(
|
||||
child: CupertinoScrollbar(
|
||||
child: ListView.builder(
|
||||
itemCount: mainController.newDriverRegister.length,
|
||||
itemBuilder: (context, index) {
|
||||
final driver = mainController.newDriverRegister[index];
|
||||
return DriverCard(driver: driver);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DriverCard extends StatelessWidget {
|
||||
final Map<String, dynamic> driver;
|
||||
|
||||
const DriverCard({super.key, required this.driver});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoCard(
|
||||
margin: const EdgeInsets.all(16.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1.copyWith(
|
||||
color: driver['isCall'].toString() == '1'
|
||||
? AppColor.greenColor
|
||||
: AppColor.accentColor),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10, vertical: 2),
|
||||
child: Text(
|
||||
'Driver Information'.tr,
|
||||
style: CupertinoTheme.of(context).textTheme.navTitleTextStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
InfoText('Name'.tr, driver['name_arabic'].toString()),
|
||||
InfoText('Phone'.tr, driver['phone'].toString()),
|
||||
InfoText('Email'.tr, driver['email'].toString()),
|
||||
InfoText('License Type'.tr, driver['license_type'].toString()),
|
||||
InfoText(
|
||||
'License Categories'.tr, driver['license_categories'] ?? ''),
|
||||
InfoText(
|
||||
'National Number'.tr, driver['national_number'].toString()),
|
||||
InfoText('Occupation'.tr, driver['occupation'].toString()),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'Notes:'.tr,
|
||||
style: CupertinoTheme.of(context).textTheme.navTitleTextStyle,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
CupertinoTextField(
|
||||
controller: Get.find<MainController>().notesController,
|
||||
placeholder: driver['notes'] ?? 'Enter notes here...'.tr,
|
||||
maxLines: 3,
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: CupertinoColors.systemGrey),
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
child: MyElevatedButton(
|
||||
title: 'Call Driver'.tr,
|
||||
onPressed: () {
|
||||
Get.find<MainController>()
|
||||
.makePhoneCall(driver['phone'].toString());
|
||||
})),
|
||||
CupertinoButton(
|
||||
onPressed: () async {
|
||||
await Get.find<MainController>().addWelcomeCall(
|
||||
driver['id'].toString(),
|
||||
);
|
||||
},
|
||||
child: Text('Save Changes'.tr),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class InfoText extends StatelessWidget {
|
||||
final String label;
|
||||
final String value;
|
||||
|
||||
const InfoText(this.label, this.value, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 4.0),
|
||||
child: Text(
|
||||
'$label: $value',
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CupertinoCard extends StatelessWidget {
|
||||
final Widget child;
|
||||
final EdgeInsetsGeometry margin;
|
||||
|
||||
const CupertinoCard(
|
||||
{super.key, required this.child, this.margin = EdgeInsets.zero});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: margin,
|
||||
decoration: BoxDecoration(
|
||||
color: CupertinoColors.systemBackground,
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: CupertinoColors.systemGrey.withOpacity(0.2),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 5,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user