
--- client/views/component/Table.jsx
+++ client/views/component/Table.jsx
... | ... | @@ -1,7 +1,52 @@ |
1 | 1 |
import React from "react"; |
2 |
+import Button from "./Button.jsx"; |
|
2 | 3 |
// import styled from "styled-components"; |
3 | 4 |
|
4 |
-export default function Table({ head, contents, contentKey, onClick, className}) { |
|
5 |
+export default function Table({ head, contents, contentKey, onClick, className, page}) { |
|
6 |
+ const [modalOpen, setModalOpen] = React.useState(false); |
|
7 |
+ const openModal = () => { |
|
8 |
+ setModalOpen(true); |
|
9 |
+ }; |
|
10 |
+ |
|
11 |
+ const [modalOpen2, setModalOpen2] = React.useState(false); |
|
12 |
+ const openModal2 = () => { |
|
13 |
+ setModalOpen2(true); |
|
14 |
+ }; |
|
15 |
+ |
|
16 |
+ |
|
17 |
+ const buttonPrint = () => { |
|
18 |
+ if(page == 'mySenior'){ |
|
19 |
+ return( |
|
20 |
+ <td> |
|
21 |
+ <Button |
|
22 |
+ className={"btn-small gray-btn"} |
|
23 |
+ btnName={"보기"} |
|
24 |
+ onClick={openModal} |
|
25 |
+ /> |
|
26 |
+ </td>) |
|
27 |
+ } |
|
28 |
+ else if(page == 'allSenior'){ |
|
29 |
+ return( |
|
30 |
+ <> |
|
31 |
+ <td> |
|
32 |
+ <Button |
|
33 |
+ className={"btn-small gray-btn"} |
|
34 |
+ btnName={"선택"} |
|
35 |
+ onClick={openModal2} |
|
36 |
+ /> |
|
37 |
+ </td> |
|
38 |
+ <td> |
|
39 |
+ <Button |
|
40 |
+ className={"btn-small gray-btn"} |
|
41 |
+ btnName={"보기"} |
|
42 |
+ onClick={openModal} |
|
43 |
+ /> |
|
44 |
+ </td> |
|
45 |
+ </> |
|
46 |
+ ) |
|
47 |
+ } |
|
48 |
+ } |
|
49 |
+ |
|
5 | 50 |
return ( |
6 | 51 |
<table className={className}> |
7 | 52 |
<thead> |
... | ... | @@ -15,14 +60,27 @@ |
15 | 60 |
{contents.map((i, index) => { |
16 | 61 |
return ( |
17 | 62 |
<tr key={index}> |
18 |
- {contentKey.map((kes) => { |
|
19 |
- return <td onClick={onClick}>{i[kes]}</td>; |
|
20 |
- })} |
|
63 |
+ {/* // <td>{i.rn}</td> |
|
64 |
+ // <td>{i.user_name}</td> |
|
65 |
+ // <td>{i.user_phonenumber}</td> |
|
66 |
+ // <td>{i.user_gender}</td> |
|
67 |
+ // <td>{i.user_birth}</td> |
|
68 |
+ // <td>{i.user_address}</td> |
|
69 |
+ // {buttonPrint()} */} |
|
70 |
+ {contentKey.map((kes) => { |
|
71 |
+ return ( |
|
72 |
+ <> |
|
73 |
+ <td onClick={onClick}>{i[kes]}</td> |
|
74 |
+ </> |
|
75 |
+ ) |
|
76 |
+ })} |
|
77 |
+ {buttonPrint()} |
|
21 | 78 |
</tr> |
22 | 79 |
); |
23 | 80 |
})} |
24 | 81 |
</tbody> |
25 | 82 |
</table> |
83 |
+ |
|
26 | 84 |
); |
27 | 85 |
} |
28 | 86 |
|
--- client/views/pages/user_management/UserAuthoriySelect_agency.jsx
+++ client/views/pages/user_management/UserAuthoriySelect_agency.jsx
... | ... | @@ -9,9 +9,10 @@ |
9 | 9 |
// 화면 진입 시 탭 별 노출될ㄹ 리스트 초기화 |
10 | 10 |
const [subjectList, setSubjectList] = React.useState([]); |
11 | 11 |
const [subjectMyList, setSubjectMyList] = React.useState([]); |
12 |
- |
|
12 |
+ |
|
13 | 13 |
// ------ 등록 버튼 클릭 시 노출되는 모달 데이터 ------// |
14 | 14 |
// 사용자 등록 시 초기값 세팅 |
15 |
+ |
|
15 | 16 |
const [userName, setUserName] = React.useState(""); |
16 | 17 |
const [gender, setGender] = React.useState(""); |
17 | 18 |
const [brith, setBrith] = React.useState(""); |
... | ... | @@ -22,10 +23,25 @@ |
22 | 23 |
const [medicineD, setMedicineD] = React.useState(false); |
23 | 24 |
const [medication, setMedication] = React.useState(""); |
24 | 25 |
const [note, setNote] = React.useState(""); |
25 |
- |
|
26 |
+ |
|
27 |
+ // 등록 후 초기화 진행 |
|
28 |
+ const dataReset = () => { |
|
29 |
+ setUserName(""); |
|
30 |
+ setGender(""); |
|
31 |
+ setBrith(""); |
|
32 |
+ setTelNum(""); |
|
33 |
+ setHomeAddress(""); |
|
34 |
+ setMedicineM(""); |
|
35 |
+ setMedicineL(""); |
|
36 |
+ setMedicineD(""); |
|
37 |
+ setMedication(""); |
|
38 |
+ setNote(""); |
|
39 |
+ } |
|
26 | 40 |
// 변경되는 데이터 Handler |
27 | 41 |
const handleUserName = (e) => { |
42 |
+ |
|
28 | 43 |
setUserName(e.target.value); |
44 |
+ |
|
29 | 45 |
}; |
30 | 46 |
const handleGender = (e) => { |
31 | 47 |
setGender(e.target.value); |
... | ... | @@ -34,7 +50,7 @@ |
34 | 50 |
setBrith(e.target.value); |
35 | 51 |
}; |
36 | 52 |
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`); |
|
53 |
+ e.target.value = e.target.value.replace(/[^0-9]/g, '').replace(/^(\d{2,3})(\d{3,4})(\d{4})$/, `$1-$2-$3`); |
|
38 | 54 |
setTelNum(e.target.value); |
39 | 55 |
}; |
40 | 56 |
const handleHomeAddress = (e) => { |
... | ... | @@ -57,82 +73,100 @@ |
57 | 73 |
}; |
58 | 74 |
|
59 | 75 |
// 대상자 등록 함수 |
60 |
- const seniorInsert = () => { |
|
61 |
- // userName,gender,brith, telNum, homeAddress, note, medicineM, medicineL, medicineD |
|
62 |
- // console.log("userName : ",userName); |
|
63 |
- // console.log("gender : ",gender); |
|
64 |
- // console.log("brith : ",brith); |
|
65 |
- // console.log("telNum : ",telNum); |
|
66 |
- // console.log("homeAddress : ",homeAddress); |
|
67 |
- // console.log("note : ",note); |
|
68 |
- // console.log("medicineM : ",medicineM); |
|
69 |
- // console.log("medicineL : ",medicineL); |
|
70 |
- // console.log("medicineD : ",medicineD); |
|
76 |
+ const InsertSenior = () => { |
|
71 | 77 |
var insertBtn = confirm("등록하시겠습니까?"); |
72 |
- if(insertBtn){ |
|
73 |
- fetch("/user/userInsert_userMadicationInsert.json", { |
|
74 |
- method: "POST", |
|
75 |
- headers: { |
|
76 |
- 'Content-Type': 'application/json; charset=UTF-8' |
|
77 |
- }, |
|
78 |
- body: JSON.stringify({ |
|
79 |
- userName:userName, |
|
80 |
- gender:gender, |
|
81 |
- brith :brith, |
|
82 |
- userTel :telNum, |
|
83 |
- homeAddress:homeAddress, |
|
84 |
- medicineM:medicineM, |
|
85 |
- medicineL:medicineL, |
|
86 |
- medicineD:medicineD, |
|
87 |
- medication:medication, |
|
88 |
- note:note, |
|
89 |
- agancyId:'agency1', |
|
90 |
- govId:'government1', |
|
91 |
- userCode : '4' |
|
92 |
- }), |
|
93 |
- }).then((response) => response.json()).then((data) => { |
|
94 |
- alert("등록 되었습니다."); |
|
95 |
- }).catch((error) => { |
|
96 |
- console.log('selectNotice() /Notice/selectNotice.json error : ', error); |
|
97 |
- }); |
|
98 |
- }else{ |
|
99 |
- return; |
|
78 |
+ if (insertBtn) { |
|
79 |
+ InsertUserData(); |
|
80 |
+ alert("등록 되었습니다."); |
|
81 |
+ dataReset(); |
|
82 |
+ closeModal3(); |
|
83 |
+ } else { |
|
84 |
+ return; |
|
100 | 85 |
} |
101 |
- |
|
86 |
+ |
|
87 |
+ }; |
|
88 |
+ // 대상자 정보 등록을 위한 함수 |
|
89 |
+ const InsertUserData = () => { |
|
90 |
+ fetch("/user/insertSeniorData.json", { |
|
91 |
+ method: "POST", |
|
92 |
+ headers: { |
|
93 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
94 |
+ }, |
|
95 |
+ body: JSON.stringify({ |
|
96 |
+ userName: userName, |
|
97 |
+ gender: gender, |
|
98 |
+ brith: brith, |
|
99 |
+ userTel: telNum, |
|
100 |
+ homeAddress: homeAddress, |
|
101 |
+ agancyId: 'agency1', |
|
102 |
+ govId: 'government1', |
|
103 |
+ userCode: '4' |
|
104 |
+ }), |
|
105 |
+ }).then((response) => response.json()).then((data) => { |
|
106 |
+ console.log("대상자 정보 등록"); |
|
107 |
+ InsertUserPillData(); |
|
108 |
+ }).catch((error) => { |
|
109 |
+ console.log('insertSeniorData() /Notice/insertSeniorData.json error : ', error); |
|
110 |
+ }); |
|
111 |
+ }; |
|
112 |
+ // 대상자 약 복용 정보 등록을 위한 함수 |
|
113 |
+ const InsertUserPillData = () => { |
|
114 |
+ fetch("/user/insertSeniorMadication.json", { |
|
115 |
+ method: "POST", |
|
116 |
+ headers: { |
|
117 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
118 |
+ }, |
|
119 |
+ body: JSON.stringify({ |
|
120 |
+ userTel: telNum, |
|
121 |
+ medicineM: medicineM, |
|
122 |
+ medicineL: medicineL, |
|
123 |
+ medicineD: medicineD, |
|
124 |
+ medication: medication, |
|
125 |
+ note: note, |
|
126 |
+ }), |
|
127 |
+ }).then((response) => response.json()).then((data) => { |
|
128 |
+ console.log("약 정보 등록"); |
|
129 |
+ }).catch((error) => { |
|
130 |
+ console.log('InsertUserPillData() /user/insertSeniorMadication.json error : ', error); |
|
131 |
+ }); |
|
102 | 132 |
}; |
103 | 133 |
|
104 | 134 |
const getSelectSubjectList = () => { |
105 |
- fetch("/user/selectSubjectList.json", { |
|
106 |
- method: "POST", |
|
107 |
- headers: { |
|
108 |
- 'Content-Type': 'application/json; charset=UTF-8' |
|
109 |
- }, |
|
110 |
- }).then((response) => response.json()).then((data) => { |
|
111 |
- const rowData = data; |
|
112 |
- console.log(data); |
|
113 |
- setSubjectList(rowData) |
|
135 |
+ fetch("/user/selectUserList.json", { |
|
136 |
+ method: "POST", |
|
137 |
+ headers: { |
|
138 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
139 |
+ }, |
|
140 |
+ body: JSON.stringify({ |
|
141 |
+ userCode: '4', |
|
142 |
+ }), |
|
143 |
+ }).then((response) => response.json()).then((data) => { |
|
144 |
+ const rowData = data; |
|
145 |
+ console.log(data); |
|
146 |
+ setSubjectList(rowData) |
|
114 | 147 |
|
115 |
- }).catch((error) => { |
|
116 |
- console.log('getSelectSubjectList() /user/selectSubjectList.json error : ', error); |
|
117 |
- }); |
|
148 |
+ }).catch((error) => { |
|
149 |
+ console.log('getSelectSubjectList() /user/selectUserList.json error : ', error); |
|
150 |
+ }); |
|
118 | 151 |
}; |
119 | 152 |
|
120 | 153 |
const getSelectMySubjectList = () => { |
121 |
- fetch("/user/selectMySubjectList.json", { |
|
122 |
- method: "POST", |
|
123 |
- headers: { |
|
124 |
- 'Content-Type': 'application/json; charset=UTF-8' |
|
125 |
- }, |
|
126 |
- body: JSON.stringify({ |
|
127 |
- agancyId: 'agency1', |
|
128 |
- }), |
|
129 |
- }).then((response) => response.json()).then((data) => { |
|
130 |
- const rowData = data; |
|
131 |
- console.log(data); |
|
132 |
- setSubjectMyList(rowData) |
|
133 |
- }).catch((error) => { |
|
134 |
- console.log('getSubjectMySelect() /user/selectMySubjectList.json error : ', error); |
|
135 |
- }); |
|
154 |
+ fetch("/user/selectMyUserList.json", { |
|
155 |
+ method: "POST", |
|
156 |
+ headers: { |
|
157 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
158 |
+ }, |
|
159 |
+ body: JSON.stringify({ |
|
160 |
+ agancyId: 'agency1', |
|
161 |
+ userCode: '4', |
|
162 |
+ }), |
|
163 |
+ }).then((response) => response.json()).then((data) => { |
|
164 |
+ const rowData = data; |
|
165 |
+ console.log(data); |
|
166 |
+ setSubjectMyList(rowData) |
|
167 |
+ }).catch((error) => { |
|
168 |
+ console.log('getSubjectMySelect() /user/selectMyUserList.json error : ', error); |
|
169 |
+ }); |
|
136 | 170 |
}; |
137 | 171 |
|
138 | 172 |
const navigate = useNavigate(); |
... | ... | @@ -181,7 +215,7 @@ |
181 | 215 |
"생년월일", |
182 | 216 |
"주소", |
183 | 217 |
"보호자", |
184 |
- |
|
218 |
+ |
|
185 | 219 |
]; |
186 | 220 |
const key1 = [ |
187 | 221 |
// "No", "name", "Id", "call", "gender", "birth", "address", "management" |
... | ... | @@ -339,12 +373,13 @@ |
339 | 373 |
id: 1, |
340 | 374 |
title: "내가 관리하는 대상자", |
341 | 375 |
description: ( |
342 |
- |
|
376 |
+ |
|
343 | 377 |
<Table |
344 | 378 |
className={"protector-user"} |
345 | 379 |
head={thead1} |
346 | 380 |
contents={subjectMyList} |
347 | 381 |
contentKey={key1} |
382 |
+ page={"mySenior"} |
|
348 | 383 |
/> |
349 | 384 |
), |
350 | 385 |
}, |
... | ... | @@ -357,6 +392,7 @@ |
357 | 392 |
head={thead2} |
358 | 393 |
contents={subjectList} |
359 | 394 |
contentKey={key2} |
395 |
+ page={"allSenior"} |
|
360 | 396 |
/> |
361 | 397 |
), |
362 | 398 |
}, |
... | ... | @@ -429,7 +465,7 @@ |
429 | 465 |
</Modal> |
430 | 466 |
<Modal open={modalOpen2} close={closeModal2} header="담당자 배정"> |
431 | 467 |
<div className="board-wrap"> |
432 |
- <SubTitle explanation={"담당자 선택"} className="margin-bottom"/> |
|
468 |
+ <SubTitle explanation={"담당자 선택"} className="margin-bottom" /> |
|
433 | 469 |
<div className="flex-start protectorlist margin-bottom5"> |
434 | 470 |
<input type="text" list="protectorlist" /> |
435 | 471 |
<datalist id="protectorlist"> |
... | ... | @@ -456,9 +492,9 @@ |
456 | 492 |
</Modal> |
457 | 493 |
<Modal open={modalOpen3} close={closeModal3} header="대상자 등록"> |
458 | 494 |
<div className="board-wrap"> |
459 |
- <SubTitle explanation={"회원 등록 시 ID는 연락처, 패스워드는 생년월일 8자리입니다."} className="margin-bottom"/> |
|
495 |
+ <SubTitle explanation={"회원 등록 시 ID는 연락처, 패스워드는 생년월일 8자리입니다."} className="margin-bottom" /> |
|
460 | 496 |
<table className="margin-bottom2 senior-insert"> |
461 |
- {/* <tr> |
|
497 |
+ {/* <tr> |
|
462 | 498 |
<th>대상자등록번호</th> |
463 | 499 |
<td colSpan={3} className="flex"> |
464 | 500 |
<input type="text" placeholder="생성하기 버튼 클릭 시 자동으로 생성됩니다."/> |
... | ... | @@ -486,7 +522,7 @@ |
486 | 522 |
</td> |
487 | 523 |
</tr> |
488 | 524 |
<tr> |
489 |
- <th>생년월일</th> |
|
525 |
+ <th>생년월일</th> |
|
490 | 526 |
<td> |
491 | 527 |
<div className="flex"> |
492 | 528 |
<input type='date' value={brith} onChange={handleBrithday} /> |
... | ... | @@ -496,7 +532,7 @@ |
496 | 532 |
<td> |
497 | 533 |
<input type="text" /> |
498 | 534 |
</td> */} |
499 |
- |
|
535 |
+ |
|
500 | 536 |
</tr> |
501 | 537 |
<tr> |
502 | 538 |
<th>연락처</th> |
... | ... | @@ -513,10 +549,10 @@ |
513 | 549 |
<tr> |
514 | 550 |
<th>필요 복약</th> |
515 | 551 |
<td> |
516 |
- <div className="flex"> |
|
517 |
- <input type="checkbox" name="medicationSelect" checked={medicineM} onClick={(e) => {handleMedicineM(e)}} /><label for="medicationTime">아침</label> |
|
518 |
- <input type="checkbox" name="medicationSelect" checked={medicineL} onClick={(e) => {handleMedicineL(e)}}/><label for="medicationTime">점심</label> |
|
519 |
- <input type="checkbox" name="medicationSelect" checked={medicineD} onClick={(e) => {handleMedicineD(e)}}/><label for="medicationTime">저녁</label> |
|
552 |
+ <div className="flex"> |
|
553 |
+ <input type="checkbox" name="medicationSelect" checked={medicineM} onClick={(e) => { handleMedicineM(e) }} /><label for="medicationTime">아침</label> |
|
554 |
+ <input type="checkbox" name="medicationSelect" checked={medicineL} onClick={(e) => { handleMedicineL(e) }} /><label for="medicationTime">점심</label> |
|
555 |
+ <input type="checkbox" name="medicationSelect" checked={medicineD} onClick={(e) => { handleMedicineD(e) }} /><label for="medicationTime">저녁</label> |
|
520 | 556 |
</div> |
521 | 557 |
</td> |
522 | 558 |
</tr> |
... | ... | @@ -532,7 +568,7 @@ |
532 | 568 |
<textarea className="note" cols="30" rows="2" value={note} onChange={handleNote}></textarea> |
533 | 569 |
</td> |
534 | 570 |
</tr> |
535 |
- |
|
571 |
+ |
|
536 | 572 |
{/* <tr> |
537 | 573 |
<th>기저질환</th> |
538 | 574 |
<td colSpan={3}> |
... | ... | @@ -540,15 +576,15 @@ |
540 | 576 |
</td> |
541 | 577 |
</tr> */} |
542 | 578 |
</table> |
543 |
- <div className="btn-wrap flex-center"> |
|
544 |
- <Button |
|
545 |
- className={"btn-small green-btn"} |
|
546 |
- btnName={"등록"} |
|
547 |
- onClick={() => { |
|
548 |
- seniorInsert(userName,gender,brith, telNum, homeAddress, note, medicineM, medicineL, medicineD) |
|
549 |
- }} |
|
550 |
- /> |
|
551 |
- </div> |
|
579 |
+ <div className="btn-wrap flex-center"> |
|
580 |
+ <Button |
|
581 |
+ className={"btn-small green-btn"} |
|
582 |
+ btnName={"등록"} |
|
583 |
+ onClick={() => { |
|
584 |
+ InsertSenior(userName, gender, brith, telNum, homeAddress, note, medicineM, medicineL, medicineD) |
|
585 |
+ }} |
|
586 |
+ /> |
|
587 |
+ </div> |
|
552 | 588 |
</div> |
553 | 589 |
</Modal> |
554 | 590 |
|
... | ... | @@ -584,7 +620,7 @@ |
584 | 620 |
/> |
585 | 621 |
</div> |
586 | 622 |
<div className="btn-wrap flex-end"> |
587 |
- <Button className={"btn-small green-btn"} btnName={"등록"} onClick={openModal3}/> |
|
623 |
+ <Button className={"btn-small green-btn"} btnName={"등록"} onClick={openModal3} /> |
|
588 | 624 |
</div> |
589 | 625 |
<ul className="tab-content"> |
590 | 626 |
{data |
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?