diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index b47a16e62..a9dd64219 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -333,7 +333,7 @@ const router = createBrowserRouter([ path: ROUTES.REPORTS_ADD_NOTIONAL_TRANSFERS, element: , handle: { - title: 'New Notional Transfer', + title: 'Notional transfer of eligible renewable fuels', mode: 'add' } }, @@ -341,7 +341,7 @@ const router = createBrowserRouter([ path: ROUTES.REPORTS_ADD_ALLOCATION_AGREEMENTS, element: , handle: { - title: 'New Allocation Agreement', + title: 'Allocation agreements', mode: 'add' } }, @@ -349,7 +349,7 @@ const router = createBrowserRouter([ path: ROUTES.REPORTS_ADD_OTHER_USE_FUELS, element: , handle: { - title: 'New Fuel for Other Use', + title: 'Fuels for other use', mode: 'add' } }, @@ -357,7 +357,7 @@ const router = createBrowserRouter([ path: ROUTES.REPORTS_ADD_FINAL_SUPPLY_EQUIPMENTS, element: , handle: { - title: 'Final Supply Equipment', + title: 'Final supply equipment', mode: 'add' } }, @@ -365,7 +365,7 @@ const router = createBrowserRouter([ path: ROUTES.REPORTS_ADD_SUPPLY_OF_FUEL, element: , handle: { - title: 'Supply of fuels', + title: 'Supply of fuel', mode: 'add' } }, diff --git a/frontend/src/assets/locales/en/allocationAgreement.json b/frontend/src/assets/locales/en/allocationAgreement.json index 554b3fbe6..b56ef8f49 100644 --- a/frontend/src/assets/locales/en/allocationAgreement.json +++ b/frontend/src/assets/locales/en/allocationAgreement.json @@ -1,8 +1,11 @@ { - "allocationAgreementTitle": "Allocation Agreement", + "allocationAgreementTitle": "Allocation agreements", "noAllocationAgreementsFound": "No allocation agreements found", "addAllocationAgreementRowsTitle": "Allocation agreements (e.g., allocating responsibility for fuel)", - "allocationAgreementSubtitle": "Enter allocation agreement details below", + "allocationAgreementGuides": [ + "Report fuel volumes for which you have an allocation agreement. Report both fuels that you have allocated responsibility to another organization, and fuels you have received responsibly from another organization.", + "Fuels that you have received responsibility for must also be reported in fuel supply." + ], "fuelCodeFieldRequiredError": "Error updating row: Fuel code field required", "allocationAgreementColLabels": { "allocationTransactionType": "Responsibility", diff --git a/frontend/src/assets/locales/en/finalSupplyEquipment.json b/frontend/src/assets/locales/en/finalSupplyEquipment.json index d8ed2de94..6473557f1 100644 --- a/frontend/src/assets/locales/en/finalSupplyEquipment.json +++ b/frontend/src/assets/locales/en/finalSupplyEquipment.json @@ -1,8 +1,11 @@ { "fseTitle": "Final supply equipment (FSE)", - "addFSErowsTitle": "Add new final supply equipment(s) (FSE)", - "fseSubtitle": "Report dates of supply for your FSE. If your billing location is different from your equipment location provided below use the Notes field. Use the Notes field if you use any Other options.", - "reportingResponsibilityInfo": "If you are reporting on behalf of an FSE for which you hold allocated reporting responsibility, please list the utility account holder's organization name associated with the specific station, rather than your own organization's name.", + "addFSErowsTitle": "Final supply equipment", + "reportingResponsibilityInfo": [ + "Report dates of supply for your final supply equipment (FSE).", + "Organization: Enter your organization name unless you are reporting FSE that you have received allocated responsibility. In this case, enter the utility account holder's organization name.", + "Enter the billing address in the Notes field if it is different than the equipment address. Also, enter an explanation in the Notes field if you select 'Other' from any of the select options." + ], "newFinalSupplyEquipmentBtn": "New final supply equipment", "noFinalSupplyEquipmentsFound": "No final supply equipments found", "finalSupplyEquipmentDownloadBtn": "Download as Excel", @@ -30,15 +33,15 @@ "complianceReportId": "Compliance Report ID", "organizationName": "Organization", "supplyFrom": "Supply date range", - "kwhUsage":"kWh usage", + "kwhUsage": "kWh usage", "supplyFromDate": "Dates of supply from", "supplyToDate": "Dates of supply to", "registrationNbr": "Registration #", "serialNbr": "Serial #", "manufacturer": "Manufacturer", - "model":"Model", + "model": "Model", "levelOfEquipment": "Level of equipment", - "ports":"Ports", + "ports": "Ports", "fuelMeasurementType": "Fuel measurement type", "intendedUses": "Intended use", "intendedUsers": "Intended users", diff --git a/frontend/src/assets/locales/en/fuelExport.json b/frontend/src/assets/locales/en/fuelExport.json index cc2cac887..1ffef51fd 100644 --- a/frontend/src/assets/locales/en/fuelExport.json +++ b/frontend/src/assets/locales/en/fuelExport.json @@ -1,8 +1,8 @@ { "fuelExportTitle": "Export fuel", "noFuelExportsFound": "No fuel exports found", - "addFuelExportRowsTitle": "Add new fuel export", - "fuelExportSubtitle": "You must report fuel that was marketed or supplied in B.C. and then exported out of the province. Only negative compliance units (debits) can be issued, credits cannot be issued for exported fuel.", + "addFuelExportRowsTitle": "Export fuels", + "fuelExportGuide": "Report fuel volumes that were marketed or supplied in B.C. and then exported out of the province. Only negative compliance units (debits) can be issued, credits cannot be issued for exported fuel.", "fuelExportDownloadBtn": "Download as Excel", "fuelExportDownloadingMsg": "Downloading export fuels information", "fuelExportDownloadFailMsg": "Failed to download export fuel information.", diff --git a/frontend/src/assets/locales/en/fuelSupply.json b/frontend/src/assets/locales/en/fuelSupply.json index 15ba14b59..494954a24 100644 --- a/frontend/src/assets/locales/en/fuelSupply.json +++ b/frontend/src/assets/locales/en/fuelSupply.json @@ -1,8 +1,8 @@ { - "fuelSupplyTitle": "Supply of fuels", + "fuelSupplyTitle": "Supply of fuel", "noFuelSuppliesFound": "No fuel supplies found", "addFuelSupplyRowsTitle": "Add new supply of fuel", - "fuelSupplySubtitle": "Report the fuel volumes supplied for various uses.", + "fuelSupplyGuide": "Report fuel volumes you supplied for the various end uses.", "fuelSupplyDownloadBtn": "Download as Excel", "fuelSupplyDownloadingMsg": "Downloading supply of fuels information", "fuelSupplyDownloadFailMsg": "Failed to download supply of fuel information.", @@ -16,7 +16,7 @@ "fuelType": "Fuel type", "fuelTypeOther": "Fuel type other", "fuelCategoryId": "Fuel category", - "endUseId": "End use", + "endUse": "End use", "provisionOfTheActId": "Determining carbon intensity", "fuelCode": "Fuel code", "quantity": "Quantity supplied", diff --git a/frontend/src/assets/locales/en/notionalTransfer.json b/frontend/src/assets/locales/en/notionalTransfer.json index 804e61df2..865c4c7c2 100644 --- a/frontend/src/assets/locales/en/notionalTransfer.json +++ b/frontend/src/assets/locales/en/notionalTransfer.json @@ -7,7 +7,8 @@ "notionalTransferDownloadFailMsg": "Failed to download notional transfer information.", "LoadFailMsg": "Failed to load notional transfer rows.", "notionalTransferLoadFailMsg": "Failed to load notional transfer information.", - "newNotionalTransferTitle": "Add new notional transfer(s)", + "newNotionalTransferTitle": "Notional transfer of eligible renewable fuels", + "newNotionalTransferGuide": "Report renewable fuel volumes that you received or transferred through a notional transfer.", "editNotionalTransferTitle": "Edit draft notional transfer", "approvedNotionalTransferTitle": "Approved draft notional transfer", "deletedNotionalTransferTitle": "Deleted draft notional transfer", diff --git a/frontend/src/assets/locales/en/otherUses.json b/frontend/src/assets/locales/en/otherUses.json index 70b32650d..cd4ed2250 100644 --- a/frontend/src/assets/locales/en/otherUses.json +++ b/frontend/src/assets/locales/en/otherUses.json @@ -6,7 +6,8 @@ "otherUsesDownloadingMsg": "Downloading other uses information", "otherUsesDownloadFailMsg": "Failed to download other uses information.", "otherUsesLoadFailMsg": "Failed to load other uses information.", - "newOtherUsesTitle": "Add new other use(s)", + "newOtherUsesTitle": "Fuels for other use", + "newOtherUsesGuide": "Report fuel volumes that you supplied for heating or other prescribed uses other than transportation.", "editOtherUsesTitle": "Edit other use entry", "approvedOtherUsesTitle": "Approved other use entry", "deletedOtherUsesTitle": "Deleted other use entry", diff --git a/frontend/src/views/AllocationAgreements/AddEditAllocationAgreements.jsx b/frontend/src/views/AllocationAgreements/AddEditAllocationAgreements.jsx index 779d430e5..9c9cdd7b9 100644 --- a/frontend/src/views/AllocationAgreements/AddEditAllocationAgreements.jsx +++ b/frontend/src/views/AllocationAgreements/AddEditAllocationAgreements.jsx @@ -29,6 +29,9 @@ export const AddEditAllocationAgreements = () => { const alertRef = useRef() const location = useLocation() const { t } = useTranslation(['common', 'allocationAgreement', 'reports']) + const guides = useMemo(() => + t('allocationAgreement:allocationAgreementGuides', { returnObjects: true }) + ) const params = useParams() const { complianceReportId, compliancePeriod } = params const navigate = useNavigate() @@ -69,22 +72,28 @@ export const AddEditAllocationAgreements = () => { } }, [location.state?.message, location.state?.severity]) - const validate = (params, validationFn, errorMessage, alertRef, field = null) => { - const value = field ? params.node?.data[field] : params; + const validate = ( + params, + validationFn, + errorMessage, + alertRef, + field = null + ) => { + const value = field ? params.node?.data[field] : params if (field && params.colDef.field !== field) { - return true; + return true } if (!validationFn(value)) { alertRef.current?.triggerAlert({ message: errorMessage, - severity: 'error', - }); - return false; + severity: 'error' + }) + return false } - return true; // Proceed with the update - }; + return true // Proceed with the update + } const onGridReady = useCallback( async (params) => { @@ -119,7 +128,11 @@ export const AddEditAllocationAgreements = () => { ) useEffect(() => { - const updatedColumnDefs = allocationAgreementColDefs(optionsData, errors, currentUser) + const updatedColumnDefs = allocationAgreementColDefs( + optionsData, + errors, + currentUser + ) setColumnDefs(updatedColumnDefs) }, [errors, optionsData, currentUser]) @@ -179,7 +192,8 @@ export const AddEditAllocationAgreements = () => { if (params.colDef.field === 'transactionPartner') { if (params.newValue === currentUser.organization.name) { alertRef.current?.triggerAlert({ - message: 'You cannot select your own organization as the transaction partner.', + message: + 'You cannot select your own organization as the transaction partner.', severity: 'error' }) params.node.setDataValue('transactionPartner', '') @@ -190,12 +204,12 @@ export const AddEditAllocationAgreements = () => { const isValid = validate( params, (value) => { - return value !== null && !isNaN(value) && value > 0; + return value !== null && !isNaN(value) && value > 0 }, 'Quantity supplied must be greater than 0.', alertRef, - 'quantity', - ); + 'quantity' + ) if (!isValid) { return @@ -332,16 +346,21 @@ export const AddEditAllocationAgreements = () => {
- {t('allocationAgreement:addAllocationAgreementRowsTitle')} - - - {t('allocationAgreement:allocationAgreementSubtitle')} + {t('allocationAgreement:allocationAgreementTitle')} + + {guides.map((v, i) => ( + + {v} + + ))} +
({ useParams: () => mockUseParams() })) +// Mock react-i18next // Mock react-i18next vi.mock('react-i18next', () => ({ useTranslation: () => ({ - t: (key) => key + t: vi.fn((key, options = {}) => { + // Handle specific keys with returnObjects + if ( + key === 'allocationAgreement:allocationAgreementGuides' && + options.returnObjects + ) { + return ['Guide 1', 'Guide 2', 'Guide 3'] // Mocked guide objects + } + return key + }) }) })) @@ -107,7 +117,7 @@ describe('AddEditAllocationAgreements', () => { it('renders the component', () => { render(, { wrapper }) expect( - screen.getByText('allocationAgreement:addAllocationAgreementRowsTitle') + screen.getByText('allocationAgreement:allocationAgreementTitle') ).toBeInTheDocument() }) diff --git a/frontend/src/views/FinalSupplyEquipments/AddEditFinalSupplyEquipments.jsx b/frontend/src/views/FinalSupplyEquipments/AddEditFinalSupplyEquipments.jsx index 2e9285580..d866f45a6 100644 --- a/frontend/src/views/FinalSupplyEquipments/AddEditFinalSupplyEquipments.jsx +++ b/frontend/src/views/FinalSupplyEquipments/AddEditFinalSupplyEquipments.jsx @@ -25,6 +25,9 @@ export const AddEditFinalSupplyEquipments = () => { const alertRef = useRef() const location = useLocation() const { t } = useTranslation(['common', 'finalSupplyEquipment', 'reports']) + const subTitles = t('finalSupplyEquipment:reportingResponsibilityInfo', { + returnObjects: true + }) const params = useParams() const { complianceReportId, compliancePeriod } = params const navigate = useNavigate() @@ -277,24 +280,20 @@ export const AddEditFinalSupplyEquipments = () => {
- {t('finalSupplyEquipment:addFSErowsTitle')} - - - {t('finalSupplyEquipment:fseSubtitle')} - - - {t('finalSupplyEquipment:reportingResponsibilityInfo')} + {t('finalSupplyEquipment:fseTitle')} + + {subTitles.map((v, i) => ( + + ))} +
{ - {t('fuelExport:fuelExportSubtitle')} + {t('fuelExport:fuelExportGuide')} diff --git a/frontend/src/views/FuelSupplies/AddEditFuelSupplies.jsx b/frontend/src/views/FuelSupplies/AddEditFuelSupplies.jsx index f76063182..935acb711 100644 --- a/frontend/src/views/FuelSupplies/AddEditFuelSupplies.jsx +++ b/frontend/src/views/FuelSupplies/AddEditFuelSupplies.jsx @@ -360,12 +360,12 @@ export const AddEditFuelSupplies = () => {
- {t('fuelSupply:addFuelSupplyRowsTitle')} + {t('fuelSupply:fuelSupplyTitle')} {t('fuelSupply:fuelSupplySubtitle')} diff --git a/frontend/src/views/FuelSupplies/__tests__/AddEditFuelSupplies.test.jsx b/frontend/src/views/FuelSupplies/__tests__/AddEditFuelSupplies.test.jsx index c31a71d49..4417f3521 100644 --- a/frontend/src/views/FuelSupplies/__tests__/AddEditFuelSupplies.test.jsx +++ b/frontend/src/views/FuelSupplies/__tests__/AddEditFuelSupplies.test.jsx @@ -92,7 +92,7 @@ describe('AddEditFuelSupplies', () => { render(, { wrapper }) // Check for a title or any text that indicates successful rendering expect( - screen.getByText('fuelSupply:addFuelSupplyRowsTitle') + screen.getByText('fuelSupply:fuelSupplyTitle') ).toBeInTheDocument() }) diff --git a/frontend/src/views/NotionalTransfers/AddEditNotionalTransfers.jsx b/frontend/src/views/NotionalTransfers/AddEditNotionalTransfers.jsx index 00a633f7d..fb17e5318 100644 --- a/frontend/src/views/NotionalTransfers/AddEditNotionalTransfers.jsx +++ b/frontend/src/views/NotionalTransfers/AddEditNotionalTransfers.jsx @@ -44,24 +44,30 @@ export const AddEditNotionalTransfers = () => { severity: location.state.severity || 'info' }) } - }, [location?.state?.message, location?.state?.severity]); + }, [location?.state?.message, location?.state?.severity]) - const validate = (params, validationFn, errorMessage, alertRef, field = null) => { - const value = field ? params.node?.data[field] : params; + const validate = ( + params, + validationFn, + errorMessage, + alertRef, + field = null + ) => { + const value = field ? params.node?.data[field] : params if (field && params.colDef.field !== field) { - return true; + return true } if (!validationFn(value)) { alertRef.current?.triggerAlert({ message: errorMessage, - severity: 'error', - }); - return false; + severity: 'error' + }) + return false } - return true; // Proceed with the update - }; + return true // Proceed with the update + } const onGridReady = (params) => { const ensureRowIds = (rows) => { @@ -118,7 +124,8 @@ export const AddEditNotionalTransfers = () => { if (params.colDef.field === 'legalName') { if (params.newValue === currentUser.organization.name) { alertRef.current?.triggerAlert({ - message: 'You cannot select your own organization as the transaction partner.', + message: + 'You cannot select your own organization as the transaction partner.', severity: 'error' }) params.node.setDataValue('legalName', '') @@ -129,12 +136,12 @@ export const AddEditNotionalTransfers = () => { const isValid = validate( params, (value) => { - return value !== null && !isNaN(value) && value > 0; + return value !== null && !isNaN(value) && value > 0 }, 'Quantity supplied must be greater than 0.', alertRef, - 'quantity', - ); + 'quantity' + ) if (!isValid) { return @@ -234,7 +241,11 @@ export const AddEditNotionalTransfers = () => { useEffect(() => { if (!optionsLoading) { - const updatedColumnDefs = notionalTransferColDefs(optionsData, errors, currentUser) + const updatedColumnDefs = notionalTransferColDefs( + optionsData, + errors, + currentUser + ) setColumnDefs(updatedColumnDefs) } }, [errors, optionsData, optionsLoading, currentUser]) @@ -260,6 +271,14 @@ export const AddEditNotionalTransfers = () => { {t('notionalTransfer:newNotionalTransferTitle')} + + {t('notionalTransfer:newNotionalTransferGuide')} +
{ {t('otherUses:newOtherUsesTitle')} + + {t('otherUses:newOtherUsesGuide')} +