diff --git a/src/app/tenders/[details]/components/tender-procurement-section.tsx b/src/app/tenders/[details]/components/tender-procurement-section.tsx index 5de4c15..b7f6eb4 100644 --- a/src/app/tenders/[details]/components/tender-procurement-section.tsx +++ b/src/app/tenders/[details]/components/tender-procurement-section.tsx @@ -13,7 +13,27 @@ type TenderProcurementSectionProps = { tender: TTenderDetails; }; +const TED_NOTICE_DETAIL = "https://ted.europa.eu/en/notice/-/detail"; + +function uniqueTrimmedNoticeIds(ids: string[] | undefined): string[] { + if (!ids?.length) return []; + const seen = new Set(); + const out: string[] = []; + for (const id of ids) { + const trimmed = id?.trim(); + if (!trimmed || seen.has(trimmed)) continue; + seen.add(trimmed); + out.push(trimmed); + } + return out; +} + export function TenderProcurementSection({ tender }: TenderProcurementSectionProps) { + const relatedNoticeIds = uniqueTrimmedNoticeIds(tender.related_notice_publication_ids); + + const noticeTypeCode = tender.notice_type_code?.trim(); + const mainClassification = tender.main_classification?.trim(); + return (
@@ -59,6 +79,48 @@ export function TenderProcurementSection({ tender }: TenderProcurementSectionPro {tender.procurement_type_code} + {noticeTypeCode ? ( + + + {noticeTypeCode} + + + ) : null} + {mainClassification ? ( + + + {mainClassification} + + + ) : null} + {relatedNoticeIds.length > 0 ? ( + +
    + {relatedNoticeIds.map((noticeId) => ( +
  • + + {noticeId} + +
  • + ))} +
+
+ ) : null}
); diff --git a/src/lib/api/types/Tenders.ts b/src/lib/api/types/Tenders.ts index f36202f..f7742d2 100644 --- a/src/lib/api/types/Tenders.ts +++ b/src/lib/api/types/Tenders.ts @@ -13,6 +13,12 @@ export const TenderSchema = z.object({ duration_unit: z.string(), estimated_value: z.number(), notice_publication_id: z.string(), + /** Related TED notice publication IDs (e.g. modifications, same procedure). */ + related_notice_publication_ids: z.array(z.string()).optional(), + /** TED form / notice type code (e.g. can-modif). */ + notice_type_code: z.string().optional(), + /** Primary CPV classification code. */ + main_classification: z.string().optional(), procedure_code: z.string(), procurement_type_code: z.string(), publication_date: z.number(),