feat: Refactor medical and sea service verification pages

- Split MedicalVerificationPage into MedicalVerificationPage and SeaServiceVerificationPage for better separation of concerns.
- Update navigation to include separate entries for Sea Service Verification and Medical Verification.
- Enhance sea service columns to display additional vessel information and days served.
- Add translations for new and updated labels in both English and Amharic.
- Introduce seaServiceDays helper function to calculate days served based on engagement and discharge dates.
- Remove deprecated MedicalCertificatePage from the portal.
- Update routing to direct to the new sea service and medical pages.
This commit is contained in:
Nati
2026-08-20 11:01:04 +00:00
parent db5b7bdf70
commit 558cfe20a1
16 changed files with 239 additions and 471 deletions

View File

@@ -1,2 +1,3 @@
export * from './seafarer.types';
export * from './seafarer-api';
export * from './seafarer.helpers';

View File

@@ -0,0 +1,23 @@
/**
* Days served on one engagement, counted inclusively — embarkation and
* discharge days both count. The same arithmetic the API uses for approved
* sea time (`SeafarerRecordService.approvedSeaTime`), so the figure a seafarer
* sees while typing is the figure the eligibility gate will credit.
*
* `null` until both dates are set or while they are out of order.
*/
export function seaServiceDays(
engagementDate: string | null | undefined,
dischargeDate: string | null | undefined,
): number | null {
if (!engagementDate || !dischargeDate) return null;
const from = Date.UTC(...dateParts(engagementDate));
const to = Date.UTC(...dateParts(dischargeDate));
if (Number.isNaN(from) || Number.isNaN(to) || to < from) return null;
return Math.round((to - from) / 86_400_000) + 1;
}
function dateParts(value: string): [number, number, number] {
const [y, m, d] = value.slice(0, 10).split('-').map(Number);
return [y, (m || 1) - 1, d || 1];
}