2024-02-13 00:14:09 +00:00
import React , { useState , useEffect , useCallback } from 'react' ;
import { Link , useLocation } from 'react-router-dom' ;
2023-12-26 06:35:38 +00:00
2024-02-13 00:14:09 +00:00
import * as EgovNet from 'api/egovFetch' ;
import URL from 'constants/url' ;
2023-12-26 06:35:38 +00:00
2024-02-13 00:14:09 +00:00
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin' ;
2024-02-28 00:08:26 +00:00
import CODE from "../../../constants/code" ;
import Modal from "react-bootstrap/Modal" ;
import AboutSiteModal from "./aboutSiteMgt/AboutSiteModal" ;
2024-02-13 00:14:09 +00:00
function StandardCodeMgt ( props ) {
2023-12-26 06:35:38 +00:00
2024-02-28 00:08:26 +00:00
const location = useLocation ( ) ;
const [ searchCondition , setSearchCondition ] = useState ( location . state ? . searchCondition || { pageIndex : 1 , searchCnd : '0' , searchWrd : '' } ) ; // 기존 조회에서 접근 했을 시 || 신규로 접근 했을 시
const [ paginationInfo , setPaginationInfo ] = useState ( { } ) ;
const [ listTag , setListTag ] = useState ( [ ] ) ;
const [ show , setShow ] = useState ( false ) ;
const [ modalBody , setModalBody ] = useState ( ) ;
const handleClose = ( ) => setShow ( false ) ;
const handleShow = ( ) => setShow ( true ) ;
const retrieveList = useCallback ( ( ) => {
handleClose ( ) ;
console . groupCollapsed ( "AdminPartnerSiteList.retrieveList()" ) ;
const retrieveListURL = '/admin/config/partner-site-list' ;
const requestOptions = {
method : "GET" ,
headers : {
'Content-type' : 'application/json' ,
} ,
body : JSON . stringify ( )
}
EgovNet . requestFetch ( retrieveListURL ,
requestOptions ,
( resp ) => {
let mutListTag = [ ] ;
listTag . push ( < p className = "no_data" key = "0" > 검색된 결과가 없습니다 . < / p > ) ; // 게시판 목록 초기값
// 리스트 항목 구성
resp . result . partnerSiteList . forEach ( function ( item , index ) {
if ( index === 0 ) mutListTag = [ ] ; // 목록 초기화
mutListTag . push (
< div className = "list_item" >
< div > { item . siteSeq } < / div >
< div > { item . siteTitle } < / div >
< div > { item . siteUrl } < / div >
< div > { item . fileGrpId } < / div >
< div > { item . siteOrder } < / div >
< div > { item . useYn } < / div >
< div > < button className = { "btn btn_blue_h31 px-1" } onClick = { ( ) => { editBoard ( item ) } } > 수정 < / button > < / div >
< / div >
) ;
} ) ;
setListTag ( mutListTag ) ;
console . log ( "@@@ resp : " ) ;
} ,
function ( resp ) {
console . log ( "err response : " , resp ) ;
}
) ;
console . groupEnd ( "EgovAdminBoardList.retrieveList()" ) ;
} , [ ] ) ;
useEffect ( ( ) => {
retrieveList ( searchCondition ) ;
// eslint-disable-next-line react-hooks/exhaustive-deps
} , [ ] ) ;
function editBoard ( item ) {
handleShow ( ) ;
if ( item != undefined ) {
item . mode = CODE . MODE _MODIFY ;
}
setModalBody ( < AboutSiteModal props = { item } reloadFunction = { retrieveList } / > )
}
2023-12-26 06:35:38 +00:00
return (
< div className = "container" >
2024-02-13 00:14:09 +00:00
< div className = "c_wrap" >
{ /* <!-- Location --> */ }
< div className = "location" >
< ul >
< li > < Link to = { URL . MAIN } className = "home" > Home < / Link > < / li >
2024-02-28 00:08:26 +00:00
< li > < Link to = { URL . ADMIN } > 사이트관리 < / Link > < / li >
2024-02-13 00:14:09 +00:00
< li > 환경설정 < / li >
< li > 관련사이트 관리 < / li >
< / ul >
< / div >
{ /* <!--// Location --> */ }
< div className = "layout" >
{ /* <!-- Navigation --> */ }
< EgovLeftNav > < / EgovLeftNav >
{ /* <!--// Navigation --> */ }
< div className = "contents NOTICE_LIST" id = "contents" >
< div className = "top_tit" >
< h1 className = "tit_1" > 관련사이트 관리 < / h1 >
< / div >
2024-02-28 00:08:26 +00:00
{ /* <!-- 검색조건 --> */ }
{ / * < d i v c l a s s N a m e = " c o n d i t i o n " >
< ul >
< li className = "third_1 L" >
< span className = "lb" > 검색유형선택 < / span >
< label className = "f_select" htmlFor = "searchCnd" >
< select id = "searchCnd" name = "searchCnd" title = "검색유형선택" ref = { cndRef }
onChange = { e => {
cndRef . current . value = e . target . value ;
} }
>
< option value = "0" > 게시판명 < / option >
< option value = "1" > 게시판유형 < / option >
< / select >
< / label >
< / li >
< li className = "third_2 R" >
< span className = "lb" > 검색어 < / span >
< span className = "f_search w_400" >
< input type = "text" name = "" defaultValue = { searchCondition && searchCondition . searchWrd } placeholder = "" ref = { wrdRef }
onChange = { e => {
wrdRef . current . value = e . target . value ;
} }
/ >
< button type = "button"
onClick = { ( ) => {
retrieveList ( { ... searchCondition , pageIndex : 1 , searchCnd : cndRef . current . value , searchWrd : wrdRef . current . value } ) ;
} } > 조회 < / button >
< / span >
< / li >
< li >
< Link to = { URL . ADMIN _BOARD _CREATE } className = "btn btn_blue_h46 pd35" > 등록 < / Link >
< / li >
< / ul >
< / div > * / }
{ /* <!--// 검색조건 --> */ }
{ /* <!-- 게시판목록 --> */ }
< div className = "board_list BRD006" >
< div className = "head" >
< span > 번호 < / span >
< span > 사이트명 < / span >
< span > URL < / span >
< span > 배너이미지 < / span >
< span > 정렬순서 < / span >
< span > 사용여부 < / span >
< span > < button className = { "btn btn_blue_h31 px-1" } onClick = { ( ) => { editBoard ( undefined ) } } > 추가 < / button > < / span >
< / div >
< div className = "result" >
{ listTag }
< / div >
< / div >
{ /* <!--// 게시판목록 --> */ }
< div className = "board_bot" >
{ /* <!-- Paging --> */ }
{ / * < E g o v P a g i n g p a g i n a t i o n = { p a g i n a t i o n I n f o } m o v e T o P a g e = { p a s s e d P a g e = > {
retrieveList ( { ... searchCondition , pageIndex : passedPage , searchCnd : cndRef . current . value , searchWrd : wrdRef . current . value } )
} } / > * / }
{ /* <!--/ Paging --> */ }
< / div >
{ /* <!--// 본문 --> */ }
2024-02-13 00:14:09 +00:00
< / div >
< / div >
< / div >
2024-02-28 00:08:26 +00:00
< Modal show = { show } onHide = { handleClose } keyboard = { false } >
{ modalBody }
< / Modal >
2023-12-26 06:35:38 +00:00
< / div >
) ;
}
2024-02-13 00:14:09 +00:00
export default StandardCodeMgt ;