Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #143

Merged
merged 6 commits into from
Dec 5, 2024
Merged

fix #143

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/admin/activity-category/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const AdminGrid = () => {
Export To Excel
</button>

<div className={"ag-theme-quartz"} style={{ height: 600 }}>
<div className={"ag-theme-quartz"} style={{ height: 500 }}>
<AgGridReact
rowData={rowData}
columnDefs={columnDefs}
Expand Down
62 changes: 40 additions & 22 deletions src/app/admin/activity/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,27 +151,45 @@ const AdminGrid = () => {
}, [token, router]);

const [columnDefs, setColumnDefs] = useState<ColDef[]>([
{ field: "personal_activity_id", headerName: "Activity Id" },
{ field: "participant_name", headerName: "Name" },
{ field: "us_id", headerName: "User Id" },
{ field: "participant_address", headerName: "Tree Number" },
{ field: "activity_social_media_link", headerName: "Activity Link" },
{ field: "activity_description", headerName: "Chest Number" },
{ field: "activity_views", headerName: "View" },
{ field: "activity_likes", headerName: "Like" },
{ field: "activity_value", headerName: "Value" },
{ field: "earnings", headerName: "Earnings" },
{ field: "gp_name", headerName: "Group Name" },
{ field: "group_type", headerName: "Category" },
{ field: "activity_sub_category", headerName: "School Type" },
{ field: "edu_district", headerName: "Education District" },
{ field: "edu_sub_district_name", headerName: "Education Sub District" },
{ field: "sahodaya_name", headerName: "Sahodaya" },
{ field: "block_name", headerName: "Block" },
{ field: "project_name", headerName: "Project" },
{ field: "chapter_name", headerName: "Chapter" },
{ field: "cntry_name", headerName: "Country" },
{ field: "st_name", headerName: "State" },
{ field: "personal_activity_id", headerName: "Activity Id",width:120 },
{ field: "participant_name", headerName: "Name",width:100 },
{ field: "us_id", headerName: "User Id",width:100 },
{ field: "participant_address", headerName: "Tree Number",width:140 },
{ field: "activity_social_media_link", headerName: "Activity Link",width:140 },
{ field: "activity_on", headerName: "Activity On",width:140,
valueFormatter: (params) => {
const date = new Date(params.value);
const day = String(date.getDate()).padStart(2, '0');
const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-based
const year = date.getFullYear();
return `${day}-${month}-${year}`;
}
},
{ field: "activity_description", headerName: "Chest Number",width:140 },
{ field: "activity_views", headerName: "View",width:100 },
{ field: "activity_likes", headerName: "Like",width:100 },
{ field: "activity_value", headerName: "Value",width:100 },
{ field: "earnings", headerName: "Earnings",width:120 },
{ field: "created_on", headerName: "Created On",width:140,
valueFormatter: (params) => {
const date = new Date(params.value);
const day = String(date.getDate()).padStart(2, '0');
const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-based
const year = date.getFullYear();
return `${day}-${month}-${year}`;
}
},
{ field: "gp_name", headerName: "Group Name",width:140 },
{ field: "group_type", headerName: "Category",width:120 },
{ field: "activity_sub_category", headerName: "School Type",width:140 },
{ field: "edu_district", headerName: "Education District",width:180 },
{ field: "edu_sub_district_name", headerName: "Education Sub District",width:200 },
{ field: "sahodaya_name", headerName: "Sahodaya",width:120 },
{ field: "block_name", headerName: "Block",width:100 },
{ field: "project_name", headerName: "Project",width:100 },
{ field: "chapter_name", headerName: "Chapter",width:100 },
{ field: "cntry_name", headerName: "Country",width:100 },
{ field: "st_name", headerName: "State",width:100 },
]);

const defaultColDef = useMemo(() => {
Expand Down Expand Up @@ -1560,7 +1578,7 @@ const AdminGrid = () => {
</div>
<div className="flex items-center justify-center font-bold">Total Count : {totalcount}</div>

<div className={"ag-theme-quartz"} style={{ height: 600 }}>
<div className={"ag-theme-quartz"} style={{ height: 530 }}>
<AgGridReact
rowData={rowData}
columnDefs={[
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/ads/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const AdminGrid = () => {
>
Export To Excel
</button>
<div className={"ag-theme-quartz"} style={{ height: 600 }}>
<div className={"ag-theme-quartz"} style={{ height: 500 }}>
<AgGridReact
rowData={rowData}
columnDefs={[
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/challenges/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ const AdminGrid = () => {
</div>
<div className="flex items-center justify-center font-bold">Total Count : {totalcount}</div>

<div className={"ag-theme-quartz"} style={{ height: 600 }}>
<div className={"ag-theme-quartz"} style={{ height: 500 }}>
<AgGridReact
rowData={rowData}
columnDefs={[
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/clubs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const AdminGrid = () => {
Export To Excel
</button>

<div className={"ag-theme-quartz"} style={{ height: 600 }}>
<div className={"ag-theme-quartz"} style={{ height: 500 }}>
<AgGridReact
rowData={rowData}
columnDefs={[
Expand Down
42 changes: 4 additions & 38 deletions src/app/admin/contact-us-form/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import axios from "axios";
import { apiURL } from "@/app/requestsapi/request";
import Cookies from 'js-cookie';
import * as XLSX from 'xlsx';
import PaginationComponent from "../PageComponent";

ModuleRegistry.registerModules([ClientSideRowModelModule]);

Expand Down Expand Up @@ -118,7 +119,7 @@ const AdminGrid = () => {
>
Export To Excel
</button>
<div className={"ag-theme-quartz"} style={{ height: 600 }}>
<div className={"ag-theme-quartz"} style={{ height: 500 }}>
<AgGridReact
rowData={rowData}
columnDefs={columnDefs}
Expand All @@ -131,44 +132,9 @@ const AdminGrid = () => {
paginationPageSizeSelector={[10, 25, 50]}
/>
</div>
<div className="flex justify-center items-center space-x-2 my-4">
<button
className={currentPage === 1 ?
"text-white text-sm py-2 px-4 bg-[#6b6767] rounded-xl shadow-lg"
: "text-white text-sm py-2 px-4 bg-[#3C6E1F] rounded-xl shadow-lg"
}
onClick={() => handlePageChange(currentPage - 1)}
disabled={currentPage === 1}
>
Previous
</button>
{currentPage >= 4 && totalPages > 3 && <span className="text-xl text-gray-600">...</span>}

{Array.from({ length: totalPages >= 3 ? 3 : totalPages }, (_, index) => currentPage < 4 ? index+1:currentPage+index-2).map((page) => (
<span
key={page}
className={`text-xl cursor-pointer text-gray-600 ${page === currentPage ? 'font-bold' : 'underline'}`}
onClick={() => handlePageChange(page)}
>
{page > 0 ? page : ''}
</span>
))}

{currentPage > 1 && totalPages > 3 && currentPage!=totalPages && <span className="text-xl text-gray-600">...</span>}
{currentPage === 1 && totalPages > 3 && currentPage!=totalPages && <span className="text-xl text-gray-600">...</span>}

<PaginationComponent currentPage={currentPage} totalPages={totalPages} onPageChange={handlePageChange} />

<button
className={currentPage === totalPages || totalPages === 1 ?
"text-white text-sm py-2 px-4 bg-[#6b6767] rounded-xl shadow-lg"
: "text-white text-sm py-2 px-4 bg-[#3C6E1F] rounded-xl shadow-lg"
}
onClick={() => handlePageChange(currentPage + 1)}
disabled={currentPage === totalPages || totalPages === 1}
>
Next
</button>
</div>

</div>
);
};
Expand Down
40 changes: 25 additions & 15 deletions src/app/admin/coordinators/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,27 @@ const AdminGrid = () => {
}, [token, router]);

const [columnDefs, setColumnDefs] = useState<ColDef[]>([
{ field: "co_ord_id", headerName: "Coordinator Id" },
{ field: "co_ord_name", headerName: "Name" },
{ field: "co_email_id", headerName: "Email" },
{ field: "co_username", headerName: "Username" },
{ field: "group_type", headerName: "Group" },
{ field: "cntry_name", headerName: "Country" },
{ field: "st_name", headerName: "State" },
{ field: "dis_name", headerName: "District" },
{ field: "cop_name", headerName: "Cooperation" },
{ field: "lsg_name", headerName: "LSGD" },
{ field: "gp_ward_no", headerName: "Ward" },
{ field: "gp_name", headerName: "Group Name" },
{ field: "gp_refferal_name", headerName: "Referral Name" },
{ field: "co_ord_id", headerName: "Coordinator Id",width:150},
{ field: "co_ord_name", headerName: "Name",width:100 },
{ field: "co_email_id", headerName: "Email" ,width:100},
{ field: "co_username", headerName: "Username",width:120 },
{ field: "co_ord_created_on", headerName: "Created On",width:140,
valueFormatter: (params) => {
const date = new Date(params.value);
const day = String(date.getDate()).padStart(2, '0');
const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-based
const year = date.getFullYear();
return `${day}-${month}-${year}`;
} },
{ field: "group_type", headerName: "Group",width:100 },
{ field: "cntry_name", headerName: "Country",width:100 },
{ field: "st_name", headerName: "State",width:100 },
{ field: "dis_name", headerName: "District",width:100 },
{ field: "cop_name", headerName: "Cooperation",width:130 },
{ field: "lsg_name", headerName: "LSGD",width:100 },
{ field: "gp_ward_no", headerName: "Ward",width:100 },
{ field: "gp_name", headerName: "Group Name",width:140 },
{ field: "gp_refferal_name", headerName: "Referral Name",width:160 },

]);

Expand Down Expand Up @@ -220,9 +228,11 @@ const AdminGrid = () => {


if (response.data.success && response.status != 203) {
setRowData(response.data.cordinatorList);
setTotalPages(Math.ceil(response.data.totalCount / itemsPerPage));
setTotalcount(response.data.totalCount);
setRowData(response.data.cordinatorList);
console.log(response.data)


}
}
Expand Down Expand Up @@ -1447,7 +1457,7 @@ setTotalcount("0");
</div>
<div className="flex items-center justify-center font-bold">Total Count : {totalcount}</div>

<div className={"ag-theme-quartz"} style={{ height: 600 }}>
<div className={"ag-theme-quartz"} style={{ height: 530 }}>
<AgGridReact
rowData={rowData}
columnDefs={[
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/corporation/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ const fetchFilteredCorp = async (value: string) => {
</div>


<div className={"ag-theme-quartz"} style={{ height: 600 }}>
<div className={"ag-theme-quartz"} style={{ height: 500 }}>
<AgGridReact
rowData={rowData}
columnDefs={[
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/edudistrict/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ const AdminGrid = () => {
</div>
</div>

<div className={"ag-theme-quartz"} style={{ height: 600 }}>
<div className={"ag-theme-quartz"} style={{ height: 500 }}>
<AgGridReact
rowData={rowData}
columnDefs={[
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/edusubdistrict/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ const fetchFilteredEduSubDistrict = async (value: string) => {
</div>
</div>

<div className={"ag-theme-quartz"} style={{ height: 600 }}>
<div className={"ag-theme-quartz"} style={{ height: 500 }}>
<AgGridReact
rowData={rowData}
columnDefs={[
Expand Down
6 changes: 3 additions & 3 deletions src/app/admin/group/[id]/edit-grp-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1076,15 +1076,15 @@ export function EditGrpTypeForm() {
</select>
</div>

<div className="flex items-center mb-3 space-x-2">
<div className="flex items-center mb-3 space-x-2 mr-2">
<label htmlFor="groupFilter" className="text-sm font-medium">
Education District:
</label>
<select
id="groupFilter"
value={selecteduDistrict}
onChange={handleFilterEduDistrict}
className="border border-gray-300 rounded p-1"
className="border border-gray-300 rounded p-1 "
>
<option value="">Choose Education District</option>

Expand All @@ -1097,7 +1097,7 @@ export function EditGrpTypeForm() {
</select>
</div>

<div className="flex items-center mb-3 space-x-2">
<div className="flex items-center mb-3 space-x-2 ml-4">
<label htmlFor="groupFilter" className="text-sm font-medium">
Education Sub District:
</label>
Expand Down
54 changes: 32 additions & 22 deletions src/app/admin/group/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,26 +143,36 @@ const AdminGrid = () => {
}
}, [token, router]);
const [columnDefs, setColumnDefs] = useState<ColDef[]>([
{ field: "gp_id", headerName: "Group Id" },
{ field: "gp_name", headerName: "Group name" },
{ field: "co_ord_name", headerName: "Coordinator name" },
{ field: "co_ord_contact", headerName: "Phone Number"},
{ field: "co_ord_id", headerName: "Cordinator Id"},
{ field: "group_type", headerName: "Group type" },
{ field: "upload_count", headerName: "Upload count" },
{ field: "activity_count", headerName: "Activity count" },
{ field: "earnings", headerName: "Earnings"},
{ field: "type_name", headerName: "School type" },
{ field: "gp_cat_name", headerName: "School category" },
{ field: "edu_district", headerName: "Edu district" },
{ field: "edu_sub_district_name", headerName: "Edu sub district" },
{ field: "sahodaya_name", headerName: "Sahodaya" },
{ field: "block_name", headerName: "Block" },
{ field: "project_name", headerName: "Project" },
{ field: "chapter_name", headerName: "Chapter" },
{ field: "zone_name", headerName: "Zone" },
{ field: "cntry_name", headerName: "Country" },
{ field: "st_name", headerName: "State" },
{ field: "gp_id", headerName: "Group Id" ,width:120},
{ field: "gp_name", headerName: "Group name" ,width:140 },
{ field: "co_ord_name", headerName: "Coordinator name",width:180 },
{ field: "co_ord_contact", headerName: "Phone Number",width:160},
{ field: "co_ord_id", headerName: "Cordinator Id",width:140},
{ field: "group_type", headerName: "Group type" ,width:140 },
{ field: "co_ord_created_on", headerName: "Created On" ,width:140,
valueFormatter: (params) => {
const date = new Date(params.value);
const day = String(date.getDate()).padStart(2, '0');
const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-based
const year = date.getFullYear();
return `${day}-${month}-${year}`;
}
},
{ field: "upload_count", headerName: "Upload count" ,width:140 },
{ field: "activity_count", headerName: "Activity count" ,width:140 },
{ field: "earnings", headerName: "Earnings" ,width:120},
{ field: "type_name", headerName: "School type" ,width:140 },
{ field: "gp_cat_name", headerName: "School category" ,width:160 },
{ field: "edu_district", headerName: "Edu district",width:140 },
{ field: "edu_sub_district_name", headerName: "Edu sub district" ,width:160 },
{ field: "sahodaya_name", headerName: "Sahodaya" ,width:120},
{ field: "block_name", headerName: "Block" ,width:100 },
{ field: "project_name", headerName: "Project" ,width:100 },
{ field: "chapter_name", headerName: "Chapter" ,width:100 },
{ field: "zone_name", headerName: "Zone" ,width:100 },
{ field: "cntry_name", headerName: "Country" ,width:100 },
{ field: "st_name", headerName: "State" ,width:100 },
{ field: "co_ord_name", headerName: "Coordinator name" ,width:180 },
]);

const defaultColDef = useMemo(() => {
Expand Down Expand Up @@ -233,7 +243,7 @@ const AdminGrid = () => {
}
};
fetchdata();
}, [currentPage, token]);
}, [currentPage, filterdata, token]);

useEffect(() => {
async function fetchData() {
Expand Down Expand Up @@ -1465,7 +1475,7 @@ const AdminGrid = () => {
<div className="flex items-center justify-center font-bold">Total Count : {totalcount}</div>


<div className={"ag-theme-quartz"} style={{ height: 600 }}>
<div className={"ag-theme-quartz"} style={{ height: 520 }}>
<AgGridReact
rowData={rowData}
columnDefs={[
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/icdsblock/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ useEffect(() => {
</select>
</div>
</div>
<div className={"ag-theme-quartz"} style={{ height: 600 }}>
<div className={"ag-theme-quartz"} style={{ height: 500 }}>
<AgGridReact
rowData={rowData}
columnDefs={[
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/icdsproject/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ useEffect(() => {
</div>
</div>

<div className={"ag-theme-quartz"} style={{ height: 600 }}>
<div className={"ag-theme-quartz"} style={{ height: 500 }}>
<AgGridReact
rowData={rowData}
columnDefs={[
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/lsgd/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ const AdminGrid = () => {
</div>


<div className={"ag-theme-quartz"} style={{ height: 600 }}>
<div className={"ag-theme-quartz"} style={{ height: 500 }}>
<AgGridReact
rowData={rowData}
columnDefs={[
Expand Down
Loading