
--- client/views/component/Modal_Guardian.jsx
+++ client/views/component/Modal_Guardian.jsx
... | ... | @@ -377,7 +377,7 @@ |
377 | 377 |
</div> |
378 | 378 |
</td> |
379 | 379 |
</tr> |
380 |
- {CommonUtil.isEmpty(guardian['user_phonenumber']) == false && isNewGuardian ? ( |
|
380 |
+ {isNewGuardian ? ( |
|
381 | 381 |
<tr> |
382 | 382 |
<th><span style={{ color: "red" }}>*</span>연락처</th> |
383 | 383 |
<td colSpan={3}> |
--- client/views/pages/equipment/GovernmentEquipmentSelect.jsx
+++ client/views/pages/equipment/GovernmentEquipmentSelect.jsx
... | ... | @@ -198,6 +198,7 @@ |
198 | 198 |
'equipment_update_datetime': null, |
199 | 199 |
'equipment_update_user_id': null, |
200 | 200 |
'government_id': defaultGovernmentId, |
201 |
+ 'agency_id': defaultAgencyId, |
|
201 | 202 |
'senior_id': null |
202 | 203 |
} |
203 | 204 |
//장비 |
... | ... | @@ -374,6 +375,81 @@ |
374 | 375 |
}; |
375 | 376 |
|
376 | 377 |
|
378 |
+ //장비 대여 모달 여부 |
|
379 |
+ const [modalRentalIsOpen, setModalRentalIsOpen] = React.useState(false); |
|
380 |
+ //장비 대여 오픈 |
|
381 |
+ const modalRentalOpen = (item) => { |
|
382 |
+ setSelectEquipment(item); |
|
383 |
+ mySenior['search']['agency_id'] = item['agency_id']; |
|
384 |
+ mySeniorSelectList(1); |
|
385 |
+ setModalRentalIsOpen(true); |
|
386 |
+ }; |
|
387 |
+ //장비 대여 닫기 |
|
388 |
+ const modalRentalClose = () => { |
|
389 |
+ setModalRentalIsOpen(false); |
|
390 |
+ }; |
|
391 |
+ |
|
392 |
+ //장비 대여 등록 정보 |
|
393 |
+ const [selectEquipment, setSelectEquipment] = React.useState() |
|
394 |
+ |
|
395 |
+ //장비 대여 등록 |
|
396 |
+ const equipmentRentalInsert = (seniorId) => { |
|
397 |
+ if (confirm('해당 장비를 추가하시겠습니까?') == false) { |
|
398 |
+ return; |
|
399 |
+ } |
|
400 |
+ |
|
401 |
+ selectEquipment['senior_id'] = seniorId; |
|
402 |
+ selectEquipment['rental_start_date'] = new Date(); |
|
403 |
+ |
|
404 |
+ fetch("/equipment/equipmentRentalInsert.json", { |
|
405 |
+ method: "POST", |
|
406 |
+ headers: { |
|
407 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
408 |
+ }, |
|
409 |
+ body: JSON.stringify(selectEquipment), |
|
410 |
+ }).then((response) => response.json()).then((data) => { |
|
411 |
+ console.log("장비 대여 등록 결과(건수) : ", data); |
|
412 |
+ if (data > 0) { |
|
413 |
+ alert("추가완료"); |
|
414 |
+ modalRentalClose(); |
|
415 |
+ } else { |
|
416 |
+ alert("장비추가에 실패하였습니다. 관리자에게 문의바랍니다."); |
|
417 |
+ } |
|
418 |
+ }).catch((error) => { |
|
419 |
+ console.log('seniorSelectOne() /user/seniorSelectOne.json error : ', error); |
|
420 |
+ }); |
|
421 |
+ }; |
|
422 |
+ |
|
423 |
+ //보호사(간호사)의 돌봄 대상자(시니어) |
|
424 |
+ const [mySenior, setMySenior] = React.useState({ |
|
425 |
+ seniorList: [], |
|
426 |
+ seniorListCount: 0, |
|
427 |
+ search: { |
|
428 |
+ 'government_id': defaultGovernmentId, |
|
429 |
+ 'agency_id': defaultAgencyId, |
|
430 |
+ 'currentPage': 1, |
|
431 |
+ 'perPage': 5, |
|
432 |
+ } |
|
433 |
+ }); |
|
434 |
+ //보호사(간호사)의 돌봄 대상자(시니어) 목록 조회 |
|
435 |
+ const mySeniorSelectList = (currentPage) => { |
|
436 |
+ mySenior.search.currentPage = CommonUtil.isEmpty(currentPage) ? 1 : currentPage; |
|
437 |
+ |
|
438 |
+ fetch("/user/seniorSelectList.json", { |
|
439 |
+ method: "POST", |
|
440 |
+ headers: { |
|
441 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
442 |
+ }, |
|
443 |
+ body: JSON.stringify(mySenior.search), |
|
444 |
+ }).then((response) => response.json()).then((data) => { |
|
445 |
+ data.search = mySenior.search; |
|
446 |
+ console.log("보호사(간호사)의 돌봄 대상자(시니어) 목록 조회 : ", data); |
|
447 |
+ setMySenior(data); |
|
448 |
+ }).catch((error) => { |
|
449 |
+ console.log('seniorSelectList() /user/seniorSelectList.json error : ', error); |
|
450 |
+ }); |
|
451 |
+ } |
|
452 |
+ |
|
377 | 453 |
//Mounted |
378 | 454 |
React.useEffect(() => { |
379 | 455 |
orgSelectListOfHierarchy(); |
... | ... | @@ -422,7 +498,7 @@ |
422 | 498 |
})} |
423 | 499 |
{CommonUtil.isEmpty(rentalEquipment.equipmentList) ? |
424 | 500 |
<tr> |
425 |
- <td colSpan={9}>조회된 데이터가 없습니다</td> |
|
501 |
+ <td colSpan={10}>조회된 데이터가 없습니다</td> |
|
426 | 502 |
</tr> |
427 | 503 |
: null} |
428 | 504 |
</tbody> |
... | ... | @@ -436,6 +512,8 @@ |
436 | 512 |
/> |
437 | 513 |
</> |
438 | 514 |
); |
515 |
+ |
|
516 |
+ |
|
439 | 517 |
//현재 탭 Index |
440 | 518 |
const [tabIndex, setTabIndex] = React.useState(0); |
441 | 519 |
//탭 초기화 |
... | ... | @@ -446,15 +524,6 @@ |
446 | 524 |
<div className="flex equip-tab"> |
447 | 525 |
<SubTitle explanation={"현재 기관에 입고된 장비 중 돌봄 대상자에게 대여하지 않은 장비 목록입니다."} /> |
448 | 526 |
<div className="btn-wrap flex-end margin-bottom "> |
449 |
- <button className={"btn-small gray-btn"} |
|
450 |
- onClick={() => navigate("/UserSelect", { |
|
451 |
- state: { |
|
452 |
- 'government_id': defaultGovernmentId, |
|
453 |
- 'agency_id': null, |
|
454 |
- 'tabActiveByRoleType': 'ROLE_SENIOR', |
|
455 |
- } |
|
456 |
- })}>대상자에게 장비대여</button> |
|
457 |
- |
|
458 | 527 |
<button className={"btn-small gray-btn"} onClick={() => { modalEquipmentOpen() }}>장비 등록</button> |
459 | 528 |
</div> |
460 | 529 |
</div> |
... | ... | @@ -466,6 +535,8 @@ |
466 | 535 |
<th>시리얼넘버</th> |
467 | 536 |
<th>입고일자</th> |
468 | 537 |
<th>장비상태</th> |
538 |
+ <th>기관</th> |
|
539 |
+ <th>장비대여</th> |
|
469 | 540 |
<th>관리</th> |
470 | 541 |
</tr> |
471 | 542 |
</thead> |
... | ... | @@ -478,6 +549,24 @@ |
478 | 549 |
<td data-label="시리얼넘버">{item['equipment_serial_number']}</td> |
479 | 550 |
<td data-label="입고일자">{item['equipment_stock_date']}</td> |
480 | 551 |
<td data-label="장비상태">{equipmentStates[item['equipment_state']]}</td> |
552 |
+ <td data-label="기관"> |
|
553 |
+ {orgListOfHierarchy.map((item1, idx1) => { |
|
554 |
+ return ( |
|
555 |
+ item1['agencyList'] != undefined && item1['agencyList'] != null ? |
|
556 |
+ item1['agencyList'].map((item2, idx2) => { |
|
557 |
+ return ( |
|
558 |
+ item['agency_id'] == item2['agency_id'] ? |
|
559 |
+ item2['agency_name'] |
|
560 |
+ : null |
|
561 |
+ ) |
|
562 |
+ }) |
|
563 |
+ : null |
|
564 |
+ ) |
|
565 |
+ })} |
|
566 |
+ </td> |
|
567 |
+ <td cata-label="장비대여"> |
|
568 |
+ <button className={"btn-small gray-btn"} onClick={() => modalRentalOpen(item)}>장비 배포</button> |
|
569 |
+ </td> |
|
481 | 570 |
<td data-label="관리"> |
482 | 571 |
<button className={"btn-small gray-btn"} onClick={() => modalEquipmentOpen(item)}>정보 수정</button> |
483 | 572 |
</td> |
... | ... | @@ -486,7 +575,7 @@ |
486 | 575 |
})} |
487 | 576 |
{CommonUtil.isEmpty(deliveryEquipment.equipmentList) ? |
488 | 577 |
<tr> |
489 |
- <td colSpan={5}>조회된 데이터가 없습니다</td> |
|
578 |
+ <td colSpan={8}>조회된 데이터가 없습니다</td> |
|
490 | 579 |
</tr> |
491 | 580 |
: null} |
492 | 581 |
</tbody> |
... | ... | @@ -498,13 +587,12 @@ |
498 | 587 |
maxRange={5} |
499 | 588 |
click={deliveryEquipmentSelectList} |
500 | 589 |
/> |
501 |
- </div> |
|
590 |
+ </div > |
|
502 | 591 |
) |
503 | 592 |
}, { |
504 | 593 |
title: `사용중인 장비 (${rentalEquipment.equipmentListCount})`, |
505 | 594 |
content: ( |
506 | 595 |
<div> |
507 |
- |
|
508 | 596 |
<div className="flex-align-start userauthoriylist gap5"> |
509 | 597 |
<div className="left"> |
510 | 598 |
<SubTitle explanation={"기관 리스트"} /> |
... | ... | @@ -563,7 +651,6 @@ |
563 | 651 |
|
564 | 652 |
return ( |
565 | 653 |
<main> |
566 |
- |
|
567 | 654 |
<Modal open={modalEquipmentIsOpen} close={modalEquipmentClose} header="장비 등록"> |
568 | 655 |
<div className="board-wrap"> |
569 | 656 |
<div> |
... | ... | @@ -648,6 +735,30 @@ |
648 | 735 |
</td> |
649 | 736 |
</tr> |
650 | 737 |
: null} |
738 |
+ <tr> |
|
739 |
+ <th>시행기관 선택</th> |
|
740 |
+ <td> |
|
741 |
+ {orgListOfHierarchy.map((item, idx) => { |
|
742 |
+ return ( |
|
743 |
+ <select defaultValue={item['agencyList'][0]['agency_id']} onChange={(e) => { |
|
744 |
+ console.log('e.target.value : ', e.target.value); |
|
745 |
+ equipmentValueChange('agency_id', e.target.value); |
|
746 |
+ }}> |
|
747 |
+ {item['agencyList'] != undefined && item['agencyList'] != null ? |
|
748 |
+ item['agencyList'].map((item2, idx2) => { |
|
749 |
+ return ( |
|
750 |
+ <option key={idx2} value={item2['agency_id']} |
|
751 |
+ selected={equipment['agency_id'] == item2['agency_id']}> |
|
752 |
+ {item2['agency_name']} |
|
753 |
+ </option> |
|
754 |
+ ) |
|
755 |
+ }) |
|
756 |
+ : null} |
|
757 |
+ </select> |
|
758 |
+ ) |
|
759 |
+ })} |
|
760 |
+ </td> |
|
761 |
+ </tr> |
|
651 | 762 |
</tbody> |
652 | 763 |
</table> |
653 | 764 |
</div> |
... | ... | @@ -661,6 +772,51 @@ |
661 | 772 |
</> |
662 | 773 |
} |
663 | 774 |
</div> |
775 |
+ </div> |
|
776 |
+ </Modal> |
|
777 |
+ |
|
778 |
+ <Modal open={modalRentalIsOpen} close={modalRentalClose} header="장비 배포 시니어 선택"> |
|
779 |
+ <div className="board-wrap"> |
|
780 |
+ <table className={"protector-user"}> |
|
781 |
+ <thead> |
|
782 |
+ <tr> |
|
783 |
+ <th>No</th> |
|
784 |
+ <th>소속기관명</th> |
|
785 |
+ <th>이름</th> |
|
786 |
+ <th>생년월일</th> |
|
787 |
+ <th>성별</th> |
|
788 |
+ <th>배포</th> |
|
789 |
+ </tr> |
|
790 |
+ </thead> |
|
791 |
+ <tbody> |
|
792 |
+ {mySenior.seniorList.map((item, idx) => { |
|
793 |
+ return ( |
|
794 |
+ <tr key={idx}> |
|
795 |
+ <td data-label="No">{mySenior.seniorListCount - idx - (mySenior.search.currentPage - 1) * mySenior.search.perPage}</td> |
|
796 |
+ <td data-label="소속기관명">{item['agency_name']}</td> |
|
797 |
+ <td data-label="이름">{item['user_name']}</td> |
|
798 |
+ <td data-label="생년월일">{item['user_birth']}</td> |
|
799 |
+ <td data-label="성별">{item['user_gender']}</td> |
|
800 |
+ <td data-label="배포"> |
|
801 |
+ <button className="btn-small gray-btn" onClick={() => { equipmentRentalInsert(item['senior_id']) }}>배포하기</button> |
|
802 |
+ </td> |
|
803 |
+ </tr> |
|
804 |
+ ) |
|
805 |
+ })} |
|
806 |
+ {CommonUtil.isEmpty(mySenior.seniorList) ? |
|
807 |
+ <tr> |
|
808 |
+ <td colSpan={8}>조회된 데이터가 없습니다</td> |
|
809 |
+ </tr> |
|
810 |
+ : null} |
|
811 |
+ </tbody> |
|
812 |
+ </table> |
|
813 |
+ <Pagination |
|
814 |
+ currentPage={mySenior.search.currentPage} |
|
815 |
+ perPage={mySenior.search.perPage} |
|
816 |
+ totalCount={mySenior.seniorListCount} |
|
817 |
+ maxRange={5} |
|
818 |
+ click={mySeniorSelectList} |
|
819 |
+ /> |
|
664 | 820 |
</div> |
665 | 821 |
</Modal> |
666 | 822 |
|
... | ... | @@ -697,7 +853,6 @@ |
697 | 853 |
</div> |
698 | 854 |
</Modal> */} |
699 | 855 |
|
700 |
- |
|
701 | 856 |
<div className="search-management flex-end margin-bottom2 margin-top gap"> |
702 | 857 |
<select style={{ maxWidth: '150px' }} |
703 | 858 |
onChange={(e) => equipmentSearchChange('equipment_state', e.target.value)}> |
... | ... | @@ -724,40 +879,41 @@ |
724 | 879 |
<button className={"btn-small gray-btn"} style={{ maxWidth: '150px' }} onClick={equipmentSearching}>검색</button> |
725 | 880 |
</div> |
726 | 881 |
|
727 |
- {CommonUtil.isEmpty(state.loginUser) == false && (state.loginUser['authority'] == 'ROLE_ADMIN' || state.loginUser['authority'] == 'ROLE_GOVERNMENT') |
|
728 |
- ? ( |
|
729 |
- <div className="tab-container"> |
|
730 |
- <ul className="tab-menu flex-start"> |
|
731 |
- {tab.map((item, idx) => { |
|
732 |
- return ( |
|
733 |
- <li onClick={() => setTabIndex(idx)} className={idx == tabIndex ? 'active' : null}> |
|
734 |
- {item.title} |
|
735 |
- </li> |
|
736 |
- ) |
|
737 |
- })} |
|
738 |
- </ul> |
|
739 |
- <div className="content-wrap"> |
|
740 |
- <ul className="tab-content"> |
|
741 |
- <li> |
|
742 |
- {tab[tabIndex].content} |
|
743 |
- </li> |
|
882 |
+ { |
|
883 |
+ CommonUtil.isEmpty(state.loginUser) == false && (state.loginUser['authority'] == 'ROLE_ADMIN' || state.loginUser['authority'] == 'ROLE_GOVERNMENT') |
|
884 |
+ ? ( |
|
885 |
+ <div className="tab-container"> |
|
886 |
+ <ul className="tab-menu flex-start"> |
|
887 |
+ {tab.map((item, idx) => { |
|
888 |
+ return ( |
|
889 |
+ <li onClick={() => setTabIndex(idx)} className={idx == tabIndex ? 'active' : null}> |
|
890 |
+ {item.title} |
|
891 |
+ </li> |
|
892 |
+ ) |
|
893 |
+ })} |
|
744 | 894 |
</ul> |
745 |
- </div> |
|
746 |
- </div> |
|
747 |
- ) : ( |
|
748 |
- <div className="content-wrap"> |
|
749 |
- <DetailTitle contentTitle={"장비 사용 현황"} /> |
|
750 |
- <div className="board-wrap" style={{ marginTop: "3rem" }} > |
|
751 |
- <div className="btn-wrap margin-bottom"> |
|
752 |
- <div className="btn-wrap flex-end margin-bottom "> |
|
753 |
- <button className={"btn-small gray-btn"} onClick={() => (state.loginUser['authority'] == 'ROLE_AGENCYADMIN') ? navigate("/AgencyAdminSeniorSelect") : navigate("/AgencySeniorSelect")}>대상자 관리</button> |
|
754 |
- </div> |
|
755 |
- {rentalContent} |
|
895 |
+ <div className="content-wrap"> |
|
896 |
+ <ul className="tab-content"> |
|
897 |
+ <li> |
|
898 |
+ {tab[tabIndex].content} |
|
899 |
+ </li> |
|
900 |
+ </ul> |
|
756 | 901 |
</div> |
757 | 902 |
</div> |
758 |
- </div> |
|
759 |
- ) |
|
903 |
+ ) : ( |
|
904 |
+ <div className="content-wrap"> |
|
905 |
+ <DetailTitle contentTitle={"장비 사용 현황"} /> |
|
906 |
+ <div className="board-wrap" style={{ marginTop: "3rem" }} > |
|
907 |
+ <div className="btn-wrap margin-bottom"> |
|
908 |
+ <div className="btn-wrap flex-end margin-bottom "> |
|
909 |
+ <button className={"btn-small gray-btn"} onClick={() => (state.loginUser['authority'] == 'ROLE_AGENCYADMIN') ? navigate("/AgencyAdminSeniorSelect") : navigate("/AgencySeniorSelect")}>대상자 관리</button> |
|
910 |
+ </div> |
|
911 |
+ {rentalContent} |
|
912 |
+ </div> |
|
913 |
+ </div> |
|
914 |
+ </div> |
|
915 |
+ ) |
|
760 | 916 |
} |
761 |
- </main> |
|
917 |
+ </main > |
|
762 | 918 |
); |
763 | 919 |
} |
--- client/views/pages/senior_management/SeniorSelectOne.jsx
+++ client/views/pages/senior_management/SeniorSelectOne.jsx
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 |
import Pagination from "../../component/Pagination.jsx"; |
8 | 8 |
|
9 | 9 |
import CommonUtil from "../../../resources/js/CommonUtil.js"; |
10 |
+import { insert } from "@amcharts/amcharts5/.internal/core/util/Array.js"; |
|
10 | 11 |
|
11 | 12 |
|
12 | 13 |
export default function SeniorSelectOne() { |
... | ... | @@ -42,6 +43,56 @@ |
42 | 43 |
}); |
43 | 44 |
} |
44 | 45 |
|
46 |
+ // 시스템 코드 - 장비 상태 |
|
47 |
+ const [equipmentStates, setEquipmentStates] = React.useState({}); |
|
48 |
+ // 시스템 코드 - 장비 상태 조회 |
|
49 |
+ const equipmentStatesSelect = () => { |
|
50 |
+ console.log('equipmentStatesSelect Function Run'); |
|
51 |
+ |
|
52 |
+ //fetch post |
|
53 |
+ fetch("/common/systemCode/equipmentStatesSelect.json", { |
|
54 |
+ method: "POST", |
|
55 |
+ headers: { |
|
56 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
57 |
+ }, |
|
58 |
+ body: JSON.stringify({}) |
|
59 |
+ }).then((response) => response.json()).then((data) => { |
|
60 |
+ console.log('equipmentStatesSelect response : ', data); |
|
61 |
+ setEquipmentStates(data); |
|
62 |
+ }).catch((error) => { |
|
63 |
+ console.log('equipmentStatesSelect error : ', error); |
|
64 |
+ }); |
|
65 |
+ } |
|
66 |
+ |
|
67 |
+ //입고 및 미대여 장비 검색 정보 |
|
68 |
+ const [deliveryEquipmentSearch, setDeliveryEquipmentSearch] = React.useState({ |
|
69 |
+ 'government_id': location.state['government_id'], |
|
70 |
+ 'senior_id': 'IS_NULL', |
|
71 |
+ 'currentPage': 1, |
|
72 |
+ 'perPage': 10, |
|
73 |
+ }); |
|
74 |
+ //입고 및 미대여 목록 |
|
75 |
+ const [deliveryEquipment, setDeliveryEquipment] = React.useState({ equipmentList: [], equipmentListCount: 0 }); |
|
76 |
+ //입고 및 미대여 목록 조회 |
|
77 |
+ const deliveryEquipmentSelectList = (currentPage) => { |
|
78 |
+ deliveryEquipmentSearch.currentPage = CommonUtil.isEmpty(currentPage) ? 1 : currentPage; |
|
79 |
+ setDeliveryEquipmentSearch({ ...deliveryEquipmentSearch }); |
|
80 |
+ |
|
81 |
+ fetch("/equipment/equipmentSelectList.json", { |
|
82 |
+ method: "POST", |
|
83 |
+ headers: { |
|
84 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
85 |
+ }, |
|
86 |
+ body: JSON.stringify(deliveryEquipmentSearch) |
|
87 |
+ }).then((response) => response.json()).then((data) => { |
|
88 |
+ console.log('deliveryEquipmentSelectList response : ', data); |
|
89 |
+ setDeliveryEquipment(data); |
|
90 |
+ }).catch((error) => { |
|
91 |
+ console.log('deliveryEquipmentSelectList error : ', error); |
|
92 |
+ }); |
|
93 |
+ } |
|
94 |
+ |
|
95 |
+ |
|
45 | 96 |
|
46 | 97 |
//장비 대여 모달 여부 |
47 | 98 |
const [modalRentalIsOpen, setModalRentalIsOpen] = React.useState(false); |
... | ... | @@ -54,78 +105,28 @@ |
54 | 105 |
setModalRentalIsOpen(false); |
55 | 106 |
}; |
56 | 107 |
|
57 |
- // 시스템 코드 - 장비 상태 |
|
58 |
- const [equipmentStates, setEquipmentStates] = React.useState({}); |
|
59 |
- // 시스템 코드 - 장비 상태 조회 |
|
60 |
- const equipmentStatesSelect = () => { |
|
61 |
- console.log('equipmentStatesSelect Function Run'); |
|
62 |
- |
|
63 |
- //fetch post |
|
64 |
- fetch("/common/systemCode/equipmentStatesSelect.json", { |
|
65 |
- method: "POST", |
|
66 |
- headers: { |
|
67 |
- 'Content-Type': 'application/json; charset=UTF-8' |
|
68 |
- }, |
|
69 |
- body: JSON.stringify({}) |
|
70 |
- }).then((response) => response.json()).then((data) => { |
|
71 |
- console.log('equipmentStatesSelect response : ', data); |
|
72 |
- setEquipmentStates(data); |
|
73 |
- }).catch((error) => { |
|
74 |
- console.log('equipmentStatesSelect error : ', error); |
|
75 |
- }); |
|
76 |
- } |
|
77 |
- |
|
78 |
- //입고 및 미대여 장비 검색 정보 |
|
79 |
- const [deliveryEquipmentSearch, setDeliveryEquipmentSearch] = React.useState({ |
|
80 |
- 'government_id': location.state['government_id'], |
|
81 |
- 'senior_id': 'IS_NULL', |
|
82 |
- 'currentPage': 1, |
|
83 |
- 'perPage': 10, |
|
84 |
- }); |
|
85 |
- //입고 및 미대여 목록 |
|
86 |
- const [deliveryEquipment, setDeliveryEquipment] = React.useState({equipmentList: [], equipmentListCount: 0}); |
|
87 |
- //입고 및 미대여 목록 조회 |
|
88 |
- const deliveryEquipmentSelectList = (currentPage) => { |
|
89 |
- deliveryEquipmentSearch.currentPage = CommonUtil.isEmpty(currentPage) ? 1 : currentPage; |
|
90 |
- setDeliveryEquipmentSearch({...deliveryEquipmentSearch}); |
|
91 |
- |
|
92 |
- fetch("/equipment/equipmentSelectList.json", { |
|
93 |
- method: "POST", |
|
94 |
- headers: { |
|
95 |
- 'Content-Type': 'application/json; charset=UTF-8' |
|
96 |
- }, |
|
97 |
- body: JSON.stringify(deliveryEquipmentSearch) |
|
98 |
- }).then((response) => response.json()).then((data) => { |
|
99 |
- console.log('deliveryEquipmentSelectList response : ', data); |
|
100 |
- setDeliveryEquipment(data); |
|
101 |
- }).catch((error) => { |
|
102 |
- console.log('deliveryEquipmentSelectList error : ', error); |
|
103 |
- }); |
|
104 |
- } |
|
105 |
- |
|
106 |
- |
|
107 | 108 |
//장비 대여 등록 정보 |
108 | 109 |
const [equipmentRental, setEquipmentRental] = React.useState({ |
109 | 110 |
'senior_id': location.state['senior_id'], |
110 | 111 |
'rental_idx': 0, |
111 | 112 |
'rental_start_date': CommonUtil.getDate(), |
112 | 113 |
'rental_end_date': null, |
113 |
- 'rental_return_date': null |
|
114 |
+ 'rental_return_date': null |
|
114 | 115 |
}); |
115 | 116 |
|
116 | 117 |
//장비 대여 등록 |
117 | 118 |
const equipmentRentalInsert = (equipment) => { |
118 | 119 |
if (CommonUtil.isEmpty(equipmentRental['rental_start_date'])) { |
119 |
- alert("대여 시작일을 선택해 주세요."); |
|
120 |
- return; |
|
121 |
- } |
|
120 |
+ alert("대여 시작일을 선택해 주세요."); |
|
121 |
+ return; |
|
122 |
+ } |
|
122 | 123 |
if (confirm('해당 장비를 추가하시겠습니까?') == false) { |
123 | 124 |
return; |
124 | 125 |
} |
125 | 126 |
|
126 | 127 |
equipment['senior_id'] = location.state['senior_id']; |
127 | 128 |
equipment['rental_start_date'] = equipmentRental['rental_start_date']; |
128 |
- |
|
129 |
+ |
|
129 | 130 |
fetch("/equipment/equipmentRentalInsert.json", { |
130 | 131 |
method: "POST", |
131 | 132 |
headers: { |
... | ... | @@ -134,21 +135,92 @@ |
134 | 135 |
body: JSON.stringify(equipment), |
135 | 136 |
}).then((response) => response.json()).then((data) => { |
136 | 137 |
console.log("장비 대여 등록 결과(건수) : ", data); |
137 |
- if (data > 0) { |
|
138 |
+ if (data > 0) { |
|
138 | 139 |
alert("추가완료"); |
139 |
- modalRentalClose(); |
|
140 |
+ modalRentalClose(); |
|
140 | 141 |
equipmentSelectListBySenior(); |
141 | 142 |
deliveryEquipmentSelectList(1); |
142 |
- } else { |
|
143 |
- alert("장비추가에 실패하였습니다. 관리자에게 문의바랍니다."); |
|
144 |
- } |
|
143 |
+ } else { |
|
144 |
+ alert("장비추가에 실패하였습니다. 관리자에게 문의바랍니다."); |
|
145 |
+ } |
|
145 | 146 |
}).catch((error) => { |
146 | 147 |
console.log('seniorSelectOne() /user/seniorSelectOne.json error : ', error); |
147 | 148 |
}); |
148 | 149 |
}; |
149 | 150 |
|
151 |
+ //대상자 장비 목록 |
|
152 |
+ const [equipmentBySenior, setEquipmentBySenior] = React.useState({ equipmentList: [], equipmentListCount: 0 }); |
|
153 |
+ //대상자 장비 목록 조회 |
|
154 |
+ const equipmentSelectListBySenior = () => { |
|
155 |
+ fetch("/equipment/equipmentSelectList.json", { |
|
156 |
+ method: "POST", |
|
157 |
+ headers: { |
|
158 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
159 |
+ }, |
|
160 |
+ body: JSON.stringify(senior) |
|
161 |
+ }).then((response) => response.json()).then((data) => { |
|
162 |
+ console.log('equipmentSelectListBySenior response : ', data); |
|
163 |
+ setEquipmentBySenior(data); |
|
164 |
+ }).catch((error) => { |
|
165 |
+ console.log('equipmentSelectListBySenior error : ', error); |
|
166 |
+ }); |
|
167 |
+ } |
|
150 | 168 |
|
151 | 169 |
|
170 |
+ //장비 대여 종료 모달 여부 |
|
171 |
+ const [modalRentalEndIsOpen, setModalRentalEndIsOpen] = React.useState(false); |
|
172 |
+ const [rentalData, setRentalData] = React.useState({}); |
|
173 |
+ const [rentalEndDate, setRentalEndDate] = React.useState(); |
|
174 |
+ //장비 대여 종료 오픈 |
|
175 |
+ const modalRentalEndOpen = (item) => { |
|
176 |
+ setModalRentalEndIsOpen(true); |
|
177 |
+ setRentalData(item); |
|
178 |
+ setRentalEndDate(null); |
|
179 |
+ }; |
|
180 |
+ //장비 대여 종료 닫기 |
|
181 |
+ const modalRentalEndClose = () => { |
|
182 |
+ setModalRentalEndIsOpen(false); |
|
183 |
+ }; |
|
184 |
+ // 장비 대여 종료 |
|
185 |
+ const equipmentRentalEnd = (item, senior_delete) => { |
|
186 |
+ let insertBtn = ""; |
|
187 |
+ if (!senior_delete) { |
|
188 |
+ insertBtn = confirm("대여를 종료하시겠습니까?"); |
|
189 |
+ } else { |
|
190 |
+ insertBtn = true; |
|
191 |
+ } |
|
192 |
+ |
|
193 |
+ if (insertBtn) { |
|
194 |
+ if (CommonUtil.isEmpty(rentalEndDate) == false) { |
|
195 |
+ item['rental_end_date'] = rentalEndDate; |
|
196 |
+ } else { |
|
197 |
+ item['rental_end_date'] = new Date(); |
|
198 |
+ } |
|
199 |
+ |
|
200 |
+ fetch("/equipment/equipmentRentalUpdate.json", { |
|
201 |
+ method: "POST", |
|
202 |
+ headers: { |
|
203 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
204 |
+ }, |
|
205 |
+ body: JSON.stringify(item), |
|
206 |
+ }).then((response) => response.json()).then((data) => { |
|
207 |
+ console.log("장비 대여 결과(건수) : ", data); |
|
208 |
+ if (!senior_delete) { |
|
209 |
+ if (data > 0) { |
|
210 |
+ alert("대여 종료 되었습니다."); |
|
211 |
+ } else { |
|
212 |
+ alert("대여 종료에 실패하였습니다."); |
|
213 |
+ } |
|
214 |
+ equipmentSelectListBySenior(); |
|
215 |
+ modalRentalEndClose(); |
|
216 |
+ } else { |
|
217 |
+ return; |
|
218 |
+ } |
|
219 |
+ }).catch((error) => { |
|
220 |
+ console.log('equipmentRentalEnd() /equipment/equipmentRentalUpdate.json error : ', error); |
|
221 |
+ }); |
|
222 |
+ } |
|
223 |
+ } |
|
152 | 224 |
|
153 | 225 |
|
154 | 226 |
//시니어 정보 |
... | ... | @@ -217,9 +289,8 @@ |
217 | 289 |
modalGuardianOpen(); |
218 | 290 |
} |
219 | 291 |
|
220 |
- |
|
221 | 292 |
//대상자의 보호사 목록 |
222 |
- const [agent, setAgent] = React.useState({agentListBySenior: [], agentListCountBySenior: 0}); |
|
293 |
+ const [agent, setAgent] = React.useState({ agentListBySenior: [], agentListCountBySenior: 0 }); |
|
223 | 294 |
//대상자의 보호사 목록 조회 |
224 | 295 |
const agentSelectListBySenior = () => { |
225 | 296 |
fetch("/user/agentSelectListBySenior.json", { |
... | ... | @@ -235,27 +306,6 @@ |
235 | 306 |
console.log('agentSelectListBySenior() /user/agentSelectListBySenior.json error : ', error); |
236 | 307 |
}); |
237 | 308 |
} |
238 |
- |
|
239 |
- |
|
240 |
- //대상자 장비 목록 |
|
241 |
- const [equipmentBySenior, setEquipmentBySenior] = React.useState({equipmentList: [], equipmentListCount: 0}); |
|
242 |
- //대상자 장비 목록 조회 |
|
243 |
- const equipmentSelectListBySenior = () => { |
|
244 |
- fetch("/equipment/equipmentSelectList.json", { |
|
245 |
- method: "POST", |
|
246 |
- headers: { |
|
247 |
- 'Content-Type': 'application/json; charset=UTF-8' |
|
248 |
- }, |
|
249 |
- body: JSON.stringify(senior) |
|
250 |
- }).then((response) => response.json()).then((data) => { |
|
251 |
- console.log('equipmentSelectListBySenior response : ', data); |
|
252 |
- setEquipmentBySenior(data); |
|
253 |
- }).catch((error) => { |
|
254 |
- console.log('equipmentSelectListBySenior error : ', error); |
|
255 |
- }); |
|
256 |
- } |
|
257 |
- |
|
258 |
- |
|
259 | 309 |
|
260 | 310 |
//가입승인 |
261 | 311 |
const userUpdate = (user, callback) => { |
... | ... | @@ -280,11 +330,99 @@ |
280 | 330 |
}); |
281 | 331 |
} |
282 | 332 |
|
333 |
+ // 시니어 - 담당자 매칭 종료 |
|
334 |
+ const agentSeniorDelete = (agent_id, agent_match_idx, senior_delete) => { |
|
335 |
+ let insertBtn = ""; |
|
336 |
+ if (!senior_delete) { |
|
337 |
+ insertBtn = confirm("담당자 매칭을 종료하시겠습니까?"); |
|
338 |
+ } else { |
|
339 |
+ insertBtn = true; |
|
340 |
+ } |
|
341 |
+ |
|
342 |
+ if (insertBtn) { |
|
343 |
+ fetch("/user/agentSeniorDelete.json", { |
|
344 |
+ method: "POST", |
|
345 |
+ headers: { |
|
346 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
347 |
+ }, |
|
348 |
+ body: JSON.stringify({ |
|
349 |
+ agent_id: agent_id, |
|
350 |
+ senior_id: senior['senior_id'], |
|
351 |
+ agent_match_idx: agent_match_idx |
|
352 |
+ }), |
|
353 |
+ }).then((response) => response.json()).then((data) => { |
|
354 |
+ console.log("사용자 등록 결과(건수) : ", data); |
|
355 |
+ |
|
356 |
+ if (!senior_delete) { |
|
357 |
+ if (data > 0) { |
|
358 |
+ alert("담당자 매칭이 종료 되었습니다."); |
|
359 |
+ seniorSelectListByAgent(); |
|
360 |
+ } else { |
|
361 |
+ alert("담당자 매칭 종료에 실패하였습니다."); |
|
362 |
+ } |
|
363 |
+ } else { |
|
364 |
+ return; |
|
365 |
+ } |
|
366 |
+ }).catch((error) => { |
|
367 |
+ console.log('agentSeniorDelete() /user/agentSeniorDelete.json error : ', error); |
|
368 |
+ }); |
|
369 |
+ } |
|
370 |
+ } |
|
371 |
+ |
|
372 |
+ // 시니어 삭제 |
|
373 |
+ const seniorDelete = (senior) => { |
|
374 |
+ let insertBtn = confirm("삭제하시겠습니까?"); |
|
375 |
+ if (insertBtn) { |
|
376 |
+ // 보호사 매칭 종료 |
|
377 |
+ let agent_id = ""; |
|
378 |
+ let agent_match_idx = ""; |
|
379 |
+ agent.agentListBySenior.map((item, idx) => { |
|
380 |
+ if (item['senior_id'] = senior['senior_id'] && item['agent_match_state']) { |
|
381 |
+ agent_id = item['agent_id'] |
|
382 |
+ agent_match_idx = item['agent_match_idx'] |
|
383 |
+ agentSeniorDelete(agent_id, agent_match_idx, true); |
|
384 |
+ } |
|
385 |
+ }); |
|
386 |
+ |
|
387 |
+ // 장비 대여 종료 |
|
388 |
+ let equipment = {}; |
|
389 |
+ equipmentBySenior.equipmentList.map((item, idx) => { |
|
390 |
+ if (item['senior_id'] = senior['senior_id']) { |
|
391 |
+ equipment = item; |
|
392 |
+ equipmentRentalEnd(equipment, true); |
|
393 |
+ } |
|
394 |
+ }); |
|
395 |
+ |
|
396 |
+ senior['user_use'] = false; |
|
397 |
+ |
|
398 |
+ fetch("/user/userUpdate.json", { |
|
399 |
+ method: "POST", |
|
400 |
+ headers: { |
|
401 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
402 |
+ }, |
|
403 |
+ body: JSON.stringify(senior), |
|
404 |
+ }).then((response) => response.json()).then((data) => { |
|
405 |
+ console.log("사용자 등록 결과(건수) : ", data); |
|
406 |
+ if (data > 0) { |
|
407 |
+ alert("삭제 되었습니다."); |
|
408 |
+ navigate(-1); |
|
409 |
+ } else { |
|
410 |
+ alert("삭제에 실패하였습니다."); |
|
411 |
+ } |
|
412 |
+ }).catch((error) => { |
|
413 |
+ console.log('seniorDelete() /user/userInsert.json error : ', error); |
|
414 |
+ }); |
|
415 |
+ } else { |
|
416 |
+ return; |
|
417 |
+ } |
|
418 |
+ } |
|
419 |
+ |
|
420 |
+ |
|
283 | 421 |
React.useEffect(() => { |
284 | 422 |
medicationTimeCodeSelectList(); |
285 | 423 |
equipmentStatesSelect(); |
286 | 424 |
deliveryEquipmentSelectList(); |
287 |
- |
|
425 |
+ |
|
288 | 426 |
seniorSelectOne(); |
289 | 427 |
guardianSelectListBySenior(); |
290 | 428 |
agentSelectListBySenior(); |
... | ... | @@ -293,56 +431,59 @@ |
293 | 431 |
|
294 | 432 |
|
295 | 433 |
return ( |
296 |
- <main> |
|
297 |
- <Modal_Guardian open={modalGuardianIsOpen} close={modalGuardianClose} seniorId={location.state['senior_id']} |
|
298 |
- guardianBySenior={guardianBySenior} |
|
299 |
- guardianManagementCallback={() => {guardianSelectListBySenior(); modalGuardianClose(); setGuardianBySenior({})}}/> |
|
434 |
+ <main> |
|
435 |
+ <Modal_Guardian open={modalGuardianIsOpen} close={modalGuardianClose} seniorId={location.state['senior_id']} |
|
436 |
+ guardianBySenior={guardianBySenior} |
|
437 |
+ guardianManagementCallback={() => { guardianSelectListBySenior(); modalGuardianClose(); setGuardianBySenior({}) }} /> |
|
300 | 438 |
|
301 | 439 |
|
302 |
- <Modal open={modalRentalIsOpen} close={modalRentalClose} header="사용가능 장비 선택"> |
|
303 |
- <div className="board-wrap"> |
|
304 |
- <div> |
|
305 |
- <div className="search-management flex-end margin-bottom2 margin-top"> |
|
306 |
- <div style={{width: '120px', fontWeight: '600', fontSize: '16px'}}>대여 시작일</div> |
|
307 |
- <input type="date" |
|
308 |
- value={equipmentRental['rental_start_date']} |
|
309 |
- onChange={(e) => { |
|
310 |
- equipmentRental['rental_start_date'] = e.target.value; |
|
311 |
- setEquipmentRental({...equipmentRental})} |
|
312 |
- }/> |
|
313 |
- </div> |
|
314 |
- |
|
315 |
- <table class="caregiver-user protector-user"> |
|
316 |
- <thead> |
|
317 |
- <tr> |
|
318 |
- <th>No </th> |
|
319 |
- <th>모델명</th> |
|
320 |
- <th>시리얼넘버</th> |
|
321 |
- <th>입고일자</th> |
|
322 |
- <th>장비상태</th> |
|
323 |
- <th>장비선택</th> |
|
324 |
- </tr> |
|
325 |
- </thead> |
|
326 |
- <tbody> |
|
327 |
- {deliveryEquipment.equipmentList.map((item, idx) => { return ( |
|
440 |
+ <Modal open={modalRentalIsOpen} close={modalRentalClose} header="사용가능 장비 선택"> |
|
441 |
+ <div className="board-wrap"> |
|
442 |
+ <div> |
|
443 |
+ <div className="search-management flex-end margin-bottom2 margin-top"> |
|
444 |
+ <div style={{ width: '120px', fontWeight: '600', fontSize: '16px' }}>대여 시작일</div> |
|
445 |
+ <input type="date" |
|
446 |
+ value={equipmentRental['rental_start_date']} |
|
447 |
+ onChange={(e) => { |
|
448 |
+ equipmentRental['rental_start_date'] = e.target.value; |
|
449 |
+ setEquipmentRental({ ...equipmentRental }) |
|
450 |
+ } |
|
451 |
+ } /> |
|
452 |
+ </div> |
|
453 |
+ |
|
454 |
+ <table class="caregiver-user protector-user"> |
|
455 |
+ <thead> |
|
328 | 456 |
<tr> |
329 |
- <td data-label="No">{deliveryEquipment.equipmentListCount - idx - (deliveryEquipmentSearch.currentPage - 1) * deliveryEquipmentSearch.perPage}</td> |
|
330 |
- <td data-label="모델명">{item['equipment_name']}</td> |
|
331 |
- <td data-label="시리얼넘버">{item['equipment_serial_number']}</td> |
|
332 |
- <td data-label="입고일자">{item['equipment_stock_date']}</td> |
|
333 |
- <td data-label="장비상태">{equipmentStates[item['equipment_state']]}</td> |
|
334 |
- <td data-label="장비선택"> |
|
335 |
- <button className={"btn-small gray-btn"} onClick={() => {equipmentRentalInsert(item)}}>추가</button> |
|
336 |
- </td> |
|
337 |
- |
|
457 |
+ <th>No </th> |
|
458 |
+ <th>모델명</th> |
|
459 |
+ <th>시리얼넘버</th> |
|
460 |
+ <th>입고일자</th> |
|
461 |
+ <th>장비상태</th> |
|
462 |
+ <th>장비선택</th> |
|
338 | 463 |
</tr> |
339 |
- )})} |
|
340 |
- {CommonUtil.isEmpty(deliveryEquipment.equipmentList) ? |
|
341 |
- <tr> |
|
342 |
- <td colSpan={6}>조회된 데이터가 없습니다</td> |
|
343 |
- </tr> |
|
344 |
- : null} |
|
345 |
- </tbody> |
|
464 |
+ </thead> |
|
465 |
+ <tbody> |
|
466 |
+ {deliveryEquipment.equipmentList.map((item, idx) => { |
|
467 |
+ return ( |
|
468 |
+ <tr> |
|
469 |
+ <td data-label="No">{deliveryEquipment.equipmentListCount - idx - (deliveryEquipmentSearch.currentPage - 1) * deliveryEquipmentSearch.perPage}</td> |
|
470 |
+ <td data-label="모델명">{item['equipment_name']}</td> |
|
471 |
+ <td data-label="시리얼넘버">{item['equipment_serial_number']}</td> |
|
472 |
+ <td data-label="입고일자">{item['equipment_stock_date']}</td> |
|
473 |
+ <td data-label="장비상태">{equipmentStates[item['equipment_state']]}</td> |
|
474 |
+ <td data-label="장비선택"> |
|
475 |
+ <button className={"btn-small gray-btn"} onClick={() => { equipmentRentalInsert(item) }}>추가</button> |
|
476 |
+ </td> |
|
477 |
+ |
|
478 |
+ </tr> |
|
479 |
+ ) |
|
480 |
+ })} |
|
481 |
+ {CommonUtil.isEmpty(deliveryEquipment.equipmentList) ? |
|
482 |
+ <tr> |
|
483 |
+ <td colSpan={6}>조회된 데이터가 없습니다</td> |
|
484 |
+ </tr> |
|
485 |
+ : null} |
|
486 |
+ </tbody> |
|
346 | 487 |
</table> |
347 | 488 |
<Pagination |
348 | 489 |
currentPage={deliveryEquipmentSearch.currentPage} |
... | ... | @@ -351,230 +492,266 @@ |
351 | 492 |
maxRange={5} |
352 | 493 |
click={deliveryEquipmentSelectList} |
353 | 494 |
/> |
495 |
+ </div> |
|
354 | 496 |
</div> |
355 |
- </div> |
|
356 |
- </Modal> |
|
497 |
+ </Modal> |
|
498 |
+ |
|
499 |
+ <Modal open={modalRentalEndIsOpen} close={modalRentalEndClose} header="장비 대여 종료"> |
|
500 |
+ <div className="board-wrap"> |
|
501 |
+ <table className="margin-bottom"> |
|
502 |
+ <tbody> |
|
503 |
+ <tr> |
|
504 |
+ <th>장비대여종료일</th> |
|
505 |
+ <td> |
|
506 |
+ <input type="date" defaultValue={new Date().toLocaleDateString('en-CA')} onChange={(e) => { |
|
507 |
+ console.log('e.target.value : ', e.target.value); |
|
508 |
+ setRentalEndDate(e.target.value); |
|
509 |
+ }} /> |
|
510 |
+ </td> |
|
511 |
+ </tr> |
|
512 |
+ </tbody> |
|
513 |
+ </table> |
|
514 |
+ <div className="flex-center"> |
|
515 |
+ <button className="btn-small gray-btn" onClick={() => { |
|
516 |
+ equipmentRentalEnd(rentalData, false) |
|
517 |
+ }}>확인</button> |
|
518 |
+ </div> |
|
519 |
+ </div> |
|
520 |
+ </Modal> |
|
357 | 521 |
|
358 | 522 |
|
359 |
- <div className="content-wrap row"> |
|
360 |
- <SubTitle explanation={"대상자 상세 프로필"} className="margin-bottom" /> |
|
361 |
- <div className="margin-bottom5"> |
|
362 |
- <table className="margin-bottom senior-detail"> |
|
363 |
- <tbody> |
|
364 |
- <tr> |
|
365 |
- <th>관리기관</th> |
|
366 |
- <td> |
|
367 |
- <span>{senior['government_name']}</span> |
|
368 |
- </td> |
|
369 |
- </tr> |
|
523 |
+ <div className="content-wrap row"> |
|
524 |
+ <SubTitle explanation={"대상자 상세 프로필"} className="margin-bottom" /> |
|
525 |
+ <div className="margin-bottom5"> |
|
526 |
+ <table className="margin-bottom senior-detail"> |
|
527 |
+ <tbody> |
|
528 |
+ <tr> |
|
529 |
+ <th>관리기관</th> |
|
530 |
+ <td> |
|
531 |
+ <span>{senior['government_name']}</span> |
|
532 |
+ </td> |
|
533 |
+ </tr> |
|
370 | 534 |
|
371 |
- <tr> |
|
372 |
- <th>시행기관</th> |
|
373 |
- <td> |
|
374 |
- <span>{senior['agency_name']}</span> |
|
375 |
- </td> |
|
376 |
- </tr> |
|
535 |
+ <tr> |
|
536 |
+ <th>시행기관</th> |
|
537 |
+ <td> |
|
538 |
+ <span>{senior['agency_name']}</span> |
|
539 |
+ </td> |
|
540 |
+ </tr> |
|
377 | 541 |
|
378 |
- <tr> |
|
379 |
- <th>이름(아이디)</th> |
|
380 |
- <td> |
|
381 |
- <span>{senior['user_name']}({senior['user_id']})</span> |
|
382 |
- </td> |
|
383 |
- </tr> |
|
542 |
+ <tr> |
|
543 |
+ <th>이름(아이디)</th> |
|
544 |
+ <td> |
|
545 |
+ <span>{senior['user_name']}({senior['user_id']})</span> |
|
546 |
+ </td> |
|
547 |
+ </tr> |
|
384 | 548 |
|
385 |
- <tr> |
|
386 |
- <th>성별</th> |
|
387 |
- <td> |
|
388 |
- <span>{senior['user_gender']}</span> |
|
389 |
- </td> |
|
390 |
- </tr> |
|
391 |
- |
|
392 |
- <tr> |
|
393 |
- <th>연락처</th> |
|
394 |
- <td> |
|
395 |
- <span>{senior['user_phonenumber']}</span> |
|
396 |
- </td> |
|
397 |
- </tr> |
|
549 |
+ <tr> |
|
550 |
+ <th>성별</th> |
|
551 |
+ <td> |
|
552 |
+ <span>{senior['user_gender']}</span> |
|
553 |
+ </td> |
|
554 |
+ </tr> |
|
398 | 555 |
|
399 |
- <tr> |
|
400 |
- <th>생년월일</th> |
|
401 |
- <td> |
|
402 |
- <span>{senior['user_birth']}</span> |
|
403 |
- </td> |
|
404 |
- </tr> |
|
556 |
+ <tr> |
|
557 |
+ <th>연락처</th> |
|
558 |
+ <td> |
|
559 |
+ <span>{senior['user_phonenumber']}</span> |
|
560 |
+ </td> |
|
561 |
+ </tr> |
|
405 | 562 |
|
406 |
- <tr> |
|
407 |
- <th>주소</th> |
|
408 |
- <td> |
|
409 |
- <span>{senior['user_address']}</span> |
|
410 |
- </td> |
|
411 |
- </tr> |
|
412 |
- |
|
413 |
- <tr> |
|
414 |
- <th>필요복약</th> |
|
415 |
- <td className="flex-start"> |
|
416 |
- {medicationTimeCodeList.filter(item => senior.seniorMedicationList.indexOf(item['medication_time_code']) > -1).map((item, idx) => { return ( |
|
417 |
- <span>{item['medication_time_code_name']}</span> |
|
418 |
- )})} |
|
419 |
- </td> |
|
420 |
- </tr> |
|
563 |
+ <tr> |
|
564 |
+ <th>생년월일</th> |
|
565 |
+ <td> |
|
566 |
+ <span>{senior['user_birth']}</span> |
|
567 |
+ </td> |
|
568 |
+ </tr> |
|
421 | 569 |
|
422 |
- <tr> |
|
423 |
- <th>복용중인 약</th> |
|
424 |
- <td colSpan={3}> |
|
425 |
- <span className="medicine" cols="30" rows="2">{senior['medication_pill']}</span> |
|
426 |
- </td> |
|
427 |
- </tr> |
|
428 |
- |
|
429 |
- <tr> |
|
430 |
- <th>비고</th> |
|
431 |
- <td colSpan={3}> |
|
432 |
- <span className="note" cols="30" rows="2">{senior['senior_note']}</span> |
|
433 |
- </td> |
|
434 |
- </tr> |
|
435 |
- </tbody> |
|
436 |
- </table> |
|
570 |
+ <tr> |
|
571 |
+ <th>주소</th> |
|
572 |
+ <td> |
|
573 |
+ <span>{senior['user_address']}</span> |
|
574 |
+ </td> |
|
575 |
+ </tr> |
|
576 |
+ |
|
577 |
+ <tr> |
|
578 |
+ <th>필요복약</th> |
|
579 |
+ <td className="flex-start"> |
|
580 |
+ {medicationTimeCodeList.filter(item => senior.seniorMedicationList.indexOf(item['medication_time_code']) > -1).map((item, idx) => { |
|
581 |
+ return ( |
|
582 |
+ <span>{item['medication_time_code_name']}</span> |
|
583 |
+ ) |
|
584 |
+ })} |
|
585 |
+ </td> |
|
586 |
+ </tr> |
|
587 |
+ |
|
588 |
+ <tr> |
|
589 |
+ <th>복용중인 약</th> |
|
590 |
+ <td colSpan={3}> |
|
591 |
+ <span className="medicine" cols="30" rows="2">{senior['medication_pill']}</span> |
|
592 |
+ </td> |
|
593 |
+ </tr> |
|
594 |
+ |
|
595 |
+ <tr> |
|
596 |
+ <th>비고</th> |
|
597 |
+ <td colSpan={3}> |
|
598 |
+ <span className="note" cols="30" rows="2">{senior['senior_note']}</span> |
|
599 |
+ </td> |
|
600 |
+ </tr> |
|
601 |
+ </tbody> |
|
602 |
+ </table> |
|
603 |
+ <div className="btn-wrap flex-center"> |
|
604 |
+ <button className={"btn-large gray-btn"} onClick={() => { navigate("/SeniorEdit", { state: { 'senior_id': senior['senior_id'] } }) }}>수정</button> |
|
605 |
+ <button className={"btn-large red-btn"} onClick={() => seniorDelete(senior)}>삭제</button> |
|
606 |
+ </div> |
|
607 |
+ </div> |
|
608 |
+ |
|
609 |
+ <SubTitle explanation={"대상자의 보호자"} className="margin-bottom display-inline-block" /> |
|
610 |
+ <button className={"btn-small gray-btn display-inline-block float-right"} onClick={() => { setGuardianBySenior({}); modalGuardianOpen() }}>보호자 추가</button> |
|
611 |
+ <div className="margin-bottom5"> |
|
612 |
+ <table className={"protector-user"}> |
|
613 |
+ <thead> |
|
614 |
+ <tr> |
|
615 |
+ <th>No</th> |
|
616 |
+ <th>이름</th> |
|
617 |
+ <th>관계</th> |
|
618 |
+ <th>연락처</th> |
|
619 |
+ <th>생년월일</th> |
|
620 |
+ <th>주소</th> |
|
621 |
+ <th>가입승인</th> |
|
622 |
+ <th>관리</th> |
|
623 |
+ </tr> |
|
624 |
+ </thead> |
|
625 |
+ <tbody> |
|
626 |
+ {guardianListBySenior.map((item, idx) => { |
|
627 |
+ return ( |
|
628 |
+ <tr key={idx}> |
|
629 |
+ <td data-label="No">{idx + 1}</td> |
|
630 |
+ <td data-label="이름">{item['user_name']}</td> |
|
631 |
+ <td data-label="관계">{item['senior_relationship']}</td> |
|
632 |
+ <td data-label="연락처">{item['user_phonenumber']}</td> |
|
633 |
+ <td data-label="생년월일">{item['user_birth']}</td> |
|
634 |
+ <td data-label="주소">{item['user_address']}</td> |
|
635 |
+ <td data-label="가입승인"> |
|
636 |
+ {item['is_accept'] ? "승인완료" : |
|
637 |
+ <button className={"btn-small red-btn"} onClick={() => { userUpdate(item, guardianSelectListBySenior) }}>가입승인</button> |
|
638 |
+ } |
|
639 |
+ </td> |
|
640 |
+ <td data-label="관리"> |
|
641 |
+ <button className={"btn-small lightgray-btn"} onClick={() => guardianBySeniorManagement(item)}>정보 수정</button> |
|
642 |
+ </td> |
|
643 |
+ </tr> |
|
644 |
+ ) |
|
645 |
+ })} |
|
646 |
+ {CommonUtil.isEmpty(guardianListBySenior) ? |
|
647 |
+ <tr> |
|
648 |
+ <td colSpan={8}>조회된 데이터가 없습니다</td> |
|
649 |
+ </tr> |
|
650 |
+ : null} |
|
651 |
+ </tbody> |
|
652 |
+ </table> |
|
653 |
+ </div> |
|
654 |
+ |
|
655 |
+ |
|
656 |
+ <SubTitle explanation={"대상자의 보호사"} className="margin-bottom" /> |
|
657 |
+ <div className="margin-bottom5"> |
|
658 |
+ <table className={"senior-user protector-user"}> |
|
659 |
+ <thead> |
|
660 |
+ <tr> |
|
661 |
+ <th>No</th> |
|
662 |
+ <th>관리기관명</th> |
|
663 |
+ <th>소속기관명</th> |
|
664 |
+ <th>이름</th> |
|
665 |
+ <th>연락처</th> |
|
666 |
+ <th>이메일</th> |
|
667 |
+ <th>상태</th> |
|
668 |
+ <th>배정시작일</th> |
|
669 |
+ <th>배정종료일</th> |
|
670 |
+ <th>관리</th> |
|
671 |
+ <th>상세보기</th> |
|
672 |
+ </tr> |
|
673 |
+ </thead> |
|
674 |
+ <tbody> |
|
675 |
+ {agent.agentListBySenior.map((item, idx) => { |
|
676 |
+ return ( |
|
677 |
+ <tr key={idx}> |
|
678 |
+ <td data-label="No">{idx + 1}</td> |
|
679 |
+ <td data-label="관리기관명">{item['government_name']}</td> |
|
680 |
+ <td data-label="소속기관명">{item['agency_name']}</td> |
|
681 |
+ <td data-label="이름">{item['user_name']}</td> |
|
682 |
+ <td data-label="연락처">{item['user_phonenumber']}</td> |
|
683 |
+ <td data-label="이메일">{item['user_email']}</td> |
|
684 |
+ <td data-label="상태">{item['agent_match_state'] ? <span className="green">현재 보호사</span> : <span className="grey">이전 보호사</span>}</td> |
|
685 |
+ <td data-label="배정시작일">{item['agent_match_start_date']}</td> |
|
686 |
+ <td data-label="배정종료일">{item['agent_match_end_date']}</td> |
|
687 |
+ <td data-label="관리"> |
|
688 |
+ {item['agent_match_state'] ? |
|
689 |
+ <button className="btn-small red-btn" onClick={() => agentSeniorDelete(item['agent_id'], item['agent_match_idx'], false)}>매칭종료</button> |
|
690 |
+ : null} |
|
691 |
+ </td> |
|
692 |
+ <td data-label="상세보기"> |
|
693 |
+ <button className={"btn-small lightgray-btn"} onClick={() => { navigate("/AgentSelectOne", { state: { 'agent_id': item['agent_id'] } }) }}>상세 페이지 이동</button> |
|
694 |
+ </td> |
|
695 |
+ </tr> |
|
696 |
+ ) |
|
697 |
+ })} |
|
698 |
+ {CommonUtil.isEmpty(agent.agentListBySenior) ? |
|
699 |
+ <tr> |
|
700 |
+ <td colSpan={11}>조회된 데이터가 없습니다</td> |
|
701 |
+ </tr> |
|
702 |
+ : null} |
|
703 |
+ </tbody> |
|
704 |
+ </table> |
|
705 |
+ </div> |
|
706 |
+ |
|
707 |
+ |
|
708 |
+ <SubTitle explanation={"대상자의 장비"} className="margin-bottom display-inline-block" /> |
|
709 |
+ <button className={"btn-small gray-btn display-inline-block float-right"} onClick={modalRentalOpen}>장비 추가</button> |
|
710 |
+ <div className="margin-bottom5"> |
|
711 |
+ <table className={"senior-user protector-user"}> |
|
712 |
+ <thead> |
|
713 |
+ <tr> |
|
714 |
+ <th>No </th> |
|
715 |
+ <th>모델명</th> |
|
716 |
+ <th>시리얼넘버</th> |
|
717 |
+ <th>장비상태</th> |
|
718 |
+ <th>장비대여여부</th> |
|
719 |
+ <th>관리</th> |
|
720 |
+ </tr> |
|
721 |
+ </thead> |
|
722 |
+ <tbody> |
|
723 |
+ {equipmentBySenior.equipmentList.map((item, idx) => { |
|
724 |
+ return ( |
|
725 |
+ <tr key={idx}> |
|
726 |
+ <td data-label="No">{idx + 1}</td> |
|
727 |
+ <td data-label="모델명">{item['equipment_name']}</td> |
|
728 |
+ <td data-label="시리얼넘버">{item['equipment_serial_number']}</td> |
|
729 |
+ <td data-label="장비상태">{equipmentStates[item['equipment_state']]}</td> |
|
730 |
+ <td data-label="장비상태"> |
|
731 |
+ {CommonUtil.isEmpty(item['rental_start_date']) == false && CommonUtil.isEmpty(item['rental_end_date']) == true ? |
|
732 |
+ '대여중' : '대여종료'} |
|
733 |
+ </td> |
|
734 |
+ <td data-label="관리"> |
|
735 |
+ { |
|
736 |
+ CommonUtil.isEmpty(item['rental_start_date']) == false && CommonUtil.isEmpty(item['rental_end_date']) == true ? |
|
737 |
+ (<button className={"btn-small red-btn"} onClick={() => modalRentalEndOpen(item)}>대여 종료</button>) |
|
738 |
+ : null} |
|
739 |
+ </td> |
|
740 |
+ </tr> |
|
741 |
+ ) |
|
742 |
+ })} |
|
743 |
+ {CommonUtil.isEmpty(equipmentBySenior.equipmentList) ? |
|
744 |
+ <tr> |
|
745 |
+ <td colSpan={6}>조회된 데이터가 없습니다</td> |
|
746 |
+ </tr> |
|
747 |
+ : null} |
|
748 |
+ </tbody> |
|
749 |
+ </table> |
|
750 |
+ </div> |
|
437 | 751 |
<div className="btn-wrap flex-center"> |
438 |
- <button className={"btn-large gray-btn"} onClick={() => {navigate("/SeniorEdit", {state: {'senior_id': senior['senior_id']}})}}>수정</button> |
|
439 |
- <button className={"btn-large red-btn"} onClick={() => alert("삭제할 수 없습니다.")}>삭제</button> |
|
752 |
+ <button className={"btn-large gray-btn"} onClick={() => navigate(-1)}>이전</button> |
|
440 | 753 |
</div> |
441 | 754 |
</div> |
442 |
- |
|
443 |
- <SubTitle explanation={"대상자의 보호자"} className="margin-bottom display-inline-block" /> |
|
444 |
- <button className={"btn-small gray-btn display-inline-block float-right"} onClick={() => {setGuardianBySenior({}); modalGuardianOpen()}}>보호자 추가</button> |
|
445 |
- <div className="margin-bottom5"> |
|
446 |
- <table className={"protector-user"}> |
|
447 |
- <thead> |
|
448 |
- <tr> |
|
449 |
- <th>No</th> |
|
450 |
- <th>이름</th> |
|
451 |
- <th>관계</th> |
|
452 |
- <th>연락처</th> |
|
453 |
- <th>생년월일</th> |
|
454 |
- <th>주소</th> |
|
455 |
- <th>가입승인</th> |
|
456 |
- <th>관리</th> |
|
457 |
- </tr> |
|
458 |
- </thead> |
|
459 |
- <tbody> |
|
460 |
- {guardianListBySenior.map((item, idx) => { return ( |
|
461 |
- <tr key={idx}> |
|
462 |
- <td data-label="No">{idx + 1}</td> |
|
463 |
- <td data-label="이름">{item['user_name']}</td> |
|
464 |
- <td data-label="관계">{item['senior_relationship']}</td> |
|
465 |
- <td data-label="연락처">{item['user_phonenumber']}</td> |
|
466 |
- <td data-label="생년월일">{item['user_birth']}</td> |
|
467 |
- <td data-label="주소">{item['user_address']}</td> |
|
468 |
- <td data-label="가입승인"> |
|
469 |
- {item['is_accept'] ? "승인완료" : |
|
470 |
- <button className={"btn-small red-btn"} onClick={() => {userUpdate(item, guardianSelectListBySenior)}}>가입승인</button> |
|
471 |
- } |
|
472 |
- </td> |
|
473 |
- <td data-label="관리"> |
|
474 |
- <button className={"btn-small lightgray-btn"} onClick={() => guardianBySeniorManagement(item)}>정보 수정</button> |
|
475 |
- </td> |
|
476 |
- </tr> |
|
477 |
- )})} |
|
478 |
- {CommonUtil.isEmpty(guardianListBySenior) ? |
|
479 |
- <tr> |
|
480 |
- <td colSpan={8}>조회된 데이터가 없습니다</td> |
|
481 |
- </tr> |
|
482 |
- : null} |
|
483 |
- </tbody> |
|
484 |
- </table> |
|
485 |
- </div> |
|
486 |
- |
|
487 |
- |
|
488 |
- <SubTitle explanation={"대상자의 보호사"} className="margin-bottom" /> |
|
489 |
- <div className="margin-bottom5"> |
|
490 |
- <table className={"senior-user protector-user"}> |
|
491 |
- <thead> |
|
492 |
- <tr> |
|
493 |
- <th>No</th> |
|
494 |
- <th>관리기관명</th> |
|
495 |
- <th>소속기관명</th> |
|
496 |
- <th>이름</th> |
|
497 |
- <th>연락처</th> |
|
498 |
- <th>이메일</th> |
|
499 |
- <th>상태</th> |
|
500 |
- <th>배정시작일</th> |
|
501 |
- <th>배정종료일</th> |
|
502 |
- <th>배정관리</th> |
|
503 |
- <th>상세보기</th> |
|
504 |
- </tr> |
|
505 |
- </thead> |
|
506 |
- <tbody> |
|
507 |
- {agent.agentListBySenior.map((item, idx) => { return ( |
|
508 |
- <tr key={idx}> |
|
509 |
- <td data-label="No">{idx + 1}</td> |
|
510 |
- <td data-label="관리기관명">{item['government_name']}</td> |
|
511 |
- <td data-label="소속기관명">{item['agency_name']}</td> |
|
512 |
- <td data-label="이름">{item['user_name']}</td> |
|
513 |
- <td data-label="연락처">{item['user_phonenumber']}</td> |
|
514 |
- <td data-label="이메일">{item['user_email']}</td> |
|
515 |
- <td data-label="상태">{item['agent_match_state'] ? <span className="green">현재 보호사</span> : <span className="grey">이전 보호사</span>}</td> |
|
516 |
- <td data-label="배정시작일">{item['agent_match_start_date']}</td> |
|
517 |
- <td data-label="배정종료일">{item['agent_match_end_date']}</td> |
|
518 |
- <td data-label="배정관리"> |
|
519 |
- <button className="btn-small red-btn" onClick={() => confirm("매칭종료하시겠습니까?")}>매칭종료</button> |
|
520 |
- </td> |
|
521 |
- <td data-label="상세보기"> |
|
522 |
- <button className={"btn-small lightgray-btn"} onClick={() => {navigate("/AgentSelectOne", {state: {'agent_id': item['agent_id']}})}}>상세 페이지 이동</button> |
|
523 |
- </td> |
|
524 |
- </tr> |
|
525 |
- )})} |
|
526 |
- {CommonUtil.isEmpty(agent.agentListBySenior) ? |
|
527 |
- <tr> |
|
528 |
- <td colSpan={10}>조회된 데이터가 없습니다</td> |
|
529 |
- </tr> |
|
530 |
- : null} |
|
531 |
- </tbody> |
|
532 |
- </table> |
|
533 |
- </div> |
|
534 |
- |
|
535 |
- |
|
536 |
- |
|
537 |
- <SubTitle explanation={"대상자의 장비"} className="margin-bottom display-inline-block" /> |
|
538 |
- <button className={"btn-small gray-btn display-inline-block float-right"} onClick={modalRentalOpen}>장비 추가</button> |
|
539 |
- <div className="margin-bottom5"> |
|
540 |
- <table className={"senior-user protector-user"}> |
|
541 |
- <thead> |
|
542 |
- <tr> |
|
543 |
- <th>No </th> |
|
544 |
- <th>모델명</th> |
|
545 |
- <th>시리얼넘버</th> |
|
546 |
- <th>장비상태</th> |
|
547 |
- <th>관리</th> |
|
548 |
- </tr> |
|
549 |
- </thead> |
|
550 |
- <tbody> |
|
551 |
- {equipmentBySenior.equipmentList.map((item, idx) => { return ( |
|
552 |
- <tr key={idx}> |
|
553 |
- <td data-label="No">{idx + 1}</td> |
|
554 |
- <td data-label="모델명">{item['equipment_name']}</td> |
|
555 |
- <td data-label="시리얼넘버">{item['equipment_serial_number']}</td> |
|
556 |
- <td data-label="장비상태">{equipmentStates[item['equipment_state']]}</td> |
|
557 |
- <td data-label="관리"> |
|
558 |
- <button className={"btn-small red-btn"} onClick={() => guardianBySeniorManagement(item)}>대여 종료</button> |
|
559 |
- </td> |
|
560 |
- </tr> |
|
561 |
- )})} |
|
562 |
- {CommonUtil.isEmpty(equipmentBySenior.equipmentList) ? |
|
563 |
- <tr> |
|
564 |
- <td colSpan={5}>조회된 데이터가 없습니다</td> |
|
565 |
- </tr> |
|
566 |
- : null} |
|
567 |
- </tbody> |
|
568 |
- </table> |
|
569 |
- </div> |
|
570 |
- |
|
571 |
- |
|
572 |
- <div className="btn-wrap flex-center"> |
|
573 |
- <button className={"btn-large gray-btn"} onClick={() => navigate(-1)}>이전</button> |
|
574 |
- </div> |
|
575 |
- |
|
576 |
- </div> |
|
577 |
- |
|
578 |
- </main> |
|
755 |
+ </main> |
|
579 | 756 |
); |
580 | 757 |
} |
--- client/views/pages/user_management/AgencyAdminSeniorSelect.jsx
+++ client/views/pages/user_management/AgencyAdminSeniorSelect.jsx
... | ... | @@ -18,6 +18,10 @@ |
18 | 18 |
|
19 | 19 |
const [modalOpen, setModalOpen] = React.useState(false); |
20 | 20 |
const openModal = () => { |
21 |
+ if (CheckList.length < 0) { |
|
22 |
+ alert("대상을 선택해 주세요."); |
|
23 |
+ return; |
|
24 |
+ } |
|
21 | 25 |
setModalOpen(true); |
22 | 26 |
}; |
23 | 27 |
const closeModal = () => { |
... | ... | @@ -83,49 +87,26 @@ |
83 | 87 |
} |
84 | 88 |
} |
85 | 89 |
const searching = () => { |
86 |
- mySenior.search['searchType'] = search['searchType']; |
|
87 |
- mySenior.search['searchText'] = search['searchText']; |
|
88 |
- mySenior.search['agent_id'] = state.loginUser['user_id']; |
|
89 |
- setMySenior({ ...mySenior }); |
|
90 |
- |
|
91 | 90 |
agencySenior.search['searchType'] = search['searchType']; |
92 | 91 |
agencySenior.search['searchText'] = search['searchText']; |
93 | 92 |
agencySenior.search['agency_id'] = state.loginUser['agency_id']; |
94 | 93 |
setAgencySenior({ ...agencySenior }); |
95 | 94 |
|
96 |
- mySeniorSelectList(1); |
|
95 |
+ agencyDeleteSenior.search['searchType'] = search['searchType']; |
|
96 |
+ agencyDeleteSenior.search['searchText'] = search['searchText']; |
|
97 |
+ agencyDeleteSenior.search['agency_id'] = state.loginUser['agency_id']; |
|
98 |
+ setAgencyDeleteSenior({ ...agencyDeleteSenior }); |
|
99 |
+ |
|
97 | 100 |
agencySeniorSelectList(1); |
101 |
+ agencyDeleteSeniorSelectList(1); |
|
98 | 102 |
} |
99 |
- |
|
100 |
- |
|
101 |
- //보호사(간호사)의 돌봄 대상자(시니어) |
|
102 |
- const [mySenior, setMySenior] = React.useState({ seniorList: [], seniorListCount: 0, search: JSON.parse(JSON.stringify(search)) }); |
|
103 |
- //보호사(간호사)의 돌봄 대상자(시니어) 목록 조회 |
|
104 |
- const mySeniorSelectList = (currentPage) => { |
|
105 |
- mySenior.search.currentPage = CommonUtil.isEmpty(currentPage) ? 1 : currentPage; |
|
106 |
- |
|
107 |
- fetch("/user/seniorSelectList.json", { |
|
108 |
- method: "POST", |
|
109 |
- headers: { |
|
110 |
- 'Content-Type': 'application/json; charset=UTF-8' |
|
111 |
- }, |
|
112 |
- body: JSON.stringify(mySenior.search), |
|
113 |
- }).then((response) => response.json()).then((data) => { |
|
114 |
- data.search = mySenior.search; |
|
115 |
- console.log("보호사(간호사)의 돌봄 대상자(시니어) 목록 조회 : ", data); |
|
116 |
- setMySenior(data); |
|
117 |
- }).catch((error) => { |
|
118 |
- console.log('seniorSelectList() /user/seniorSelectList.json error : ', error); |
|
119 |
- }); |
|
120 |
- } |
|
121 |
- |
|
122 |
- |
|
123 | 103 |
|
124 | 104 |
//시행기관의 대상자(시니어) |
125 | 105 |
const [agencySenior, setAgencySenior] = React.useState({ seniorList: [], seniorListCount: 0, search: JSON.parse(JSON.stringify(search)) }); |
126 | 106 |
//시행기관의 대상자(시니어) 목록 조회 |
127 | 107 |
const agencySeniorSelectList = (currentPage) => { |
128 | 108 |
agencySenior.search.currentPage = CommonUtil.isEmpty(currentPage) ? 1 : currentPage; |
109 |
+ agencySenior.search.user_use = true; |
|
129 | 110 |
|
130 | 111 |
fetch("/user/seniorSelectList.json", { |
131 | 112 |
method: "POST", |
... | ... | @@ -157,36 +138,6 @@ |
157 | 138 |
return '보호사'; |
158 | 139 |
} |
159 | 140 |
|
160 |
- |
|
161 |
- |
|
162 |
- //보호사의 대상자 등록 |
|
163 |
- const agentSeniorInsert = (senior, agentId) => { |
|
164 |
- if (confirm(`${senior['user_name']}님을 돌봄 대상자로 추가하시겠습니까?`) == false) { |
|
165 |
- return; |
|
166 |
- } else { |
|
167 |
- senior['agent_id'] = state.loginUser['user_id']; |
|
168 |
- } |
|
169 |
- fetch("/user/agentSeniorInsert.json", { |
|
170 |
- method: "POST", |
|
171 |
- headers: { |
|
172 |
- 'Content-Type': 'application/json; charset=UTF-8' |
|
173 |
- }, |
|
174 |
- body: JSON.stringify(senior), |
|
175 |
- }).then((response) => response.json()).then((data) => { |
|
176 |
- if (data > 0) { |
|
177 |
- setTabIndex(0); |
|
178 |
- search.searchText = ''; |
|
179 |
- search.searchType = ''; |
|
180 |
- searching(); |
|
181 |
- alert("추가완료"); |
|
182 |
- } else { |
|
183 |
- alert("추가에 실패하였습니다. 관리자에게 문의바랍니다."); |
|
184 |
- } |
|
185 |
- }).catch((error) => { |
|
186 |
- console.log('agencySeniorSelectList() /user/seniorSelectList.json error : ', error); |
|
187 |
- }); |
|
188 |
- } |
|
189 |
- |
|
190 | 141 |
const [CheckList, setCheckList] = React.useState([]); |
191 | 142 |
const [IdList, setIdList] = React.useState([]); |
192 | 143 |
|
... | ... | @@ -196,18 +147,81 @@ |
196 | 147 |
ids[i] = item['user_id'] |
197 | 148 |
}) |
198 | 149 |
setIdList(ids) |
199 |
- }, [agencySenior.seniorList]) |
|
150 |
+ }, [agencySenior.seniorList,]) |
|
200 | 151 |
|
201 | 152 |
const onChangeAll = (e) => { |
202 | 153 |
setCheckList(e.target.checked ? IdList : []) |
203 | 154 |
} |
204 | 155 |
|
205 | 156 |
const onChangeEach = (e, id) => { |
157 |
+ console.log('checkList : ', CheckList); |
|
206 | 158 |
if (e.target.checked) { |
207 | 159 |
setCheckList([...CheckList, id]); |
208 | 160 |
} else { |
209 | 161 |
setCheckList(CheckList.filter((checkedId) => checkedId !== id)); |
210 | 162 |
} |
163 |
+ } |
|
164 |
+ |
|
165 |
+ // 시니어 - 담당자 매칭 시도 |
|
166 |
+ const [workerId, setWorkerId] = React.useState(""); |
|
167 |
+ // 시니어 - 담당자 매칭 |
|
168 |
+ const MatchSeniorAgency = () => { |
|
169 |
+ if (workerId == '') { |
|
170 |
+ alert("보호사를 선택해 주세요."); |
|
171 |
+ return; |
|
172 |
+ } |
|
173 |
+ var insertBtn = confirm("등록하시겠습니까?"); |
|
174 |
+ if (insertBtn) { |
|
175 |
+ for (let i = 0; i < CheckList.length; i++) { |
|
176 |
+ agentSeniorInsert(CheckList[i]); |
|
177 |
+ } |
|
178 |
+ } else { |
|
179 |
+ return; |
|
180 |
+ } |
|
181 |
+ }; |
|
182 |
+ |
|
183 |
+ // 보호사 배정 |
|
184 |
+ const agentSeniorInsert = (seniorId) => { |
|
185 |
+ fetch("/user/agentSeniorInsert.json", { |
|
186 |
+ method: "POST", |
|
187 |
+ headers: { |
|
188 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
189 |
+ }, |
|
190 |
+ body: JSON.stringify({ |
|
191 |
+ agent_id: workerId, |
|
192 |
+ senior_id: seniorId, |
|
193 |
+ agent_match_insert_user_id: state.loginUser['user_id'] |
|
194 |
+ }), |
|
195 |
+ }).then((response) => response.json()).then((data) => { |
|
196 |
+ closeModal(); |
|
197 |
+ agentSelectList(); |
|
198 |
+ searching(); |
|
199 |
+ }).catch((error) => { |
|
200 |
+ console.log('MatchSeniorAgency() /user/agentSeniorInsert.json error : ', error); |
|
201 |
+ }); |
|
202 |
+ } |
|
203 |
+ |
|
204 |
+ |
|
205 |
+ //시행기관의 삭제 대상자(시니어) |
|
206 |
+ const [agencyDeleteSenior, setAgencyDeleteSenior] = React.useState({ seniorList: [], seniorListCount: 0, search: JSON.parse(JSON.stringify(search)) }); |
|
207 |
+ //시행기관의 삭제 대상자(시니어) 목록 조회 |
|
208 |
+ const agencyDeleteSeniorSelectList = (currentPage) => { |
|
209 |
+ agencyDeleteSenior.search.currentPage = CommonUtil.isEmpty(currentPage) ? 1 : currentPage; |
|
210 |
+ agencyDeleteSenior.search.user_use = false; |
|
211 |
+ |
|
212 |
+ fetch("/user/seniorSelectList.json", { |
|
213 |
+ method: "POST", |
|
214 |
+ headers: { |
|
215 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
216 |
+ }, |
|
217 |
+ body: JSON.stringify(agencyDeleteSenior.search), |
|
218 |
+ }).then((response) => response.json()).then((data) => { |
|
219 |
+ data.search = agencyDeleteSenior.search; |
|
220 |
+ console.log("시행기관의 삭제 대상자(시니어) 목록 조회 : ", data); |
|
221 |
+ setAgencyDeleteSenior(data); |
|
222 |
+ }).catch((error) => { |
|
223 |
+ console.log('agencyDeleteSeniorSelectList() /user/seniorSelectList.json error : ', error); |
|
224 |
+ }); |
|
211 | 225 |
} |
212 | 226 |
|
213 | 227 |
React.useEffect(() => { |
... | ... | @@ -300,7 +314,8 @@ |
300 | 314 |
return ( |
301 | 315 |
<tr key={idx}> |
302 | 316 |
<td data-label="checkbox"> |
303 |
- <input type="checkbox" name="checkSenior" id={"check" + idx} onChange={(e) => onChangeEach(e, item['user_id'])} checked={CheckList.includes(item['user_id'])} /> |
|
317 |
+ <input type="checkbox" name="checkSenior" id={"check" + idx} onChange={(e) => |
|
318 |
+ onChangeEach(e, item['user_id'])} checked={CheckList.includes(item['user_id'])} /> |
|
304 | 319 |
</td> |
305 | 320 |
<td data-label="No">{agencySenior.seniorListCount - idx - (agencySenior.search.currentPage - 1) * agencySenior.search.perPage}</td> |
306 | 321 |
<td data-label="소속기관명">{item['agency_name']}</td> |
... | ... | @@ -347,6 +362,72 @@ |
347 | 362 |
/> |
348 | 363 |
</div> |
349 | 364 |
</div> |
365 |
+ </div> |
|
366 |
+ ) |
|
367 |
+ }, { |
|
368 |
+ title: `우리기관 삭제된 돌봄 대상자 (${agencyDeleteSenior.seniorListCount})`, |
|
369 |
+ content: ( |
|
370 |
+ <div> |
|
371 |
+ <div className="flex equip-tab"> |
|
372 |
+ <SubTitle explanation={"삭제된 돌봄 대상자 목록입니다."} /> |
|
373 |
+ </div> |
|
374 |
+ <table className={"protector-user"}> |
|
375 |
+ <thead> |
|
376 |
+ <tr> |
|
377 |
+ <th>No</th> |
|
378 |
+ <th>소속기관명</th> |
|
379 |
+ <th>이름</th> |
|
380 |
+ <th>생년월일</th> |
|
381 |
+ <th>성별</th> |
|
382 |
+ <th>연락처</th> |
|
383 |
+ <th>보호자</th> |
|
384 |
+ <th>대상자관리</th> |
|
385 |
+ </tr> |
|
386 |
+ </thead> |
|
387 |
+ <tbody> |
|
388 |
+ {agencyDeleteSenior.seniorList.map((item, idx) => { |
|
389 |
+ return ( |
|
390 |
+ <tr key={idx}> |
|
391 |
+ <td data-label="No">{agencyDeleteSenior.seniorListCount - idx - (agencyDeleteSenior.search.currentPage - 1) * agencyDeleteSenior.search.perPage}</td> |
|
392 |
+ <td data-label="소속기관명">{item['agency_name']}</td> |
|
393 |
+ <td data-label="이름">{item['user_name']}</td> |
|
394 |
+ <td data-label="생년월일">{item['user_birth']}</td> |
|
395 |
+ <td data-label="성별">{item['user_gender']}</td> |
|
396 |
+ <td data-label="연락처">{item['user_phonenumber']}</td> |
|
397 |
+ <td data-label="보호자"> |
|
398 |
+ {CommonUtil.isEmpty(item['guardian_user_names']) |
|
399 |
+ ? '없음' |
|
400 |
+ : item['guardian_user_names'] |
|
401 |
+ } |
|
402 |
+ </td> |
|
403 |
+ <td data-label="대상자관리"> |
|
404 |
+ <button className="btn-small gray-btn" onClick={() => { |
|
405 |
+ navigate("/SeniorSelectOne", { |
|
406 |
+ state: { |
|
407 |
+ 'senior_id': item['senior_id'], |
|
408 |
+ 'agency_id': item['agency_id'], |
|
409 |
+ 'government_id': item['government_id'] |
|
410 |
+ } |
|
411 |
+ }) |
|
412 |
+ }}>대상자관리</button> |
|
413 |
+ </td> |
|
414 |
+ </tr> |
|
415 |
+ ) |
|
416 |
+ })} |
|
417 |
+ {CommonUtil.isEmpty(agencyDeleteSenior.seniorList) ? |
|
418 |
+ <tr> |
|
419 |
+ <td colSpan={8}>조회된 데이터가 없습니다</td> |
|
420 |
+ </tr> |
|
421 |
+ : null} |
|
422 |
+ </tbody> |
|
423 |
+ </table> |
|
424 |
+ <Pagination |
|
425 |
+ currentPage={agencySenior.search.currentPage} |
|
426 |
+ perPage={agencySenior.search.perPage} |
|
427 |
+ totalCount={agencySenior.seniorListCount} |
|
428 |
+ maxRange={5} |
|
429 |
+ click={agencySeniorSelectList} |
|
430 |
+ /> |
|
350 | 431 |
</div> |
351 | 432 |
) |
352 | 433 |
} |
... | ... | @@ -409,7 +490,10 @@ |
409 | 490 |
<tr> |
410 | 491 |
<th>담당 보호사</th> |
411 | 492 |
<td> |
412 |
- <select name="" id=""> |
|
493 |
+ <select onChange={(e) => { |
|
494 |
+ console.log('e.target.value : ', e.target.value); |
|
495 |
+ setWorkerId(e.target.value); |
|
496 |
+ }}> |
|
413 | 497 |
<option value="">담당 보호사를 선택해주세요.</option> |
414 | 498 |
{agent.userList.map((user, idx) => { |
415 | 499 |
return ( |
... | ... | @@ -422,8 +506,9 @@ |
422 | 506 |
</tbody> |
423 | 507 |
</table> |
424 | 508 |
<div className="flex-center"> |
425 |
- <button className="btn-small gray-btn">등록</button> |
|
426 |
- <button className="btn-small red-btn">삭제</button> |
|
509 |
+ <button className="btn-small gray-btn" onClick={() => { |
|
510 |
+ MatchSeniorAgency() |
|
511 |
+ }}>등록</button> |
|
427 | 512 |
</div> |
428 | 513 |
</div> |
429 | 514 |
</Modal> |
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?