Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

制度登録画面のチェックボックスをまとめる #313

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 24 additions & 56 deletions src/admin/pages/newSystem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const Textarea = styled.textarea`
`;

type historyProps = RouteComponentProps;
declare type TargetFamilyType = keyof typeof TargetFamily

const Input: React.FC<historyProps> = props => {
const user = useSelector((state: AppState) => state.userState);
Expand Down Expand Up @@ -105,6 +106,16 @@ const Input: React.FC<historyProps> = props => {
"高齢者"
];

const targetFamilyList: Array<string> = [
"独身",
"夫婦",
"子持ち",
"二世帯",
"ひとり親",
"介護",
"不明"
]

const post = () => {
setSelectionCategory(selectionCategory);
const systemData: System = {
Expand Down Expand Up @@ -254,63 +265,20 @@ const Input: React.FC<historyProps> = props => {
</label>
</div>
<div>
<label>
<input
type="checkbox"
value={TargetFamily.独身}
checked={selectionTargetFamily.indexOf(0) !== -1}
onChange={e => handleTargetFamilyChange(e)}
/>
独身
</label>
<label>
<input
type="checkbox"
value={TargetFamily.夫婦}
checked={selectionTargetFamily.indexOf(1) !== -1}
onChange={e => handleTargetFamilyChange(e)}
/>
夫婦
</label>
<label>
<input
type="checkbox"
value={TargetFamily.子持ち}
checked={selectionTargetFamily.indexOf(2) !== -1}
onChange={e => handleTargetFamilyChange(e)}
/>
子持ち
</label>
<label>
<input
type="checkbox"
value={TargetFamily.二世帯}
checked={selectionTargetFamily.indexOf(3) !== -1}
onChange={e => handleTargetFamilyChange(e)}
/>
二世帯
</label>
<label>
<input
type="checkbox"
value={TargetFamily.ひとり親}
checked={selectionTargetFamily.indexOf(4) !== -1}
onChange={e => handleTargetFamilyChange(e)}
/>
ひとり親
</label>
<label>
<input
type="checkbox"
value={TargetFamily.介護}
checked={selectionTargetFamily.indexOf(5) !== -1}
onChange={e => handleTargetFamilyChange(e)}
/>
介護
</label>
{targetFamilyList.map((targetFamilyName, index) => (
<label key={targetFamilyName}>
<input
key={targetFamilyName}
type="checkbox"
value={TargetFamily[targetFamilyName as TargetFamilyType]}
checked={selectionTargetFamily.indexOf(index) !== -1}
onChange={e => handleTargetFamilyChange(e)}
/>
{targetFamilyName}
</label>
))}
</div>
{/* {console.log(selectionCategory)}
{console.log(selectionTargetFamily)} */}

<Select
onChange={e => {
setTargetAge(parseInt(e.target.value));
Expand Down