From 826459f304aa91e28672712af0aa6cb15400604d Mon Sep 17 00:00:00 2001 From: bcjang Date: Fri, 25 Apr 2025 15:33:21 +0900 Subject: [PATCH] =?UTF-8?q?toast=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20alert=20=EA=B8=80=EB=A1=9C=EB=B2=8C=ED=99=94=20load?= =?UTF-8?q?ing=20=EA=B8=80=EB=A1=9C=EB=B2=8C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 16 +- src/apis/BlackList.js | 2 +- src/assets/data/data.js | 32 + src/assets/data/index.js | 2 +- src/assets/data/options.js | 12 + .../data/pages/caliumRequestSearch.json | 53 ++ src/assets/data/pages/eventSearch.json | 63 ++ src/assets/data/pages/mailSearch.json | 90 +++ src/assets/data/pages/menuBanner.json | 126 ++++ src/assets/data/pages/menuBannerRegist.json | 176 +++++ src/assets/data/pages/menuBannerSearch.json | 53 ++ src/assets/data/pages/menuBannerTable.json | 107 +++ src/assets/data/pages/userBlockSearch.json | 78 ++ src/assets/data/pages/userBlockTable.json | 101 +++ src/assets/data/types.js | 9 + src/components/ServiceManage/index.js | 7 +- .../ServiceManage/modal/BattleEventModal.js | 136 ++-- .../ServiceManage/modal/EventDetailModal.js | 83 +-- .../ServiceManage/modal/LandAuctionModal.js | 112 +-- .../ServiceManage/modal/OwnerChangeModal.js | 124 +--- .../searchBar/AdminViewSearchBar.js | 8 +- .../searchBar/CommonSearchBar.js | 134 ++++ .../searchBar/LandInfoSearchBar.js | 4 +- .../searchBar/LogViewSearchBar.js | 8 +- .../searchBar/useCommonSearch.js | 182 +++++ src/components/UserManage/AuthRegistBar.js | 2 +- .../UserManage/CaliumRequestRegistModal.js | 127 +--- src/components/common/Custom/CaliTable.js | 112 +++ .../Date/DateTimeRangerPickerComponent.js | 11 +- .../common/SearchBar/SearchBarLayout.js | 16 +- src/components/common/Table/TableHeader.js | 80 +++ src/components/common/Table/ViewTableInfo.js | 100 +-- src/components/common/alert/ToastAlert.js | 156 ++++ src/components/common/index.js | 8 +- src/components/common/modal/DynamicModal.js | 4 - src/context/AlertProvider.js | 155 ++++ src/context/LoadingProvider.js | 37 + src/i18n.js | 21 +- src/pages/DataManage/LandInfoView.js | 26 +- src/pages/ServiceManage/BattleEvent.js | 123 ++-- src/pages/ServiceManage/Board.js | 342 ++++----- src/pages/ServiceManage/Event.js | 261 +++---- src/pages/ServiceManage/EventRegist.js | 161 ++--- src/pages/ServiceManage/LandAuction.js | 70 +- src/pages/ServiceManage/Mail.js | 456 +++++------- src/pages/ServiceManage/MailRegist.js | 672 +++++++++--------- src/pages/ServiceManage/UserBlock.js | 442 ++++-------- src/pages/ServiceManage/UserBlockRegist.js | 167 ++--- src/pages/UserManage/AuthSettingUpdate.js | 80 +-- src/pages/UserManage/CaliumRequest.js | 249 +++---- 50 files changed, 3211 insertions(+), 2385 deletions(-) create mode 100644 src/assets/data/pages/caliumRequestSearch.json create mode 100644 src/assets/data/pages/eventSearch.json create mode 100644 src/assets/data/pages/mailSearch.json create mode 100644 src/assets/data/pages/menuBanner.json create mode 100644 src/assets/data/pages/menuBannerRegist.json create mode 100644 src/assets/data/pages/menuBannerSearch.json create mode 100644 src/assets/data/pages/menuBannerTable.json create mode 100644 src/assets/data/pages/userBlockSearch.json create mode 100644 src/assets/data/pages/userBlockTable.json create mode 100644 src/components/ServiceManage/searchBar/CommonSearchBar.js create mode 100644 src/components/ServiceManage/searchBar/useCommonSearch.js create mode 100644 src/components/common/Custom/CaliTable.js create mode 100644 src/components/common/Table/TableHeader.js create mode 100644 src/components/common/alert/ToastAlert.js create mode 100644 src/context/AlertProvider.js create mode 100644 src/context/LoadingProvider.js diff --git a/src/App.js b/src/App.js index 880d5ed..02bd081 100644 --- a/src/App.js +++ b/src/App.js @@ -5,16 +5,22 @@ import GlobalStyles from './styles/GlobalStyles'; import RouteInfo from './RouteInfo'; import './i18n'; +import { AlertProvider } from './context/AlertProvider'; +import { LoadingProvider } from './context/LoadingProvider'; function App() { const isToken = sessionStorage.getItem('token') ? true : false; return ( - - - {isToken ? : } - - + + + + + {isToken ? : } + + + + ); } diff --git a/src/apis/BlackList.js b/src/apis/BlackList.js index 4a045f5..7d75c1c 100644 --- a/src/apis/BlackList.js +++ b/src/apis/BlackList.js @@ -67,7 +67,7 @@ export const BlackListRegist = async (token, params) => { headers: { Authorization: `Bearer ${token}` }, }); - return res; + return res.data; } catch (e) { if (e instanceof Error) { throw new Error('BlacklistRegist', e); diff --git a/src/assets/data/data.js b/src/assets/data/data.js index c5efe05..bcad856 100644 --- a/src/assets/data/data.js +++ b/src/assets/data/data.js @@ -24,11 +24,39 @@ export const caliumRequestInitData = { content: '', } +export const ORDER_OPTIONS = { + asc: [ + { value: 'ASC', label: '오름차순' }, + { value: 'DESC', label: '내림차순' } + ], + desc: [ + { value: 'DESC', label: '내림차순' }, + { value: 'ASC', label: '오름차순' } + ], +}; + +export const PAGE_SIZE_OPTIONS = { + default: [ + { value: '50', label: '50개' }, + { value: '100', label: '100개' } + ], + B: [ + { value: '500', label: '500개' }, + { value: '1000', label: '1000개' }, + { value: '5000', label: '5000개' }, + { value: '10000', label: '10000개' } + ], +}; + export const STATUS_STYLES = { COMPLETE: { background: '#58AB62', color: 'white' }, + EXPIRATION: { + background: '#58AB62', + color: 'white' + }, WAIT: { background: '#DEBB46', color: 'black' @@ -57,6 +85,10 @@ export const STATUS_STYLES = { background: '#4287f5', color: 'white' }, + INPROGRESS: { + background: '#4287f5', + color: 'white' + }, AUCTION_END: { background: '#A37FB8', color: 'white' diff --git a/src/assets/data/index.js b/src/assets/data/index.js index a9433ca..016f34f 100644 --- a/src/assets/data/index.js +++ b/src/assets/data/index.js @@ -28,4 +28,4 @@ export { opUserSessionType, opMailType, } from './options' -export {benItems, MinuteList, HourList, caliumRequestInitData, STATUS_STYLES, months} from './data' \ No newline at end of file +export {benItems, MinuteList, HourList, caliumRequestInitData, STATUS_STYLES, months, PAGE_SIZE_OPTIONS, ORDER_OPTIONS} from './data' \ No newline at end of file diff --git a/src/assets/data/options.js b/src/assets/data/options.js index d07b1b4..87b515f 100644 --- a/src/assets/data/options.js +++ b/src/assets/data/options.js @@ -10,6 +10,18 @@ export const mailSendType = [ { value: 'DIRECT_SEND', name: '즉시 발송' }, ]; +export const message_type = [ + { value: 'CHATTING', name: '채팅 타입' }, + { value: 'CHATTING_TOAST', name: '채팅 + 토스트' }, +]; + +export const sendStatus = [ + { value: 'WAIT', name: '대기' }, + { value: 'RUNNING', name: '송출중' }, + { value: 'FINISH', name: '완료' }, + { value: 'FAIL', name: '실패' }, +]; + export const mailSendStatus = [ { value: 'ALL', name: '전체' }, { value: 'WAIT', name: '대기' }, diff --git a/src/assets/data/pages/caliumRequestSearch.json b/src/assets/data/pages/caliumRequestSearch.json new file mode 100644 index 0000000..afc7e8c --- /dev/null +++ b/src/assets/data/pages/caliumRequestSearch.json @@ -0,0 +1,53 @@ +{ + "initialSearchParams": { + "searchContent": "", + "status": "ALL", + "startDate": "", + "endDate": "", + "orderBy": "DESC", + "pageSize": 50, + "currentPage": 1 + }, + + "searchFields": [ + { + "type": "period", + "startDateId": "startDate", + "endDateId": "endDate", + "label": "등록 일자", + "col": 1 + }, + { + "type": "text", + "id": "searchContent", + "label": "요청 내용", + "placeholder": "요청 내용", + "width": "300px", + "col": 1 + }, + { + "type": "select", + "id": "status", + "label": "요청 상태", + "optionsRef": "caliumStatus", + "col": 1 + } + ], + + "apiInfo": { + "functionName": "CaliumRequestView", + "loadOnMount": true, + "paramsMapping": [ + "searchContent", + "status", + {"param": "startDate", "transform": "toISOString"}, + {"param": "endDate", "transform": "toISOString"}, + "orderBy", + "pageSize", + "currentPage" + ], + "pageField": "currentPage", + "pageSizeField": "pageSize", + "orderField": "orderBy" + } +} \ No newline at end of file diff --git a/src/assets/data/pages/eventSearch.json b/src/assets/data/pages/eventSearch.json new file mode 100644 index 0000000..fcd5d3e --- /dev/null +++ b/src/assets/data/pages/eventSearch.json @@ -0,0 +1,63 @@ +{ + "initialSearchParams": { + "searchTitle": "", + "searchContent": "", + "status": "ALL", + "startDate": "", + "endDate": "", + "orderBy": "DESC", + "pageSize": 50, + "currentPage": 1 + }, + + "searchFields": [ + { + "type": "text", + "id": "searchTitle", + "label": "우편 제목", + "placeholder": "제목 입력", + "width": "300px", + "col": 1 + }, + { + "type": "period", + "startDateId": "startDate", + "endDateId": "endDate", + "label": "조회 일자", + "col": 1 + }, + { + "type": "text", + "id": "searchContent", + "label": "우편 내용", + "placeholder": "우편 내용(공백으로 구분)", + "width": "300px", + "col": 1 + }, + { + "type": "select", + "id": "status", + "label": "이벤트 상태", + "optionsRef": "eventStatus", + "col": 2 + } + ], + + "apiInfo": { + "functionName": "EventView", + "loadOnMount": true, + "paramsMapping": [ + "searchTitle", + "searchContent", + "status", + {"param": "startDate", "transform": "toISOString"}, + {"param": "endDate", "transform": "toISOString"}, + "orderBy", + "pageSize", + "currentPage" + ], + "pageField": "currentPage", + "pageSizeField": "pageSize", + "orderField": "orderBy" + } +} \ No newline at end of file diff --git a/src/assets/data/pages/mailSearch.json b/src/assets/data/pages/mailSearch.json new file mode 100644 index 0000000..d699559 --- /dev/null +++ b/src/assets/data/pages/mailSearch.json @@ -0,0 +1,90 @@ +{ + "initialSearchParams": { + "searchTitle": "", + "searchContent": "", + "sendType": "ALL", + "status": "ALL", + "mailType": "ALL", + "receiveType": "ALL", + "startDate": "", + "endDate": "", + "orderBy": "DESC", + "pageSize": 50, + "currentPage": 1 + }, + + "searchFields": [ + { + "type": "text", + "id": "searchTitle", + "label": "우편 제목", + "placeholder": "제목 입력", + "width": "300px", + "col": 1 + }, + { + "type": "period", + "startDateId": "startDate", + "endDateId": "endDate", + "label": "조회 일자", + "col": 1 + }, + { + "type": "text", + "id": "searchContent", + "label": "우편 내용", + "placeholder": "우편 내용(공백으로 구분)", + "width": "300px", + "col": 1 + }, + { + "type": "select", + "id": "sendType", + "label": "발송 방식", + "optionsRef": "mailSendType", + "col": 2 + }, + { + "type": "select", + "id": "status", + "label": "발송 상태", + "optionsRef": "mailSendStatus", + "col": 2 + }, + { + "type": "select", + "id": "mailType", + "label": "우편 타입", + "optionsRef": "mailType", + "col": 2 + }, + { + "type": "select", + "id": "receiveType", + "label": "수신 대상", + "optionsRef": "mailReceiveType", + "col": 2 + } + ], + + "apiInfo": { + "functionName": "MailView", + "loadOnMount": true, + "paramsMapping": [ + "searchTitle", + "searchContent", + "sendType", + "status", + "mailType", + "receiveType", + {"param": "startDate", "transform": "toISOString"}, + {"param": "endDate", "transform": "toISOString"}, + "orderBy", + "pageSize", + "currentPage" + ], + "pageField": "currentPage", + "pageSizeField": "pageSize", + "orderField": "orderBy" + } +} \ No newline at end of file diff --git a/src/assets/data/pages/menuBanner.json b/src/assets/data/pages/menuBanner.json new file mode 100644 index 0000000..7c4e223 --- /dev/null +++ b/src/assets/data/pages/menuBanner.json @@ -0,0 +1,126 @@ +{ + "pageId": "menuBanner", + "title": "메뉴 배너 관리", + "endpoint": "/api/v1/menu/banner", + "permissions": ["battleEventRead", "battleEventUpdate", "battleEventDelete"], + "layout": { + "type": "standard", + "components": ["search", "table", "pagination"] + }, + "actions": [ + { + "id": "create", + "label": "배너 등록", + "type": "button", + "theme": "primary", + "permission": "battleEventUpdate", + "action": { + "type": "modal", + "target": "createModal" + } + }, + { + "id": "delete", + "label": "선택 삭제", + "type": "button", + "theme": "line", + "permission": "battleEventDelete", + "requireSelection": true, + "action": { + "type": "modal", + "target": "deleteConfirmModal" + } + } + ], + "modals": { + "createModal": { + "id": "createModal", + "type": "form", + "title": "메뉴 배너 등록", + "size": "medium", + "schema": "menuBannerForm", + "actions": [ + { + "id": "cancel", + "label": "취소", + "type": "button", + "theme": "line", + "action": { + "type": "close" + } + }, + { + "id": "submit", + "label": "등록", + "type": "button", + "theme": "primary", + "action": { + "type": "api", + "method": "POST", + "endpoint": "/api/v1/menu/banner", + "successAction": { + "type": "close", + "then": "refresh" + } + } + } + ] + }, + "detailModal": { + "id": "detailModal", + "type": "form", + "title": "메뉴 배너 상세", + "size": "medium", + "schema": "menuBannerForm", + "readOnly": true, + "dataSource": { + "type": "api", + "endpoint": "/api/v1/menu/banner/detail/{id}" + }, + "actions": [ + { + "id": "close", + "label": "확인", + "type": "button", + "theme": "line", + "action": { + "type": "close" + } + } + ] + }, + "deleteConfirmModal": { + "id": "deleteConfirmModal", + "type": "confirm", + "title": "배너 삭제", + "message": "선택한 배너를 삭제하시겠습니까?", + "actions": [ + { + "id": "cancel", + "label": "취소", + "type": "button", + "theme": "line", + "action": { + "type": "close" + } + }, + { + "id": "confirm", + "label": "삭제", + "type": "button", + "theme": "primary", + "action": { + "type": "api", + "method": "DELETE", + "endpoint": "/api/v1/menu/banner/delete", + "dataTransform": "selectedToRequestBody", + "successAction": { + "type": "close", + "then": "refresh" + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/src/assets/data/pages/menuBannerRegist.json b/src/assets/data/pages/menuBannerRegist.json new file mode 100644 index 0000000..fc63a47 --- /dev/null +++ b/src/assets/data/pages/menuBannerRegist.json @@ -0,0 +1,176 @@ +{ + "modal": { + "titles": { + "create": "메뉴배너 등록", + "update": "메뉴배너 수정", + "view": "메뉴배너 상세" + }, + "grid": { + "rows": 8, + "columns": 12 + }, + "fields": [ + { + "id": "date_range", + "type": "dateTimeRange", + "label": "등록기간", + "position": { "row": 0, "col": 0, "width": 12 }, + "startDateField": "start_dt", + "endDateField": "end_dt", + "startDateLabel": "시작일자", + "endDateLabel": "종료일자", + "validations": ["required"], + "visibleOn": ["create", "update", "view"], + "editableOn": ["create", "update"] + }, + { + "id": "title", + "type": "text", + "label": "배너 제목", + "position": { "row": 1, "col": 0, "width": 6 }, + "validations": ["required"], + "visibleOn": ["create", "update", "view"], + "editableOn": ["create", "update"], + "width": "100%" + }, + { + "id": "image_ko", + "type": "imageUpload", + "label": "이미지 첨부 (KO)", + "position": { "row": 2, "col": 0, "width": 12 }, + "language": "KO", + "validations": ["required"], + "visibleOn": ["create", "update", "view"], + "editableOn": ["create", "update"] + }, + { + "id": "image_en", + "type": "imageUpload", + "label": "이미지 첨부 (EN)", + "position": { "row": 3, "col": 0, "width": 12 }, + "language": "EN", + "validations": ["required"], + "visibleOn": ["create", "update", "view"], + "editableOn": ["create", "update"] + }, + { + "id": "image_ja", + "type": "imageUpload", + "label": "이미지 첨부 (JA)", + "position": { "row": 4, "col": 0, "width": 12 }, + "language": "JA", + "validations": ["required"], + "visibleOn": ["create", "update", "view"], + "editableOn": ["create", "update"] + }, + { + "id": "is_link", + "type": "checkbox", + "label": "이미지 링크 여부", + "position": { "row": 5, "col": 0, "width": 12 }, + "visibleOn": ["create", "update", "view"], + "editableOn": ["create", "update"] + }, + { + "id": "link_ko", + "type": "textWithSuffix", + "label": "웹 링크", + "position": { "row": 6, "col": 0, "width": 12 }, + "suffix": "KO", + "conditional": { "field": "is_link", "operator": "==", "value": true }, + "validations": ["required"], + "visibleOn": ["create", "update", "view"], + "editableOn": ["create", "update"], + "width": "100%" + }, + { + "id": "link_en", + "type": "textWithSuffix", + "label": "", + "position": { "row": 7, "col": 0, "width": 12 }, + "suffix": "EN", + "conditional": { "field": "is_link", "operator": "==", "value": true }, + "validations": ["required"], + "visibleOn": ["create", "update", "view"], + "editableOn": ["create", "update"], + "width": "100%" + }, + { + "id": "link_ja", + "type": "textWithSuffix", + "label": "", + "position": { "row": 8, "col": 0, "width": 12 }, + "suffix": "JA", + "conditional": { "field": "is_link", "operator": "==", "value": true }, + "validations": ["required"], + "visibleOn": ["create", "update", "view"], + "editableOn": ["create", "update"], + "width": "100%" + } + ], + "actions": { + "create": [ + { "id": "cancel", "label": "취소", "theme": "line", "action": "cancel" }, + { "id": "submit", "label": "등록", "theme": "primary", "action": "submit" } + ], + "update": [ + { "id": "cancel", "label": "취소", "theme": "line", "action": "cancel" }, + { "id": "submit", "label": "수정", "theme": "primary", "action": "submit" } + ], + "view": [ + { "id": "cancel", "label": "취소", "theme": "line", "action": "cancel" }, + { "id": "edit", "label": "수정", "theme": "primary", "action": "edit" } + ] + }, + "validations": { + "create": [ + { + "condition": "start_dt < (new Date() + 60 * 60000)", + "message": "EVENT_TIME_LIMIT_ADD" + }, + { + "condition": "end_dt <= start_dt", + "message": "DATE_START_DIFF_END_WARNING" + } + ], + "update": [ + { + "condition": "end_dt <= start_dt", + "message": "DATE_START_DIFF_END_WARNING" + } + ] + }, + "api": { + "create": { + "endpoint": "MenuBannerSingleRegist", + "errorMapping": { + "ERROR_API_FAIL": "API_FAIL", + "ERROR_REGIST_FAIL": "REGIST_FAIL" + } + }, + "update": { + "endpoint": "MenuBannerUpdate", + "errorMapping": { + "ERROR_API_FAIL": "API_FAIL", + "ERROR_UPDATE_FAIL": "UPDATE_FAIL" + } + } + } + }, + "initData": { + "title": "", + "is_link": false, + "start_dt": "", + "end_dt": "", + "image_list": [ + { "language": "KO", "content": "" }, + { "language": "EN", "content": "" }, + { "language": "JA", "content": "" } + ], + "link_list": [ + { "language": "KO", "content": "" }, + { "language": "EN", "content": "" }, + { "language": "JA", "content": "" } + ] + } +} \ No newline at end of file diff --git a/src/assets/data/pages/menuBannerSearch.json b/src/assets/data/pages/menuBannerSearch.json new file mode 100644 index 0000000..a119b86 --- /dev/null +++ b/src/assets/data/pages/menuBannerSearch.json @@ -0,0 +1,53 @@ +{ + "initialSearchParams": { + "searchData": "", + "status": "ALL", + "startDate": "", + "endDate": "", + "orderBy": "DESC", + "pageSize": 50, + "currentPage": 1 + }, + + "searchFields": [ + { + "type": "text", + "id": "searchData", + "label": "제목", + "placeholder": "제목 입력", + "width": "300px", + "col": 1 + }, + { + "type": "select", + "id": "status", + "label": "상태", + "optionsRef": "opMenuBannerStatus", + "col": 1 + }, + { + "type": "period", + "startDateId": "startDate", + "endDateId": "endDate", + "label": "기간", + "col": 1 + } + ], + + "apiInfo": { + "functionName": "MenuBannerView", + "loadOnMount": true, + "paramsMapping": [ + "searchData", + "status", + {"param": "startDate", "transform": "toISOString"}, + {"param": "endDate", "transform": "toISOString"}, + "orderBy", + "pageSize", + "currentPage" + ], + "pageField": "currentPage", + "pageSizeField": "pageSize", + "orderField": "orderBy" + } +} \ No newline at end of file diff --git a/src/assets/data/pages/menuBannerTable.json b/src/assets/data/pages/menuBannerTable.json new file mode 100644 index 0000000..45b423a --- /dev/null +++ b/src/assets/data/pages/menuBannerTable.json @@ -0,0 +1,107 @@ +{ + "id": "menuBannerTable", + "selection": { + "type": "single", + "idField": "id" + }, + "header": { + "countType": "total", + "orderType": "desc", + "pageType": "default", + "buttons": [ + { + "id": "delete", + "text": "선택 삭제", + "theme": "line", + "disableWhen": "noSelection", + "requiredAuth": "battleEventDelete", + "action": "delete" + }, + { + "id": "register", + "text": "이미지 등록", + "theme": "primary", + "requiredAuth": "battleEventUpdate", + "action": "navigate", + "navigateTo": "/servicemanage/menubanner/menubannerregist" + } + ] + }, + "columns": [ + { + "id": "checkbox", + "type": "checkbox", + "width": "40px", + "title": "" + }, + { + "id": "row_num", + "type": "text", + "width": "70px", + "title": "번호" + }, + { + "id": "status", + "type": "status", + "width": "100px", + "title": "등록 상태", + "option_name": "opMenuBannerStatus" + }, + { + "id": "start_dt", + "type": "date", + "width": "200px", + "title": "시작일(KST)", + "format": { + "type": "function", + "name": "convertKTC" + } + }, + { + "id": "end_dt", + "type": "date", + "width": "200px", + "title": "종료일(KST)", + "format": { + "type": "function", + "name": "convertKTC" + } + }, + { + "id": "title", + "type": "text", + "title": "설명 제목" + }, + { + "id": "is_link", + "type": "option", + "width": "90px", + "title": "링크여부", + "option_name": "opYNType" + }, + { + "id": "detail", + "type": "button", + "width": "120px", + "title": "상세보기", + "text": "상세보기", + "action": { + "type": "modal", + "target": "detailModal", + "dataParam": { + "id": "id" + } + } + }, + { + "id": "update_by", + "type": "text", + "width": "150px", + "title": "히스토리" + } + ], + "sort": { + "defaultColumn": "row_num", + "defaultDirection": "desc" + } +} \ No newline at end of file diff --git a/src/assets/data/pages/userBlockSearch.json b/src/assets/data/pages/userBlockSearch.json new file mode 100644 index 0000000..ed294ee --- /dev/null +++ b/src/assets/data/pages/userBlockSearch.json @@ -0,0 +1,78 @@ +{ + "initialSearchParams": { + "searchType": "GUID", + "searchData": "", + "email": "", + "status": "ALL", + "sanctions": "ALL", + "period": "ALL", + "orderBy": "DESC", + "pageSize": 50, + "currentPage": 1 + }, + + "searchFields": [ + { + "type": "select", + "id": "searchType", + "label": "대상", + "optionsRef": "eventStatus", + "col": 1 + }, + { + "type": "text", + "id": "searchData", + "placeholder": "대상 입력", + "width": "300px", + "col": 1 + }, + { + "type": "text", + "id": "email", + "label": "등록자", + "placeholder": "이메일 입력", + "width": "300px", + "col": 1 + }, + { + "type": "select", + "id": "status", + "label": "상태", + "optionsRef": "blockStatus", + "col": 2 + }, + { + "type": "select", + "id": "sanctions", + "label": "제재 사유", + "optionsRef": "blockSanctions", + "col": 2 + }, + { + "type": "select", + "id": "period", + "label": "제재 기간", + "optionsRef": "blockPeriod", + "col": 2 + } + ], + + "apiInfo": { + "functionName": "BlackListView", + "loadOnMount": true, + "paramsMapping": [ + "searchType", + "searchData", + "email", + "status", + "sanctions", + "period", + "orderBy", + "pageSize", + "currentPage" + ], + "pageField": "currentPage", + "pageSizeField": "pageSize", + "orderField": "orderBy" + } +} \ No newline at end of file diff --git a/src/assets/data/pages/userBlockTable.json b/src/assets/data/pages/userBlockTable.json new file mode 100644 index 0000000..8a3b4ea --- /dev/null +++ b/src/assets/data/pages/userBlockTable.json @@ -0,0 +1,101 @@ +{ + "id": "userBlockTable", + "selection": { + "type": "single", + "idField": "id" + }, + "header": { + "countType": "total", + "orderType": "desc", + "pageType": "default", + "buttons": [ + { + "id": "delete", + "text": "선택 삭제", + "theme": "line", + "disableWhen": "noSelection", + "requiredAuth": "blackListDelete", + "action": "delete" + }, + { + "id": "register", + "text": "제재 등록", + "theme": "primary", + "requiredAuth": "blackListUpdate", + "action": "navigate", + "navigateTo": "/servicemanage/userblock/userblockregist" + } + ] + }, + "columns": [ + { + "id": "checkbox", + "type": "checkbox", + "width": "40px", + "title": "" + }, + { + "id": "row_num", + "type": "text", + "width": "80px", + "title": "번호" + }, + { + "id": "guid", + "type": "text", + "width": "20%", + "title": "GUID" + }, + { + "id": "nickname", + "type": "text", + "width": "20%", + "title": "아바타명" + }, + { + "id": "status", + "type": "status", + "width": "100px", + "title": "상태", + "option_name": "blockStatus" + }, + { + "id": "period", + "type": "option", + "width": "100px", + "title": "제재 기간", + "option_name": "blockPeriod" + }, + { + "id": "sanctions", + "type": "option", + "width": "250px", + "title": "제재 사유", + "option_name": "blockSanctions" + }, + { + "id": "create_by", + "type": "text", + "width": "150px", + "title": "등록자" + }, + { + "id": "detail", + "type": "button", + "width": "120px", + "title": "상세보기", + "text": "상세보기", + "action": { + "type": "modal", + "target": "detailModal", + "dataParam": { + "id": "id" + } + } + } + ], + "sort": { + "defaultColumn": "row_num", + "defaultDirection": "desc" + } +} \ No newline at end of file diff --git a/src/assets/data/types.js b/src/assets/data/types.js index b97e302..8a15169 100644 --- a/src/assets/data/types.js +++ b/src/assets/data/types.js @@ -59,6 +59,15 @@ export const authType = { levelDeveloper: 99999, }; +export const alertTypes = { + info: 0, + success: 1, + warning: 2, + error: 3, + confirm: 4, + confirmChildren: 5 +} + export const adminAuthLevel = { NONE: "None", READER: "Reader", diff --git a/src/components/ServiceManage/index.js b/src/components/ServiceManage/index.js index 9800b63..152b084 100644 --- a/src/components/ServiceManage/index.js +++ b/src/components/ServiceManage/index.js @@ -22,6 +22,9 @@ import LogViewSearchBar from './searchBar/LogViewSearchBar'; import AdminViewSearchBar from './searchBar/AdminViewSearchBar'; import CaliumRequestSearchBar from './searchBar/CaliumRequestSearchBar'; +import CommonSearchBar from './searchBar/CommonSearchBar'; +import useCommonSearch from './searchBar/useCommonSearch'; + //etc import ReportListSummary from './ReportListSummary'; import WhiteListSearchBar from './WhiteListRegistBar'; @@ -50,5 +53,7 @@ export { LandAuctionSearchBar, LandAuctionModal, BattleEventModal, - OwnerChangeModal + OwnerChangeModal, + useCommonSearch, + CommonSearchBar }; diff --git a/src/components/ServiceManage/modal/BattleEventModal.js b/src/components/ServiceManage/modal/BattleEventModal.js index fb061aa..67723ce 100644 --- a/src/components/ServiceManage/modal/BattleEventModal.js +++ b/src/components/ServiceManage/modal/BattleEventModal.js @@ -1,7 +1,6 @@ import React, { useState, Fragment, useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import Button from '../../common/button/Button'; -import Loading from '../../common/Loading'; import { Title, @@ -19,10 +18,8 @@ import { FormStatusWarning, FormButtonContainer, } from '../../../styles/ModuleComponents'; -import { modalTypes } from '../../../assets/data'; -import { DynamicModal, Modal, SingleDatePicker, SingleTimePicker } from '../../common'; +import { Modal, SingleDatePicker, SingleTimePicker } from '../../common'; import { NONE, TYPE_MODIFY, TYPE_REGISTRY } from '../../../assets/data/adminConstants'; -import { useModal } from '../../../hooks/hook'; import { convertKTCDate } from '../../../utils'; import { battleEventHotTime, @@ -31,28 +28,19 @@ import { battleRepeatType, } from '../../../assets/data/options'; import { BattleEventModify, BattleEventSingleRegist } from '../../../apis/Battle'; -import { battleEventStatusType } from '../../../assets/data/types'; +import { alertTypes, battleEventStatusType } from '../../../assets/data/types'; import { isValidDayRange } from '../../../utils/date'; +import { useAlert } from '../../../context/AlertProvider'; +import { useLoading } from '../../../context/LoadingProvider'; const BattleEventModal = ({ modalType, detailView, handleDetailView, content, setDetailData, configData, rewardData }) => { const { t } = useTranslation(); const token = sessionStorage.getItem('token'); + const { showToast, showModal } = useAlert(); + const {withLoading} = useLoading(); - const [loading, setLoading] = useState(false); // 로딩 창 - const { - modalState, - handleModalView, - handleModalClose - } = useModal({ - cancel: 'hidden', - registConfirm: 'hidden', - registComplete: 'hidden' - }); - - const [isNullValue, setIsNullValue] = useState(false); // 데이터 값 체크 - const [alertMsg, setAlertMsg] = useState(''); - - const [resultData, setResultData] = useState(initData); //데이터 정보 + const [isNullValue, setIsNullValue] = useState(false); + const [resultData, setResultData] = useState(initData); useEffect(() => { if(modalType === TYPE_MODIFY && content && Object.keys(content).length > 0){ @@ -103,7 +91,7 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se const endDay = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate()); if (endDay <= startDay) { - setAlertMsg(t('BATTLE_EVENT_MODAL_START_DIFF_END_WARNING')); + showToast('DATE_START_DIFF_END_WARNING', {type: alertTypes.warning}); return; } } @@ -147,7 +135,7 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se const endDay = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate()); if (endDay <= startDay) { - setAlertMsg(t('BATTLE_EVENT_MODAL_START_DIFF_END_WARNING')); + showToast('DATE_START_DIFF_END_WARNING', {type: alertTypes.warning}); return; } @@ -166,7 +154,7 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se round_time: config.round_time }); } else { - console.warn('Config not found for value:', e.target.value); + showToast('Config not found for value:', e.target.value, {type: alertTypes.warning}); } } @@ -185,17 +173,17 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se const startDt = resultData.event_start_dt; const endDt = resultData.event_end_dt; if (modalType === TYPE_REGISTRY && startDt < minAllowedTime) { - setAlertMsg(t('BATTLE_EVENT_MODAL_START_DT_WARNING')); + showToast('BATTLE_EVENT_MODAL_START_DT_WARNING', {type: alertTypes.warning}); return; } if(resultData.repeat_type !== 'NONE' && !isValidDayRange(startDt, endDt)) { - setAlertMsg(t('BATTLE_EVENT_MODAL_START_DIFF_END_WARNING')) + showToast('BATTLE_EVENT_MODAL_START_DT_WARNING', {type: alertTypes.warning}); return; } //화면에 머물면서 상태는 안바꼈을 경우가 있기에 시작시간 지났을경우 차단 if (modalType === TYPE_REGISTRY && startDt < new Date()) { - setAlertMsg(t('BATTLE_EVENT_MODAL_START_DT_WARNING')); + showToast('BATTLE_EVENT_MODAL_START_DT_WARNING', {type: alertTypes.warning}); return; } @@ -204,57 +192,48 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se setResultData({ ...resultData, round_time: config.round_time }); } - handleModalView('registConfirm'); - break; - case "cancel": - handleModalView('cancel'); - break; - case "cancelConfirm": - handleModalClose('cancel'); - handleReset(); + showModal(isView('modify') ? 'BATTLE_EVENT_UPDATE_CONFIRM' : 'BATTLE_EVENT_REGIST_CONFIRM', { + type: alertTypes.confirm, + onConfirm: () => handleSubmit('registConfirm') + }); + break; case "registConfirm": - setLoading(true); - if(isView('modify')){ - await BattleEventModify(token, content?.id, resultData).then(data => { - setLoading(false); - handleModalClose('registConfirm'); + await withLoading( async () => { + return await BattleEventModify(token, content?.id, resultData); + }).then(data => { if(data.result === "SUCCESS") { - handleModalView('registComplete'); + showToast('UPDATE_COMPLETED', {type: alertTypes.success}); }else if(data.result === "ERROR_BATTLE_EVENT_TIME_OVER"){ - setAlertMsg(t('BATTLE_EVENT_MODAL_TIME_CHECK_WARNING')); + showToast('BATTLE_EVENT_MODAL_TIME_CHECK_WARNING', {type: alertTypes.error}); }else{ - setAlertMsg(t('UPDATE_FAIL')); + showToast('UPDATE_FAIL', {type: alertTypes.error}); } }).catch(reason => { - setAlertMsg(t('API_FAIL')); + showToast('API_FAIL', {type: alertTypes.error}); + }).finally(() => { + handleReset(); }); } else{ - await BattleEventSingleRegist(token, resultData).then(data => { - setLoading(false); - handleModalClose('registConfirm'); + await withLoading( async () => { + return await BattleEventSingleRegist(token, resultData); + }).then(data => { if(data.result === "SUCCESS") { - handleModalView('registComplete'); + showToast('REGIST_COMPLTE', {type: alertTypes.success}); }else if(data.result === "ERROR_BATTLE_EVENT_TIME_OVER"){ - setAlertMsg(t('BATTLE_EVENT_MODAL_TIME_CHECK_WARNING')); + showToast('BATTLE_EVENT_MODAL_TIME_CHECK_WARNING', {type: alertTypes.error}); }else{ - setAlertMsg(t('REGIST_FAIL')); + showToast('REGIST_FAIL', {type: alertTypes.error}); } }).catch(reason => { - setAlertMsg(t('API_FAIL')); + showToast('API_FAIL', {type: alertTypes.error}); + }).finally(() => { + handleReset(); }); } break; - case "registComplete": - handleModalClose('registComplete'); - handleReset(); - window.location.reload(); - break; - case "warning": - setAlertMsg(''); - break; } } @@ -404,7 +383,14 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se /> : <> -