Skip to content

Commit

Permalink
Merge pull request #5346 from bcgov/dev-rook-RQ-FOIMOD-2975-bugfix
Browse files Browse the repository at this point in the history
Enable editing personal tag for ministry users FOIMOD-2976
  • Loading branch information
richard-aot authored Jul 30, 2024
2 parents 294d8bc + 78a45fb commit d7e6187
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 278 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ const MCFPersonal = ({
setNewPersonalAttributes,
updatePersonalAttributes,
setCurPersonalAttributes,
setCurrentEditRecord
setCurrentEditRecord,
divisionModalTagValue,
divisions=[],
isMinistryCoordinator,
currentEditRecord
}) => {
const [personalAttributes, setPersonalAttributes] = useState();
useEffect(() => {
Expand All @@ -44,7 +48,7 @@ const MCFPersonal = ({
const MCFSections = useSelector((state) => state.foiRequests.foiPersonalSections);
const [tagList, setTagList] = useState([]);
const [otherTagList, setOtherTagList] = useState([]);

const MCFPeople = useSelector(
(state) => state.foiRequests.foiPersonalPeople
);
Expand All @@ -71,6 +75,12 @@ const MCFPersonal = ({
const [additionalFileTypes, setAdditionalFileTypes] = useState([]);
const [showAdditionalFileTypes, setShowAdditionalFileTypes] = useState(false);

useEffect(() => {
if(currentEditRecord?.attributes?.divisions[0]?.divisionid) {
setNewDivision(currentEditRecord.attributes.divisions[0].divisionid);
}
},[currentEditRecord])

useEffect(() => {
if(MCFSections?.sections) {
if(MCFSections.sections.length > MCFPopularSections-1) {
Expand Down Expand Up @@ -277,6 +287,28 @@ const MCFPersonal = ({
</span>
</div>


{isMinistryCoordinator && divisions.length > 0 && (<>
<div className="tagtitle">
<span>Select Division: *</span>
</div>
<div className="taglist">
{divisions.map(tag =>
<ClickableChip
id={`${tag.divisionid}Tag`}
key={`${tag.divisionid}-tag`}
label={tag.divisionname.toUpperCase()}
sx={{width: "fit-content", marginRight: "8px", marginBottom: "8px"}}
color="primary"
size="small"
onClick={()=>{setNewDivision(tag.divisionid)}}
clicked={divisionModalTagValue == tag.divisionid}
/>
)}
</div>
</>)}


<div className="tagtitle">
<span>Select Person: *</span>
</div>
Expand Down Expand Up @@ -586,6 +618,7 @@ const MCFPersonal = ({
<button
className={`btn-bottom btn-save btn`}
onClick={() => {updatePersonalAttributes(true);reset();}}
disabled={isMinistryCoordinator}
>
Update for All
</button>
Expand Down

This file was deleted.

Loading

0 comments on commit d7e6187

Please sign in to comment.