merge branches
This commit is contained in:
@@ -49,7 +49,7 @@ class TenderDetailDesktopPage extends StatelessWidget {
|
||||
SizedBox(height: 32.0.h()),
|
||||
TenderDetailCard(detail: detail),
|
||||
SizedBox(height: 24.0.h()),
|
||||
TenderDetailActions(isScreenBig: true),
|
||||
TenderDetailActions(isScreenBig: true, detail: detail),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -45,7 +45,7 @@ class TenderDetailMobilePage extends StatelessWidget {
|
||||
SizedBox(height: 24.0.h()),
|
||||
TenderDetailCard(detail: detail),
|
||||
SizedBox(height: 24.0.h()),
|
||||
TenderDetailActions(isScreenBig: false),
|
||||
TenderDetailActions(isScreenBig: false, detail: detail),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -49,7 +49,7 @@ class TenderDetailTabletPage extends StatelessWidget {
|
||||
SizedBox(height: 28.0.h()),
|
||||
TenderDetailCard(detail: detail),
|
||||
SizedBox(height: 24.0.h()),
|
||||
TenderDetailActions(isScreenBig: true),
|
||||
TenderDetailActions(isScreenBig: true, detail: detail),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/constants/strings.dart';
|
||||
import 'package:tm_app/core/theme/colors.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/view_models/tender_detail_view_model.dart';
|
||||
import 'package:tm_app/views/shared/base_button.dart';
|
||||
import 'package:tm_app/views/shared/select_submission_bottom_sheet.dart';
|
||||
|
||||
import '../../../data/services/model/tender_data/tender_data.dart';
|
||||
|
||||
class TenderDetailActions extends StatelessWidget {
|
||||
final bool isScreenBig;
|
||||
const TenderDetailActions({required this.isScreenBig, super.key});
|
||||
final TenderData detail;
|
||||
const TenderDetailActions({
|
||||
required this.isScreenBig,
|
||||
required this.detail,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -36,22 +46,69 @@ class TenderDetailActions extends StatelessWidget {
|
||||
)
|
||||
: Column(
|
||||
children: [
|
||||
BaseButton(
|
||||
isEnabled: true,
|
||||
text: AppStrings.tenderSubmitButton,
|
||||
backgroundColor: AppColors.primary30,
|
||||
textColor: AppColors.mainBlue,
|
||||
onPressed: () {},
|
||||
Consumer<TenderDetailViewModel>(
|
||||
builder: (context, viewModel, child) {
|
||||
return viewModel.isSubmitApprovalLoading
|
||||
? BaseButton(
|
||||
isEnabled: true,
|
||||
text: AppStrings.tenderSubmitButton,
|
||||
backgroundColor: AppColors.primary30,
|
||||
textColor: AppColors.mainBlue,
|
||||
isLoading: true,
|
||||
onPressed: () {},
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled: true,
|
||||
text: AppStrings.tenderSubmitButton,
|
||||
backgroundColor: AppColors.primary30,
|
||||
textColor: AppColors.mainBlue,
|
||||
onPressed: () {
|
||||
showModalBottomSheet(
|
||||
isDismissible: true,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SelectSubmissionBottomSheet(
|
||||
onConfirm: (value) {
|
||||
viewModel.submitTenderApproval(
|
||||
tenderId: detail.id!,
|
||||
submissionMode: value,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16.0.h()),
|
||||
BaseButton(
|
||||
isEnabled: true,
|
||||
text: AppStrings.tenderRejectButton,
|
||||
borderColor: AppColors.red10,
|
||||
textColor: AppColors.red10,
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
borderWidth: 1,
|
||||
onPressed: () {},
|
||||
Consumer<TenderDetailViewModel>(
|
||||
builder: (context, viewModel, child) {
|
||||
return viewModel.isRejectApprovalLoading
|
||||
? BaseButton(
|
||||
isEnabled: true,
|
||||
text: AppStrings.tenderRejectButton,
|
||||
borderColor: AppColors.error,
|
||||
textColor: AppColors.error,
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
borderWidth: 1,
|
||||
onPressed: () {},
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled: true,
|
||||
text: AppStrings.tenderRejectButton,
|
||||
borderColor: AppColors.error,
|
||||
textColor: AppColors.error,
|
||||
backgroundColor: AppColors.backgroundColor,
|
||||
borderWidth: 1,
|
||||
onPressed: () {
|
||||
viewModel.rejectTenderApproval(
|
||||
tenderId: detail.id!,
|
||||
submissionMode: 'self-apply',
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16.0.h()),
|
||||
],
|
||||
|
||||
@@ -46,7 +46,7 @@ class TendersListItem extends StatelessWidget {
|
||||
vertical: 5.0.h(),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary2,
|
||||
color: AppColors.primary20,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Row(
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/routes/app_routes.dart';
|
||||
import 'package:tm_app/view_models/profile_view_model.dart';
|
||||
import 'package:tm_app/views/profile/widgets/theme_toggle.dart';
|
||||
import 'package:tm_app/views/shared/tender_app_bar.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/constants/strings.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
import '../widgets/theme_toggle.dart';
|
||||
import '../widgets/title_description.dart';
|
||||
|
||||
class MobileProfilePage extends StatefulWidget {
|
||||
@@ -88,36 +90,67 @@ class _MobileProfilePageState extends State<MobileProfilePage> {
|
||||
description: 'Telecommunications',
|
||||
),
|
||||
TitleDescription(title: 'Founded', description: '2010'),
|
||||
SizedBox(height: 24.0.h()),
|
||||
// Theme Toggle
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 16.0.w(),
|
||||
vertical: 12.0.h(),
|
||||
SizedBox(height: 32.0.h()),
|
||||
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: Text(
|
||||
AppStrings.settings,
|
||||
style: TextStyle(
|
||||
fontSize: 20.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey70,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 36.0.h()),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.0.w()),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
AppStrings.appTheme,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey70,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
SvgPicture.asset(AssetsManager.sun),
|
||||
SizedBox(width: 12.0.w()),
|
||||
SizedBox(
|
||||
width: 52.0.w(),
|
||||
height: 32.0.h(),
|
||||
child: ThemeToggle(),
|
||||
),
|
||||
SizedBox(width: 12.0.w()),
|
||||
SvgPicture.asset(AssetsManager.moon),
|
||||
],
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surfaceColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColors.borderColor),
|
||||
),
|
||||
child: const ThemeToggle(),
|
||||
),
|
||||
// ElevatedButton(
|
||||
// onPressed: () => viewModel.logout(),
|
||||
// child: const Text('Logout'),
|
||||
// ),
|
||||
SizedBox(height: 24.0.h()),
|
||||
Divider(color: AppColors.dividerColor, thickness: 1),
|
||||
SizedBox(height: 24.0.h()),
|
||||
Spacer(),
|
||||
InkWell(
|
||||
onTap: () => viewModel.logout(context),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 45.0.h(),
|
||||
height: 56.0.h(),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColors.borderColor),
|
||||
color: AppColors.primary20,
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text('Logout'),
|
||||
child: Text(
|
||||
'Logout',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -11,26 +11,12 @@ class ThemeToggle extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final themeProvider = context.watch<ThemeProvider>();
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
Icon(
|
||||
themeProvider.isDarkMode ? Icons.dark_mode : Icons.light_mode,
|
||||
color: AppColors.primaryTextColor,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
themeProvider.isDarkMode ? 'Dark Mode' : 'Light Mode',
|
||||
style: TextStyle(color: AppColors.primaryTextColor, fontSize: 16),
|
||||
),
|
||||
const Spacer(),
|
||||
Switch(
|
||||
value: themeProvider.isDarkMode,
|
||||
onChanged: (value) {
|
||||
themeProvider.toggleTheme();
|
||||
},
|
||||
activeColor: AppColors.primaryColor,
|
||||
),
|
||||
],
|
||||
return Switch(
|
||||
value: themeProvider.isDarkMode,
|
||||
onChanged: (value) {
|
||||
themeProvider.toggleTheme();
|
||||
},
|
||||
activeColor: AppColors.primaryColor,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
|
||||
import '../../core/theme/colors.dart';
|
||||
|
||||
class SelectSubmissionBottomSheet extends StatefulWidget {
|
||||
const SelectSubmissionBottomSheet({required this.onConfirm, super.key});
|
||||
final ValueChanged<String> onConfirm;
|
||||
|
||||
@override
|
||||
State<SelectSubmissionBottomSheet> createState() =>
|
||||
_SelectSubmissionBottomSheetState();
|
||||
}
|
||||
|
||||
class _SelectSubmissionBottomSheetState
|
||||
extends State<SelectSubmissionBottomSheet> {
|
||||
int selectedType = 0;
|
||||
String type = 'self-apply';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Wrap(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
// height: 272.0.h(),
|
||||
padding: EdgeInsets.fromLTRB(24.0.w(), 24.0.h(), 24.0.w(), 33.0.h()),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.backgroundColor,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(16.0),
|
||||
topRight: Radius.circular(16.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Select Submission',
|
||||
style: TextStyle(
|
||||
fontSize: 20.0.sp(),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.grey70,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
_submissionType(
|
||||
title: 'self-apply',
|
||||
isSelected: type == 'self-apply',
|
||||
onTap: () {
|
||||
selectedType = 0;
|
||||
type = 'self-apply';
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
_submissionType(
|
||||
title: 'Partnership',
|
||||
isSelected: type == 'partnership',
|
||||
onTap: () {
|
||||
selectedType = 1;
|
||||
type = 'partnership';
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
widget.onConfirm(type);
|
||||
context.pop();
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 56.0.h(),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary20,
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Confirm',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.mainBlue,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _submissionType({
|
||||
required VoidCallback onTap,
|
||||
required String title,
|
||||
required bool isSelected,
|
||||
}) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 56.0.h(),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 20.0.w(),
|
||||
height: 20.0.w(),
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 10.0.w(),
|
||||
vertical: 10.0.h(),
|
||||
),
|
||||
padding: EdgeInsets.all(3),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: isSelected ? AppColors.mainBlue : AppColors.grey70,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: isSelected ? AppColors.mainBlue : Colors.transparent,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.grey80,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -40,12 +40,15 @@ class _MainTendersSliderState extends State<MainTendersSlider> {
|
||||
currentPage = currentPage - 1;
|
||||
});
|
||||
|
||||
// Fetch feedback for the previous tender if not already loaded
|
||||
// Fetch feedback and approvals for the previous tender if not already loaded
|
||||
final viewModel = context.read<TendersViewModel>();
|
||||
final previousTenderId = widget.tenders[currentPage - 2].id!;
|
||||
if (!viewModel.hasFeedbackForTender(previousTenderId)) {
|
||||
viewModel.getTenderFeedback(previousTenderId);
|
||||
}
|
||||
if (!viewModel.hasTenderApprovalForTender(previousTenderId)) {
|
||||
viewModel.getTenderApprovals(previousTenderId);
|
||||
}
|
||||
}
|
||||
|
||||
void _goToNextPage() {
|
||||
@@ -61,12 +64,15 @@ class _MainTendersSliderState extends State<MainTendersSlider> {
|
||||
currentPage = currentPage + 1;
|
||||
});
|
||||
|
||||
// Fetch feedback for the next tender if not already loaded
|
||||
// Fetch feedback and approvals for the next tender if not already loaded
|
||||
final viewModel = context.read<TendersViewModel>();
|
||||
final nextTenderId = widget.tenders[currentPage].id!;
|
||||
if (!viewModel.hasFeedbackForTender(nextTenderId)) {
|
||||
viewModel.getTenderFeedback(nextTenderId);
|
||||
}
|
||||
if (!viewModel.hasTenderApprovalForTender(nextTenderId)) {
|
||||
viewModel.getTenderApprovals(nextTenderId);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -95,11 +101,16 @@ class _MainTendersSliderState extends State<MainTendersSlider> {
|
||||
currentPage = index + 1;
|
||||
});
|
||||
|
||||
// Fetch feedback for the new tender if not already loaded
|
||||
// Fetch feedback and approvals for the new tender if not already loaded
|
||||
final viewModel = context.read<TendersViewModel>();
|
||||
if (!viewModel.hasFeedbackForTender(widget.tenders[index].id!)) {
|
||||
viewModel.getTenderFeedback(widget.tenders[index].id!);
|
||||
}
|
||||
if (!viewModel.hasTenderApprovalForTender(
|
||||
widget.tenders[index].id!,
|
||||
)) {
|
||||
viewModel.getTenderApprovals(widget.tenders[index].id!);
|
||||
}
|
||||
|
||||
// Check if we need to load more tenders (when user reaches near the end)
|
||||
if (index >= widget.tenders.length - 1 &&
|
||||
@@ -154,28 +165,26 @@ class _MainTendersSliderState extends State<MainTendersSlider> {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
viewModel.isLoadingMore ?
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 4.0.h()),
|
||||
child: SizedBox(
|
||||
width: 16.0.w(),
|
||||
height: 16.0.w(),
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2.0,
|
||||
color: AppColors.jellyBean,
|
||||
viewModel.isLoadingMore
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(top: 4.0.h()),
|
||||
child: SizedBox(
|
||||
width: 16.0.w(),
|
||||
height: 16.0.w(),
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2.0,
|
||||
color: AppColors.jellyBean,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'$currentPage/${widget.tenders.length}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.grey,
|
||||
),
|
||||
),
|
||||
):
|
||||
Text(
|
||||
'$currentPage/${widget.tenders.length}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.grey,
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:tm_app/view_models/tenders_view_model.dart';
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../core/utils/size_config.dart';
|
||||
import '../../shared/select_submission_bottom_sheet.dart';
|
||||
|
||||
class TenderActionButtonsRow extends StatelessWidget {
|
||||
final TenderData tender;
|
||||
@@ -35,7 +36,7 @@ class TenderActionButtonsRow extends StatelessWidget {
|
||||
_rejectButton(viewModel),
|
||||
SizedBox(width: 32.0.w()),
|
||||
//submit button
|
||||
_submitButton(viewModel),
|
||||
_submitButton(viewModel, context),
|
||||
SizedBox(width: 32.0.w()),
|
||||
// Like button
|
||||
_likeButton(viewModel),
|
||||
@@ -46,12 +47,22 @@ class TenderActionButtonsRow extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _rejectButton(TendersViewModel viewModel) {
|
||||
// Find approval for this specific tender
|
||||
if (tender.id == null) return const SizedBox.shrink();
|
||||
|
||||
final approval = viewModel.getTenderApprovalForTender(tender.id!);
|
||||
final isRejected = approval?.status == 'rejected';
|
||||
|
||||
return Tooltip(
|
||||
message: AppStrings.reject,
|
||||
child: InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
onTap: () {
|
||||
// viewModel.toggleReject(tender);
|
||||
viewModel.toggleApprovals(
|
||||
tenderId: tender.id!,
|
||||
submissionMode: 'self-apply',
|
||||
status: 'rejected',
|
||||
);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -61,22 +72,14 @@ class TenderActionButtonsRow extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color:
|
||||
// tender.rejected ?? false
|
||||
// ? AppColors.errorColor
|
||||
// :
|
||||
AppColors.grey60,
|
||||
color: isRejected ? AppColors.errorColor : AppColors.grey60,
|
||||
width: 1.5.w(),
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
color:
|
||||
// tender.rejected ?? false
|
||||
// ? AppColors.errorColor
|
||||
// :
|
||||
AppColors.grey60,
|
||||
color: isRejected ? AppColors.errorColor : AppColors.grey60,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
@@ -87,11 +90,7 @@ class TenderActionButtonsRow extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
// tender.rejected ?? false
|
||||
// ? AppColors.errorColor
|
||||
// :
|
||||
AppColors.grey60,
|
||||
color: isRejected ? AppColors.errorColor : AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -100,13 +99,41 @@ class TenderActionButtonsRow extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _submitButton(TendersViewModel viewModel) {
|
||||
Widget _submitButton(TendersViewModel viewModel, BuildContext context) {
|
||||
// Find approval for this specific tender
|
||||
if (tender.id == null) return const SizedBox.shrink();
|
||||
|
||||
final approval = viewModel.getTenderApprovalForTender(tender.id!);
|
||||
final isApproved = approval?.status == 'approved';
|
||||
|
||||
return Tooltip(
|
||||
message: AppStrings.submit,
|
||||
child: InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
onTap: () {
|
||||
// viewModel.toggleSubmit(tender);
|
||||
if (isApproved) {
|
||||
viewModel.toggleApprovals(
|
||||
tenderId: tender.id!,
|
||||
submissionMode: approval?.submissionMode ?? 'self-apply',
|
||||
status: 'approved',
|
||||
);
|
||||
} else {
|
||||
showModalBottomSheet(
|
||||
isDismissible: true,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SelectSubmissionBottomSheet(
|
||||
onConfirm: (value) {
|
||||
viewModel.toggleApprovals(
|
||||
tenderId: tender.id!,
|
||||
submissionMode: value,
|
||||
status: 'approved',
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -116,24 +143,15 @@ class TenderActionButtonsRow extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color:
|
||||
// tender.submitted ?? false
|
||||
// ? AppColors.successColor
|
||||
// :
|
||||
AppColors.grey60,
|
||||
color: isApproved ? AppColors.successColor : AppColors.grey60,
|
||||
width: 1.5.w(),
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: SvgPicture.asset(
|
||||
AssetsManager.tick,
|
||||
colorFilter: ColorFilter.mode(
|
||||
// tender.submitted ?? false
|
||||
// ? AppColors.successColor
|
||||
// :
|
||||
AppColors.grey60,
|
||||
BlendMode.srcATop,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
color: isApproved ? AppColors.successColor : AppColors.grey60,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.0.h()),
|
||||
@@ -143,11 +161,7 @@ class TenderActionButtonsRow extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
color:
|
||||
// tender.submitted ?? false
|
||||
// ? AppColors.successColor
|
||||
// :
|
||||
AppColors.grey60,
|
||||
color: isApproved ? AppColors.successColor : AppColors.grey60,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -158,6 +172,8 @@ class TenderActionButtonsRow extends StatelessWidget {
|
||||
|
||||
Widget _dislikeButton(TendersViewModel viewModel) {
|
||||
// Find feedback for this specific tender
|
||||
if (tender.id == null) return const SizedBox.shrink();
|
||||
|
||||
final feedback = viewModel.getFeedbackForTender(tender.id!);
|
||||
final isDisliked = feedback?.feedbackType == 'dislike';
|
||||
|
||||
@@ -198,6 +214,8 @@ class TenderActionButtonsRow extends StatelessWidget {
|
||||
|
||||
Widget _likeButton(TendersViewModel viewModel) {
|
||||
// Find feedback for this specific tender
|
||||
if (tender.id == null) return const SizedBox.shrink();
|
||||
|
||||
final feedback = viewModel.getFeedbackForTender(tender.id!);
|
||||
final isLiked = feedback?.feedbackType == 'like';
|
||||
|
||||
|
||||
@@ -55,6 +55,10 @@ class TenderCard extends StatelessWidget {
|
||||
_deadlineBadge(),
|
||||
SizedBox(height: 12.0.h()),
|
||||
|
||||
// Approval status badge
|
||||
// _approvalStatusBadge(),
|
||||
SizedBox(height: 12.0.h()),
|
||||
|
||||
// Title
|
||||
_tenderTitle(),
|
||||
SizedBox(height: 8.0.h()),
|
||||
@@ -148,6 +152,59 @@ class TenderCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
// Widget _approvalStatusBadge() {
|
||||
// return Consumer<TendersViewModel>(
|
||||
// builder: (context, viewModel, child) {
|
||||
// final approvalStatus = viewModel.getApprovalStatusForTender(tender.id!);
|
||||
// final statusText = approvalStatus ?? 'Pending';
|
||||
|
||||
// Color statusColor;
|
||||
// switch (approvalStatus) {
|
||||
// case 'approved':
|
||||
// statusColor = AppColors.successColor;
|
||||
// break;
|
||||
// case 'rejected':
|
||||
// statusColor = AppColors.errorColor;
|
||||
// break;
|
||||
// default:
|
||||
// statusColor = AppColors.grey60;
|
||||
// }
|
||||
|
||||
// return Container(
|
||||
// width: double.infinity,
|
||||
// height: 24.0.h(),
|
||||
// padding: EdgeInsets.symmetric(horizontal: 8.0.w()),
|
||||
// decoration: BoxDecoration(
|
||||
// color: AppColors.grey20,
|
||||
// borderRadius: BorderRadius.circular(4),
|
||||
// border: Border.all(color: statusColor),
|
||||
// ),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Text(
|
||||
// 'Approval Status',
|
||||
// style: TextStyle(
|
||||
// color: AppColors.grey80,
|
||||
// fontSize: 14.0.sp(),
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// statusText.toUpperCase(),
|
||||
// style: TextStyle(
|
||||
// color: statusColor,
|
||||
// fontSize: 14.0.sp(),
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
Widget _tenderTitle() {
|
||||
return Text(
|
||||
tender.title ?? '',
|
||||
@@ -244,14 +301,15 @@ class TenderCard extends StatelessWidget {
|
||||
),
|
||||
SizedBox(width: 8.0.w()),
|
||||
// Country flag placeholder
|
||||
SizedBox(
|
||||
width: 32.0.w(),
|
||||
height: 21.0.h(),
|
||||
child: CountryFlag.fromCountryCode(
|
||||
tender.countryCode!,
|
||||
shape: RoundedRectangle(4),
|
||||
if (tender.countryCode != null)
|
||||
SizedBox(
|
||||
width: 32.0.w(),
|
||||
height: 21.0.h(),
|
||||
child: CountryFlag.fromCountryCode(
|
||||
tender.countryCode!,
|
||||
shape: RoundedRectangle(4),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -260,7 +318,9 @@ class TenderCard extends StatelessWidget {
|
||||
Widget _seeMoreButton(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
TenderDetailRouteData(tenderId: tender.id!).push(context);
|
||||
if (tender.id != null) {
|
||||
TenderDetailRouteData(tenderId: tender.id!).push(context);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 108.0.w(),
|
||||
|
||||
Reference in New Issue
Block a user