diff --git a/src/app/(main)/projects/create/sub/not-found.tsx b/src/app/(main)/projects/createSub/not-found.tsx
similarity index 100%
rename from src/app/(main)/projects/create/sub/not-found.tsx
rename to src/app/(main)/projects/createSub/not-found.tsx
diff --git a/src/app/(main)/projects/create/sub/page.tsx b/src/app/(main)/projects/createSub/page.tsx
similarity index 100%
rename from src/app/(main)/projects/create/sub/page.tsx
rename to src/app/(main)/projects/createSub/page.tsx
diff --git a/src/app/(main)/projects/edit/sub/not-found.tsx b/src/app/(main)/projects/editSub/not-found.tsx
similarity index 100%
rename from src/app/(main)/projects/edit/sub/not-found.tsx
rename to src/app/(main)/projects/editSub/not-found.tsx
diff --git a/src/app/(main)/projects/edit/sub/page.tsx b/src/app/(main)/projects/editSub/page.tsx
similarity index 100%
rename from src/app/(main)/projects/edit/sub/page.tsx
rename to src/app/(main)/projects/editSub/page.tsx
diff --git a/src/app/(main)/projects/page.tsx b/src/app/(main)/projects/page.tsx
index 129d601..7cf44d0 100644
--- a/src/app/(main)/projects/page.tsx
+++ b/src/app/(main)/projects/page.tsx
@@ -43,7 +43,7 @@ const Projects: React.FC = async () => {
color="secondary"
startIcon={}
LinkComponent={Link}
- href="/projects/create/sub"
+ href="/projects/createSub"
>
{t("Create Sub Project")}
}
diff --git a/src/components/Breadcrumb/Breadcrumb.tsx b/src/components/Breadcrumb/Breadcrumb.tsx
index 8c1b9b0..73f41f6 100644
--- a/src/components/Breadcrumb/Breadcrumb.tsx
+++ b/src/components/Breadcrumb/Breadcrumb.tsx
@@ -15,9 +15,9 @@ const pathToLabelMap: { [path: string]: string } = {
"/home": "User Workspace",
"/projects": "Projects",
"/projects/create": "Create Project",
- "/projects/create/sub": "Sub Project",
+ "/projects/createSub": "Sub Project",
"/projects/edit": "Edit Project",
- "/projects/edit/sub": "Sub Project",
+ "/projects/editSub": "Sub Project",
"/tasks": "Task Template",
"/tasks/create": "Create Task Template",
"/staffReimbursement": "Staff Reimbursement",
diff --git a/src/components/ControlledAutoComplete/ControlledAutoComplete.tsx b/src/components/ControlledAutoComplete/ControlledAutoComplete.tsx
index 36e7542..ed7e81b 100644
--- a/src/components/ControlledAutoComplete/ControlledAutoComplete.tsx
+++ b/src/components/ControlledAutoComplete/ControlledAutoComplete.tsx
@@ -72,11 +72,11 @@ function ControlledAutoComplete<
);
}}
- // renderTags={(tagValue, getTagProps) => {
- // return tagValue.map((option, index) => (
- //
- // ))
- // }}
+ renderTags={(tagValue, getTagProps) => {
+ return tagValue.map((option, index) => (
+
+ ))
+ }}
onChange={(event, value) => {
field.onChange(value?.map(v => v.id))
}}
@@ -99,11 +99,11 @@ function ControlledAutoComplete<
);
}}
- // renderTags={(tagValue, getTagProps) => {
- // return tagValue.map((option, index) => (
- //
- // ))
- // }}
+ renderTags={(tagValue, getTagProps) => {
+ return tagValue.map((option, index) => (
+
+ ))
+ }}
onChange={(event, value) => {
field.onChange(value?.id ?? null)
}}
diff --git a/src/components/CreateProject/Milestone.tsx b/src/components/CreateProject/Milestone.tsx
index f2e62ce..d854af9 100644
--- a/src/components/CreateProject/Milestone.tsx
+++ b/src/components/CreateProject/Milestone.tsx
@@ -50,6 +50,16 @@ const Milestone: React.FC = ({ allTasks, isActive }) => {
const [currentTaskGroupId, setCurrentTaskGroupId] = useState(
taskGroups[0].id,
);
+
+ /*const onSelectTaskGroup = useCallback(
+ (event: SelectChangeEvent) => {
+ const id = event.target.value;
+ const newTaksGroupId = typeof id === "string" ? parseInt(id) : id;
+ setCurrentTaskGroupId(newTaksGroupId);
+ },
+ [],
+ );*/
+
const onSelectTaskGroup = useCallback(
(event: SyntheticEvent, value: NonNullable) => {
const id = value.id;
diff --git a/src/components/CreateProject/ProjectClientDetails.tsx b/src/components/CreateProject/ProjectClientDetails.tsx
index 9e4ac7f..bce421a 100644
--- a/src/components/CreateProject/ProjectClientDetails.tsx
+++ b/src/components/CreateProject/ProjectClientDetails.tsx
@@ -113,6 +113,7 @@ const ProjectClientDetails: React.FC = ({
// get customer (client) contact combo
const [firstCustomerLoaded, setFirstCustomerLoaded] = useState(false)
+ const [isMainProjectInfoLoading, setIsMainProjectInfoLoading] = useState(false)
useEffect(() => {
if (selectedCustomerId !== undefined) {
fetchCustomer(selectedCustomerId).then(({ contacts, subsidiaryIds }) => {
@@ -120,8 +121,10 @@ const ProjectClientDetails: React.FC = ({
setCustomerSubsidiaryIds(subsidiaryIds);
// if (subsidiaryIds.length > 0) setValue("clientSubsidiaryId", subsidiaryIds[0])
- // else
- if (isEditMode && !firstCustomerLoaded) { setFirstCustomerLoaded(true) } else setValue("clientSubsidiaryId", null)
+ // else
+ if (isEditMode && !firstCustomerLoaded) { setFirstCustomerLoaded(true) }
+ else if (!isEditMode && isMainProjectInfoLoading) { setIsMainProjectInfoLoading(false) }
+ else setValue("clientSubsidiaryId", null)
// if (contacts.length > 0) setValue("clientContactId", contacts[0].id)
// else setValue("clientContactId", undefined)
});
@@ -160,6 +163,7 @@ const ProjectClientDetails: React.FC = ({
const mainProject = mainProjects.find(project => project.projectId === mainProjectId);
if (mainProject !== undefined) {
+ setIsMainProjectInfoLoading(() => true)
setValue("projectName", mainProject.projectName)
setValue("projectCategoryId", mainProject.projectCategoryId)
setValue("projectLeadId", mainProject.projectLeadId)
diff --git a/src/components/ProjectSearch/ProjectSearch.tsx b/src/components/ProjectSearch/ProjectSearch.tsx
index bbb1d67..6456902 100644
--- a/src/components/ProjectSearch/ProjectSearch.tsx
+++ b/src/components/ProjectSearch/ProjectSearch.tsx
@@ -62,7 +62,7 @@ const ProjectSearch: React.FC = ({ projects, projectCategories }) => {
const onProjectClick = useCallback(
(project: ProjectResult) => {
if (Boolean(project.mainProject)) {
- router.push(`/projects/edit/sub?id=${project.id}`);
+ router.push(`/projects/editSub?id=${project.id}`);
} else router.push(`/projects/edit?id=${project.id}`);
},
[router],