استكمال قرار 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>
86 lines
2.6 KiB
Dart
86 lines
2.6 KiB
Dart
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];
|
|
}
|