Skip to content

Commit

Permalink
[티켓,랜딩] 랜딩페이지 통계정보, 티켓 리스트 수정
Browse files Browse the repository at this point in the history
[티켓,랜딩] 랜딩페이지 통계정보, 티켓 리스트 수정
  • Loading branch information
ImNM authored Aug 6, 2022
2 parents 8883db9 + 863c3c1 commit b11eb15
Show file tree
Hide file tree
Showing 11 changed files with 222 additions and 10 deletions.
29 changes: 29 additions & 0 deletions src/components/LandingPage/Box.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

.Box {
width: 200px;
border-radius: 4px;
background: white;
height: 120px;
display: flex;
align-items: center;
justify-content: left;
cursor: pointer;
}


.text1 {
color: rgb(185, 185, 185);
font-size: 14px;
justify-content: left;
text-align: left;
margin-left: 17pt;
}


.text2 {
margin-left: 17pt;
color: rgb(185, 185, 185);
font-size: 30px;
justify-content: left;
text-align: left;
}
20 changes: 20 additions & 0 deletions src/components/LandingPage/Box.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import './Box.css';

export const Box = ({ data, title }) => {
return (
<div
className="Box"
style={{
marginRight: '20px',
float: 'left',
marginBottom: '20px'
}}
>
<div>
<div className="text1">{title}</div>

<div className="text2"> {data}</div>
</div>
</div>
);
};
84 changes: 80 additions & 4 deletions src/components/LandingPage/LandingPage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,83 @@
import React from "react";
import React, { useState, useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { Box } from './Box';
import { LandingPage } from '../../state/actions-creators/LandingPage';

function LandingPage() {
return <div>LandingPage</div>;
function Landing_Page() {
const dispatch = useDispatch();
const { data } = useSelector(state => state.LandingPage);

useEffect(() => {
dispatch(LandingPage());
}, [dispatch]);

console.log(data);

return (
<div style={{ display: 'flex' }}>
<ul>
<p
style={{ fontWeight: 'bold', fontSize: '14px', marginBottom: '20px' }}
>
티켓 관련
</p>

{data && (
<div>
<Box data={data?.totalTicket} title={'링크 발급된 티켓'}>
{' '}
</Box>

<Box data={data?.depositedTicket} title={'입금 확인된 티켓'}>
{' '}
</Box>

<Box data={data?.income} title={'판매대금'}>
{' '}
</Box>
</div>
)}

<p
style={{ fontWeight: 'bold', fontSize: '14px', marginBottom: '20px' }}
>
입금 관련
</p>
{data && (
<div>
<Box data={data?.doneOrder} title={'입금 확인 완료'}>
{' '}
</Box>

<Box data={data?.waitOrder} title={'입금 확인 중'}>
{' '}
</Box>

<Box data={data?.expireOrder} title={'미입금 처리'}>
{' '}
</Box>
</div>
)}

<p
style={{ fontWeight: 'bold', fontSize: '14px', marginBottom: '20px' }}
>
입장 확인 관련
</p>
{data && (
<div>
<Box data={data?.enteredTicket} title={'입장 확인된 티켓'}>
{' '}
</Box>

<Box data={data?.nonEnteredTicket} title={'입장 확인 안 된 티켓'}>
{' '}
</Box>
</div>
)}
</ul>
</div>
);
}

export default LandingPage;
export default Landing_Page;
27 changes: 23 additions & 4 deletions src/components/Tables/TicketsPage/TicketsPage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react';

import moment from 'moment';
import { useSelector, useDispatch } from 'react-redux';
import { Table, Segmented, Select } from 'antd';
import {
Expand Down Expand Up @@ -139,8 +139,23 @@ function TicketsPage() {
render={user => user.name}
key="id"
/>

<Column title="공연 날짜" dataIndex="date" key="id" />
<Column title="예매일자" dataIndex="createdAt" key="id" />
<Column
title="예매일자"
dataIndex="createdAt"
render={element => {
return moment(element).utc(false).format('MM월DD일 HH:mm');
}}
/>
<Column
title="업데이트일자"
dataIndex="updatedAt"
key="id"
render={element => {
return moment(element).utc(false).format('MM월DD일 HH:mm');
}}
/>
<Column
title="Action"
dataIndex=""
Expand All @@ -153,8 +168,12 @@ function TicketsPage() {
>
<Option value="입금확인">입금확인</Option>
<Option value="입장완료">입장완료</Option>
<Option value="기한만료">기한만료</Option>
<Option value="확인대기">확인대기</Option>
<Option value="기한만료" disabled={true}>
기한만료
</Option>
<Option value="확인대기" disabled={true}>
확인대기
</Option>
</Select>
</div>
);
Expand Down
2 changes: 2 additions & 0 deletions src/state/action-types/LandingPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const LANDING_PAGE_SUCCESS = 'LANDING_PAGE_SUCCESS';
export const LANDING_PAGE_ERROR = 'LANING_PAGE_ERROR';
1 change: 1 addition & 0 deletions src/state/action-types/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * from './logout';
export * from './examplePagination';
export * from './ticketPagination';
export * from './usersPage';
export * from './LandingPage';
32 changes: 32 additions & 0 deletions src/state/actions-creators/LandingPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import axios from 'axios';
import { LANDING_PAGE_SUCCESS, LANDING_PAGE_ERROR } from '../action-types';

export const LandingPage = callback => async dispatch => {
try {
const response = await axios.get(
`https://api.gosrock.band/v1/orders/report`
);
console.log(response.data.data);

const newData = response.data.data;
const data = {
totalTicket: newData.ticketReport.totalTicket,
depositedTicket: newData.ticketReport.depositedTicket,
income: newData.income,
doneOrder: newData.orderReport.doneOrder,
waitOrder: newData.orderReport.waitOrder,
expireOrder: newData.orderReport.waitOrder,
enteredTicket: newData.enterReport.enteredTicket,
nonEnteredTicket: newData.enterReport.nonEnteredTicket
};

dispatch({ type: LANDING_PAGE_SUCCESS, payload: data });

// 자동으로 피쳐로 넘어가게끔
// callback();
} catch (e) {
//400 ~
console.log(e);
dispatch({ type: LANDING_PAGE_ERROR, payload: '조회 실패' });
}
};
3 changes: 2 additions & 1 deletion src/state/actions-creators/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import { slackMessage } from './slackMessage';
import { slackValidation } from './slackValidation';
import { logout } from './logout';
import { ticketPagination } from './ticketPagination';
import { LandingPage } from './LandingPage';

export { slackMessage, slackValidation, logout, ticketPagination };
export { slackMessage, slackValidation, logout, ticketPagination, LandingPage };
1 change: 1 addition & 0 deletions src/state/actions-creators/ticketPagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const changeState =
try {
console.log('ticketId:', id);
console.log('status:', e);

const response = await axios.patch(
`https://api.gosrock.band/v1/tickets/status`,
{ ticketId: id, status: e }
Expand Down
29 changes: 29 additions & 0 deletions src/state/reducers/LandingPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* eslint-disable import/no-anonymous-default-export */
import { LANDING_PAGE_SUCCESS, LANDING_PAGE_ERROR } from '../action-types';

export default function (
state = {
data: {
totalTicket: 0,
depositedTicket: 0,
income: 0,
doneOrder: 0,
waitOrder: 0,
expireOrder: 0,
enteredTicket: 0,
nonEnteredTicket: 0
},
error: null
},
action
) {
switch (action.type) {
case LANDING_PAGE_SUCCESS:
return { ...state, data: action.payload, error: action.payload };
case LANDING_PAGE_ERROR:
return { ...state, data: [], error: action.payload };

default:
return state;
}
}
4 changes: 3 additions & 1 deletion src/state/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { combineReducers } from 'redux';
import { auth } from './auth';
import examplePagination from './examplePagination';
import ticketPagination from './ticketPagination';
import LandingPage from './LandingPage';
import slackMessage from './slackMessage';
import usersPage from './usersPage';

Expand All @@ -10,5 +11,6 @@ export default combineReducers({
auth: auth,
examplePagination: examplePagination,
usersPage: usersPage,
ticketPagination: ticketPagination
ticketPagination: ticketPagination,
LandingPage: LandingPage
});

0 comments on commit b11eb15

Please sign in to comment.