최정우 최정우 2023-04-05
230405 최정우 사용자 관리 완료 (시스템 관리자)
@8de7df428609265ccdfc7281a4c17273fe262ad6
client/resources/css/common.css
--- client/resources/css/common.css
+++ client/resources/css/common.css
@@ -431,8 +431,8 @@
 }
 
 /* 컬러 */
-.yellow{background: #f2db71;}
-.sky{background-color: #d1e4e3;}
-.grey{background-color: #8d8d8d;}
-.green{background-color: #219102;}
+.yellow{color: #f2db71;}
+.sky{color: #68d1cc;}
+.grey{color: #8d8d8d;}
+.green{color: #209101;}
 
client/views/component/Modal_SeniorInsert.jsx
--- client/views/component/Modal_SeniorInsert.jsx
+++ client/views/component/Modal_SeniorInsert.jsx
@@ -1,10 +1,10 @@
-import React, { useState, useRef } from "react";
+import React from "react";
 import { useSelector } from "react-redux";
 import SubTitle from "./SubTitle.jsx";
 
 import CommonUtil from "../../resources/js/CommonUtil.js";
 
-export default function Modal({ open, close, seniorInsertCallback, defaultAgencyId, defaultGovernmentId }) {
+export default function Modal({ open, close, seniorInsertCallback, defaultAgentId, defaultAgencyId, defaultGovernmentId }) {
 
   //console.log(`seniorInsertModal - defaultGovernmentId:${defaultGovernmentId}, defaultAgencyId:${defaultAgencyId}`)
 
@@ -67,7 +67,7 @@
 
 
   //등록할 시니어 정보
-  const [senior, setSenior] = useState({
+  const [senior, setSenior] = React.useState({
     'user_id': null,
     'user_name': null,
     'user_password': null,
@@ -87,13 +87,16 @@
     'senior_note': null,
 
     'seniorMedicationList': [],
+
+    'agent_id': !defaultAgentId ? state.loginUser['agent_id'] : defaultAgentId,
   });
   //console.log(`seniorInsertModal - senior:`, senior);
 
   //각 데이터별로 Dom 정보 담을 Ref 생성
   const seniorRefInit = JSON.parse(JSON.stringify(senior));
   seniorRefInit['user_gender'] = {};
-  const seniorRef = useRef(seniorRefInit);
+  seniorRefInit['user_id_check_button'] = null;
+  const seniorRef = React.useRef(seniorRefInit);
 
   //등록할 시니어 정보 변경
   const seniorValueChange = (targetKey, value) => {
@@ -137,7 +140,38 @@
     }
   }
 
+  //아이디 중복 확인
+  const [isIdCheck, setIsIdCheck] = React.useState(false);
+  //로그인 아이디 중복 검사
+  const userIdCheck = () => {
+    if (CommonUtil.isEmpty(senior['user_phonenumber']) == true) {
+      seniorRef.current['user_phonenumber'].focus();
+      alert("연락처를 입력해 주세요.");
+      return false;
+    }
 
+    senior['user_id'] = senior['user_phonenumber'];
+    fetch("/user/userSelectOne.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify(senior),
+    }).then((response) => response.json()).then((data) => {
+      console.log("로그인 아이디 중복 검사(아이디를 통한 사용자 조회) : ", data);
+      if (CommonUtil.isEmpty(data) == true) {
+        setIsIdCheck(true);
+        seniorRef.current['user_address'].focus();
+        alert("사용가능한 연락처 입니다.");
+      } else {
+        setIsIdCheck(false);
+        seniorRef.current['user_phonenumber'].focus();
+        alert("이미 존재하는 연락처 입니다.");
+      }
+    }).catch((error) => {
+      console.log('userIdCheck() /user/userSelectOne.json error : ', error);
+    });
+  }
   //시니어 등록 유효성 검사
   const seniorInsertValidation = () => {
     if (CommonUtil.isEmpty(senior['government_id']) == true) {
@@ -168,6 +202,10 @@
     if (CommonUtil.isEmpty(senior['user_phonenumber']) == true) {
       seniorRef.current['user_phonenumber'].focus();
       alert("연락처를 입력해 주세요.");
+      return false;
+    }
+    if (isIdCheck == false) {
+      alert("연락처 중복확인을 해주세요.");
       return false;
     }
     if (CommonUtil.isEmpty(senior['user_address']) == true) {
@@ -306,11 +344,15 @@
                 <tr>
                   <th><span style={{color : "red"}}>*</span>연락처</th>
                   <td colSpan={3}>
-                    <input type="number" maxLength="11"
+                    <input type="number" maxLength="11" style={{width: 'calc(100% - 160px)'}}
                       value={senior['user_phonenumber']}
                       onChange={(e) => {seniorValueChange('user_phonenumber', e.target.value)}}
                       ref={el => seniorRef.current['user_phonenumber'] = el}
                     />
+                    <button className={"red-btn btn-large"} onClick={userIdCheck}
+                      ref={el => seniorRef.current['user_id_check_button'] = el}>
+                      중복확인
+                    </button>
                   </td>
                 </tr>
                 <tr>
client/views/pages/AppRoute.jsx
--- client/views/pages/AppRoute.jsx
+++ client/views/pages/AppRoute.jsx
@@ -51,6 +51,9 @@
 import Healthcare from "./healthcare/Healthcare.jsx"
 import Medicalcare from "./healthcare/Medicalcare.jsx"
 
+import UserEdit from "./user_management/UserEdit.jsx";
+import AgentSelectOne from "./user_management/AgentSelectOne.jsx";
+
 const AllAppMenuItems = [
   {
     title: "올잇메디",
@@ -461,7 +464,10 @@
       <Route path="/QandAConfirm" element={<QandAConfirm />}></Route>
       <Route path="/Join" element={<Join />}></Route>
       <Route path="/SeniorEdit" element={<SeniorEdit />}></Route>
-      <Route path="/SeniorSelectOne" element={<SeniorSelectOne />}></Route>      
+      <Route path="/SeniorSelectOne" element={<SeniorSelectOne />}></Route>
+      <Route path="/UserEdit" element={<UserEdit />}></Route>
+      <Route path="/AgentSelectOne" element={<AgentSelectOne />}></Route>
+      
     </Routes>
   );
 }
@@ -562,9 +568,12 @@
       <Route path="/QandAConfirm" element={<QandAConfirm />}></Route>
       <Route path="/QandAInsert" element={<QandAInsert />}></Route>
       <Route path="/ProtectorSelect" element={<ProtectorSelect />}></Route>
-      <Route path="/SeniorEdit/:seniorId" element={<SeniorEdit />}></Route>
       <Route path="/AgencyInsert" element={<AgencyInsert />}></Route>
       <Route path="/Join" element={<Join />}></Route>
+      <Route path="/SeniorEdit" element={<SeniorEdit />}></Route>
+      <Route path="/SeniorSelectOne" element={<SeniorSelectOne />}></Route>
+      <Route path="/UserEdit" element={<UserEdit />}></Route>
+      <Route path="/AgentSelectOne" element={<AgentSelectOne />}></Route>
     </Routes>
   );
 }
@@ -632,8 +641,10 @@
       
       <Route path="/Main" element={<Main_agency />}></Route>
       <Route path="/UserAuthoriySelect_agency" element={<UserAuthoriySelect_agency />}></Route>
-      <Route path="/SeniorEdit/:seniorId" element={<SeniorEdit />}></Route>
-      <Route path="/SeniorSelectOne/:seniorId" element={<SeniorSelectOne />}></Route>
+      <Route path="/SeniorEdit" element={<SeniorEdit />}></Route>
+      <Route path="/SeniorSelectOne" element={<SeniorSelectOne />}></Route>
+      <Route path="/UserEdit" element={<UserEdit />}></Route>
+      <Route path="/AgentSelectOne" element={<AgentSelectOne />}></Route>
       <Route
         path="/MedicineCareSelectOne"
         element={<MedicineCareSelectOne />}
client/views/pages/join/Join.jsx
--- client/views/pages/join/Join.jsx
+++ client/views/pages/join/Join.jsx
@@ -62,7 +62,7 @@
   }
   /**** 기본 조회 데이터 (종료) ****/
 
-  //로그인 중복 확인
+  //아이디 중복 확인
   const [isIdCheck, setIsIdCheck] = React.useState(false);
 
   //등록할 사용자 정보
@@ -123,6 +123,12 @@
   }
   //로그인 아이디 중복 검사
   const userIdCheck = () => {
+    if (CommonUtil.isEmpty(user['user_id']) == true) {
+      userRef.current['user_id'].focus();
+      alert("아이디를 입력해 주세요.");
+      return;
+    }
+
     fetch("/user/userSelectOne.json", {
       method: "POST",
       headers: {
@@ -172,7 +178,7 @@
       return false;
     }
     if (isIdCheck == false) {
-      alert("아이디 중복 확인을 해주세요.");
+      alert("아이디 중복확인을 해주세요.");
       return false;
     }
     if (CommonUtil.isEmpty(user['user_password']) == true) {
@@ -222,6 +228,31 @@
       }
     }).catch((error) => {
       console.log('userInsert() /user/userInsert.json error : ', error);
+    });
+  }
+
+  //보호사 등록
+  const agentInsert = () => {
+    if (userInsertValidation() == false) {
+      return;
+    }
+
+    fetch("/user/agentInsert.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify(user),
+    }).then((response) => response.json()).then((data) => {
+      console.log("보호사 등록 결과(건수) : ", data);
+      if (data > 0) {
+        alert("계정생성완료");
+        navigate(-1);
+      } else {
+        alert("계정생성에 실패하였습니다. 관리자에게 문의바랍니다.");
+      }
+    }).catch((error) => {
+      console.log('agentInsert() /user/agentInsert.json error : ', error);
     });
   }
   
@@ -351,7 +382,10 @@
 
             <div className="btn-wrap">
               <button className={"gray-btn btn-large"} onClick={() => {navigate(-1)}}>취소</button>
-              <button className={"red-btn btn-large"} onClick={userInsert}>등록</button>
+              {user['authority'] == "ROLE_AGENCY"
+                ? <button className={"red-btn btn-large"} onClick={agentInsert}>등록</button>
+                : <button className={"red-btn btn-large"} onClick={userInsert}>등록</button>
+              }
             </div>
 
           </div>
client/views/pages/senior_management/SeniorEdit.jsx
--- client/views/pages/senior_management/SeniorEdit.jsx
+++ client/views/pages/senior_management/SeniorEdit.jsx
@@ -1,177 +1,353 @@
 import React from "react";
-import Button from "../../component/Button.jsx";
-import ContentTitle from "../../component/ContentTitle.jsx";
-import { useNavigate } from "react-router";
+import { useNavigate, useLocation } from "react-router";
+import { useSelector } from "react-redux";
 import SubTitle from "../../component/SubTitle.jsx";
-import { useParams } from "react-router";
+
+import CommonUtil from "../../../resources/js/CommonUtil.js";
 
 export default function SeniorEdit() {
   const navigate = useNavigate();
-  let { seniorId } = useParams();
+  const location = useLocation();
 
-  const [seniortOne, setSeniorOne] = React.useState([]);
+  /**** 기본 조회 데이터 (시작) ****/
+  //전역 변수 저장 객체
+  const state = useSelector((state) => {return state});
 
-  //-------- 상세페이지 선택된 대상자의 정보 불러오기 --------//
-  const getSeniorDataOne = () => {
-    fetch("/user/selectSeniorOne.json", {
+  //기관 계층 구조 목록
+  const [orgListOfHierarchy, setOrgListOfHierarchy] = React.useState([]);
+  //기관(관리, 시행) 계층 구조 목록 조회
+  const orgSelectListOfHierarchy = () => {
+    fetch("/org/orgSelectListOfHierarchy.json", {
       method: "POST",
       headers: {
         'Content-Type': 'application/json; charset=UTF-8'
       },
-      body: JSON.stringify({
-        user_id: seniorId
-      }),
+      body: JSON.stringify({}),
     }).then((response) => response.json()).then((data) => {
-      setSeniorOne(data[0]);
-      setTelNum(data[0].user_phonenumber)
-      setHomeAddress(data[0].user_address)
-      setMedicineM(data[0].breakfast_medication_check)
-      setMedicineL(data[0].lunch_medication_check)
-      setMedicineD(data[0].dinner_medication_check)
-      setMedication(data[0].medication_pill)
-      setNote(data[0].senior_note)
-
+      console.log("기관(관리, 시행) 계층 구조 목록 조회 : ", data);
+      setOrgListOfHierarchy(data);
     }).catch((error) => {
-      console.log('getSeniorDataOne() /user/selectSeniorOne.json error : ', error);
+      console.log('orgSelectListOfHierarchy() /org/orgSelectListOfHierarchy.json error : ', error);
     });
   };
+  const getAgencyList = () => {
+    const government = orgListOfHierarchy.find(item => item['government_id'] == senior['government_id']);
+    if (CommonUtil.isEmpty(government) || CommonUtil.isEmpty(government['agencyList'])) {
+      return [];
+    } else {
+      return government['agencyList'];
+    }
+  }
 
-  //초기값 세팅
-  const [telNum, setTelNum] = React.useState("");
-  const [homeAddress, setHomeAddress] = React.useState("");
-  const [medicineM, setMedicineM] = React.useState(false);
-  const [medicineL, setMedicineL] = React.useState(false);
-  const [medicineD, setMedicineD] = React.useState(false);
-  const [medication, setMedication] = React.useState("");
-  const [note, setNote] = React.useState("");
-
-  //-------- 변경되는 데이터 Handler 설정 --------//
-  const handleTelNum = (e) => {
-    e.target.value = e.target.value.replace(/[^0-9]/g, '').replace(/^(\d{2,3})(\d{3,4})(\d{4})$/, `$1-$2-$3`);
-    setTelNum(e.target.value);
-  };
-  const handleHomeAddress = (e) => {
-    setHomeAddress(e.target.value);
-  };
-  const handleMedicineM = (e) => {
-    setMedicineM(e.target.checked);
-  };
-  const handleMedicineL = (e) => {
-    setMedicineL(e.target.checked);
-  };
-  const handleMedicineD = (e) => {
-    setMedicineD(e.target.checked);
-  };
-  const handleMedication = (e) => {
-    setMedication(e.target.value);
-  };
-  const handleNote = (e) => {
-    setNote(e.target.value);
-  };
-
-  const updateSeniorData = () => {
-    console.log("telNum : ", telNum);
-    console.log("homeAddress : ", homeAddress);
-    console.log("note : ", note);
-    console.log("medicineM : ", medicineM);
-    console.log("medicineL : ", medicineL);
-    console.log("medicineD : ", medicineD);
-    fetch("/user/updateSeniorMadication.json", {
+  const [medicationTimeCodeList, setMedicationTimeCodeList] = React.useState([]);
+  //복약 시간 코드 목록 조회
+  const medicationTimeCodeSelectList = () => {
+    fetch("/common/medicationTimeCodeSelectList.json", {
       method: "POST",
       headers: {
         'Content-Type': 'application/json; charset=UTF-8'
       },
-      body: JSON.stringify({
-        user_id: seniorId,
-        user_phonenumber: telNum,
-        user_address: homeAddress,
-        breakfast_medication_check: medicineM,
-        lunch_medication_check: medicineL,
-        dinner_medication_check: medicineD,
-        medication_pill: medication ,
-        senior_note: note ,
-      }),
+      body: JSON.stringify({}),
     }).then((response) => response.json()).then((data) => {
-      alert("수정 되었습니다.");
-      navigate(`/SeniorSelectOne/${seniorId}`);
+      console.log("복약 시간 코드 목록 조회 : ", data);
+      setMedicationTimeCodeList(data);
+
+      //시니어 복약 정보 미리 세팅
+      let newSenior = JSON.parse(JSON.stringify(senior));
+      for (let i = 0; i < data.length; i++) {
+        newSenior['seniorMedicationList'].push(data[i]['medication_time_code']);
+      }
+      setSenior(newSenior);
     }).catch((error) => {
-      console.log('updateSeniorData() /user/updateSeniorMadication.json error : ', error);
+      console.log('medicationTimeCodeSelectList() /common/medicationTimeCodeSelectList.json error : ', error);
+    });
+  }
+  /**** 기본 조회 데이터 (종료) ****/
+
+
+
+  //시니어 정보
+  const [senior, setSenior] = React.useState({
+    'user_id': location.state['senior_id'],
+    'user_name': null,
+    'user_password': null,
+    'user_phonenumber': null,
+    'user_birth': null,
+    'user_gender': null,
+    'user_address': null,
+    'user_email': null,
+    'authority': 'ROLE_SENIOR',
+    'agency_id': null,
+    'government_id': null,
+
+    'senior_id': location.state['senior_id'],
+    'care_grade': null,
+    'medication_pill': null,
+    'underlie_disease': null,
+    'senior_note': null,
+
+    'seniorMedicationList': []
+  });
+  //시니어 상세 조회
+  const seniorSelectOne = () => {
+    fetch("/user/seniorSelectOne.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify(senior),
+    }).then((response) => response.json()).then((data) => {
+      console.log("seniorSelectOne data : ", data);
+      setSenior(data);
+    }).catch((error) => {
+      console.log('seniorSelectOne() /user/seniorSelectOne.json error : ', error);
     });
   };
 
+  //각 데이터별로 Dom 정보 담을 Ref 생성
+  const seniorRefInit = JSON.parse(JSON.stringify(senior));
+  seniorRefInit['user_gender'] = {};
+  const seniorRef = React.useRef(seniorRefInit);
+
+  //등록할 시니어 정보 변경
+  const seniorValueChange = (targetKey, value) => {
+    let newSenior = JSON.parse(JSON.stringify(senior));
+    newSenior[targetKey] = value;
+    setSenior(newSenior);
+  }
+  //등록할 시니어의 관리기관 변경
+  const seniorGovernmentIdChange = (value) => {
+    let newSenior = JSON.parse(JSON.stringify(senior));
+    if (CommonUtil.isEmpty(value) == true) {
+      newSenior['government_id'] = null;
+    } else {
+      newSenior['government_id'] = value;
+    }
+    newSenior['agency_id'] = null;
+    setSenior(newSenior);
+  }
+  //등록할 시니어의 시행기관 변경
+  const seniorAgencyIdChange = (value) => {
+    let newSenior = JSON.parse(JSON.stringify(senior));
+    if (CommonUtil.isEmpty(value) == true) {
+      newSenior['agency_id'] = null;
+    } else {
+      newSenior['agency_id'] = value;
+    }
+    setSenior(newSenior);
+  }
+  //등록할 시니어의 기본 복약 정보 변경
+  const seniorMedicationChange = (value, isChecked) => {
+    let newSenior = JSON.parse(JSON.stringify(senior));
+    let index = newSenior['seniorMedicationList'].indexOf(value);
+    if (isChecked == true && index == -1) {
+      newSenior['seniorMedicationList'].push(value);
+      setSenior(newSenior);
+    } else if (isChecked == false && index > -1) {
+      newSenior['seniorMedicationList'].splice(index, 1);
+      setSenior(newSenior);
+    } else {
+      return;
+    }
+  }
+
+
+  //시니어 등록 유효성 검사
+  const seniorUpdatetValidation = () => {
+    if (CommonUtil.isEmpty(senior['government_id']) == true) {
+      seniorRef.current['government_id'].focus();
+      alert("관리기관을 선택해 주세요.");
+      return false;
+    }
+    if (CommonUtil.isEmpty(senior['agency_id']) == true) {
+      seniorRef.current['agency_id'].focus();
+      alert("시행기관을 선택해 주세요.");
+      return false;
+    }
+    if (CommonUtil.isEmpty(senior['user_name']) == true) {
+      seniorRef.current['user_name'].focus();
+      alert("이름을 입력해 주세요.");
+      return false;
+    }
+    if (CommonUtil.isEmpty(senior['user_gender']) == true) {
+      seniorRef.current['user_gender']['m'].focus();
+      alert("성별을 선택해 주세요.");
+      return false;
+    }
+    if (CommonUtil.isEmpty(senior['user_birth']) == true) {
+      seniorRef.current['user_birth'].focus();
+      alert("생년월일을 선택해 주세요.");
+      return false;
+    }
+    if (CommonUtil.isEmpty(senior['user_phonenumber']) == true) {
+      seniorRef.current['user_phonenumber'].focus();
+      alert("연락처를 입력해 주세요.");
+      return false;
+    }
+    if (CommonUtil.isEmpty(senior['user_address']) == true) {
+      seniorRef.current['user_address'].focus();
+      alert("주소를 입력해 주세요.");
+      return false;
+    }
+
+    return true;
+  }
+  //시니어 등록
+  const seniorUpdate = () => {
+    if (seniorUpdatetValidation() == false) {
+      return;
+    }
+
+    fetch("/user/seniorUpdate.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify(senior),
+    }).then((response) => response.json()).then((data) => {
+      console.log("시니어 수정 결과(건수) : ", data);
+      if (data > 0) {
+        alert("수정완료");
+        navigate(-1);
+      } else {
+        alert("등록에 실패하였습니다. 관리자에게 문의바랍니다.");
+      }
+    }).catch((error) => {
+      console.log('seniorUpdate() /user/seniorUpdate.json error : ', error);
+    });
+  }
+
+
+  //Mounted
   React.useEffect(() => {
-    getSeniorDataOne();
-
+    orgSelectListOfHierarchy();
+    medicationTimeCodeSelectList();
+    seniorSelectOne();
   }, [])
+
+
   return (
     <main>
-      <div className="board-wrap">
+      <div className="content-wrap row">
+
+        <div className="margin-bottom5">
           <SubTitle explanation={"수정페이지"} className="margin-bottom" />
           <table className="margin-bottom2 senior-detail">
-            {/* <tr>
-              <th>대상자등록번호</th>
-              <td colSpan={3} className="flex">
-                <input type="text" placeholder="생성하기 버튼 클릭 시 자동으로 생성됩니다."/>
-                <Button
-              className={"btn-large gray-btn"}
-              btnName={"생성하기"}
-            />
-              </td>
-            </tr> */}
             <tr>
-              <th>아이디</th>
+              <th><span style={{color : "red"}}>*</span>관리기관</th>
               <td>
-                <span>{seniortOne.user_id}</span>
+                <select onChange={(e) => {seniorGovernmentIdChange(e.target.value)}}
+                  ref={el => seniorRef.current['government_id'] = el}>
+                  <option value={''} selected={senior['government_id'] == null}>관리기관선택</option>
+                  {orgListOfHierarchy.map((item, idx) => { return (
+                    <option key={idx} value={item['government_id']} selected={senior['government_id'] == item['government_id']}>
+                      {item['government_name']}
+                    </option>
+                  )})}
+                </select>
+              </td>
+              <th><span style={{color : "red"}}>*</span>시행기관</th>
+              <td>
+                <select onChange={(e) => {seniorAgencyIdChange(e.target.value)}}
+                  ref={el => seniorRef.current['agency_id'] = el}>
+                  <option value={''} selected={senior['agency_id'] == null}>시행기관선택</option>
+                  {getAgencyList().map((item, idx) => { return (
+                    <option key={idx} value={item['agency_id']} selected={senior['agency_id'] == item['agency_id']}>
+                      {item['agency_name']}
+                    </option>
+                  )})}
+                </select>
               </td>
             </tr>
             <tr>
-            <th>이름</th>
+              <th><span style={{color : "red"}}>*</span>이름</th>
               <td>
-                <span>{seniortOne.user_name}</span>
+                <input type="text"
+                  value={senior['user_name']}
+                  onChange={(e) => {seniorValueChange('user_name', e.target.value)}}
+                  ref={el => seniorRef.current['user_name'] = el}
+                />
               </td>
-              <th>성별</th>
-              <td>
-                <span>{seniortOne.user_gender}</span>
+              <th><span style={{color : "red"}}>*</span>성별</th>
+              <td className="">
+                <div className="gender flex-start">
+                  <div className="flex-start">
+                    <input type="radio" id="user_gender_m" name="user_gender" value="남" checked={senior['user_gender'] == '남'}
+                      onChange={(e) => {e.target.checked ? seniorValueChange('user_gender', e.target.value) : null}}
+                      ref={el => seniorRef.current['user_gender']['m'] = el}
+                      />
+                    <label for="user_gender_m">남</label>
+                  </div>
+                  <div className="flex-start">
+                    <input type="radio" id="user_gender_f" name="user_gender" value="여" checked={senior['user_gender'] == '여'}
+                      onChange={(e) => {e.target.checked ? seniorValueChange('user_gender', e.target.value) : null}}
+                      ref={el => seniorRef.current['user_gender']['f'] = el}
+                      />
+                    <label for="user_gender_f">여</label>
+                  </div>
+                </div >
               </td>
             </tr>
             <tr>
-            <th>생년월일</th>
+              <th><span style={{color : "red"}}>*</span>생년월일</th>
               <td>
-                <span>{seniortOne.user_birth}</span>
+                <div className="flex">
+                  <input type='date'
+                    value={senior['user_birth']}
+                    onChange={(e) => {seniorValueChange('user_birth', e.target.value)}}
+                    ref={el => seniorRef.current['user_birth'] = el}
+                  />
+                </div>
               </td>
             </tr>
             <tr>
-              <th>연락처</th>
+              <th><span style={{color : "red"}}>*</span>연락처</th>
               <td colSpan={3}>
-                <input type="text" maxLength="13" value={telNum} onChange={handleTelNum} />
+                <input type="number" maxLength="11"
+                  value={senior['user_phonenumber']}
+                  onChange={(e) => {seniorValueChange('user_phonenumber', e.target.value)}}
+                  ref={el => seniorRef.current['user_phonenumber'] = el}
+                />
               </td>
             </tr>
             <tr>
-              <th>주소</th>
+              <th><span style={{color : "red"}}>*</span>주소</th>
               <td colSpan={3}>
-                <input type="text" value={homeAddress} onChange={handleHomeAddress} />
+                <input type="text"
+                  value={senior['user_address']}
+                  onChange={(e) => {seniorValueChange('user_address', e.target.value)}}
+                  ref={el => seniorRef.current['user_address'] = el}
+                />
               </td>
             </tr>
             <tr>
               <th>필요 복약</th>
-              <td>
-                <div className="flex-start">
-                  <input type="checkbox" name="medicationSelect" checked={medicineM} onClick={(e) => { handleMedicineM(e) }} /><label for="medicationTime">아침</label>
-                  <input type="checkbox" name="medicationSelect" checked={medicineL} onClick={(e) => { handleMedicineL(e) }} /><label for="medicationTime">점심</label>
-                  <input type="checkbox" name="medicationSelect" checked={medicineD} onClick={(e) => { handleMedicineD(e) }} /><label for="medicationTime">저녁</label>
+              <td className="medicationTime-td">
+                <div className="flex">
+                  {medicationTimeCodeList.map((item, idx) => { return (
+                    <span key={idx}>
+                      <input type="checkbox"
+                        name="medicationTimeCodeList"
+                        id={item['medication_time_code']}
+                        value={item['medication_time_code']}
+                        onChange={(e) => {seniorMedicationChange(e.target.value, e.target.checked)}}
+                        checked={senior['seniorMedicationList'].indexOf(item['medication_time_code']) > -1}/>
+                      <label for={item['medication_time_code']}>{item['medication_time_code_name']}</label>
+                    </span>
+                  )})}
                 </div>
               </td>
             </tr>
             <tr>
               <th>복용중인 약</th>
               <td colSpan={3}>
-                <textarea className="medicine" cols="30" rows="2" value={medication} onChange={handleMedication}></textarea>
+                <textarea className="medicine" cols="30" rows="2" value={senior['medication_pill']} onChange={(e) => {seniorValueChange('medication_pill', e.target.value)}} />
               </td>
             </tr>
             <tr>
               <th>비고</th>
               <td colSpan={3}>
-                <textarea className="note" cols="30" rows="2" value={note} onChange={handleNote}></textarea>
+                <textarea className="note" cols="30" rows="2" value={senior['senior_note']} onChange={(e) => {seniorValueChange('senior_note', e.target.value)}} />
               </td>
             </tr>
 
@@ -182,22 +358,14 @@
               </td>
             </tr> */}
           </table>
-          <div className="btn-wrap flex-center">
-          <Button
-              className={"btn-small gray-btn"}
-              btnName={"이전"}
-              onClick={() => {navigate(-1)
-              }}
-            />
-            <Button
-              className={"btn-small gray-btn"}
-              btnName={"저장"}
-              onClick={() => {
-                updateSeniorData();
-              }}
-            />
-          </div>
         </div>
+
+        <div className="btn-wrap flex-center">
+          <button className={"btn-large gray-btn"} onClick={() => navigate(-1)}>이전</button>
+          <button className={"btn-large red-btn"} onClick={seniorUpdate}>수정</button>
+        </div>
+
+      </div>
     </main>
   );
 }
client/views/pages/senior_management/SeniorSelectOne.jsx
--- client/views/pages/senior_management/SeniorSelectOne.jsx
+++ client/views/pages/senior_management/SeniorSelectOne.jsx
@@ -8,7 +8,6 @@
 export default function SeniorSelectOne() {
   const navigate = useNavigate();
   const location = useLocation();
-  console.log('location.state : ', location.state);
 
   //보호자 모달 오픈 여부
   const [modalGuardianIsOpen, setModalGuardianIsOpen] = React.useState(false);
@@ -136,7 +135,7 @@
       },
       body: JSON.stringify(user),
     }).then((response) => response.json()).then((data) => {
-      console.log("시니어 등록 결과(건수) : ", data);
+      console.log("가입승인 결과(건수) : ", data);
       if (data > 0) {
         alert("승인완료");
         callback();
@@ -195,9 +194,9 @@
             </tr>
             
             <tr>
-              <th>생년월일</th>
+              <th>연락처</th>
               <td>
-                <span>{senior['user_birth']}</span>
+                <span>{senior['user_phonenumber']}</span>
               </td>
             </tr>
 
@@ -240,7 +239,7 @@
           </tbody>
         </table>
         <div className="btn-wrap flex-center">
-          <button className={"btn-large gray-btn"} onClick={() => {navigate("/SeniorEdit");}}>수정</button>
+          <button className={"btn-large gray-btn"} onClick={() => {navigate("/SeniorEdit", {state: {'senior_id': senior['senior_id']}})}}>수정</button>
           <button className={"btn-large red-btn"} onClick={() => alert("삭제할 수 없습니다.")}>삭제</button>
         </div>
       </div>
@@ -320,7 +319,7 @@
                 <td>{item['agent_match_start_date']}</td>
                 <td>{item['agent_match_end_date']}</td>
                 <td>
-                  <button className={"btn-small lightgray-btn"} onClick={() => {}}>상세 페이지 이동</button>
+                  <button className={"btn-small lightgray-btn"} onClick={() => {navigate("/AgentSelectOne", {state: {'agent_id': item['agent_id']}})}}>상세 페이지 이동</button>
                 </td>
               </tr>
             )})}
 
client/views/pages/user_management/AgentSelectOne.jsx (added)
+++ client/views/pages/user_management/AgentSelectOne.jsx
@@ -0,0 +1,267 @@
+import React from "react";
+import { useNavigate, useLocation } from "react-router";
+
+import SubTitle from "../../component/SubTitle.jsx";
+import Modal_Guardian from "../../component/Modal_Guardian.jsx";
+import Modal_SeniorInsert from "../../component/Modal_SeniorInsert.jsx";
+
+
+export default function AgentSelectOne() {
+  const navigate = useNavigate();
+  const location = useLocation();
+
+
+  //대상자(시니어) 등록 모달 오픈 여부
+  const [modalSeniorInsertIsOpen, setModalSeniorInsertIsOpen] = React.useState(false);
+  //대상자(시니어) 등록 모달 오픈
+  const modalSeniorInsertOpen = () => {
+    setModalSeniorInsertIsOpen(true);
+  };
+  //대상자(시니어) 등록 모달 닫기
+  const modalSeniorInsertClose = () => {
+    setModalSeniorInsertIsOpen(false);
+  };
+
+
+  //시니어 정보
+  const [agent, setAgent] = React.useState({
+    'user_id': location.state['agent_id'],
+    'user_name': null,
+    'user_password': null,
+    'user_phonenumber': null,
+    'user_birth': null,
+    'user_gender': null,
+    'user_address': null,
+    'user_email': null,
+    'authority': 'ROLE_AGENCY',
+    'agency_id': null,
+    'government_id': null,
+
+    'agent_id': location.state['agent_id'],
+  });
+  //시니어 상세 조회
+  const agentSelectOne = () => {
+    fetch("/user/userSelectOne.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify(agent),
+    }).then((response) => response.json()).then((data) => {
+      console.log("agentSelectOne data : ", data);
+      data['agent_id'] = location.state['agent_id'];
+      setAgent(data);
+    }).catch((error) => {
+      console.log('agentSelectOne() /user/userSelectOne.json error : ', error);
+    });
+  };
+
+  //보호사의 대상자 목록
+  const [seniorByAgent, setSeniorByAgent] = React.useState({seniorListByAgent: [], seniorListCountByAgent: 0});
+  //보호사의 선택한 대상자 정보
+  const [senior, setSenior] = React.useState({});
+  //보호사의 대상자 목록 조회
+  const seniorSelectListByAgent = () => {
+    fetch("/user/seniorSelectListByAgent.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify(agent),
+    }).then((response) => response.json()).then((data) => {
+      console.log("seniorSelectListByAgent data : ", data);
+      setSeniorByAgent(data);
+    }).catch((error) => {
+      console.log('seniorSelectListByAgent() /user/seniorSelectListByAgent.json error : ', error);
+    });
+  };
+
+  //선택한 보호자 정보 관리
+  const guardianByAgentManagement = (item) => {
+    setSenior(item);
+  }
+
+  //가입승인
+  const userUpdate = () => {
+    agent['is_accept'] = true;
+
+    fetch("/user/userUpdate.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify(agent),
+    }).then((response) => response.json()).then((data) => {
+      console.log("가입승인 결과(건수) : ", data);
+      if (data > 0) {
+        alert("승인완료");
+        agentSelectOne();
+      } else {
+        alert("승인에 실패하였습니다. 관리자에게 문의바랍니다.");
+      }
+    }).catch((error) => {
+      console.log('userUpdate() /user/userUpdate.json error : ', error);
+    });
+  }
+
+
+
+  //보호자의 대상자 제거
+  const agentSeniorDelete = (senior) => {
+    if (confirm('해당 보호대상자의 케어를 종료하시겠습니까?') == false) {
+      return;
+    }
+
+    fetch("/user/agentSeniorDelete.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify(senior),
+    }).then((response) => response.json()).then((data) => {
+      console.log("보호자의 대상자 제거 결과(건수) : ", data);
+      if (data > 0) {
+        alert("케어종료완료");
+        seniorSelectListByAgent();
+      } else {
+        alert("케어종료에 실패하였습니다. 관리자에게 문의바랍니다.");
+      }
+    }).catch((error) => {
+      console.log('agentSeniorDelete() /user/agentSeniorDelete.json error : ', error);
+    });
+  }
+
+  React.useEffect(() => {
+    agentSelectOne();
+    seniorSelectListByAgent();
+  }, [])
+
+
+  return (
+    <main>
+      <Modal_SeniorInsert
+        open={modalSeniorInsertIsOpen}
+        close={modalSeniorInsertClose}
+        seniorInsertCallback={() => {seniorSelectListByAgent(); modalSeniorInsertClose();}}
+        defaultAgentId={agent['agent_id']}
+        defaultAgencyId={agent['agency_id']}
+        defaultGovernmentId={agent['government_id']}
+      />
+
+      <div className="content-wrap row">
+        <SubTitle explanation={"대상자 상세 프로필"} className="margin-bottom" />
+        <div className="margin-bottom5">
+          <table className="margin-bottom senior-detail">
+            <tbody>
+              <tr>
+                <th>관리기관</th>
+                <td>
+                  <span>{agent['government_name']}</span>
+                </td>             
+              </tr>
+
+              <tr>
+                <th>시행기관</th>
+                <td>
+                  <span>{agent['agency_name']}</span>
+                </td>              
+              </tr>
+
+              <tr>
+                <th>이름(아이디)</th>
+                <td>
+                  <span>{agent['user_name']}({agent['user_id']})</span>
+                </td>           
+              </tr>
+              
+              <tr>
+                <th>연락처</th>
+                <td>
+                  <span>{agent['user_phonenumber']}</span>
+                </td>
+              </tr>
+
+              <tr>
+                <th>이메일</th>
+                <td>
+                  <span>{agent['user_email']}</span>
+                </td>         
+              </tr>
+
+              <tr>
+                <th>가입승인관리</th>
+                <td>
+                  {agent['is_accept'] ? <span>승인완료</span> : 
+                    <button className={"btn-small red-btn"} onClick={userUpdate}>가입승인</button>
+                  }
+                </td>         
+              </tr>
+              
+            </tbody>
+          </table>
+          <div className="btn-wrap flex-center">
+            <button className={"btn-large gray-btn"} onClick={() => {navigate("/UserEdit", {state: {'user_id': agent['user_id']}})}}>수정</button>
+            <button className={"btn-large red-btn"} onClick={() => alert("삭제할 수 없습니다.")}>삭제</button>
+          </div>
+        </div>
+
+        <SubTitle explanation={"보호사의 보호대상자"} className="margin-bottom display-inline-block" />
+        <button className={"btn-small gray-btn display-inline-block float-right"} onClick={() => modalSeniorInsertOpen()}>보호대상자 추가</button>
+        <div className="margin-bottom5">
+          <table className={"agent-user"}>
+            <thead>
+              <tr>
+                <th>No</th>
+                {/* <th>관리기관명</th>
+                <th>소속기관명</th> */}
+                <th>이름</th>
+                <th>연락처</th>
+                <th>생년월일</th>
+                <th>성별</th>
+                <th>상태</th>
+                <th>배정시작일</th>
+                <th>배정종료일</th>
+                <th>상세보기</th>
+              </tr>
+            </thead>
+            <tbody>
+              {seniorByAgent.seniorListByAgent.map((item, idx) => { return (
+                <tr key={idx}>
+                  <td>{idx + 1}</td>
+                  {/* <td>{item['government_name']}</td>
+                  <td>{item['agency_name']}</td> */}
+                  <td>{item['user_name']}</td>
+                  <td>{item['user_phonenumber']}</td>
+                  <td>{item['user_birth']}</td>
+                  <td>{item['user_gender']}</td>
+                  <td>{item['agent_match_state'] ? <span className="green">케어중</span> : <span className="grey">케어완료</span>}</td>
+                  <td>{item['agent_match_start_date']}</td>
+                  <td>
+                    {item['agent_match_state'] ?
+                     <button className={"btn-small red-btn"} onClick={() => {agentSeniorDelete(item)}}>케어종료</button>
+                     : item['agent_match_end_date']
+                    }
+                  </td>
+                  <td>
+                    <button className={"btn-small lightgray-btn"} onClick={() => {navigate("/SeniorSelectOne", {state: {'senior_id': item['user_id']}})}}>상세 페이지 이동</button>
+                  </td>
+                </tr>
+              )})}
+              {seniorByAgent.seniorListByAgent == null || seniorByAgent.seniorListByAgent.length == 0 ?
+                <tr>
+                  <td colSpan={9}>조회된 데이터가 없습니다</td>
+                </tr>
+              : null}
+            </tbody>
+          </table>
+        </div>
+
+        <div className="btn-wrap flex-center">
+          <button className={"btn-large gray-btn"} onClick={() => navigate(-1)}>이전</button>
+        </div>
+
+      </div>
+
+    </main>
+  );
+}
client/views/pages/user_management/UserAuthoriySelect.jsx
--- client/views/pages/user_management/UserAuthoriySelect.jsx
+++ client/views/pages/user_management/UserAuthoriySelect.jsx
@@ -278,7 +278,6 @@
 
   //사용자 등록 페이지 이동
   const join = () => {
-    console.log('userSearch : ', userSearch);
     navigate("/Join", {state: {
       'government_id': userSearch['government_id'],
       'agency_id': userSearch['agency_id'],
@@ -416,8 +415,8 @@
                           </div>
 
                           <div className="btn-wrap flex margin-bottom">
-                        <SubTitle explanation={"대상자 클릭 시 상세페이지로 이동합니다."} />
-                            <button className={"btn-small gray-btn"} onClick={() => modalSeniorInsertOpen()}>등록</button>
+                            <SubTitle explanation={"대상자 클릭 시 상세페이지로 이동합니다."} />
+                            {/* <button className={"btn-small gray-btn"} onClick={() => modalSeniorInsertOpen()}>등록</button> */}
                           </div>
 
                           <table className={"protector-user"}>
@@ -515,7 +514,7 @@
                                     }
                                   </td>
                                   <td>
-                                    <button className={"btn-small lightgray-btn"} onClick={() => modalGuardianOpen()}>상세 페이지 이동</button>
+                                    <button className={"btn-small lightgray-btn"} onClick={() => {navigate("/AgentSelectOne", {state: {'agent_id': item['user_id']}})}}>상세 페이지 이동</button>
                                   </td>
                                 </tr>
                               )})}
@@ -588,7 +587,7 @@
                                     }
                                   </td>
                                   <td>
-                                    <button className={"btn-small lightgray-btn"} onClick={() => modalGuardianOpen()}>정보 수정</button>
+                                    <button className={"btn-small lightgray-btn"} onClick={() => {navigate("/UserEdit", {state: {'user_id': item['user_id']}})}}>정보 수정</button>
                                   </td>
                                 </tr>
                               )})}
@@ -653,7 +652,7 @@
                                     }
                                   </td>
                                   <td>
-                                    <button className={"btn-small lightgray-btn"} onClick={() => modalGuardianOpen()}>정보 수정</button>
+                                    <button className={"btn-small lightgray-btn"} onClick={() => {navigate("/UserEdit", {state: {'user_id': item['user_id']}})}}>정보 수정</button>
                                   </td>
                                 </tr>
                               )})}
 
client/views/pages/user_management/UserEdit.jsx (added)
+++ client/views/pages/user_management/UserEdit.jsx
@@ -0,0 +1,362 @@
+import React from "react";
+import { useNavigate, useLocation } from "react-router";
+import { useSelector } from "react-redux";
+
+import CommonUtil from "../../../resources/js/CommonUtil.js";
+
+export default function UserEdit() {
+  const navigate = useNavigate();
+  const location = useLocation();
+
+  /**** 기본 조회 데이터 (시작) ****/
+  //전역 변수 저장 객체
+  const state = useSelector((state) => {return state});
+
+  //권한 타입 종류
+  const [authorities, setAuthorities] = React.useState([]);
+  //권한 타입 종류 목록 조회
+  const authoritiesSelect = () => {
+    fetch("/common/systemCode/authoritiesSelect.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify({}),
+    }).then((response) => response.json()).then((data) => {
+      console.log("권한 타입 종류 목록 조회 : ", data);
+      setAuthorities(data);
+    }).catch((error) => {
+      console.log('authoritiesSelect() /common/systemCode/authoritiesSelect.json error : ', error);
+    });
+  };
+  //기관 계층 구조 목록
+  const [orgListOfHierarchy, setOrgListOfHierarchy] = React.useState([]);
+  //기관(관리, 시행) 계층 구조 목록 조회
+  const orgSelectListOfHierarchy = () => {
+    fetch("/org/orgSelectListOfHierarchy.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify({}),
+    }).then((response) => response.json()).then((data) => {
+      console.log("기관(관리, 시행) 계층 구조 목록 조회 : ", data);
+      setOrgListOfHierarchy(data);
+    }).catch((error) => {
+      console.log('orgSelectListOfHierarchy() /org/orgSelectListOfHierarchy.json error : ', error);
+    });
+  };
+  const getAgencyList = () => {
+    const government = orgListOfHierarchy.find(item => item['government_id'] == user['government_id']);
+    if (CommonUtil.isEmpty(government) || CommonUtil.isEmpty(government['agencyList'])) {
+      return [];
+    } else {
+      return government['agencyList'];
+    }
+  }
+  /**** 기본 조회 데이터 (종료) ****/
+
+  //로그인 중복 확인
+  const [isIdCheck, setIsIdCheck] = React.useState(true);
+
+  //수정할 사용자 정보
+  const [user, setUser] = React.useState({
+    'user_id': location.state['user_id'],
+    'user_name': null,
+    'user_password': null,
+    'user_password_check': null,
+    'user_phonenumber': null,
+    'user_birth': null,
+    'user_gender': null,
+    'user_address': null,
+    'user_email': null,
+    'authority': null,
+    'agency_id': null,
+    'government_id': null,
+  });
+  //각 데이터별로 Dom 정보 담을 Ref 생성
+  const userRefInit = JSON.parse(JSON.stringify(user));
+  userRefInit['user_gender'] = {};
+  userRefInit['user_id_check_button'] = null;
+  const userRef = React.useRef(userRefInit);
+
+  //사용자 정보 조회
+  const userSelectOne = () => {
+    fetch("/user/userSelectOne.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify(user),
+    }).then((response) => response.json()).then((data) => {
+      console.log("사용자 정보 조회 : ", data);
+      setUser(data);
+    }).catch((error) => {
+      console.log('userSelectOne() /user/userSelectOne.json error : ', error);
+    });
+  }
+
+  //수정할 사용자 정보 변경
+  const userValueChange = (targetKey, value) => {
+    let newUser = JSON.parse(JSON.stringify(user));
+    newUser[targetKey] = value;
+    setUser(newUser);
+  }
+  //수정할 사용자의 관리기관 변경
+  const userGovernmentIdChange = (value) => {
+    let newUser = JSON.parse(JSON.stringify(user));
+    if (CommonUtil.isEmpty(value) == true) {
+      newUser['government_id'] = null;
+    } else {
+      newUser['government_id'] = value;
+    }
+    newUser['agency_id'] = null;
+    setUser(newUser);
+  }
+  //수정할 사용자의 시행기관 변경
+  const userAgencyIdChange = (value) => {
+    let newUser = JSON.parse(JSON.stringify(user));
+    if (CommonUtil.isEmpty(value) == true) {
+      newUser['agency_id'] = null;
+    } else {
+      newUser['agency_id'] = value;
+    }
+    setUser(newUser);
+  }
+  //로그인 아이디 중복 검사
+  const userIdCheck = () => {
+    if (CommonUtil.isEmpty(user['user_id']) == true) {
+      userRef.current['user_id'].focus();
+      alert("아이디를 입력해 주세요.");
+      return;
+    }
+    
+    fetch("/user/userSelectOne.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify(user),
+    }).then((response) => response.json()).then((data) => {
+      console.log("로그인 아이디 중복 검사(아이디를 통한 사용자 조회) : ", data);
+      if (CommonUtil.isEmpty(data) == true) {
+        setIsIdCheck(true);
+        userRef.current['user_password'].focus();
+        alert("사용가능한 아이디 입니다.");
+      } else {
+        setIsIdCheck(false);
+        userRef.current['user_id'].focus();
+        alert("이미 존재하는 아이디 입니다.");
+      }
+    }).catch((error) => {
+      console.log('userIdCheck() /user/userSelectOne.json error : ', error);
+    });
+  }
+
+
+   //사용자 등록 유효성 검사
+   const userUpdateValidation = () => {
+    if ((user['authority'] == 'ROLE_GOVERNMENT' || user['authority'] == 'ROLE_AGENCY')
+        && CommonUtil.isEmpty(user['government_id']) == true) {
+      userRef.current['government_id'].focus();
+      alert("관리기관을 선택해 주세요.");
+      return false;
+    }
+
+    if (user['authority'] == 'ROLE_AGENCY' && CommonUtil.isEmpty(user['agency_id']) == true) {
+      userRef.current['agency_id'].focus();
+      alert("시행기관을 선택해 주세요.");
+      return false;
+    }
+
+    if (CommonUtil.isEmpty(user['user_name']) == true) {
+      userRef.current['user_name'].focus();
+      alert("이름을 입력해 주세요.");
+      return false;
+    }
+    if (CommonUtil.isEmpty(user['user_id']) == true) {
+      userRef.current['user_id'].focus();
+      alert("아이디를 입력해 주세요.");
+      return false;
+    }
+    if (isIdCheck == false) {
+      alert("아이디 중복 확인을 해주세요.");
+      return false;
+    }
+    if (CommonUtil.isEmpty(user['user_password']) == false
+        && user['user_password'] != user['user_password_check']) {
+      userRef.current['user_password_check'].focus();
+      alert("비밀번호가 일치하지 않습니다.");
+      return false;
+    }
+    if (CommonUtil.isEmpty(user['user_phonenumber']) == true) {
+      userRef.current['user_phonenumber'].focus();
+      alert("연락처를 입력해 주세요.");
+      return false;
+    }
+
+    /* if (CommonUtil.isEmpty(user['user_email']) == true) {
+      userRef.current['user_email'].focus();
+      alert("이메일을 입력해 주세요.");
+      return false;
+    } */
+
+    return true;
+  }
+
+  //사용자 등록
+  const userUpdate = () => {
+    if (userUpdateValidation() == false) {
+      return;
+    }
+
+    fetch("/user/userUpdate.json", {
+      method: "POST",
+      headers: {
+        'Content-Type': 'application/json; charset=UTF-8'
+      },
+      body: JSON.stringify(user),
+    }).then((response) => response.json()).then((data) => {
+      console.log("사용자 수정 결과(건수) : ", data);
+      if (data > 0) {
+        alert("계정수정완료");
+        navigate(-1);
+      } else {
+        alert("계정수정에 실패하였습니다. 관리자에게 문의바랍니다.");
+      }
+    }).catch((error) => {
+      console.log('userUpdate() /user/userUpdate.json error : ', error);
+    });
+  }
+  
+  //Mounted
+  React.useEffect(() => {
+    authoritiesSelect();
+    orgSelectListOfHierarchy();
+    userSelectOne();
+  }, []);
+  
+
+  return (
+      <div className="container row flex-center join-login">
+        <div className="join-group">
+          <h3>계정수정</h3>
+          <div className="join-inner">
+            <div>
+              <div className="flex-start margin-bottom2">
+                <label className="flex25"><span style={{color : "red"}}>*</span>사용자구분</label>
+                {authorities[user['authority']]}
+              </div>
+            </div>
+
+            {user['authority'] == 'ROLE_GOVERNMENT' || user['authority'] == 'ROLE_AGENCY' ?
+              <div>
+                <div className="flex-start margin-bottom2">
+                  <label className="flex25" htmlFor="name"><span style={{color : "red"}}>*</span>관리기관</label>
+                  <select onChange={(e) => {userGovernmentIdChange(e.target.value)}} ref={el => userRef.current['government_id'] = el}>
+                    <option value={''} selected={user['government_id'] == null}>관리기관선택</option>
+                    {orgListOfHierarchy.map((item, idx) => { return (
+                      <option key={idx} value={item['government_id']} selected={user['government_id'] == item['government_id']}>
+                        {item['government_name']}
+                      </option>
+                    )})}
+                  </select>
+                </div>
+              </div>
+            : null}
+
+            {user['authority'] == 'ROLE_AGENCY' ?
+              <div>
+                <div className="flex-start margin-bottom2">
+                  <label className="flex25" htmlFor="name"><span style={{color : "red"}}>*</span>시행기관</label>
+                  <select onChange={(e) => {userAgencyIdChange(e.target.value)}} ref={el => userRef.current['agency_id'] = el}>
+                    <option value={''} selected={user['agency_id'] == null}>시행기관선택</option>
+                    {getAgencyList().map((item, idx) => { return (
+                      <option key={idx} value={item['agency_id']} selected={user['agency_id'] == item['agency_id']}>
+                        {item['agency_name']}
+                      </option>
+                    )})}
+                  </select>
+                </div>
+              </div>
+            : null}
+
+            <div>
+              <div className="flex-start margin-bottom2">
+                <label className="flex25" htmlFor="name"><span style={{color : "red"}}>*</span>이름</label>
+                <input type="text"
+                  value={user['user_name']}
+                  onChange={(e) => {userValueChange('user_name', e.target.value)}}
+                  ref={el => userRef.current['user_name'] = el}
+                />
+              </div>
+            </div>
+
+            <div className="id">
+              <div className="flex-start margin-bottom2">
+                <label className="flex25" htmlFor="id"><span style={{color : "red"}}>*</span>아이디</label>
+                <input type="text"
+                  value={user['user_id']}
+                  onChange={(e) => {userValueChange('user_id', e.target.value); setIsIdCheck(false)}}
+                  ref={el => userRef.current['user_id'] = el}
+                />
+                <button className={"red-btn btn-large"} onClick={userIdCheck}
+                  ref={el => userRef.current['user_id_check_button'] = el}>
+                  중복확인
+                </button>
+              </div>
+            </div>
+
+            <div>
+              <div className="flex-start margin-bottom2">
+                <label className="flex25" htmlFor="password"><span style={{color : "red"}}>*</span>비밀번호</label>
+                <input type="password"
+                  value={user['user_password']}
+                  onChange={(e) => {userValueChange('user_password', e.target.value)}}
+                  ref={el => userRef.current['user_password'] = el}
+                />
+              </div>
+            </div>
+            <div>
+              <div className="flex-start margin-bottom2">
+                <label className="flex25" htmlFor="password_check"><span style={{color : "red"}}>*</span>비밀번호 확인</label>
+                <input type="password"
+                  value={user['user_password_check']}
+                  onChange={(e) => {userValueChange('user_password_check', e.target.value)}}
+                  ref={el => userRef.current['user_password_check'] = el}
+                />
+              </div>
+            </div>
+
+            <div>
+              <div className="flex margin-bottom2">
+                <label className="flex25" htmlFor="phone_number"><span style={{color : "red"}}>*</span>전화번호</label>
+                <input type="number" maxLength="11"
+                  value={user['user_phonenumber']}
+                  onChange={(e) => {userValueChange('user_phonenumber', e.target.value)}}
+                  ref={el => userRef.current['user_phonenumber'] = el}
+                />
+              </div>
+            </div>
+
+            <div>
+              <div className="flex-start margin-bottom2">
+                <label className="flex25" htmlFor="password_check">이메일</label>
+                <input type="text"
+                  value={user['user_email']}
+                  onChange={(e) => {userValueChange('user_email', e.target.value)}}
+                  ref={el => userRef.current['user_email'] = el}
+                />
+              </div>
+            </div>
+
+            <div className="btn-wrap">
+              <button className={"gray-btn btn-large"} onClick={() => {navigate(-1)}}>취소</button>
+              <button className={"red-btn btn-large"} onClick={userUpdate}>수정</button>
+            </div>
+
+          </div>
+        </div>
+      </div>
+  );
+}
Add a comment
List