fix phone dashboard

This commit is contained in:
root
2026-05-27 03:11:45 -04:00
parent 7ca43ba2f3
commit 1112b04516
48 changed files with 1222 additions and 368 deletions
+31 -4
View File
@@ -31,7 +31,6 @@ import '../../features/client/screens/booking_screen.dart';
import '../../features/client/screens/booking_confirmation_screen.dart';
import '../../features/client/screens/my_bookings_screen.dart';
import '../../features/client/models/booking_result.dart';
import '../../features/agency_webview/screens/agency_dashboard_webview_screen.dart';
final routerProvider = Provider<GoRouter>((ref) {
final router = GoRouter(
@@ -43,6 +42,7 @@ final routerProvider = Provider<GoRouter>((ref) {
final isSplash = loc == '/splash';
final isLanding = loc == '/landing';
final isLogin = loc.startsWith('/login');
final isAgency = loc == '/agency';
if (status == AuthStatus.unknown) {
return isSplash ? null : '/splash';
@@ -57,12 +57,20 @@ final routerProvider = Provider<GoRouter>((ref) {
return '/landing';
}
if (isAgency) {
if (status == AuthStatus.authenticated) {
return auth.userType == AppConstants.userTypeEmployee
? '/dashboard'
: '/client';
}
return '/login/employee';
}
if (status == AuthStatus.unauthenticated) {
if (isLanding ||
isLogin ||
loc.startsWith('/client') ||
loc == '/role' ||
loc == '/agency') {
loc == '/role') {
return null;
}
return '/landing';
@@ -90,6 +98,10 @@ final routerProvider = Provider<GoRouter>((ref) {
path: '/dashboard/vehicles',
builder: (context, _) => const VehiclesScreen(),
),
GoRoute(
path: '/dashboard/fleet',
builder: (context, _) => const VehiclesScreen(),
),
GoRoute(
path: '/dashboard/reservations',
builder: (context, _) => const ReservationsScreen(),
@@ -103,6 +115,11 @@ final routerProvider = Provider<GoRouter>((ref) {
builder: (_, state) =>
VehicleDetailScreen(id: state.pathParameters['id']!),
),
GoRoute(
path: '/dashboard/fleet/:id',
builder: (_, state) =>
VehicleDetailScreen(id: state.pathParameters['id']!),
),
GoRoute(
path: '/dashboard/reservations/:id',
builder: (_, state) =>
@@ -178,7 +195,7 @@ final routerProvider = Provider<GoRouter>((ref) {
),
GoRoute(
path: '/agency',
builder: (context, _) => const AgencyDashboardWebViewScreen(),
builder: (context, _) => const EmployeeLoginScreen(),
),
GoRoute(
path: '/dashboard/reservations/new',
@@ -188,12 +205,22 @@ final routerProvider = Provider<GoRouter>((ref) {
path: '/dashboard/vehicles/new',
builder: (context, _) => const VehicleFormScreen(),
),
GoRoute(
path: '/dashboard/fleet/new',
builder: (context, _) => const VehicleFormScreen(),
),
GoRoute(
path: '/dashboard/vehicles/:id/edit',
builder: (_, state) => VehicleFormScreen(
vehicle: state.extra as dynamic,
),
),
GoRoute(
path: '/dashboard/fleet/:id/edit',
builder: (_, state) => VehicleFormScreen(
vehicle: state.extra as dynamic,
),
),
GoRoute(
path: '/dashboard/customers/new',
builder: (context, _) => const CustomerFormScreen(),