+ RC 사생 명단 업로드
+
+ RC 사생에게만 RC 장소 예약을 받기 위해 RC 사생 명단 정보가 필요합니다.
+ 아래 주소에서 CSV 파일을 다운 받아 요 형식에 맞춰 입력 후, 다시 CSV 파일을 업로드 해주세요.
+ CSV 파일이 업로드 되면, RC 사생 명단 초기화 후 업로드 된 명단에 있는 Povis ID를 가진 모든 유저를 RC 사생으로 분류합니다.
+ 만약 RC 사생 명단 업로드 후에 RC 사생이 추가로 가입한다면, 자동으로 RC 사생으로 분류됩니다.
+
+
+
+
+ POPO 가입 RC 사생 수: {popoRcStdntCnt}명 ({Number((popoRcStdntCnt / totalRcStdntCnt * 100).toFixed(1))}%)
+
+
+ 전체 RC 사생 수: {totalRcStdntCnt}명
+
+
+
+
+
+ CSV 다운로드
+
+
+ {
+ PoPoAxios.get('/setting/sync-rc-students-list', { withCredentials: true })
+ .then(() => {
+ alert('싱크에 성공 했습니다.');
+ window.location.reload();
+ })
+ .catch((err) => {
+ const errMsg = err.response.data.message;
+ alert(`목록 싱크에 실패했습니다.\n${errMsg}`)
+ })
+ }}
+ >
+ RC 사생 명단 Sync
+
+
+
+
+
+
+
+ )
+}
+
+export default RcStudentsListPage;
+
+export async function getServerSideProps() {
+ const res1 = await PoPoAxios.get('/user/count/RC_STUDENT');
+ const popoRcStdntCnt = res1.data;
+
+ const res2 = await PoPoAxios.get('/setting/count-rc-students-list');
+ const totalRcStdntCnt = res2.data;
+
+ return { props: { popoRcStdntCnt, totalRcStdntCnt } }
+}
diff --git a/utils/image-upload.js b/utils/file-upload.js
similarity index 54%
rename from utils/image-upload.js
rename to utils/file-upload.js
index 9e116e7..d399260 100644
--- a/utils/image-upload.js
+++ b/utils/file-upload.js
@@ -9,3 +9,13 @@ export function ImageUpload(uri, image_file) {
headers: { "Content-Type": "multipart/form-data" },
});
}
+
+export function CsvUpload(uri, csv_file) {
+ let formData = new FormData();
+ formData.append("csv_file", csv_file);
+
+ return PoPoAxios.post(uri, formData, {
+ withCredentials: true,
+ headers: { "Content-Type": "multipart/form-data" },
+ });
+}