Skip to content

Commit

Permalink
[fix]協賛活動編集モーダル修正
Browse files Browse the repository at this point in the history
  • Loading branch information
Kubosaka committed Nov 23, 2023
1 parent c26c10e commit 3c56d31
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions view/next-project/src/components/sponsoractivities/EditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export default function EditModal(props: ModalProps) {
expense: Number((props.sponsorActivity.expense / 11).toFixed(1)),
});

const default_user = users.find((user) => user.id === formData.userID);

const initStyleIds = sponsorStyleDetails
? sponsorStyleDetails.map((sponsorStyleDetail) => sponsorStyleDetail.sponsorStyleID)
: [];
Expand Down Expand Up @@ -178,7 +180,9 @@ export default function EditModal(props: ModalProps) {
.filter((user, index, self) => {
return self.findIndex((u) => u.name === user.name) === index;
});
if (res.length !== 0) setFormData({ ...formData, userID: res[0].id });
if (res.length !== 0 && default_user?.bureauID !== bureauId) {
setFormData({ ...formData, userID: res[0].id });
}
return res;
}, [bureauId]);

Expand All @@ -187,9 +191,9 @@ export default function EditModal(props: ModalProps) {
<div className='my-6 grid grid-cols-5 items-center justify-items-center gap-3'>
<p className='text-black-600'>企業名</p>
<div className='col-span-4 w-full'>
<Select className='w-full' onChange={handler('sponsorID')}>
<Select className='w-full' onChange={handler('sponsorID')} value={data.sponsorID}>
{sponsors.map((sponsor) => (
<option key={sponsor.id} value={sponsor.id} selected={sponsor.id === data.sponsorID}>
<option key={sponsor.id} value={sponsor.id}>
{sponsor.name}
</option>
))}
Expand Down Expand Up @@ -221,9 +225,9 @@ export default function EditModal(props: ModalProps) {
</div>
<p className='text-black-600'>担当者名</p>
<div className='col-span-4 w-full'>
<Select className='w-full' onChange={handler('userID')}>
<Select className='w-full' onChange={handler('userID')} value={data.userID}>
{filteredUsers.map((user) => (
<option key={user.id} value={user.id} selected={user.id === data.userID}>
<option key={user.id} value={user.id}>
{user.name}
</option>
))}
Expand All @@ -236,21 +240,16 @@ export default function EditModal(props: ModalProps) {
onChange={(e) => {
setFormData({ ...formData, isDone: e.target.value === '回収完了' ? true : false });
}}
value={data.isDone ? '回収完了' : '未回収'}
>
<option value='未回収' selected={data.isDone === false}>
未回収
</option>
<option value='回収完了' selected={data.isDone === true}>
回収完了
</option>
<option value='未回収'>未回収</option>
<option value='回収完了'>回収完了</option>
</Select>
</div>
<p className='text-black-600'>オプション</p>
<div className='col-span-4 w-full'>
<Select value={data.feature} onChange={setFeature}>
<option value={'なし'} selected>
なし
</option>
<option value={'なし'}>なし</option>
<option value={'ポスター'} disabled={isSelectSponsorBooth}>
ポスター
</option>
Expand Down

0 comments on commit 3c56d31

Please sign in to comment.