
Merge branch 'admin' of http://210.180.118.83/yjryu/senior_care_system into admin
@16cd96b29f405c051278acdcb6fccb7920102bb9
--- client/views/pages/equipment/EquipmentManagementSelect.jsx
+++ client/views/pages/equipment/EquipmentManagementSelect.jsx
... | ... | @@ -176,7 +176,6 @@ |
176 | 176 |
"입고 일자", |
177 | 177 |
"상태", |
178 | 178 |
"보유 기관", |
179 |
- "대상자", |
|
180 | 179 |
"관리", |
181 | 180 |
]; |
182 | 181 |
const key1 = [ |
... | ... | @@ -185,7 +184,6 @@ |
185 | 184 |
"equipment_stock_date", |
186 | 185 |
"equipment_state", |
187 | 186 |
"agency_name", |
188 |
- "senior_name", |
|
189 | 187 |
]; |
190 | 188 |
|
191 | 189 |
const thead2 = [ |
... | ... | @@ -281,7 +279,7 @@ |
281 | 279 |
/********************************** 시행기관 장비 (시작) **********************************/ |
282 | 280 |
//로그 확인 |
283 | 281 |
const logCheck = () => { |
284 |
- console.log('equipmentNotMatchSeniorList - change: ', equipmentNotMatchSeniorList); |
|
282 |
+ console.log('seniorMatchListByEquipment - change: ', seniorMatchListByEquipment.length); |
|
285 | 283 |
}; |
286 | 284 |
|
287 | 285 |
// 시행기관 전체 장비 목록 |
... | ... | @@ -298,6 +296,8 @@ |
298 | 296 |
const [seniorMatchReturnModal, setSeniorMatchReturnModal] = React.useState(false); |
299 | 297 |
// 시행기관 장비 상세 조회 모달창 |
300 | 298 |
const [agencyEquipmentOneModal, setAgencyEquipmentOneModal] = React.useState(false); |
299 |
+ // 장비별 대상자 매칭 목록 조회 |
|
300 |
+ const [seniorMatchListByEquipment, setSeniorMatchListByEquipment] = React.useState([]); |
|
301 | 301 |
|
302 | 302 |
// 장비 비매칭 대상자 목록 |
303 | 303 |
const [equipmentNotMatchSeniorList, setEquipmentNotMatchSeniorList] = React.useState([]); |
... | ... | @@ -395,16 +395,18 @@ |
395 | 395 |
setSeniorEquipment(data); |
396 | 396 |
}; |
397 | 397 |
|
398 |
- |
|
399 |
- // 대상자 장비 등록 모달창 열기 |
|
398 |
+ // 시행기관 장비 상세 조회 모달창 열기 |
|
400 | 399 |
const agencyEquipmentOneModalOpen = (item) => { |
401 |
- setSeniorEquipment(item); // 선택한 장비 데이터 저장 |
|
400 |
+ agencyEquipmentSelectOne(item); |
|
401 |
+ // setSeniorEquipment(item); // 선택한 장비 데이터 저장 |
|
402 | 402 |
setAgencyEquipmentOneModal(true); |
403 | 403 |
}; |
404 |
- // 대상자 장비 등록 모달창 닫기 |
|
404 |
+ |
|
405 |
+ // 시행기관 장비 상세 조회 모달창 닫기 |
|
405 | 406 |
const agencyEquipmentOneModalClose = () => { |
406 | 407 |
setAgencyEquipmentOneModal(false); |
407 | 408 |
}; |
409 |
+ |
|
408 | 410 |
|
409 | 411 |
// 시행기관 전체 장비 목록 조회 |
410 | 412 |
const agencyEquipmentSelectList = () => { |
... | ... | @@ -466,6 +468,28 @@ |
466 | 468 |
}); |
467 | 469 |
} |
468 | 470 |
|
471 |
+ // 시행기관 장비 상세 조회 |
|
472 |
+ const agencyEquipmentSelectOne = (item) => { |
|
473 |
+ console.log('agencyEquipmentSelectOne Function Run: ', item); |
|
474 |
+ |
|
475 |
+ // 대상자 장비 반납 구분 조건 data |
|
476 |
+ item['matchTarget'] = 'equipment'; |
|
477 |
+ |
|
478 |
+ fetch("/equipment/equipmentMatchSelectList.json", { |
|
479 |
+ method: "POST", |
|
480 |
+ headers: { |
|
481 |
+ 'Content-Type': 'application/json; charset=UTF-8' |
|
482 |
+ }, |
|
483 |
+ body: JSON.stringify(item), |
|
484 |
+ }).then((response) => response.json()).then((data) => { |
|
485 |
+ console.log('agencyEquipmentSelectOne response : ', data); |
|
486 |
+ // 장비별 대상자 매칭 목록 |
|
487 |
+ setSeniorMatchListByEquipment(data); |
|
488 |
+ }).catch((error) => { |
|
489 |
+ console.log('agencyEquipmentSelectOne error : ', error); |
|
490 |
+ }); |
|
491 |
+ } |
|
492 |
+ |
|
469 | 493 |
// 대상자 장비 등록 |
470 | 494 |
const seniorEquipmentInsert = () => { |
471 | 495 |
console.log('seniorEquipmentInsert Function Run'); |
... | ... | @@ -495,16 +519,21 @@ |
495 | 519 |
} |
496 | 520 |
|
497 | 521 |
// 대여일 유효성 검사 |
498 |
- /* if(seniorEquipment['equipment_rental_start_date'] == null) { |
|
522 |
+ if(seniorEquipment['equipment_rental_start_date'] == null) { |
|
499 | 523 |
alert('대여일을 입력해 주세요'); |
500 | 524 |
return; |
501 |
- } */ |
|
525 |
+ } |
|
502 | 526 |
|
503 | 527 |
// 반납 예정일 유효성 검사 |
504 |
- /* if(seniorEquipment['equipment_rental_end_date'] == null) { |
|
528 |
+ if(seniorEquipment['equipment_rental_end_date'] == null) { |
|
505 | 529 |
alert('반납 예정일 입력해 주세요'); |
506 | 530 |
return; |
507 |
- } */ |
|
531 |
+ } |
|
532 |
+ |
|
533 |
+ // 이전 매칭 기록 확인 조건 data |
|
534 |
+ // console.log('insert seniorEquipment before: ', seniorEquipment); |
|
535 |
+ seniorEquipment['matchTarget'] = 'senior'; |
|
536 |
+ // console.log('insert seniorEquipment after: ', seniorEquipment); |
|
508 | 537 |
|
509 | 538 |
fetch("/equipment/seniorEquipmentInsert.json", { |
510 | 539 |
method: "POST", |
... | ... | @@ -553,10 +582,10 @@ |
553 | 582 |
} |
554 | 583 |
|
555 | 584 |
// 반납 예정일 유효성 검사 |
556 |
- /* if(seniorEquipment['equipment_rental_return_date'] == null) { |
|
557 |
- alert('반납일 입력해 주세요'); |
|
585 |
+ if(seniorEquipment['equipment_rental_return_date'] == null) { |
|
586 |
+ alert('반납일을 입력해 주세요'); |
|
558 | 587 |
return; |
559 |
- } */ |
|
588 |
+ } |
|
560 | 589 |
|
561 | 590 |
fetch("/equipment/seniorEquipmentReturn.json", { |
562 | 591 |
method: "POST", |
... | ... | @@ -653,6 +682,20 @@ |
653 | 682 |
"선택", |
654 | 683 |
]; |
655 | 684 |
|
685 |
+ const thead66 = [ |
|
686 |
+ "대상자", |
|
687 |
+ "대여일", |
|
688 |
+ "반납일", |
|
689 |
+ "반납 담당자", |
|
690 |
+ ]; |
|
691 |
+ |
|
692 |
+ const key66 = [ |
|
693 |
+ "senior_name", |
|
694 |
+ "equipment_rental_start_date", |
|
695 |
+ "equipment_rental_return_date", |
|
696 |
+ "return_user_name", |
|
697 |
+ ]; |
|
698 |
+ |
|
656 | 699 |
// 마운트 시 실행 함수 |
657 | 700 |
React.useEffect(() => { |
658 | 701 |
equipmentStatesSelect(); |
... | ... | @@ -734,31 +777,34 @@ |
734 | 777 |
</tr> |
735 | 778 |
</thead> |
736 | 779 |
<tbody> |
737 |
- {equipmentList.map((item, index) => { |
|
738 |
- return ( |
|
739 |
- <tr key={index}> |
|
740 |
- <td>{equipmentList.length - index}</td> |
|
741 |
- {key1.map((kes) => { |
|
742 |
- return <td>{item[kes]}</td> |
|
743 |
- })} |
|
744 |
- <td> |
|
745 |
- { |
|
746 |
- item['senior_id'] == null |
|
747 |
- ? <Button |
|
748 |
- className={"btn-small gray-btn"} |
|
749 |
- btnName={"등록"} |
|
750 |
- onClick={() => seniorMatchInsertModalOpen(item)} |
|
751 |
- /> |
|
752 |
- : <Button |
|
753 |
- className={"btn-small gray-btn"} |
|
754 |
- btnName={"반납"} |
|
755 |
- onClick={seniorMatchDelete} |
|
756 |
- /> |
|
757 |
- } |
|
758 |
- </td> |
|
759 |
- </tr> |
|
760 |
- ); |
|
761 |
- })} |
|
780 |
+ {equipmentList.length > 0 |
|
781 |
+ ? equipmentList.map((item, index) => { |
|
782 |
+ return ( |
|
783 |
+ <tr key={index}> |
|
784 |
+ <td>{equipmentList.length - index}</td> |
|
785 |
+ {key1.map((kes) => { |
|
786 |
+ return <td>{item[kes]}</td> |
|
787 |
+ })} |
|
788 |
+ <td> |
|
789 |
+ { |
|
790 |
+ item['senior_id'] == null |
|
791 |
+ ? <Button |
|
792 |
+ className={"btn-small gray-btn"} |
|
793 |
+ btnName={"등록"} |
|
794 |
+ onClick={() => seniorMatchInsertModalOpen(item)} |
|
795 |
+ /> |
|
796 |
+ : <Button |
|
797 |
+ className={"btn-small gray-btn"} |
|
798 |
+ btnName={"반납"} |
|
799 |
+ onClick={seniorMatchDelete} |
|
800 |
+ /> |
|
801 |
+ } |
|
802 |
+ </td> |
|
803 |
+ </tr> |
|
804 |
+ ); |
|
805 |
+ }) |
|
806 |
+ : <td colSpan={7}>조회된 데이터가 없습니다.</td> |
|
807 |
+ } |
|
762 | 808 |
</tbody> |
763 | 809 |
</table> |
764 | 810 |
</div> |
... | ... | @@ -818,7 +864,7 @@ |
818 | 864 |
{agencyEquipmentList.map((item, index) => { |
819 | 865 |
if(item) |
820 | 866 |
return ( |
821 |
- <tr key={index} onclick={agencyEquipmentOneModalOpen}> |
|
867 |
+ <tr key={index} onClick={() => agencyEquipmentOneModalOpen(item)}> |
|
822 | 868 |
<td>{agencyEquipmentList.length - index}</td> |
823 | 869 |
{/* {key11.map((kes) => { |
824 | 870 |
if(kes == "equipment_rental_state") { |
... | ... | @@ -841,7 +887,7 @@ |
841 | 887 |
return <td>{Object.values(equipmentRentalStates)[idx]}</td> |
842 | 888 |
})} |
843 | 889 |
<td>{item['equipment_match_idx']}</td> |
844 |
- <td onClick={event.stopPropagation()}> |
|
890 |
+ <td onClick={(e) => e.stopPropagation()}> |
|
845 | 891 |
{ |
846 | 892 |
item['equipment_rental_state'] == 'RENTABLE' |
847 | 893 |
? <Button |
... | ... | @@ -881,25 +927,28 @@ |
881 | 927 |
</tr> |
882 | 928 |
</thead> |
883 | 929 |
<tbody> |
884 |
- {agencySeniorEquipmentList.map((item, index) => { |
|
885 |
- return ( |
|
886 |
- <tr key={index}> |
|
887 |
- <td>{agencySeniorEquipmentList.length - index}</td> |
|
888 |
- {key22.map((kes) => { |
|
889 |
- return <td>{item[kes]}</td> |
|
890 |
- })} |
|
891 |
- <td> |
|
892 |
- { |
|
893 |
- <Button |
|
894 |
- className={"btn-small gray-btn"} |
|
895 |
- btnName={"반납"} |
|
896 |
- onClick={() => seniorMatchReturnModalOpen(item)} |
|
897 |
- /> |
|
898 |
- } |
|
899 |
- </td> |
|
900 |
- </tr> |
|
901 |
- ); |
|
902 |
- })} |
|
930 |
+ {agencySeniorEquipmentList.length > 0 |
|
931 |
+ ? agencySeniorEquipmentList.map((item, index) => { |
|
932 |
+ return ( |
|
933 |
+ <tr key={index}> |
|
934 |
+ <td>{agencySeniorEquipmentList.length - index}</td> |
|
935 |
+ {key22.map((kes) => { |
|
936 |
+ return <td>{item[kes]}</td> |
|
937 |
+ })} |
|
938 |
+ <td> |
|
939 |
+ { |
|
940 |
+ <Button |
|
941 |
+ className={"btn-small gray-btn"} |
|
942 |
+ btnName={"반납"} |
|
943 |
+ onClick={() => seniorMatchReturnModalOpen(item)} |
|
944 |
+ /> |
|
945 |
+ } |
|
946 |
+ </td> |
|
947 |
+ </tr> |
|
948 |
+ ); |
|
949 |
+ }) |
|
950 |
+ : <td colSpan={9}>조회된 데이터가 없습니다.</td> |
|
951 |
+ } |
|
903 | 952 |
</tbody> |
904 | 953 |
</table> |
905 | 954 |
</div> |
... | ... | @@ -922,25 +971,28 @@ |
922 | 971 |
</tr> |
923 | 972 |
</thead> |
924 | 973 |
<tbody> |
925 |
- {agencyStockEquipmentList.map((item, index) => { |
|
926 |
- return ( |
|
927 |
- <tr key={index}> |
|
928 |
- <td>{agencyStockEquipmentList.length - index}</td> |
|
929 |
- {key33.map((kes) => { |
|
930 |
- return <td>{item[kes]}</td> |
|
931 |
- })} |
|
932 |
- <td> |
|
933 |
- { |
|
934 |
- <Button |
|
935 |
- className={"btn-small gray-btn"} |
|
936 |
- btnName={"등록"} |
|
937 |
- onClick={() => seniorMatchInsertModalOpen(item)} |
|
938 |
- /> |
|
939 |
- } |
|
940 |
- </td> |
|
941 |
- </tr> |
|
942 |
- ); |
|
943 |
- })} |
|
974 |
+ {agencyStockEquipmentList.length > 0 |
|
975 |
+ ? agencyStockEquipmentList.map((item, index) => { |
|
976 |
+ return ( |
|
977 |
+ <tr key={index}> |
|
978 |
+ <td>{agencyStockEquipmentList.length - index}</td> |
|
979 |
+ {key33.map((kes) => { |
|
980 |
+ return <td>{item[kes]}</td> |
|
981 |
+ })} |
|
982 |
+ <td> |
|
983 |
+ { |
|
984 |
+ <Button |
|
985 |
+ className={"btn-small gray-btn"} |
|
986 |
+ btnName={"등록"} |
|
987 |
+ onClick={() => seniorMatchInsertModalOpen(item)} |
|
988 |
+ /> |
|
989 |
+ } |
|
990 |
+ </td> |
|
991 |
+ </tr> |
|
992 |
+ ); |
|
993 |
+ }) |
|
994 |
+ : <td colSpan={5}>조회된 데이터가 없습니다.</td> |
|
995 |
+ } |
|
944 | 996 |
</tbody> |
945 | 997 |
</table> |
946 | 998 |
</div> |
... | ... | @@ -1110,32 +1162,24 @@ |
1110 | 1162 |
<table className={"caregiver-user"}> |
1111 | 1163 |
<thead> |
1112 | 1164 |
<tr> |
1113 |
- {thead55.map((i) => { |
|
1165 |
+ {thead66.map((i) => { |
|
1114 | 1166 |
return <th>{i}</th>; |
1115 | 1167 |
})} |
1116 | 1168 |
</tr> |
1117 | 1169 |
</thead> |
1118 | 1170 |
<tbody> |
1119 |
- <tr> |
|
1120 |
- <td> |
|
1121 |
- <input type="date" onChange={seniorEquipmentRentalReturnDateInsert} /> |
|
1122 |
- </td> |
|
1123 |
- <td> |
|
1124 |
- <input type="text" list="senior_list" placeholder="반납 담당자를 입력해 주세요" onChange={seniorEquipmentReturnUserIdInsert} /> |
|
1125 |
- <datalist id="senior_list"> |
|
1126 |
- {workerList.map((item) => { |
|
1127 |
- return <option value={item['user_id']}>{item['user_name']}</option> |
|
1128 |
- })} |
|
1129 |
- </datalist> |
|
1130 |
- </td> |
|
1131 |
- <td> |
|
1132 |
- <Button |
|
1133 |
- className={"btn-small gray-btn"} |
|
1134 |
- btnName={"선택"} |
|
1135 |
- onClick={seniorEquipmentReturn} |
|
1136 |
- /> |
|
1137 |
- </td> |
|
1138 |
- </tr> |
|
1171 |
+ {seniorMatchListByEquipment.length > 0 |
|
1172 |
+ ? seniorMatchListByEquipment.map((item, index) => { |
|
1173 |
+ return ( |
|
1174 |
+ <tr> |
|
1175 |
+ {key66.map((kes) => { |
|
1176 |
+ return <td>{item[kes]}</td> |
|
1177 |
+ })} |
|
1178 |
+ </tr> |
|
1179 |
+ ); |
|
1180 |
+ }) |
|
1181 |
+ : <td colSpan={4}>조회된 데이터가 없습니다.</td> |
|
1182 |
+ } |
|
1139 | 1183 |
</tbody> |
1140 | 1184 |
</table> |
1141 | 1185 |
</div> |
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?