Browse Source

update project

tags/Baseline_30082024_FRONTEND_UAT
cyril.tsui 1 year ago
parent
commit
fd25f5de03
10 changed files with 30 additions and 16 deletions
  1. +0
    -0
      src/app/(main)/projects/createSub/not-found.tsx
  2. +0
    -0
      src/app/(main)/projects/createSub/page.tsx
  3. +0
    -0
      src/app/(main)/projects/editSub/not-found.tsx
  4. +0
    -0
      src/app/(main)/projects/editSub/page.tsx
  5. +1
    -1
      src/app/(main)/projects/page.tsx
  6. +2
    -2
      src/components/Breadcrumb/Breadcrumb.tsx
  7. +10
    -10
      src/components/ControlledAutoComplete/ControlledAutoComplete.tsx
  8. +10
    -0
      src/components/CreateProject/Milestone.tsx
  9. +6
    -2
      src/components/CreateProject/ProjectClientDetails.tsx
  10. +1
    -1
      src/components/ProjectSearch/ProjectSearch.tsx

src/app/(main)/projects/create/sub/not-found.tsx → src/app/(main)/projects/createSub/not-found.tsx View File


src/app/(main)/projects/create/sub/page.tsx → src/app/(main)/projects/createSub/page.tsx View File


src/app/(main)/projects/edit/sub/not-found.tsx → src/app/(main)/projects/editSub/not-found.tsx View File


src/app/(main)/projects/edit/sub/page.tsx → src/app/(main)/projects/editSub/page.tsx View File


+ 1
- 1
src/app/(main)/projects/page.tsx View File

@@ -43,7 +43,7 @@ const Projects: React.FC = async () => {
color="secondary" color="secondary"
startIcon={<Add />} startIcon={<Add />}
LinkComponent={Link} LinkComponent={Link}
href="/projects/create/sub"
href="/projects/createSub"
> >
{t("Create Sub Project")} {t("Create Sub Project")}
</Button>} </Button>}


+ 2
- 2
src/components/Breadcrumb/Breadcrumb.tsx View File

@@ -15,9 +15,9 @@ const pathToLabelMap: { [path: string]: string } = {
"/home": "User Workspace", "/home": "User Workspace",
"/projects": "Projects", "/projects": "Projects",
"/projects/create": "Create Project", "/projects/create": "Create Project",
"/projects/create/sub": "Sub Project",
"/projects/createSub": "Sub Project",
"/projects/edit": "Edit Project", "/projects/edit": "Edit Project",
"/projects/edit/sub": "Sub Project",
"/projects/editSub": "Sub Project",
"/tasks": "Task Template", "/tasks": "Task Template",
"/tasks/create": "Create Task Template", "/tasks/create": "Create Task Template",
"/staffReimbursement": "Staff Reimbursement", "/staffReimbursement": "Staff Reimbursement",


+ 10
- 10
src/components/ControlledAutoComplete/ControlledAutoComplete.tsx View File

@@ -72,11 +72,11 @@ function ControlledAutoComplete<
</li> </li>
); );
}} }}
// renderTags={(tagValue, getTagProps) => {
// return tagValue.map((option, index) => (
// <Chip {...getTagProps({ index })} key={option?.id} label={option.label ?? option.name} />
// ))
// }}
renderTags={(tagValue, getTagProps) => {
return tagValue.map((option, index) => (
<Chip {...getTagProps({ index })} key={option?.id} label={option.label ?? option.name} />
))
}}
onChange={(event, value) => { onChange={(event, value) => {
field.onChange(value?.map(v => v.id)) field.onChange(value?.map(v => v.id))
}} }}
@@ -99,11 +99,11 @@ function ControlledAutoComplete<
</MenuItem> </MenuItem>
); );
}} }}
// renderTags={(tagValue, getTagProps) => {
// return tagValue.map((option, index) => (
// <Chip {...getTagProps({ index })} key={option?.id} label={option.label ?? option.name} />
// ))
// }}
renderTags={(tagValue, getTagProps) => {
return tagValue.map((option, index) => (
<Chip {...getTagProps({ index })} key={option?.id} label={option.label ?? option.name} />
))
}}
onChange={(event, value) => { onChange={(event, value) => {
field.onChange(value?.id ?? null) field.onChange(value?.id ?? null)
}} }}


+ 10
- 0
src/components/CreateProject/Milestone.tsx View File

@@ -50,6 +50,16 @@ const Milestone: React.FC<Props> = ({ allTasks, isActive }) => {
const [currentTaskGroupId, setCurrentTaskGroupId] = useState( const [currentTaskGroupId, setCurrentTaskGroupId] = useState(
taskGroups[0].id, taskGroups[0].id,
); );

/*const onSelectTaskGroup = useCallback(
(event: SelectChangeEvent<TaskGroup["id"]>) => {
const id = event.target.value;
const newTaksGroupId = typeof id === "string" ? parseInt(id) : id;
setCurrentTaskGroupId(newTaksGroupId);
},
[],
);*/

const onSelectTaskGroup = useCallback( const onSelectTaskGroup = useCallback(
(event: SyntheticEvent<Element, Event>, value: NonNullable<TaskGroup>) => { (event: SyntheticEvent<Element, Event>, value: NonNullable<TaskGroup>) => {
const id = value.id; const id = value.id;


+ 6
- 2
src/components/CreateProject/ProjectClientDetails.tsx View File

@@ -113,6 +113,7 @@ const ProjectClientDetails: React.FC<Props> = ({


// get customer (client) contact combo // get customer (client) contact combo
const [firstCustomerLoaded, setFirstCustomerLoaded] = useState(false) const [firstCustomerLoaded, setFirstCustomerLoaded] = useState(false)
const [isMainProjectInfoLoading, setIsMainProjectInfoLoading] = useState(false)
useEffect(() => { useEffect(() => {
if (selectedCustomerId !== undefined) { if (selectedCustomerId !== undefined) {
fetchCustomer(selectedCustomerId).then(({ contacts, subsidiaryIds }) => { fetchCustomer(selectedCustomerId).then(({ contacts, subsidiaryIds }) => {
@@ -120,8 +121,10 @@ const ProjectClientDetails: React.FC<Props> = ({
setCustomerSubsidiaryIds(subsidiaryIds); setCustomerSubsidiaryIds(subsidiaryIds);


// if (subsidiaryIds.length > 0) setValue("clientSubsidiaryId", subsidiaryIds[0]) // 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) // if (contacts.length > 0) setValue("clientContactId", contacts[0].id)
// else setValue("clientContactId", undefined) // else setValue("clientContactId", undefined)
}); });
@@ -160,6 +163,7 @@ const ProjectClientDetails: React.FC<Props> = ({
const mainProject = mainProjects.find(project => project.projectId === mainProjectId); const mainProject = mainProjects.find(project => project.projectId === mainProjectId);


if (mainProject !== undefined) { if (mainProject !== undefined) {
setIsMainProjectInfoLoading(() => true)
setValue("projectName", mainProject.projectName) setValue("projectName", mainProject.projectName)
setValue("projectCategoryId", mainProject.projectCategoryId) setValue("projectCategoryId", mainProject.projectCategoryId)
setValue("projectLeadId", mainProject.projectLeadId) setValue("projectLeadId", mainProject.projectLeadId)


+ 1
- 1
src/components/ProjectSearch/ProjectSearch.tsx View File

@@ -62,7 +62,7 @@ const ProjectSearch: React.FC<Props> = ({ projects, projectCategories }) => {
const onProjectClick = useCallback( const onProjectClick = useCallback(
(project: ProjectResult) => { (project: ProjectResult) => {
if (Boolean(project.mainProject)) { 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}`); } else router.push(`/projects/edit?id=${project.id}`);
}, },
[router], [router],


Loading…
Cancel
Save