-
+
diff --git a/src/app/outAccept/page.tsx b/src/app/outAccept/page.tsx
index 3f43b5c..386b779 100644
--- a/src/app/outAccept/page.tsx
+++ b/src/app/outAccept/page.tsx
@@ -30,6 +30,15 @@ const OutAccept = () => {
AcceptDataList();
}, [selectGrade, selectClass]);
+ useEffect(() => {
+ const grade = parseInt(localStorage.getItem("grade") || "1", 10);
+ const class_num = parseInt(localStorage.getItem("class_num") || "1", 10);
+ const setgrade = grade === 0 ? 1 : grade;
+ const setclass_num = class_num === 0 ? 1 : class_num;
+ setSelectGrade(setgrade);
+ setSelectClass(setclass_num);
+ }, []);
+
const handleGradeChange = (selectedOption: number) => {
if (selectedOption === 5) {
setSelectGrade(5);
@@ -39,6 +48,20 @@ const OutAccept = () => {
}
};
+ const acceptColor = () => {
+ if (selectedStudents.length === 0) {
+ return "solidDisabled";
+ }
+ return "primary";
+ };
+
+ const refuseColor = () => {
+ if (selectedStudents.length === 0) {
+ return "ghostDisabled";
+ }
+ return "red";
+ };
+
const handleClassChange = (selectedOption: number) => {
if (selectGrade === 5) {
alert("학년을 선택해주세요");
@@ -97,7 +120,9 @@ const OutAccept = () => {
};
const Accept = () => {
- setAcModal(true);
+ if (selectedStudents.length === 0) {
+ alert("외출 수락 할 학생을 선택해주세요");
+ } else setAcModal(true);
};
const onCancel = () => {
@@ -106,7 +131,9 @@ const OutAccept = () => {
};
const No = () => {
- setNomodal(true);
+ if (selectedStudents.length === 0) {
+ alert("외출 거절 할 학생을 선택해주세요");
+ } else setNomodal(true);
};
const onClickTab = (tab: boolean) => {
@@ -125,6 +152,7 @@ const OutAccept = () => {
},
{
onSuccess: () => {
+ location.reload();
setNomodal(false);
},
onError: (error) => {
@@ -152,8 +180,8 @@ const OutAccept = () => {
},
{
onSuccess: () => {
+ location.reload();
setAcModal(false);
- // location.reload();
},
onError: (error) => {
console.error("Out accept error", error);
@@ -183,11 +211,15 @@ const OutAccept = () => {