diff --git a/app/src/utils/constants.ts b/app/src/utils/constants.ts
index 79eee5799..8075e6b3f 100644
--- a/app/src/utils/constants.ts
+++ b/app/src/utils/constants.ts
@@ -84,7 +84,8 @@ export const FONT_FAMILY_HEADER = 'Montserrat';
// This should not be the same as OperationType.
export type DrefStatus = components<'read'>['schemas']['DrefDrefStatusEnumKey'];
// const DREF_STATUS_COMPLETED = 1 satisfies DrefStatus;
-export const DREF_STATUS_IN_PROGRESS = 0 satisfies DrefStatus;
+export const DREF_STATUS_DRAFT = 1 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/views/AccountMyFormsDref/ActiveDrefTable/index.tsx b/app/src/views/AccountMyFormsDref/ActiveDrefTable/index.tsx
index 5e00c6747..e4bc615e0 100644
--- a/app/src/views/AccountMyFormsDref/ActiveDrefTable/index.tsx
+++ b/app/src/views/AccountMyFormsDref/ActiveDrefTable/index.tsx
@@ -30,6 +30,7 @@ import {
import useUserMe from '#hooks/domain/useUserMe';
import useFilterState from '#hooks/useFilterState';
import {
+ DREF_STATUS_APPROVED,
DREF_TYPE_LOAN,
type TypeOfDrefEnum,
} from '#utils/constants';
@@ -230,13 +231,15 @@ function ActiveDrefTable(props: Props) {
const {
unpublished_op_update_count,
- is_published,
+ status,
has_ops_update,
has_final_report,
country_details,
is_dref_imminent_v2,
} = originalDref;
+ const is_published = status === DREF_STATUS_APPROVED;
+
const canAddOpsUpdate = (is_published ?? false)
&& (applicationType === 'DREF' || applicationType === 'OPS_UPDATE')
&& !has_final_report
diff --git a/app/src/views/AccountMyFormsDref/DrefTableActions/index.tsx b/app/src/views/AccountMyFormsDref/DrefTableActions/index.tsx
index 8b16ad1f7..6e3f28989 100644
--- a/app/src/views/AccountMyFormsDref/DrefTableActions/index.tsx
+++ b/app/src/views/AccountMyFormsDref/DrefTableActions/index.tsx
@@ -27,7 +27,7 @@ import Link from '#components/Link';
import useAlert from '#hooks/useAlert';
import useRouting from '#hooks/useRouting';
import {
- DREF_STATUS_IN_PROGRESS,
+ DREF_STATUS_DRAFT,
DREF_TYPE_IMMINENT,
DREF_TYPE_LOAN,
type DrefStatus,
@@ -167,7 +167,7 @@ function DrefTableActions(props: Props) {
pending: publishDrefPending,
} = useLazyRequest({
method: 'POST',
- url: '/api/v2/dref/{id}/publish/',
+ url: '/api/v2/dref/{id}/approve/',
pathVariables: { id: String(id) },
// FIXME: typings should be fixed in the server
body: () => ({} as never),
@@ -198,7 +198,7 @@ function DrefTableActions(props: Props) {
pending: publishOpsUpdatePending,
} = useLazyRequest({
method: 'POST',
- url: '/api/v2/dref-op-update/{id}/publish/',
+ url: '/api/v2/dref-op-update/{id}/approve/',
pathVariables: { id: String(id) },
// FIXME: typings should be fixed in the server
body: () => ({} as never),
@@ -229,7 +229,7 @@ function DrefTableActions(props: Props) {
pending: publishFinalReportPending,
} = useLazyRequest({
method: 'POST',
- url: '/api/v2/dref-final-report/{id}/publish/',
+ url: '/api/v2/dref-final-report/{id}/approve/',
pathVariables: { id: String(id) },
// FIXME: typings should be fixed in the server
body: () => ({} as never),
@@ -385,7 +385,7 @@ function DrefTableActions(props: Props) {
const canDownloadAllocation = (applicationType === 'DREF' || applicationType === 'OPS_UPDATE');
- const canApprove = status === DREF_STATUS_IN_PROGRESS && hasPermissionToApprove;
+ const canApprove = status === DREF_STATUS_DRAFT && hasPermissionToApprove;
const shouldConfirmImminentAddOpsUpdate = drefType === DREF_TYPE_IMMINENT && isDrefImminentV2;
@@ -494,7 +494,7 @@ function DrefTableActions(props: Props) {
>
)}
>
- {status === DREF_STATUS_IN_PROGRESS && applicationType === 'DREF' && (
+ {status === DREF_STATUS_DRAFT && applicationType === 'DREF' && (
)}
- {status === DREF_STATUS_IN_PROGRESS && applicationType === 'OPS_UPDATE' && (
+ {status === DREF_STATUS_DRAFT && applicationType === 'OPS_UPDATE' && (
)}
- {status === DREF_STATUS_IN_PROGRESS && applicationType === 'FINAL_REPORT' && (
+ {status === DREF_STATUS_DRAFT && applicationType === 'FINAL_REPORT' && (
formFields,
+ useCurrentLanguageForMutation: true,
onSuccess: (response) => {
alert.show(
strings.formSaveRequestSuccessMessage,
@@ -479,6 +479,7 @@ export function Component() {
url: '/api/v2/dref/',
method: 'POST',
body: (formFields: DrefRequestPostBody) => formFields,
+ useCurrentLanguageForMutation: true,
onSuccess: (response) => {
alert.show(
strings.formSaveRequestSuccessMessage,
@@ -609,13 +610,14 @@ export function Component() {
const disabled = fetchingDref || saveDrefPending;
// New DREFs can only be created in English
- const nonEnglishCreate = isNotDefined(drefId) && currentLanguage !== 'en';
+ // const nonEnglishCreate = isNotDefined(drefId) && currentLanguage !== 'en';
+
const languageMismatch = isDefined(drefId)
&& isDefined(drefResponse)
&& currentLanguage !== drefResponse?.translation_module_original_language;
- const shouldHideForm = nonEnglishCreate
- || languageMismatch
- || fetchingDref
+
+ const shouldHideForm = fetchingDref
+ // || nonEnglishCreate
|| isDefined(drefResponseError);
return (
@@ -730,11 +732,11 @@ export function Component() {
originalLanguage={drefResponse.translation_module_original_language}
/>
)}
- {nonEnglishCreate && (
+ {/* nonEnglishCreate && (
- )}
+ ) */}
{isDefined(drefResponseError) && (
formFields,
+ useCurrentLanguageForMutation: true,
onSuccess: (response) => {
alert.show(
strings.formSaveRequestSuccessMessage,
@@ -409,8 +410,8 @@ export function Component() {
const languageMismatch = isDefined(finalReportId)
&& isDefined(finalReportResponse)
&& currentLanguage !== finalReportResponse?.translation_module_original_language;
- const shouldHideForm = languageMismatch
- || fetchingFinalReport
+
+ const shouldHideForm = fetchingFinalReport
|| isDefined(finalReportResponseError);
return (
diff --git a/app/src/views/DrefOperationalUpdateForm/index.tsx b/app/src/views/DrefOperationalUpdateForm/index.tsx
index a29fc1f00..254b3ef67 100644
--- a/app/src/views/DrefOperationalUpdateForm/index.tsx
+++ b/app/src/views/DrefOperationalUpdateForm/index.tsx
@@ -43,6 +43,7 @@ import NonFieldError from '#components/NonFieldError';
import Page from '#components/Page';
import useCurrentLanguage from '#hooks/domain/useCurrentLanguage';
import useAlert from '#hooks/useAlert';
+import { DREF_STATUS_APPROVED } from '#utils/constants';
import {
type GoApiResponse,
useLazyRequest,
@@ -313,7 +314,7 @@ export function Component() {
const prevOperationalUpdateId = useMemo(() => {
const currentOpsUpdate = drefResponse
?.operational_update_details
- ?.find((ou) => !ou.is_published);
+ ?.find((ou) => !(ou.status === DREF_STATUS_APPROVED));
if (isNotDefined(currentOpsUpdate)) {
return undefined;
@@ -344,6 +345,7 @@ export function Component() {
} = useLazyRequest({
url: '/api/v2/dref-op-update/{id}/',
method: 'PATCH',
+ useCurrentLanguageForMutation: true,
pathVariables: isDefined(opsUpdateId) ? { id: opsUpdateId } : undefined,
body: (formFields: OpsUpdateRequestBody) => formFields,
onSuccess: (response) => {
@@ -575,8 +577,8 @@ export function Component() {
const languageMismatch = isDefined(opsUpdateId)
&& isDefined(drefResponse)
&& currentLanguage !== opsUpdateResponse?.translation_module_original_language;
- const shouldHideForm = languageMismatch
- || fetchingOpsUpdate
+
+ const shouldHideForm = fetchingOpsUpdate
|| isDefined(opsUpdateResponseError);
return (
diff --git a/go-api b/go-api
index 0b28ce554..6745b93ae 160000
--- a/go-api
+++ b/go-api
@@ -1 +1 @@
-Subproject commit 0b28ce5542941c45666320b7411c4d9de6f6291a
+Subproject commit 6745b93aed93aff3d57751a91d6ee94c651f8112