dde66521f6
- Introduced a .dockerignore file to optimize Docker builds by excluding unnecessary files. - Updated the Dockerfile to use a Flutter base image, enabling web builds for the application. - Added new data models for `Lot` and `OrganizationAddress` to represent tender details more accurately. - Enhanced the `Organization` model to include `companyId` and a nested `address` field. - Updated the `TenderData` model to include new fields such as `noticeTypeCode`, `formType`, and `lots`, reflecting the API response structure. - Regenerated necessary code for data models to ensure compatibility with the updated structures.
150 lines
5.2 KiB
Dart
150 lines
5.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.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/detail/widgets/tender_detail_action.dart';
|
|
// AI-NOTE (for PR reviewer): Import kept (commented) — the TenderDetailCard
|
|
// (static "profile match / incomplete resume" card) is disabled, not removed.
|
|
// import 'package:tm_app/views/detail/widgets/tender_detail_card.dart';
|
|
import 'package:tm_app/views/detail/widgets/tender_detail_header.dart';
|
|
|
|
import '../../../core/constants/tender_approval_status.dart';
|
|
import '../../../core/utils/app_toast.dart';
|
|
import '../../shared/desktop_navigation_widget.dart';
|
|
import '../../shared/tablet_desktop_appbar.dart';
|
|
import '../strings/tender_details_strings.dart';
|
|
|
|
class TenderDetailDesktopPage extends StatefulWidget {
|
|
final String tenderId;
|
|
const TenderDetailDesktopPage({required this.tenderId, super.key});
|
|
|
|
@override
|
|
State<TenderDetailDesktopPage> createState() =>
|
|
_TenderDetailDesktopPageState();
|
|
}
|
|
|
|
class _TenderDetailDesktopPageState extends State<TenderDetailDesktopPage> {
|
|
late final TenderDetailViewModel viewModel;
|
|
@override
|
|
void initState() {
|
|
viewModel = context.read<TenderDetailViewModel>();
|
|
viewModel.addListener(_viewModelListener);
|
|
super.initState();
|
|
}
|
|
|
|
void _viewModelListener() {
|
|
if (viewModel.status.isNotEmpty &&
|
|
viewModel.status == TenderApprovalStatus.submitted.value &&
|
|
viewModel.approvalStatus == true) {
|
|
AppToast.success(
|
|
context,
|
|
TenderDetailsStrings.tenderSubmittedSuccessfully,
|
|
);
|
|
}
|
|
if (viewModel.status.isNotEmpty &&
|
|
viewModel.status == TenderApprovalStatus.unsubmitted.value &&
|
|
viewModel.approvalStatus == true) {
|
|
AppToast.success(
|
|
context,
|
|
TenderDetailsStrings.tenderUnsubmittedSuccessfully,
|
|
);
|
|
}
|
|
if (viewModel.status.isNotEmpty &&
|
|
viewModel.status == TenderApprovalStatus.rejected.value &&
|
|
viewModel.approvalStatus == true) {
|
|
AppToast.success(
|
|
context,
|
|
TenderDetailsStrings.tenderRejectedSuccessfully,
|
|
);
|
|
}
|
|
if (viewModel.status.isNotEmpty &&
|
|
viewModel.status == TenderApprovalStatus.unrejected.value &&
|
|
viewModel.approvalStatus == true) {
|
|
AppToast.success(
|
|
context,
|
|
TenderDetailsStrings.tenderUnrejectedSuccessfully,
|
|
);
|
|
}
|
|
if (viewModel.approvalStatus != false && viewModel.errorMessage != null) {
|
|
AppToast.error(context, viewModel.errorMessage!);
|
|
}
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
viewModel.removeListener(_viewModelListener);
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.backgroundColor,
|
|
body: Consumer<TenderDetailViewModel>(
|
|
builder: (context, tenderViewModel, child) {
|
|
if (tenderViewModel.isLoading) {
|
|
return const Center(
|
|
child: CircularProgressIndicator(color: AppColors.secondary50),
|
|
);
|
|
}
|
|
|
|
if (tenderViewModel.errorMessage != null) {
|
|
return Center(child: Text(tenderViewModel.errorMessage!));
|
|
}
|
|
|
|
final detail = tenderViewModel.tenderDetail;
|
|
if (detail == null) {
|
|
return const Center(child: Text(TenderDetailsStrings.tenderNoData));
|
|
}
|
|
|
|
return SafeArea(
|
|
child: Column(
|
|
children: [
|
|
const DesktopNavigationWidget(
|
|
currentIndex: 1, // Home index
|
|
),
|
|
Expanded(
|
|
child: SingleChildScrollView(
|
|
child: Center(
|
|
child: SizedBox(
|
|
width: 740,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(32.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const TabletDesktopAppbar(
|
|
title: TenderDetailsStrings.tenderDetailTitle,
|
|
),
|
|
SizedBox(height: 32.0.h()),
|
|
TenderDetailHeader(
|
|
isScreenBig: true,
|
|
detail: detail,
|
|
),
|
|
SizedBox(height: 32.0.h()),
|
|
// AI-NOTE (for PR reviewer): Static mock card
|
|
// disabled (kept for future) — hard-coded data.
|
|
// TenderDetailCard(detail: detail),
|
|
// SizedBox(height: 24.0.h()),
|
|
TenderDetailActions(
|
|
isScreenBig: true,
|
|
detail: detail,
|
|
viewModel: viewModel,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|