From 4c5dca1ef1b3e61a9c9bd2e0ca5a4abdb38508a5 Mon Sep 17 00:00:00 2001 From: Kubosaka Date: Thu, 27 Jun 2024 00:14:57 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[feat]=E4=B8=80=E8=88=AC=E3=83=A6=E3=83=BC?= =?UTF-8?q?=E3=82=B6=E3=83=BC=E3=81=AE=E5=8B=9F=E9=87=91=E3=83=9A=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=82=92=E9=96=B2=E8=A6=A7=E4=B8=8D=E5=8F=AF=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mysql/db/users.sql | 2 +- .../src/pages/fund_informations/index.tsx | 20 +++++++------------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/mysql/db/users.sql b/mysql/db/users.sql index e9a480bc2..13b474caf 100644 --- a/mysql/db/users.sql +++ b/mysql/db/users.sql @@ -21,4 +21,4 @@ INSERT into users (name, bureau_id, role_id) values ('技大太郎2', 6, 2); INSERT into users (name, bureau_id, role_id) values ('技大太郎3', 3, 3); -- 一般ユーザー(財務局員) -INSERT into users (name, bureau_id, role_id) values ('技大太郎4', 3, 1); +INSERT into users (name, bureau_id, role_id) values ('技大太郎4', 3, 4); diff --git a/view/next-project/src/pages/fund_informations/index.tsx b/view/next-project/src/pages/fund_informations/index.tsx index 9f82d5f0b..5f7c266aa 100644 --- a/view/next-project/src/pages/fund_informations/index.tsx +++ b/view/next-project/src/pages/fund_informations/index.tsx @@ -12,6 +12,7 @@ import OpenDeleteModalButton from '@components/fund_information/OpenDeleteModalB import OpenEditModalButton from '@components/fund_information/OpenEditModalButton'; import MainLayout from '@components/layout/MainLayout'; import { Department, FundInformation, Teacher, User, YearPeriod } from '@type/common'; +import Router from 'next/router'; interface FundInformationView { fundInformation: FundInformation; @@ -36,24 +37,16 @@ export const getServerSideProps = async () => { const periodsRes = await get(getPeriodsUrl); const getTeachersInformationURL = process.env.SSR_API_URI + '/teachers'; const getDepartmentURL = process.env.SSR_API_URI + '/departments'; - const getFundInformationURL = process.env.SSR_API_URI + '/fund_informations'; - const getFundInformationViewURL = - process.env.SSR_API_URI + - '/fund_informations/details/' + - (periodsRes ? String(periodsRes[periodsRes.length - 1].year) : String(date.getFullYear())); + const getUserURL = process.env.SSR_API_URI + '/users'; const teachersInformationRes = await get(getTeachersInformationURL); - const fundInformationRes = await get(getFundInformationURL); const departmentRes = await get(getDepartmentURL); - const fundInformationViewRes = await get(getFundInformationViewURL); const userRes = await get(getUserURL); return { props: { teachers: teachersInformationRes, departments: departmentRes, - fundInformation: fundInformationRes, - fundInformationView: fundInformationViewRes, users: userRes, yearPeriods: periodsRes, }, @@ -68,14 +61,15 @@ export default function FundInformations(props: Props) { const user = useRecoilValue(userAtom); const [currentUser, setCurrentUser] = useState(); + // 一般ユーザーの場合、購入申請へ飛ばす + user?.roleID === 1 && Router.push('/purchaseorders'); + useEffect(() => { setCurrentUser(user); }, []); // 募金一覧 - const [fundInformationViews, setFundInformationViews] = useState( - props.fundInformationView, - ); + const [fundInformationViews, setFundInformationViews] = useState(); //年の指定 const yearPeriods = props.yearPeriods; @@ -147,7 +141,7 @@ export default function FundInformations(props: Props) { const putURL = process.env.CSR_API_URI + '/fund_informations/' + id; await put(putURL, fundItem); - const newFundInformationViews = fundInformationViews.map((fundInformationView) => { + const newFundInformationViews = fundInformationViews?.map((fundInformationView) => { if (fundInformationView.fundInformation.id == id) { return { ...fundInformationView, From 3ae0322b71998860cb36af53ae65d29a009e3bab Mon Sep 17 00:00:00 2001 From: Kubosaka Date: Wed, 26 Jun 2024 15:19:18 +0000 Subject: [PATCH 2/4] formatted by workflow --- view/next-project/src/pages/fund_informations/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/next-project/src/pages/fund_informations/index.tsx b/view/next-project/src/pages/fund_informations/index.tsx index 5f7c266aa..91b352ee8 100644 --- a/view/next-project/src/pages/fund_informations/index.tsx +++ b/view/next-project/src/pages/fund_informations/index.tsx @@ -1,5 +1,6 @@ import clsx from 'clsx'; import Head from 'next/head'; +import Router from 'next/router'; import { useEffect, useState, useMemo } from 'react'; import { useRecoilValue } from 'recoil'; import { userAtom } from '@/store/atoms'; @@ -12,7 +13,6 @@ import OpenDeleteModalButton from '@components/fund_information/OpenDeleteModalB import OpenEditModalButton from '@components/fund_information/OpenEditModalButton'; import MainLayout from '@components/layout/MainLayout'; import { Department, FundInformation, Teacher, User, YearPeriod } from '@type/common'; -import Router from 'next/router'; interface FundInformationView { fundInformation: FundInformation; From 73d5b84513e4e2ea7f0be3604b2d752080af68a5 Mon Sep 17 00:00:00 2001 From: Kubosaka Date: Thu, 27 Jun 2024 08:55:35 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[fix]=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mysql/db/users.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql/db/users.sql b/mysql/db/users.sql index 13b474caf..fb57004da 100644 --- a/mysql/db/users.sql +++ b/mysql/db/users.sql @@ -20,5 +20,5 @@ INSERT into users (name, bureau_id, role_id) values ('技大太郎2', 6, 2); -- 財務局長 INSERT into users (name, bureau_id, role_id) values ('技大太郎3', 3, 3); --- 一般ユーザー(財務局員) +-- 財務局員 INSERT into users (name, bureau_id, role_id) values ('技大太郎4', 3, 4); From 1cd7e761b344b8e173aed0d791fe5811230f4fa2 Mon Sep 17 00:00:00 2001 From: Kubosaka Date: Thu, 27 Jun 2024 09:21:04 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[feat]=E4=B8=80=E8=88=AC=E3=83=A6=E3=83=BC?= =?UTF-8?q?=E3=82=B6=E3=83=BC=E5=A0=B4=E5=90=88=E3=83=87=E3=83=BC=E3=82=BF?= =?UTF-8?q?=E3=82=92=E9=9D=9E=E8=A1=A8=E7=A4=BA=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/next-project/src/pages/fund_informations/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/view/next-project/src/pages/fund_informations/index.tsx b/view/next-project/src/pages/fund_informations/index.tsx index 91b352ee8..700aad409 100644 --- a/view/next-project/src/pages/fund_informations/index.tsx +++ b/view/next-project/src/pages/fund_informations/index.tsx @@ -284,6 +284,7 @@ export default function FundInformations(props: Props) { {fundInformationViews && + user?.roleID !== 1 && fundInformationViews.map((fundViewItem: FundInformationView, index) => (