diff --git a/components/Forms/BasicDetailsForm.js b/components/Forms/BasicDetailsForm.js index 41f1c503..2ceae9b1 100644 --- a/components/Forms/BasicDetailsForm.js +++ b/components/Forms/BasicDetailsForm.js @@ -14,6 +14,7 @@ import Spinner from '../Spinner' import { useRouter } from 'next/router'; import { Alert } from '@mui/lab'; import { UpdateFormIdContext } from './Form'; +import { indexOf } from 'underscore'; // import { FacilityIdContext, FacilityWardDataContext } from './Form'; @@ -691,8 +692,11 @@ export function BasicDeatilsForm({ editMode }) { parent=facilityTypeDetails[0]?.parent; if(parent) { - document.getElementsByName('facility_type_parent')[0].value = parent.toString(); - } + const facilityTypeParent = document.getElementsByName('facility_type_parent') + if(facilityTypeParent) facilityTypeParent["value"] = parent; + // console.log({typeParent: facilityTypeParent["value"]}) + + } }) getFacilityTypeDetails(parent, options?.token) @@ -713,14 +717,12 @@ export function BasicDeatilsForm({ editMode }) { if (isClient) { - // return( - //
-    //     {
-    //       JSON.stringify({data: options?.data}, null, 2)
-    //     }
-    //   
- // ) + // return ( + //
{
+    //     JSON.stringify(formError, null, 2)
+    //   }
+ // ) return (
+ { - editMode ? - + + { + options?.data?.facility_checklist_document?.url !== (null || undefined) && + +

Uploaded File:

+ + {/* {options?.data?.official_name} Facility Checklist File */} + {options?.data?.facility_checklist_document?.url} + +
+ } + + : + className='flex-none w-full bg-transparent border-none outline-none flex-grow placeholder-gray-500 ' + /> + + + + : + - } - + + + } diff --git a/pages/facilities/[id].js b/pages/facilities/[id].js index 05877702..b0aceed2 100644 --- a/pages/facilities/[id].js +++ b/pages/facilities/[id].js @@ -28,18 +28,21 @@ import Fade from '@mui/material/Fade'; import {Formik, Form, Field} from 'formik' import Typography from '@mui/material/Typography'; import FacilitySideMenu from "../../components/FacilitySideMenu"; -import { Table, TableBody, TableCell, TableRow } from "@mui/material"; +import { Avatar} from "@mui/material"; import { useAlert } from "react-alert"; import { KeyboardArrowRight, KeyboardArrowDown } from "@mui/icons-material"; -import { ChevronRight } from "@mui/icons-material"; + +import { Checklist } from "@mui/icons-material"; +import { DocumentScanner } from "@mui/icons-material"; +import { FileCopy } from "@mui/icons-material"; +import { MailOutline } from "@mui/icons-material"; const Facility = (props) => { - // const userPermissions = useContext(PermissionContext) - // const userGroup = useContext(UserGroupContext) + const userCtx = useContext(UserContext) @@ -56,12 +59,12 @@ const Facility = (props) => { ); - const facility = props["0"]?.data; - const wardName = props["0"]?.data?.ward_name; - const center = props["1"]?.geoLocation?.center; - const geoLocationData = props["1"]?.geoLocation; - const qf = props["3"]?.qf ?? ''; - // const {facility_updated_json } = props["2"]?.updates; + const facility = props?.data; + const wardName = props?.data?.ward_name; + const center = props?.geoLocation?.center; + const geoLocationData = props?.geoLocation; + const qf = props?.qf ?? ''; + // const {facility_updated_json } = props?.updates; const filters = [] @@ -78,11 +81,11 @@ const Facility = (props) => { const [khisSynched, setKhisSynched] = useState(false); const [facilityFeedBack, setFacilityFeedBack] = useState([]) const [pathId, setPathId] = useState('') - const [allFctsSelected, setAllFctsSelected] = useState(false); + const [allFctsSelected, setAllFctsSelected] = useState(false) const [title, setTitle] = useState('') - const [isViewChangeLog, setIsViewChangeLog] = useState(false) - const [changeLogData, setChangeLogData] = useState(null) + const [isViewActivityLog, setViewActivityLog] = useState(true) + const [activityLog, setActivityLog] = useState(null) const [isClosingFacility, setIsClosingFacility] = useState(false) @@ -107,11 +110,16 @@ const Facility = (props) => { useEffect(() => { setUser(userCtx); + setActivityLog(props?.activityLog) if(user.id === 6){ router.push('/auth/login') } }, []) if(isClient) { + + // return (
{
+      //   JSON.stringify(props, null, 2)
+      // }
) return ( <> @@ -501,7 +509,7 @@ const Facility = (props) => { -
+
{/* Action Buttons e.g (Approve/Reject, Edit, Regulate, Upgrade, Close) */} @@ -642,7 +650,7 @@ const Facility = (props) => { console.log({props}) } - + */} + + + +
} {/* Facility Details Tab Section */} - + {/* end facility approval */} -