diff --git a/app/src/components/Navbar/LanguageDropdown/index.tsx b/app/src/components/Navbar/LanguageDropdown/index.tsx index b6d3040d38..210fb243f8 100644 --- a/app/src/components/Navbar/LanguageDropdown/index.tsx +++ b/app/src/components/Navbar/LanguageDropdown/index.tsx @@ -16,17 +16,10 @@ import { } from '@togglecorp/fujs'; import DropdownMenuItem from '#components/DropdownMenuItem'; +import { languageNameMap } from '#utils/common'; import styles from './styles.module.css'; -// NOTE: these doesn't need to be translated -const languageNameMap: Record = { - en: 'English', - fr: 'Français', - es: 'Español', - ar: 'عربي', -}; - const languageList = mapToList( languageNameMap, (value, key) => ({ key: key as Language, value }), diff --git a/app/src/components/domain/GoMultiFileInput/index.tsx b/app/src/components/domain/GoMultiFileInput/index.tsx index 78eb052d30..d39ed19438 100644 --- a/app/src/components/domain/GoMultiFileInput/index.tsx +++ b/app/src/components/domain/GoMultiFileInput/index.tsx @@ -62,6 +62,7 @@ type Props = Omit, 'multiple' | 'value' withoutPreview?: boolean; error?: React.ReactNode; description?: React.ReactNode; + useCurrentLanguageForMutation?: boolean; } function GoMultiFileInput(props: Props) { @@ -85,6 +86,7 @@ function GoMultiFileInput(props: Props) { withoutPreview, error, description, + useCurrentLanguageForMutation = false, } = props; const strings = useTranslation(i18n); @@ -97,6 +99,7 @@ function GoMultiFileInput(props: Props) { formData: true, url, method: 'POST', + useCurrentLanguageForMutation, body: (body: { files: File[] }) => { const formData = new FormData(); diff --git a/app/src/components/domain/GoSingleFileInput/index.tsx b/app/src/components/domain/GoSingleFileInput/index.tsx index 7458b29b7f..f4201b08f3 100644 --- a/app/src/components/domain/GoSingleFileInput/index.tsx +++ b/app/src/components/domain/GoSingleFileInput/index.tsx @@ -45,6 +45,7 @@ type Props = Omit, 'multiple' | 'value' description?: React.ReactNode; onSuccess?: () => void; withoutStatus?: boolean; + useCurrentLanguageForMutation?: boolean; } function GoSingleFileInput(props: Props) { @@ -72,6 +73,7 @@ function GoSingleFileInput(props: Props) { requestBody, onSuccess, withoutStatus, + useCurrentLanguageForMutation = false, } = props; const strings = useTranslation(i18n); @@ -88,6 +90,7 @@ function GoSingleFileInput(props: Props) { // FIXME: fix typing in server (low priority) // the server generated type for response and body is the same body: (body) => body as never, + useCurrentLanguageForMutation, onSuccess: (response) => { const { id, file } = response; onChange(id, name); diff --git a/app/src/components/domain/ImageWithCaptionInput/index.tsx b/app/src/components/domain/ImageWithCaptionInput/index.tsx index ec7c546902..4ab0ec9c82 100644 --- a/app/src/components/domain/ImageWithCaptionInput/index.tsx +++ b/app/src/components/domain/ImageWithCaptionInput/index.tsx @@ -39,6 +39,7 @@ interface Props { icons?: React.ReactNode; actions?: React.ReactNode; disabled?: boolean; + useCurrentLanguageForMutation?: boolean; } // FIXME: Move this to components @@ -57,6 +58,7 @@ function ImageWithCaptionInput(props: Props) icons, actions, disabled, + useCurrentLanguageForMutation, } = props; const strings = useTranslation(i18n); @@ -111,6 +113,7 @@ function ImageWithCaptionInput(props: Props) /> ) : undefined} clearable + useCurrentLanguageForMutation={useCurrentLanguageForMutation} > {label} diff --git a/app/src/components/domain/MultiImageWithCaptionInput/index.tsx b/app/src/components/domain/MultiImageWithCaptionInput/index.tsx index 2f56e65e02..220b04118b 100644 --- a/app/src/components/domain/MultiImageWithCaptionInput/index.tsx +++ b/app/src/components/domain/MultiImageWithCaptionInput/index.tsx @@ -47,6 +47,7 @@ interface Props { actions?: React.ReactNode; readOnly?: boolean; disabled?: boolean; + useCurrentLanguageForMutation?: boolean; } // FIXME: Move this to components @@ -65,6 +66,7 @@ function MultiImageWithCaptionInput(props: Prop actions, readOnly, disabled, + useCurrentLanguageForMutation = false, } = props; const strings = useTranslation(i18n); @@ -143,6 +145,7 @@ function MultiImageWithCaptionInput(props: Prop withoutPreview readOnly={readOnly} disabled={disabled} + useCurrentLanguageForMutation={useCurrentLanguageForMutation} > {label} diff --git a/app/src/utils/common.ts b/app/src/utils/common.ts index f387c4d06f..6210ae901c 100644 --- a/app/src/utils/common.ts +++ b/app/src/utils/common.ts @@ -1,3 +1,4 @@ +import { type Language } from '@ifrc-go/ui/contexts'; import { DEFAULT_INVALID_TEXT } from '@ifrc-go/ui/utils'; import { isTruthyString } from '@togglecorp/fujs'; @@ -37,6 +38,14 @@ export function downloadFile( URL.revokeObjectURL(url); } +// NOTE: these doesn't need to be translated +export const languageNameMap: Record = { + en: 'English', + fr: 'Français', + es: 'Español', + ar: 'عربي', +}; + export function getFirstTruthyString( primaryStr: string | null | undefined, secondaryStr: string | null | undefined, diff --git a/app/src/utils/constants.ts b/app/src/utils/constants.ts index b5e910192e..6c21ee9e3b 100644 --- a/app/src/utils/constants.ts +++ b/app/src/utils/constants.ts @@ -83,9 +83,11 @@ export const FONT_FAMILY_HEADER = 'Montserrat'; // FIXME: fix typing in server (medium priority) // This should not be the same as OperationType. export type DrefStatus = components<'read'>['schemas']['DrefDrefStatusEnumKey']; + export const DREF_STATUS_DRAFT = 1 satisfies DrefStatus; -export const DREF_STATUS_FINALIZED = 2 satisfies DrefStatus; -export const DREF_STATUS_APPROVED = 3 satisfies DrefStatus; +export const DREF_STATUS_FINALIZING = 2 satisfies DrefStatus; +export const DREF_STATUS_FINALIZED = 3 satisfies DrefStatus; +export const DREF_STATUS_APPROVED = 4 satisfies DrefStatus; export type TypeOfDrefEnum = components<'read'>['schemas']['DrefDrefDrefTypeEnumKey']; export const DREF_TYPE_IMMINENT = 0 satisfies TypeOfDrefEnum; diff --git a/app/src/utils/restRequest/go.ts b/app/src/utils/restRequest/go.ts index 1779c29117..477822b687 100644 --- a/app/src/utils/restRequest/go.ts +++ b/app/src/utils/restRequest/go.ts @@ -44,7 +44,9 @@ export interface AdditionalOptions { formData?: boolean; isCsvRequest?: boolean; enforceEnglishForQuery?: boolean; + // FIXME using the current language should be default behaviour so we might not need this. useCurrentLanguageForMutation?: boolean; + enforceLanguageForMutation?: Language; isExcelRequest?: boolean; } @@ -167,6 +169,7 @@ export const processGoOptions: GoContextInterface['transformOptions'] = ( isExcelRequest, enforceEnglishForQuery = false, useCurrentLanguageForMutation = false, + enforceLanguageForMutation, } = extraOptions; const currentLanguage = getFromStorage(KEY_LANGUAGE_STORAGE) ?? 'en'; @@ -180,9 +183,17 @@ export const processGoOptions: GoContextInterface['transformOptions'] = ( if (method === 'GET') { // Query defaultHeaders['Accept-Language'] = enforceEnglishForQuery ? 'en' : currentLanguage; - } else { + } else if (method === 'POST' || method === 'PUT' || method === 'PATCH') { // Mutation - defaultHeaders['Accept-Language'] = useCurrentLanguageForMutation ? currentLanguage : 'en'; + if (isDefined(enforceLanguageForMutation)) { + defaultHeaders['Accept-Language'] = enforceLanguageForMutation; + } else if (useCurrentLanguageForMutation) { + defaultHeaders['Accept-Language'] = currentLanguage; + } else { + defaultHeaders['Accept-Language'] = 'en'; + } + } else { + defaultHeaders['Accept-Language'] = currentLanguage ?? 'en'; } if (formData) { diff --git a/app/src/views/AccountMyFormsDref/ActiveDrefTable/index.tsx b/app/src/views/AccountMyFormsDref/ActiveDrefTable/index.tsx index e4bc615e04..7670b29d48 100644 --- a/app/src/views/AccountMyFormsDref/ActiveDrefTable/index.tsx +++ b/app/src/views/AccountMyFormsDref/ActiveDrefTable/index.tsx @@ -10,6 +10,7 @@ import { TableBodyContent, } from '@ifrc-go/ui'; import { type RowOptions } from '@ifrc-go/ui'; +import { type Language } from '@ifrc-go/ui/contexts'; import { useTranslation } from '@ifrc-go/ui/hooks'; import { createDateColumn, @@ -31,6 +32,7 @@ import useUserMe from '#hooks/domain/useUserMe'; import useFilterState from '#hooks/useFilterState'; import { DREF_STATUS_APPROVED, + DREF_STATUS_FINALIZING, DREF_TYPE_LOAN, type TypeOfDrefEnum, } from '#utils/constants'; @@ -86,6 +88,21 @@ function ActiveDrefTable(props: Props) { disaster_type: filter.disaster_type, appeal_code: filter.appeal_code, }, + shouldPoll: (res) => { + if (res.errored) { + return -1; + } + + const hasFinalizingStatus = res.value.results.some( + (item) => item.status === DREF_STATUS_FINALIZING, + ); + + if (!hasFinalizingStatus) { + return -1; + } + + return 3000; + }, }); const userMe = useUserMe(); @@ -236,6 +253,7 @@ function ActiveDrefTable(props: Props) { has_final_report, country_details, is_dref_imminent_v2, + starting_language, } = originalDref; const is_published = status === DREF_STATUS_APPROVED; @@ -270,6 +288,7 @@ function ActiveDrefTable(props: Props) { canCreateFinalReport, hasPermissionToApprove: isRegionCoordinator || userMe?.is_superuser, onPublishSuccess: refetchActiveDref, + startingLanguage: starting_language as Language, }; }, { columnClassName: styles.actions }, diff --git a/app/src/views/AccountMyFormsDref/CompletedDrefTable/index.tsx b/app/src/views/AccountMyFormsDref/CompletedDrefTable/index.tsx index 707d8dec14..cf45cae91a 100644 --- a/app/src/views/AccountMyFormsDref/CompletedDrefTable/index.tsx +++ b/app/src/views/AccountMyFormsDref/CompletedDrefTable/index.tsx @@ -201,7 +201,7 @@ function CompletedDrefTable(props: Props) { dref: datum.dref, glide_code: datum.glide_code, date_of_publication: datum.date_of_publication, - original_language: datum.original_language, + starting_language: datum.starting_language, }), ), { diff --git a/app/src/views/AccountMyFormsDref/DrefTableActions/i18n.json b/app/src/views/AccountMyFormsDref/DrefTableActions/i18n.json index c598bbcb4c..cd697f8e1c 100644 --- a/app/src/views/AccountMyFormsDref/DrefTableActions/i18n.json +++ b/app/src/views/AccountMyFormsDref/DrefTableActions/i18n.json @@ -5,6 +5,7 @@ "dropdownActionFinalizeLabel": "Finalize", "dropdownActionAllocationFormLabel": "Allocation Form", "dropdownActionAddOpsUpdateLabel": "Add Operational Update", + "dropdownActionAddFinalReportLabel": "Add Final Report", "dropdownActionCreateFinalReportLabel": "Create Final Report", "dropdownActionShareLabel": "Share", "dropdownActionExportLabel": "Export", @@ -16,9 +17,15 @@ "drefApprovalInProgressTitle": "Approval in progress...", "drefAccountCouldNotCreate": "Could not create new operational update", "drefAccountCouldNotCreateFinalReport": "Could not create final report", - "drefAccountConfirmMessage": "You're about to Approve this DREF. Once approved, it can no longer be edited. Are you sure you want to Approve?", - "drefAccountFinalizeConfirmMessage": "You're about to Finalize this DREF. Once finalize, it can no longer be edited. Are you sure you want to Finalize?", + "drefAccountConfirmMessage": "You're about to approve this DREF. Once approved, it can no longer be edited. Are you sure you want to approve?", + "drefAccountFinalizeConfirmMessage": "You are about to finalize this DREF. Once finalized, the original language will change to English, and it will no longer be editable in the {selectedLanguage} language. Are you sure you want to proceed?", + "drefOpsUpdateStartingLanguageLabel": "DREF Starting Language", + "dropdownActionNewOpsUpdateConfirmationMessage": "You are about to create a new DREF Operational Update.", + "dropdownActionNewOpsUpdateLanguageSelectLanguageMessage": "Please select the language to create the DREF Operation Update.", + "dropdownActionNewFinalReportConfirmationMessage": "You are about to create a new DREF Final Report.", + "dropdownActionNewFinalReportLanguageSelectLanguageMessage": "Please select the language to create the DREF Final Report.", "dropdownActionImminentNewOpsUpdateConfirmationHeading": "Confirm addition of Operational Update", + "dropdownActionNewFinalReportConfirmationHeading": "Confirm addition of Final Report", "dropdownActionImminentNewOpsUpdateConfirmationMessage": "The DREF type will be changed to Response (from Imminent) for the Operational Update. Once created, you'll be able to change it to other types except Imminent. Are you sure you want to add an Operational Update?" } } diff --git a/app/src/views/AccountMyFormsDref/DrefTableActions/index.tsx b/app/src/views/AccountMyFormsDref/DrefTableActions/index.tsx index 137f3fa2d3..fd00d7b4f2 100644 --- a/app/src/views/AccountMyFormsDref/DrefTableActions/index.tsx +++ b/app/src/views/AccountMyFormsDref/DrefTableActions/index.tsx @@ -1,4 +1,8 @@ -import { useCallback } from 'react'; +import { + useCallback, + useMemo, + useState, +} from 'react'; import { AddLineIcon, CaseManagementIcon, @@ -10,15 +14,25 @@ import { } from '@ifrc-go/icons'; import type { ButtonProps } from '@ifrc-go/ui'; import { + Button, Message, Modal, + RadioInput, TableActions, } from '@ifrc-go/ui'; +import { type Language } from '@ifrc-go/ui/contexts'; import { useBooleanState, useTranslation, } from '@ifrc-go/ui/hooks'; -import { isDefined } from '@togglecorp/fujs'; +import { + resolveToString, + stringLabelSelector, +} from '@ifrc-go/ui/utils'; +import { + isDefined, + isNotDefined, +} from '@togglecorp/fujs'; import DrefExportModal from '#components/domain/DrefExportModal'; import DrefShareModal from '#components/domain/DrefShareModal'; @@ -26,6 +40,7 @@ import DropdownMenuItem from '#components/DropdownMenuItem'; import Link from '#components/Link'; import useAlert from '#hooks/useAlert'; import useRouting from '#hooks/useRouting'; +import { languageNameMap } from '#utils/common'; import { DREF_STATUS_DRAFT, DREF_STATUS_FINALIZED, @@ -44,6 +59,15 @@ import { exportDrefAllocation } from './drefAllocationExport'; import i18n from './i18n.json'; import styles from './styles.module.css'; +type SelectLanguageOption = { + key: Language, + label: string, +} + +function selectLanguageKeySelector(option: SelectLanguageOption) { + return option.key; +} + export interface Props { drefId: number; id: number; @@ -54,6 +78,7 @@ export interface Props { canCreateFinalReport: boolean; hasPermissionToApprove?: boolean; isDrefImminentV2?: boolean; + startingLanguage?: Language; onPublishSuccess?: () => void; drefType?: TypeOfDrefEnum | null | undefined; @@ -71,14 +96,32 @@ function DrefTableActions(props: Props) { isDrefImminentV2, onPublishSuccess, drefType, + startingLanguage, } = props; + const [selectOpsLanguage, setSelectOpsLanguage] = useState(); + + const [selectFinalLanguage, setSelectFinalLanguage] = useState(); + const { navigate } = useRouting(); const alert = useAlert(); const strings = useTranslation(i18n); + const selectLanguageOptions: SelectLanguageOption[] | undefined = useMemo(() => { + if (isNotDefined(startingLanguage)) { + return undefined; + } + return [ + { + key: startingLanguage, + label: `${languageNameMap[startingLanguage]} (${strings.drefOpsUpdateStartingLanguageLabel})`, + }, + { key: 'en', label: languageNameMap.en }, + ]; + }, [startingLanguage, strings.drefOpsUpdateStartingLanguageLabel]); + const [showExportModal, { setTrue: setShowExportModalTrue, setFalse: setShowExportModalFalse, @@ -356,7 +399,13 @@ function DrefTableActions(props: Props) { method: 'POST', url: '/api/v2/dref-op-update/', // FIXME: the type should be fixed on the server - body: (drefId: number) => ({ dref: drefId } as OpsUpdateRequestBody), + body: ( + drefId: number, + ) => ({ + dref: drefId, + starting_language: startingLanguage === 'en' ? startingLanguage : selectOpsLanguage, + } as unknown as OpsUpdateRequestBody), + enforceLanguageForMutation: selectOpsLanguage, onSuccess: (response) => { navigate( 'drefOperationalUpdateForm', @@ -385,8 +434,14 @@ function DrefTableActions(props: Props) { } = useLazyRequest({ method: 'POST', url: '/api/v2/dref-final-report/', + enforceLanguageForMutation: selectFinalLanguage, // FIXME: the type should be fixed on the server - body: (drefId: number) => ({ dref: drefId } as FinalReportRequestBody), + body: ( + drefId: number, + ) => ({ + dref: drefId, + starting_language: startingLanguage === 'en' ? startingLanguage : selectFinalLanguage, + } as FinalReportRequestBody), onSuccess: (response) => { navigate( isDrefImminentV2 ? 'drefFinalReportForm' : 'oldDrefFinalReportForm', @@ -425,6 +480,16 @@ function DrefTableActions(props: Props) { setFalse: setShowShareModalFalse, }] = useBooleanState(false); + const [showOperationConfirmModal, { + setTrue: setShowOperationConfirmModalTrue, + setFalse: setShowOperationConfirmModalFalse, + }] = useBooleanState(false); + + const [showFinalReportConfirmModal, { + setTrue: setShowFinalReportConfirmModalTrue, + setFalse: setShowFinalReportConfirmModalFalse, + }] = useBooleanState(false); + const handleExportClick: NonNullable['onClick']> = useCallback( () => { setShowExportModalTrue(); @@ -523,7 +588,14 @@ function DrefTableActions(props: Props) { name={undefined} type="confirm-button" icons={} - confirmMessage={strings.drefAccountFinalizeConfirmMessage} + confirmMessage={ + resolveToString( + strings.drefAccountFinalizeConfirmMessage, + { + selectedLanguage: startingLanguage ? languageNameMap[startingLanguage] : '--', + }, + ) + } onConfirm={handleFinalizeClick} disabled={disabled} persist @@ -556,30 +628,12 @@ function DrefTableActions(props: Props) { {strings.dropdownActionAllocationFormLabel} )} - {canAddOpsUpdate && shouldConfirmImminentAddOpsUpdate && ( - } - confirmHeading={ - strings.dropdownActionImminentNewOpsUpdateConfirmationHeading - } - confirmMessage={ - strings.dropdownActionImminentNewOpsUpdateConfirmationMessage - } - onConfirm={handleAddOpsUpdate} - disabled={disabled} - persist - > - {strings.dropdownActionAddOpsUpdateLabel} - - )} - {canAddOpsUpdate && !shouldConfirmImminentAddOpsUpdate && ( + {canAddOpsUpdate && ( } - onClick={handleAddOpsUpdate} + onClick={setShowOperationConfirmModalTrue} disabled={disabled} persist > @@ -590,7 +644,7 @@ function DrefTableActions(props: Props) { } disabled={disabled} persist @@ -623,60 +677,146 @@ function DrefTableActions(props: Props) { )} > - {(status === DREF_STATUS_DRAFT || status === DREF_STATUS_FINALIZED) && applicationType === 'DREF' && ( - } - > - {strings.dropdownActionEditLabel} - - )} - {(status === DREF_STATUS_DRAFT || status === DREF_STATUS_FINALIZED) && applicationType === 'OPS_UPDATE' && ( - } - > - {strings.dropdownActionEditLabel} - - )} - {(status === DREF_STATUS_DRAFT || status === DREF_STATUS_FINALIZED) && applicationType === 'FINAL_REPORT' && ( - } - > - {strings.dropdownActionEditLabel} - - )} - {showExportModal && ( - - )} - {showShareModal && ( - - )} - {drefApprovalPending && ( - - } + > + {strings.dropdownActionEditLabel} + + ) + } + { + (status === DREF_STATUS_DRAFT || status === DREF_STATUS_FINALIZED) && applicationType === 'OPS_UPDATE' && ( + } + > + {strings.dropdownActionEditLabel} + + ) + } + { + (status === DREF_STATUS_DRAFT || status === DREF_STATUS_FINALIZED) && applicationType === 'FINAL_REPORT' && ( + } + > + {strings.dropdownActionEditLabel} + + ) + } + { + showExportModal && ( + - - )} + ) + } + { + showShareModal && ( + + ) + } + { + showOperationConfirmModal && ( + + {strings.dropdownActionAddOpsUpdateLabel} + + )} + > +

{strings.dropdownActionNewOpsUpdateConfirmationMessage}

+ {shouldConfirmImminentAddOpsUpdate + && strings.dropdownActionImminentNewOpsUpdateConfirmationMessage} + {startingLanguage !== 'en' && ( + <> +

+ {strings + .dropdownActionNewOpsUpdateLanguageSelectLanguageMessage} +

+ + + )} +
+ ) + } + { + showFinalReportConfirmModal && ( + + {strings.dropdownActionAddFinalReportLabel} + + )} + > +

{strings.dropdownActionNewFinalReportConfirmationMessage}

+ {startingLanguage !== 'en' && ( + <> +

+ {strings + .dropdownActionNewFinalReportLanguageSelectLanguageMessage} +

+ + + )} +
+ ) + } + { + drefApprovalPending && ( + + + + ) + } ); } diff --git a/app/src/views/AccountMyFormsDref/DrefTableActions/styles.module.css b/app/src/views/AccountMyFormsDref/DrefTableActions/styles.module.css index 5e3fdb7f3b..8513915b69 100644 --- a/app/src/views/AccountMyFormsDref/DrefTableActions/styles.module.css +++ b/app/src/views/AccountMyFormsDref/DrefTableActions/styles.module.css @@ -1,3 +1,9 @@ .icon { font-size: var(--go-ui-height-icon-multiplier); } + +.add-ops-update-modal { + display: flex; + flex-direction: column; + gap: var(--go-ui-spacing-lg); +} diff --git a/app/src/views/DrefApplicationForm/Actions/index.tsx b/app/src/views/DrefApplicationForm/Actions/index.tsx index 6b4fe3c157..b318c19bec 100644 --- a/app/src/views/DrefApplicationForm/Actions/index.tsx +++ b/app/src/views/DrefApplicationForm/Actions/index.tsx @@ -410,6 +410,7 @@ function Actions(props: Props) { setFileIdToUrlMap={setFileIdToUrlMap} disabled={disabled} clearable + useCurrentLanguageForMutation > {strings.drefFormAssessmentReportUploadButtonLabel} diff --git a/app/src/views/DrefApplicationForm/EventDetail/index.tsx b/app/src/views/DrefApplicationForm/EventDetail/index.tsx index d57b9b90b1..2c5edf03f6 100644 --- a/app/src/views/DrefApplicationForm/EventDetail/index.tsx +++ b/app/src/views/DrefApplicationForm/EventDetail/index.tsx @@ -513,6 +513,7 @@ function EventDetail(props: Props) { setFileIdToUrlMap={setFileIdToUrlMap} error={getErrorObject(error?.images_file)} disabled={disabled || readOnly} + useCurrentLanguageForMutation /> @@ -601,6 +602,7 @@ function EventDetail(props: Props) { setFileIdToUrlMap={setFileIdToUrlMap} clearable disabled={disabled} + useCurrentLanguageForMutation > {strings.drefFormUploadSupportingDocumentButton} diff --git a/app/src/views/DrefApplicationForm/Operation/index.tsx b/app/src/views/DrefApplicationForm/Operation/index.tsx index be7714a339..f728645cb2 100644 --- a/app/src/views/DrefApplicationForm/Operation/index.tsx +++ b/app/src/views/DrefApplicationForm/Operation/index.tsx @@ -390,6 +390,7 @@ function Operation(props: Props) { setFileIdToUrlMap={setFileIdToUrlMap} clearable disabled={disabled} + useCurrentLanguageForMutation > {strings.drefFormUploadTargetingDocumentButtonLabel} @@ -725,6 +726,7 @@ function Operation(props: Props) { setFileIdToUrlMap={setFileIdToUrlMap} error={error?.budget_file} disabled={disabled} + useCurrentLanguageForMutation clearable description={( {strings.drefFormUploadSupportingDocumentButtonLabel} diff --git a/app/src/views/DrefApplicationForm/Overview/index.tsx b/app/src/views/DrefApplicationForm/Overview/index.tsx index db63dac9a4..f448d82142 100644 --- a/app/src/views/DrefApplicationForm/Overview/index.tsx +++ b/app/src/views/DrefApplicationForm/Overview/index.tsx @@ -447,6 +447,7 @@ function Overview(props: Props) { setFileIdToUrlMap={setFileIdToUrlMap} clearable disabled={disabled} + useCurrentLanguageForMutation > {strings.drefFormOverviewUploadDocumentButtonLabel} @@ -546,6 +547,7 @@ function Overview(props: Props) { setFileIdToUrlMap={setFileIdToUrlMap} label={strings.drefFormUploadAnImageLabel} disabled={disabled} + useCurrentLanguageForMutation /> )} @@ -567,6 +569,7 @@ function Overview(props: Props) { setFileIdToUrlMap={setFileIdToUrlMap} label={strings.drefFormUploadAnImageLabel} disabled={disabled} + useCurrentLanguageForMutation /> )} diff --git a/app/src/views/DrefApplicationForm/i18n.json b/app/src/views/DrefApplicationForm/i18n.json index a0985591f6..9047f3d851 100644 --- a/app/src/views/DrefApplicationForm/i18n.json +++ b/app/src/views/DrefApplicationForm/i18n.json @@ -18,7 +18,6 @@ "formLoadErrorTitle": "Failed to load DREF Application!", "formBackButtonLabel": "Back", "formLoadingMessage": "Loading DREF Application...", - "formNotAvailableInNonEnglishMessage": "DREF Application is not available in the selected language!", "formEditNotAvailableInSelectedLanguageMessage": "DREF Application is currently in view-only mode.", "drefFeedbackForm": "Provide feedback on IFRC DREF" } diff --git a/app/src/views/DrefFinalReportForm/EventDetail/index.tsx b/app/src/views/DrefFinalReportForm/EventDetail/index.tsx index 16dfd8ec09..3146acaec5 100644 --- a/app/src/views/DrefFinalReportForm/EventDetail/index.tsx +++ b/app/src/views/DrefFinalReportForm/EventDetail/index.tsx @@ -261,6 +261,7 @@ function EventDetail(props: Props) { error={getErrorObject(error?.images_file)} readOnly={readOnly} disabled={disabled} + useCurrentLanguageForMutation /> )} diff --git a/app/src/views/DrefFinalReportForm/Operation/index.tsx b/app/src/views/DrefFinalReportForm/Operation/index.tsx index 12255129f1..f5f04b62b5 100644 --- a/app/src/views/DrefFinalReportForm/Operation/index.tsx +++ b/app/src/views/DrefFinalReportForm/Operation/index.tsx @@ -987,6 +987,7 @@ function Operation(props: Props) { clearable readOnly={readOnly} disabled={disabled} + useCurrentLanguageForMutation > {strings.finalReportFinancialReportAttachment} diff --git a/app/src/views/DrefFinalReportForm/Overview/index.tsx b/app/src/views/DrefFinalReportForm/Overview/index.tsx index 132de075cd..d42b9b8589 100644 --- a/app/src/views/DrefFinalReportForm/Overview/index.tsx +++ b/app/src/views/DrefFinalReportForm/Overview/index.tsx @@ -425,6 +425,7 @@ function Overview(props: Props) { label={strings.drefFormUploadAnImageLabel} readOnly={readOnly} disabled={disabled} + useCurrentLanguageForMutation /> )} @@ -445,6 +446,7 @@ function Overview(props: Props) { label={strings.drefFormUploadAnImageLabel} readOnly={readOnly} disabled={disabled} + useCurrentLanguageForMutation /> {strings.drefFormAssessmentReportUploadButtonLabel} diff --git a/app/src/views/DrefOperationalUpdateForm/EventDetail/index.tsx b/app/src/views/DrefOperationalUpdateForm/EventDetail/index.tsx index 66e7b17a65..68d7315818 100644 --- a/app/src/views/DrefOperationalUpdateForm/EventDetail/index.tsx +++ b/app/src/views/DrefOperationalUpdateForm/EventDetail/index.tsx @@ -468,6 +468,7 @@ function EventDetail(props: Props) { error={getErrorObject(error?.images_file)} readOnly={readOnly} disabled={disabled} + useCurrentLanguageForMutation /> )} diff --git a/app/src/views/DrefOperationalUpdateForm/Operation/index.tsx b/app/src/views/DrefOperationalUpdateForm/Operation/index.tsx index e1ac35ec3b..1cb7156b9a 100644 --- a/app/src/views/DrefOperationalUpdateForm/Operation/index.tsx +++ b/app/src/views/DrefOperationalUpdateForm/Operation/index.tsx @@ -792,6 +792,7 @@ function Operation(props: Props) { readOnly={readOnly} disabled={disabled} clearable + useCurrentLanguageForMutation description={( )} @@ -512,6 +513,7 @@ function Overview(props: Props) { label={strings.drefFormUploadAnImageLabel} readOnly={readOnly} disabled={disabled} + useCurrentLanguageForMutation /> )} diff --git a/app/src/views/OldDrefFinalReportForm/index.tsx b/app/src/views/OldDrefFinalReportForm/index.tsx index a512c06032..070804991d 100644 --- a/app/src/views/OldDrefFinalReportForm/index.tsx +++ b/app/src/views/OldDrefFinalReportForm/index.tsx @@ -38,7 +38,11 @@ import NonFieldError from '#components/NonFieldError'; import Page from '#components/Page'; import useCurrentLanguage from '#hooks/domain/useCurrentLanguage'; import useAlert from '#hooks/useAlert'; -import { DREF_STATUS_DRAFT, DREF_STATUS_FINALIZED, DREF_TYPE_IMMINENT } from '#utils/constants'; +import { + DREF_STATUS_DRAFT, + DREF_STATUS_FINALIZED, + DREF_TYPE_IMMINENT, +} from '#utils/constants'; import { type GoApiResponse, useLazyRequest, diff --git a/go-api b/go-api index 4a91f3b88b..bd58acb614 160000 --- a/go-api +++ b/go-api @@ -1 +1 @@ -Subproject commit 4a91f3b88b1cf4f7d795404e55ce49a104fb2413 +Subproject commit bd58acb61415d64c4b1368ed400ca5c90e0faa2a diff --git a/translationMigrations/000052-1760421406280.json b/translationMigrations/000052-1760421406280.json deleted file mode 100644 index 30fb063470..0000000000 --- a/translationMigrations/000052-1760421406280.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "parent": "000051-1758354992698.json", - "actions": [ - { - "action": "add", - "key": "drefAccountFinalizeConfirmMessage", - "namespace": "accountMyFormsDref", - "value": "You're about to Finalize this DREF. Once finalize, it can no longer be edited. Are you sure you want to Finalize?" - }, - { - "action": "add", - "key": "drefFinalizeFailureTitle", - "namespace": "accountMyFormsDref", - "value": "Failed to finalize the DREF!" - }, - { - "action": "add", - "key": "drefFinalizeSuccessTitle", - "namespace": "accountMyFormsDref", - "value": "Successfully finalized the DREF!" - }, - { - "action": "add", - "key": "dropdownActionFinalizeLabel", - "namespace": "accountMyFormsDref", - "value": "Finalize" - }, - { - "action": "update", - "key": "formEditNotAvailableInSelectedLanguageMessage", - "namespace": "drefApplicationForm", - "newValue": "DREF Application is currently in view-only mode." - }, - { - "action": "update", - "key": "formNotAvailableInSelectedLanguageMessage", - "namespace": "drefFinalReportForm", - "newValue": "DREF Final Report is not available in the selected language!" - }, - { - "action": "update", - "key": "formNotAvailableInSelectedLanguageMessage", - "namespace": "drefOperationalUpdateForm", - "newValue": "DREF Operational Update is not available in the selected language!" - }, - { - "action": "update", - "key": "languageMismatchErrorMessage", - "namespace": "languageMismatchMessage", - "newValue": "This is because form was originally created in {originalLanguage} language and edits cannot be edited in the {selectedLanguage} language." - }, - { - "action": "update", - "key": "languageMismatchErrorTitle", - "namespace": "languageMismatchMessage", - "newValue": "Edit not available in {selectedLanguage} language!" - }, - { - "action": "update", - "key": "languageMismatchHelpMessage", - "namespace": "languageMismatchMessage", - "newValue": "To make changes, please switch to the original language of the form." - } - ] -} \ No newline at end of file