95 lines
3.0 KiB
Dart
95 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
import '../core/models/reservation.dart';
|
|
import 'status_badge.dart';
|
|
|
|
class ReservationCard extends StatelessWidget {
|
|
final Reservation reservation;
|
|
final VoidCallback? onTap;
|
|
|
|
const ReservationCard({super.key, required this.reservation, this.onTap});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final fmt = DateFormat('MMM d, yyyy');
|
|
final cs = Theme.of(context).colorScheme;
|
|
|
|
return Card(
|
|
child: InkWell(
|
|
onTap: onTap,
|
|
borderRadius: BorderRadius.circular(12),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(14),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
reservation.vehicle?.displayName ?? 'Reservation',
|
|
style: const TextStyle(
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 15,
|
|
),
|
|
),
|
|
),
|
|
StatusBadge(status: reservation.status),
|
|
],
|
|
),
|
|
if (reservation.customer != null) ...[
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
reservation.customer!.fullName,
|
|
style: TextStyle(
|
|
fontSize: 13,
|
|
color: cs.onSurfaceVariant,
|
|
),
|
|
),
|
|
],
|
|
const SizedBox(height: 10),
|
|
Row(
|
|
children: [
|
|
Icon(
|
|
Icons.calendar_today,
|
|
size: 14,
|
|
color: cs.onSurfaceVariant.withValues(alpha: 0.8),
|
|
),
|
|
const SizedBox(width: 4),
|
|
Text(
|
|
'${fmt.format(reservation.startDate)} → ${fmt.format(reservation.endDate)}',
|
|
style: TextStyle(
|
|
fontSize: 13,
|
|
color: cs.onSurfaceVariant,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 6),
|
|
Row(
|
|
children: [
|
|
Icon(
|
|
Icons.attach_money,
|
|
size: 14,
|
|
color: cs.onSurfaceVariant.withValues(alpha: 0.8),
|
|
),
|
|
const SizedBox(width: 4),
|
|
Text(
|
|
'\$${(reservation.totalAmount / 100).toStringAsFixed(2)}',
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w600,
|
|
color: cs.onSurface,
|
|
),
|
|
),
|
|
const SizedBox(width: 8),
|
|
StatusBadge(status: reservation.paymentStatus),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|