|
|
|
|
@ -30,15 +30,15 @@ class _DashboardViewState extends State<DashboardView> {
|
|
|
|
|
log("widget.dashboardRouteEnum: ${widget.dashboardRouteEnum}");
|
|
|
|
|
super.initState();
|
|
|
|
|
dashboardVMProvider = Provider.of<DashboardVMProvider>(context, listen: false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Ensure selected index is valid for individual providers (no Requests tab)
|
|
|
|
|
if (AppState().userType != UserType.providerDealer) {
|
|
|
|
|
if (AppState().userType != UserType.providerDealer && AppState().userType != UserType.dealershipUser) {
|
|
|
|
|
// For individuals, max index is 3 (Ads), so if selected is 4, set to Home (2)
|
|
|
|
|
if (dashboardVMProvider.selectedNavbarBarIndex >= 4) {
|
|
|
|
|
dashboardVMProvider.selectedNavbarBarIndex = 2; // Home
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scheduleMicrotask(() => dashboardVMProvider.onRefresh(context, dashboardRouteEnum: widget.dashboardRouteEnum));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -47,13 +47,12 @@ class _DashboardViewState extends State<DashboardView> {
|
|
|
|
|
// Build fragments list conditionally based on user type
|
|
|
|
|
// Individual providers should not have access to Requests
|
|
|
|
|
List<Widget> fragments = [
|
|
|
|
|
const BranchListPage(), // 0
|
|
|
|
|
const BranchListPage(), // 0
|
|
|
|
|
const BranchAppointmentFragment(), // 1
|
|
|
|
|
const HomeFragment(), // 2
|
|
|
|
|
const AdsFragment(), // 3
|
|
|
|
|
// Only Dealerships can access Special Requests
|
|
|
|
|
if (AppState().userType == UserType.providerDealer)
|
|
|
|
|
const MyRequestsFragment(), // 4 (only for dealerships)
|
|
|
|
|
const HomeFragment(), // 2
|
|
|
|
|
const AdsFragment(), // 3
|
|
|
|
|
// Only Dealerships (and dealership staff users) can access Special Requests
|
|
|
|
|
if (AppState().userType == UserType.providerDealer || AppState().userType == UserType.dealershipUser) const MyRequestsFragment(), // 4 (only for dealerships)
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// Ensure the selected index is valid for the current fragments list
|
|
|
|
|
|