feat: استيراد كود سيرو إلى تريبز (سيرو @ecfe7568) — بلا تعديل
قرار المالك 2026-07-27: باك إند سيرو PHP هو المعتمد، وتطبيقاته المجرّبة ميدانياً تحل محل إعادة البناء المؤرشفة. سيرو نفسه لم يُمسّ. الخريطة: backend · payment_server · loction_server · ride_server · passenger_server · docker · dashboard · stress_test → الجذر siro_rider → apps/rider siro_driver → apps/driver siro_admin → dashboards/admin siro_service → dashboards/service android_bot → apps/android_bot socialBot → apps/socialBot نُسخ المتعقَّب في git سيرو فقط عبر `git archive` (3,198 ملفاً / ~169 م.ب) لا `cp -r` — فاستُثنيت مخلفات البناء تلقائياً. بلا أي تعديل محتوى عمداً: كل ما يلي يصير فرقاً مقروءاً مقابل المصدر. لم يُستورد وسببه: siromove.com (الموقع التسويقي يبقى marketing/ في تريبز، سيرو فيه 8 ملفات) · docs و planning (تريبز له docs/ الخاص) · deploy.sh (ليس نشراً على سيرفر بل `git add . && git push origin --all` — فخّ في مستودع آخر) · transit_dashboard (بانتظار قرار مصير backend-transit و dashboards/transit-web). ⚠️ لا يبني بعد — ثلاثة نواقص متوقعة ومقصودة: 1. `.env` و `lib/env/env.g.dart` غير متعقَّبين في سيرو (أسرار لكل مستأجر): كل تطبيق فلاتر يحتاج .env خاصاً ثم توليد env.g.dart بـ build_runner. 2. إعدادات Firebase (9 ملفات google-services.json و GoogleService-Info.plist) يستبعدها .gitignore تريبز — ولكل مستأجر مشروع Firebase خاص أصلاً. 3. apps/driver في سيرو يشير إلى `../../Intaleq/packages/get` خارج المستودع → يجب ضمّ الحزم داخله أسوة بـ apps/rider. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
9909d9b4c1
commit
4d8414c96b
@@ -0,0 +1,305 @@
|
||||
// transit_driver_home_page.dart — رحلات اليوم لسائق الباص (مواصلاتي)
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../controller/transit/transit_driver_controller.dart';
|
||||
import '../../controller/transit/transit_driver_models.dart';
|
||||
import '../widgets/elevated_btn.dart';
|
||||
import '../widgets/my_scafold.dart';
|
||||
import 'qr_scanner_page.dart';
|
||||
|
||||
class TransitDriverHomePage extends StatelessWidget {
|
||||
const TransitDriverHomePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(TransitDriverController());
|
||||
|
||||
return GetBuilder<TransitDriverController>(
|
||||
builder: (c) {
|
||||
// ── حالة التحميل ─────────────────────────────────────────
|
||||
if (c.isCheckingBusDriver) {
|
||||
return MyScafolld(
|
||||
title: 'Mawasalati'.tr,
|
||||
isleading: true,
|
||||
body: const [Column(children: [Expanded(child: Center(child: CircularProgressIndicator()))])],
|
||||
);
|
||||
}
|
||||
|
||||
// ── حساب غير مفعّل — شاشة إدخال التوكن ─────────────────
|
||||
if (!c.isBusDriver) {
|
||||
return _ActivationPage(controller: c);
|
||||
}
|
||||
|
||||
// ── رحلات اليوم ──────────────────────────────────────────
|
||||
return MyScafolld(
|
||||
title: c.orgName,
|
||||
isleading: true,
|
||||
body: [
|
||||
Column(
|
||||
children: [
|
||||
// بانر المحطة الحالية إن كانت هناك رحلة نشطة
|
||||
if (c.activeTrip != null && c.currentStop != null)
|
||||
_CurrentStopBanner(stop: c.currentStop!),
|
||||
|
||||
Expanded(
|
||||
child: RefreshIndicator(
|
||||
onRefresh: c.fetchTodayTrips,
|
||||
child: c.isLoadingTrips
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: c.todayTrips.isEmpty
|
||||
? ListView(
|
||||
children: [
|
||||
const SizedBox(height: 80),
|
||||
Center(
|
||||
child: Text('No trips today'.tr, style: AppStyle.title),
|
||||
),
|
||||
],
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.all(16),
|
||||
itemCount: c.todayTrips.length,
|
||||
itemBuilder: (_, i) => _tripCard(c, c.todayTrips[i]),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _tripCard(TransitDriverController c, TransitDriverTrip trip) {
|
||||
final isStarted = trip.status == 'started';
|
||||
final isCompleted = trip.status == 'completed';
|
||||
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 14),
|
||||
color: AppColor.cardColor,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
side: BorderSide(
|
||||
color: isStarted ? AppColor.greenColor : AppColor.borderColor,
|
||||
width: isStarted ? 1.5 : 1),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(14),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.directions_bus, color: AppColor.accentColor),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(trip.routeName,
|
||||
style: AppStyle.title.copyWith(fontWeight: FontWeight.bold)),
|
||||
),
|
||||
if (trip.departureTime != null)
|
||||
Text(trip.departureTime!, style: AppStyle.subtitle),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text('${trip.stops.length} ${'Stops'.tr}', style: AppStyle.subtitle),
|
||||
if (trip.delayMinutes > 0)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 6),
|
||||
child: Text(
|
||||
'${'Delayed by'.tr} ${trip.delayMinutes} ${'min'.tr}',
|
||||
style: AppStyle.subtitle.copyWith(color: AppColor.yellowColor)),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
if (!isCompleted)
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: MyElevatedButton(
|
||||
title: isStarted ? 'End Trip'.tr : 'Start Trip'.tr,
|
||||
kolor: isStarted ? AppColor.redColor : AppColor.greenColor,
|
||||
onPressed: c.isActionInProgress
|
||||
? () {}
|
||||
: () => isStarted ? c.endTrip(trip) : c.startTrip(trip),
|
||||
),
|
||||
),
|
||||
if (isStarted) ...[
|
||||
const SizedBox(width: 8),
|
||||
IconButton(
|
||||
icon: Icon(Icons.report_gmailerrorred, color: AppColor.yellowColor),
|
||||
onPressed: () => _showDelayDialog(c, trip),
|
||||
),
|
||||
],
|
||||
],
|
||||
)
|
||||
else
|
||||
Text('Trip completed'.tr,
|
||||
style: AppStyle.subtitle.copyWith(color: AppColor.greenColor)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showDelayDialog(TransitDriverController c, TransitDriverTrip trip) {
|
||||
final ctrl = TextEditingController(text: '5');
|
||||
Get.defaultDialog(
|
||||
title: 'Report Delay'.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
TextField(
|
||||
controller: ctrl,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(labelText: 'Number of minutes'.tr),
|
||||
),
|
||||
],
|
||||
),
|
||||
textConfirm: 'Send'.tr,
|
||||
textCancel: 'Cancel'.tr,
|
||||
onConfirm: () {
|
||||
final minutes = int.tryParse(ctrl.text.trim()) ?? 5;
|
||||
c.reportDelay(trip, minutes);
|
||||
Get.back();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ── شاشة التفعيل بتوكن الدعوة ──────────────────────────────────────────────
|
||||
|
||||
class _ActivationPage extends StatelessWidget {
|
||||
final TransitDriverController controller;
|
||||
const _ActivationPage({required this.controller});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final tokenCtrl = TextEditingController();
|
||||
|
||||
return MyScafolld(
|
||||
title: 'Mawasalati'.tr,
|
||||
isleading: true,
|
||||
body: [
|
||||
Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 40),
|
||||
Container(
|
||||
width: 88,
|
||||
height: 88,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.accentColor.withValues(alpha: 0.12),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(Icons.directions_bus_rounded,
|
||||
size: 46, color: AppColor.accentColor),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
'This account is not registered as a bus driver in any institution'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Activate Bus Driver Account'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
TextField(
|
||||
controller: tokenCtrl,
|
||||
textAlign: TextAlign.center,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Invite Token'.tr,
|
||||
hintText: 'Paste the token from the WhatsApp message'.tr,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16, vertical: 14),
|
||||
),
|
||||
),
|
||||
if (controller.activationError.isNotEmpty) ...[
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
controller.activationError,
|
||||
style: AppStyle.subtitle.copyWith(color: AppColor.redColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 20),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 55,
|
||||
child: controller.isActivating
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: MyElevatedButton(
|
||||
kolor: AppColor.accentColor,
|
||||
onPressed: () =>
|
||||
controller.activateWithToken(tokenCtrl.text),
|
||||
title: 'Activate'.tr,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextButton(
|
||||
onPressed: controller.checkBusDriverStatus,
|
||||
child: Text('Refresh'.tr,
|
||||
style: AppStyle.subtitle.copyWith(color: AppColor.accentColor)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ── بانر المحطة الحالية ──────────────────────────────────────────────────────
|
||||
|
||||
class _CurrentStopBanner extends StatelessWidget {
|
||||
final TransitStopInfo stop;
|
||||
const _CurrentStopBanner({required this.stop});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
color: AppColor.greenColor.withValues(alpha: 0.12),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_on_rounded, color: AppColor.greenColor, size: 18),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${'Now at'.tr}: ${stop.nameAr}',
|
||||
style: AppStyle.subtitle.copyWith(
|
||||
color: AppColor.greenColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 35,
|
||||
width: 80,
|
||||
child: MyElevatedButton(
|
||||
onPressed: () {
|
||||
Get.to(() => QRScannerPage(stopId: stop.id, stopName: stop.nameAr));
|
||||
},
|
||||
kolor: AppColor.accentColor,
|
||||
title: 'Scan'.tr,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user