Skip to content

Commit

Permalink
Merge pull request #102 from Kim-Jaemin420/develop
Browse files Browse the repository at this point in the history
문서 OX2 수정
  • Loading branch information
Kim-Jaemin420 authored May 19, 2021
2 parents e014007 + 604ce50 commit dc334d5
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 182 deletions.
8 changes: 4 additions & 4 deletions src/components/common/getItemData.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import axios from 'axios';

const getItemData = async setState => {
const CERT_NO = JSON.parse(localStorage.getItem('certNo'));
const CERTNO = JSON.parse(localStorage.getItem('certNo'));
const RCVNO = JSON.parse(localStorage.getItem('rcvNo'));
const VESSELNM = JSON.parse(localStorage.getItem('shipNm'));

if (!CERT_NO) return;
if (!CERTNO) return;

const params = new URL(window.location.href).pathname;
const path = params.split('/')[2];

try {
const res = await axios.get(
`${process.env.REACT_APP_SERVER_URL}/api/doc/${path}?ct=${CERT_NO}`,
`${process.env.REACT_APP_SERVER_URL}/api/doc/${path}?ct=${CERTNO}`,
{
headers: {
Authorization: `Bearer ${sessionStorage.getItem('KOSCO_token')}`,
Expand All @@ -28,7 +28,7 @@ const getItemData = async setState => {
H: {
RCVNO,
VESSELNM,
CERTNO: CERT_NO || null,
CERTNO,
},
D1,
...rest,
Expand Down
9 changes: 6 additions & 3 deletions src/components/doc/OX2/OX2Bottom.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { useSelector } from 'react-redux';
import styled from 'styled-components';
import OX2BttomTableRow from './OX2BttomTableRow';

Expand Down Expand Up @@ -55,7 +56,9 @@ const ButtonDiv = styled.div`
text-align: center;
`;

const OX2Bottom = ({ onInsertD2, onRemoveD2, onChange, D2Lists, units, onChangeDatePicker }) => {
const OX2Bottom = ({ onInsertD2, onRemoveD2, onChange, units, onChangeDatePicker }) => {
const D2 = useSelector(state => state.ox2.D2);

return (
<>
<TableBox>
Expand All @@ -74,8 +77,8 @@ const OX2Bottom = ({ onInsertD2, onRemoveD2, onChange, D2Lists, units, onChangeD
</tr>
</thead>
<tbody>
{D2Lists.map((list, index) => (
<OX2BttomTableRow key={list.id} id={list.id} onRemoveD2={onRemoveD2} onChange={onChange} num={index + 1} units={units} onChangeDatePicker={onChangeDatePicker}/>
{Object.entries(D2).map((item, index) => (
<OX2BttomTableRow key={item[0]} id={item[0]} onRemove={onRemoveD2} onChange={onChange} num={index + 1} units={units} onChangeDatePicker={onChangeDatePicker}/>
))}
</tbody>
</table>
Expand Down
5 changes: 4 additions & 1 deletion src/components/doc/OX2/OX2Bottom2.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { useSelector } from 'react-redux';
import styled from 'styled-components';

const BottomBox = styled.div`
Expand All @@ -22,11 +23,13 @@ const BottomBox = styled.div`
`;

const OX2Bottom2 = ({ onChangeTextArea }) => {
const D3 = useSelector(state => state.ox2.D3);

return (
<BottomBox>
<div className='title'>Recommendation ;</div>
<div className='description'>
<textarea onChange={onChangeTextArea}></textarea>
<textarea value={D3} onChange={onChangeTextArea}></textarea>
</div>
</BottomBox>
);
Expand Down
22 changes: 11 additions & 11 deletions src/components/doc/OX2/OX2BttomTableRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,41 @@ import { useSelector } from 'react-redux';
import DeleteButton from '../common/DeleteButton';

const OX2BttomTableRow = ({ id, onRemoveD2, onChange, num, units, onChangeDatePicker }) => {
const { TestDt } = useSelector(state => state.ox2.D2[id]);
const { Manuf, Volume, WorkPress, SerialNo, TestDt, Perform } = useSelector(state => state.ox2.D2[id]);
const inputArg = ({ target }) => onChange({ target, id });
return (
<tr>
<td>
{'NO.' + num}
</td>
<td>
<input type='text' onChange={inputArg} name="Manuf" data-form="D2"/>
<input type='text' value={Manuf} onChange={inputArg} name="Manuf" data-form="D2"/>
</td>
<td>
<input type='text' onChange={inputArg} name="Volume" data-form="D2"/>
<input type='text' value={Volume} onChange={inputArg} name="Volume" data-form="D2"/>
</td>
<td>
<input type='text' onChange={inputArg} name="WorkPress" data-form="D2"/>
<input type='text' value={WorkPress} onChange={inputArg} name="WorkPress" data-form="D2"/>
</td>
<td>
<input type='text' onChange={inputArg} name="SerialNo" data-form="D2"/>
<input type='text' value={SerialNo} onChange={inputArg} name="SerialNo" data-form="D2"/>
</td>
<td>
<DatePicker
selected={TestDt}
selected={new Date(TestDt)}
name="TestDt"
data-form="D2"
dateFormat="MMM.yyyy"
dateFormat="yyyy-MM"
onChange={value => onChangeDatePicker({ id, target: { name: "TestDt", form: "D2", value } })}
showMonthYearPicker
/>
</td>
<td>
<select name="Perform" data-form="D2" onChange={inputArg}>
<select name="Perform" data-form="D2" value={Perform} onChange={inputArg}>
<option defaultValue="선택해주세요">선택해주세요</option>
{units.map(unit => (
<option key={unit.CdNm} value={unit.CD}>
{unit.CdNm}
{units.map(({CdNm, CD}) => (
<option key={CdNm} value={CD}>
{CdNm}
</option>
))}
</select>
Expand Down
6 changes: 3 additions & 3 deletions src/components/doc/OX2/OX2Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ const ButtonBox = styled.div`
cursor: pointer;
}`;

const OX2Form = ({ onChangeD1, onChange, onRemove, onInsert, onChangeTextArea, lists, D2Lists, datas, onInsertD2, onRemoveD2, units, onChangeDatePicker, showModal, showCommModal }) => {
const OX2Form = ({ onChangeD1, onChange, onRemove, onInsert, onChangeTextArea, datas, onInsertD2, onRemoveD2, units, onChangeDatePicker, showModal, showCommModal }) => {
return (
<form>
<Info />
<OX2Top datas={datas} lists={lists} onRemove={onRemove} onInsert={onInsert} onChangeD1={onChangeD1}/>
<OX2Bottom onInsertD2={onInsertD2} onRemoveD2={onRemoveD2} onChange={onChange} D2Lists={D2Lists} units={units} onChangeDatePicker={onChangeDatePicker}/>
<OX2Top datas={datas} onRemove={onRemove} onInsert={onInsert} onChangeD1={onChangeD1}/>
<OX2Bottom onInsertD2={onInsertD2} onRemoveD2={onRemoveD2} onChange={onChange} units={units} onChangeDatePicker={onChangeDatePicker}/>
<OX2Bottom2 onChangeTextArea={onChangeTextArea}/>
<ButtonBox>
<DynTemporaryStorageButton showModal={showModal}/>
Expand Down
8 changes: 5 additions & 3 deletions src/components/doc/OX2/OX2Top.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { useSelector } from 'react-redux';
import styled from 'styled-components';
import OX2TopTableRow from './OX2TopTableRow';

Expand Down Expand Up @@ -95,7 +96,8 @@ const ButtonDiv = styled.div`
text-align: center;
`;

const OX2Top = ({ datas, lists, onRemove, onInsert, onChangeD1 }) => {
const OX2Top = ({ datas, onRemove, onInsert, onChangeD1 }) => {
const D1 = useSelector(state => state.ox2.D1);

return (
<>
Expand All @@ -109,8 +111,8 @@ const OX2Top = ({ datas, lists, onRemove, onInsert, onChangeD1 }) => {
<div className='right-box'>
<div className='title'>Specification of medical oxygen ;</div>
<div className='description-box'>
{lists.map((list, index) => (
<OX2TopTableRow key={list.id} id={list.id} onRemove={onRemove} num={index + 1} onChangeD1={onChangeD1}/>
{Object.entries(D1).map((item, index) => (
<OX2TopTableRow key={item[0]} id={item[0]} onRemove={onRemove} num={index + 1} onChangeD1={onChangeD1}/>
))}
</div>
</div>
Expand Down
17 changes: 10 additions & 7 deletions src/components/doc/OX2/OX2TopTableRow.jsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
import React from 'react';
import { useSelector } from 'react-redux';
import DeleteButton from '../common/DeleteButton';

const OX2TopTableRow = ({ id, onRemove, onChangeD1, num }) => {
const { SetNo1, SetNo2, SetNo3, SetNo4, SetNo5, SetNo6, SetNo7 } = useSelector(state => state.ox2.D1[id]);

const checkBoxArgument = ({ target }) => onChangeD1({ target, id })
return (
<div>
<div className='title'>
{'SET NO.' + num}
</div>
<div className='description'>
<input type='checkbox' defaultChecked='checked' onChange={checkBoxArgument} name="SetNo1"/>
<input type='checkbox'checked={!!SetNo1} onChange={checkBoxArgument} name="SetNo1"/>
</div>
<div className='description'>
<input type='checkbox' defaultChecked='checked' onChange={checkBoxArgument} name="SetNo2"/>
<input type='checkbox'checked={!!SetNo2} onChange={checkBoxArgument} name="SetNo2"/>
</div>
<div className='description'>
<input type='checkbox' defaultChecked='checked' onChange={checkBoxArgument} name="SetNo3"/>
<input type='checkbox'checked={!!SetNo3} onChange={checkBoxArgument} name="SetNo3"/>
</div>
<div className='description'>
<input type='checkbox' defaultChecked='checked' onChange={checkBoxArgument} name="SetNo4"/>
<input type='checkbox'checked={!!SetNo4} onChange={checkBoxArgument} name="SetNo4"/>
</div>
<div className='description'>
<input type='checkbox' defaultChecked='checked' onChange={checkBoxArgument} name="SetNo5"/>
<input type='checkbox'checked={!!SetNo5} onChange={checkBoxArgument} name="SetNo5"/>
</div>
<div className='description'>
<input type='checkbox' defaultChecked='checked' onChange={checkBoxArgument} name="SetNo6"/>
<input type='checkbox'checked={!!SetNo6} onChange={checkBoxArgument} name="SetNo6"/>
</div>
<div className='description'>
<input type='checkbox' defaultChecked='checked' onChange={checkBoxArgument} name="SetNo7"/>
<input type='checkbox'checked={!!SetNo7} onChange={checkBoxArgument} name="SetNo7"/>
</div>
<div className='description' onClick={() => onRemove(id)}>
<DeleteButton />
Expand Down
Loading

0 comments on commit dc334d5

Please sign in to comment.