-
Notifications
You must be signed in to change notification settings - Fork 0
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 Class Management #85
Open
Fouz7
wants to merge
19
commits into
development
Choose a base branch
from
dev-sp8-class-management
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
55d47c2
Merge remote-tracking branch 'origin/development' into dev-sp5-dhiki
Fouz7 0517ad9
FIX :: Route
Fouz7 96f5115
FIX :: Class Management Integrating
Fouz7 31c4766
Fix Opportunity and Applicant Page (#60)
elsamrafisptr d97353d
Merge remote-tracking branch 'origin/development' into dev-sp5-dhiki
Fouz7 35e04ab
FIX :: Class Management Integrating
Fouz7 47c0cb6
Merge remote-tracking branch 'origin/development' into dev-sp5-dhiki
Fouz7 e18c55a
REFACTOR :: Class Management
Fouz7 1c1d33c
FIX :: Major Modal CRUD and Class Pagination bugs
Fouz7 b794a63
Merge remote-tracking branch 'origin/development' into dev-sp8-class-…
Fouz7 3a2d177
REFACTOR :: Class Management
Fouz7 b27f662
INTEGRATE :: Search and Filter Class Endpoint
Fouz7 2f7de01
Merge remote-tracking branch 'refs/remotes/origin/development' into d…
Fouz7 bbc1231
REFACTOR
Fouz7 9123f5e
Merge remote-tracking branch 'origin/development' into dev-sp8-class-…
Fouz7 451eb07
INTEGRATE :: Search and Filter Class Endpoint
Fouz7 0ed775f
Refactor :: Class Management
Fouz7 33e3d00
Refactor :: Class Management
Fouz7 c48beb1
Refactor :: Class Management
Fouz7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,4 +111,4 @@ const GlobalModal = ({ | |
); | ||
}; | ||
|
||
export default GlobalModal; | ||
export {GlobalModal}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,102 @@ | ||
export { Header, Button as CustomButton } from "./Dashboard"; | ||
export { Navbar } from "./Navbar/Navbar"; | ||
export { Sidebar } from "./Sidebar/Sidebar"; | ||
export { QuillEditor } from "./QuillEditor/QuillEditor"; | ||
export { ErrorBoundary } from "./ErrorBoundary/ErrorBoundary"; | ||
export {Header, Button as CustomButton} from "./Dashboard"; | ||
export {Navbar} from "./Navbar/Navbar"; | ||
export {Sidebar} from "./Sidebar/Sidebar"; | ||
export {QuillEditor} from "./QuillEditor/QuillEditor"; | ||
export {ErrorBoundary} from "./ErrorBoundary/ErrorBoundary"; | ||
export * from "./Internship"; | ||
export { Spinner } from "./Loading/Spinner"; | ||
export {Spinner} from "./Loading/Spinner"; | ||
export { | ||
LogbookPagination, | ||
StudentTable, | ||
DetailLogbook, | ||
SearchBar, | ||
LogbookPagination, | ||
StudentTable, | ||
DetailLogbook, | ||
SearchBar, | ||
} from "./Logbook"; | ||
export { | ||
Flex, | ||
Input, | ||
Form, | ||
DatePicker, | ||
Select, | ||
Card, | ||
Typography, | ||
Checkbox, | ||
Divider, | ||
Space, | ||
Modal, | ||
Pagination, | ||
Button, | ||
Spin, | ||
Dropdown, | ||
Table, | ||
message, | ||
Tabs, | ||
Row, | ||
Col, | ||
ConfigProvider, | ||
Collapse, | ||
Menu, | ||
Progress, | ||
Tag, | ||
Breadcrumb, | ||
Alert, | ||
Empty, | ||
Switch, | ||
Flex, | ||
Input, | ||
Form, | ||
DatePicker, | ||
Select, | ||
Card, | ||
Typography, | ||
Checkbox, | ||
Divider, | ||
Space, | ||
Modal, | ||
Pagination, | ||
Button, | ||
Spin, | ||
Dropdown, | ||
Table, | ||
message, | ||
Tabs, | ||
Row, | ||
Col, | ||
ConfigProvider, | ||
Collapse, | ||
Menu, | ||
Progress, | ||
Tag, | ||
Breadcrumb, | ||
Alert, | ||
Empty, | ||
Switch, | ||
Descriptions, | ||
} from "antd"; | ||
|
||
export { | ||
ArrowUpOutlined, | ||
ArrowLeftOutlined, | ||
SearchOutlined, | ||
DownOutlined, | ||
SettingOutlined, | ||
BoldOutlined, | ||
UnderlineOutlined, | ||
ItalicOutlined, | ||
AlignLeftOutlined, | ||
AlignCenterOutlined, | ||
AlignRightOutlined, | ||
OrderedListOutlined, | ||
UnorderedListOutlined, | ||
PaperClipOutlined, | ||
PlusCircleOutlined, | ||
FontSizeOutlined, | ||
FontColorsOutlined, | ||
LineHeightOutlined, | ||
CloseCircleFilled, | ||
BookOutlined, | ||
DeleteOutlined, | ||
EditOutlined, | ||
EyeOutlined, | ||
InfoCircleFilled, | ||
UndoOutlined, | ||
ClockCircleOutlined, | ||
UserAddOutlined, | ||
UsergroupAddOutlined, | ||
UserOutlined, | ||
CaretDownOutlined, | ||
CaretUpOutlined, | ||
ImportOutlined, | ||
DownloadOutlined, | ||
FileDoneOutlined, | ||
ExportOutlined, | ||
CheckCircleOutlined, | ||
LeftOutlined, | ||
AccountBookOutlined, | ||
EyeInvisibleOutlined, | ||
EyeFilled, | ||
EyeInvisibleFilled, | ||
LockOutlined, | ||
CheckCircleFilled, | ||
CloseOutlined, | ||
LogoutOutlined, | ||
CaretDownFilled, | ||
EyeTwoTone, | ||
EyeInvisibleTwoTone, | ||
LoadingOutlined, | ||
ArrowUpOutlined, | ||
ArrowLeftOutlined, | ||
SearchOutlined, | ||
DownOutlined, | ||
SettingOutlined, | ||
BoldOutlined, | ||
UnderlineOutlined, | ||
ItalicOutlined, | ||
AlignLeftOutlined, | ||
AlignCenterOutlined, | ||
AlignRightOutlined, | ||
OrderedListOutlined, | ||
UnorderedListOutlined, | ||
PaperClipOutlined, | ||
PlusCircleOutlined, | ||
FontSizeOutlined, | ||
FontColorsOutlined, | ||
LineHeightOutlined, | ||
CloseCircleFilled, | ||
BookOutlined, | ||
DeleteOutlined, | ||
EditOutlined, | ||
EyeOutlined, | ||
InfoCircleFilled, | ||
UndoOutlined, | ||
ClockCircleOutlined, | ||
UserAddOutlined, | ||
UsergroupAddOutlined, | ||
UserOutlined, | ||
CaretDownOutlined, | ||
CaretUpOutlined, | ||
ImportOutlined, | ||
DownloadOutlined, | ||
FileDoneOutlined, | ||
ExportOutlined, | ||
CheckCircleOutlined, | ||
LeftOutlined, | ||
AccountBookOutlined, | ||
EyeInvisibleOutlined, | ||
EyeFilled, | ||
EyeInvisibleFilled, | ||
LockOutlined, | ||
CheckCircleFilled, | ||
CloseOutlined, | ||
LogoutOutlined, | ||
CaretDownFilled, | ||
EyeTwoTone, | ||
EyeInvisibleTwoTone, | ||
LoadingOutlined, | ||
} from "@ant-design/icons"; | ||
|
||
export { ToastContainer, toast } from "react-toastify"; | ||
export { SelectMultiple } from "./ProgramManagement/components"; | ||
export { Link, Navigate } from "react-router-dom"; | ||
export {ActionButtons} from "./Button/ActionButtons"; | ||
export {ToastContainer, toast} from "react-toastify"; | ||
export {SelectMultiple} from "./ProgramManagement/components"; | ||
export {Link, Navigate} from "react-router-dom"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const ModalEnum = { | ||
HIDE: 0, | ||
CREATE: 1, | ||
UPDATE: 2, | ||
DETAIL: 3, | ||
}; | ||
|
||
export { ModalEnum }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { useCallback, useState } from "react"; | ||
import { ClassApi } from "@/utils/axios/ApiService.js"; | ||
import { mappedClassData } from "@/utils/utils"; | ||
Fouz7 marked this conversation as resolved.
Show resolved
Hide resolved
Fouz7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const useClass = () => { | ||
const [classData, setClassData] = useState([]); | ||
const [originalClassData, setOriginalClassData] = useState([]); | ||
const [isModalLoading, setIsModalLoading] = useState(false); | ||
const [tableErrorMessage, setTableErrorMessage] = useState(""); | ||
const [visibleModal, setVisibleModal] = useState(0); | ||
const [selectedClassUUID, setSelectedClassUUID] = useState(null); | ||
const [currentPage, setCurrentPage] = useState(1); | ||
const [rowPerPage, setRowPerPage] = useState(5); | ||
const [isRefreshPage, setIsRefreshPage] = useState(false); | ||
const [isTableLoading, setIsTableLoading] = useState(false); | ||
const [totalData, setTotalData] = useState(0); | ||
const [totalPages, setTotalPages] = useState(0); | ||
const [filterValues, setFilterValues] = useState([]); | ||
|
||
const getAllClasses = useCallback(async () => { | ||
setTableErrorMessage(false); | ||
setIsTableLoading(true); | ||
|
||
try { | ||
const response = await ClassApi.getClasses(rowPerPage, currentPage, true, "", filterValues); | ||
if (response.success) { | ||
const { data, total } = response.data; | ||
const mappedClasses = data.map((cls, idx) => | ||
mappedClassData(cls, idx + 1 + (currentPage - 1) * rowPerPage) | ||
); | ||
setClassData(mappedClasses); | ||
setOriginalClassData(mappedClasses); | ||
setTotalData(total); | ||
setTotalPages(Math.ceil(total / rowPerPage)); | ||
} else { | ||
setClassData([]); | ||
} | ||
} catch (error) { | ||
setTableErrorMessage('Error fetching class data'); | ||
} finally { | ||
setIsTableLoading(false); | ||
} | ||
}, [rowPerPage, currentPage, filterValues]); | ||
|
||
const handleSetRowPerPage = (value) => { | ||
setRowPerPage(value); | ||
setCurrentPage(1); | ||
setIsRefreshPage((prev) => !prev); | ||
}; | ||
|
||
const filterClassData = (filterValues) => { | ||
setFilterValues(filterValues); | ||
setIsRefreshPage((prev) => !prev); | ||
}; | ||
|
||
return { | ||
classData, | ||
setClassData, | ||
isModalLoading, | ||
setIsModalLoading, | ||
isTableLoading, | ||
setIsTableLoading, | ||
tableErrorMessage, | ||
visibleModal, | ||
setVisibleModal, | ||
selectedClassUUID, | ||
setSelectedClassUUID, | ||
currentPage, | ||
setCurrentPage, | ||
rowPerPage, | ||
setRowPerPage: handleSetRowPerPage, | ||
isRefreshPage, | ||
setTableErrorMessage, | ||
setIsRefreshPage, | ||
totalData, | ||
setTotalData, | ||
totalPages, | ||
setTotalPages, | ||
getAllClasses, | ||
filterClassData | ||
}; | ||
}; | ||
|
||
export { useClass }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { ClassApi } from "@/utils/utils";