diff --git a/app/Base/configs/routes.tsx b/app/Base/configs/routes.tsx
index 087c2bb8e8..4442eb108c 100644
--- a/app/Base/configs/routes.tsx
+++ b/app/Base/configs/routes.tsx
@@ -322,7 +322,7 @@ const assessments = wrap({
if (!project) {
return false;
}
- return project.hasAssessmentTemplate;
+ return project.isAssessmentEnabled;
},
visibility: 'is-authenticated',
});
@@ -341,7 +341,7 @@ const leadGroups = wrap({
if (!project) {
return false;
}
- return project.hasAssessmentTemplate;
+ return project.isAssessmentEnabled;
},
visibility: 'is-authenticated',
});
@@ -384,7 +384,7 @@ const aryDashboard = wrap({
return (
// project.isVisualizationEnabled
// && project.isVisualizationAvailable
- project.hasAssessmentTemplate
+ project.isAssessmentEnabled
);
},
});
@@ -462,7 +462,7 @@ const newAssessmentEditRoute = wrap({
return false;
}
// NOTE: using permission for LEAD as we don't have one for assessment
- return project.hasAssessmentTemplate && (
+ return project.isAssessmentEnabled && (
project.allowedPermissions.includes('CREATE_LEAD')
|| project.allowedPermissions.includes('UPDATE_LEAD')
);
@@ -486,7 +486,7 @@ const createNewAssessmentEditRoute = wrap({
return false;
}
// NOTE: using permission for LEAD as we don't have one for assessment
- return project.hasAssessmentTemplate && (
+ return project.isAssessmentEnabled && (
project.allowedPermissions.includes('CREATE_LEAD')
|| project.allowedPermissions.includes('UPDATE_LEAD')
);
@@ -510,7 +510,7 @@ const assessmentEditRoute = wrap({
return false;
}
// NOTE: using permission for LEAD as we don't have one for assessment
- return project.hasAssessmentTemplate && (
+ return project.isAssessmentEnabled && (
project.allowedPermissions.includes('CREATE_LEAD')
|| project.allowedPermissions.includes('UPDATE_LEAD')
);
@@ -534,7 +534,7 @@ const groupAssessmentEditRoute = wrap({
return false;
}
// NOTE: using permission for LEAD as we don't have one for assessment
- return project.hasAssessmentTemplate && (
+ return project.isAssessmentEnabled && (
project.allowedPermissions.includes('CREATE_LEAD')
|| project.allowedPermissions.includes('UPDATE_LEAD')
);
diff --git a/app/components/general/BulkUploadModal/LeadsPane/index.tsx b/app/components/general/BulkUploadModal/LeadsPane/index.tsx
index 955894e789..d81d651b91 100644
--- a/app/components/general/BulkUploadModal/LeadsPane/index.tsx
+++ b/app/components/general/BulkUploadModal/LeadsPane/index.tsx
@@ -230,7 +230,7 @@ function LeadsPane(props: Props) {
// onLeadGroupOptionsChange={setLeadGroupOptions}
assigneeOptions={projectUserOptions}
onAssigneeOptionChange={setProjectUserOptions}
- hasAssessment={project?.hasAssessmentTemplate}
+ hasAssessment={project?.isAssessmentEnabled}
/>
{selectedLeadAttachment && (
diff --git a/app/gqlFragments.ts b/app/gqlFragments.ts
index 76cc6c3303..077df4340d 100644
--- a/app/gqlFragments.ts
+++ b/app/gqlFragments.ts
@@ -277,7 +277,7 @@ export const LAST_ACTIVE_PROJECT_FRAGMENT = gql`
analysisFramework {
id
}
- hasAssessmentTemplate
+ isAssessmentEnabled
id
isPrivate
title
diff --git a/app/views/EntryEdit/SourceDetails/index.tsx b/app/views/EntryEdit/SourceDetails/index.tsx
index d882c0f69b..9df11a0245 100644
--- a/app/views/EntryEdit/SourceDetails/index.tsx
+++ b/app/views/EntryEdit/SourceDetails/index.tsx
@@ -126,7 +126,7 @@ function SourceDetails(props: Props) {
confidentialityOptions={
leadOptions?.leadConfidentialityOptions?.enumValues
}
- hasAssessment={project?.hasAssessmentTemplate}
+ hasAssessment={project?.isAssessmentEnabled}
/>
diff --git a/app/views/Export/index.tsx b/app/views/Export/index.tsx
index 921a389d7e..1d1c83a6ec 100644
--- a/app/views/Export/index.tsx
+++ b/app/views/Export/index.tsx
@@ -52,7 +52,7 @@ function Export() {
>
Export History
- {project?.hasAssessmentTemplate && (
+ {project?.isAssessmentEnabled && (
New Export
- {project?.hasAssessmentTemplate && (
+ {project?.isAssessmentEnabled && (
)}
@@ -102,7 +102,7 @@ function Export() {
/>
)}
- {project?.hasAssessmentTemplate && (
+ {project?.isAssessmentEnabled && (
{
@@ -192,6 +194,7 @@ const initialValue: PartialFormType = {
title: '',
isPrivate: false,
isTest: false,
+ isAssessmentEnabled: false,
hasPubliclyViewableUnprotectedLeads: false,
hasPubliclyViewableConfidentialLeads: false,
hasPubliclyViewableRestrictedLeads: false,
@@ -215,9 +218,11 @@ const LAST_ACTIVE_PROJECT = gql`
`;
const CURRENT_PROJECT = gql`
+ ${LAST_ACTIVE_PROJECT_FRAGMENT}
query UserCurrentProject($projectId: ID!) {
project(id: $projectId) {
id
+ ...LastActiveProjectResponse
title
startDate
endDate
@@ -228,6 +233,7 @@ const CURRENT_PROJECT = gql`
description
isPrivate
isTest
+ isAssessmentEnabled
hasPubliclyViewableUnprotectedLeads
hasPubliclyViewableConfidentialLeads
hasPubliclyViewableRestrictedLeads
@@ -251,14 +257,17 @@ const CURRENT_PROJECT = gql`
`;
const PROJECT_CREATE = gql`
+${LAST_ACTIVE_PROJECT_FRAGMENT}
mutation ProjectCreate($data: ProjectCreateInputType!) {
projectCreate(data: $data) {
ok
result {
+ ...LastActiveProjectResponse
id
title
startDate
endDate
+ isAssessmentEnabled
hasPubliclyViewableUnprotectedLeads
hasPubliclyViewableConfidentialLeads
hasPubliclyViewableRestrictedLeads
@@ -289,12 +298,14 @@ mutation ProjectCreate($data: ProjectCreateInputType!) {
`;
const PROJECT_UPDATE = gql`
+${LAST_ACTIVE_PROJECT_FRAGMENT}
mutation ProjectUpdate($projectId: ID!, $data: ProjectUpdateInputType!) {
project(id: $projectId) {
projectUpdate(data: $data) {
ok
result {
id
+ ...LastActiveProjectResponse
title
startDate
endDate
@@ -305,6 +316,7 @@ mutation ProjectUpdate($projectId: ID!, $data: ProjectUpdateInputType!) {
description
isPrivate
isTest
+ isAssessmentEnabled
hasPubliclyViewableUnprotectedLeads
hasPubliclyViewableConfidentialLeads
hasPubliclyViewableRestrictedLeads
@@ -475,6 +487,10 @@ function ProjectDetailsForm(props: Props) {
{ variant: 'error' },
);
} else if (ok) {
+ setPristine(true);
+ if (response?.project?.projectUpdate?.result) {
+ setProject(response?.project?.projectUpdate?.result);
+ }
alert.show(
'Successfully updated project!',
{ variant: 'success' },
@@ -763,6 +779,27 @@ function ProjectDetailsForm(props: Props) {
+
+ )}
+ >
+
+