feat:법인카드 테스트 데이터 생성 버튼 추가
- 번개(Zap) 아이콘 버튼 클릭 시 임시 데이터 3건 생성 - 입력 테스트용 기능 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
const DollarSign = createIcon('dollar-sign');
|
||||
const CheckCircle = createIcon('check-circle');
|
||||
const XCircle = createIcon('x-circle');
|
||||
const Zap = createIcon('zap');
|
||||
|
||||
function CorporateCardsManagement() {
|
||||
// 카드 목록 데이터 (빈 배열로 시작 - 실제 데이터는 서버 연동 후 로드)
|
||||
@@ -76,6 +77,36 @@ function CorporateCardsManagement() {
|
||||
};
|
||||
const [formData, setFormData] = useState(initialFormState);
|
||||
|
||||
// 테스트용 임시 데이터 생성
|
||||
const generateTestData = () => {
|
||||
const companies = ['삼성카드', '현대카드', '국민카드', '신한카드', '롯데카드'];
|
||||
const names = ['업무용', '마케팅', '개발팀', '영업팀', '관리팀'];
|
||||
const users = ['김철수', '이영희', '박민수', '최지영', '정대한'];
|
||||
|
||||
const randomNum = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
const randomCard = () => `${randomNum(1000,9999)}-${randomNum(1000,9999)}-${randomNum(1000,9999)}-${randomNum(1000,9999)}`;
|
||||
const randomExpiry = () => `${randomNum(25,30)}/${String(randomNum(1,12)).padStart(2,'0')}`;
|
||||
|
||||
const newCards = Array.from({ length: 3 }, (_, i) => ({
|
||||
id: Date.now() + i,
|
||||
cardName: `${names[randomNum(0,4)]} 법인카드`,
|
||||
cardCompany: companies[randomNum(0,4)],
|
||||
cardNumber: randomCard(),
|
||||
cardType: Math.random() > 0.3 ? 'credit' : 'debit',
|
||||
paymentDay: [10, 15, 20, 25][randomNum(0,3)],
|
||||
creditLimit: randomNum(3, 20) * 1000000,
|
||||
currentUsage: randomNum(0, 10) * 100000,
|
||||
cardHolderName: '(주)테스트회사',
|
||||
actualUser: users[randomNum(0,4)],
|
||||
expiryDate: randomExpiry(),
|
||||
cvc: String(randomNum(100,999)),
|
||||
status: 'active',
|
||||
memo: '테스트 데이터'
|
||||
}));
|
||||
|
||||
setCards(prev => [...prev, ...newCards]);
|
||||
};
|
||||
|
||||
// 카드사 목록
|
||||
const cardCompanies = ['삼성카드', '현대카드', '국민카드', '신한카드', '롯데카드', 'BC카드', '하나카드', '우리카드', 'NH농협카드'];
|
||||
|
||||
@@ -225,13 +256,22 @@ function CorporateCardsManagement() {
|
||||
<p className="text-sm text-gray-500">Corporate Card Management</p>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={handleAddCard}
|
||||
className="flex items-center gap-2 px-4 py-2 bg-violet-600 hover:bg-violet-700 text-white rounded-lg transition-colors"
|
||||
>
|
||||
<Plus className="w-4 h-4" />
|
||||
<span className="text-sm font-medium">카드 등록</span>
|
||||
</button>
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
onClick={handleAddCard}
|
||||
className="flex items-center gap-2 px-4 py-2 bg-violet-600 hover:bg-violet-700 text-white rounded-lg transition-colors"
|
||||
>
|
||||
<Plus className="w-4 h-4" />
|
||||
<span className="text-sm font-medium">카드 등록</span>
|
||||
</button>
|
||||
<button
|
||||
onClick={generateTestData}
|
||||
className="flex items-center gap-1 px-3 py-2 bg-amber-500 hover:bg-amber-600 text-white rounded-lg transition-colors"
|
||||
title="테스트 데이터 생성"
|
||||
>
|
||||
<Zap className="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user