Enhance Customer model to include role attribute and update related components
- Added a new `role` attribute to the `Customer` model in `customer.dart` and updated the corresponding generated files. - Modified the `AuthViewModel` to set the user role based on the logged-in user's role. - Updated UI components in `TenderDetailActions` and `DesktopTendersPage` to conditionally render elements based on the user's role. - Refactored tests to validate the new role attribute in the `Customer` model.
This commit is contained in:
@@ -17,6 +17,7 @@ import 'package:tm_app/views/tenders/widgets/tenders_sort_dialog.dart';
|
||||
|
||||
import '../../../core/constants/common_strings.dart';
|
||||
import '../../../core/utils/app_toast.dart';
|
||||
import '../../../view_models/auth_view_model.dart';
|
||||
|
||||
class DesktopTendersPage extends StatefulWidget {
|
||||
const DesktopTendersPage({super.key});
|
||||
@@ -49,6 +50,7 @@ class _DesktopTendersPageState extends State<DesktopTendersPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userRole = context.read<AuthViewModel>().userRole;
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
body: SafeArea(
|
||||
@@ -56,8 +58,8 @@ class _DesktopTendersPageState extends State<DesktopTendersPage> {
|
||||
children: [
|
||||
const DesktopNavigationWidget(currentIndex: 1),
|
||||
SizedBox(height: 48.0.h()),
|
||||
const _SearchBox(),
|
||||
const _ActionButtons(),
|
||||
if (userRole == Role.analyst) const _SearchBox(),
|
||||
if (userRole == Role.analyst) const _ActionButtons(),
|
||||
Expanded(
|
||||
child: Consumer<TendersViewModel>(
|
||||
builder: (context, vm, child) {
|
||||
|
||||
Reference in New Issue
Block a user