Skip to content

Commit

Permalink
Merge pull request #277 from itenium-be/project-extension
Browse files Browse the repository at this point in the history
Project extension bugfix
  • Loading branch information
Laoujin authored Dec 20, 2023
2 parents 2c3629c + aad1ec9 commit 70448e9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
4 changes: 0 additions & 4 deletions frontend/src/actions/projectActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ export function saveProject(project: IProjectModel, navigate?: any, after: 'to-l
if (after === 'to-list') {
navigate('/projects');
} else {
// First navigate away?
// Workaround for EditProject not reloading the form
// when the url _id changes. Need a hook for this :)
navigate('/projects');
navigate(`/projects/${response.body._id}`);
}
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/project/CopyProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Modal} from '../controls/Modal';
import {saveProject} from '../../actions/projectActions';
import {ArrayInput} from '../controls/form-controls/inputs/ArrayInput';
import {FullFormConfig} from '../../models';
import { ContractStatus } from '../client/models/ContractModels';
import {ContractStatus} from '../client/models/ContractModels';

type CopyProjectProps = {
projectToCopy: IProjectModel;
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/components/project/EditProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ export const EditProject = () => {

const docTitle = consultant._id ? 'projectEdit' : 'projectNew';
useDocumentTitle(docTitle, {consultant: consultant.firstName, client: client.name});

if (model && !project._id) {
if (model && (!project._id || project._id !== params.id)) {
setProject(model);
}

Expand Down Expand Up @@ -131,7 +130,7 @@ export const EditProject = () => {
</Form>
<StickyFooter claim={Claim.ManageProjects}>
<ConfirmationButton
className="tst-confirm-delete-project"
className="tst-confirm-delete-project"
onClick={() => dispatch(deleteProject(project._id, navigate) as any)}
variant="danger"
title={t('project.deleteConfirm.title')}
Expand All @@ -140,7 +139,7 @@ export const EditProject = () => {
>
{t('project.deleteConfirm.content')}
</ConfirmationButton>
{project.endDate && project._id && <CopyProject projectToCopy={project} />}
{project.endDate && project._id && <CopyProject projectToCopy={project}/>}
<BusyButton className="tst-save-project" onClick={() => dispatch(saveProject(project, navigate) as any)} disabled={isButtonDisabled}>
{t('save')}
</BusyButton>
Expand Down

0 comments on commit 70448e9

Please sign in to comment.