From 3b70fc3e42dbee5e85a9cabbbe3840407215303c Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Fri, 7 Apr 2023 19:56:03 +0900 Subject: [PATCH 01/37] =?UTF-8?q?[fix]=20=E9=87=91=E9=A1=8D=E3=82=92number?= =?UTF-8?q?=E3=81=A7=E5=8F=97=E3=81=91=E5=8F=96=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=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/components/common/Input/Input.tsx | 2 ++ .../src/components/sponsorstyles/SponsorStyleAddModal.tsx | 1 + 2 files changed, 3 insertions(+) diff --git a/view/next-project/src/components/common/Input/Input.tsx b/view/next-project/src/components/common/Input/Input.tsx index 0522ccfb5..00860de0a 100644 --- a/view/next-project/src/components/common/Input/Input.tsx +++ b/view/next-project/src/components/common/Input/Input.tsx @@ -10,6 +10,7 @@ interface Props { value?: string | number; onChange?: (e: React.ChangeEvent) => void; children?: React.ReactNode; + type?: string; } function Input(props: Props): JSX.Element { @@ -23,6 +24,7 @@ function Input(props: Props): JSX.Element { id={props.id} value={props.value} onChange={props.onChange} + type={props.type} > {props.children} diff --git a/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx b/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx index 879d707cf..3c49d0feb 100644 --- a/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx +++ b/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx @@ -135,6 +135,7 @@ export default function SponsorStyleAddModal(props: ModalProps) {

金額

Date: Fri, 7 Apr 2023 21:41:25 +0900 Subject: [PATCH 02/37] =?UTF-8?q?[fix]=20sponsor=E3=81=AE=E3=83=A2?= =?UTF-8?q?=E3=83=BC=E3=83=80=E3=83=AB=E3=81=AE=E9=96=8B=E9=96=89=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next-project/src/components/sponsors/SponsorAddModal.tsx | 1 - .../src/components/sponsors/SponsorEditModal.tsx | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/view/next-project/src/components/sponsors/SponsorAddModal.tsx b/view/next-project/src/components/sponsors/SponsorAddModal.tsx index 3b2d16888..6877bfe2b 100644 --- a/view/next-project/src/components/sponsors/SponsorAddModal.tsx +++ b/view/next-project/src/components/sponsors/SponsorAddModal.tsx @@ -1,4 +1,3 @@ -/* eslint-disable import/no-unresolved */ import { useRouter } from 'next/router'; import React, { useState } from 'react'; diff --git a/view/next-project/src/components/sponsors/SponsorEditModal.tsx b/view/next-project/src/components/sponsors/SponsorEditModal.tsx index 99564af33..82db8c7ad 100644 --- a/view/next-project/src/components/sponsors/SponsorEditModal.tsx +++ b/view/next-project/src/components/sponsors/SponsorEditModal.tsx @@ -14,7 +14,6 @@ interface Props { export default function SponsorEditModal(props: Props) { const router = useRouter(); - const { closeModal } = useUI(); const [formData, setFormData] = useState(props.sponsor); @@ -31,7 +30,7 @@ export default function SponsorEditModal(props: Props) { const submit = async (formData: Sponsor) => { editSponsor(formData); - closeModal(); + props.setIsOpen(false); router.reload(); }; @@ -39,7 +38,7 @@ export default function SponsorEditModal(props: Props) {
- + props.setIsOpen(false)} />

企業登録

From ac14f348ab1ed196301b906c79b9d6b8e21b1501 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Fri, 7 Apr 2023 21:41:41 +0900 Subject: [PATCH 03/37] =?UTF-8?q?[fix]=20=E5=8B=9F=E9=87=91=E9=96=A2?= =?UTF-8?q?=E4=BF=82=E3=81=AEmodal=E3=82=92tailwind=E3=81=AB=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/DeleteButton.tsx | 7 +- .../src/components/common/EditButton.tsx | 9 +- .../src/components/common/Modal.tsx | 2 +- .../components/fund_information/AddModal.tsx | 307 +++++------------- .../fund_information/DeleteModal.tsx | 207 ++---------- .../fund_information/DetailModal.tsx | 107 ------ .../components/fund_information/EditModal.tsx | 233 ++++++------- .../fund_information/OpenAddModalButton.tsx | 52 ++- .../OpenDeleteModalButton.tsx | 46 +-- .../fund_information/OpenEditModalButton.tsx | 64 ++-- .../src/pages/fund_informations/index.tsx | 66 ++-- 11 files changed, 297 insertions(+), 803 deletions(-) delete mode 100644 view/next-project/src/components/fund_information/DetailModal.tsx diff --git a/view/next-project/src/components/common/DeleteButton.tsx b/view/next-project/src/components/common/DeleteButton.tsx index 0b30d7730..b43e0269e 100644 --- a/view/next-project/src/components/common/DeleteButton.tsx +++ b/view/next-project/src/components/common/DeleteButton.tsx @@ -20,12 +20,11 @@ const DeleteButton = (props: Props) => { return ( ); }; diff --git a/view/next-project/src/components/common/EditButton.tsx b/view/next-project/src/components/common/EditButton.tsx index 5ca454fc1..8b720736b 100644 --- a/view/next-project/src/components/common/EditButton.tsx +++ b/view/next-project/src/components/common/EditButton.tsx @@ -7,7 +7,7 @@ interface Props { } const EditButton: React.FC = (props) => { - const { onClick, isDisabled } = props; + const { onClick, isDisabled = true } = props; const buttonClass = useMemo(() => { if (!isDisabled) { @@ -19,13 +19,12 @@ const EditButton: React.FC = (props) => { return ( ); }; diff --git a/view/next-project/src/components/common/Modal.tsx b/view/next-project/src/components/common/Modal.tsx index 53d5aa83c..61b58ce48 100644 --- a/view/next-project/src/components/common/Modal.tsx +++ b/view/next-project/src/components/common/Modal.tsx @@ -8,7 +8,7 @@ interface Props { export default function Modal(props: Props) { const className = - 'relative w-auto my-6 mx-auto max-w-3xl bg-white-0 rounded-lg p-5' + + 'relative my-6 mx-auto bg-white-0 rounded-lg p-5' + (props.className ? ` ${props.className}` : ''); return ( diff --git a/view/next-project/src/components/fund_information/AddModal.tsx b/view/next-project/src/components/fund_information/AddModal.tsx index 7765a86b5..9019fb802 100644 --- a/view/next-project/src/components/fund_information/AddModal.tsx +++ b/view/next-project/src/components/fund_information/AddModal.tsx @@ -1,47 +1,23 @@ -import { - Box, - Center, - ChakraProvider, - Flex, - Grid, - GridItem, - Input, - Modal, - ModalBody, - ModalContent, - ModalFooter, - ModalOverlay, - Select, - Spacer, -} from '@chakra-ui/react'; import { useRouter } from 'next/router'; import React, { Dispatch, FC, SetStateAction, useEffect, useMemo, useState } from 'react'; -import { RiCloseCircleLine } from 'react-icons/ri'; import { useRecoilState } from 'recoil'; +import { Modal, CloseButton, Input, Select, PrimaryButton } from '../common'; + import { userAtom } from '@/store/atoms'; import { post } from '@api/fundInformations'; -import theme from '@assets/theme'; -import RegistButton from '@components/common/RegistButton'; import { Department, FundInformation, Teacher, User } from '@type/common'; interface ModalProps { setShowModal: Dispatch>; - openModal: boolean; - children?: React.ReactNode; - teachersInformation: Teacher[]; + teachers: Teacher[]; departments: Department[]; - currentUser: User; - userID: number | string; + users: User[]; } const OpenAddModal: FC = (props) => { const [user] = useRecoilState(userAtom); - const closeModal = () => { - props.setShowModal(false); - }; - const router = useRouter(); const [departmentID, setDepartmentID] = useState(1); const [formData, setFormData] = useState({ @@ -67,73 +43,6 @@ const OpenAddModal: FC = (props) => { } }, [user, router.isReady]); - // 学科別教員リストの用意 - // // 電気電子情報 - const electricalTeachers: Teacher[] = useMemo( - () => props.teachersInformation.filter((teacher) => teacher.departmentID === 1), - [props.teachersInformation], - ); - // // 生物 - const biologicalTeachers: Teacher[] = useMemo( - () => props.teachersInformation.filter((teacher) => teacher.departmentID === 2), - [props.teachersInformation], - ); - // // 機械 - const machineTeachers: Teacher[] = useMemo( - () => props.teachersInformation.filter((teacher) => teacher.departmentID === 3), - [props.teachersInformation], - ); - // // 物質 - const materialTeachers: Teacher[] = useMemo( - () => props.teachersInformation.filter((teacher) => teacher.departmentID === 4), - [props.teachersInformation], - ); - // // 環境社会基盤 - const environmentalTeachers: Teacher[] = useMemo( - () => props.teachersInformation.filter((teacher) => teacher.departmentID === 5), - [props.teachersInformation], - ); - // // 情報・経営 - const informationManagementTeachers: Teacher[] = useMemo( - () => props.teachersInformation.filter((teacher) => teacher.departmentID === 6), - [props.teachersInformation], - ); - // // 基盤共通 - const commonEducationTeachers: Teacher[] = useMemo( - () => props.teachersInformation.filter((teacher) => teacher.departmentID === 7), - [props.teachersInformation], - ); - // // 原子力 - const nuclearTeachers: Teacher[] = useMemo( - () => props.teachersInformation.filter((teacher) => teacher.departmentID === 8), - [props.teachersInformation], - ); - // // 技学イノベ - const technologyInovationTeachers: Teacher[] = useMemo( - () => props.teachersInformation.filter((teacher) => teacher.departmentID === 9), - [props.teachersInformation], - ); - // // システム安全 - const systemSafetyTeachers: Teacher[] = useMemo( - () => props.teachersInformation.filter((teacher) => teacher.departmentID === 10), - [props.teachersInformation], - ); - // // 技術支援 - const technologySupportTeachers: Teacher[] = useMemo( - () => props.teachersInformation.filter((teacher) => teacher.departmentID === 11), - [props.teachersInformation], - ); - // // 産学融合 - const industryAcademiaFusionTeachers: Teacher[] = useMemo( - () => props.teachersInformation.filter((teacher) => teacher.departmentID === 12), - [props.teachersInformation], - ); - // // 学長・事務 - const presidentClericals: Teacher[] = useMemo( - () => props.teachersInformation.filter((teacher) => teacher.departmentID === 13), - [props.teachersInformation], - ); - const handler = (input: string) => (e: React.ChangeEvent | React.ChangeEvent) => { @@ -149,141 +58,81 @@ const OpenAddModal: FC = (props) => { await post(addFundInformationUrl, data); }; - // 学科ごとの教員のセレクトボックス - const selectTeacherContent = (teachers: Teacher[]) => { - return ( - <> - - - ); - }; - return ( - - - - - - - - - - - - - -
- 募金の登録 -
-
- - - - - - 学科 - - - - - - - - 教員名 - - - - {departmentID == 1 && selectTeacherContent(electricalTeachers)} - {departmentID == 2 && selectTeacherContent(biologicalTeachers)} - {departmentID == 3 && selectTeacherContent(machineTeachers)} - {departmentID == 4 && selectTeacherContent(materialTeachers)} - {departmentID == 5 && selectTeacherContent(environmentalTeachers)} - {departmentID == 6 && selectTeacherContent(informationManagementTeachers)} - {departmentID == 7 && selectTeacherContent(commonEducationTeachers)} - {departmentID == 8 && selectTeacherContent(nuclearTeachers)} - {departmentID == 9 && selectTeacherContent(technologyInovationTeachers)} - {departmentID == 10 && selectTeacherContent(systemSafetyTeachers)} - {departmentID == 11 && selectTeacherContent(technologySupportTeachers)} - {departmentID == 12 && selectTeacherContent(industryAcademiaFusionTeachers)} - {departmentID == 13 && selectTeacherContent(presidentClericals)} - - - - 金額 - - - - - - - - - - 備考 - - - - - - - - - - -
-
-
- - { - addFundInformation(formData); - router.reload(); - }} - > - 登録する - - -
-
-
-
+ +
+
+ props.setShowModal(false)} /> +
+
+

募金の登録

+
+

所属

+
+ +
+

教員名

+
+ +
+

担当者

+
+ +
+

金額

+
+ +
+

備考

+
+ +
+
+
+ { + addFundInformation(formData); + props.setShowModal(false); + router.reload(); + }} + > + 登録する + +
+
); }; diff --git a/view/next-project/src/components/fund_information/DeleteModal.tsx b/view/next-project/src/components/fund_information/DeleteModal.tsx index 897e307d7..2bc8368a2 100644 --- a/view/next-project/src/components/fund_information/DeleteModal.tsx +++ b/view/next-project/src/components/fund_information/DeleteModal.tsx @@ -1,189 +1,52 @@ -import { - ChakraProvider, - Center, - Text, - Flex, - Box, - Spacer, - Modal, - ModalOverlay, - ModalContent, - ModalFooter, - ModalBody, - Grid, - GridItem, - Divider, -} from '@chakra-ui/react'; import { useRouter } from 'next/router'; -import { useState, useEffect, Dispatch, SetStateAction } from 'react'; -import { useCallback } from 'react'; -import { RiCloseCircleLine } from 'react-icons/ri'; +import React, { Dispatch, FC, SetStateAction } from 'react'; -import { get, del } from '@api/api_methods'; -import theme from '@assets/theme'; -import { RedButton } from '@components/common'; -import { FundInformation, Teacher, User } from '@type/common'; +import { del } from '@api/api_methods'; +import { Modal, CloseButton, OutlinePrimaryButton, PrimaryButton } from '@components/common'; interface ModalProps { setShowModal: Dispatch>; - openModal: boolean; children?: React.ReactNode; id: number | string; - teacherID: number; - userID: number; } -export default function DeleteModal(props: ModalProps) { +const DeleteModal: FC = (props) => { + const router = useRouter(); + const closeModal = () => { props.setShowModal(false); + router.reload(); }; - const router = useRouter(); - - // モーダルに表示する用のfund_informationを定義 - const [fundInformation, setFundInformation] = useState({ - userID: 0, - teacherID: 0, - price: 0, - remark: '', - isFirstCheck: false, - isLastCheck: false, - }); - - const [teacher, setTeacher] = useState({ - id: Number(fundInformation.teacherID), - name: '', - position: '', - departmentID: 1, - room: '', - isBlack: false, - remark: '', - createdAt: '', - updatedAt: '', - }); - - const [user, setUser] = useState({ - id: 0, - name: '', - bureauID: 1, - roleID: 1, - }); - - // モーダルを開いているfund_informationを取得 - const getFundInformation = useCallback(async () => { - const getFundInformationURL = process.env.CSR_API_URI + '/fund_informations/' + props.id; - setFundInformation(await get(getFundInformationURL)); - }, [props.id]); - - // teacher_idに紐づくteacherを取得 - const getTeacher = useCallback(async () => { - const getTeacherURL = process.env.CSR_API_URI + '/teachers/' + props.teacherID; - setTeacher(await get(getTeacherURL)); - }, [props.teacherID]); - - // user_idに紐づくuserを取得 - const getUser = useCallback(async () => { - const getUserURL = process.env.CSR_API_URI + '/users/' + props.userID; - setUser(await get(getUserURL)); - }, [props.userID]); - - useEffect(() => { - if (router.isReady) { - getFundInformation(); - getTeacher(); - getUser(); - } - }, [router, getFundInformation, getTeacher, getUser]); - - const deleteFundInformation = async (id: number | string) => { - const deleteFundInformationURL = process.env.CSR_API_URI + '/fund_informations/' + id; - await del(deleteFundInformationURL); + const deleteFundInformations = async (id: number | string) => { + const deletePurchaseReportUrl = process.env.CSR_API_URI + '/fund_informations/' + id; + await del(deletePurchaseReportUrl); }; return ( - - - - - - - - - - - - - -
- 募金の削除 -
-
- - - - - - 報告者名 - - - - - {user.name} - - - - - - 教員名 - - - - - {teacher.name} - - - - - - 金額 - - - - - {fundInformation.price} - - - - - - 備考 - - - - - {fundInformation.remark} - - - - - - -
-
-
- - { - deleteFundInformation(props.id); - router.reload(); - }} - > - 削除する - - -
-
-
-
+ +
+
+ props.setShowModal(false)} /> +
+
+
募金の削除
+
削除しますか?
+
+
+ 戻る + { + deleteFundInformations(props.id); + closeModal(); + }} + > + 削除 + +
+
+
); -} +}; + +export default DeleteModal; diff --git a/view/next-project/src/components/fund_information/DetailModal.tsx b/view/next-project/src/components/fund_information/DetailModal.tsx deleted file mode 100644 index 197039a5f..000000000 --- a/view/next-project/src/components/fund_information/DetailModal.tsx +++ /dev/null @@ -1,107 +0,0 @@ -import { - ChakraProvider, - Center, - Text, - Flex, - Box, - Spacer, - Modal, - ModalOverlay, - ModalContent, - ModalBody, - Grid, - GridItem, -} from '@chakra-ui/react'; -import { useRouter } from 'next/router'; -import { FC, useEffect, useState, useCallback, Dispatch, SetStateAction } from 'react'; -import { RiCloseCircleLine } from 'react-icons/ri'; - -import { get } from '@api/api_methods'; -import theme from '@assets/theme'; - -interface ModalProps { - setShowModal: Dispatch>; - openModal: boolean; - children?: React.ReactNode; - id: number | string; -} - -const PurchaseOrderEditModal: FC = (props) => { - const closeModal = () => { - props.setShowModal(false); - }; - - const router = useRouter(); - - const [formData, setFormData] = useState({ - deadline: '', - user_id: '', - }); - - // モーダルを開いているfund_informationを取得 - const getFundInformation = useCallback(async () => { - const getFundInformationURL = process.env.CSR_API_URI + '/fund_informations/' + props.id; - setFormData(await get(getFundInformationURL)); - }, [props.id]); - - useEffect(() => { - if (router.isReady) { - getFundInformation(); - } - }, [router, getFundInformation]); - - return ( - - - - - - - - - - - - - -
- 詳細 -
-
- - - - 購入期限日 - - - - - - {formData.deadline} - - - - - - - - 申請者 - - - - - - {formData.user_id} - - - - -
-
-
-
-
- ); -}; - -export default PurchaseOrderEditModal; diff --git a/view/next-project/src/components/fund_information/EditModal.tsx b/view/next-project/src/components/fund_information/EditModal.tsx index 96c1e179e..6f2d5350c 100644 --- a/view/next-project/src/components/fund_information/EditModal.tsx +++ b/view/next-project/src/components/fund_information/EditModal.tsx @@ -1,65 +1,40 @@ -import { - Box, - Center, - ChakraProvider, - Flex, - Grid, - GridItem, - Input, - Modal, - ModalBody, - ModalContent, - ModalFooter, - ModalOverlay, - Select, - Spacer, -} from '@chakra-ui/react'; import { useRouter } from 'next/router'; -import { Dispatch, ReactNode, SetStateAction, useCallback, useEffect, useState } from 'react'; -import { RiCloseCircleLine } from 'react-icons/ri'; +import { Dispatch, SetStateAction, useEffect, useState } from 'react'; + +import { Modal, Input, Select, CloseButton, PrimaryButton } from '../common'; -import { get } from '@api/api_methods'; import { put } from '@api/fundInformations'; -import theme from '@assets/theme'; -import Button from '@components/common/RegistButton'; -import { FundInformation, Teacher, User } from '@type/common'; +import { FundInformation, Teacher, User, Department } from '@type/common'; interface ModalProps { setShowModal: Dispatch>; - openModal: boolean; - children?: ReactNode; - id: number | string; teachers: Teacher[]; - currentUser: User; + users: User[]; + departments: Department[]; + fundInformation: FundInformation; } -export default function FundInformationEditModal(props: ModalProps) { - const closeModal = () => { - props.setShowModal(false); - }; - +export default function EditModal(props: ModalProps) { const router = useRouter(); const [formData, setFormData] = useState({ - userID: 0, - teacherID: 0, - price: 0, - remark: '', + id: props.fundInformation.id, + userID: props.fundInformation.userID, + teacherID: props.fundInformation.teacherID, + price: props.fundInformation.price, + remark: props.fundInformation.remark, isFirstCheck: false, isLastCheck: false, }); - // モーダルを開いているfund_informationを取得 - const getFundInformation = useCallback(async () => { - const getFundInformationURL = process.env.CSR_API_URI + '/fund_informations/' + props.id; - setFormData(await get(getFundInformationURL)); - }, [props.id]); + const [departmentID, setDepartmentID] = useState(1); useEffect(() => { - if (router.isReady) { - getFundInformation(); + const teacher = props.teachers.find((teacher) => teacher.departmentID === departmentID); + if (teacher && teacher.id) { + setFormData({ ...formData, teacherID: teacher.id }); } - }, [router, getFundInformation]); + }, [departmentID]); const handler = (input: string) => @@ -72,104 +47,88 @@ export default function FundInformationEditModal(props: ModalProps) { setFormData({ ...formData, [input]: e.target.value }); }; - const submitFundInformation = async (data: FundInformation, id: number | string) => { - const submitFundInformationURL = process.env.CSR_API_URI + '/fund_informations/' + id; + const submitFundInformation = async (data: FundInformation) => { + const submitFundInformationURL = process.env.CSR_API_URI + '/fund_informations/' + data.id; await put(submitFundInformationURL, data); router.reload(); }; return ( - - - - - - - - - - - - - -
- 募金の編集 -
-
- - - - - - 教員名 - - - - - - - - 金額 - - - - - - - - - - 備考 - - - - - - - - - - -
-
-
- - - -
-
-
-
+ +
+
+ props.setShowModal(false)} /> +
+
+

募金の登録

+
+

所属

+
+ +
+

教員名

+
+ +
+

担当者

+
+ +
+

金額

+
+ +
+

備考

+
+ +
+
+
+ { + submitFundInformation(formData); + props.setShowModal(false); + router.reload(); + }} + > + 登録する + +
+
); } diff --git a/view/next-project/src/components/fund_information/OpenAddModalButton.tsx b/view/next-project/src/components/fund_information/OpenAddModalButton.tsx index 5f737c114..dd3a8d7e2 100644 --- a/view/next-project/src/components/fund_information/OpenAddModalButton.tsx +++ b/view/next-project/src/components/fund_information/OpenAddModalButton.tsx @@ -1,45 +1,31 @@ -import { ChakraProvider, Button } from '@chakra-ui/react'; -import * as React from 'react'; -import { useState } from 'react'; +import React, { useState } from 'react'; -import theme from '@assets/theme'; -import AddModal from '@components/fund_information/AddModal'; +import { AddButton } from '@components/common'; +import OpenAddModal from './AddModal'; import { Teacher, Department, User } from '@type/common'; interface Props { - width?: string; - height?: string; children?: React.ReactNode; - teachersInformation: Teacher[]; + teachers: Teacher[]; departments: Department[]; - currentUser: User; - userID: number | string; + users: User[]; } -export default function OpenAddModalButton(props: Props) { - const [showModal, setShowModal] = useState(false); - const ShowModal = () => { - setShowModal(true); - }; +export const OpenAddModalButton = (props: Props) => { + const [isOpen, setIsOpen] = useState(false); + return ( - - - - + + {isOpen && } + ); -} +}; + +export default OpenAddModalButton; diff --git a/view/next-project/src/components/fund_information/OpenDeleteModalButton.tsx b/view/next-project/src/components/fund_information/OpenDeleteModalButton.tsx index cb8120af0..5138fada6 100644 --- a/view/next-project/src/components/fund_information/OpenDeleteModalButton.tsx +++ b/view/next-project/src/components/fund_information/OpenDeleteModalButton.tsx @@ -1,48 +1,24 @@ -import { ChakraProvider, Button } from '@chakra-ui/react'; -import * as React from 'react'; -import { useState } from 'react'; -import { RiDeleteBinLine } from 'react-icons/ri'; +import React, { useState } from 'react'; -import theme from '@assets/theme'; -import DeleteModal from '@components/fund_information/DeleteModal'; +import { DeleteButton } from '@components/common'; + +import DeleteModal from './DeleteModal'; interface Props { - width?: string; - height?: string; children?: React.ReactNode; id: number; - teacherID: number; - userID: number; } const OpenDeleteModalButton: React.FC = (props) => { - const [showModal, setShowModal] = useState(false); - const ShowModal = () => { - setShowModal(true); + const [isOpen, setIsOpen] = useState(false); + const onOpen = () => { + setIsOpen(true); }; return ( - - - - + <> + + {isOpen && } + ); }; diff --git a/view/next-project/src/components/fund_information/OpenEditModalButton.tsx b/view/next-project/src/components/fund_information/OpenEditModalButton.tsx index c4983c691..35fa65fb3 100644 --- a/view/next-project/src/components/fund_information/OpenEditModalButton.tsx +++ b/view/next-project/src/components/fund_information/OpenEditModalButton.tsx @@ -1,49 +1,37 @@ -import { ChakraProvider, Button } from '@chakra-ui/react'; -import * as React from 'react'; -import { useState } from 'react'; -import { RiPencilFill } from 'react-icons/ri'; +import React, { useState } from 'react'; -import theme from '@assets/theme'; -import EditModal from '@components/fund_information/EditModal'; -import { Teacher, User } from '@type/common'; +import { EditButton } from '@components/common'; +import EditModal from './EditModal'; +import { Teacher, Department, User, FundInformation } from '@type/common'; interface Props { - width?: string; - height?: string; - children?: React.ReactNode; - id: number; teachers: Teacher[]; - currentUser: User; + departments: Department[]; + users: User[]; + fundInformation: FundInformation; } -const OpenEditModalButton: React.FC = (props) => { - const [showModal, setShowModal] = useState(false); - const ShowModal = () => { - setShowModal(true); - }; +export const OpenAddModalButton = (props: Props) => { + const [isOpen, setIsOpen] = useState(false); + return ( - - - + { + setIsOpen(true); + }} /> - + {isOpen && ( + + )} + ); }; -export default OpenEditModalButton; +export default OpenAddModalButton; diff --git a/view/next-project/src/pages/fund_informations/index.tsx b/view/next-project/src/pages/fund_informations/index.tsx index dbd85ea50..0ba263687 100644 --- a/view/next-project/src/pages/fund_informations/index.tsx +++ b/view/next-project/src/pages/fund_informations/index.tsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import Head from 'next/head'; import { useRouter } from 'next/router'; -import { useEffect, useState } from 'react'; +import { useEffect, useState, useMemo } from 'react'; import { useRecoilValue } from 'recoil'; import { userAtom } from '@/store/atoms'; @@ -27,8 +27,7 @@ interface Props { departments: Department[]; fundInformation: FundInformation[]; fundInformationView: FundInformationView[]; - currentUser: User; - totalFee: number; + users: User[]; } export const getServerSideProps = async () => { @@ -36,18 +35,12 @@ export const getServerSideProps = async () => { 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'; + 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); - - // 合計金額の計算 - let totalFee = 0; - fundInformationRes.map((fundItemRes: FundInformation) => { - if (fundItemRes.isLastCheck) { - totalFee += fundItemRes.price; - } - }); + const userRes = await get(getUserURL); return { props: { @@ -55,7 +48,7 @@ export const getServerSideProps = async () => { departments: departmentRes, fundInformation: fundInformationRes, fundInformationView: fundInformationViewRes, - totalFee: totalFee, + users: userRes, }, }; }; @@ -63,6 +56,7 @@ export const getServerSideProps = async () => { export default function FundInformations(props: Props) { // 教員一覧 const teachers: Teacher[] = props.teachers; + const users: User[] = props.users; const departments: Department[] = [ { id: 1, @@ -180,19 +174,16 @@ export default function FundInformations(props: Props) { } }, [router]); - // Modal用にuserIDを設定 - const userID = currentUser.id; - // チェック済みの合計金額用のステート - const [totalFee, setTotalFee] = useState(props.totalFee); - - const calcTotalFee = (initFundInformation: FundInformation) => { - if (initFundInformation.isLastCheck) { - setTotalFee(totalFee + initFundInformation.price); - } else { - setTotalFee(totalFee - initFundInformation.price); - } - }; + const totalFee = useMemo(() => { + return fundInformation.reduce((sum, fundInformation) => { + if (fundInformation.isLastCheck) { + return sum + fundInformation.price; + } else { + return sum; + } + }, 0); + }, [fundInformation]); // チェックの切り替え const switchCheck = async ( @@ -213,7 +204,6 @@ export default function FundInformations(props: Props) { createdAt: fundItem.createdAt, updatedAt: fundItem.updatedAt, }; - calcTotalFee(initFundInformation); } setFundInformation( fundInformation.map((fundItem: FundInformation) => @@ -300,12 +290,7 @@ export default function FundInformations(props: Props) {
- + 学内募金登録
@@ -341,10 +326,7 @@ export default function FundInformations(props: Props) { {fundInformationView && fundInformationView.map((fundViewItem: FundInformationView, index) => ( - + - {!isUser || fundViewItem.fundInformation.userID == currentUser.id ? ( + {fundViewItem.fundInformation.userID == currentUser.id || + isDeveloper || + isFinanceStaff || + isFinanceDirector ? (
From 08b95a7951a0bbdcd7e2bec3768362246b18ee27 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Fri, 7 Apr 2023 22:16:58 +0900 Subject: [PATCH 04/37] =?UTF-8?q?[fix]=20sponsorStyle=E3=81=AE=E7=99=BB?= =?UTF-8?q?=E9=8C=B2=E5=87=A6=E7=90=86=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/layout/Layout/Layout.tsx | 2 - .../sponsorstyles/OpenAddModalButton.tsx | 28 +- .../sponsorstyles/SponsorStyleAddModal.tsx | 284 ++++-------------- .../sponsorstyles/SponsorStyleNumModal.tsx | 74 ----- .../src/pages/sponsorstyles/index.tsx | 12 - 5 files changed, 79 insertions(+), 321 deletions(-) delete mode 100644 view/next-project/src/components/sponsorstyles/SponsorStyleNumModal.tsx diff --git a/view/next-project/src/components/layout/Layout/Layout.tsx b/view/next-project/src/components/layout/Layout/Layout.tsx index c434e53a1..a49225d16 100644 --- a/view/next-project/src/components/layout/Layout/Layout.tsx +++ b/view/next-project/src/components/layout/Layout/Layout.tsx @@ -2,7 +2,6 @@ import React, { ReactNode } from 'react'; import SponsorActivitiesAddModal from '@/components/sponsoractivities/SponsorActivitiesAddModal'; import SponsorAddModal from '@/components/sponsors/SponsorAddModal'; -import SponsorStyleNumModal from '@/components/sponsorstyles/SponsorStyleNumModal'; import PurchaseItemNumModal from '@components/purchaseorders/PurchaseItemNumModal'; import PurchaseReportAddModal from '@components/purchasereports/AddModal'; import PurchaseOrderListModal from '@components/purchasereports/PurchaseOrderListModal'; @@ -20,7 +19,6 @@ const ModalView: React.FC<{ modalView: string }> = ({ modalView }) => { {modalView === 'PURCHASE_ORDER_LIST_MODAL' && } {modalView === 'PURCHASE_REPORT_ITEM_NUM_MODAL' && } {modalView === 'SPONSOR_ACTIVITIES_ADD_MODAL' && } - {modalView === 'SPONSOR_STYLE_NUM_MODAL' && } ); }; diff --git a/view/next-project/src/components/sponsorstyles/OpenAddModalButton.tsx b/view/next-project/src/components/sponsorstyles/OpenAddModalButton.tsx index f3289602d..ff1eceeb4 100644 --- a/view/next-project/src/components/sponsorstyles/OpenAddModalButton.tsx +++ b/view/next-project/src/components/sponsorstyles/OpenAddModalButton.tsx @@ -1,24 +1,30 @@ -import React from 'react'; +import React, { useState } from 'react'; import { AddButton } from '@components/common'; -import { useUI } from '@components/ui/context'; +import SponsorStyleAddModal from './SponsorStyleAddModal'; interface Props { children?: React.ReactNode; } export const OpenAddModalButton = (props: Props) => { - const { setModalView, openModal } = useUI(); + const [isOpen, setIsOpen] = useState(false); return ( - { - setModalView('SPONSOR_STYLE_NUM_MODAL'); - openModal(); - }} - > - {props.children} - + <> + { + setIsOpen(true); + }} + > + {props.children} + + {isOpen && ( + + )} + ); }; diff --git a/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx b/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx index 3c49d0feb..7bac9b12e 100644 --- a/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx +++ b/view/next-project/src/components/sponsorstyles/SponsorStyleAddModal.tsx @@ -1,262 +1,102 @@ -import clsx from 'clsx'; import { useRouter } from 'next/router'; import React, { useState } from 'react'; -import { RiArrowDropRightLine } from 'react-icons/ri'; import { post } from '@api/sponsorStyle'; import { CloseButton, Input, Modal, - OutlinePrimaryButton, PrimaryButton, - Stepper, Select, } from '@components/common'; import { SCALE } from '@constants/scale'; import { SponsorStyle } from '@type/common'; -import { useUI } from '../ui/context'; - interface ModalProps { - purchaseItemNum: number; setIsOpen: (isOpen: boolean) => void; } -const TABLE_COLUMNS = ['広告サイズ', 'カラーorモノクロ', '金額']; - -export default function SponsorStyleAddModal(props: ModalProps) { - const [activeStep, setActiveStep] = useState(1); +export default function SponsorAddModal(props: ModalProps) { const router = useRouter(); - const { closeModal } = useUI(); - const nextStep = () => { - setActiveStep(activeStep + 1); - }; - const prevStep = () => { - setActiveStep(activeStep - 1); - }; - const reset = () => { - setActiveStep(1); - setIsDone(false); - }; - - // 協賛スタイルを登録するかどうかのフラグ - const [isDone, setIsDone] = useState(false); - // 協賛スタイル数だけステップを用意 - const steps = []; - for (let i = 0; i < props.purchaseItemNum; i++) { - steps.push({ label: '' }); - } - - // 協賛スタイル const [formData, setFormData] = useState({ - id: 0, scale: SCALE[0], isColor: false, price: 0, }); - // 協賛スタイルのリスト - const [formDataList, setFormDataList] = useState(() => { - const initFormDataList = []; - for (let i = 0; i < props.purchaseItemNum; i++) { - const initFormData: SponsorStyle = { - id: i + 1, - scale: SCALE[0], - isColor: false, - price: 0, - }; - initFormDataList.push(initFormData); - } - return initFormDataList; - }); - - const formDataListHandler = + const handler = (input: string) => (e: React.ChangeEvent | React.ChangeEvent) => { - setFormDataList( - formDataList.map((formData: SponsorStyle) => - formData.id === Number(e.target.id) ? { ...formData, [input]: e.target.value } : formData, - ), - ); + setFormData({ ...formData, [input]: e.target.value }); }; - // 協賛スタイルの登録と購入物品の更新を行い、ページをリロード - const submit = (data: SponsorStyle[]) => { - addSponsorStyles(data); - props.setIsOpen(false); - closeModal(); - router.reload(); + const addSponsorStyle = async (data: SponsorStyle) => { + const addSponsorUrl = process.env.CSR_API_URI + '/sponsorstyles'; + await post(addSponsorUrl, data); }; - // 協賛スタイルの追加 - const addSponsorStyles = async (data: SponsorStyle[]) => { - data.map(async (data: SponsorStyle) => { - const purchaseReportUrl = process.env.CSR_API_URI + '/sponsorstyles'; - await post(purchaseReportUrl, data); - }); + const submit = async (formData: SponsorStyle) => { + addSponsorStyle(formData); + props.setIsOpen(false); + router.reload(); }; - // 購入物品の情報 - const content = (data: SponsorStyle) => ( - <> -
-

広告サイズ

-
- -
-
-

カラー

-

モノクロ

-
-
- + return ( + +
+
+ props.setIsOpen(false)} />
-

金額

+
+

協賛スタイルの登録

+
+

広告サイズ

+
+ +
+
+
カラー
+
モノクロ
+
+
+ +
+
金額
+
- - ); - - const SponsorStyleTable = (sponsorStyles: SponsorStyle[]) => { - return ( - - - - {TABLE_COLUMNS.map((tableColumn: string) => ( - - ))} - - - - {sponsorStyles.map((sponsorStyle, index) => ( - - - - - - ))} - -
-
{tableColumn}
-
-
{sponsorStyle.scale}
-
-
- {sponsorStyle.isColor ? 'カラー' : 'モノクロ'} -
-
-
{sponsorStyle.price}
-
- ); - }; - - return ( - <> - -
-
- { - props.setIsOpen(false); - }} - /> -
-
-
協賛スタイルの登録
-
- - {!isDone && <>{content(formDataList[activeStep - 1])}} - - {isDone ? ( - <> -
{SponsorStyleTable(formDataList)}
-
- 戻る - { - submit(formDataList); - }} - > - 登録を確定する - -
- - ) : ( - <> -
- {/* stepが1より大きい時のみ戻るボタンを表示 */} - {activeStep > 1 && ( - 戻る - )} - {activeStep === 1 && ( - { - props.setIsOpen(false); - }} - > - 戻る - - )} - { - { - activeStep === steps.length ? setIsDone(true) : nextStep(); - } - }} - > - {activeStep === steps.length ? '確認へ' : '登録して次へ'} - - -
- - )} -
-
- +
+
+ { + submit(formData); + }} + > + 登録する + +
+
); } diff --git a/view/next-project/src/components/sponsorstyles/SponsorStyleNumModal.tsx b/view/next-project/src/components/sponsorstyles/SponsorStyleNumModal.tsx deleted file mode 100644 index 57acbfeee..000000000 --- a/view/next-project/src/components/sponsorstyles/SponsorStyleNumModal.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import React, { useState } from 'react'; - -import { - CloseButton, - Modal, - OutlinePrimaryButton, - PrimaryButton, - PullDown, -} from '@components/common'; -import { useUI } from '@components/ui/context'; - -import SponsorStyleAddModal from './SponsorStyleAddModal'; - -export default function SponsorStyleNumModal() { - const { closeModal } = useUI(); - - // 協賛スタイル数用の配列 - const sponsorStyleNumArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; - - // 協賛スタイルの追加モーダル開閉用変数 - const [isOpen, setIsOpen] = useState(false); - - // 購入物品数 - const [purchaseItemNum, setPurchaseItemNum] = useState(1); - - return ( - -
-
- -
-
-
-

協賛スタイルの登録

-
-
-
-

複数同時に登録できます

-

いくつ登録しますか?

-
-
-

登録数

- setPurchaseItemNum(Number(e.target.value))} - > - {sponsorStyleNumArray.map((data) => ( - - ))} - -
-
-
- 戻る -
-
- { - setIsOpen(true); - }} - > - 報告へ進む - - {isOpen && ( - - )} -
-
-
-
- ); -} diff --git a/view/next-project/src/pages/sponsorstyles/index.tsx b/view/next-project/src/pages/sponsorstyles/index.tsx index d2729def5..74ac55bbe 100644 --- a/view/next-project/src/pages/sponsorstyles/index.tsx +++ b/view/next-project/src/pages/sponsorstyles/index.tsx @@ -51,9 +51,6 @@ export default function SponsorStyleList(props: Props) { - @@ -71,15 +68,6 @@ export default function SponsorStyleList(props: Props) { {sponsorStyleList.map((sponsorStyleItem, index) => ( - + @@ -162,9 +165,7 @@ export default function PurchaseReports(props: Props) { )} onClick={() => { onOpen( - purchaseReportViewItem.purchaseReport.id - ? purchaseReportViewItem.purchaseReport.id - : 0, + purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem, ); }} @@ -187,9 +188,24 @@ export default function PurchaseReports(props: Props) { )} onClick={() => { onOpen( - purchaseReportViewItem.purchaseReport.id - ? purchaseReportViewItem.purchaseReport.id - : 0, + purchaseReportViewItem.purchaseReport.id || 0, + purchaseReportViewItem, + ); + }} + > +
+ {purchaseReportViewItem.purchaseReport.id} +
+ + ))} + + + + +
-

ID

-

広告サイズ

-

{sponsorStyleItem.id}

-
Date: Fri, 7 Apr 2023 23:39:27 +0900 Subject: [PATCH 05/37] =?UTF-8?q?[fix]=20=E3=83=A9=E3=83=99=E3=83=AB?= =?UTF-8?q?=E3=82=92expanse=E3=81=8B=E3=82=89=E5=8F=97=E3=81=91=E5=8F=96?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/common/BureauLabel/BureauLabel.tsx | 15 ++++++++------- .../common/BureauLabel/BureauLabel.type.ts | 2 +- .../src/pages/purchaseorders/index.tsx | 11 ++++++++--- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/view/next-project/src/components/common/BureauLabel/BureauLabel.tsx b/view/next-project/src/components/common/BureauLabel/BureauLabel.tsx index 75f7ad9a8..48e76d1f5 100644 --- a/view/next-project/src/components/common/BureauLabel/BureauLabel.tsx +++ b/view/next-project/src/components/common/BureauLabel/BureauLabel.tsx @@ -6,15 +6,16 @@ import { BureauLabelProps } from './BureauLabel.type'; import Label from '../Label'; const BureauLabel: React.FC = (props) => { - const { bureauID } = props; - const bureau = useMemo(() => { - const bureau = BUREAUS_WITH_EN.find((bureau) => bureau.id === bureauID); - return bureau; - }, [bureauID]); + const { bureauName } = props; + const bureauEn = useMemo(() => { + const bureau = BUREAUS_WITH_EN.find((bureau) => bureau.name === bureauName); + if(!bureau) return 'other'; + return bureau.name_en + }, []); return ( - Date: Fri, 7 Apr 2023 23:39:49 +0900 Subject: [PATCH 06/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E7=94=B3?= =?UTF-8?q?=E8=AB=8B=E3=81=ABexpanseID=E3=82=92=E5=8A=A0=E5=91=B3=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/purchaseorders/DetailModal.tsx | 2 +- .../purchaseorders/OpenAddModalButton.tsx | 18 +-- .../purchaseorders/PurchaseItemNumModal.tsx | 113 +++++++++--------- .../purchaseorders/PurchaseOrderAddModal.tsx | 4 +- view/next-project/src/type/common.ts | 12 ++ .../src/utils/api/purchaseOrder.ts | 6 +- 6 files changed, 86 insertions(+), 69 deletions(-) diff --git a/view/next-project/src/components/purchaseorders/DetailModal.tsx b/view/next-project/src/components/purchaseorders/DetailModal.tsx index b1df31599..faf76fb07 100644 --- a/view/next-project/src/components/purchaseorders/DetailModal.tsx +++ b/view/next-project/src/components/purchaseorders/DetailModal.tsx @@ -39,7 +39,7 @@ const DetailModal: FC = (props) => { }; return ( - +
diff --git a/view/next-project/src/components/purchaseorders/OpenAddModalButton.tsx b/view/next-project/src/components/purchaseorders/OpenAddModalButton.tsx index 9d18de7d9..ab7eb4be2 100644 --- a/view/next-project/src/components/purchaseorders/OpenAddModalButton.tsx +++ b/view/next-project/src/components/purchaseorders/OpenAddModalButton.tsx @@ -1,28 +1,28 @@ -import React from 'react'; - +import React, { useState } from 'react'; import { AddButton } from '@components/common'; -import { useUI } from '@components/ui/context'; +import PurchaseItemNumModal from './PurchaseItemNumModal'; +import { Expense } from '@type/common'; interface Props { - width?: string; - height?: string; children?: React.ReactNode; - onClick?: () => void; + expenses: Expense[]; } export default function OpenModalButton(props: Props) { - const { setModalView, openModal } = useUI(); + const [isOpen, setIsOpen] = useState(false); return ( <> { - setModalView('PURCHASE_ITEM_NUM_MODAL'); - openModal(); + setIsOpen(true); }} > {props.children} + {isOpen && ( + + )} ); } diff --git a/view/next-project/src/components/purchaseorders/PurchaseItemNumModal.tsx b/view/next-project/src/components/purchaseorders/PurchaseItemNumModal.tsx index e9ebd2d10..3815136aa 100644 --- a/view/next-project/src/components/purchaseorders/PurchaseItemNumModal.tsx +++ b/view/next-project/src/components/purchaseorders/PurchaseItemNumModal.tsx @@ -1,4 +1,3 @@ -import clsx from 'clsx'; import React, { useState } from 'react'; import { useRecoilState } from 'recoil'; @@ -6,17 +5,19 @@ import { userAtom } from '@/store/atoms'; import { post } from '@api/purchaseOrder'; import { CloseButton, Input, Modal, PrimaryButton, Select } from '@components/common'; import AddModal from '@components/purchaseorders/PurchaseOrderAddModal'; -import { useUI } from '@components/ui/context'; -import { PurchaseItem, PurchaseOrder } from '@type/common'; +import { PurchaseItem, PurchaseOrder, Expense } from '@type/common'; -export default function PurchaseItemNumModal() { +export interface PurchaseItemNumModalProps { + setIsOpen: React.Dispatch>; + expenses: Expense[]; +} + +export default function PurchaseItemNumModal(props: PurchaseItemNumModalProps) { const [user] = useRecoilState(userAtom); // 購入物品数用の配列 const purchaseItemNumArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; - const { closeModal } = useUI(); - const [isOpen, setIsOpen] = useState(false); const onOpen = () => { @@ -26,10 +27,11 @@ export default function PurchaseItemNumModal() { setIsOpen(false); }; - const [formData, setFormData] = useState({ + const [formData, setFormData] = useState({ deadline: '', userID: user.id, financeCheck: false, + expenseID: 0, }); const [purchaseItemNum, setPurchaseItemNum] = useState({ value: 1, @@ -96,59 +98,60 @@ export default function PurchaseItemNumModal() { return ( <> -
-
- +
+
+ props.setIsOpen(false)} />
-
+
購入申請の作成
-
-
-
-
-
-
- 購入期限 -
-
-
- -
-
-
-
-
- 購入物品数 -
-
-
- -
-
+
+

+ 購入期限 +

+
+ +
+

+ 購入した局・団体 +

+
+ +
+

+ 購入物品数 +

+
+
-
-
+
{ submit(formData); @@ -164,7 +167,7 @@ export default function PurchaseItemNumModal() { props.setIsOpen(false)} onClose={onClose} setFormDataList={setFormDataList} formDataList={formDataList} diff --git a/view/next-project/src/components/purchaseorders/PurchaseOrderAddModal.tsx b/view/next-project/src/components/purchaseorders/PurchaseOrderAddModal.tsx index ce1854144..40279fc94 100644 --- a/view/next-project/src/components/purchaseorders/PurchaseOrderAddModal.tsx +++ b/view/next-project/src/components/purchaseorders/PurchaseOrderAddModal.tsx @@ -87,7 +87,7 @@ export default function AddModal(props: ModalProps) {
- +
@@ -95,7 +95,7 @@ export default function AddModal(props: ModalProps) {
- +
diff --git a/view/next-project/src/type/common.ts b/view/next-project/src/type/common.ts index 38994421d..878b55188 100644 --- a/view/next-project/src/type/common.ts +++ b/view/next-project/src/type/common.ts @@ -39,12 +39,24 @@ export interface PurchaseItem { createdAt?: string; updatedAt?: string; } + +// Expense(支出) +export interface Expense { + id?: number; + name: string; + totalPrice: number; + yearID: number; + createdAt?: string; + updatedAt?: string; +} + // // PurchaseOrder(購入申請) export interface PurchaseOrder { id?: number; deadline: string; userID: number; financeCheck: boolean; + expenseID: number; createdAt?: string; updatedAt?: string; } diff --git a/view/next-project/src/utils/api/purchaseOrder.ts b/view/next-project/src/utils/api/purchaseOrder.ts index d5a6b65fa..42d2a03de 100644 --- a/view/next-project/src/utils/api/purchaseOrder.ts +++ b/view/next-project/src/utils/api/purchaseOrder.ts @@ -4,8 +4,9 @@ export const post = async (url: string, data: PurchaseOrder) => { const deadline = data.deadline; const userId = data.userID; const financeCheck = data.financeCheck; + const expenseId = data.expenseID; const postUrl = - url + '?deadline=' + deadline + '&user_id=' + userId + '&finance_check=' + financeCheck; + url + '?deadline=' + deadline + '&user_id=' + userId + '&finance_check=' + financeCheck + '&expense_id=' + expenseId; const res = await fetch(postUrl, { method: 'POST', @@ -22,8 +23,9 @@ export const put = async (url: string, data: PurchaseOrder) => { const deadline = data.deadline; const userId = data.userID; const financeCheck = data.financeCheck; + const expenseId = data.expenseID; const putUrl = - url + '?deadline=' + deadline + '&user_id=' + userId + '&finance_check=' + financeCheck; + url + '?deadline=' + deadline + '&user_id=' + userId + '&finance_check=' + financeCheck + '&expense_id=' + expenseId; const res = await fetch(putUrl, { method: 'PUT', mode: 'cors', From a7f2ec4601da51dd32acdbc7754ff2282fcba2ae Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 00:56:55 +0900 Subject: [PATCH 07/37] =?UTF-8?q?[fix]=20expenseID=E3=81=AE=E5=87=A6?= =?UTF-8?q?=E7=90=86=E3=82=92=E8=B3=BC=E5=85=A5=E5=A0=B1=E5=91=8A=E3=81=AB?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/purchasereports/AddModal.tsx | 107 +++----------- .../purchasereports/DeleteModal.tsx | 82 ++++------- .../PurchaseOrderListModal.tsx | 16 +- .../PurchaseReportAddModal.tsx | 2 + .../PurchaseReportItemNumModal.tsx | 138 ++++++++++-------- .../src/pages/purchasereports/index.tsx | 25 +--- 6 files changed, 140 insertions(+), 230 deletions(-) diff --git a/view/next-project/src/components/purchasereports/AddModal.tsx b/view/next-project/src/components/purchasereports/AddModal.tsx index ee7c9b8c4..243c52764 100644 --- a/view/next-project/src/components/purchasereports/AddModal.tsx +++ b/view/next-project/src/components/purchasereports/AddModal.tsx @@ -8,97 +8,38 @@ import { CloseButton, Modal, PrimaryButton, PullDown } from '@components/common' import { useUI } from '@components/ui/context'; export default function PurchaseItemNumModal() { - const [user] = useRecoilState(userAtom); - const { setModalView, openModal, closeModal } = useUI(); - const [bureauID, setBureauID] = useState(user.bureauID); - - // 申請する局用のhandler - const bureauHandler = () => (e: React.ChangeEvent) => { - setBureauID(Number(e.target.value)); - }; - return ( - -
-
- -
+ +
+
-
+

購入報告の登録 +

+
+

申請した物品としていない物品を同時に購入した場合は

+

2回に分けて登録をお願いします

-
-
-
-
-
- 申請した物品としていない物品を同時に購入した場合は -
- 2回に分けて登録をお願いします。 -
-
-
-
-
- 申請する局 -
-
- - {BUREAUS.map((data) => ( - - ))} - -
-
-
-
-
-
-
-
-
+ { + setModalView('PURCHASE_ORDER_LIST_MODAL'); + openModal(); + }} + > + 購入申請から登録 + + { + setModalView('PURCHASE_REPORT_ITEM_NUM_MODAL'); + openModal(); + }} > -
-
- { - setModalView('PURCHASE_ORDER_LIST_MODAL'); - openModal(); - }} - > - 購入申請から登録 - -
-
- { - setModalView('PURCHASE_REPORT_ITEM_NUM_MODAL'); - openModal(); - }} - > - 単体で登録 - -
-
-
-
+ 申請していない物品を登録 +
-
); } diff --git a/view/next-project/src/components/purchasereports/DeleteModal.tsx b/view/next-project/src/components/purchasereports/DeleteModal.tsx index 9d48dea09..9614b9cf9 100644 --- a/view/next-project/src/components/purchasereports/DeleteModal.tsx +++ b/view/next-project/src/components/purchasereports/DeleteModal.tsx @@ -1,24 +1,9 @@ -import { - Box, - Center, - ChakraProvider, - Flex, - Modal, - ModalBody, - ModalContent, - ModalFooter, - ModalOverlay, - Spacer, - Text, - VStack, -} from '@chakra-ui/react'; import { useRouter } from 'next/router'; import React, { Dispatch, FC, SetStateAction } from 'react'; -import { RiCloseCircleLine } from 'react-icons/ri'; import { del } from '@api/api_methods'; -import theme from '@assets/theme'; -import Button from '@components/common/RegistButton'; + +import { CloseButton, Modal, OutlinePrimaryButton, PrimaryButton} from '../common'; interface ModalProps { setShowModal: Dispatch>; @@ -40,46 +25,29 @@ const PurchaseReportDeleteModal: FC = (props) => { }; return ( - - - - - - - - - - - - - - 購入報告の削除 - - - -
- 削除してもよいですか? -
-
-
-
-
-
- - - -
-
-
-
+ +
+
+ props.setShowModal(false)} /> +
+
+
協賛企業の削除
+
削除しますか?
+
+
+ 戻る + { + deletePurchaseReport(props.id); + closeModal(); + router.reload(); + }} + > + 削除 + +
+
+
); }; diff --git a/view/next-project/src/components/purchasereports/PurchaseOrderListModal.tsx b/view/next-project/src/components/purchasereports/PurchaseOrderListModal.tsx index 8b70fea54..39e714e4b 100644 --- a/view/next-project/src/components/purchasereports/PurchaseOrderListModal.tsx +++ b/view/next-project/src/components/purchasereports/PurchaseOrderListModal.tsx @@ -5,7 +5,7 @@ import { useEffect, useState } from 'react'; import { get } from '@api/api_methods'; import { CloseButton, Modal, OutlinePrimaryButton, PrimaryButton, Radio } from '@components/common'; import { useUI } from '@components/ui/context'; -import { PurchaseOrder, User, PurchaseItem } from 'src/type/common'; +import { PurchaseOrder, User, PurchaseItem, Expense } from '@type/common'; import PurchaseReportAddModal from './PurchaseReportAddModal'; @@ -25,6 +25,7 @@ export default function PurchaseItemNumModal() { }; const [purchaseOrderView, setPurchaseOrderView] = useState([]); + const [expenses, setExpenses] = useState([]); const [purchaseOrderId, setPurchaseOrderId] = useState(1); const [purchaseItemNum, setPurchaseItemNum] = useState(0); @@ -32,12 +33,18 @@ export default function PurchaseItemNumModal() { useEffect(() => { if (router.isReady) { const getPurchaseOrderViewUrl = process.env.CSR_API_URI + '/purchaseorders/details'; + const getExpensesUrl = process.env.CSR_API_URI + '/expenses'; const getPurchaseOrderView = async (url: string) => { const purchaseOrderViewRes: PurchaseOrderView[] = await get(url); setPurchaseOrderView(purchaseOrderViewRes); }; + const getExpenses = async (url: string) => { + const expensesRes: Expense[] = await get(url); + setExpenses(expensesRes); + }; getPurchaseOrderView(getPurchaseOrderViewUrl); + getExpenses(getExpensesUrl); } }, [router]); @@ -140,12 +147,7 @@ export default function PurchaseItemNumModal() { )} >
- {purchaseOrderItem.user.bureauID === 1 && '総務局'} - {purchaseOrderItem.user.bureauID === 2 && '渉外局'} - {purchaseOrderItem.user.bureauID === 3 && '財務局'} - {purchaseOrderItem.user.bureauID === 4 && '企画局'} - {purchaseOrderItem.user.bureauID === 5 && '政策局'} - {purchaseOrderItem.user.bureauID === 6 && '情報局'} + {expenses.find((expense) => expense.id === purchaseOrderItem.purchaseOrder.expenseID)?.name}
単価

個数

([]); + const [expenseID, setExpenseID] = useState(1); + + useEffect(() => { + const getExpensesUrl = process.env.CSR_API_URI + '/expenses'; + const getExpenses = async () => { + const res = await get(getExpensesUrl); + setExpenses(res); + }; + getExpenses(); + }, []); const { setModalView, openModal, closeModal } = useUI(); @@ -63,9 +75,10 @@ export default function PurchaseReportItemNumModal() { } const data: PurchaseOrder = { - deadline: String(year) + monthStr + dayStr, + deadline: String(year) + '-' + monthStr + '-' + dayStr, userID: user.id, financeCheck: false, + expenseID: expenseID, }; const addPurchaseOrderUrl = process.env.CSR_API_URI + '/purchaseorders'; const postRes = await post(addPurchaseOrderUrl, data); @@ -104,33 +117,21 @@ export default function PurchaseReportItemNumModal() { }; return ( - -
-
+ <> + +
-
-
- 購入報告単体で登録 -
-
-
-
-
-
-
-
- 報告する物品の個数を入力してください -
-
-
-
-
-
-
-
購入物品数
-
-
+

+ 購入報告単体で登録 +

+

+ 報告する物品の個数を入力してください +

+
+
+

購入物品数

+
{purchaseItemNumArray.map((data) => (
-
-
-
-
-
-
-
- { - setModalView('PURCHASE_REPORT_ADD_MODAL'); - openModal(); - }} - > - 戻る - -
-
- { - addPurchaseOrder(); - }} - > - 報告へ進む - - {isOpen && ( - - )} +
+

購入した局・団体

+
+ +
-
- +
+ { + setModalView('PURCHASE_REPORT_ADD_MODAL'); + openModal(); + }} + > + 戻る + + { + addPurchaseOrder(); + }} + > + 報告へ進む + +
+ + {isOpen && ( + + )} + ); } diff --git a/view/next-project/src/pages/purchasereports/index.tsx b/view/next-project/src/pages/purchasereports/index.tsx index d5683893f..30b0bac0a 100644 --- a/view/next-project/src/pages/purchasereports/index.tsx +++ b/view/next-project/src/pages/purchasereports/index.tsx @@ -11,7 +11,7 @@ import DetailModal from '@components/purchasereports/DetailModal'; import OpenAddModalButton from '@components/purchasereports/OpenAddModalButton'; import OpenDeleteModalButton from '@components/purchasereports/OpenDeleteModalButton'; import OpenEditModalButton from '@components/purchasereports/OpenEditModalButton'; -import { PurchaseItem, PurchaseOrder, PurchaseReport, User } from '@type/common'; +import { PurchaseItem, PurchaseOrder, PurchaseReport, User, Expense } from '@type/common'; export interface PurchaseReportView { purchaseReport: PurchaseReport; @@ -26,17 +26,21 @@ interface Props { purchaseReportView: PurchaseReportView[]; user: User; purchaseOrder: PurchaseOrder[]; + expenses: Expense[]; } export async function getServerSideProps() { const getPurchaseReportUrl = process.env.SSR_API_URI + '/purchasereports'; const getPurchaseReportViewUrl = process.env.SSR_API_URI + '/purchasereports/details'; + const getExpenseUrl = process.env.SSR_API_URI + '/expenses'; const purchaseReportRes = await get(getPurchaseReportUrl); const purchaseReportViewRes = await get(getPurchaseReportViewUrl); + const expenseRes = await get(getExpenseUrl); return { props: { purchaseReport: purchaseReportRes, purchaseReportView: purchaseReportViewRes, + expenses: expenseRes, }, }; } @@ -61,23 +65,6 @@ export default function PurchaseReports(props: Props) { } const purchaseReports: PurchaseReport[] = initPurchaseReportList; - // // 購入申請 - // const [purchaseOrders, setPurchaseOrders] = useState(() => { - // const initPurchaseOederList = []; - // for (let i = 0; i < props.purchaseReportView.length; i++) { - // initPurchaseOederList.push(props.purchaseReportView[i].purchaseOrder); - // } - // return initPurchaseOederList; - // }); - // // 購入申請者 - // const [orderUsers, setOrderUsers] = useState(() => { - // const initOederUserList = []; - // for (let i = 0; i < props.purchaseReportView.length; i++) { - // initOederUserList.push(props.purchaseReportView[i].orderUser); - // } - // return initOederUserList; - // }); - // 日付のフォーマットを変更 const formatDate = (date: string) => { const datetime = date.replace('T', ' '); @@ -208,7 +195,7 @@ export default function PurchaseReports(props: Props) { }} >
- + expense.id === purchaseReportViewItem.purchaseOrder.expenseID)?.name || ''} />
Date: Sat, 8 Apr 2023 00:57:46 +0900 Subject: [PATCH 08/37] =?UTF-8?q?[fix]=20=E4=B8=8D=E8=A6=81=E3=81=AAimport?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/purchasereports/AddModal.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/view/next-project/src/components/purchasereports/AddModal.tsx b/view/next-project/src/components/purchasereports/AddModal.tsx index 243c52764..4889bdbf3 100644 --- a/view/next-project/src/components/purchasereports/AddModal.tsx +++ b/view/next-project/src/components/purchasereports/AddModal.tsx @@ -1,10 +1,5 @@ -import clsx from 'clsx'; -import React, { useState } from 'react'; -import { useRecoilState } from 'recoil'; - -import { BUREAUS } from '@/constants/bureaus'; -import { userAtom } from '@/store/atoms'; -import { CloseButton, Modal, PrimaryButton, PullDown } from '@components/common'; +import React from 'react'; +import { CloseButton, Modal, PrimaryButton } from '@components/common'; import { useUI } from '@components/ui/context'; export default function PurchaseItemNumModal() { From 55129803fd92afdbe1949bdc4d10e7b828a8202d Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 01:01:44 +0900 Subject: [PATCH 09/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E5=A0=B1?= =?UTF-8?q?=E5=91=8A=E3=81=ABID=E3=81=AE=E5=88=97=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0/=E7=9C=81=E3=82=B3=E3=83=BC=E3=83=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/purchasereports/index.tsx | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/view/next-project/src/pages/purchasereports/index.tsx b/view/next-project/src/pages/purchasereports/index.tsx index 30b0bac0a..103dcc026 100644 --- a/view/next-project/src/pages/purchasereports/index.tsx +++ b/view/next-project/src/pages/purchasereports/index.tsx @@ -130,6 +130,9 @@ export default function PurchaseReports(props: Props) {
財務局長チェック
+
ID
+
報告した局
{ + onOpen( + purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem, ); }} @@ -206,9 +222,7 @@ export default function PurchaseReports(props: Props) { )} onClick={() => { onOpen( - purchaseReportViewItem.purchaseReport.id - ? purchaseReportViewItem.purchaseReport.id - : 0, + purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem, ); }} @@ -229,9 +243,7 @@ export default function PurchaseReports(props: Props) { )} onClick={() => { onOpen( - purchaseReportViewItem.purchaseReport.id - ? purchaseReportViewItem.purchaseReport.id - : 0, + purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem, ); }} @@ -248,9 +260,7 @@ export default function PurchaseReports(props: Props) { )} onClick={() => { onOpen( - purchaseReportViewItem.purchaseReport.id - ? purchaseReportViewItem.purchaseReport.id - : 0, + purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem, ); }} @@ -282,9 +292,7 @@ export default function PurchaseReports(props: Props) { )} onClick={() => { onOpen( - purchaseReportViewItem.purchaseReport.id - ? purchaseReportViewItem.purchaseReport.id - : 0, + purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem, ); }} @@ -304,9 +312,7 @@ export default function PurchaseReports(props: Props) { )} onClick={() => { onOpen( - purchaseReportViewItem.purchaseReport.id - ? purchaseReportViewItem.purchaseReport.id - : 0, + purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem, ); }} From cceb3c3c35ad9dffa0397fa7f5c92db114130ef3 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Fri, 7 Apr 2023 16:08:08 +0000 Subject: [PATCH 10/37] formatted by workflow --- .../common/BureauLabel/BureauLabel.tsx | 4 +- .../src/components/common/DeleteButton.tsx | 2 +- .../src/components/common/EditButton.tsx | 2 +- .../components/fund_information/AddModal.tsx | 23 ++---- .../components/fund_information/EditModal.tsx | 17 ++-- .../fund_information/OpenAddModalButton.tsx | 12 ++- .../fund_information/OpenEditModalButton.tsx | 3 +- .../purchaseorders/OpenAddModalButton.tsx | 8 +- .../purchaseorders/PurchaseItemNumModal.tsx | 20 ++--- .../components/purchasereports/AddModal.tsx | 11 ++- .../purchasereports/DeleteModal.tsx | 2 +- .../PurchaseOrderListModal.tsx | 6 +- .../PurchaseReportItemNumModal.tsx | 20 ++--- .../components/sponsors/SponsorEditModal.tsx | 1 - .../sponsorstyles/OpenAddModalButton.tsx | 7 +- .../sponsorstyles/SponsorStyleAddModal.tsx | 78 +++++++++---------- .../src/pages/purchaseorders/index.tsx | 9 ++- .../src/pages/purchasereports/index.tsx | 49 ++++-------- .../src/utils/api/purchaseOrder.ts | 20 ++++- 19 files changed, 136 insertions(+), 158 deletions(-) diff --git a/view/next-project/src/components/common/BureauLabel/BureauLabel.tsx b/view/next-project/src/components/common/BureauLabel/BureauLabel.tsx index 48e76d1f5..c090a7d48 100644 --- a/view/next-project/src/components/common/BureauLabel/BureauLabel.tsx +++ b/view/next-project/src/components/common/BureauLabel/BureauLabel.tsx @@ -9,8 +9,8 @@ const BureauLabel: React.FC = (props) => { const { bureauName } = props; const bureauEn = useMemo(() => { const bureau = BUREAUS_WITH_EN.find((bureau) => bureau.name === bureauName); - if(!bureau) return 'other'; - return bureau.name_en + if (!bureau) return 'other'; + return bureau.name_en; }, []); return ( diff --git a/view/next-project/src/components/common/DeleteButton.tsx b/view/next-project/src/components/common/DeleteButton.tsx index b43e0269e..cb6c598a0 100644 --- a/view/next-project/src/components/common/DeleteButton.tsx +++ b/view/next-project/src/components/common/DeleteButton.tsx @@ -20,7 +20,7 @@ const DeleteButton = (props: Props) => { return ( -
+
-

- 購入報告単体で登録 -

-

- 報告する物品の個数を入力してください -

+

購入報告単体で登録

+

報告する物品の個数を入力してください

-
+

購入物品数

@@ -141,7 +137,7 @@ export default function PurchaseReportItemNumModal() {
-
+

購入した局・団体

- {SCALE.map((scale) => ( - - ))} - -
-
-
カラー
-
モノクロ
-
-
- -
-
金額
-
- +

広告サイズ

+
+ +
+
+
カラー
+
モノクロ
+
+
+ +
+
金額
+
+ +
-
- expense.id === purchaseOrderViewItem.purchaseOrder.expenseID)?.name || ''} /> + + expense.id === purchaseOrderViewItem.purchaseOrder.expenseID, + )?.name || '' + } + />
{ - onOpen( - purchaseReportViewItem.purchaseReport.id || 0, - purchaseReportViewItem, - ); + onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} >
@@ -187,10 +184,7 @@ export default function PurchaseReports(props: Props) { index === purchaseReports.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', )} onClick={() => { - onOpen( - purchaseReportViewItem.purchaseReport.id || 0, - purchaseReportViewItem, - ); + onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} >
@@ -204,14 +198,18 @@ export default function PurchaseReports(props: Props) { index === purchaseReports.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', )} onClick={() => { - onOpen( - purchaseReportViewItem.purchaseReport.id || 0, - purchaseReportViewItem, - ); + onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} >
- expense.id === purchaseReportViewItem.purchaseOrder.expenseID)?.name || ''} /> + + expense.id === purchaseReportViewItem.purchaseOrder.expenseID, + )?.name || '' + } + />
{ - onOpen( - purchaseReportViewItem.purchaseReport.id || 0, - purchaseReportViewItem, - ); + onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} >
@@ -242,10 +237,7 @@ export default function PurchaseReports(props: Props) { index === purchaseReports.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', )} onClick={() => { - onOpen( - purchaseReportViewItem.purchaseReport.id || 0, - purchaseReportViewItem, - ); + onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} >
@@ -259,10 +251,7 @@ export default function PurchaseReports(props: Props) { index === purchaseReports.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', )} onClick={() => { - onOpen( - purchaseReportViewItem.purchaseReport.id || 0, - purchaseReportViewItem, - ); + onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} >
{ - onOpen( - purchaseReportViewItem.purchaseReport.id || 0, - purchaseReportViewItem, - ); + onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} >
@@ -311,10 +297,7 @@ export default function PurchaseReports(props: Props) { index === purchaseReports.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', )} onClick={() => { - onOpen( - purchaseReportViewItem.purchaseReport.id || 0, - purchaseReportViewItem, - ); + onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} >
diff --git a/view/next-project/src/utils/api/purchaseOrder.ts b/view/next-project/src/utils/api/purchaseOrder.ts index 42d2a03de..2d7f43360 100644 --- a/view/next-project/src/utils/api/purchaseOrder.ts +++ b/view/next-project/src/utils/api/purchaseOrder.ts @@ -6,7 +6,15 @@ export const post = async (url: string, data: PurchaseOrder) => { const financeCheck = data.financeCheck; const expenseId = data.expenseID; const postUrl = - url + '?deadline=' + deadline + '&user_id=' + userId + '&finance_check=' + financeCheck + '&expense_id=' + expenseId; + url + + '?deadline=' + + deadline + + '&user_id=' + + userId + + '&finance_check=' + + financeCheck + + '&expense_id=' + + expenseId; const res = await fetch(postUrl, { method: 'POST', @@ -25,7 +33,15 @@ export const put = async (url: string, data: PurchaseOrder) => { const financeCheck = data.financeCheck; const expenseId = data.expenseID; const putUrl = - url + '?deadline=' + deadline + '&user_id=' + userId + '&finance_check=' + financeCheck + '&expense_id=' + expenseId; + url + + '?deadline=' + + deadline + + '&user_id=' + + userId + + '&finance_check=' + + financeCheck + + '&expense_id=' + + expenseId; const res = await fetch(putUrl, { method: 'PUT', mode: 'cors', From 7134e597bebfae073834d2d83942497d349ac035 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 01:27:19 +0900 Subject: [PATCH 11/37] =?UTF-8?q?[fix]=20=E7=94=B3=E8=AB=8B=E3=81=9B?= =?UTF-8?q?=E3=81=9A=E3=81=AB=E5=A0=B1=E5=91=8A=E3=81=97=E3=80=81=E3=82=AD?= =?UTF-8?q?=E3=83=A3=E3=83=B3=E3=82=BB=E3=83=AB=E3=81=97=E3=81=9F=E5=A0=B4?= =?UTF-8?q?=E5=90=88=E3=81=AB=E3=81=9D=E3=81=AE=E7=94=B3=E8=AB=8B=E3=82=92?= =?UTF-8?q?=E5=89=8A=E9=99=A4=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/purchasereports/PurchaseReportAddModal.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx b/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx index 971922a86..e60dddb7c 100644 --- a/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx +++ b/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx @@ -4,7 +4,7 @@ import { RiArrowDropRightLine } from 'react-icons/ri'; import { useRecoilState } from 'recoil'; import { userAtom } from '@/store/atoms'; -import { get } from '@api/api_methods'; +import { get, del } from '@api/api_methods'; import { put } from '@api/purchaseItem'; import { post } from '@api/purchaseReport'; import { @@ -180,6 +180,11 @@ export default function PurchaseReportAddModal(props: ModalProps) { }); }; + const deletePurchaseOrder = async () => { + const deletePurchaseOrderUrl = process.env.CSR_API_URI + '/purchaseorders/' + props.purchaseOrderId; + await del(deletePurchaseOrderUrl); + }; + // 購入物品の情報 const content = (data: PurchaseItem) => ( <> @@ -242,6 +247,7 @@ export default function PurchaseReportAddModal(props: ModalProps) {
{ + deletePurchaseOrder(); props.setIsOpen(false); }} /> From f3d82bcba9c71567e3bea26202ec6cbc727865ed Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Fri, 7 Apr 2023 16:28:50 +0000 Subject: [PATCH 12/37] formatted by workflow --- view/next-project/src/components/fund_information/AddModal.tsx | 1 - .../next-project/src/components/fund_information/EditModal.tsx | 1 - .../src/components/purchasereports/PurchaseReportAddModal.tsx | 3 ++- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/view/next-project/src/components/fund_information/AddModal.tsx b/view/next-project/src/components/fund_information/AddModal.tsx index cb823b7d4..8d94b1a66 100644 --- a/view/next-project/src/components/fund_information/AddModal.tsx +++ b/view/next-project/src/components/fund_information/AddModal.tsx @@ -2,7 +2,6 @@ import { useRouter } from 'next/router'; import React, { Dispatch, FC, SetStateAction, useEffect, useState } from 'react'; import { useRecoilState } from 'recoil'; - import { userAtom } from '@/store/atoms'; import { post } from '@api/fundInformations'; import { Department, FundInformation, Teacher, User } from '@type/common'; diff --git a/view/next-project/src/components/fund_information/EditModal.tsx b/view/next-project/src/components/fund_information/EditModal.tsx index 4cc9663a1..40ef5b50d 100644 --- a/view/next-project/src/components/fund_information/EditModal.tsx +++ b/view/next-project/src/components/fund_information/EditModal.tsx @@ -1,7 +1,6 @@ import { useRouter } from 'next/router'; import { Dispatch, SetStateAction, useEffect, useState } from 'react'; - import { put } from '@api/fundInformations'; import { FundInformation, Teacher, User, Department } from '@type/common'; diff --git a/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx b/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx index e60dddb7c..dd143e829 100644 --- a/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx +++ b/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx @@ -181,7 +181,8 @@ export default function PurchaseReportAddModal(props: ModalProps) { }; const deletePurchaseOrder = async () => { - const deletePurchaseOrderUrl = process.env.CSR_API_URI + '/purchaseorders/' + props.purchaseOrderId; + const deletePurchaseOrderUrl = + process.env.CSR_API_URI + '/purchaseorders/' + props.purchaseOrderId; await del(deletePurchaseOrderUrl); }; From 77ea0522a8b60f0de253b8442ee2777ffd6a8d59 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 01:39:21 +0900 Subject: [PATCH 13/37] =?UTF-8?q?[fix]=20=E4=BD=BF=E3=82=8F=E3=81=AA?= =?UTF-8?q?=E3=81=84=E7=AE=87=E6=89=80=E3=82=92=E3=82=B3=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=A2=E3=82=A6=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchasereports/PurchaseReportAddModal.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx b/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx index e60dddb7c..2164ba2eb 100644 --- a/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx +++ b/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx @@ -322,12 +322,15 @@ export default function PurchaseReportAddModal(props: ModalProps) { }} >
- {activeStep === steps.length ? '登録して確認' : '登録して次へ'} + {/* {activeStep === steps.length ? '登録して確認' : '登録して次へ'} */} + {activeStep === steps.length ? '確認へ' : '次へ'}
- {!props.isOnlyReported && ( + {/* 登録物品(purchaseItem)ページの財務局長チェックがtrueになる */} + {/* 登録物品(purchaseItem)ページは現在使われていないのでコメントアウト */} + {/* {!props.isOnlyReported && (
- )} + )} */}
)} From 2926cc5532ece64926a3f8a9a12f04f71462b46e Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Fri, 7 Apr 2023 16:40:49 +0000 Subject: [PATCH 14/37] formatted by workflow --- .../src/components/purchasereports/PurchaseReportAddModal.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx b/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx index 346677192..636d5233f 100644 --- a/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx +++ b/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx @@ -15,7 +15,6 @@ import { PrimaryButton, Stepper, Textarea, - UnderlinePrimaryButton, } from '@components/common'; import PurchaseReportConfirmModal from '@components/purchasereports/PurchaseReportConfirmModal'; import { PurchaseItem, PurchaseOrder, PurchaseReport, User } from '@type/common'; From 8595e48280dc41344606042c6e154d2c27c19909 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 18:05:46 +0900 Subject: [PATCH 15/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E5=A0=B1?= =?UTF-8?q?=E5=91=8A=E8=A9=B3=E7=B4=B0=E3=83=A2=E3=83=BC=E3=83=80=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E5=B9=85=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next-project/src/components/purchasereports/DetailModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/next-project/src/components/purchasereports/DetailModal.tsx b/view/next-project/src/components/purchasereports/DetailModal.tsx index bf6b57460..6534d3dd7 100644 --- a/view/next-project/src/components/purchasereports/DetailModal.tsx +++ b/view/next-project/src/components/purchasereports/DetailModal.tsx @@ -49,7 +49,7 @@ const DetailModal: FC = (props) => { }; return ( - +
From 830ce0e3e63b0a33de747a91f6dbd5d1fc7fda32 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 18:26:19 +0900 Subject: [PATCH 16/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E5=A0=B1?= =?UTF-8?q?=E5=91=8A=E3=81=AEdetailModal=E3=81=AE=E6=94=AF=E5=87=BA?= =?UTF-8?q?=E3=82=82=E3=81=A8=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchasereports/DetailModal.tsx | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/view/next-project/src/components/purchasereports/DetailModal.tsx b/view/next-project/src/components/purchasereports/DetailModal.tsx index 6534d3dd7..911924c42 100644 --- a/view/next-project/src/components/purchasereports/DetailModal.tsx +++ b/view/next-project/src/components/purchasereports/DetailModal.tsx @@ -1,12 +1,12 @@ import { useRouter } from 'next/router'; -import React, { FC } from 'react'; +import React, { FC, useMemo } from 'react'; import { RiCloseCircleLine, RiExternalLinkLine, RiFileCopyLine } from 'react-icons/ri'; import { useRecoilState } from 'recoil'; import { userAtom } from '@/store/atoms'; import { del } from '@api/api_methods'; import { Checkbox, Modal, RedButton, Tooltip } from '@components/common'; -import { PurchaseItem, PurchaseReport, PurchaseReportView } from '@type/common'; +import { PurchaseItem, PurchaseReport, PurchaseReportView, Expense } from '@type/common'; interface ModalProps { isOpen: boolean; @@ -14,6 +14,7 @@ interface ModalProps { children?: React.ReactNode; id: number | string; purchaseReportViewItem: PurchaseReportView; + expenses: Expense[]; isDelete: boolean; } @@ -24,6 +25,13 @@ const DetailModal: FC = (props) => { props.setIsOpen(false); }; + const expenseName = useMemo(() => { + const expense = props.expenses.find( + (expense) => expense.id === props.purchaseReportViewItem.purchaseOrder.expenseID, + ); + return expense ? expense.name : ''; + }, [props.expenses, props.purchaseReportViewItem]); + const router = useRouter(); const formatDate = (date: string) => { @@ -69,26 +77,9 @@ const DetailModal: FC = (props) => { props.purchaseReportViewItem.purchaseItems, )}
-

報告した局

+

購入した局

- {props.purchaseReportViewItem && - props.purchaseReportViewItem.reportUser.bureauID === 1 && - '総務局'} - {props.purchaseReportViewItem && - props.purchaseReportViewItem.reportUser.bureauID === 2 && - '渉外局'} - {props.purchaseReportViewItem && - props.purchaseReportViewItem.reportUser.bureauID === 3 && - '財務局'} - {props.purchaseReportViewItem && - props.purchaseReportViewItem.reportUser.bureauID === 4 && - '企画局'} - {props.purchaseReportViewItem && - props.purchaseReportViewItem.reportUser.bureauID === 5 && - '政策局'} - {props.purchaseReportViewItem && - props.purchaseReportViewItem.reportUser.bureauID === 6 && - '情報局'} + {expenseName}

報告日

From 43c91891a762cb36665cc136d6c65962c8afebb8 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 18:26:43 +0900 Subject: [PATCH 17/37] =?UTF-8?q?[fix]=20=E5=A0=B1=E5=91=8A=E3=81=97?= =?UTF-8?q?=E3=81=9F=E5=B1=80=E3=81=A7=E3=81=AF=E3=81=AA=E3=81=8F=E8=B3=BC?= =?UTF-8?q?=E5=85=A5=E3=81=97=E3=81=9F=E5=B1=80=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/next-project/src/pages/purchasereports/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/view/next-project/src/pages/purchasereports/index.tsx b/view/next-project/src/pages/purchasereports/index.tsx index 5d3bb1e14..2554ed9b7 100644 --- a/view/next-project/src/pages/purchasereports/index.tsx +++ b/view/next-project/src/pages/purchasereports/index.tsx @@ -134,7 +134,7 @@ export default function PurchaseReports(props: Props) {
ID
-
報告した局
+
購入した局
報告日
@@ -355,6 +355,7 @@ export default function PurchaseReports(props: Props) { id={purchaseReportID} isOpen={isOpen} setIsOpen={setIsOpen} + expenses={props.expenses} purchaseReportViewItem={purchaseReportViewItem} isDelete={false} /> From 15ad5f0cb47da81767e540772a6c8219bfb92990 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 18:31:54 +0900 Subject: [PATCH 18/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E7=94=B3?= =?UTF-8?q?=E8=AB=8B=E3=81=AE=E8=A9=B3=E7=B4=B0=E3=83=A2=E3=83=BC=E3=83=80?= =?UTF-8?q?=E3=83=AB=E3=81=AE=E8=B3=BC=E5=85=A5=E3=81=97=E3=81=9F=E3=81=84?= =?UTF-8?q?=E5=B1=80=E3=82=92expenseID=E3=81=8B=E3=82=89=E5=8F=96=E5=BE=97?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/purchaseorders/DetailModal.tsx | 31 +++++++------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/view/next-project/src/components/purchaseorders/DetailModal.tsx b/view/next-project/src/components/purchaseorders/DetailModal.tsx index faf76fb07..01846ea78 100644 --- a/view/next-project/src/components/purchaseorders/DetailModal.tsx +++ b/view/next-project/src/components/purchaseorders/DetailModal.tsx @@ -1,13 +1,13 @@ import clsx from 'clsx'; import { useRouter } from 'next/router'; -import React, { FC } from 'react'; +import React, { FC, useMemo } from 'react'; import { RiCloseCircleLine, RiExternalLinkLine, RiFileCopyLine } from 'react-icons/ri'; import { useRecoilState } from 'recoil'; import { userAtom } from '@/store/atoms'; import { del } from '@api/api_methods'; import { Checkbox, Modal, RedButton, Tooltip } from '@components/common'; -import { PurchaseItem, PurchaseOrderView } from '@type/common'; +import { PurchaseItem, PurchaseOrderView, Expense } from '@type/common'; interface ModalProps { isOpen: boolean; @@ -15,6 +15,7 @@ interface ModalProps { children?: React.ReactNode; id: number | string; purchaseOrderViewItem: PurchaseOrderView; + expenses: Expense[]; isDelete: boolean; } @@ -38,6 +39,13 @@ const DetailModal: FC = (props) => { await del(deletePurchaseOrderUrl); }; + const expenseName = useMemo(() => { + const expense = props.expenses.find( + (expense) => expense.id === props.purchaseOrderViewItem.purchaseOrder.expenseID, + ); + return expense ? expense.name : ''; + }, [props.expenses, props.purchaseOrderViewItem]); + return (
@@ -80,24 +88,7 @@ const DetailModal: FC = (props) => { 'col-span-3 grid w-full border border-x-white-0 border-b-primary-1 border-t-white-0 pl-1', )} > - {props.purchaseOrderViewItem && - props.purchaseOrderViewItem.user.bureauID === 1 && - '総務局'} - {props.purchaseOrderViewItem && - props.purchaseOrderViewItem.user.bureauID === 2 && - '渉外局'} - {props.purchaseOrderViewItem && - props.purchaseOrderViewItem.user.bureauID === 3 && - '財務局'} - {props.purchaseOrderViewItem && - props.purchaseOrderViewItem.user.bureauID === 4 && - '企画局'} - {props.purchaseOrderViewItem && - props.purchaseOrderViewItem.user.bureauID === 5 && - '政策局'} - {props.purchaseOrderViewItem && - props.purchaseOrderViewItem.user.bureauID === 6 && - '情報局'} + {expenseName}
From d1b861f4197968ce7a542193ee2ed3726d9b64f4 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 18:32:14 +0900 Subject: [PATCH 19/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E3=81=97?= =?UTF-8?q?=E3=81=9F=E5=B1=80=E3=81=A7=E3=81=AF=E3=81=AA=E3=81=8F=E8=B3=BC?= =?UTF-8?q?=E5=85=A5=E3=81=97=E3=81=9F=E3=81=84=E5=B1=80=E3=81=AB=E3=81=99?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/purchaseorders/PurchaseItemNumModal.tsx | 2 +- view/next-project/src/pages/purchaseorders/index.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/view/next-project/src/components/purchaseorders/PurchaseItemNumModal.tsx b/view/next-project/src/components/purchaseorders/PurchaseItemNumModal.tsx index ea6f03f8c..3f835c2ea 100644 --- a/view/next-project/src/components/purchaseorders/PurchaseItemNumModal.tsx +++ b/view/next-project/src/components/purchaseorders/PurchaseItemNumModal.tsx @@ -114,7 +114,7 @@ export default function PurchaseItemNumModal(props: PurchaseItemNumModalProps) { className='w-full' /> -

購入した局・団体

+

購入したい局・団体

-
申請した局
+
購入したい局
申請日
@@ -326,6 +326,7 @@ export default function PurchaseOrders(props: Props) { isOpen={isOpen} setIsOpen={setIsOpen} purchaseOrderViewItem={purchaseOrderViewItem} + expenses={props.expenses} isDelete={false} /> )} From 52fda0ddedde8fc88c302ef2e6760823c80154f3 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 09:33:26 +0000 Subject: [PATCH 20/37] formatted by workflow --- .../src/components/purchasereports/DetailModal.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/view/next-project/src/components/purchasereports/DetailModal.tsx b/view/next-project/src/components/purchasereports/DetailModal.tsx index 911924c42..aec86128c 100644 --- a/view/next-project/src/components/purchasereports/DetailModal.tsx +++ b/view/next-project/src/components/purchasereports/DetailModal.tsx @@ -78,9 +78,7 @@ const DetailModal: FC = (props) => { )}

購入した局

-
- {expenseName} -
+
{expenseName}

報告日

{props.purchaseReportViewItem && From 737a092affec8e95e220cedcbda4f9d7963737f9 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 18:51:06 +0900 Subject: [PATCH 21/37] =?UTF-8?q?[fix]=20=E8=A9=B3=E7=B4=B0=E3=81=AE?= =?UTF-8?q?=E7=B7=A8=E9=9B=86=E3=81=B8=E3=81=A8=E6=98=8E=E7=A4=BA=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=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/components/purchaseorders/EditModal.tsx | 2 +- view/next-project/src/components/purchasereports/EditModal.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/view/next-project/src/components/purchaseorders/EditModal.tsx b/view/next-project/src/components/purchaseorders/EditModal.tsx index 474af3268..81c0c70a9 100644 --- a/view/next-project/src/components/purchaseorders/EditModal.tsx +++ b/view/next-project/src/components/purchaseorders/EditModal.tsx @@ -194,7 +194,7 @@ export default function EditModal(props: ModalProps) { >
{activeStep === formDataList.length - ? '登録して編集を完了' + ? '詳細の編集へ' : '登録して次へ'}
diff --git a/view/next-project/src/components/purchasereports/EditModal.tsx b/view/next-project/src/components/purchasereports/EditModal.tsx index fd9554223..90ada01df 100644 --- a/view/next-project/src/components/purchasereports/EditModal.tsx +++ b/view/next-project/src/components/purchasereports/EditModal.tsx @@ -310,7 +310,7 @@ export default function EditModal(props: ModalProps) { >
{activeStep === formDataList.length - ? '登録して編集を完了' + ? '詳細の編集へ' : '登録して次へ'}
From 50a5892910bb9560ea99a63ed6f7c54e6bed8bf0 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 09:52:16 +0000 Subject: [PATCH 22/37] formatted by workflow --- view/next-project/src/components/purchaseorders/EditModal.tsx | 4 +--- .../next-project/src/components/purchasereports/EditModal.tsx | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/view/next-project/src/components/purchaseorders/EditModal.tsx b/view/next-project/src/components/purchaseorders/EditModal.tsx index 81c0c70a9..741e99c64 100644 --- a/view/next-project/src/components/purchaseorders/EditModal.tsx +++ b/view/next-project/src/components/purchaseorders/EditModal.tsx @@ -193,9 +193,7 @@ export default function EditModal(props: ModalProps) { }} >
- {activeStep === formDataList.length - ? '詳細の編集へ' - : '登録して次へ'} + {activeStep === formDataList.length ? '詳細の編集へ' : '登録して次へ'}
diff --git a/view/next-project/src/components/purchasereports/EditModal.tsx b/view/next-project/src/components/purchasereports/EditModal.tsx index 90ada01df..da73ec333 100644 --- a/view/next-project/src/components/purchasereports/EditModal.tsx +++ b/view/next-project/src/components/purchasereports/EditModal.tsx @@ -309,9 +309,7 @@ export default function EditModal(props: ModalProps) { }} >
- {activeStep === formDataList.length - ? '詳細の編集へ' - : '登録して次へ'} + {activeStep === formDataList.length ? '詳細の編集へ' : '登録して次へ'}
From 4a4c22651b926f52d0e87a50fde74c1035db6223 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 19:21:33 +0900 Subject: [PATCH 23/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E7=94=B3?= =?UTF-8?q?=E8=AB=8B=E3=81=ABdeleteModal=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/purchaseorders/DeleteModal.tsx | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 view/next-project/src/components/purchaseorders/DeleteModal.tsx diff --git a/view/next-project/src/components/purchaseorders/DeleteModal.tsx b/view/next-project/src/components/purchaseorders/DeleteModal.tsx new file mode 100644 index 000000000..419d3a04c --- /dev/null +++ b/view/next-project/src/components/purchaseorders/DeleteModal.tsx @@ -0,0 +1,52 @@ +import { useRouter } from 'next/router'; +import React, { Dispatch, FC, SetStateAction } from 'react'; + +import { del } from '@api/api_methods'; + +import { CloseButton, Modal, OutlinePrimaryButton, PrimaryButton } from '../common'; + +interface ModalProps { + setShowModal: Dispatch>; + id: number | string; +} + +const DeleteModal: FC = (props) => { + const closeModal = () => { + props.setShowModal(false); + }; + + const router = useRouter(); + + const deletePurchaseOrder = async (id: number | string) => { + const deletePurchaseReportUrl = process.env.CSR_API_URI + '/purchaseorders/' + id; + await del(deletePurchaseReportUrl); + }; + + return ( + +
+
+ props.setShowModal(false)} /> +
+
+
購入申請の削除
+
削除しますか?
+
+
+ 戻る + { + deletePurchaseOrder(props.id); + closeModal(); + router.reload(); + }} + > + 削除 + +
+
+
+ ); +}; + +export default DeleteModal; From 689754ef1d925d2219aff70d027363b98382643f Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 19:21:55 +0900 Subject: [PATCH 24/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E7=94=B3?= =?UTF-8?q?=E8=AB=8B=E3=81=A7deleteModal=E3=82=92=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchaseorders/OpenDeleteModalButton.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/view/next-project/src/components/purchaseorders/OpenDeleteModalButton.tsx b/view/next-project/src/components/purchaseorders/OpenDeleteModalButton.tsx index 966476df1..efad02857 100644 --- a/view/next-project/src/components/purchaseorders/OpenDeleteModalButton.tsx +++ b/view/next-project/src/components/purchaseorders/OpenDeleteModalButton.tsx @@ -2,13 +2,10 @@ import React from 'react'; import { useState } from 'react'; import { DeleteButton } from '@components/common'; -import DetailModal from '@components/purchaseorders/DetailModal'; -import { PurchaseOrderView } from '@type/common'; +import DeleteModal from './DeleteModal'; interface Props { - children?: React.ReactNode; id: number; - purchaseOrderViewItem: PurchaseOrderView; isDisabled: boolean; } @@ -21,12 +18,9 @@ const OpenDeleteModalButton: React.FC = (props) => { <> {isOpen && ( - )} From 23e6494879a4d520270b0a44eea0f303222c13ec Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 19:22:13 +0900 Subject: [PATCH 25/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E7=94=B3?= =?UTF-8?q?=E8=AB=8B=E3=81=A7expenseID=E3=81=AE=E5=88=9D=E6=9C=9F=E5=80=A4?= =?UTF-8?q?=E3=82=92=E5=85=A5=E5=8A=9B=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/purchaseorders/PurchaseItemNumModal.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/view/next-project/src/components/purchaseorders/PurchaseItemNumModal.tsx b/view/next-project/src/components/purchaseorders/PurchaseItemNumModal.tsx index 3f835c2ea..46cec8951 100644 --- a/view/next-project/src/components/purchaseorders/PurchaseItemNumModal.tsx +++ b/view/next-project/src/components/purchaseorders/PurchaseItemNumModal.tsx @@ -31,7 +31,7 @@ export default function PurchaseItemNumModal(props: PurchaseItemNumModalProps) { deadline: '', userID: user.id, financeCheck: false, - expenseID: 0, + expenseID: 1, }); const [purchaseItemNum, setPurchaseItemNum] = useState({ value: 1, @@ -154,7 +154,6 @@ export default function PurchaseItemNumModal(props: PurchaseItemNumModalProps) {
- {isOpen && ( Date: Sat, 8 Apr 2023 19:22:26 +0900 Subject: [PATCH 26/37] [fix] fix typo --- .../next-project/src/components/purchasereports/DeleteModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/next-project/src/components/purchasereports/DeleteModal.tsx b/view/next-project/src/components/purchasereports/DeleteModal.tsx index 0cc916cc2..86e1a83f9 100644 --- a/view/next-project/src/components/purchasereports/DeleteModal.tsx +++ b/view/next-project/src/components/purchasereports/DeleteModal.tsx @@ -31,7 +31,7 @@ const PurchaseReportDeleteModal: FC = (props) => { props.setShowModal(false)} /> -
協賛企業の削除
+
購入報告の削除
削除しますか?
From 14ca18f7f5c50e5e5ba0f99db9b3293af24cde00 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 19:22:41 +0900 Subject: [PATCH 27/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E7=94=B3?= =?UTF-8?q?=E8=AB=8B=E3=81=A7=E7=99=BB=E9=8C=B2=E3=81=97=E3=81=AA=E3=81=8B?= =?UTF-8?q?=E3=81=A3=E3=81=9F=E9=9A=9B=E3=81=AB=E3=80=81=E7=94=B3=E8=AB=8B?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/purchaseorders/PurchaseOrderAddModal.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/view/next-project/src/components/purchaseorders/PurchaseOrderAddModal.tsx b/view/next-project/src/components/purchaseorders/PurchaseOrderAddModal.tsx index 40279fc94..07710f2ee 100644 --- a/view/next-project/src/components/purchaseorders/PurchaseOrderAddModal.tsx +++ b/view/next-project/src/components/purchaseorders/PurchaseOrderAddModal.tsx @@ -5,6 +5,7 @@ import { RiExternalLinkLine, RiFileCopyLine } from 'react-icons/ri'; import { RiArrowDropRightLine } from 'react-icons/ri'; import { post } from '@api/purchaseItem'; +import { del } from '@api/api_methods'; import { PrimaryButton, OutlinePrimaryButton, @@ -45,6 +46,12 @@ export default function AddModal(props: ModalProps) { const [isDone, setIsDone] = useState(false); const router = useRouter(); + const deletePurchaseOrder = async () => { + const deletePurchaseOrderUrl = + process.env.CSR_API_URI + '/purchaseorders/' + props.formDataList[0].purchaseOrderID; + await del(deletePurchaseOrderUrl); + }; + const handler = (stepNumber: number, input: string) => (e: React.ChangeEvent | React.ChangeEvent) => { @@ -229,6 +236,7 @@ export default function AddModal(props: ModalProps) {
{ + deletePurchaseOrder(); props.onClose(); props.numModalOnClose(); }} From eb8fee3370001fb8e519165512920956bdb44df8 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 10:23:51 +0000 Subject: [PATCH 28/37] formatted by workflow --- .../components/purchaseorders/OpenDeleteModalButton.tsx | 8 ++------ .../components/purchaseorders/PurchaseOrderAddModal.tsx | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/view/next-project/src/components/purchaseorders/OpenDeleteModalButton.tsx b/view/next-project/src/components/purchaseorders/OpenDeleteModalButton.tsx index efad02857..f06ec57a0 100644 --- a/view/next-project/src/components/purchaseorders/OpenDeleteModalButton.tsx +++ b/view/next-project/src/components/purchaseorders/OpenDeleteModalButton.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { useState } from 'react'; import { DeleteButton } from '@components/common'; + import DeleteModal from './DeleteModal'; interface Props { @@ -17,12 +18,7 @@ const OpenDeleteModalButton: React.FC = (props) => { return ( <> - {isOpen && ( - - )} + {isOpen && } ); }; diff --git a/view/next-project/src/components/purchaseorders/PurchaseOrderAddModal.tsx b/view/next-project/src/components/purchaseorders/PurchaseOrderAddModal.tsx index 07710f2ee..1578924d6 100644 --- a/view/next-project/src/components/purchaseorders/PurchaseOrderAddModal.tsx +++ b/view/next-project/src/components/purchaseorders/PurchaseOrderAddModal.tsx @@ -4,8 +4,8 @@ import React, { useState } from 'react'; import { RiExternalLinkLine, RiFileCopyLine } from 'react-icons/ri'; import { RiArrowDropRightLine } from 'react-icons/ri'; -import { post } from '@api/purchaseItem'; import { del } from '@api/api_methods'; +import { post } from '@api/purchaseItem'; import { PrimaryButton, OutlinePrimaryButton, From 8a364e9ecdae6ba342dc27a29e61502dfa445f3d Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 21:24:59 +0900 Subject: [PATCH 29/37] =?UTF-8?q?[fix]=E8=B3=BC=E5=85=A5=E7=94=B3=E8=AB=8B?= =?UTF-8?q?=E3=81=8B=E3=82=89=E5=A0=B1=E5=91=8A=E3=81=99=E3=82=8B=E3=81=A8?= =?UTF-8?q?=E3=81=8D=E3=81=AB=E7=89=A9=E5=93=81=E3=82=92=E5=85=A8=E3=81=A6?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PurchaseOrderListModal.tsx | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/view/next-project/src/components/purchasereports/PurchaseOrderListModal.tsx b/view/next-project/src/components/purchasereports/PurchaseOrderListModal.tsx index 5dc2e4877..7144c5f88 100644 --- a/view/next-project/src/components/purchasereports/PurchaseOrderListModal.tsx +++ b/view/next-project/src/components/purchasereports/PurchaseOrderListModal.tsx @@ -174,18 +174,15 @@ export default function PurchaseItemNumModal() { )} >
- {purchaseOrderItem.purchaseItem?.length === 1 ? ( - <> - {purchaseOrderItem.purchaseItem && - purchaseOrderItem.purchaseItem[0].item} - - ) : ( - <> - {purchaseOrderItem.purchaseItem && - purchaseOrderItem.purchaseItem[0].item} - , ... - - )} + { + purchaseOrderItem.purchaseItem && + purchaseOrderItem.purchaseItem.map((purchaseItem) => ( +
+ {purchaseItem.item} +
+
+ )) + }
Date: Sat, 8 Apr 2023 21:25:15 +0900 Subject: [PATCH 30/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E3=81=97?= =?UTF-8?q?=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F=E5=A0=B4=E5=90=88=E3=82=92?= =?UTF-8?q?=E8=80=83=E6=85=AE=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchasereports/PurchaseReportAddModal.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx b/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx index 636d5233f..6118c4d02 100644 --- a/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx +++ b/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx @@ -15,6 +15,7 @@ import { PrimaryButton, Stepper, Textarea, + UnderlinePrimaryButton } from '@components/common'; import PurchaseReportConfirmModal from '@components/purchasereports/PurchaseReportConfirmModal'; import { PurchaseItem, PurchaseOrder, PurchaseReport, User } from '@type/common'; @@ -322,15 +323,12 @@ export default function PurchaseReportAddModal(props: ModalProps) { }} >
- {/* {activeStep === steps.length ? '登録して確認' : '登録して次へ'} */} - {activeStep === steps.length ? '確認へ' : '次へ'} + {activeStep === steps.length ? '購入物品として登録して確認へ' : '購入物品として登録して次へ'}
- {/* 登録物品(purchaseItem)ページの財務局長チェックがtrueになる */} - {/* 登録物品(purchaseItem)ページは現在使われていないのでコメントアウト */} - {/* {!props.isOnlyReported && ( + {!props.isOnlyReported && (
- {activeStep === steps.length ? '登録せずに確認' : '登録せずに次へ'} + {activeStep === steps.length ? '購入しなかった物品として登録して確認へ' : '購入しなかった物品として登録して次へ'}
- )} */} + )} )} From aef8e4ee043923dbbf533b2765550461d6b2aaaa Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 23:13:06 +0900 Subject: [PATCH 31/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E7=89=A9?= =?UTF-8?q?=E5=93=81=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=97=E3=81=A6=E5=90=88?= =?UTF-8?q?=E8=A8=88=E9=87=91=E9=A1=8D=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/purchasereports/index.tsx | 73 +++++++++++++------ 1 file changed, 50 insertions(+), 23 deletions(-) diff --git a/view/next-project/src/pages/purchasereports/index.tsx b/view/next-project/src/pages/purchasereports/index.tsx index 2554ed9b7..edd15d1be 100644 --- a/view/next-project/src/pages/purchasereports/index.tsx +++ b/view/next-project/src/pages/purchasereports/index.tsx @@ -1,6 +1,6 @@ import clsx from 'clsx'; import Head from 'next/head'; -import { useState } from 'react'; +import { useState, useMemo } from 'react'; import { useRecoilState } from 'recoil'; import { userAtom } from '@/store/atoms'; @@ -72,16 +72,26 @@ export default function PurchaseReports(props: Props) { return datetime2; }; - // 購入報告の合計金額を計算 const TotalFee = (purchaseReport: PurchaseReport, purchaseItems: PurchaseItem[]) => { let totalFee = 0; purchaseItems.map((purchaseItem: PurchaseItem) => { - totalFee += purchaseItem.price * purchaseItem.quantity; + if (purchaseItem.financeCheck) { + totalFee += purchaseItem.price * purchaseItem.quantity; + } }); totalFee += purchaseReport.addition - purchaseReport.discount; return totalFee; }; + // すべてのpurchaseReportの合計金額 + const totalReportFee = useMemo(() => { + let totalFee = 0; + props.purchaseReportView.map((purchaseReportView: PurchaseReportView) => { + totalFee += TotalFee(purchaseReportView.purchaseReport, purchaseReportView.purchaseItems); + }); + return totalFee; + }, [props.purchaseReportView]); + // 変更可能なcheckboxの描画 const changeableCheckboxContent = (isChecked: boolean) => { { @@ -161,7 +171,7 @@ export default function PurchaseReports(props: Props) { className={clsx( 'px-1', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === purchaseReports.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} onClick={() => { onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); @@ -181,7 +191,7 @@ export default function PurchaseReports(props: Props) { className={clsx( 'px-1', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === purchaseReports.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} onClick={() => { onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); @@ -195,7 +205,7 @@ export default function PurchaseReports(props: Props) { className={clsx( 'px-1', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === purchaseReports.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} onClick={() => { onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); @@ -216,7 +226,7 @@ export default function PurchaseReports(props: Props) { className={clsx( 'px-1', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === purchaseReports.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} onClick={() => { onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); @@ -234,7 +244,7 @@ export default function PurchaseReports(props: Props) { className={clsx( 'px-1', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === purchaseReports.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} onClick={() => { onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); @@ -248,7 +258,7 @@ export default function PurchaseReports(props: Props) { className={clsx( 'px-1', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === purchaseReports.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} onClick={() => { onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); @@ -260,24 +270,28 @@ export default function PurchaseReports(props: Props) { )} > {purchaseReportViewItem.purchaseItems && - purchaseReportViewItem.purchaseItems.map( - (purchaseItem: PurchaseItem, index: number) => ( -
- {purchaseReportViewItem.purchaseItems.length - 1 === index ? ( - <>{purchaseItem.item} - ) : ( - <>{purchaseItem.item}, - )} -
- ), - )} + purchaseReportViewItem.purchaseItems.some((purchaseItem) => { + return purchaseItem.financeCheck; + }) ? ( + purchaseReportViewItem.purchaseItems.map((purchaseItem) => { + if (purchaseItem.financeCheck) { + return ( +
+ {purchaseItem.item} ({purchaseItem.quantity}) +
+ ); + } + }) + ) : ( +
購入物品なし
+ )}
{ onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); @@ -294,7 +308,7 @@ export default function PurchaseReports(props: Props) { className={clsx( 'px-1', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === purchaseReports.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} onClick={() => { onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); @@ -308,7 +322,7 @@ export default function PurchaseReports(props: Props) { className={clsx( 'px-1', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === purchaseReports.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} >
@@ -346,6 +360,19 @@ export default function PurchaseReports(props: Props) {
+
合計
+
+
+ {totalReportFee} +
+
+
+
From 4174a9df857f781b78c9427095c15d5290872254 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 23:32:07 +0900 Subject: [PATCH 32/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E7=94=B3?= =?UTF-8?q?=E8=AB=8B=E3=81=AE=E5=90=88=E8=A8=88=E9=87=91=E9=A1=8D=E3=82=92?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/purchaseorders/index.tsx | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/view/next-project/src/pages/purchaseorders/index.tsx b/view/next-project/src/pages/purchaseorders/index.tsx index 33f0ff19e..f44309d5b 100644 --- a/view/next-project/src/pages/purchaseorders/index.tsx +++ b/view/next-project/src/pages/purchaseorders/index.tsx @@ -1,6 +1,6 @@ import clsx from 'clsx'; import Head from 'next/head'; -import { useState } from 'react'; +import { useState, useMemo } from 'react'; import { useRecoilState } from 'recoil'; import { userAtom } from '@/store/atoms'; @@ -63,6 +63,15 @@ export default function PurchaseOrders(props: Props) { return totalFee; }; + // 全ての購入申請の合計金額を計算 + const totalPurchaseOrderFee = useMemo(() => { + let totalFee = 0; + props.purchaseOrderView?.map((purchaseOrderView: PurchaseOrderView) => { + totalFee += TotalFee(purchaseOrderView.purchaseItem); + }); + return totalFee; + }, [props.purchaseOrderView]); + // 変更可能なcheckboxの描画 const changeableCheckboxContent = (isChecked: boolean) => { { @@ -138,7 +147,7 @@ export default function PurchaseOrders(props: Props) { className={clsx( 'px-1', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === props.purchaseOrderView.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} >
@@ -155,7 +164,7 @@ export default function PurchaseOrders(props: Props) { className={clsx( 'px-1', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === props.purchaseOrderView.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} onClick={() => { onOpen( @@ -181,7 +190,7 @@ export default function PurchaseOrders(props: Props) { className={clsx( 'px-1', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === props.purchaseOrderView.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} onClick={() => { onOpen( @@ -204,7 +213,7 @@ export default function PurchaseOrders(props: Props) { className={clsx( 'px-1', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === props.purchaseOrderView.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} onClick={() => { onOpen( @@ -223,7 +232,7 @@ export default function PurchaseOrders(props: Props) { className={clsx( 'px-1', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === props.purchaseOrderView.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} onClick={() => { onOpen( @@ -257,7 +266,7 @@ export default function PurchaseOrders(props: Props) { className={clsx( 'px-1', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === props.purchaseOrderView.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} onClick={() => { onOpen( @@ -276,7 +285,7 @@ export default function PurchaseOrders(props: Props) { className={clsx( 'px-4', index === 0 ? 'pt-4 pb-3' : 'py-3', - index === props.purchaseOrderView.length - 1 ? 'pb-4 pt-3' : 'border-b py-3', + 'border-b py-3', )} >
@@ -303,7 +312,6 @@ export default function PurchaseOrders(props: Props) { ? purchaseOrderViewItem.purchaseOrder.id : 0 } - purchaseOrderViewItem={purchaseOrderViewItem} isDisabled={ !purchaseOrderViewItem.purchaseOrder.financeCheck && (user.roleID === 2 || @@ -316,6 +324,18 @@ export default function PurchaseOrders(props: Props) { ))} + + +
+
合計
+
+ + +
+ {totalPurchaseOrderFee} +
+ +
From ede0a6fe5796689989ee5d31962518c3b7611dfa Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sat, 8 Apr 2023 14:33:13 +0000 Subject: [PATCH 33/37] formatted by workflow --- .../PurchaseOrderListModal.tsx | 16 ++--- .../PurchaseReportAddModal.tsx | 10 ++- .../src/pages/purchaseorders/index.tsx | 46 ++----------- .../src/pages/purchasereports/index.tsx | 66 ++++--------------- 4 files changed, 34 insertions(+), 104 deletions(-) diff --git a/view/next-project/src/components/purchasereports/PurchaseOrderListModal.tsx b/view/next-project/src/components/purchasereports/PurchaseOrderListModal.tsx index 7144c5f88..eff1769f0 100644 --- a/view/next-project/src/components/purchasereports/PurchaseOrderListModal.tsx +++ b/view/next-project/src/components/purchasereports/PurchaseOrderListModal.tsx @@ -174,15 +174,13 @@ export default function PurchaseItemNumModal() { )} >
- { - purchaseOrderItem.purchaseItem && - purchaseOrderItem.purchaseItem.map((purchaseItem) => ( -
- {purchaseItem.item} -
-
- )) - } + {purchaseOrderItem.purchaseItem && + purchaseOrderItem.purchaseItem.map((purchaseItem) => ( +
+ {purchaseItem.item} +
+
+ ))}
- {activeStep === steps.length ? '購入物品として登録して確認へ' : '購入物品として登録して次へ'} + {activeStep === steps.length + ? '購入物品として登録して確認へ' + : '購入物品として登録して次へ'}
@@ -339,7 +341,9 @@ export default function PurchaseReportAddModal(props: ModalProps) { isFinanceCheckHandler(formDataList[activeStep - 1].id, false); }} > - {activeStep === steps.length ? '購入しなかった物品として登録して確認へ' : '購入しなかった物品として登録して次へ'} + {activeStep === steps.length + ? '購入しなかった物品として登録して確認へ' + : '購入しなかった物品として登録して次へ'}
diff --git a/view/next-project/src/pages/purchaseorders/index.tsx b/view/next-project/src/pages/purchaseorders/index.tsx index f44309d5b..60d1cc47a 100644 --- a/view/next-project/src/pages/purchaseorders/index.tsx +++ b/view/next-project/src/pages/purchaseorders/index.tsx @@ -143,13 +143,7 @@ export default function PurchaseOrders(props: Props) { {props.purchaseOrderView.map((purchaseOrderViewItem, index) => ( - +
{user.roleID === 3 ? changeableCheckboxContent( @@ -161,11 +155,7 @@ export default function PurchaseOrders(props: Props) {
{ onOpen( purchaseOrderViewItem.purchaseOrder.id @@ -187,11 +177,7 @@ export default function PurchaseOrders(props: Props) {
{ onOpen( purchaseOrderViewItem.purchaseOrder.id @@ -210,11 +196,7 @@ export default function PurchaseOrders(props: Props) { { onOpen( purchaseOrderViewItem.purchaseOrder.id @@ -229,11 +211,7 @@ export default function PurchaseOrders(props: Props) { { onOpen( purchaseOrderViewItem.purchaseOrder.id @@ -263,11 +241,7 @@ export default function PurchaseOrders(props: Props) { { onOpen( purchaseOrderViewItem.purchaseOrder.id @@ -281,13 +255,7 @@ export default function PurchaseOrders(props: Props) { {TotalFee(purchaseOrderViewItem.purchaseItem)} - +
( { onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} @@ -188,11 +184,7 @@ export default function PurchaseReports(props: Props) {
{ onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} @@ -202,11 +194,7 @@ export default function PurchaseReports(props: Props) {
{ onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} @@ -223,11 +211,7 @@ export default function PurchaseReports(props: Props) { { onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} @@ -241,11 +225,7 @@ export default function PurchaseReports(props: Props) { { onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} @@ -255,11 +235,7 @@ export default function PurchaseReports(props: Props) { { onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} @@ -288,11 +264,7 @@ export default function PurchaseReports(props: Props) { { onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} @@ -305,11 +277,7 @@ export default function PurchaseReports(props: Props) { { onOpen(purchaseReportViewItem.purchaseReport.id || 0, purchaseReportViewItem); }} @@ -318,13 +286,7 @@ export default function PurchaseReports(props: Props) { {purchaseReportViewItem.purchaseReport.remark || '無し'} - +
))} - +
合計
- -
- {totalReportFee} -
+ +
{totalReportFee}
- +
From c6e50088d74d2b236e14b72d47e863e425ebf5a3 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sun, 9 Apr 2023 12:55:15 +0900 Subject: [PATCH 34/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E7=94=B3?= =?UTF-8?q?=E8=AB=8B=E3=81=8B=E3=82=89=E5=A0=B1=E5=91=8A=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=81=A8=E3=81=8D=E3=81=AB=E3=80=81=E3=83=A2=E3=83=BC=E3=83=80?= =?UTF-8?q?=E3=83=AB=E3=82=92=E9=96=89=E3=81=98=E3=82=8B=E3=81=A8=E5=89=8A?= =?UTF-8?q?=E9=99=A4=E3=81=97=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/purchasereports/PurchaseReportAddModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx b/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx index 1c99574cf..67a9d5cab 100644 --- a/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx +++ b/view/next-project/src/components/purchasereports/PurchaseReportAddModal.tsx @@ -248,7 +248,7 @@ export default function PurchaseReportAddModal(props: ModalProps) {
{ - deletePurchaseOrder(); + if (props.isOnlyReported) deletePurchaseOrder(); props.setIsOpen(false); }} /> From 41b77622fc5bcfd3331373a95f9b9ebdd8fa0280 Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sun, 9 Apr 2023 14:10:39 +0900 Subject: [PATCH 35/37] =?UTF-8?q?[fix]=E8=B3=BC=E5=85=A5=E6=9C=89=E7=84=A1?= =?UTF-8?q?=E3=82=92detailmodal=E3=81=AB=E8=A1=A8=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchasereports/DetailModal.tsx | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/view/next-project/src/components/purchasereports/DetailModal.tsx b/view/next-project/src/components/purchasereports/DetailModal.tsx index aec86128c..fdf95eb80 100644 --- a/view/next-project/src/components/purchasereports/DetailModal.tsx +++ b/view/next-project/src/components/purchasereports/DetailModal.tsx @@ -132,11 +132,9 @@ const DetailModal: FC = (props) => {
URL
- {user.roleID === 3 ? ( - -
局長確認
- - ) : null} + +
購入有無
+ @@ -180,13 +178,11 @@ const DetailModal: FC = (props) => {
- {user.roleID === 3 ? ( - -
- -
- - ) : null} + +
+ +
+ ))} From a679a3cf380344cb6f8c9b4f53ab8b91a6f3a8ac Mon Sep 17 00:00:00 2001 From: imaimai17468 Date: Sun, 9 Apr 2023 14:22:44 +0900 Subject: [PATCH 36/37] =?UTF-8?q?[fix]=20=E8=B3=BC=E5=85=A5=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=81=8B=E3=81=A9=E3=81=86=E3=81=8B=E3=82=92=E5=A0=B1?= =?UTF-8?q?=E5=91=8A=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=A7=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/purchasereports/index.tsx | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/view/next-project/src/pages/purchasereports/index.tsx b/view/next-project/src/pages/purchasereports/index.tsx index 0e03a4bdf..5382fe3d3 100644 --- a/view/next-project/src/pages/purchasereports/index.tsx +++ b/view/next-project/src/pages/purchasereports/index.tsx @@ -153,7 +153,7 @@ export default function PurchaseReports(props: Props) {
期限日
-
購入物品
+
購入物品 (個数)
合計金額
@@ -245,22 +245,12 @@ export default function PurchaseReports(props: Props) { 'overflow-hidden text-ellipsis whitespace-nowrap text-center text-sm text-black-600', )} > - {purchaseReportViewItem.purchaseItems && - purchaseReportViewItem.purchaseItems.some((purchaseItem) => { - return purchaseItem.financeCheck; - }) ? ( - purchaseReportViewItem.purchaseItems.map((purchaseItem) => { - if (purchaseItem.financeCheck) { - return ( -
- {purchaseItem.item} ({purchaseItem.quantity}) -
- ); - } - }) - ) : ( -
購入物品なし
- )} + {/* name (個数/finasucheck) */} + {purchaseReportViewItem.purchaseItems.map((purchaseItem, index) => ( +
+ {`${purchaseItem.financeCheck?'○': 'x'} ${purchaseItem.item} (${purchaseItem.quantity})`} +
+ ))}
Date: Sun, 9 Apr 2023 05:23:50 +0000 Subject: [PATCH 37/37] formatted by workflow --- view/next-project/src/pages/purchasereports/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/view/next-project/src/pages/purchasereports/index.tsx b/view/next-project/src/pages/purchasereports/index.tsx index 5382fe3d3..4e422d69b 100644 --- a/view/next-project/src/pages/purchasereports/index.tsx +++ b/view/next-project/src/pages/purchasereports/index.tsx @@ -248,7 +248,9 @@ export default function PurchaseReports(props: Props) { {/* name (個数/finasucheck) */} {purchaseReportViewItem.purchaseItems.map((purchaseItem, index) => (
- {`${purchaseItem.financeCheck?'○': 'x'} ${purchaseItem.item} (${purchaseItem.quantity})`} + {`${purchaseItem.financeCheck ? '○' : 'x'} ${purchaseItem.item} (${ + purchaseItem.quantity + })`}
))}