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:
amirrezaghabeli
2025-10-14 09:12:24 +03:30
parent 504fa1e80a
commit 13dbb5fae5
10 changed files with 109 additions and 53 deletions
@@ -13,6 +13,7 @@ import 'package:tm_app/views/your_tenders/widgets/liked_disliked_tenders_list.da
import 'package:tm_app/views/your_tenders/widgets/tenders_submitted.dart';
import '../../shared/desktop_navigation_widget.dart';
import '../../shared/page_selection_dialog.dart';
class YourTendersDesktopPage extends StatefulWidget {
const YourTendersDesktopPage({super.key});
@@ -149,28 +150,37 @@ class _YourTendersDesktopPageState extends State<YourTendersDesktopPage>
SizedBox(width: 10.0.w()),
InkWell(
onTap: () async {
// final selectedPage = await showDialog<int>(
// context: context,
// builder: (context) {
// return AlertDialog(
// backgroundColor: AppColors.backgroundColor,
// title: const Text(YourTendersStrings.selectPage),
// content: SizedBox(
// width: 200.0.w(),
// height: 300.0.h(),
// child: ListView.builder(
// itemCount: viewModel.totalPages,
// itemBuilder: (context, index) {
// final pageNumber = index + 1;
// return ListTile(
// title: Text('${YourTendersStrings.page} $pageNumber'),
// onTap: () => Navigator.pop(context, pageNumber),
// );
// },
// ),
// ),
// );
// },
// );
final selectedPage = await showDialog<int>(
context: context,
builder: (context) {
return AlertDialog(
backgroundColor: AppColors.backgroundColor,
title: const Text(YourTendersStrings.selectPage),
content: SizedBox(
width: 200.0.w(),
height: 300.0.h(),
child: ListView.builder(
itemCount: viewModel.totalPages,
itemBuilder: (context, index) {
final pageNumber = index + 1;
return ListTile(
title: Text('${YourTendersStrings.page} $pageNumber'),
onTap: () => Navigator.pop(context, pageNumber),
);
},
),
builder:
(context) => PageSelectionDialog(
totalPages: viewModel.totalPages,
currentPage: viewModel.currentPage,
),
);
},
);
if (selectedPage != null) {