Skip to content

Commit

Permalink
Updated the wide view port UI for all the pages; and fixed the facili…
Browse files Browse the repository at this point in the history
…ty edit form issue
  • Loading branch information
ertush committed Mar 7, 2024
1 parent bec7595 commit e7251a6
Show file tree
Hide file tree
Showing 25 changed files with 350 additions and 297 deletions.
12 changes: 7 additions & 5 deletions components/Forms/BasicDetailsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,15 +545,16 @@ export function BasicDeatilsForm({ editMode }) {
useEffect(() => {

// console.log({facility: options?.data})
async function updateFacilityTypeDetailOptions() {
async function updateFacilityTypeDetailOptions(e) {
try {
const facilityTypeDetails = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/facilities/facility_types_details/?is_parent=false&parent=${e.target.value}`, {
const facilityTypeDetails = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/facilities/facility_types_details/?is_parent=false`, {
headers: {
'Accept': 'application/json',
'Authorization': `Bearer ${options?.token}`
}
})


const filteredFacilityType = (await facilityTypeDetails.json())?.results

if (!filteredFacilityType) throw Error('Unable to Fetch Facility Type Details')
Expand All @@ -571,7 +572,7 @@ export function BasicDeatilsForm({ editMode }) {

}
catch (e) {
console.error(e.message)
console.error(e?.message)
}
}

Expand Down Expand Up @@ -1582,9 +1583,10 @@ export function BasicDeatilsForm({ editMode }) {
</label>

<input
type='file'
type={editMode ? 'text' : 'file' }
name='facility_checklist_document'
defaultValue={options?.data?.facility_checklist_document ?? ''}
disabled={editMode}
defaultValue={`Checklist File ${options?.data?.facility_checklist_document?.url ?? 'missing'}`}
className='flex-none w-full bg-transparent p-2 flex-grow border placeholder-gray-500 border-gray-400 rounded focus:shadow-none focus:border-black outline-none'
/>

Expand Down
2 changes: 1 addition & 1 deletion components/Forms/RegulationForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export function RegulationForm() {
!hideLicenseNumber &&
<div className="w-full flex flex-col items-start justify-start gap-1 mb-3">
<label htmlFor="license_number" className="text-gray-600 bg-transparent capitalize text-sm">License Number</label>
<Field type="text" name="license_number" className="flex-none w-full bg-transparent p-2 flex-grow border placeholder-gray-500 border-gray-400 rounded focus:shadow-none focus:border-black outline-none" />
<Field type="text" name="license_number" className="flex-none w-full bg-transparent p-2 flex-grow border placeholder-gray-500 border-gray-400 rounded focus:shadow-none focus:border-black outline-none" />
</div>
}

Expand Down
14 changes: 7 additions & 7 deletions components/Forms/formComponents/EditListWithCount.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,16 +455,16 @@ function EditListWithCount(
{
showItemCategory &&
<ul className='max-h-96 overflow-auto border-r border-l border-b border-gray-500'>
{categoryOptions.map(({ label, value, catcount }) => (
<div key={value}
{categoryOptions.map(({ label, value, catcount }, i) => (
<div key={i}
className='card bg-gray-50 shadow-md p-2 group hover:bg-gray-500 hover:text-gray-50 hover:cursor-pointer'
>
<li
className="flex items-center justify-start cursor-pointer space-x-2 p-1 px-2"
onClick={() => {
filterSpecialities(value)
}}
key={value}>{label}</li>
>{label}</li>
<span>({catcount} selected)</span>
<hr className='border-xs boredr-gray-200 group-hover:border-gray-500'></hr>
</div>
Expand All @@ -489,9 +489,9 @@ function EditListWithCount(
<tbody className='bg-gray-50 shadow-md'>
{specialities.length === 0 && <tr><td colSpan={3} className="text-center">{`No ${itemsCategoryName.includes('infrastructure') ? 'infrastructure' : 'specialities'} found`}</td></tr>}

{specialities.map((row) => (
{specialities.map((row, i) => (

<tr key={row?.id} >
<tr key={i} >
<td className=" px-1 py-1">
<label className="w-full p-2" >{row?.name}</label>
</td>
Expand Down Expand Up @@ -549,9 +549,9 @@ function EditListWithCount(
<tbody className='bg-gray-50 shadow-md'>
{selectedRows.length === 0 && <tr><td colSpan={3} className="text-center">No specialities found</td></tr>}
{/* {selectedRows.pop()} */}
{selectedRows.map((row) => {
{selectedRows.map((row, i) => {
// if(row.name !== "Vaccine Carriers" || row.name !== "Public Health Technician"){
return ( <tr>
return ( <tr key={i}>
<td className="border border-gray-300 px-1 py-1">{row?.sname}</td>
{row?.iscategoryvisible ? <td className="border border-gray-300 px-1 py-1">{row?.category_name}</td> :null }
<td className="border border-gray-300 px-1 py-1">Yes</td>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"react-datepicker": "^4.16.0",
"react-dom": "^18.2.0",
"react-dual-listbox": "^5.0.2",
"react-error-boundary": "^4.0.13",
"react-highcharts": "^16.1.0",
"react-icons": "^4.10.1",
"react-leaflet": "^4.2.1",
Expand Down
2 changes: 1 addition & 1 deletion pages/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const Account = () => {
<link rel="icon" href="/favicon.ico" />
</Head>

<MainLayout className="w-full grid grid-cols-5 gap-3 md:mt-3 mb-12">
<MainLayout className="w-full md:w-[85%] md:mx-auto grid grid-cols-5 gap-3 md:mt-3 mb-12">
{open &&
<Modal
aria-labelledby="transition-modal-title"
Expand Down
2 changes: 1 addition & 1 deletion pages/admin_offices/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function AddAdminOffice(props) {
if(isClient){
return (
<MainLayout isLoading={false} searchTerm={props?.query?.searchTerm}>
<div className="w-full grid grid-cols-5 gap-4 px-1 md:px-4 py-2 h-auto mt-8 my-4">
<div className="w-full md:w-[85%] md:mx-auto px-4 md:px-0 grid grid-cols-5 gap-4 py-2 h-auto mt-8 my-4">
<div className="col-span-5 flex flex-col gap-3 md:gap-5 px-4">
<div className="flex flex-wrap items-center justify-between gap-2 text-sm md:text-base py-3">
<div className="flex flex-row items-center justify-between gap-2 text-sm md:text-base py-3">
Expand Down
2 changes: 1 addition & 1 deletion pages/admin_offices/edit/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function EditAdminOffice(props) {

return (
<MainLayout isLoading={false} searchTerm={props?.query?.searchTerm}>
<div className="w-full grid grid-cols-5 gap-4 px-1 md:px-4 py-2 my-4">
<div className="w-full md:w-[85%] md:mx-auto grid grid-cols-5 gap-4 px-4 md:px-0 py-2 my-4">
<div className="col-span-5 flex flex-col gap-3 md:gap-5 px-4">
<div className="flex flex-wrap items-center justify-between gap-2 text-sm md:text-base py-3">
<div className="flex flex-row items-center justify-between gap-2 text-sm md:text-base py-3">
Expand Down
2 changes: 1 addition & 1 deletion pages/admin_offices/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function AdminOffices(props) {
<link rel="icon" href="/favicon.ico" />
</Head>
<MainLayout isLoading={false} isFullWidth={false}>
<div className="w-full grid grid-cols-7 mt-8 gap-4 p-1 md:mx-4 my-2">
<div className="w-full md:w-[85%] px-4 md:px-0 grid grid-cols-7 mt-8 gap-4 p-1 md:mx-4 my-2">
<div className="col-span-7 flex flex-col gap-x-1">
<div className="flex flex-wrap items-center justify-between gap-2 text-sm md:text-base py-1">
<div className="flex flex-row items-center justify-between gap-x-2 gap-y-0 text-sm md:text-base py-1">
Expand Down
2 changes: 1 addition & 1 deletion pages/community-units/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ function AddCommunityUnit(props) {

{/* Main Layout */}
<MainLayout isLoading={false} searchTerm={props?.query?.searchTerm}>
<div className='w-full h-full grid grid-cols-5 gap-4 px-0 md:px-4 py-2 my-4'>
<div className='w-full md:w-[85%] md:mx-auto h-full grid grid-cols-5 gap-4 px-0 md:px-4 py-2 my-4'>
{/* Breadcrumbs */}
<div className='col-span-5 flex flex-col gap-3 md:gap-5 px-0'>
<div className='flex flex-wrap items-center justify-between gap-2 text-sm md:text-base py-3'>
Expand Down
12 changes: 1 addition & 11 deletions pages/facilities/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -636,17 +636,7 @@ const Facility = (props) => {

<button
onClick={() => {
// /api/facilities/facility_detail_report/b2f3c373-40ef-4ca9-bc9c-4237eb9a06b2/?access_token=token

// fetch(`${process.env.NEXT_PUBLIC_API_URL}/facilities/facility_detail_report/${facility?.id}/?access_token=${props['3']?.token}`,
// {
// 'headers': {
// "Accept": "application/json",
// 'cache-control': "no-cache",
// "Authorization": "Bearer " + props['3']?.token
// }
// })


router.push(`${process.env.NEXT_PUBLIC_API_URL}/facilities/facility_detail_report/${facility?.id}/?access_token=${props['3']?.token}`)
}}
className="p-2 text-center -md font-semibold text-base text-white bg-gray-600 rounded"
Expand Down
Loading

0 comments on commit e7251a6

Please sign in to comment.