Files
tm_app/lib/views/detail/pages/detail_tablet_page.dart
T
AmirReza Jamali dde66521f6 Add Docker support and enhance data models for tender details
- 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.
2026-06-03 13:32:42 +03:30

149 lines
5.1 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 'package:tm_app/views/shared/tablet_navigation_widget.dart';
import '../../../core/constants/tender_approval_status.dart';
import '../../../core/utils/app_toast.dart';
import '../../shared/tablet_desktop_appbar.dart';
import '../../shared/tender_app_bar.dart';
import '../strings/tender_details_strings.dart';
class TenderDetailTabletPage extends StatefulWidget {
final String tenderId;
const TenderDetailTabletPage({required this.tenderId, super.key});
@override
State<TenderDetailTabletPage> createState() => _TenderDetailTabletPageState();
}
class _TenderDetailTabletPageState extends State<TenderDetailTabletPage> {
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) {
final GlobalKey<ScaffoldState> key = GlobalKey();
return Scaffold(
key: key,
backgroundColor: AppColors.backgroundColor,
appBar: tabletAppBar(
title: TenderDetailsStrings.tenderDetailTitle,
key: key,
context: context,
),
drawer: const TabletNavigationWidget(
currentIndex: 1, // Home is index 0
),
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: SingleChildScrollView(
child: Center(
child: SizedBox(
width: 768,
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const TabletDesktopAppbar(
title: TenderDetailsStrings.tenderDetailTitle,
),
SizedBox(height: 28.0.h()),
TenderDetailHeader(isScreenBig: true, detail: detail),
SizedBox(height: 28.0.h()),
// AI-NOTE (for PR reviewer): Static mock card disabled
// (kept for future) — hard-coded profile-match data.
// TenderDetailCard(detail: detail),
// SizedBox(height: 24.0.h()),
TenderDetailActions(
isScreenBig: true,
detail: detail,
viewModel: viewModel,
),
],
),
),
),
),
),
);
},
),
);
}
}