최정우 최정우 2023-04-11
12
@d79f60e88b52f34bcd72b3717c591da78f04fd1a
client/views/layout/Menu.jsx
--- client/views/layout/Menu.jsx
+++ client/views/layout/Menu.jsx
@@ -1,13 +1,18 @@
 import React from "react";
-import SidebarItem from "./SidebarItem.jsx";
-import Button from "../component/Button.jsx";
 import { useNavigate } from "react-router";
+import { useSelector } from "react-redux";
+
+import SidebarItem from "./SidebarItem.jsx";
 import logo from "../../resources/files/images/logo.png";
 import MenuIcon from "@mui/icons-material/Menu";
 import CloseIcon from '@mui/icons-material/Close';
 
 export default function Sidebar({items}) {
+  //전역 변수 저장 객체
+  const state = useSelector((state) => {return state});
+
   const [menuToggle, setMenuToggle] = React.useState(false);
+
   const onClickshow=()=>{
     setMenuToggle(!menuToggle)
   }
@@ -38,17 +43,10 @@
   };
   return (
  <>
-      <nav
-        className={menuToggle? "nav on" : "nav"}        
-      >
-        <div className="menuicon"  onClick={() => {
-                  onClickshow();
-                  // count();
-                  handleClick();
-                  }}>
-                    {icons[iconIndex]}
-                    {/* <MenuIcon sx={{ width:35, height:35,color:"#7a7f87"}}/> */}
-                    </div >
+      <nav className={menuToggle? "nav on" : "nav"}>
+        <div className="menuicon"  onClick={() => {onClickshow(); handleClick();}}>
+          {icons[iconIndex]} 
+        </div>
         <h1 className="logo"><img src={logo} alt="" /></h1>
         <div className="flex-align-column" style={{ marginTop: `3rem` }}>
           <ul >
@@ -57,10 +55,14 @@
             ))}
           </ul>
         </div>
-        <div className="bottom-section flex-center">
-            <div className="info-id" ><span onClick={() => {
-              navigate("/Join");
-            }}>계정추가</span></div>
+        <div className="bottom-section flex-center" style={{width: '100%'}}>
+            {state.loginUser['authority'] == 'ROLE_ADMIN' ? 
+              <div className="info-id" >
+                <span onClick={() => {
+                  navigate("/Join");
+                }}>계정추가</span>
+              </div>
+            : null}
             <div className="logout" onClick={logout}><span>로그아웃</span></div>
           </div>
       </nav>
client/views/pages/AppRoute.jsx
--- client/views/pages/AppRoute.jsx
+++ client/views/pages/AppRoute.jsx
@@ -35,8 +35,8 @@
 import EquipmentRentalInsert from "./equipment/EquipmentRentalInsert.jsx";
 import EquipmentManagementSelect from "./equipment/EquipmentManagementSelect.jsx";
 import EquipmentManagementSelectOne from "./equipment/EquipmentManagementSelectOne.jsx";
-import UserAuthoriySelect from "./user_management/UserAuthoriySelect.jsx";
-import UserAuthoriySelect_agency from "./user_management/UserAuthoriySelect_agency.jsx";
+import UserSelect from "./user_management/UserSelect.jsx";
+import AgencySeniorSelect from "./user_management/AgencySeniorSelect.jsx";
 import QandASelect from "./callcenter/QandASelect.jsx";
 import QandAConfirm from "./callcenter/QandAConfirm.jsx";
 import EquipmentManagementInsert from "./equipment/EquipmentManagementInsert.jsx";
@@ -80,7 +80,7 @@
       },
       {
         title: "사용자 관리",
-        path: "/UserAuthoriySelect",
+        path: "/UserSelect",
       },
     ],
   },
@@ -140,7 +140,7 @@
       <Route path="/QandAInsert" element={<QandAInsert />}></Route>
       <Route path="/QandASelect" element={<QandASelect />}></Route>
       <Route path="/EquipmentManagementSelectAdd" element={<EquipmentManagementSelectAdd />}></Route>
-      <Route path="/UserAuthoriySelect" element={<UserAuthoriySelect />}></Route>
+      <Route path="/UserSelect" element={<UserSelect />}></Route>
       <Route path="/QandAConfirm" element={<QandAConfirm />}></Route>
       <Route path="/Join" element={<Join />}></Route>
       <Route path="/SeniorEdit" element={<SeniorEdit />}></Route>
@@ -175,7 +175,7 @@
       },
       {
         title: "사용자 관리",
-        path: "/UserAuthoriySelect",
+        path: "/UserSelect",
       },
     ],
   },
@@ -236,7 +236,7 @@
       <Route path="/MedicineStatistics" element={<MedicineStatistics />} ></Route>
       <Route path="/VisitInsert" element={<VisitInsert />}></Route>
       <Route path="/VisitSelectOne" element={<VisitSelectOne />}></Route>
-      <Route path="/UserAuthoriySelect" element={<UserAuthoriySelect />}></Route>
+      <Route path="/UserSelect" element={<UserSelect />}></Route>
       <Route path="/RiskSet" element={<RiskSet />}></Route>
       {/* <Route path="/AuthorityManagement" element={<AuthorityManagement />}></Route> */}
       <Route path="/QandASelect" element={<QandASelect />}></Route>
@@ -250,7 +250,6 @@
       <Route path="/UserEdit" element={<UserEdit />}></Route>
       <Route path="/AgentSelectOne" element={<AgentSelectOne />}></Route>
       <Route path="/OrgSelect" element={<OrgSelect />}></Route>
-      <Route path="/UserAuthoriySelect" element={<UserAuthoriySelect />}></Route>
     </Routes>
   );
 }
@@ -262,7 +261,7 @@
   },
   {
     title: "대상자 관리",
-    path: "/UserAuthoriySelect_agency",
+    path: "/AgencySeniorSelect",
     icon: (
       <PersonIcon sx={{ fontSize: 20, color: "#333333", marginRight: 1 }} />
     ),
@@ -283,25 +282,16 @@
   },
   {
     title: "장비 관리",
+    path: "/EquipmentManagementSelect",
     icon: (
-      <ConstructionIcon sx={{ fontSize: 20, color: "#333333", marginRight: 1 }} />
+      <SpeakerPhoneIcon sx={{ fontSize: 20, color: "#333333", marginRight: 1 }} />
     ),
-    childrens: [
-      {
-        title: "장비 대여 관리",
-        path: "/EquipmentManagementSelect",
-      },
-      {
-        title: "문의게시판",
-        path: "/QandASelect",
-      },
-    ]
   },
   {
     title: "Q&A",
-    path: "/QuestionSelect",
+    path: "/QandASelect",
     icon: (
-      <SpeakerPhoneIcon
+      <ContactSupportIcon
         sx={{ fontSize: 20, color: "#333333", marginRight: 1 }}
       />
     ),
@@ -317,7 +307,7 @@
       <Route path="/QuestionSelect" element={<QuestionSelect />}></Route>
       
       <Route path="/Main" element={<Main_agency />}></Route>
-      <Route path="/UserAuthoriySelect_agency" element={<UserAuthoriySelect_agency />}></Route>
+      <Route path="/AgencySeniorSelect" element={<AgencySeniorSelect />}></Route>
       <Route path="/SeniorEdit" element={<SeniorEdit />}></Route>
       <Route path="/SeniorSelectOne" element={<SeniorSelectOne />}></Route>
       <Route path="/UserEdit" element={<UserEdit />}></Route>
@@ -363,19 +353,19 @@
   {
     title: "Home",
     path: "/Main",
-    icon: <HouseIcon sx={{ fontSize: 20, color: "#333333", marginRight: 1 }} />,
+    icon: <HouseIcon sx={{ fontSize: 20, marginRight: 1 }} />,
   },
   {
     title: "그래프로 보기",
     path: "/GuardianStatistics",
-    icon: <EqualizerIcon sx={{ fontSize: 20, color: "#333333", marginRight: 1 }} />,
+    icon: <EqualizerIcon sx={{ fontSize: 20, marginRight: 1 }} />,
   },
   {
     title: "Q&A",
-    path: "/QuestionSelect",
+    path: "/QandASelect",
     icon: (
-      <SpeakerPhoneIcon
-        sx={{ fontSize: 20, color: "#333333", marginRight: 1 }}
+      <ContactSupportIcon
+        sx={{ fontSize: 20, marginRight: 1 }}
       />
     ),
   },
@@ -385,8 +375,7 @@
     <Routes>
       <Route path="/GuardianStatistics" element={<GuardianStatistics />}></Route>
       <Route path="/Main" element={<Main_guardian />}></Route>
-      <Route path="/QuestionSelect" element={<QuestionSelect />}></Route>
-      <Route path="/QuestionConfirm/:qnaIdx" element={<QuestionConfirm />}></Route>
+      <Route path="/QandASelect" element={<QandASelect />}></Route>
       
     </Routes>
   );
client/views/pages/equipment/EquipmentManagementSelect.jsx
--- client/views/pages/equipment/EquipmentManagementSelect.jsx
+++ client/views/pages/equipment/EquipmentManagementSelect.jsx
@@ -498,7 +498,7 @@
 		content: (
 			<div>
 				<div className="flex equip-tab">
-					<SubTitle explanation={"장비 클릭 시 지난 매칭이력을 확인할 수 있습니다."} />
+					<SubTitle explanation={"납품 가능한 장비 목록입니다."} />
 					<div className="btn-wrap flex-end margin-bottom ">
 						{isEquipmentDelivery
 							? <>
@@ -597,7 +597,7 @@
 										className={item['government_id'] == org['government_id'] ? "active" : ""}>
 										{item['government_name']}
 									</a>
-									{item['agencyList'] != undefined && item['agencyList'] != null ?
+									{/* {item['agencyList'] != undefined && item['agencyList'] != null ?
 										<ul style={{marginLeft: '15px'}}>
 										{item['agencyList'].map((item2, idx2) => { return (
 											<li style={{margin: '10px 0px'}} key={idx2}>
@@ -610,7 +610,7 @@
 										)})}
 										</ul>
 										: null
-									}
+									} */}
 								</li>
 							)})}
 							</ul>
@@ -618,7 +618,7 @@
 					</div>
 					<div className="right">
 						<div className="flex equip-tab">
-							<SubTitle explanation={"장비 클릭 시 지난 매칭이력을 확인할 수 있습니다."} />
+							<SubTitle explanation={"선택한 기관에 납품된 장비 목록입니다."} />
 							<div className="btn-wrap flex-end margin-bottom ">
 								{/* <button className={"btn-small gray-btn"} onClick={() => {modalEquipmentOpen()}}>등록</button> */}
 							</div>
client/views/pages/org/OrgSelect.jsx
--- client/views/pages/org/OrgSelect.jsx
+++ client/views/pages/org/OrgSelect.jsx
@@ -583,7 +583,9 @@
                                     <th>관리대상자(명)</th>
                                     <th>주소</th>
                                     <th>대표연락처</th>
-                                    <th>시행기관조회</th>
+                                    {state.loginUser['authority'] == 'ROLE_ADMIN' ?
+                                        <th>시행기관조회</th>
+                                    : null}
                                     {/* <th>장비관리</th> */}
                                     <th>사용자관리</th>
                                     <th>관리</th>
@@ -601,16 +603,18 @@
                                     <td data-label="관리 대상자(명)">{item['senior_user_count']}</td>
                                     <td data-label="주소">{item['government_address']}</td>
                                     <td data-label="대표 연락처">{item['government_phonenumber']}</td>
-                                    <td>
-                                        <button className={"btn-small lightgray-btn"} onClick={() => {
-                                            government.government = item;
-                                            setGovernment({...government});
-                                            agency.search['government_id'] = item['government_id'];
-                                            agency.search['ageny_id'] = null;
-                                            setAgency({...agency});
-                                            agencySelectList();
-                                        }}>시행기관조회</button>
-                                    </td>
+                                    {state.loginUser['authority'] == 'ROLE_ADMIN' ?
+                                        <td>
+                                            <button className={"btn-small lightgray-btn"} onClick={() => {
+                                                government.government = item;
+                                                setGovernment({...government});
+                                                agency.search['government_id'] = item['government_id'];
+                                                agency.search['ageny_id'] = null;
+                                                setAgency({...agency});
+                                                agencySelectList();
+                                            }}>시행기관조회</button>
+                                        </td>
+                                    : null}
                                     {/* <td>
                                         <button className={"btn-small gray-btn"} onClick={() => {userManagementPage(item['government_id'], null, 'ROLE_GOVERNMENT')}}>장비관리</button>
                                     </td> */}
@@ -627,7 +631,7 @@
                                 )})}
                                 {CommonUtil.isEmpty(government.governmentList) ?
                                 <tr>
-                                    <td colSpan={12}>조회된 데이터가 없습니다</td>
+                                    <td colSpan={state.loginUser['authority'] == 'ROLE_ADMIN' ? 12 : 11}>조회된 데이터가 없습니다</td>
                                 </tr>
                                 : null}
                             </tbody>
 
client/views/pages/user_management/UserAuthoriySelect_agency.jsx (deleted)
--- client/views/pages/user_management/UserAuthoriySelect_agency.jsx
@@ -1,246 +0,0 @@
-import React from "react";
-import Table from "../../component/Table.jsx";
-import Button from "../../component/Button.jsx";
-import SubTitle from "../../component/SubTitle.jsx";
-import Modal_SeniorInsert from "../../component/Modal_SeniorInsert.jsx";
-import { useNavigate } from "react-router";
-import Pagination from "../../component/Pagination.jsx";
-
-export default function UserAuthoriySelect_agency() {
-  // 화면 진입 시 탭 별 노출될 리스트 초기화 
-  const [seniortList, setSeniorList] = React.useState([]);
-  const [seniorMyList, setSeniorMyList] = React.useState([]);
-  const [addSenior, setAddSenior] = React.useState(true); //추가된 시니어가 있는지 확인
-
-  //category 설정 초기화
-  const [selectUserCode, setSelectUserCode] = React.useState("전체");
-  const [selectUserData, setSelectUserData] = React.useState("이름");
-  
-  //-------- 페이징 작업 설정 시작 --------//
-  const limit = 15; // 페이지당 보여줄 공지 개수
-  const [page, setPage] = React.useState(1); //page index
-  const offset = (page - 1) * limit; //게시물 위치 계산
-  const [myUserTotal, setMyUserTotal] = React.useState(0); //최대길이 넣을 변수
-  const [userTotal, setUserTotal] = React.useState(0); //최대길이 넣을 변수
-  //-------- 페이징 작업 설정 끝 --------//
-
-  // ------ 대상자 영역 클릭시 저장될 데이터 handler ------//
-  const handleSelectUserCode = (e) => {
-    console.log("e.target.value : ", e.target.value)
-    setSelectUserCode(e.target.value);
-  };
-  const handleSelectUserData = (e) => {
-    console.log("e.target.value : ", e.target.value)
-    setSelectUserData(e.target.value);
-  };
-
- // 자신이 속한 기관 시니어 보기
-  const getSelectSeniorList = () => {
-    fetch("/user/selectUserList.json", {
-      method: "POST",
-      headers: {
-        'Content-Type': 'application/json; charset=UTF-8'
-      },
-      body: JSON.stringify({
-        agency_id: 'AGENCY01',
-        authority: 'SENIOR01',
-      }),
-    }).then((response) => response.json()).then((data) => {
-      const rowData = data;
-      
-        console.log(data);
-        setSeniorList(rowData);
-        setUserTotal(rowData.length);
-        setAddSenior(false);
-      
-
-    }).catch((error) => {
-      console.log('getSelectSeniorList() /user/selectUserList.json error : ', error);
-    });
-  };
-  // 내 시니어 리스트 보기
-  const getSelectMySeniorList = () => {
-    fetch("/user/selectMyUserList.json", {
-      method: "POST",
-      headers: {
-        'Content-Type': 'application/json; charset=UTF-8'
-      },
-      body: JSON.stringify({
-        user_id : 'agency_user',
-        agency_id : 'AGENCY01',
-        authority : 'SENIOR01',
-      }),
-    }).then((response) => response.json()).then((data) => {
-      const rowData = data;
-      if(addSenior || rowData.length !=data.length){
-        console.log(data);
-        setSeniorMyList(rowData);
-        setMyUserTotal(rowData.length);
-        setAddSenior(false);
-      }
-    }).catch((error) => {
-      console.log('getSubjectMySelect() /user/selectMyUserList.json error : ', error);
-    });
-  };
-
-  const navigate = useNavigate();
-  const [modalOpen, setModalOpen] = React.useState(false);
-  const openModal = () => {
-    setModalOpen(true);
-  };
-  const [modalOpen2, setModalOpen2] = React.useState(false);
-  const openModal2 = () => {
-    setModalOpen2(true);
-  };
-  const [modalOpen3, setModalOpen3] = React.useState(false);
-  const openModal3 = () => {
-    setModalOpen3(true);
-  };
-
-  // const insertBtn = (id) => {
-  //   if (id == 2) {
-  //     return (
-  //       <Button
-  //         className={"btn-small gray-btn"}
-  //         btnName={"등록"}
-  //         onClick={() => {
-  //           navigate("/SeniorInsert");
-  //         }}
-  //       />
-  //     )
-  //   }
-  // };
-
-  const thead1 = [
-    "No",
-    "대상자 이름",
-    "대상자 연락처",
-    "성별",
-    "생년월일",
-    "주소",
-    "보호자",
-
-  ];
-  const key1 = [
-    // "No", "name", "Id", "call", "gender", "birth", "address", "management"
-    "rn",
-    "user_name",
-    "user_phonenumber",
-    "user_gender",
-    "user_birth",
-    "user_address",
-  ];
-
-  const thead2 = [
-    "No",
-    "대상자 이름",
-    "대상자 연락처",
-    "성별",
-    "생년월일",
-    "주소",
-    "담당자",
-    "보호자",
-  ];
-
-  const key2 = [
-    "rn",
-    "user_name",
-    "user_phonenumber",
-    "user_gender",
-    "user_birth",
-    "user_address",
-  ];
-
-  const data = [
-    {
-      id: 1,
-      title: "내가 관리하는 대상자",
-      description: (
-
-        <Table
-          className={"protector-user"}
-          head={thead1}
-          contents={seniorMyList}
-          contentKey={key1}
-          view={"mySenior"}
-          offset={offset}
-          limit={limit}
-        />
-      ),
-    },
-    {
-      id: 2,
-      title: "전체 대상자",
-      description: (
-        <Table
-          className={"caregiver-user"}
-          head={thead2}
-          contents={seniortList}
-          contentKey={key2}
-          view={"allSenior"}
-          offset={offset}
-          limit={limit}
-        />
-      ),
-    },
-  ];
-
-  const [index, setIndex] = React.useState(1);
-
-  
-  React.useEffect(() => {
-    getSelectSeniorList();
-    getSelectMySeniorList();
-
-  }, [addSenior])
-  return (
-    <main>
-      <Modal_SeniorInsert open={modalOpen3} setModalOpen3={setModalOpen3} setAddSenior={setAddSenior} header="대상자 등록"/>
-      <div className="tab-container">
-        <ul className="tab-menu flex-start">
-          {data.map((item) => (
-            <li
-              key={item.id}
-              className={index === item.id ? "active" : null}
-              onClick={() => {setIndex(item.id); setPage(1)}}
-            >
-              {item.title}
-            </li>
-          ))}
-        </ul>
-        <div className="content-wrap">
-          <div className="search-management flex-start margin-bottom2">
-            <select name="management-agency" onChange={handleSelectUserCode} value={selectUserCode}>
-              <option value="기관전체">전체</option>
-              <option value="대상자">대상자</option>
-              <option value="담당자">담당자</option>
-              <option value="보호자">보호자</option>
-            </select>
-            <select onChange={handleSelectUserData} value={selectUserData}>
-              <option value="이름">이름</option>
-              <option value="아이디">아이디</option>
-            </select>
-            <input type="text" className="senior-search"/>
-            <Button
-              className={"btn-small gray-btn"}
-              btnName={"검색"}
-            />
-          </div>
-          <div className="btn-wrap flex-end">
-            <Button className={"btn-small gray-btn"} btnName={"등록"} onClick={openModal3} />
-          </div>
-          <ul className="tab-content">
-            {data
-              .filter((item) => index === item.id)
-              .map((item) => (
-                <li>{item.description}</li>
-              ))}
-          </ul>
-          <div>
-            <Pagination total={index === 1 ? myUserTotal:userTotal} limit={limit} page={page} setPage={setPage} />
-          </div>
-        </div>
-      </div>
-    </main>
-  );
-}
client/views/pages/user_management/UserSelect.jsx (Renamed from client/views/pages/user_management/UserAuthoriySelect.jsx)
--- client/views/pages/user_management/UserAuthoriySelect.jsx
+++ client/views/pages/user_management/UserSelect.jsx
@@ -1,18 +1,12 @@
-import React, { useState } from "react";
+import React from "react";
 import { useNavigate, useLocation } from "react-router";
 import { useSelector } from "react-redux";
 
 import ContentTitle from "../../component/ContentTitle.jsx";
 import SubTitle from "../../component/SubTitle.jsx";
-import Modal from "../../component/Modal.jsx";
-import Table from "../../component/Table.jsx";
-import Button from "../../component/Button.jsx";
-import Category from "../../component/Category.jsx";
 import Modal_SeniorInsert from "../../component/Modal_SeniorInsert.jsx";
-import { width } from "@mui/system";
 import Modal_Guardian from "../../component/Modal_Guardian.jsx";
 import Pagination from "../../component/Pagination.jsx";
-import Dot from "../../../resources/files/icon/dot.png";
 import House from "../../../resources/files/icon/house.png";
 import Arrow from "../../../resources/files/icon/arrow.png";
 
Add a comment
List