This commit is contained in:
Hamza Aleghwairyeen
2024-04-12 23:06:59 +03:00
parent 766f930a30
commit 4e35874f2b
12 changed files with 177 additions and 110 deletions

View File

@@ -14,8 +14,8 @@ class AppLink {
static String addTokensDriver = "$server/ride/firebase/addDriver.php";
//=======================Wallet===================
static String wallet = '$server/ride/passengerWallet/';
static String walletDriver = '$server/ride/driverWallet/';
static String wallet = '$server/ride/passengerWallet';
static String walletDriver = '$server/ride/driverWallet';
static String getAllPassengerTransaction =
"$wallet/getAllPassengerTransaction.php";
static String getWalletByPassenger = "$wallet/getWalletByPassenger.php";

View File

@@ -173,6 +173,7 @@ class FirebaseMessagesController extends GetxController {
} else if (message.notification!.title! == 'RideIsBegin') {
Get.find<MapPassengerController>().getBeginRideFromDriver();
// Get.snackbar('RideIsBegin', '', backgroundColor: AppColor.greenColor);
box.write(BoxName.passengerWalletTotal, '0');
NotificationController()
.showNotification('Trip is Begin'.tr, ''.tr, 'start');
update();

View File

@@ -481,6 +481,7 @@ class MapDriverController extends GetxController {
});
print('passengerWalletBurc aft ${double.parse(passengerWalletBurc)}');
}
double pointsSubstraction = 0;
pointsSubstraction = double.parse(paymentAmount) *
(-1) *

View File

@@ -668,6 +668,7 @@ class MapPassengerController extends GetxController {
rideTimerBegin = false;
box.write(BoxName.arrivalTime, '');
remainingTimeTimerRideBegin = 0;
box.write(BoxName.passengerWalletTotal, '0');
update();
}

View File

@@ -21,7 +21,7 @@ class OrderHistoryController extends GetxController {
'passenger_id': box.read(BoxName.passengerID).toString(),
});
if (res.toString() == 'failure') {
Get.snackbar('failure', 'message');
// Get.snackbar('failure', 'message');
isloading = false;
update();
} else {

View File

@@ -440,6 +440,7 @@ class MyTranslation extends Translations {
'Submit Question': "طرح السؤال",
'Please enter your Question.': "الرجاء إدخال سؤالك.",
'Help Details': "تفاصيل المساعدة",
'No trip yet found': 'لم يتم حجز أي رحلة بعد ',
'No Response yet.': "لا يوجد رد بعد.",
' You Earn today is ': " ما حصلت عليه اليوم هو",
' You Have in': "لديك في",

View File

@@ -1,5 +1,7 @@
import 'dart:convert';
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/constant/links.dart';
@@ -16,11 +18,23 @@ class PassengerWalletHistoryController extends GetxController {
var res = await CRUD().get(
link: AppLink.getPassengerWalletArchive,
payload: {'passenger_id': box.read(BoxName.passengerID)});
archive = jsonDecode(res)['message'];
print(archive);
isLoading = false;
update();
if (res != 'failure') {
archive = jsonDecode(res)['message'];
print(archive);
isLoading = false;
update();
} else {}
Get.defaultDialog(
barrierDismissible: false,
title: 'No wallet record found'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'OK'.tr,
onPressed: () {
Get.back();
Get.back();
}));
}
@override

View File

@@ -42,7 +42,8 @@ class MapPagePassenger extends StatelessWidget {
const MapMenuWidget(),
const MenuIconMapPageWidget(),
buttomSheetMapPage(),
CarDetailsTypeToChoose(), const Burc(),
CarDetailsTypeToChoose(),
const Burc(),
const ApplyOrderWidget(),
// hexagonClipper(),
const CancelRidePageShow(),

View File

@@ -422,7 +422,7 @@ class Burc extends StatelessWidget {
' in your'
.tr +
' ${AppInformation.appName}'
'\n wallet due to a previous trip.'
' wallet due to a previous trip.'
.tr,
textAlign: TextAlign.center,
style: AppStyle.subtitle,

View File

@@ -18,34 +18,42 @@ class PaymentHistoryPassengerPage extends StatelessWidget {
GetBuilder<PassengerWalletHistoryController>(
builder: (controller) => controller.isLoading
? const MyCircularProgressIndicator()
: ListView.builder(
itemCount: controller.archive.length,
itemBuilder: (BuildContext context, int index) {
var list = controller.archive[index];
return Padding(
padding: const EdgeInsets.all(4),
child: Container(
decoration: BoxDecoration(
color: double.parse(list['balance']) < 0
? AppColor.redColor.withOpacity(.4)
: AppColor.greenColor.withOpacity(.4)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
list['balance'],
style: AppStyle.title,
),
Text(
list['created_at'],
style: AppStyle.title,
),
],
),
: controller.archive.isEmpty
? Center(
child: Text(
'No wallet record found'.tr,
style: AppStyle.title,
),
);
},
),
)
: ListView.builder(
itemCount: controller.archive.length,
itemBuilder: (BuildContext context, int index) {
var list = controller.archive[index];
return Padding(
padding: const EdgeInsets.all(4),
child: Container(
decoration: BoxDecoration(
color: double.parse(list['balance']) < 0
? AppColor.redColor.withOpacity(.4)
: AppColor.greenColor.withOpacity(.4)),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
list['balance'],
style: AppStyle.title,
),
Text(
list['created_at'],
style: AppStyle.title,
),
],
),
),
);
},
),
)
],
isleading: true);

View File

@@ -1,8 +1,11 @@
import 'package:SEFER/controller/home/map_passenger_controller.dart';
import 'package:SEFER/main.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/views/widgets/my_scafold.dart';
import 'package:SEFER/views/widgets/mycircular.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import '../../../constant/colors.dart';
import '../../../controller/functions/launch.dart';
@@ -23,80 +26,106 @@ class OrderHistory extends StatelessWidget {
GetBuilder<OrderHistoryController>(
builder: (orderHistoryController) => orderHistoryController.isloading
? const MyCircularProgressIndicator()
: ListView.builder(
itemCount:
orderHistoryController.orderHistoryListPassenger.length,
itemBuilder: (BuildContext context, int index) {
final rides =
orderHistoryController.orderHistoryListPassenger[index];
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12)),
color: AppColor.secondaryColor,
boxShadow: [
BoxShadow(
color: AppColor.accentColor,
offset: Offset(-3, -3),
blurRadius: 0,
spreadRadius: 0,
blurStyle: BlurStyle.outer),
BoxShadow(
color: AppColor.accentColor,
offset: Offset(3, 3),
blurRadius: 0,
spreadRadius: 0,
blurStyle: BlurStyle.outer)
]),
child: Padding(
: orderHistoryController.orderHistoryListPassenger.isEmpty
? Center(
child: Text(
'No trip yet found'.tr,
style: AppStyle.headTitle2,
),
)
: ListView.builder(
itemCount: orderHistoryController
.orderHistoryListPassenger.length,
itemBuilder: (BuildContext context, int index) {
final rides = orderHistoryController
.orderHistoryListPassenger[index];
return Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
InkWell(
onTap: () {
String mapUrl =
'https://www.google.com/maps/dir/${rides['start_location']}/${rides['end_location']}/';
// print(mapUrl);
showInBrowser(mapUrl);
},
child: Text(
'Click here to Show it in Map'.tr,
style: AppStyle.title,
),
),
Column(
child: Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
rides['date'],
style: AppStyle.subtitle,
InkWell(
onTap: () {
String mapUrl =
'https://www.google.com/maps/dir/${rides['start_location']}/${rides['end_location']}/';
// print(mapUrl);
showInBrowser(mapUrl);
},
child: SizedBox(
height: Get.height * .2,
width: Get.width * .75,
child: GoogleMap(
initialCameraPosition: CameraPosition(
target: Get.find<
MapPassengerController>()
.passengerLocation, // Assuming passenger location is available
zoom: 15,
),
polylines: {
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId:
const PolylineId('route'),
points: [
LatLng(
rides['start_location']
['latitude'],
rides['start_location']
['longitude']),
LatLng(
rides['end_location']
['latitude'],
rides['end_location']
['longitude']),
],
color: AppColor.primaryColor,
width: 5,
),
},
),
),
),
Text(
rides['time'],
style: AppStyle.subtitle,
),
Text(
rides['status'],
style: rides['status'] != 'Canceled'.tr
? AppStyle.subtitle.copyWith(
color: AppColor.greenColor)
: AppStyle.subtitle
.copyWith(color: AppColor.redColor),
),
Text(
'${'Price is'.tr} ${rides['price']}',
style: AppStyle.subtitle,
Column(
children: [
Text(
rides['date'],
style: AppStyle.subtitle,
),
Text(
rides['time'],
style: AppStyle.subtitle,
),
Text(
rides['status'],
style: rides['status'] != 'Canceled'.tr
? AppStyle.subtitle.copyWith(
color: AppColor.greenColor)
: AppStyle.subtitle.copyWith(
color: AppColor.redColor),
),
Text(
'${'Price is'.tr} ${rides['price']}',
style: AppStyle.subtitle,
),
],
),
],
),
],
),
),
),
),
);
},
),
);
},
),
)
],
);

View File

@@ -1,3 +1,5 @@
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/main.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/style.dart';
@@ -25,25 +27,34 @@ class TaarifPage extends StatelessWidget {
// decoration: AppStyle.boxDecoration,
children: [
Text('Minimum fare'.tr, style: AppStyle.title),
Text('1 ${'JOD'.tr}', style: AppStyle.title),
box.read(BoxName.countryCode) == 'Jordan'
? Text('1 ${'JOD'.tr}', style: AppStyle.title)
: Text('20 ${'LE'.tr}', style: AppStyle.title),
],
),
TableRow(
children: [
Text('Maximum fare'.tr, style: AppStyle.title),
Text('200 ${'JOD'.tr}', style: AppStyle.title),
box.read(BoxName.countryCode) == 'Jordan'
? Text('200 ${'JOD'.tr}', style: AppStyle.title)
: Text('15000 ${'LE'.tr}', style: AppStyle.title),
],
),
TableRow(
children: [
Text('Flag-down fee'.tr, style: AppStyle.title),
Text('0.47 ${'JOD'.tr}', style: AppStyle.title),
box.read(BoxName.countryCode) == 'Jordan'
? Text('0.47 ${'JOD'.tr}', style: AppStyle.title)
: Text('15 ${'LE'.tr}', style: AppStyle.title),
],
),
TableRow(
children: [
Text('0.05 ${'JOD'.tr}/min and 0.21 ${'JOD'.tr}/km',
style: AppStyle.title),
box.read(BoxName.countryCode) == 'Jordan'
? Text('0.05 ${'JOD'.tr}/min and 0.21 ${'JOD'.tr}/km',
style: AppStyle.title)
: Text('1 ${'LE'.tr}/min and 4 ${'LE'.tr}/km',
style: AppStyle.title),
Text('Including Tax'.tr, style: AppStyle.title),
],
),
@@ -52,7 +63,7 @@ class TaarifPage extends StatelessWidget {
const SizedBox(height: 10),
Text('BookingFee'.tr, style: AppStyle.headTitle2),
const SizedBox(height: 10),
Text('4.17%', style: AppStyle.title),
Text('10%', style: AppStyle.title),
const SizedBox(height: 20),
Text('Morning'.tr, style: AppStyle.headTitle2),
const SizedBox(height: 10),