Skip to content

Commit

Permalink
chore :: 주말급식 수정 및 외출 타입 수정
Browse files Browse the repository at this point in the history
chore :: 주말급식 수정 및 외출 타입 수정
  • Loading branch information
phyuna0525 authored Aug 27, 2024
2 parents 4a74fb9 + 47affe0 commit fdab01d
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 86 deletions.
2 changes: 1 addition & 1 deletion src/apis/afterManage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const GetClubList = (club: string) => {
queryFn: async () => {
try {
const response = await instance.get(
`/attendance/alltime/club?club=${club}`
`/attendance/total-time/club?club=${club}`
);
return response.data;
} catch (error) {
Expand Down
5 changes: 2 additions & 3 deletions src/apis/outAccept/outAccept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import apiError from "@/hook/apiError";

interface applicationDataProp {
class_num: number;
end_time: string;
end: string;
grade: number;
id: string;
num: number;
reason: string;
start_time: string;
start: string;
user_id: string;
username: string;
}
Expand Down Expand Up @@ -58,7 +58,6 @@ export const useOutAccept = () => {
mutationFn: async (param) => {
try {
const response = await instance.patch(`${param.type}/status`, {
type: param.type,
status: param.status,
ids: param.ids,
});
Expand Down
16 changes: 8 additions & 8 deletions src/apis/outList/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ interface applicationOK {
id: string;
username: string;
user_id: string;
start_time: string;
end_time: string;
start: string;
end: string;
grade: number;
class_num: number;
num: number;
Expand All @@ -18,8 +18,8 @@ interface OutListData {
id: string;
user_id: string;
username: string;
start_time: string;
end_time: string;
start: string;
end: string;
grade: number;
class_num: number;
num: number;
Expand All @@ -34,8 +34,8 @@ interface data {

interface previousStudent {
reason: string;
start_time: string;
end_time: string;
start: string;
end: string;
username: string;
date: string;
type: "APPLICATION" | "EARLY_RETURN";
Expand All @@ -45,7 +45,7 @@ interface ReturnHomeData {
id: string;
user_id: string;
username: string;
start_time: string;
start: string;
grade: number;
class_num: number;
num: number;
Expand All @@ -55,7 +55,7 @@ interface ReturnHomeData {
interface earlyReturnHome {
user_id: string;
username: string;
start_time: string;
start: string;
grade: number;
class_num: number;
num: number;
Expand Down
4 changes: 2 additions & 2 deletions src/apis/previousList/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import apiError from "@/hook/apiError";
import { instance } from "..";
import { useMutation } from "@tanstack/react-query";

interface Type {
export interface PreviousType {
username: string;
application_story: {
reason: string;
Expand All @@ -29,7 +29,7 @@ interface id {

export const GetPreviousList = () => {
const { handleError } = apiError();
return useMutation<Type, void, { id: string }>({
return useMutation<PreviousType, void, { id: string }>({
mutationFn: async (param: id) => {
try {
const response = await instance.get(`story/query/${param.id}`);
Expand Down
4 changes: 2 additions & 2 deletions src/apis/selfStudy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const CheckStatus = () => {
return useMutation<void, Error, Change[]>({
mutationFn: async (param) => {
try {
await instance.patch(`/attendance/alltime/modify`, param);
await instance.patch(`/attendance/total-time/modify`, param);
} catch (error) {
handleError(error);
}
Expand All @@ -40,7 +40,7 @@ export const ClassStudentCheck = (grade: number, class_num: number) => {
queryFn: async () => {
try {
const { data } = await instance.get<ClassCheck[]>(
`/attendance/alltime/grade?grade=${grade}&class_num=${class_num}`
`/attendance/total-time/grade?grade=${grade}&class_num=${class_num}`
);
return data;
} catch (error) {
Expand Down
75 changes: 31 additions & 44 deletions src/app/WeekendMeals/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,6 @@ import { BackGround } from "../components/common/background";
import { useRouter } from "next/navigation";
import { NextPage } from "next";

interface mealcheckProp {
id: string;
name: string;
status: "OK" | "NO";
grade: number;
class_num: number;
num: number;
}

interface notCheckMeal {
id: string;
name: string;
status: "QUIET";
grade: number;
class_num: number;
num: number;
}

const WeekendMeals: NextPage = () => {
const router = useRouter();
const [selectGrade, setSelectGrade] = useState<number>(1);
Expand All @@ -40,12 +22,7 @@ const WeekendMeals: NextPage = () => {
router.push("/WeekendMeals/all");
};

const { data: checkMealMutate, refetch: RecheckMealMutate } = MealCheck(
selectGrade,
selectClass
);
const { data: notCheckMealMutate, refetch: RenotCheckMealMutate } =
NotMealCheck(selectGrade, selectClass);
const { data: checkMealMutate } = MealCheck(selectGrade, selectClass);

useEffect(() => {
const grade = parseInt(localStorage.getItem("grade") || "1", 10);
Expand Down Expand Up @@ -95,33 +72,30 @@ const WeekendMeals: NextPage = () => {
<div className=" flex justify-between w-full">
<div className=" flex flex-col gap-9 w-1/2">
<div className=" flex flex-col gap-1">
<div className=" text-heading6-M text-gray-900">응답자</div>
<div className=" text-caption1 text-neutral-300">
응답자의 상태는 수정할 수 없습니다.
</div>
<div className=" text-heading6-M text-gray-900">신청자</div>
</div>
<div className=" flex flex-col gap-3">
{checkMealMutate?.map((item, index) => (
<Classmeals
key={index}
number={setStudentNum(item)}
name={item.name}
state={item.status || "NO"}
onclick={() => {}}
id=""
/>
))}
{checkMealMutate?.map(
(item, index) =>
item.status === "OK" && (
<Classmeals
key={index}
number={setStudentNum(item)}
name={item.name}
state={item.status || "NO"}
onclick={() => {}}
id=""
/>
)
)}
</div>
</div>
<div className=" flex flex-col gap-9 w-1/2 h-full">
<div className=" flex flex-col gap-1">
<div className=" text-heading6-M text-gray-900">미응답자</div>
<div className=" text-caption1 text-neutral-300">
매달 5일 전까지 상태를 수정할 수 있습니다
</div>
<div className=" text-heading6-M text-gray-900">미신청자</div>
</div>
<div className="flex flex-col gap-3 h-full">
{notCheckMealMutate?.map((item, index) => (
{/* {notCheckMealMutate?.map((item, index) => (
<Classmeals
id={item.id}
key={index}
Expand All @@ -132,7 +106,20 @@ const WeekendMeals: NextPage = () => {
setEffect(effect + 1);
}}
/>
))}
))} */}
{checkMealMutate?.map(
(item, index) =>
item.status === "NO" && (
<Classmeals
key={index}
number={setStudentNum(item)}
name={item.name}
state={item.status || "NO"}
onclick={() => {}}
id=""
/>
)
)}
</div>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/app/components/common/list/before/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Image from "next/image";
import React, { useState, useRef, useEffect } from "react";
import arrow from "@/assets/img/Icon/chevron-right.svg";
import downarrow from "@/assets/img/Icon/downarrow.svg";
import { GetPreviousList } from "@/apis/previousList";
import { GetPreviousList, PreviousType } from "@/apis/previousList";
import BeforeList from "./list";
import OutBedge from "./badge";

Expand All @@ -18,8 +18,8 @@ interface Type {
username: string;
application_story: {
reason: string;
start_time: string;
end_time: string;
start: string;
end: string;
date: string;
type: "APPLICATION" | "EARLY_RETURN";
}[];
Expand All @@ -33,7 +33,7 @@ const PreviousList: React.FC<getProp> = ({
}) => {
const [isDropdownVisible, setIsDropdownVisible] = useState<boolean>(false);
const { mutate: getPrevious } = GetPreviousList();
const [data, setData] = useState<Type>();
const [data, setData] = useState<PreviousType>();
const dropdownRef = useRef<HTMLDivElement>(null);

const toggleDropdown = async () => {
Expand Down
18 changes: 3 additions & 15 deletions src/app/outAccept/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@ import { useRouter } from "next/navigation";
import { BackGround } from "../components/common/background";
import useAcceptListSelection from "@/hook/hook";

interface applicationDataProp {
class_num: number;
end_time: string;
grade: number;
id: string;
num: number;
reason: string;
start_time: string;
user_id: string;
username: string;
}

const OutAccept = () => {
const router = useRouter();
const [selectedTab, setSelectedTab] = useState<boolean>(true);
Expand Down Expand Up @@ -203,7 +191,7 @@ const OutAccept = () => {
handleAcceptListClick(dataItem.id, dataItem.username)
}
key={index}
time={`${dataItem.start_time} ~ ${dataItem.end_time}`}
time={`${dataItem.start} ~ ${dataItem.end}`}
student={getStudentString(dataItem)}
why={`${dataItem.reason}`}
/>
Expand All @@ -214,10 +202,10 @@ const OutAccept = () => {
{getClassMutate?.map((dataItem, index) => (
<AcceptList
onClick={() =>
handleAcceptListClick(dataItem.user_id, dataItem.username)
handleAcceptListClick(dataItem.id, dataItem.username)
}
key={index}
time={`${dataItem.start_time} ~`}
time={`${dataItem.start} ~`}
student={`${getStudentString(dataItem)}`}
why={dataItem.reason}
/>
Expand Down
6 changes: 3 additions & 3 deletions src/app/outList/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import useAcceptListSelection from "@/hook/hook";
interface applicationOK {
id: string;
username: string;
start_time: string;
end_time: string;
start: string;
end: string;
grade: number;
class_num: number;
num: number;
Expand Down Expand Up @@ -103,7 +103,7 @@ const OutList = () => {
onClick={() => handleAcceptListClick(data.id, data.username)}
id={data.id}
key={index}
returnTime={data.end_time}
returnTime={data.end}
student={getStudentString(data)}
reason={data.reason}
/>
Expand Down
8 changes: 4 additions & 4 deletions src/app/outList/reason/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ interface OutListData {
id: string;
user_id: string;
username: string;
start_time: string;
end_time: string;
start: string;
end: string;
grade: number;
class_num: number;
num: number;
Expand All @@ -24,7 +24,7 @@ interface HomeData {
id: string;
user_id: string;
username: string;
start_time: string;
start: string;
grade: number;
class_num: number;
num: number;
Expand Down Expand Up @@ -79,7 +79,7 @@ const Reason = () => {
{(selectedTab ? outData : returnHomeData).map((item, index) => (
<ReasonList
key={index}
time={item.start_time}
time={item.start}
endTime=""
student={student(item)}
why={item.reason}
Expand Down

0 comments on commit fdab01d

Please sign in to comment.