diff --git a/components/Forms/BasicDetailsForm.js b/components/Forms/BasicDetailsForm.js index eaf0a96..4d3fb7b 100644 --- a/components/Forms/BasicDetailsForm.js +++ b/components/Forms/BasicDetailsForm.js @@ -168,29 +168,27 @@ export function BasicDeatilsForm({ editMode }) { }) }) - const handleDateChange = useCallback((e) => { + // const handleDateChange = useCallback((e) => { - e.preventDefault() + // e.preventDefault() - if (e.currentTarget.name == "date_established") { - setDateValidationError(prev => ({ ...prev, date_established: null })) - } - const today = new Date() + // if (e.currentTarget.name == "date_established") { + // setDateValidationError(prev => ({ ...prev, date_established: null })) + // } + // const today = new Date() - const setDate = e.currentTarget.valueAsDate + // const setDate = e.currentTarget.valueAsDate - if (setDate > today) { - if (e.currentTarget.name == "date_established") { - setDateValidationError(prev => ({ ...prev, date_established: 'Date Established cannot be in the future' })) - } + // if (setDate > today) { + // if (e.currentTarget.name == "date_established") { + // setDateValidationError(prev => ({ ...prev, date_established: 'Date Established cannot be in the future' })) + // } - e.currentTarget.value = '' + // e.currentTarget.value = '' - } - }) + // } + // }) - - const handleSelectChange = useCallback(async (e) => { @@ -565,7 +563,7 @@ export function BasicDeatilsForm({ editMode }) { if (facilityData) { fetch( - `${process.env.NEXT_PUBLIC_API_URL}/common/wards/${facilityData?.ward}/`, + `${process.env.NEXT_PUBLIC_API_URL}/common/wards/${facilityData?.ward}`, { headers: { Authorization: 'Bearer ' + options?.token, diff --git a/components/Forms/GeolocationForm.js b/components/Forms/GeolocationForm.js index 0e0bdcf..614e6ca 100644 --- a/components/Forms/GeolocationForm.js +++ b/components/Forms/GeolocationForm.js @@ -120,8 +120,8 @@ export function GeolocationForm({ editMode }) { if (payload) { const url = options?.data?.lat_long && options?.data?.coordinates ? - `${process.env.NEXT_PUBLIC_API_URL}/gis/facility_coordinates/${options?.data?.lat_long && `${options?.data?.coordinates}/`}` : - `${process.env.NEXT_PUBLIC_API_URL}/gis/facility_coordinates/` + `${process.env.NEXT_PUBLIC_API_URL}/gis/facility_coordinates/${options?.data?.lat_long && `${options?.data?.coordinates}/?access_token=${options?.token}`}` : + `${process.env.NEXT_PUBLIC_API_URL}/gis/facility_coordinates/?access_token=${options?.token}` fetch(url, { @@ -209,7 +209,7 @@ export function GeolocationForm({ editMode }) { // console.log({payload}) - fetch(`${process.env.NEXT_PUBLIC_API_URL}/gis/facility_coordinates/`, { + fetch(`${process.env.NEXT_PUBLIC_API_URL}/gis/facility_coordinates/?access_token=${options?.token}`, { method: 'POST', headers: { 'Accept': 'application/json',