9/21/2
This commit is contained in:
@@ -20,6 +20,7 @@ class AppLink {
|
||||
static String getTokens = "$server/ride/firebase/get.php";
|
||||
static String getAllTokenDrivers =
|
||||
"$server/ride/firebase/getALlTokenDrivers.php";
|
||||
|
||||
static String getAllTokenPassengers =
|
||||
"$server/ride/firebase/getAllTokenPassengers.php";
|
||||
static String addTokens = "$server/ride/firebase/add.php";
|
||||
@@ -220,7 +221,8 @@ class AppLink {
|
||||
static String getAccount = "$authCaptin/getAccount.php";
|
||||
|
||||
//===================Admin Captin============
|
||||
|
||||
static String getDriversPhonesAndTokens =
|
||||
"$server/Admin/AdminCaptain/getDriversPhonesAndTokens.php";
|
||||
static String getPassengerDetailsByPassengerID =
|
||||
"$server/Admin/getPassengerDetailsByPassengerID.php";
|
||||
static String getPassengerDetails = "$server/Admin/getPassengerDetails.php";
|
||||
@@ -237,11 +239,13 @@ class AppLink {
|
||||
"$server/Admin/AdminRide/getRidesPerMonth.php";
|
||||
static String getRidesDetails = "$server/Admin/AdminRide/get.php";
|
||||
static String getPassengersStatic = "$serviceApp/getPassengersStatic.php";
|
||||
static String getRidesStatic = "$serviceApp/getRidesStatic.php";
|
||||
static String getEmployeeStatic = "$serviceApp/getEmployeeStatic.php";
|
||||
static String getdriverstotalMonthly =
|
||||
"$serviceApp/getdriverstotalMonthly.php";
|
||||
|
||||
////////////////////////
|
||||
static String serviceApp = "$server/serviceApp";
|
||||
static String serviceApp = "$server/serviceapp";
|
||||
static String editCarPlate = "$serviceApp/editCarPlate.php";
|
||||
static String getComplaintAllData = "$serviceApp/getComplaintAllData.php";
|
||||
static String getComplaintAllDataForDriver =
|
||||
@@ -259,4 +263,14 @@ class AppLink {
|
||||
static String addNotesDriver = "$serviceApp/addNotesDriver.php";
|
||||
static String getCarPlateNotEdit = "$serviceApp/getCarPlateNotEdit.php";
|
||||
static String addNotesPassenger = "$serviceApp/addNotesPassenger.php";
|
||||
//////
|
||||
static String sendSms = "https://sms.kazumi.me/api/sms/send-sms";
|
||||
static String senddlr = "https://sms.kazumi.me/api/sms/send-dlr";
|
||||
static String sendvalidity = "https://sms.kazumi.me/api/sms/send-validity";
|
||||
static String sendmany = "https://sms.kazumi.me/api/sms/send-many";
|
||||
static String checkCredit = "https://sms.kazumi.me/api/sms/check-credit";
|
||||
static String getSender = "$server/auth/sms/getSender.php";
|
||||
static String checkStatus = "https://sms.kazumi.me/api/sms/check-status";
|
||||
static String updatePhoneInvalidSMSPassenger =
|
||||
"$server/auth/sms/updatePhoneInvalidSMSPassenger.php";
|
||||
}
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
import 'dart:convert';
|
||||
|
||||
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 '../../constant/api_key.dart';
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
|
||||
class DashboardController extends GetxController {
|
||||
bool isLoading = false;
|
||||
List dashbord = [];
|
||||
String creditSMS = '0';
|
||||
final formKey = GlobalKey<FormState>();
|
||||
final smsText = TextEditingController();
|
||||
|
||||
Future getDashBoard() async {
|
||||
isLoading = true;
|
||||
@@ -36,6 +41,22 @@ class DashboardController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
sendSMSMethod() async {
|
||||
if (formKey.currentState!.validate()) {
|
||||
for (var phoneNumber in box.read(BoxName.tokensDrivers)['message']) {
|
||||
// for (var i = 0; i < 2; i++) {
|
||||
await CRUD().sendSmsEgypt(
|
||||
phoneNumber['phone'].toString(),
|
||||
// box.read(BoxName.tokensDrivers)['message'][i]['phone'].toString(),
|
||||
smsText.text,
|
||||
);
|
||||
// Log.print('CRUD().phoneDriversTest.: ${phoneNumber['phone']}');
|
||||
Future.delayed(const Duration(microseconds: 20));
|
||||
}
|
||||
Get.back();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
getDashBoard();
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/links.dart';
|
||||
import '../../models/model/passengers_model.dart';
|
||||
import '../../print.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class StaticController extends GetxController {
|
||||
@@ -14,11 +15,20 @@ class StaticController extends GetxController {
|
||||
var chartDataPassengers;
|
||||
var chartDataDrivers;
|
||||
var chartDataDriversCalling;
|
||||
var chartDataRides;
|
||||
var chartDataEmployee;
|
||||
var chartDataEmployeeMaryam;
|
||||
var chartDataEmployeeRawda;
|
||||
var chartDataEmployeeMena;
|
||||
var chartDataDriversMatchingNotes;
|
||||
bool isLoading = false;
|
||||
String totalMonthlyPassengers = '';
|
||||
String totalMonthlyRides = '';
|
||||
String totalMonthlyEmployee = '';
|
||||
String totalMonthlyDrivers = '';
|
||||
late List<MonthlyPassengerInstall> passengersData;
|
||||
late List<MonthlyRidesInstall> ridesData;
|
||||
late List<MonthlyEmployeeData> employeeData;
|
||||
late List<MonthlyDriverInstall> driversData;
|
||||
|
||||
Future<void> fetch() async {
|
||||
@@ -48,6 +58,98 @@ class StaticController extends GetxController {
|
||||
update(); // Notify the observers about the data and loading state change
|
||||
}
|
||||
|
||||
Future<void> fetchRides() async {
|
||||
isLoading = true;
|
||||
update(); // Notify the observers about the loading state change
|
||||
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.getRidesStatic,
|
||||
payload: {},
|
||||
);
|
||||
jsonData1 = jsonDecode(res);
|
||||
var jsonResponse = jsonDecode(res) as Map<String, dynamic>;
|
||||
isLoading = false;
|
||||
final List<dynamic> jsonData = jsonResponse['message'];
|
||||
totalMonthlyRides = jsonData[0]['totalMonthly'].toString();
|
||||
ridesData = jsonData.map<MonthlyRidesInstall>((item) {
|
||||
return MonthlyRidesInstall.fromJson(item);
|
||||
}).toList();
|
||||
final List<FlSpot> spots = ridesData
|
||||
.map((data) => FlSpot(
|
||||
data.day.toDouble(),
|
||||
data.totalRides.toDouble(),
|
||||
))
|
||||
.toList();
|
||||
chartDataRides = spots;
|
||||
|
||||
update(); // Notify the observers about the data and loading state change
|
||||
}
|
||||
|
||||
Future<void> fetchEmployee() async {
|
||||
isLoading = true;
|
||||
update();
|
||||
|
||||
var res = await CRUD().get(link: AppLink.getEmployeeStatic, payload: {});
|
||||
var jsonResponse = jsonDecode(res) as Map<String, dynamic>;
|
||||
isLoading = false;
|
||||
|
||||
final List<dynamic> jsonData = jsonResponse['message'];
|
||||
totalMonthlyRides = jsonData[0]['totalMonthly'].toString();
|
||||
|
||||
// Group data by employee
|
||||
Map<String, List<MonthlyEmployeeData>> employeeDataMap = {};
|
||||
|
||||
for (var item in jsonData) {
|
||||
var employeeData = MonthlyEmployeeData.fromJson(item);
|
||||
if (!employeeDataMap.containsKey(employeeData.name)) {
|
||||
employeeDataMap[employeeData.name] = [];
|
||||
}
|
||||
employeeDataMap[employeeData.name]!.add(employeeData);
|
||||
}
|
||||
|
||||
// Create FlSpot data for each employee
|
||||
List<FlSpot> chartDataMaryam = [];
|
||||
List<FlSpot> chartDataRawda = [];
|
||||
List<FlSpot> chartDataMena = [];
|
||||
|
||||
for (int day = 1; day <= DateTime.now().day; day++) {
|
||||
chartDataMaryam.add(FlSpot(
|
||||
day.toDouble(),
|
||||
employeeDataMap['maryam']
|
||||
?.firstWhere((e) => e.day == day,
|
||||
orElse: () => MonthlyEmployeeData(
|
||||
day: day, totalEmployees: 0, name: 'maryam'))
|
||||
.totalEmployees
|
||||
.toDouble() ??
|
||||
0));
|
||||
chartDataRawda.add(FlSpot(
|
||||
day.toDouble(),
|
||||
employeeDataMap['rawda']
|
||||
?.firstWhere((e) => e.day == day,
|
||||
orElse: () => MonthlyEmployeeData(
|
||||
day: day, totalEmployees: 0, name: 'rawda'))
|
||||
.totalEmployees
|
||||
.toDouble() ??
|
||||
0));
|
||||
chartDataMena.add(FlSpot(
|
||||
day.toDouble(),
|
||||
employeeDataMap['mena']
|
||||
?.firstWhere((e) => e.day == day,
|
||||
orElse: () => MonthlyEmployeeData(
|
||||
day: day, totalEmployees: 0, name: 'mena'))
|
||||
.totalEmployees
|
||||
.toDouble() ??
|
||||
0));
|
||||
}
|
||||
|
||||
// Combine spots into a single list if needed or keep them separate
|
||||
chartDataEmployeeMaryam = chartDataMaryam;
|
||||
chartDataEmployeeRawda = chartDataRawda;
|
||||
chartDataEmployeeMena = chartDataMena;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
Future<void> fetchDrivers() async {
|
||||
isLoading = true;
|
||||
update(); // Notify the observers about the loading state change
|
||||
@@ -92,6 +194,8 @@ class StaticController extends GetxController {
|
||||
|
||||
Future getAll() async {
|
||||
await fetch();
|
||||
await fetchRides();
|
||||
await fetchDrivers();
|
||||
await fetchEmployee();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import '../../constant/colors.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import '../../views/widgets/elevated_btn.dart';
|
||||
import '../notification_controller.dart';
|
||||
import 'local_notification.dart';
|
||||
@@ -83,34 +84,38 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
var currentPage = 1;
|
||||
var totalPages = 1;
|
||||
Future<void> getAllTokenDrivers({int page = 1}) async {
|
||||
Future<void> getAllTokenDrivers() async {
|
||||
isLoading = true;
|
||||
try {
|
||||
var res = await http.post(
|
||||
Uri.parse(AppLink.getAllTokenDrivers),
|
||||
Uri.parse(AppLink.getDriversPhonesAndTokens),
|
||||
headers: {
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
|
||||
},
|
||||
body: {
|
||||
'page': page.toString(),
|
||||
// 'page': page.toString(),
|
||||
},
|
||||
);
|
||||
|
||||
var jsonResponse = jsonDecode(res.body);
|
||||
Log.print('jsonResponse: ${jsonResponse}');
|
||||
if (jsonResponse['status'] == 'success') {
|
||||
var newData = jsonResponse['data'] as List;
|
||||
if (page == 1) {
|
||||
dataTokens.clear();
|
||||
tokens.clear();
|
||||
}
|
||||
dataTokens.addAll(newData);
|
||||
for (var item in newData) {
|
||||
tokens.add(item['token']);
|
||||
}
|
||||
currentPage = int.parse(jsonResponse['currentPage']);
|
||||
totalPages = jsonResponse['totalPages'];
|
||||
box.write(BoxName.tokensDrivers, tokens);
|
||||
// var newData = jsonResponse['data'] as List;
|
||||
// Log.print('newData: ${newData}');
|
||||
// // if (page == 1) {
|
||||
// // dataTokens.clear();
|
||||
// // tokens.clear();
|
||||
// // }
|
||||
// dataTokens.addAll(newData);
|
||||
// for (var item in newData) {
|
||||
// tokens.add(item['token']);
|
||||
// }
|
||||
// currentPage = int.parse(jsonResponse['currentPage']);
|
||||
// totalPages = jsonResponse['totalPages'];
|
||||
box.write(BoxName.tokensDrivers, jsonResponse);
|
||||
Log.print(
|
||||
'box.write(BoxName.tokensDrivers: ${box.read(BoxName.tokensDrivers)}');
|
||||
} else {
|
||||
Get.defaultDialog(
|
||||
title: "Warning", middleText: "No more data available");
|
||||
@@ -166,17 +171,20 @@ class FirebaseMessagesController extends GetxController {
|
||||
bool isSendingNotifications = false;
|
||||
Future<void> loadAllPagesAndSendNotifications() async {
|
||||
isSendingNotifications = true;
|
||||
currentPage = 1;
|
||||
// currentPage = 1;
|
||||
|
||||
while (currentPage <= totalPages) {
|
||||
await getAllTokenDrivers(page: currentPage);
|
||||
await NotificationController().sendNotificationDrivers();
|
||||
print(tokens);
|
||||
if (currentPage < totalPages) {
|
||||
await Future.delayed(const Duration(seconds: 3));
|
||||
}
|
||||
currentPage++;
|
||||
}
|
||||
// while (currentPage <= totalPages) {
|
||||
// await getAllTokenDrivers(page: currentPage);
|
||||
await getAllTokenDrivers();
|
||||
// Log.print('tokens: ${tokens}');
|
||||
await NotificationController().sendNotificationDrivers();
|
||||
// print(tokens);
|
||||
|
||||
// if (currentPage < totalPages) {
|
||||
// await Future.delayed(const Duration(seconds: 3));
|
||||
// }
|
||||
// currentPage++;
|
||||
// }
|
||||
|
||||
isSendingNotifications = false;
|
||||
Get.snackbar("Success", "All notifications sent!");
|
||||
@@ -189,7 +197,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
while (currentPagePassenger <= totalPagesPassenger) {
|
||||
await getAllTokenPassenger(page: currentPagePassenger);
|
||||
await NotificationController().sendNotificationDrivers();
|
||||
await NotificationController().sendNotificationPassengers();
|
||||
print(tokensPassengers);
|
||||
if (currentPagePassenger < totalPagesPassenger) {
|
||||
await Future.delayed(const Duration(seconds: 3));
|
||||
@@ -596,6 +604,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
// Obtain an OAuth 2.0 access token
|
||||
final accessToken = await accessTokenManager.getAccessToken();
|
||||
// Log.print('accessToken: ${accessToken}');
|
||||
|
||||
// Send the notification
|
||||
final response = await http.post(
|
||||
@@ -612,9 +621,6 @@ class FirebaseMessagesController extends GetxController {
|
||||
'title': title,
|
||||
'body': body,
|
||||
},
|
||||
'data': {
|
||||
'DriverList': jsonEncode([]),
|
||||
},
|
||||
'android': {
|
||||
'notification': {
|
||||
'sound': tone,
|
||||
@@ -634,11 +640,11 @@ class FirebaseMessagesController extends GetxController {
|
||||
if (response.statusCode == 200) {
|
||||
print(
|
||||
'Notification sent successfully. Status code: ${response.statusCode}');
|
||||
print('Response body: ${response.body}');
|
||||
// print('Response body: ${response.body}');
|
||||
} else {
|
||||
print(
|
||||
'Failed to send notification. Status code: ${response.statusCode}');
|
||||
print('Response body: ${response.body}');
|
||||
// print('Response body: ${response.body}');
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error sending notification: $e');
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,15 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sefer_admin1/constant/box_name.dart';
|
||||
import 'package:sefer_admin1/constant/links.dart';
|
||||
import 'package:sefer_admin1/controller/firebase/firbase_messge.dart';
|
||||
import 'package:sefer_admin1/controller/functions/crud.dart';
|
||||
import 'package:sefer_admin1/main.dart';
|
||||
import 'package:sefer_admin1/views/widgets/elevated_btn.dart';
|
||||
import 'package:sefer_admin1/views/widgets/my_textField.dart';
|
||||
|
||||
import '../constant/style.dart';
|
||||
import '../print.dart';
|
||||
|
||||
class NotificationController extends GetxController {
|
||||
final formKey = GlobalKey<FormState>();
|
||||
@@ -54,14 +57,37 @@ class NotificationController extends GetxController {
|
||||
confirm: MyElevatedButton(
|
||||
title: 'send'.tr,
|
||||
onPressed: () async {
|
||||
tokensDriver = box.read(BoxName.tokensDrivers);
|
||||
if (formKey.currentState!.validate()) {
|
||||
for (var i = 0; i < tokensDriver.length; i++) {
|
||||
print(tokensDriver.length);
|
||||
// FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
||||
// title.text, body.text, tokensDriver[i]);
|
||||
}
|
||||
// tokensDriver = box.read(BoxName.tokensDrivers)['message'];
|
||||
// Log.print('tokensDriver: ${tokensDriver}');
|
||||
// if (formKey.currentState!.validate()) {
|
||||
box.read(BoxName.tokensDrivers)['message'].length;
|
||||
for (var i = 0;
|
||||
i < box.read(BoxName.tokensDrivers)['message'].length;
|
||||
i++) {
|
||||
// for (var i = 0; i < 2; i++) {
|
||||
// print(i);
|
||||
var res = await CRUD()
|
||||
.post(link: AppLink.addNotificationCaptain, payload: {
|
||||
"driverID": box
|
||||
.read(BoxName.tokensDrivers)['message'][i]['id']
|
||||
.toString(),
|
||||
"title": title.text,
|
||||
"body": body.text,
|
||||
});
|
||||
Log.print('res: ${res}');
|
||||
// Log.print('tokensDriver[i]: ${tokensDriver[i]}');
|
||||
Future.delayed(const Duration(microseconds: 50));
|
||||
|
||||
FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
||||
title.text,
|
||||
body.text,
|
||||
box
|
||||
.read(BoxName.tokensDrivers)['message'][i]['token']
|
||||
.toString(),
|
||||
'tone2.wav');
|
||||
}
|
||||
Get.back();
|
||||
// }
|
||||
}),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'cancel',
|
||||
@@ -115,3 +141,52 @@ class NotificationController extends GetxController {
|
||||
}));
|
||||
}
|
||||
}
|
||||
// يلا دلوقتي! تطبيق سفر جاهز عشان تبدأ تستقبل الطلبات
|
||||
// • افتح التطبيق دلوقتي، واستعد إنك تستقبل طلبات أكتر. كل ما تكون فاتح، فرصتك في الطلبات بتزيد!
|
||||
// 2. خليك فاتح واستقبل طلبات أكتر مع تطبيق سفر
|
||||
// • وجودك متصل في التطبيق هيخليك تستقبل طلبات أكتر. افتح التطبيق دلوقتي وما تفوتش الفرصة!
|
||||
// 3. فرصتك لزيادة دخلك مع تطبيق سفر تبدأ من دلوقتي!
|
||||
// • مجرد إنك تفتح التطبيق مش هيأثر عليك، بالعكس، هيزود فرصتك في طلبات أكتر. افتح التطبيق واشترك دلوقتي!
|
||||
|
||||
//sms
|
||||
// link sefer driver is https://shorturl.at/IHJcm1.
|
||||
// // ميزات الأمان بعد 500 رحلة:
|
||||
// • “بعد 500 رحلة مع سفر، تحصل على مميزات أمان إضافية لضمان راحتك.”
|
||||
// • “نوفر لك ميزات أمان متقدمة بعد 500 رحلة لتجربة قيادة أكثر أمانًا.”
|
||||
// • “مع 500 رحلة، تحصل على دعم أمني متقدم لتوفير أفضل تجربة قيادة.”
|
||||
// 2. ميزات الصيانة:
|
||||
// • “احصل على خدمات صيانة مجانية بعد عدد معين من الرحلات مع سفر.”
|
||||
// • “استمتع بخدمات صيانة حصرية عند الوصول إلى عدد محدد من الرحلات.”
|
||||
// • “مع سفر، نقدم لك عروض صيانة مميزة لتحافظ على سيارتك في أفضل حال.”
|
||||
// 3. ميزات فتح حسابات البنوك:
|
||||
// • “مع سفر، يمكنك فتح حساب بنكي بسهولة واستفادة من عروض مميزة.”
|
||||
// • “افتح حساب بنكي مع تطبيق سفر واستفد من خدمات مالية حصرية.”
|
||||
// • “نساعدك على فتح حساب بنكي بأفضل العروض بالتعاون مع البنوك المحلية.”
|
||||
// 4. ميزات ورود السيارات ومعارض السيارات الخاصة بنا:
|
||||
// • “استمتع بعروض مميزة لشراء السيارات من معارض سفر الحصرية.”
|
||||
// • “اختر سيارتك المثالية من معارض سفر بأسعار تنافسية وخدمات مميزة.”
|
||||
// • “نقدم لك أفضل عروض السيارات من معارضنا لتسهيل امتلاك سيارتك الجديدة.”
|
||||
// 5. ميزات أوفر كار:
|
||||
// • “أوفر كار من سفر توفر لك سيارات اقتصادية لزيادة دخلك بكفاءة.”
|
||||
// • “مع أوفر كار، يمكنك العمل بسيارات اقتصادية وتحقيق أرباح أكبر.”
|
||||
// • “تطبيق سفر يقدم لك أوفر كار، الخيار الاقتصادي المثالي لزيادة دخلك.”
|
||||
// 6. مستوى الدخل المحدود والطلبات الاقتصادية:
|
||||
// • “لأصحاب الدخل المحدود، وفرنا طلبات اقتصادية تضمن لك زيادة دخلك.”
|
||||
// • “الطلبات الاقتصادية من سفر تساعدك على زيادة دخلك بسهولة وفعالية.”
|
||||
// • “استفد من طلبات اقتصادية تناسب أصحاب الدخل المحدود لزيادة أرباحك.”
|
||||
// 7. طلبات الليل:
|
||||
// • “مع طلبات الليل من سفر، زود دخلك واستفد من فرص إضافية في المساء.”
|
||||
// • “لا تفوت فرصة طلبات الليل مع سفر، زود دخلك في أي وقت.”
|
||||
// • “طلبات الليل من سفر توفر لك فرصًا إضافية لتحقيق دخل أعلى.”
|
||||
// 8. طلبات الكمفورت الأكثر راحة والسيارات المكيفة:
|
||||
// • “قدّم خدمة مريحة مع طلبات الكمفورت من سفر والسيارات المكيفة.”
|
||||
// • “طلبات الكمفورت توفر تجربة راقية للركاب بسيارات مكيفة ومريحة.”
|
||||
// • “مع سفر، سيارات الكمفورت المكيفة تضمن راحة الركاب وزيادة الطلبات.”
|
||||
// 9. طلبات السبيد:
|
||||
// • “استقبل طلبات السبيد مع سفر لتقديم رحلات أسرع وزيادة دخلك.”
|
||||
// • “طلبات السبيد توفر لك فرصة إكمال المزيد من الرحلات في وقت أقل.”
|
||||
// • “مع طلبات السبيد من سفر، تقدم خدمة سريعة وفعالة لزيادة الأرباح.”
|
||||
// 10. الطلبات الثابتة والمعتدلة السعر والنسبة الثابتة 8%:
|
||||
// • “مع نسبة ثابتة 8%، تحصل على أفضل عروض الأسعار مع سفر.”
|
||||
// • “استمتع بنسبة ثابتة 8%، أقل نسبة بين المنافسين لزيادة دخلك.”
|
||||
// • “طلبات سفر الثابتة تضمن لك دخلاً مستقراً بنسبة أقل من 8%.”
|
||||
|
||||
@@ -11,6 +11,34 @@ class MonthlyPassengerInstall {
|
||||
int.parse(json['totalPassengers'].toString().split(':')[0]));
|
||||
}
|
||||
|
||||
class MonthlyRidesInstall {
|
||||
int day;
|
||||
int totalRides;
|
||||
|
||||
MonthlyRidesInstall({required this.day, required this.totalRides});
|
||||
|
||||
factory MonthlyRidesInstall.fromJson(Map<String, dynamic> json) =>
|
||||
MonthlyRidesInstall(
|
||||
day: int.parse(json['day'].toString().split('-')[2]),
|
||||
totalRides: int.parse(json['totalRides'].toString().split(':')[0]));
|
||||
}
|
||||
|
||||
class MonthlyEmployeeData {
|
||||
int day;
|
||||
int totalEmployees;
|
||||
String name;
|
||||
|
||||
MonthlyEmployeeData(
|
||||
{required this.day, required this.totalEmployees, required this.name});
|
||||
|
||||
factory MonthlyEmployeeData.fromJson(Map<String, dynamic> json) =>
|
||||
MonthlyEmployeeData(
|
||||
day: int.parse(json['date'].toString().split('-')[2]), // Extract day
|
||||
totalEmployees: json['count'],
|
||||
name: json['NAME'],
|
||||
);
|
||||
}
|
||||
|
||||
class MonthlyDriverInstall {
|
||||
int day;
|
||||
int totalDrivers;
|
||||
|
||||
@@ -8,12 +8,15 @@ import 'package:sefer_admin1/controller/admin/static_controller.dart';
|
||||
import 'package:sefer_admin1/controller/notification_controller.dart';
|
||||
import 'package:sefer_admin1/views/admin/captain/drivers_cant_registe.dart';
|
||||
import 'package:sefer_admin1/views/admin/captain/register_captain.dart';
|
||||
import 'package:sefer_admin1/views/widgets/elevated_btn.dart';
|
||||
import 'package:sefer_admin1/views/widgets/my_textField.dart';
|
||||
import 'package:sefer_admin1/views/widgets/mycircular.dart';
|
||||
|
||||
import '../../constant/links.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../controller/functions/crud.dart';
|
||||
import '../../controller/functions/gemeni.dart';
|
||||
import '../../print.dart';
|
||||
import '../widgets/my_scafold.dart';
|
||||
import 'captain/captain.dart';
|
||||
import 'passenger/passenger.dart';
|
||||
@@ -339,12 +342,63 @@ class AdminHomePage extends StatelessWidget {
|
||||
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 {
|
||||
|
||||
@@ -230,8 +230,7 @@ class StaticDash extends StatelessWidget {
|
||||
lineBarsData: [
|
||||
LineChartBarData(
|
||||
isStepLineChart: true,
|
||||
spots: staticController
|
||||
.chartDataDriversCalling,
|
||||
spots: staticController.chartDataRides,
|
||||
isCurved: true,
|
||||
color: Colors
|
||||
.deepPurpleAccent, // Custom color
|
||||
@@ -241,7 +240,8 @@ class StaticDash extends StatelessWidget {
|
||||
true), // Show dots on each point
|
||||
belowBarData: BarAreaData(
|
||||
show: true,
|
||||
color: Colors.deepPurpleAccent
|
||||
color: const Color.fromARGB(
|
||||
255, 65, 144, 86)
|
||||
.withOpacity(
|
||||
0.3), // Custom gradient color
|
||||
),
|
||||
@@ -267,7 +267,7 @@ class StaticDash extends StatelessWidget {
|
||||
),
|
||||
bottomTitles: AxisTitles(
|
||||
axisNameWidget: Text(
|
||||
'Total Drivers on month are Calliing ${staticController.staticList[0]['totalMonthlyCallingDrivers']}'
|
||||
'Total Rides on month ${staticController.totalMonthlyRides}'
|
||||
.tr,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
@@ -279,7 +279,7 @@ class StaticDash extends StatelessWidget {
|
||||
),
|
||||
leftTitles: AxisTitles(
|
||||
axisNameWidget: Text(
|
||||
'Counts of Drivers on days'.tr,
|
||||
'Counts of Rides on days'.tr,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold),
|
||||
@@ -308,6 +308,160 @@ class StaticDash extends StatelessWidget {
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
SizedBox(
|
||||
height: Get.height * .3,
|
||||
width: double.maxFinite,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(6),
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
height: MediaQuery.of(context).size.height * 0.4,
|
||||
child: LineChart(
|
||||
LineChartData(
|
||||
lineBarsData: [
|
||||
LineChartBarData(
|
||||
spots: staticController
|
||||
.chartDataEmployeeMaryam,
|
||||
isCurved: true,
|
||||
color:
|
||||
Colors.blue, // Custom color for Maryam
|
||||
barWidth: 3,
|
||||
dotData: const FlDotData(show: true),
|
||||
belowBarData: BarAreaData(
|
||||
show: true,
|
||||
color: Colors.blue.withOpacity(0.3)),
|
||||
),
|
||||
LineChartBarData(
|
||||
spots:
|
||||
staticController.chartDataEmployeeRawda,
|
||||
isCurved: true,
|
||||
color: Colors.red, // Custom color for Rawda
|
||||
barWidth: 3,
|
||||
dotData: const FlDotData(show: true),
|
||||
belowBarData: BarAreaData(
|
||||
show: true,
|
||||
color: Colors.red.withOpacity(0.3)),
|
||||
),
|
||||
LineChartBarData(
|
||||
spots:
|
||||
staticController.chartDataEmployeeMena,
|
||||
isCurved: true,
|
||||
color:
|
||||
Colors.green, // Custom color for Mena
|
||||
barWidth: 3,
|
||||
dotData: const FlDotData(show: true),
|
||||
belowBarData: BarAreaData(
|
||||
show: true,
|
||||
color: Colors.green.withOpacity(0.3)),
|
||||
),
|
||||
],
|
||||
titlesData: const FlTitlesData(
|
||||
bottomTitles: AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: true),
|
||||
),
|
||||
leftTitles: AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: true),
|
||||
),
|
||||
),
|
||||
gridData: const FlGridData(show: true),
|
||||
borderData: FlBorderData(show: true),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// SizedBox(
|
||||
// height: Get.height * .3,
|
||||
// width: double.maxFinite,
|
||||
// // decoration: AppStyle.boxDecoration1,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.all(6),
|
||||
// child: Container(
|
||||
// decoration: AppStyle.boxDecoration1,
|
||||
// height: MediaQuery.of(context).size.height * 0.4,
|
||||
// child: LineChart(
|
||||
// LineChartData(
|
||||
// lineBarsData: [
|
||||
// LineChartBarData(
|
||||
// isStepLineChart: true,
|
||||
// spots: staticController
|
||||
// .chartDataDriversCalling,
|
||||
// isCurved: true,
|
||||
// color: Colors
|
||||
// .deepPurpleAccent, // Custom color
|
||||
// barWidth: 3, // Thinner line
|
||||
// dotData: const FlDotData(
|
||||
// show:
|
||||
// true), // Show dots on each point
|
||||
// belowBarData: BarAreaData(
|
||||
// show: true,
|
||||
// color: Colors.deepPurpleAccent
|
||||
// .withOpacity(
|
||||
// 0.3), // Custom gradient color
|
||||
// ),
|
||||
// isStrokeJoinRound: true,
|
||||
// shadow: const BoxShadow(
|
||||
// color: Colors.yellow,
|
||||
// blurRadius: 4,
|
||||
// offset: Offset(2, 2),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// showingTooltipIndicators: const [],
|
||||
// titlesData: FlTitlesData(
|
||||
// show: true,
|
||||
// topTitles: AxisTitles(
|
||||
// axisNameWidget: Text(
|
||||
// 'Days'.tr,
|
||||
// style: const TextStyle(
|
||||
// fontSize: 14,
|
||||
// fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// axisNameSize: 30,
|
||||
// ),
|
||||
// bottomTitles: AxisTitles(
|
||||
// axisNameWidget: Text(
|
||||
// 'Total Drivers on month are Calliing ${staticController.staticList[0]['totalMonthlyCallingDrivers']}'
|
||||
// .tr,
|
||||
// style: AppStyle.subtitle,
|
||||
// ),
|
||||
// axisNameSize: 30,
|
||||
// sideTitles: const SideTitles(
|
||||
// reservedSize: 30,
|
||||
// showTitles: true,
|
||||
// ),
|
||||
// ),
|
||||
// leftTitles: AxisTitles(
|
||||
// axisNameWidget: Text(
|
||||
// 'Counts of Drivers on days'.tr,
|
||||
// style: const TextStyle(
|
||||
// fontSize: 14,
|
||||
// fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// axisNameSize: 30,
|
||||
// sideTitles: const SideTitles(
|
||||
// reservedSize: 30,
|
||||
// showTitles: true,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// gridData: const FlGridData(show: true),
|
||||
// borderData: FlBorderData(
|
||||
// show: true,
|
||||
// border: const Border(
|
||||
// bottom:
|
||||
// BorderSide(color: Colors.blueAccent),
|
||||
// left:
|
||||
// BorderSide(color: Colors.blueAccent),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// )),
|
||||
// const SizedBox(
|
||||
// height: 5,
|
||||
// ),
|
||||
SizedBox(
|
||||
height: Get.height * .3,
|
||||
width: double.maxFinite,
|
||||
|
||||
Reference in New Issue
Block a user