chore: أرشفة تطبيقات ولوحات تريبز التي سيحلّ محلها كود سيرو

استكمال قرار 2026-07-27 (كوميت fff76c9 أرشف الباك إند):
  apps/rider          → apps/rider-archive-cubit
  apps/driver         → apps/driver-archive-cubit
  dashboards/admin-web    → dashboards/admin-web-archive
  dashboards/service-web  → dashboards/service-web-archive

إعادة تسمية بلا تعديل محتوى. rider/driver كانا إعادة بناء Cubit مبنية على
عقد NestJS المؤرشف. admin-web و service-web نموذجان بملف HTML واحد (164 و
128 سطراً) — يحلّ محلهما siro_admin و siro_service المكتملان.

يُحمل من المؤرشف ولا يُعاد اكتشافه: عقد map-saas المثبَّت بالتجربة في
apps/rider-archive-cubit/lib/core/api/ (x-api-key ترويسة، reverse مصفوفة،
route في points) ودرس مسار FCM.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Hamza-Ayed
2026-07-27 05:12:04 +03:00
co-authored by Claude Opus 5
parent fff76c949f
commit 9909d9b4c1
809 changed files with 0 additions and 0 deletions
@@ -0,0 +1,32 @@
import 'package:equatable/equatable.dart';
import 'package:intaleq_maps/intaleq_maps.dart';
/// باب/مدخل مكان — من استجابة انطلق.
class Gate extends Equatable {
final String nameAr;
final String nameEn;
final double lat;
final double lng;
final bool isMainGate;
const Gate({
required this.nameAr,
required this.nameEn,
required this.lat,
required this.lng,
this.isMainGate = false,
});
factory Gate.fromJson(Map<String, dynamic> j) => Gate(
nameAr: (j['name_ar'] ?? '') as String,
nameEn: (j['name_en'] ?? '') as String,
lat: (j['latitude'] as num).toDouble(),
lng: (j['longitude'] as num).toDouble(),
isMainGate: j['is_main_gate'] as bool? ?? false,
);
LatLng get latLng => LatLng(lat, lng);
@override
List<Object?> get props => [nameAr, nameEn, lat, lng, isMainGate];
}
@@ -0,0 +1,71 @@
import 'package:equatable/equatable.dart';
import 'gate_model.dart';
/// نموذج مكان من نتائج بحث انطلق (geocode / search).
class PlaceModel extends Equatable {
final String? placeId;
final String name;
final String? address;
final double lat;
final double lng;
final String? category;
final double? totalScore;
final String? source;
final List<Gate> gates;
const PlaceModel({
this.placeId,
required this.name,
this.address,
required this.lat,
required this.lng,
this.category,
this.totalScore,
this.source,
this.gates = const [],
});
/// استجابة انطلق الحقيقية — الحقول الم标准.
factory PlaceModel.fromJson(Map<String, dynamic> j) {
final lat = (j['latitude'] ?? j['location']?['lat'] ?? 0) as num;
final lng = (j['longitude'] ?? j['location']?['lng'] ?? 0) as num;
return PlaceModel(
placeId: j['id'] as String?,
name: (j['name'] ?? '') as String,
address: (j['full_address'] ?? j['address']) as String?,
lat: lat.toDouble(),
lng: lng.toDouble(),
category: j['category'] as String?,
totalScore: (j['totalScore'] as num?)?.toDouble(),
source: j['source'] as String?,
gates: (j['gates'] as List?)
?.map((g) => Gate.fromJson(g as Map<String, dynamic>))
.toList() ??
const [],
);
}
Map<String, dynamic> toJson() => {
if (placeId != null) 'id': placeId,
'name': name,
if (address != null) 'full_address': address,
'latitude': lat,
'longitude': lng,
if (category != null) 'category': category,
if (totalScore != null) 'totalScore': totalScore,
if (source != null) 'source': source,
};
/// هل لهذا المكان أبواب متعددة?
bool get hasMultipleGates => gates.length > 1;
/// الباب الرئيسي إن وُجد.
Gate? get mainGate => gates.cast<Gate?>().firstWhere(
(g) => g!.isMainGate,
orElse: () => null,
);
@override
List<Object?> get props =>
[placeId, name, address, lat, lng, category, totalScore, source, gates];
}
@@ -0,0 +1,85 @@
import 'package:equatable/equatable.dart';
/// فئة رحلة واحدة من الاستجابة (tariff/quote).
class QuoteClassModel extends Equatable {
final String vehicleClass;
final String name;
final int price;
final String currency;
final int capacity;
final String? description;
final String? imageUrl;
final int estimatedTime; // ثوانٍ تقريبية
const QuoteClassModel({
required this.vehicleClass,
required this.name,
required this.price,
required this.currency,
required this.capacity,
this.description,
this.imageUrl,
required this.estimatedTime,
});
factory QuoteClassModel.fromJson(Map<String, dynamic> j) => QuoteClassModel(
vehicleClass: j['vehicleClass'] as String,
name: (j['name'] ?? j['vehicleClass']) as String,
price: j['price'] as int,
currency: (j['currency'] ?? 'JOD') as String,
capacity: j['capacity'] as int? ?? 4,
description: j['description'] as String?,
imageUrl: j['imageUrl'] as String?,
estimatedTime: j['estimatedTime'] as int? ?? 0,
);
String get estimatedTimeText {
final min = estimatedTime ~/ 60;
return '$min min';
}
@override
List<Object?> get props => [vehicleClass, name, price, currency, capacity];
}
/// استجابة tariff/quote الكاملة.
class QuoteModel extends Equatable {
final String? pickupAddress;
final String? dropoffAddress;
final int distanceMeters;
final int durationSeconds;
final String? distanceText;
final String? durationText;
final String currency;
final List<QuoteClassModel> classes;
const QuoteModel({
this.pickupAddress,
this.dropoffAddress,
required this.distanceMeters,
required this.durationSeconds,
this.distanceText,
this.durationText,
required this.currency,
required this.classes,
});
factory QuoteModel.fromJson(Map<String, dynamic> j) {
final data = j['data'] ?? j;
return QuoteModel(
pickupAddress: data['pickupAddress'] as String?,
dropoffAddress: data['dropoffAddress'] as String?,
distanceMeters: (data['distanceMeters'] as num?)?.toInt() ?? 0,
durationSeconds: (data['durationSeconds'] as num?)?.toInt() ?? 0,
distanceText: data['distanceText'] as String?,
durationText: data['durationText'] as String?,
currency: (data['currency'] ?? 'JOD') as String,
classes: (data['classes'] as List? ?? [])
.map((c) => QuoteClassModel.fromJson(c as Map<String, dynamic>))
.toList(),
);
}
@override
List<Object?> get props => [distanceMeters, durationSeconds, currency, classes];
}
@@ -0,0 +1,35 @@
import 'package:equatable/equatable.dart';
/// فئة رحلة من ride-types endpoint (تُستخدم كقائمة المرجع).
class RideTypeModel extends Equatable {
final String id;
final String name;
final String? vehicleClass;
final int capacity;
final String? description;
final String? imageUrl;
final bool active;
const RideTypeModel({
required this.id,
required this.name,
this.vehicleClass,
required this.capacity,
this.description,
this.imageUrl,
required this.active,
});
factory RideTypeModel.fromJson(Map<String, dynamic> j) => RideTypeModel(
id: j['id'] as String,
name: (j['name'] ?? '') as String,
vehicleClass: j['vehicleClass'] as String?,
capacity: j['capacity'] as int? ?? 4,
description: j['description'] as String?,
imageUrl: j['imageUrl'] as String?,
active: j['active'] as bool? ?? true,
);
@override
List<Object?> get props => [id, name, vehicleClass, capacity, active];
}
@@ -0,0 +1,103 @@
import 'package:equatable/equatable.dart';
import 'package:intaleq_maps/intaleq_maps.dart';
/// استجابة مسار من انطلق — مع polyline مشفر وإطار خريطة.
class RouteModel extends Equatable {
final int distanceMeters;
final int durationSeconds;
final String? polyline;
final String? routeName;
final String? startName;
final String? endName;
final List<String>? tags;
final List<double>? bbox;
final double? trafficFactor;
const RouteModel({
required this.distanceMeters,
required this.durationSeconds,
this.polyline,
this.routeName,
this.startName,
this.endName,
this.tags,
this.bbox,
this.trafficFactor,
});
/// استجابة مسار انطلق الحقيقية (تُمرر عبر الباك إند كما هي).
factory RouteModel.fromJson(Map<String, dynamic> j) {
final dist = (j['distance'] ?? 0) as num;
final dur = (j['duration'] ?? 0) as num;
return RouteModel(
distanceMeters: dist.toInt(),
durationSeconds: dur.toInt(),
polyline: j['points'] as String?,
routeName: j['routeName'] as String?,
startName: j['startName'] as String?,
endName: j['endName'] as String?,
tags: (j['tags'] as List?)?.cast<String>(),
bbox: (j['bbox'] as List?)?.map((e) => (e as num).toDouble()).toList(),
trafficFactor: (j['trafficFactor'] as num?)?.toDouble(),
);
}
String get distanceText {
if (distanceMeters < 1000) return '$distanceMeters m';
return '${(distanceMeters / 1000).toStringAsFixed(1)} km';
}
String get durationText {
final min = durationSeconds ~/ 60;
if (min < 60) return '$min min';
final h = min ~/ 60;
final rem = min % 60;
return '$h h ${rem > 0 ? '$rem min' : ''}';
}
/// تحويل bbox إلى LatLngBounds لضبط الكاميرا مع حماية للمواقع القريبة على iOS.
LatLngBounds? getLatLngBounds() {
if (bbox == null || bbox!.length < 4) return null;
var minLat = bbox![1];
var minLng = bbox![0];
var maxLat = bbox![3];
var maxLng = bbox![2];
// إذا كانت المسافة بين النقاط قريبة جداً (أقل من 0.002 درجة)، نضمن توسعاً أمنياً أدنى لمنع عطل وقفل كاميرا MapLibre على iOS
if ((maxLat - minLat).abs() < 0.002) {
minLat -= 0.001;
maxLat += 0.001;
}
if ((maxLng - minLng).abs() < 0.002) {
minLng -= 0.001;
maxLng += 0.001;
}
return LatLngBounds(
southwest: LatLng(minLat, minLng),
northeast: LatLng(maxLat, maxLng),
);
}
/// فك الـ polyline عبر PolylineUtils من الباكيج.
List<LatLng> decodePolyline() {
if (polyline == null || polyline!.isEmpty) return [];
return PolylineUtils.decode(polyline!);
}
/// هل المسار مباشر (لا أضلاع)?
bool get isStraightLine => tags?.contains('straight-line') ?? false;
@override
List<Object?> get props => [
distanceMeters,
durationSeconds,
polyline,
routeName,
startName,
endName,
tags,
bbox,
trafficFactor,
];
}
@@ -0,0 +1,33 @@
import 'package:equatable/equatable.dart';
/// نقطة توقف أثناء الرحلة.
class StopModel extends Equatable {
final double lat;
final double lng;
final String? label;
final String? address;
const StopModel({
required this.lat,
required this.lng,
this.label,
this.address,
});
factory StopModel.fromJson(Map<String, dynamic> j) => StopModel(
lat: (j['lat'] as num).toDouble(),
lng: (j['lng'] as num).toDouble(),
label: j['label'] as String?,
address: j['address'] as String?,
);
Map<String, dynamic> toJson() => {
'lat': lat,
'lng': lng,
if (label != null) 'label': label,
if (address != null) 'address': address,
};
@override
List<Object?> get props => [lat, lng, label, address];
}