diff --git a/.env.development b/.env.development index 6b3844f8..0d44ce67 100644 --- a/.env.development +++ b/.env.development @@ -15,6 +15,8 @@ NEXT_PUBLIC_CONVERTER_DXF_API_URL="https://v2.convertapi.com/convert/dxf/to/png? NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="https://q-order-dev.q-cells.jp/eos/login/autoLogin" NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="https://q-musubi-dev.q-cells.jp/qm/login/autoLogin" +NEXT_PUBLIC_ECONOMIC_SIMULATION_AUTH_URL="https://q-order-dev.q-cells.jp/eos/simulation/auth" +NEXT_PUBLIC_ECONOMIC_SIMULATION_URL="https://q-order-dev.q-cells.jp/eos/simulation/list" # 테스트용 # AWS_REGION="ap-northeast-2" diff --git a/.env.local.dev b/.env.local.dev index a53524ca..8b31ac6e 100644 --- a/.env.local.dev +++ b/.env.local.dev @@ -14,6 +14,8 @@ NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secr NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-stg.q-cells.jp:8120/eos/login/autoLogin" NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-stg.q-cells.jp:8120/qm/login/autoLogin" +NEXT_PUBLIC_ECONOMIC_SIMULATION_AUTH_URL="http://q-order-stg.q-cells.jp:8120/eos/simulation/auth" +NEXT_PUBLIC_ECONOMIC_SIMULATION_URL="http://q-order-stg.q-cells.jp:8120/eos/simulation/list" # 테스트용 # AWS_REGION="ap-northeast-2" diff --git a/.env.localhost b/.env.localhost index 7cab2757..cd3a3245 100644 --- a/.env.localhost +++ b/.env.localhost @@ -15,6 +15,8 @@ NEXT_PUBLIC_CONVERTER_DXF_API_URL="https://v2.convertapi.com/convert/dxf/to/png? NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-stg.q-cells.jp:8120/eos/login/autoLogin" NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-stg.q-cells.jp:8120/qm/login/autoLogin" +NEXT_PUBLIC_ECONOMIC_SIMULATION_AUTH_URL="http://q-order-stg.q-cells.jp:8120/eos/simulation/auth" +NEXT_PUBLIC_ECONOMIC_SIMULATION_URL="http://q-order-stg.q-cells.jp:8120/eos/simulation/list" # 테스트용 # AWS_REGION="ap-northeast-2" diff --git a/.env.production b/.env.production index 50904369..e421b123 100644 --- a/.env.production +++ b/.env.production @@ -15,6 +15,8 @@ NEXT_PUBLIC_CONVERTER_DXF_API_URL="https://v2.convertapi.com/convert/dxf/to/png? NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="https://q-order.q-cells.jp/eos/login/autoLogin" NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="https://q-musubi.q-cells.jp/qm/login/autoLogin" +NEXT_PUBLIC_ECONOMIC_SIMULATION_AUTH_URL="https://q-order.q-cells.jp/eos/simulation/auth" +NEXT_PUBLIC_ECONOMIC_SIMULATION_URL="https://q-order.q-cells.jp/eos/simulation/list" # AWS_REGION="ap-northeast-2" # AMPLIFY_BUCKET="interplug" diff --git a/src/components/header/Header.jsx b/src/components/header/Header.jsx index 8c2ccbff..13105ad8 100644 --- a/src/components/header/Header.jsx +++ b/src/components/header/Header.jsx @@ -164,6 +164,29 @@ export default function Header(props) { getAutoLoginParam() }, [userSession]) + const openEconomicSimulation = async () => { + const encRes = await promiseGet({ + url: '/api/pwrGnrSimulation/encData', + params: { saleStoreId: sessionState.saleStoreId, userId: sessionState.userId }, + }) + const { encSaleStoreId, encUserId } = encRes.data + + if (!encSaleStoreId || !encUserId) return + + const authRes = await fetch(process.env.NEXT_PUBLIC_ECONOMIC_SIMULATION_AUTH_URL, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ encSaleStoreId, encUserId }), + }) + + if (authRes.ok) { + window.open(process.env.NEXT_PUBLIC_ECONOMIC_SIMULATION_URL, 'economicSimulation', `height=${screen.height},width=${screen.width},fullscreen=yes`) + } else { + const body = await authRes.json() + swalFire({ text: body.resultMessage, type: 'error' }) + } + } + const menus = [ { id: 0, name: 'header.menus.home', url: '/', children: [] }, { @@ -187,6 +210,9 @@ export default function Header(props) { ], }, { id: 8, name: 'qna.title', url: '/community/qna', children: [] }, + ...(process.env.NEXT_PUBLIC_RUN_MODE !== 'production' + ? [{ id: 9, name: 'header.menus.economic.simulation', action: openEconomicSimulation, children: [] }] + : []), ] const syncSession = useCallback(() => { @@ -237,6 +263,11 @@ export default function Header(props) { onMouseLeave={(e) => ToggleonMouse(e, 'remove', 'nav > ul')} > {menu.children.length === 0 ? ( + menu.action ? ( + + ) : ( {getMessage(menu.name)} + ) ) : ( diff --git a/src/locales/ja.json b/src/locales/ja.json index 0eb938ad..3932290e 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -10,6 +10,7 @@ "header.menus.community.notice": "お知らせ", "header.menus.community.faq": "FAQ", "header.menus.community.archive": "各種資料ダウンロード", + "header.menus.economic.simulation": "経済シミュレーション管理", "header.logout": "ログアウト", "header.go": "移動", "header.online.warranty.system": "オンライン保証システム", diff --git a/src/locales/ko.json b/src/locales/ko.json index 7d0a94f0..68d0d476 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -10,6 +10,7 @@ "header.menus.community.notice": "공지사항", "header.menus.community.faq": "FAQ", "header.menus.community.archive": "각종 자료 다운로드", + "header.menus.economic.simulation": "경제시뮬레이션 관리", "header.logout": "로그아웃", "header.go": "이동", "header.online.warranty.system": "온라인보증시스템",