+
{row.getValue("course_code")}
- Course Code: {row.getValue("course_code")}
+ Course Code: {row.getValue("course_code")}
),
- size: 90,
+ size: 110,
},
],
[]
@@ -687,20 +689,19 @@ export default function StateCutoffsPage() {
console.log('Fetching records for page:', currentPage, 'with filters:', debouncedFilters);
- // Only cancel previous request if it's for different filters (not just pagination)
- const params = new URLSearchParams({
- page: currentPage.toString(),
- perPage: itemsPerPage.toString(),
+ const requestBody = {
+ page: currentPage,
+ perPage: itemsPerPage,
search: debouncedFilters.search,
- categories: debouncedFilters.categories.join(','),
- seatAllocations: debouncedFilters.seatAllocations.join(','),
- courses: debouncedFilters.courses.join(','),
+ categories: debouncedFilters.categories,
+ seatAllocations: debouncedFilters.seatAllocations,
+ courses: debouncedFilters.courses,
percentileInput: debouncedFilters.percentileInput,
sortBy: debouncedFilters.sortBy,
- sortOrder: debouncedFilters.sortOrder
- });
+ sortOrder: debouncedFilters.sortOrder,
+ };
- const cacheKey = params.toString();
+ const cacheKey = JSON.stringify(requestBody);
// Check if this is the same request type (only different pagination)
const currentRequestKey = `${debouncedFilters.search}-${debouncedFilters.categories.join(',')}-${debouncedFilters.seatAllocations.join(',')}-${debouncedFilters.courses.join(',')}-${debouncedFilters.percentileInput}`;
@@ -735,13 +736,16 @@ export default function StateCutoffsPage() {
setLoading(true);
try {
- console.log(`Making API request ${requestId} with params:`, params.toString());
+ console.log(`Making API POST request ${requestId} with body:`, requestBody);
- const response = await fetch(`/api/mht-cet/state-cutoffs?${params}`, {
+ const response = await fetch(`/api/mht-cet/state-cutoffs`, {
+ method: 'POST',
signal: abortControllerRef.current.signal,
headers: {
+ 'Content-Type': 'application/json',
'Cache-Control': 'public, max-age=300', // Cache for 5 minutes
- }
+ },
+ body: JSON.stringify(requestBody),
});
// Check if this is still the latest request
@@ -924,39 +928,45 @@ export default function StateCutoffsPage() {
}, [memoizedTotalItems, itemsPerPage]);
return (
-
+
{/* Header */}
-
-
-
+
+
+
MHT-CET State Cutoffs 2024
-
+
Round 1 cutoffs for engineering colleges
-
-
{/* Filters */}
-
-
-
+
+
+
Filters
{hasUnsavedChanges && (
-
+
Changes Pending
)}
-
+
{/* Search Input */}
@@ -964,14 +974,14 @@ export default function StateCutoffsPage() {
placeholder="Search colleges, courses..."
value={pendingFilters.search}
onChange={(e) => setPendingFilters(prev => ({ ...prev, search: e.target.value }))}
- className="pl-10 font-abel"
+ className="pl-10 font-abel text-sm md:text-base h-12"
/>
-
+
{/* Percentile Input */}
-
-
+
{/* Enhanced Category Filter */}
-
- Categories
-
+
+ Categories
+
{pendingFilters.categories.length > 0 && (
{pendingFilters.categories.length}
@@ -1018,17 +1028,17 @@ export default function StateCutoffsPage() {
-
+
-
Select Categories
+ Select Categories
{
setPendingFilters(prev => ({ ...prev, categories: [] }));
}}
- className="font-abel"
+ className="font-abel text-xs md:text-sm"
>
Clear All
@@ -1070,7 +1080,7 @@ export default function StateCutoffsPage() {
checked={pendingFilters.categories.includes(category)}
onCheckedChange={() => handleCategoryToggle(category)}
/>
-
+
{category}
@@ -1087,9 +1097,9 @@ export default function StateCutoffsPage() {
{/* Enhanced Course Filter */}
-
- Courses
-
+
+ Courses
+
{pendingFilters.courses.length > 0 && (
{pendingFilters.courses.length}
@@ -1099,17 +1109,17 @@ export default function StateCutoffsPage() {
-
+
-
Select Courses
+ Select Courses
{
setPendingFilters(prev => ({ ...prev, courses: [] }));
}}
- className="font-abel"
+ className="font-abel text-xs md:text-sm"
>
Clear All
@@ -1145,13 +1155,14 @@ export default function StateCutoffsPage() {
{courses.map((course) => (
-
+
handleCourseToggle(course)}
+ className="mt-1"
/>
-
+
{course}
@@ -1168,9 +1179,9 @@ export default function StateCutoffsPage() {
{/* Seat Allocation Filter */}
-
- Seat Allocation
-
+
+ Seat Allocation
+
{pendingFilters.seatAllocations.length > 0 && (
{pendingFilters.seatAllocations.length}
@@ -1180,65 +1191,71 @@ export default function StateCutoffsPage() {
-
-
- {SEAT_ALLOCATION_OPTIONS.map((option) => (
-
- handleSeatAllocationToggle(option.value)}
- />
-
- {option.label}
-
-
- ))}
-
+
+
+
+ {SEAT_ALLOCATION_OPTIONS.map((option) => (
+
+ handleSeatAllocationToggle(option.value)}
+ className="mt-1"
+ />
+
+ {option.label}
+
+
+ ))}
+
+
{/* Search and Clear Buttons */}
-
+
{isSearching || loading ? (
<>
- Searching...
+ Searching...
+ ...
>
) : (
<>
- Search Cutoffs
+ Search Cutoffs
+ Search
>
)}
- Clear All
+ Clear All
+ Clear
{/* Changes Indicator */}
{!pendingFilters.percentileInput ? (
-
-
-
+
+
+
Please enter a target percentile to search for cutoffs.
) : hasUnsavedChanges ? (
-
-
-
+
+
+
You have unsaved filter changes. Click "Search Cutoffs" to apply them.
@@ -1249,68 +1266,68 @@ export default function StateCutoffsPage() {
{/* Active Filters Display */}
{(filters.percentileInput || filters.categories.length > 0 || filters.seatAllocations.length > 0 || filters.courses.length > 0) && (
-
+
-
-
Active Filters
+
+ Active Filters
{filters.percentileInput && (
-
- Target Percentile: {filters.percentileInput}%
+
+ Target: {filters.percentileInput}%
)}
{filters.categories.length > 0 && (
-
- Categories ({filters.categories.length}):
+
+ Categories ({filters.categories.length})
- {filters.categories.slice(0, 3).map((category, index) => (
-
+ {filters.categories.slice(0, 2).map((category, index) => (
+
{category}
))}
- {filters.categories.length > 3 && (
-
- +{filters.categories.length - 3} more
+ {filters.categories.length > 2 && (
+
+ +{filters.categories.length - 2} more
)}
)}
{filters.seatAllocations.length > 0 && (
-
- Seat Allocations ({filters.seatAllocations.length}):
+
+ Seats ({filters.seatAllocations.length})
- {filters.seatAllocations.slice(0, 2).map((allocation, index) => {
+ {filters.seatAllocations.slice(0, 1).map((allocation, index) => {
const option = SEAT_ALLOCATION_OPTIONS.find(s => s.value === allocation);
const label = option?.label || allocation;
return (
-
+
{label}
);
})}
- {filters.seatAllocations.length > 2 && (
-
- +{filters.seatAllocations.length - 2} more
+ {filters.seatAllocations.length > 1 && (
+
+ +{filters.seatAllocations.length - 1} more
)}
)}
{filters.courses.length > 0 && (
-
- Courses ({filters.courses.length}):
+
+ Courses ({filters.courses.length})
- {filters.courses.slice(0, 2).map((course, index) => (
-
- {course.length > 30 ? `${course.substring(0, 30)}...` : course}
+ {filters.courses.slice(0, 1).map((course, index) => (
+
+ {course.length > 20 ? `${course.substring(0, 20)}...` : course}
))}
- {filters.courses.length > 2 && (
-
- +{filters.courses.length - 2} more
+ {filters.courses.length > 1 && (
+
+ +{filters.courses.length - 1} more
)}
@@ -1321,32 +1338,32 @@ export default function StateCutoffsPage() {
)}
{/* Compact Results Summary */}
-
-
+
+
{memoizedTotalItems.toLocaleString()}
total
-
+
{records.length}
showing
-
+
{filters.categories.length}
categories
-
+
{filters.percentileInput ? '-1%' : 'All'}
- percentile range
+ range
{/* Pagination Controls */}
-
-
+
+
Showing {((currentPage - 1) * itemsPerPage) + 1} to {Math.min(currentPage * itemsPerPage, memoizedTotalItems)} of {memoizedTotalItems.toLocaleString()} results
-
-
Rows per page:
+
+
Rows per page: