Browse Source

Enable user to input sub project code

tags/Baseline_180220205_Frontend
cyril.tsui 9 months ago
parent
commit
0b4860640f
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      src/components/CreateProject/ProjectClientDetails.tsx

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

@@ -205,9 +205,14 @@ const ProjectClientDetails: React.FC<Props> = ({
); );


if (mainProject !== undefined) { if (mainProject !== undefined) {

const teamLeadIds = teamLeads.map((teamLead) => teamLead.id)
setValue("projectName", mainProject.projectName); setValue("projectName", mainProject.projectName);
setValue("projectCategoryId", mainProject.projectCategoryId); setValue("projectCategoryId", mainProject.projectCategoryId);
setValue("projectLeadId", mainProject.projectLeadId);

// set project lead id to the first team lead id if the main project lead id is not in the team lead list
setValue("projectLeadId", teamLeadIds.find((id) => id === mainProject.projectLeadId) ? mainProject.projectLeadId : teamLeadIds[0] ?? mainProject.projectLeadId);
setValue("serviceTypeId", mainProject.serviceTypeId); setValue("serviceTypeId", mainProject.serviceTypeId);
setValue("fundingTypeId", mainProject.fundingTypeId); setValue("fundingTypeId", mainProject.fundingTypeId);
setValue("contractTypeId", mainProject.contractTypeId); setValue("contractTypeId", mainProject.contractTypeId);
@@ -269,7 +274,7 @@ const ProjectClientDetails: React.FC<Props> = ({
<TextField <TextField
label={t("Project Code")} label={t("Project Code")}
fullWidth fullWidth
disabled={isSubProject && mainProjects !== undefined}
// disabled={isSubProject && mainProjects !== undefined}
{...register("projectCode", { {...register("projectCode", {
required: required:
!(isSubProject && mainProjects !== undefined) && !(isSubProject && mainProjects !== undefined) &&


Loading…
Cancel
Save