mid 셋팅및 코드 정리
This commit is contained in:
@@ -3,8 +3,8 @@ import { useLocation } from 'react-router';
|
||||
import { PATHS } from '@/shared/constants/paths';
|
||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||
import { useCashReceiptDetailMutation } from '@/entities/transaction/api/use-cash-receipt-detail-mutation';
|
||||
import { IssueInfoWrap } from '@/entities/transaction/ui/info-wrap/issue-info-wrap';
|
||||
import { DetailInfoWrap } from '@/entities/transaction/ui/info-wrap/detail-info-wrap';
|
||||
import { IssueInfoSection } from '@/entities/transaction/ui/section/issue-info-section';
|
||||
import { DetailInfoSection } from '@/entities/transaction/ui/section/detail-info-section';
|
||||
import { HeaderType } from '@/entities/common/model/types';
|
||||
import {
|
||||
TransactionCategory,
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
DetailResponse,
|
||||
IssueInfo,
|
||||
DetailInfo,
|
||||
InfoWrapKeys,
|
||||
InfoSectionKeys,
|
||||
CashReceiptPurposeType
|
||||
} from '@/entities/transaction/model/types';
|
||||
import {
|
||||
@@ -76,8 +76,8 @@ export const CashReceiptDetailPage = () => {
|
||||
callDetail();
|
||||
}, []);
|
||||
|
||||
const onClickToOpenInfo = (infoWrapKey: InfoWrapKeys) => {
|
||||
if(infoWrapKey === InfoWrapKeys.Detail){
|
||||
const onClickToOpenInfo = (infoSectionKey: InfoSectionKeys) => {
|
||||
if(infoSectionKey === InfoSectionKeys.Detail){
|
||||
setShowDetailInfo(!showDetailInfo);
|
||||
}
|
||||
};
|
||||
@@ -93,18 +93,18 @@ export const CashReceiptDetailPage = () => {
|
||||
<div className="tab-pane sub active">
|
||||
<div className="option-list">
|
||||
<div className="txn-detail">
|
||||
<IssueInfoWrap
|
||||
<IssueInfoSection
|
||||
transactionCategory={ TransactionCategory.CashReceipt }
|
||||
issueInfo={ issueInfo }
|
||||
purposeType={ purposeType }
|
||||
></IssueInfoWrap>
|
||||
></IssueInfoSection>
|
||||
<div className="txn-divider minus"></div>
|
||||
<DetailInfoWrap
|
||||
<DetailInfoSection
|
||||
transactionCategory={ TransactionCategory.CashReceipt }
|
||||
detailInfo={ detailInfo }
|
||||
isOpen={ showDetailInfo }
|
||||
onClickToOpenInfo={ (infoWrapKey) => onClickToOpenInfo(infoWrapKey) }
|
||||
></DetailInfoWrap>
|
||||
onClickToOpenInfo={ (infoSectionKey) => onClickToOpenInfo(infoSectionKey) }
|
||||
></DetailInfoSection>
|
||||
</div>
|
||||
</div>
|
||||
<div className="apply-row">
|
||||
|
||||
@@ -19,15 +19,17 @@ import {
|
||||
useSetFooterMode
|
||||
} from '@/widgets/sub-layout/use-sub-layout';
|
||||
import { CashReceiptIssueStatusBtnGroup } from '@/entities/transaction/model/contant';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
|
||||
export const CashReceiptListPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
const userMid = useStore.getState().UserStore.mid;
|
||||
|
||||
const [sortBy, setSortBy] = useState<SortByKeys>(SortByKeys.New);
|
||||
const [listItems, setListItems] = useState({});
|
||||
const [filterOn, setFilterOn] = useState<boolean>(false);
|
||||
const [pageParam, setPageParam] = useState(DEFAULT_PAGE_PARAM);
|
||||
const [mid, setMid] = useState<string>('nictest00m');
|
||||
const [mid, setMid] = useState<string>(userMid);
|
||||
const [startDate, setStartDate] = useState(moment().subtract(1, 'month').format('YYYY-MM-DD'));
|
||||
const [endDate, setEndDate] = useState(moment().format('YYYY-MM-DD'));
|
||||
const [purposeType, setPurposeType] = useState<CashReceiptPurposeType>(CashReceiptPurposeType.ALL);
|
||||
@@ -61,7 +63,7 @@ export const CashReceiptListPage = () => {
|
||||
};
|
||||
|
||||
cashReceiptList(listParams).then((rs) => {
|
||||
console.log(rs)
|
||||
console.log(rs);
|
||||
setListItems(assembleData(rs.content));
|
||||
});
|
||||
|
||||
@@ -69,13 +71,13 @@ export const CashReceiptListPage = () => {
|
||||
|
||||
const assembleData = (content: Array<CashReceiptListItem>) => {
|
||||
let data: any = {};
|
||||
if (content && content.length > 0) {
|
||||
for (let i = 0; i < content?.length; i++) {
|
||||
if(content && content.length > 0){
|
||||
for (let i=0;i<content?.length;i++){
|
||||
let groupDate = moment(content[i]?.transactionDateTime).format('YYYYMMDD');
|
||||
if (!!groupDate && !data.hasOwnProperty(groupDate)) {
|
||||
if(!!groupDate && !data.hasOwnProperty(groupDate)){
|
||||
data[groupDate] = [];
|
||||
}
|
||||
if (!!groupDate && data.hasOwnProperty(groupDate)) {
|
||||
if(!!groupDate && data.hasOwnProperty(groupDate)){
|
||||
data[groupDate].push(content[i]);
|
||||
}
|
||||
}
|
||||
@@ -96,12 +98,16 @@ export const CashReceiptListPage = () => {
|
||||
};
|
||||
const onClickToSort = (sort: SortByKeys) => {
|
||||
setSortBy(sort);
|
||||
callList({ sortBy: sort });
|
||||
callList({
|
||||
sortBy: sort
|
||||
});
|
||||
};
|
||||
|
||||
const onClickToIssueStatus = (val: CashReceiptIssueStatus) => {
|
||||
setIssueStatus(val);
|
||||
callList({ val: val });
|
||||
callList({
|
||||
val: val
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -119,14 +125,14 @@ export const CashReceiptListPage = () => {
|
||||
<input
|
||||
type="text"
|
||||
className="credit-period"
|
||||
value={moment(startDate).format('YYYY.MM.DD') + '-' + moment(endDate).format('YYYY.MM.DD')}
|
||||
readOnly={true}
|
||||
value={ moment(startDate).format('YYYY.MM.DD') + '-' + moment(endDate).format('YYYY.MM.DD') }
|
||||
readOnly={ true }
|
||||
/>
|
||||
<button className="filter-btn">
|
||||
<img
|
||||
src={IMAGE_ROOT + '/ico_setting.svg'}
|
||||
src={ IMAGE_ROOT + '/ico_setting.svg' }
|
||||
alt="검색옵션"
|
||||
onClick={() => onClickToOpenFilter()}
|
||||
onClick={ () => onClickToOpenFilter() }
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
@@ -143,19 +149,19 @@ export const CashReceiptListPage = () => {
|
||||
<span className="label">승인</span>
|
||||
<strong className="amount22">
|
||||
<NumericFormat
|
||||
value={83745200}
|
||||
value={ 83745200 }
|
||||
thousandSeparator
|
||||
displayType="text"
|
||||
suffix={'원'}
|
||||
suffix='원'
|
||||
></NumericFormat>
|
||||
</strong>
|
||||
<span className="count">
|
||||
<NumericFormat
|
||||
value={2745}
|
||||
value={ 2745 }
|
||||
thousandSeparator
|
||||
displayType="text"
|
||||
prefix={'('}
|
||||
suffix={'건)'}
|
||||
prefix='('
|
||||
suffix='건)'
|
||||
></NumericFormat>
|
||||
</span>
|
||||
</div>
|
||||
@@ -163,19 +169,19 @@ export const CashReceiptListPage = () => {
|
||||
<span className="label">취소</span>
|
||||
<strong className="amount19">
|
||||
<NumericFormat
|
||||
value={534407}
|
||||
value={ 534407 }
|
||||
thousandSeparator
|
||||
displayType="text"
|
||||
suffix={'원'}
|
||||
suffix='원'
|
||||
></NumericFormat>
|
||||
</strong>
|
||||
<span className="count">
|
||||
<NumericFormat
|
||||
value={32}
|
||||
value={ 32 }
|
||||
thousandSeparator
|
||||
displayType="text"
|
||||
prefix={'('}
|
||||
suffix={'건)'}
|
||||
prefix='('
|
||||
suffix='건)'
|
||||
></NumericFormat>
|
||||
</span>
|
||||
</div>
|
||||
@@ -184,26 +190,26 @@ export const CashReceiptListPage = () => {
|
||||
|
||||
<div className="filter-section">
|
||||
<SortOptionsBox
|
||||
sortBy={sortBy}
|
||||
sortBy={ sortBy }
|
||||
onClickToSort={ onClickToSort }
|
||||
></SortOptionsBox>
|
||||
<div>
|
||||
<div className="full-menu-keywords no-padding">
|
||||
{
|
||||
CashReceiptIssueStatusBtnGroup.map((value, index) => (
|
||||
<span
|
||||
key={`key-service-code=${index}`}
|
||||
className={`keyword-tag ${(issueStatus === value.value) ? 'active' : ''}`}
|
||||
onClick={() => onClickToIssueStatus(value.value)}
|
||||
>{value.name}</span>
|
||||
))
|
||||
}
|
||||
{
|
||||
CashReceiptIssueStatusBtnGroup.map((value, index) => (
|
||||
<span
|
||||
key={`key-service-code=${index}`}
|
||||
className={`keyword-tag ${(issueStatus === value.value) ? 'active' : ''}`}
|
||||
onClick={() => onClickToIssueStatus(value.value)}
|
||||
>{value.name}</span>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<CashReceiptList
|
||||
listItems={listItems}
|
||||
transactionCategory={TransactionCategory.CashReceipt}
|
||||
listItems={ listItems }
|
||||
transactionCategory={ TransactionCategory.CashReceipt }
|
||||
></CashReceiptList>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user