@@ -44,7 +44,9 @@ import {
4444 TENANT_ID ,
4545} from "../../helpers/Constants" ;
4646import { useSuggestionByStakeholderId } from "hooks/useSuggestionByStakeholderId" ;
47+ import { useStakeholderLog } from "hooks/useStakeholderLog" ;
4748import SuggestionHistory from "./OrganizationEdit/SuggestionHistory" ;
49+ import ChangeHistory from "./OrganizationEdit/ChangeHistory" ;
4850
4951const phoneRegExp = / ^ \( \d { 3 } \) \d { 3 } - \d { 4 } $ / ;
5052
@@ -169,6 +171,7 @@ const emptyOrganization = {
169171 submittedUser : "" ,
170172 approvedDate : "" ,
171173 approvedUser : "" ,
174+ neighborhoodName : "" ,
172175 selectedCategoryIds : [ ] ,
173176 hours : [ ] ,
174177 instagram : "" ,
@@ -226,11 +229,17 @@ const OrganizationEdit = (props) => {
226229 const { data : stakeholderSuggestions , refetch : refetchSuggestions } =
227230 useSuggestionByStakeholderId ( editId ) ;
228231
232+ const {
233+ data : versionHistory ,
234+ loading : historyLoading ,
235+ error : historyError ,
236+ } = useStakeholderLog ( editId ) ;
237+
229238 useEffect ( ( ) => {
230239 const fetchData = async ( ) => {
231240 try {
232241 if ( editId ) {
233- const stakeholder = await stakeholderService . getById ( editId ) ;
242+ const stakeholder = await stakeholderService . getById ( editId ) ;
234243 // For editing purposes, it is better to convert the
235244 // stakeholder.categories array of objects to an array of
236245 // categoryIds as stakeholder.categoryIds
@@ -561,6 +570,9 @@ const OrganizationEdit = (props) => {
561570 < Tab label = "Donations" { ...a11yProps ( 4 ) } />
562571 < Tab label = "Verification" { ...a11yProps ( 5 ) } />
563572 < Tab label = "Suggestion History" { ...a11yProps ( 6 ) } />
573+ { ( user ?. isAdmin || user ?. isCoordinator ) && (
574+ < Tab label = "Change History" { ...a11yProps ( 7 ) } />
575+ ) }
564576 </ Tabs >
565577 </ AppBar >
566578 < Identification
@@ -623,6 +635,14 @@ const OrganizationEdit = (props) => {
623635 editedSuggestions = { editedSuggestions }
624636 onEdit = { handleSuggestionEdit }
625637 />
638+ { ( user ?. isAdmin || user ?. isCoordinator ) && (
639+ < ChangeHistory
640+ tabPage = { tabPage }
641+ versions = { versionHistory }
642+ loading = { historyLoading }
643+ error = { historyError }
644+ />
645+ ) }
626646 </ Box >
627647 < Stack direction = "row" >
628648 < div style = { { flexBasis : "20%" , flexGrow : 1 } } >
0 commit comments