
--- .vscode/launch.json
... | ... | @@ -1,16 +0,0 @@ |
1 | -{ | |
2 | - // Use IntelliSense to learn about possible attributes. | |
3 | - // Hover to view descriptions of existing attributes. | |
4 | - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
5 | - "version": "0.2.0", | |
6 | - "configurations": [ | |
7 | - | |
8 | - { | |
9 | - "type": "chrome", | |
10 | - "request": "launch", | |
11 | - "name": "Launch Chrome against localhost", | |
12 | - "url": "http://localhost:8080", | |
13 | - "webRoot": "${workspaceFolder}" | |
14 | - } | |
15 | - ] | |
16 | -}(No newline at end of file) |
--- client/views/component/Table.jsx
+++ client/views/component/Table.jsx
... | ... | @@ -3,11 +3,52 @@ |
3 | 3 |
import Modal from "./MatchingModal.jsx"; |
4 | 4 |
import Modal2 from "./Modal.jsx"; |
5 | 5 |
import SubTitle from "./SubTitle.jsx"; |
6 |
- |
|
6 |
+import { useNavigate } from "react-router"; |
|
7 |
+import TableTest from "./TableTest.jsx" |
|
7 | 8 |
// import styled from "styled-components"; |
8 | 9 |
|
9 | 10 |
export default function Table({ head, contents, contentKey, onClick, className, view, offset, limit }) { |
11 |
+ const navigate = useNavigate(); |
|
12 |
+ // 모달 title에 대상자 명 출력을 위함 |
|
13 |
+ const [useName, setUseUserName] = React.useState(""); |
|
14 |
+ // 매칭을 위해 대상자 ID 값 전달을 위함 |
|
15 |
+ const [useseniorId, setUseSeniorId] = React.useState(""); |
|
16 |
+ |
|
17 |
+ //대상자 - 보호자 매칭 리스트 |
|
18 |
+ const [sgMatchList, setSgMatchList] = React.useState([]); |
|
19 |
+ |
|
20 |
+ //사용자 등록 초기값 설정 |
|
10 | 21 |
const [userName, setUserName] = React.useState(""); |
22 |
+ const [gender, setGender] = React.useState(""); |
|
23 |
+ const [brith, setBrith] = React.useState(""); |
|
24 |
+ const [telNum, setTelNum] = React.useState(""); |
|
25 |
+ const [homeAddress, setHomeAddress] = React.useState(""); |
|
26 |
+ const [relationship, setRelationship] = React.useState(""); |
|
27 |
+ const [matchState, setMatchState] = React.useState(true); |
|
28 |
+ |
|
29 |
+ //-------- 변경되는 데이터 Handler 설정 --------// |
|
30 |
+ const handleUserName = (e) => { |
|
31 |
+ setUserName(e.target.value); |
|
32 |
+ }; |
|
33 |
+ const handleBrithday = (e) => { |
|
34 |
+ setBrith(e.target.value); |
|
35 |
+ }; |
|
36 |
+ const handleTelNum = (e) => { |
|
37 |
+ e.target.value = e.target.value.replace(/[^0-9]/g, '').replace(/^(\d{2,3})(\d{3,4})(\d{4})$/, `$1-$2-$3`); |
|
38 |
+ setTelNum(e.target.value); |
|
39 |
+ }; |
|
40 |
+ const handelRelationship = (e) => { |
|
41 |
+ setRelationship(e.target.value); |
|
42 |
+ }; |
|
43 |
+ |
|
44 |
+ |
|
45 |
+ const dataReset = () => { |
|
46 |
+ setUserName(""); |
|
47 |
+ setBrith(""); |
|
48 |
+ setTelNum(""); |
|
49 |
+ relationship("") |
|
50 |
+ } |
|
51 |
+ |
|
11 | 52 |
const [modalOpen, setModalOpen] = React.useState(false); |
12 | 53 |
const openModal = () => { |
13 | 54 |
setModalOpen(true); |
... | ... | @@ -16,6 +57,7 @@ |
16 | 57 |
const [modalOpen2, setModalOpen2] = React.useState(false); |
17 | 58 |
const openModal2 = () => { |
18 | 59 |
setModalOpen2(true); |
60 |
+ dataReset(); |
|
19 | 61 |
}; |
20 | 62 |
|
21 | 63 |
const closeModal = () => { |
... | ... | @@ -24,6 +66,95 @@ |
24 | 66 |
|
25 | 67 |
const closeModal2 = () => { |
26 | 68 |
setModalOpen2(false); |
69 |
+ }; |
|
70 |
+ // 매칭 리스트 출력 영역 |
|
71 |
+ const getselectMatchList = () => { |
|
72 |
+ fetch("/user/selectSeniorGuardianMatch.json", { |
|
73 |
+ method: "POST", |
|
74 |
+ headers: { |
|
75 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
76 |
+ }, |
|
77 |
+ body: JSON.stringify({ |
|
78 |
+ senior_id: useseniorId, |
|
79 |
+ }), |
|
80 |
+ }).then((response) => response.json()).then((data) => { |
|
81 |
+ console.log("getselectMatchList : ", data); |
|
82 |
+ setSgMatchList(data); |
|
83 |
+ openModal(); |
|
84 |
+ }).catch((error) => { |
|
85 |
+ console.log('getselectMatchList() /user/selectSeniorGuardianMatch.json error : ', error); |
|
86 |
+ }); |
|
87 |
+ }; |
|
88 |
+ // 보호자 등록 영역 |
|
89 |
+ const test = () => { |
|
90 |
+ console.log("userName : ", userName); |
|
91 |
+ console.log("gender : ", gender); |
|
92 |
+ console.log("brith : ", brith); |
|
93 |
+ console.log("telNum : ", telNum); |
|
94 |
+ console.log("homeAddress : ", homeAddress); |
|
95 |
+ console.log("relationship : ", relationship); |
|
96 |
+ console.log("matchState : ", matchState); |
|
97 |
+ } |
|
98 |
+ const insertUser = () => { |
|
99 |
+ fetch("/user/insertSeniorData.json", { |
|
100 |
+ method: "POST", |
|
101 |
+ headers: { |
|
102 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
103 |
+ }, |
|
104 |
+ body: JSON.stringify({ |
|
105 |
+ user_name: userName, |
|
106 |
+ user_gender: gender != "" ? gender:null, |
|
107 |
+ user_birth: brith, |
|
108 |
+ user_phonenumber: telNum, |
|
109 |
+ user_address: homeAddress != "" ? homeAddress:null, |
|
110 |
+ agency_id: 'agency01', |
|
111 |
+ government_id: 'government01', |
|
112 |
+ user_code: '3', |
|
113 |
+ |
|
114 |
+ }), |
|
115 |
+ }).then((response) => response.json()).then((data) => { |
|
116 |
+ console.log("보호자 등록"); |
|
117 |
+ insertGuadian(); |
|
118 |
+ }).catch((error) => { |
|
119 |
+ console.log('insertUser() /user/insertSeniorData.json error : ', error); |
|
120 |
+ }); |
|
121 |
+ }; |
|
122 |
+ |
|
123 |
+ const insertGuadian = () => { |
|
124 |
+ fetch("/user/insertGuardian.json", { |
|
125 |
+ method: "POST", |
|
126 |
+ headers: { |
|
127 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
128 |
+ }, |
|
129 |
+ body: JSON.stringify({ |
|
130 |
+ user_phonenumber: telNum, |
|
131 |
+ }), |
|
132 |
+ }).then((response) => response.json()).then((data) => { |
|
133 |
+ console.log("보호자 테이블 데이터 등록"); |
|
134 |
+ matchSeniorGuadian(); |
|
135 |
+ }).catch((error) => { |
|
136 |
+ console.log('insertGuadian() /user/insertGuardian.json error : ', error); |
|
137 |
+ }); |
|
138 |
+ }; |
|
139 |
+ |
|
140 |
+ const matchSeniorGuadian = () => { |
|
141 |
+ fetch("/user/insertSeniorGuardianMatch.json", { |
|
142 |
+ method: "POST", |
|
143 |
+ headers: { |
|
144 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
145 |
+ }, |
|
146 |
+ body: JSON.stringify({ |
|
147 |
+ senior_id:useseniorId, |
|
148 |
+ user_phonenumber: telNum, |
|
149 |
+ senior_relationship:relationship, |
|
150 |
+ guardian_match_state:matchState, |
|
151 |
+ }), |
|
152 |
+ }).then((response) => response.json()).then((data) => { |
|
153 |
+ console.log("매칭 등록"); |
|
154 |
+ dataReset(); |
|
155 |
+ }).catch((error) => { |
|
156 |
+ console.log('matchSeniorGuadian() /user/insertSeniorGuardianMatch.json error : ', error); |
|
157 |
+ }); |
|
27 | 158 |
}; |
28 | 159 |
|
29 | 160 |
// 보호자 등록페이지 데이터 |
... | ... | @@ -35,31 +166,25 @@ |
35 | 166 |
"대상자와의 관계", |
36 | 167 |
]; |
37 | 168 |
const key3 = [ |
38 |
- "No", |
|
39 |
- "name", |
|
40 |
- "birth", |
|
41 |
- "phone", |
|
42 |
- "relationship", |
|
169 |
+ "rn", |
|
170 |
+ "guardian_name", |
|
171 |
+ "user_birth", |
|
172 |
+ "user_phonenumber", |
|
173 |
+ "senior_relationship", |
|
43 | 174 |
]; |
44 |
- const content3 = [ |
|
45 |
- { |
|
46 |
- No: 1, |
|
47 |
- name: "김훈", |
|
48 |
- birth: "1965.01.01", |
|
49 |
- relationship: "아들", |
|
50 |
- phone: "010-1234-1234", |
|
51 |
- }, |
|
52 |
- ]; |
|
53 |
- |
|
54 | 175 |
|
55 |
- const buttonPrint = () => { |
|
176 |
+ const buttonPrint = (name, id) => { |
|
56 | 177 |
if (view == 'mySenior') { |
57 | 178 |
return ( |
58 | 179 |
<td> |
59 | 180 |
<Button |
60 | 181 |
className={"btn-small gray-btn"} |
61 | 182 |
btnName={"보기"} |
62 |
- onClick={openModal} |
|
183 |
+ onClick={() =>{ |
|
184 |
+ setUseUserName(name); |
|
185 |
+ setUseSeniorId(id); |
|
186 |
+ getselectMatchList(); |
|
187 |
+ }} |
|
63 | 188 |
/> |
64 | 189 |
</td>) |
65 | 190 |
} |
... | ... | @@ -70,58 +195,56 @@ |
70 | 195 |
<Button |
71 | 196 |
className={"btn-small gray-btn"} |
72 | 197 |
btnName={"선택"} |
73 |
- onClick={openModal2} |
|
198 |
+ onClick={()=>{setUseSeniorId(id); openModal2}} |
|
74 | 199 |
/> |
75 | 200 |
</td> |
76 | 201 |
<td> |
77 | 202 |
<Button |
78 | 203 |
className={"btn-small gray-btn"} |
79 | 204 |
btnName={"보기"} |
80 |
- onClick={openModal} |
|
81 |
- /> |
|
205 |
+ onClick={(e) =>{ |
|
206 |
+ setUseUserName(name); |
|
207 |
+ setUseSeniorId(id); |
|
208 |
+ getselectMatchList(); |
|
209 |
+ }} |
|
210 |
+ /> |
|
82 | 211 |
</td> |
83 | 212 |
</> |
84 | 213 |
) |
85 | 214 |
} |
86 | 215 |
} |
87 |
- |
|
216 |
+ React.useEffect(() => { |
|
217 |
+ }, []) |
|
88 | 218 |
return ( |
89 | 219 |
<> |
90 | 220 |
<Modal open={modalOpen2} close={closeModal2} header="담당자 배정" /> |
91 |
- <Modal2 open={modalOpen} close={closeModal} header={userName+"님의 가족"}> |
|
221 |
+ {/* 보호자 보기 모달창 */} |
|
222 |
+ <Modal2 open={modalOpen} close={closeModal} header={useName+"님의 가족"} > |
|
92 | 223 |
<div className="board-wrap"> |
93 | 224 |
<SubTitle explanation={"최초 ID는 연락처, PW는 생년월일 8자리입니다."} className="margin-bottom" /> |
94 | 225 |
<table className="margin-bottom2 senior-insert"> |
95 | 226 |
<tr> |
96 | 227 |
<th>이름</th> |
97 | 228 |
<td> |
98 |
- <input type="text" /> |
|
229 |
+ <input type="text" value={userName} onChange={handleUserName} /> |
|
99 | 230 |
</td> |
100 | 231 |
<th>생년월일</th> |
101 | 232 |
<td> |
102 | 233 |
<div className="flex"> |
103 |
- <select name="year" id="year"> |
|
104 |
- <option value="">년</option> |
|
105 |
- </select> |
|
106 |
- <select name="month" id="month"> |
|
107 |
- <option value="">월</option> |
|
108 |
- </select> |
|
109 |
- <select name="days" id="days"> |
|
110 |
- <option value="">일</option> |
|
111 |
- </select> |
|
234 |
+ <input type='date' value={brith} onChange={handleBrithday} /> |
|
112 | 235 |
</div> |
113 | 236 |
</td> |
114 | 237 |
</tr> |
115 | 238 |
<tr> |
116 | 239 |
<th>연락처</th> |
117 | 240 |
<td colSpan={3}> |
118 |
- <input type="input" maxLength="11" /> |
|
241 |
+ <input type="input" maxLength="13" value={telNum} onChange={handleTelNum} /> |
|
119 | 242 |
</td> |
120 | 243 |
</tr> |
121 | 244 |
<tr> |
122 | 245 |
<th>대상자와의 관계</th> |
123 | 246 |
<td colSpan={3}> |
124 |
- <input type="text" /> |
|
247 |
+ <input type="text" value={relationship} onChange={handelRelationship}/> |
|
125 | 248 |
</td> |
126 | 249 |
</tr> |
127 | 250 |
</table> |
... | ... | @@ -130,15 +253,17 @@ |
130 | 253 |
className={"btn-small green-btn"} |
131 | 254 |
btnName={"추가"} |
132 | 255 |
onClick={() => { |
133 |
- navigate("/SeniorInsert"); |
|
256 |
+ test(); |
|
257 |
+ insertUser() |
|
258 |
+ getselectMatchList(); |
|
134 | 259 |
}} |
135 | 260 |
/> |
136 | 261 |
</div> |
137 | 262 |
<div> |
138 |
- <Table |
|
263 |
+ <TableTest |
|
139 | 264 |
className={"caregiver-user"} |
140 | 265 |
head={thead3} |
141 |
- contents={content3} |
|
266 |
+ contents={sgMatchList} |
|
142 | 267 |
contentKey={key3} |
143 | 268 |
/> |
144 | 269 |
</div> |
... | ... | @@ -154,18 +279,20 @@ |
154 | 279 |
</thead> |
155 | 280 |
<tbody> |
156 | 281 |
{contents.slice(offset, offset + limit).map((i, index) => { |
157 |
- const name = i.user_name; |
|
282 |
+ const userName = i.user_name; |
|
283 |
+ const userId = i.user_id |
|
158 | 284 |
return ( |
159 | 285 |
<tr key={index}> |
160 | 286 |
{contentKey.map((kes) => { |
161 | 287 |
return ( |
162 | 288 |
<> |
163 |
- <td onClick={onClick}>{i[kes]}</td> |
|
164 |
- {console.log("userName : ", userName)} |
|
289 |
+ <td onClick={() => { |
|
290 |
+ navigate("/SeniorSelectOne")}}>{i[kes]} |
|
291 |
+ </td> |
|
165 | 292 |
</> |
166 | 293 |
) |
167 | 294 |
})} |
168 |
- {buttonPrint()} |
|
295 |
+ {buttonPrint(userName, userId)} |
|
169 | 296 |
</tr> |
170 | 297 |
); |
171 | 298 |
})} |
+++ client/views/component/TableTest.jsx
... | ... | @@ -0,0 +1,72 @@ |
1 | +import React from "react"; | |
2 | +import Button from "./Button.jsx"; | |
3 | +import Modal from "./MatchingModal.jsx"; | |
4 | +import Modal2 from "./Modal.jsx"; | |
5 | +import SubTitle from "./SubTitle.jsx"; | |
6 | +import { useNavigate } from "react-router"; | |
7 | +// import styled from "styled-components"; | |
8 | + | |
9 | +export default function TableTest({ head, contents, contentKey, onClick, className }) { | |
10 | + | |
11 | + return ( | |
12 | + <> | |
13 | + <table className={className}> | |
14 | + <thead> | |
15 | + <tr> | |
16 | + {head.map((i) => { | |
17 | + return <th>{i}</th>; | |
18 | + })} | |
19 | + </tr> | |
20 | + </thead> | |
21 | + <tbody> | |
22 | + {contents.map((i, index) => { | |
23 | + const userName = i.user_name; | |
24 | + const userId = i.user_id | |
25 | + return ( | |
26 | + <tr key={index}> | |
27 | + {contentKey.map((kes) => { | |
28 | + return ( | |
29 | + <> | |
30 | + <td > | |
31 | + {i[kes]} | |
32 | + </td> | |
33 | + </> | |
34 | + ) | |
35 | + })} | |
36 | + </tr> | |
37 | + ); | |
38 | + })} | |
39 | + </tbody> | |
40 | + </table> | |
41 | + </> | |
42 | + ); | |
43 | +} | |
44 | + | |
45 | + | |
46 | +// const TableStyled = styled.table` | |
47 | +// border-top: 2px solid #2d303f; | |
48 | +// border-bottom: 1px solid #e4dccf; | |
49 | +// /* &:hover { | |
50 | +// background-color: #e4dccf; | |
51 | +// } */ | |
52 | +// `; | |
53 | + | |
54 | +// const TrStyled = styled.tr` | |
55 | +// cursor: pointer; | |
56 | +// `; | |
57 | + | |
58 | +// const ThStyled = styled.th` | |
59 | +// padding: 1rem 0; | |
60 | +// font-weight: bold; | |
61 | +// background-color: #f0ebe3; | |
62 | +// font-size: 1.4rem; | |
63 | +// text-align: center; | |
64 | +// `; | |
65 | + | |
66 | +// const TdStyled = styled.td` | |
67 | +// padding: 1rem 0; | |
68 | +// border-top: 1px solid #ececec; | |
69 | +// text-align: center; | |
70 | +// font-size: 1.3rem; | |
71 | +// background-color: #ffffff; | |
72 | +// `; |
--- client/views/pages/user_management/UserAuthoriySelect_agency.jsx
+++ client/views/pages/user_management/UserAuthoriySelect_agency.jsx
... | ... | @@ -483,7 +483,7 @@ |
483 | 483 |
<tr> |
484 | 484 |
<th>연락처</th> |
485 | 485 |
<td colSpan={3}> |
486 |
- <input type="text" value={telNum} onChange={handleTelNum} /> |
|
486 |
+ <input type="text" maxLength="13" value={telNum} onChange={handleTelNum} /> |
|
487 | 487 |
</td> |
488 | 488 |
</tr> |
489 | 489 |
<tr> |
... | ... | @@ -557,7 +557,6 @@ |
557 | 557 |
<select onChange={handleSelectUserData} value={selectUserData}> |
558 | 558 |
<option value="이름">이름</option> |
559 | 559 |
<option value="아이디">아이디</option> |
560 |
- <option value="등록번호">등록번호</option> |
|
561 | 560 |
</select> |
562 | 561 |
<input type="text" /> |
563 | 562 |
<Button |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?