Fix: promos discount query and compact car details layout
This commit is contained in:
@@ -376,7 +376,7 @@ $discount = 0;
|
|||||||
if (!empty($promo_code)) {
|
if (!empty($promo_code)) {
|
||||||
$sqlPromo = "SELECT amount FROM `promos`
|
$sqlPromo = "SELECT amount FROM `promos`
|
||||||
WHERE promo_code = :promo_code
|
WHERE promo_code = :promo_code
|
||||||
AND (passengerID = :passenger_id OR passengerID LIKE '%all%')
|
AND (passengerID = :passenger_id OR passengerID IN ('', 'none', 'all') OR passengerID LIKE '%all%')
|
||||||
AND validity_start_date <= CURDATE()
|
AND validity_start_date <= CURDATE()
|
||||||
AND validity_end_date >= CURDATE()";
|
AND validity_end_date >= CURDATE()";
|
||||||
$stmtPromo = $con->prepare($sqlPromo);
|
$stmtPromo = $con->prepare($sqlPromo);
|
||||||
|
|||||||
@@ -53,7 +53,12 @@ class MapEngineController extends GetxController {
|
|||||||
double mainBottomMenuMapHeight = Get.height * .2;
|
double mainBottomMenuMapHeight = Get.height * .2;
|
||||||
double wayPointSheetHeight = 0;
|
double wayPointSheetHeight = 0;
|
||||||
bool heightMenuBool = false;
|
bool heightMenuBool = false;
|
||||||
bool isPickerShown = false;
|
bool _isPickerShown = false;
|
||||||
|
bool get isPickerShown => _isPickerShown;
|
||||||
|
set isPickerShown(bool value) {
|
||||||
|
_isPickerShown = value;
|
||||||
|
update();
|
||||||
|
}
|
||||||
bool isPointsPageForRider = false;
|
bool isPointsPageForRider = false;
|
||||||
bool isBottomSheetShown = false;
|
bool isBottomSheetShown = false;
|
||||||
bool reloadStartApp = false;
|
bool reloadStartApp = false;
|
||||||
@@ -678,8 +683,8 @@ class MapEngineController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void changePickerShown() {
|
void changePickerShown() {
|
||||||
isPickerShown = !isPickerShown;
|
_isPickerShown = !_isPickerShown;
|
||||||
heightPickerContainer = isPickerShown == true ? 150 : 90;
|
heightPickerContainer = _isPickerShown == true ? 150 : 90;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ class PickerIconOnMap extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GetBuilder<RideLifecycleController>(
|
return GetBuilder<MapEngineController>(
|
||||||
builder: (controller) => controller.isPickerShown
|
builder: (controller) => controller.isPickerShown
|
||||||
? Positioned(
|
? Positioned(
|
||||||
bottom: Get.height * .2,
|
bottom: Get.height * .2,
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
|||||||
child: Container(
|
child: Container(
|
||||||
width: 40,
|
width: 40,
|
||||||
height: 4,
|
height: 4,
|
||||||
margin: const EdgeInsets.only(top: 12, bottom: 8),
|
margin: const EdgeInsets.only(top: 8, bottom: 4),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.grey.shade300,
|
color: Colors.grey.shade300,
|
||||||
borderRadius: BorderRadius.circular(2),
|
borderRadius: BorderRadius.circular(2),
|
||||||
@@ -137,11 +137,11 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
|||||||
|
|
||||||
// ── Car Selection List ───────────────────────────────
|
// ── Car Selection List ───────────────────────────────
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 170,
|
height: 120,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
padding: const EdgeInsets.fromLTRB(20, 8, 20, 12),
|
padding: const EdgeInsets.fromLTRB(20, 4, 20, 6),
|
||||||
itemCount: carTypes.length,
|
itemCount: carTypes.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final carType = carTypes[index];
|
final carType = carTypes[index];
|
||||||
@@ -159,7 +159,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
|||||||
// ── Promo Code & Actions ─────────────────────────────
|
// ── Promo Code & Actions ─────────────────────────────
|
||||||
_buildPromoButton(context, controller),
|
_buildPromoButton(context, controller),
|
||||||
|
|
||||||
SizedBox(height: MediaQuery.of(context).padding.bottom + 10),
|
SizedBox(height: MediaQuery.of(context).padding.bottom + 4),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -174,7 +174,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
|||||||
// ═══════════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
Widget _buildHeader(RideLifecycleController controller) {
|
Widget _buildHeader(RideLifecycleController controller) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(22, 4, 22, 8),
|
padding: const EdgeInsets.fromLTRB(22, 2, 22, 4),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@@ -211,7 +211,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 6),
|
||||||
// Trip Stats Row
|
// Trip Stats Row
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -265,7 +265,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
|||||||
Widget _buildStatChip(
|
Widget _buildStatChip(
|
||||||
{required IconData icon, required String value, required Color color}) {
|
{required IconData icon, required String value, required Color color}) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: color.withAlpha(20),
|
color: color.withAlpha(20),
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
@@ -303,7 +303,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
|||||||
child: AnimatedContainer(
|
child: AnimatedContainer(
|
||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
curve: Curves.easeOutCubic,
|
curve: Curves.easeOutCubic,
|
||||||
width: 108,
|
width: 104,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: isSelected
|
gradient: isSelected
|
||||||
? LinearGradient(
|
? LinearGradient(
|
||||||
@@ -338,8 +338,8 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
|||||||
// Selected indicator
|
// Selected indicator
|
||||||
if (isSelected)
|
if (isSelected)
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 6,
|
top: 4,
|
||||||
right: 6,
|
right: 4,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 18,
|
height: 18,
|
||||||
@@ -364,7 +364,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
|||||||
|
|
||||||
// Card content
|
// Card content
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(8, 10, 8, 8),
|
padding: const EdgeInsets.fromLTRB(6, 6, 6, 6),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
@@ -374,11 +374,11 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
|||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
carType.image,
|
carType.image,
|
||||||
height: 48,
|
height: 44,
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 4),
|
||||||
|
|
||||||
// Car name
|
// Car name
|
||||||
FittedBox(
|
FittedBox(
|
||||||
@@ -388,7 +388,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight:
|
fontWeight:
|
||||||
isSelected ? FontWeight.w800 : FontWeight.w600,
|
isSelected ? FontWeight.w800 : FontWeight.w600,
|
||||||
fontSize: 13,
|
fontSize: 12,
|
||||||
color: isSelected
|
color: isSelected
|
||||||
? AppColor.primaryColor
|
? AppColor.primaryColor
|
||||||
: AppColor.writeColor,
|
: AppColor.writeColor,
|
||||||
@@ -397,12 +397,12 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
const SizedBox(height: 6),
|
const SizedBox(height: 3),
|
||||||
|
|
||||||
// Price tag
|
// Price tag
|
||||||
Container(
|
Container(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: isSelected
|
color: isSelected
|
||||||
? AppColor.primaryColor
|
? AppColor.primaryColor
|
||||||
@@ -443,14 +443,14 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
|||||||
if (controller.promoTaken) return const SizedBox.shrink();
|
if (controller.promoTaken) return const SizedBox.shrink();
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(20, 6, 20, 4),
|
padding: const EdgeInsets.fromLTRB(20, 4, 20, 2),
|
||||||
child: Material(
|
child: Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => _showPromoCodeDialog(context, controller),
|
onTap: () => _showPromoCodeDialog(context, controller),
|
||||||
borderRadius: BorderRadius.circular(14),
|
borderRadius: BorderRadius.circular(14),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 14),
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
colors: [
|
colors: [
|
||||||
@@ -951,7 +951,11 @@ class CarDetailsTypeToChoose extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRayehGaiOption(BuildContext context, RideLifecycleController mapPassengerController, String carTypeName, String price) {
|
Widget _buildRayehGaiOption(
|
||||||
|
BuildContext context,
|
||||||
|
RideLifecycleController mapPassengerController,
|
||||||
|
String carTypeName,
|
||||||
|
String price) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class PromosPassengerPage extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
promo['description'],
|
promo['description']?.toString() ?? '',
|
||||||
style: AppStyle.headTitle.copyWith(fontSize: 18),
|
style: AppStyle.headTitle.copyWith(fontSize: 18),
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
@@ -104,7 +104,7 @@ class PromosPassengerPage extends StatelessWidget {
|
|||||||
size: 14, color: Colors.grey),
|
size: 14, color: Colors.grey),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
Text(
|
Text(
|
||||||
'${'Valid Until:'.tr} ${promo['validity_end_date']}',
|
'${'Valid Until:'.tr} ${promo['validity_end_date']?.toString() ?? ''}',
|
||||||
style: AppStyle.subtitle
|
style: AppStyle.subtitle
|
||||||
.copyWith(fontSize: 12, color: Colors.grey),
|
.copyWith(fontSize: 12, color: Colors.grey),
|
||||||
),
|
),
|
||||||
@@ -131,9 +131,10 @@ class PromosPassengerPage extends StatelessWidget {
|
|||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// --- نفس منطقك القديم للنسخ ---
|
// --- نفس منطقك القديم للنسخ ---
|
||||||
Clipboard.setData(
|
Clipboard.setData(ClipboardData(
|
||||||
ClipboardData(text: promo['promo_code']));
|
text: promo['promo_code']?.toString() ?? ''));
|
||||||
mySnackbarSuccess('${'Code'.tr} ${promo['promo_code']} ${'copied to clipboard'.tr}');
|
mySnackbarSuccess(
|
||||||
|
'${'Code'.tr} ${promo['promo_code']?.toString() ?? ''} ${'copied to clipboard'.tr}');
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
color: AppColor.primaryColor.withOpacity(0.1),
|
color: AppColor.primaryColor.withOpacity(0.1),
|
||||||
@@ -147,7 +148,7 @@ class PromosPassengerPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
promo['promo_code'],
|
promo['promo_code']?.toString() ?? '',
|
||||||
style: AppStyle.headTitle.copyWith(
|
style: AppStyle.headTitle.copyWith(
|
||||||
fontSize: 24, color: AppColor.primaryColor),
|
fontSize: 24, color: AppColor.primaryColor),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user