Refactor tender detail models and UI components for improved clarity and functionality

- Updated the `Lot`, `Organization`, and `OrganizationAddress` models to enhance data mapping for tender details.
- Revised the `TenderData` model to include additional fields reflecting the API response structure.
- Improved UI components across desktop, mobile, and tablet views by commenting out unused sections for future use.
- Added new string constants for lot details in the tender information section.
- Enhanced unit tests to cover new model fields and ensure resilience to partial API payloads.
This commit is contained in:
AmirReza Jamali
2026-06-05 19:42:09 +03:30
parent dde66521f6
commit 86ed7bc665
17 changed files with 204 additions and 375 deletions
+3 -3
View File
@@ -5,9 +5,9 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'lot.freezed.dart';
part 'lot.g.dart';
// AI-NOTE (for PR reviewer): New model for entries in the tender-details
// `lots` array. Only lot_id, title and description are mapped — the fields the
// tender-details "Lots" section renders. Add more fields here if the UI grows.
// Model for entries in the tender-details `lots` array. Only lot_id, title and
// description are mapped — the fields the tender-details "Lots" section renders.
// Add more fields here if the UI grows.
@freezed
abstract class Lot with _$Lot {
const factory Lot({
@@ -6,11 +6,11 @@ import 'package:tm_app/data/services/model/organization/organization_address.dar
part 'organization.freezed.dart';
part 'organization.g.dart';
// AI-NOTE (for PR reviewer): Added company_id and a nested address
// (OrganizationAddress) to surface buyer details on the tender-details page.
// A dedicated OrganizationAddress type is used instead of the existing
// `Address` model because the buyer address shape differs (city_name +
// country_code only) and is unrelated to the user-profile Address.
// company_id and a nested address (OrganizationAddress) surface buyer details
// on the tender-details page. A dedicated OrganizationAddress type is used
// instead of the existing `Address` model because the buyer address shape
// differs (city_name + country_code only) and is unrelated to the user-profile
// Address.
@freezed
abstract class Organization with _$Organization {
const factory Organization({
@@ -5,10 +5,10 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'organization_address.freezed.dart';
part 'organization_address.g.dart';
// AI-NOTE (for PR reviewer): New model for the buyer_organization.address
// object from the tender-details API. Kept separate from the existing profile
// `Address` model because the shapes differ (this one only needs city_name and
// country_code). Only the fields the UI shows are mapped.
// Model for the buyer_organization.address object from the tender-details API.
// Kept separate from the existing profile `Address` model because the shapes
// differ (this one only needs city_name and country_code). Only the fields the
// UI shows are mapped.
@freezed
abstract class OrganizationAddress with _$OrganizationAddress {
const factory OrganizationAddress({
@@ -8,13 +8,12 @@ import 'package:tm_app/data/services/model/organization/organization.dart';
part 'tender_data.freezed.dart';
part 'tender_data.g.dart';
// AI-NOTE (for PR reviewer): New fields were added to mirror the
// /tenders/details/:id response so the tender-details page can show them:
// notice_type_code, form_type, notice_language_code, issue_date, issue_time,
// lots, official_languages. issue_date/issue_time reuse unixTimestampFromJson
// (epoch seconds, tolerant of ms/string) like the other timestamp fields. All
// fields are nullable to stay resilient to partial API payloads. Freezed/json
// codegen (.freezed.dart/.g.dart) was regenerated for these.
// Fields mirror the /tenders/details/:id response so the tender-details page
// can show them: notice_type_code, form_type, notice_language_code, issue_date,
// issue_time, lots, official_languages. issue_date/issue_time reuse
// unixTimestampFromJson (epoch seconds, tolerant of ms/string) like the other
// timestamp fields. All fields are nullable to stay resilient to partial API
// payloads.
@freezed
abstract class TenderData with _$TenderData {
const factory TenderData({