refactor: [receivables] 수동관리 탭 제거
- ManualTab 컴포넌트 및 관련 유틸 함수 삭제 - 미사용 아이콘 선언 정리 - 외상매출금 원장 / 거래처별 요약 2탭 구조로 변경
This commit is contained in:
@@ -35,56 +35,16 @@
|
||||
};
|
||||
|
||||
const Receipt = createIcon('receipt');
|
||||
const Plus = createIcon('plus');
|
||||
const Search = createIcon('search');
|
||||
const Download = createIcon('download');
|
||||
const X = createIcon('x');
|
||||
const Edit = createIcon('edit');
|
||||
const Trash2 = createIcon('trash-2');
|
||||
const Banknote = createIcon('banknote');
|
||||
const AlertTriangle = createIcon('alert-triangle');
|
||||
const CheckCircle = createIcon('check-circle');
|
||||
const Clock = createIcon('clock');
|
||||
const RefreshCw = createIcon('refresh-cw');
|
||||
const BookOpen = createIcon('book-open');
|
||||
const Building = createIcon('building-2');
|
||||
const FileText = createIcon('file-text');
|
||||
const Filter = createIcon('filter');
|
||||
const ArrowUpDown = createIcon('arrow-up-down');
|
||||
const TrendingUp = createIcon('trending-up');
|
||||
const TrendingDown = createIcon('trending-down');
|
||||
|
||||
// ==================== 포맷 유틸 ====================
|
||||
const formatCurrency = (num) => num ? Number(num).toLocaleString() : '0';
|
||||
const formatInputCurrency = (value) => {
|
||||
if (!value && value !== 0) return '';
|
||||
const num = String(value).replace(/[^\d]/g, '');
|
||||
return num ? Number(num).toLocaleString() : '';
|
||||
};
|
||||
const parseInputCurrency = (value) => String(value).replace(/[^\d]/g, '');
|
||||
|
||||
const calculateOverdueDays = (dueDate) => {
|
||||
if (!dueDate) return 0;
|
||||
const today = new Date();
|
||||
const due = new Date(dueDate);
|
||||
const diff = Math.floor((today - due) / (1000 * 60 * 60 * 24));
|
||||
return diff > 0 ? diff : 0;
|
||||
};
|
||||
|
||||
const getStatusLabel = (status) => {
|
||||
const labels = { 'outstanding': '미수', 'partial': '부분수금', 'collected': '수금완료', 'overdue': '연체' };
|
||||
return labels[status] || status;
|
||||
};
|
||||
|
||||
const getStatusStyle = (status) => {
|
||||
const styles = {
|
||||
'outstanding': 'bg-amber-100 text-amber-700',
|
||||
'partial': 'bg-blue-100 text-blue-700',
|
||||
'collected': 'bg-emerald-100 text-emerald-700',
|
||||
'overdue': 'bg-red-100 text-red-700'
|
||||
};
|
||||
return styles[status] || 'bg-gray-100 text-gray-700';
|
||||
};
|
||||
|
||||
// ==================== 로딩 스피너 ====================
|
||||
function LoadingSpinner() {
|
||||
@@ -411,315 +371,6 @@ className="hover:bg-blue-50 cursor-pointer">
|
||||
);
|
||||
}
|
||||
|
||||
// ==================== 탭 3: 수동관리 (기존 기능) ====================
|
||||
function ManualTab() {
|
||||
const [receivables, setReceivables] = useState([]);
|
||||
const [stats, setStats] = useState({ totalAmount: 0, totalCollected: 0, totalOutstanding: 0, overdueAmount: 0, count: 0 });
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
const [filterStatus, setFilterStatus] = useState('all');
|
||||
const [filterCategory, setFilterCategory] = useState('all');
|
||||
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
const [modalMode, setModalMode] = useState('add');
|
||||
const [editingItem, setEditingItem] = useState(null);
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
const [showCollectModal, setShowCollectModal] = useState(false);
|
||||
const [collectingItem, setCollectingItem] = useState(null);
|
||||
const [collectAmount, setCollectAmount] = useState('');
|
||||
const [collectDate, setCollectDate] = useState('');
|
||||
|
||||
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
|
||||
|
||||
const categories = ['서비스', '상품', '컨설팅', '기타'];
|
||||
|
||||
const initialFormState = {
|
||||
customerName: '',
|
||||
invoiceNo: '',
|
||||
issueDate: new Date().toISOString().split('T')[0],
|
||||
dueDate: '',
|
||||
amount: '',
|
||||
collectedAmount: 0,
|
||||
status: 'outstanding',
|
||||
category: '서비스',
|
||||
description: ''
|
||||
};
|
||||
const [formData, setFormData] = useState(initialFormState);
|
||||
|
||||
const fetchReceivables = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await fetch('/finance/receivables/list');
|
||||
const data = await res.json();
|
||||
if (data.success) {
|
||||
setReceivables(data.data);
|
||||
setStats(data.stats);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('미수금 조회 실패:', err);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => { fetchReceivables(); }, []);
|
||||
|
||||
const filteredReceivables = receivables.filter(item => {
|
||||
const matchesSearch = (item.customerName || '').toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
(item.invoiceNo || '').toLowerCase().includes(searchTerm.toLowerCase());
|
||||
const matchesStatus = filterStatus === 'all' || item.status === filterStatus;
|
||||
const matchesCategory = filterCategory === 'all' || item.category === filterCategory;
|
||||
return matchesSearch && matchesStatus && matchesCategory;
|
||||
});
|
||||
|
||||
const handleAdd = () => { setModalMode('add'); setFormData(initialFormState); setShowModal(true); };
|
||||
const handleEdit = (item) => {
|
||||
setModalMode('edit');
|
||||
setEditingItem(item);
|
||||
const safeItem = {};
|
||||
Object.keys(initialFormState).forEach(key => { safeItem[key] = item[key] ?? ''; });
|
||||
setFormData(safeItem);
|
||||
setShowModal(true);
|
||||
};
|
||||
const handleSave = async () => {
|
||||
if (!formData.customerName || !formData.invoiceNo || !formData.amount) { alert('필수 항목을 입력해주세요.'); return; }
|
||||
setSaving(true);
|
||||
try {
|
||||
const url = modalMode === 'add' ? '/finance/receivables/store' : `/finance/receivables/${editingItem.id}`;
|
||||
const body = { ...formData, amount: parseInt(formData.amount) || 0 };
|
||||
const res = await fetch(url, {
|
||||
method: modalMode === 'add' ? 'POST' : 'PUT',
|
||||
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken },
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) {
|
||||
const errors = data.errors ? Object.values(data.errors).flat().join('\n') : data.message;
|
||||
alert(errors || '저장에 실패했습니다.');
|
||||
return;
|
||||
}
|
||||
setShowModal(false);
|
||||
setEditingItem(null);
|
||||
fetchReceivables();
|
||||
} catch (err) {
|
||||
console.error('저장 실패:', err);
|
||||
alert('저장에 실패했습니다.');
|
||||
} finally {
|
||||
setSaving(false);
|
||||
}
|
||||
};
|
||||
const handleDelete = async (id) => {
|
||||
if (!confirm('정말 삭제하시겠습니까?')) return;
|
||||
try {
|
||||
const res = await fetch(`/finance/receivables/${id}`, {
|
||||
method: 'DELETE',
|
||||
headers: { 'X-CSRF-TOKEN': csrfToken },
|
||||
});
|
||||
if (res.ok) {
|
||||
setShowModal(false);
|
||||
fetchReceivables();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('삭제 실패:', err);
|
||||
alert('삭제에 실패했습니다.');
|
||||
}
|
||||
};
|
||||
|
||||
const handleCollect = (item) => {
|
||||
setCollectingItem(item);
|
||||
setCollectAmount('');
|
||||
setCollectDate(new Date().toISOString().split('T')[0]);
|
||||
setShowCollectModal(true);
|
||||
};
|
||||
|
||||
const processCollection = async () => {
|
||||
const amount = parseInt(parseInputCurrency(collectAmount)) || 0;
|
||||
if (amount <= 0) { alert('수금액을 입력해주세요.'); return; }
|
||||
const remaining = collectingItem.amount - collectingItem.collectedAmount;
|
||||
if (amount > remaining) { alert('수금액이 잔액을 초과합니다.'); return; }
|
||||
|
||||
try {
|
||||
const res = await fetch(`/finance/receivables/${collectingItem.id}/collect`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken },
|
||||
body: JSON.stringify({ collectAmount: amount }),
|
||||
});
|
||||
const data = await res.json();
|
||||
if (!res.ok) {
|
||||
alert(data.message || '수금 처리에 실패했습니다.');
|
||||
return;
|
||||
}
|
||||
setShowCollectModal(false);
|
||||
setCollectingItem(null);
|
||||
fetchReceivables();
|
||||
} catch (err) {
|
||||
console.error('수금 처리 실패:', err);
|
||||
alert('수금 처리에 실패했습니다.');
|
||||
}
|
||||
};
|
||||
|
||||
const handleDownload = () => {
|
||||
const rows = [['미수금 관리'], [], ['고객사', '청구서번호', '발행일', '만기일', '분류', '청구금액', '수금액', '잔액', '상태'],
|
||||
...filteredReceivables.map(item => [item.customerName, item.invoiceNo, item.issueDate, item.dueDate, item.category, item.amount, item.collectedAmount, item.amount - item.collectedAmount, getStatusLabel(item.status)])];
|
||||
const csvContent = rows.map(row => row.join(',')).join('\n');
|
||||
const blob = new Blob(['\uFEFF' + csvContent], { type: 'text/csv;charset=utf-8;' });
|
||||
const link = document.createElement('a'); link.href = URL.createObjectURL(blob); link.download = `미수금관리_${new Date().toISOString().split('T')[0]}.csv`; link.click();
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* 대시보드 카드 */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-4 gap-4 mb-6">
|
||||
<div className="bg-white rounded-xl border border-gray-200 p-5">
|
||||
<div className="flex items-center justify-between mb-2"><span className="text-sm text-gray-500">총 채권액</span><Receipt className="w-5 h-5 text-gray-400" /></div>
|
||||
<p className="text-xl font-bold text-gray-900">{formatCurrency(stats.totalAmount)}원</p>
|
||||
<p className="text-xs text-gray-400 mt-1">{stats.count}건</p>
|
||||
</div>
|
||||
<div className="bg-white rounded-xl border border-amber-200 p-5 bg-amber-50/30">
|
||||
<div className="flex items-center justify-between mb-2"><span className="text-sm text-amber-700">미수잔액</span><Clock className="w-5 h-5 text-amber-500" /></div>
|
||||
<p className="text-xl font-bold text-amber-600">{formatCurrency(stats.totalOutstanding)}원</p>
|
||||
</div>
|
||||
<div className="bg-white rounded-xl border border-red-200 p-5 bg-red-50/30">
|
||||
<div className="flex items-center justify-between mb-2"><span className="text-sm text-red-700">연체금액</span><AlertTriangle className="w-5 h-5 text-red-500" /></div>
|
||||
<p className="text-xl font-bold text-red-600">{formatCurrency(stats.overdueAmount)}원</p>
|
||||
</div>
|
||||
<div className="bg-white rounded-xl border border-emerald-200 p-5 bg-emerald-50/30">
|
||||
<div className="flex items-center justify-between mb-2"><span className="text-sm text-emerald-700">수금완료</span><CheckCircle className="w-5 h-5 text-emerald-500" /></div>
|
||||
<p className="text-xl font-bold text-emerald-600">{formatCurrency(stats.totalCollected)}원</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 필터 + 버튼 */}
|
||||
<div className="bg-white rounded-xl border border-gray-200 p-4 mb-6">
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
<div style={{flex: '1 1 250px', maxWidth: '400px'}} className="relative">
|
||||
<Search className="w-5 h-5 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2" />
|
||||
<input type="text" placeholder="고객사, 청구서번호 검색..." value={searchTerm} onChange={(e) => setSearchTerm(e.target.value)} className="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500" />
|
||||
</div>
|
||||
<select value={filterCategory} onChange={(e) => setFilterCategory(e.target.value)} className="px-3 py-2 border border-gray-300 rounded-lg" style={{flex: '0 0 auto'}}>
|
||||
<option value="all">전체 분류</option>
|
||||
{categories.map(cat => <option key={cat} value={cat}>{cat}</option>)}
|
||||
</select>
|
||||
<div className="flex gap-1" style={{flex: '0 0 auto'}}>
|
||||
{['all', 'outstanding', 'partial', 'overdue', 'collected'].map(status => (
|
||||
<button key={status} onClick={() => setFilterStatus(status)} className={`px-2 py-2 rounded-lg text-xs font-medium ${filterStatus === status ? (status === 'collected' ? 'bg-green-600 text-white' : status === 'overdue' ? 'bg-red-600 text-white' : status === 'partial' ? 'bg-blue-600 text-white' : status === 'outstanding' ? 'bg-yellow-500 text-white' : 'bg-gray-800 text-white') : 'bg-gray-100 text-gray-700'}`}>
|
||||
{status === 'all' ? '전체' : getStatusLabel(status)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<button onClick={() => { setSearchTerm(''); setFilterStatus('all'); setFilterCategory('all'); }} className="flex items-center gap-2 px-3 py-2 text-gray-600 hover:bg-gray-100 rounded-lg" style={{flex: '0 0 auto'}}>
|
||||
<RefreshCw className="w-4 h-4" /><span className="text-sm">초기화</span>
|
||||
</button>
|
||||
<div className="flex gap-2 ml-auto" style={{flex: '0 0 auto'}}>
|
||||
<button onClick={handleDownload} className="flex items-center gap-2 px-4 py-2 text-gray-700 hover:bg-gray-100 border border-gray-300 rounded-lg text-sm"><Download className="w-4 h-4" /><span>Excel</span></button>
|
||||
<button onClick={handleAdd} className="flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg text-sm"><Plus className="w-4 h-4" /><span className="font-medium">미수금 등록</span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 테이블 */}
|
||||
<div className="bg-white rounded-xl border border-gray-200 overflow-hidden">
|
||||
<table className="w-full">
|
||||
<thead className="bg-gray-50 border-b border-gray-200">
|
||||
<tr>
|
||||
<th className="px-6 py-3 text-left text-xs font-semibold text-gray-600">고객사</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-semibold text-gray-600">청구서번호</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-semibold text-gray-600">만기일</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-semibold text-gray-600">분류</th>
|
||||
<th className="px-6 py-3 text-right text-xs font-semibold text-gray-600">청구금액</th>
|
||||
<th className="px-6 py-3 text-right text-xs font-semibold text-gray-600">잔액</th>
|
||||
<th className="px-6 py-3 text-center text-xs font-semibold text-gray-600">상태</th>
|
||||
<th className="px-6 py-3 text-center text-xs font-semibold text-gray-600">연체일</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-gray-100">
|
||||
{loading ? <LoadingSpinner /> : filteredReceivables.length === 0 ? (
|
||||
<tr><td colSpan="8" className="px-6 py-12 text-center text-gray-400">데이터가 없습니다.</td></tr>
|
||||
) : filteredReceivables.map(item => (
|
||||
<tr key={item.id} onClick={() => handleEdit(item)} className={`hover:bg-gray-50 cursor-pointer ${item.status === 'overdue' ? 'bg-red-50/50' : ''}`}>
|
||||
<td className="px-6 py-4"><p className="text-sm font-medium text-gray-900">{item.customerName}</p><p className="text-xs text-gray-400">{item.description}</p></td>
|
||||
<td className="px-6 py-4 text-sm text-gray-600">{item.invoiceNo}</td>
|
||||
<td className="px-6 py-4 text-sm text-gray-600">{item.dueDate}</td>
|
||||
<td className="px-6 py-4"><span className="px-2 py-1 rounded text-xs font-medium bg-gray-100 text-gray-700">{item.category}</span></td>
|
||||
<td className="px-6 py-4 text-sm font-medium text-right text-gray-900">{formatCurrency(item.amount)}원</td>
|
||||
<td className="px-6 py-4 text-sm font-bold text-right text-blue-600">{formatCurrency(item.amount - item.collectedAmount)}원</td>
|
||||
<td className="px-6 py-4 text-center"><span className={`px-2 py-1 rounded-full text-xs font-medium ${getStatusStyle(item.status)}`}>{getStatusLabel(item.status)}</span></td>
|
||||
<td className="px-6 py-4 text-center text-sm">{item.status === 'overdue' ? <span className="text-red-600 font-medium">{calculateOverdueDays(item.dueDate)}일</span> : '-'}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{/* 추가/수정 모달 */}
|
||||
{showModal && (
|
||||
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50">
|
||||
<div className="bg-white rounded-xl p-6 w-full max-w-lg mx-4 max-h-[90vh] overflow-y-auto">
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<h3 className="text-lg font-bold text-gray-900">{modalMode === 'add' ? '미수금 등록' : '미수금 수정'}</h3>
|
||||
<button onClick={() => setShowModal(false)} className="p-1 hover:bg-gray-100 rounded-lg"><X className="w-5 h-5 text-gray-500" /></button>
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div><label className="block text-sm font-medium text-gray-700 mb-1">고객사 *</label><input type="text" value={formData.customerName} onChange={(e) => setFormData(prev => ({ ...prev, customerName: e.target.value }))} placeholder="고객사명" className="w-full px-3 py-2 border border-gray-300 rounded-lg" /></div>
|
||||
<div><label className="block text-sm font-medium text-gray-700 mb-1">청구서번호 *</label><input type="text" value={formData.invoiceNo} onChange={(e) => setFormData(prev => ({ ...prev, invoiceNo: e.target.value }))} placeholder="INV-2026-001" className="w-full px-3 py-2 border border-gray-300 rounded-lg" /></div>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div><label className="block text-sm font-medium text-gray-700 mb-1">발행일</label><input type="date" value={formData.issueDate} onChange={(e) => setFormData(prev => ({ ...prev, issueDate: e.target.value }))} className="w-full px-3 py-2 border border-gray-300 rounded-lg" /></div>
|
||||
<div><label className="block text-sm font-medium text-gray-700 mb-1">만기일</label><input type="date" value={formData.dueDate} onChange={(e) => setFormData(prev => ({ ...prev, dueDate: e.target.value }))} className="w-full px-3 py-2 border border-gray-300 rounded-lg" /></div>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div><label className="block text-sm font-medium text-gray-700 mb-1">분류</label><select value={formData.category} onChange={(e) => setFormData(prev => ({ ...prev, category: e.target.value }))} className="w-full px-3 py-2 border border-gray-300 rounded-lg">{categories.map(cat => <option key={cat} value={cat}>{cat}</option>)}</select></div>
|
||||
<div><label className="block text-sm font-medium text-gray-700 mb-1">청구금액 *</label><input type="text" value={formatInputCurrency(formData.amount)} onChange={(e) => setFormData(prev => ({ ...prev, amount: parseInputCurrency(e.target.value) }))} placeholder="0" className="w-full px-3 py-2 border border-gray-300 rounded-lg text-right" /></div>
|
||||
</div>
|
||||
<div><label className="block text-sm font-medium text-gray-700 mb-1">적요</label><input type="text" value={formData.description} onChange={(e) => setFormData(prev => ({ ...prev, description: e.target.value }))} placeholder="적요 입력" className="w-full px-3 py-2 border border-gray-300 rounded-lg" /></div>
|
||||
{modalMode === 'edit' && (
|
||||
<div><label className="block text-sm font-medium text-gray-700 mb-1">상태</label><select value={formData.status} onChange={(e) => setFormData(prev => ({ ...prev, status: e.target.value }))} className="w-full px-3 py-2 border border-gray-300 rounded-lg"><option value="outstanding">미수</option><option value="partial">부분수금</option><option value="collected">수금완료</option><option value="overdue">연체</option></select></div>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex gap-3 mt-6">
|
||||
{modalMode === 'edit' && <button onClick={() => handleDelete(editingItem.id)} className="px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg">삭제</button>}
|
||||
<button onClick={() => setShowModal(false)} className="flex-1 px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50">취소</button>
|
||||
<button onClick={handleSave} disabled={saving} className="flex-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg disabled:opacity-50">{saving ? '저장 중...' : (modalMode === 'add' ? '등록' : '저장')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 수금 처리 모달 */}
|
||||
{showCollectModal && collectingItem && (
|
||||
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50">
|
||||
<div className="bg-white rounded-xl p-6 w-full max-w-md mx-4">
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<h3 className="text-lg font-bold text-gray-900">수금 처리</h3>
|
||||
<button onClick={() => setShowCollectModal(false)} className="p-1 hover:bg-gray-100 rounded-lg"><X className="w-5 h-5 text-gray-500" /></button>
|
||||
</div>
|
||||
<div className="bg-gray-50 rounded-lg p-4 mb-4">
|
||||
<p className="font-medium text-gray-900">{collectingItem.customerName}</p>
|
||||
<p className="text-sm text-gray-500">{collectingItem.invoiceNo}</p>
|
||||
<div className="mt-3 space-y-1 text-sm">
|
||||
<div className="flex justify-between"><span className="text-gray-500">청구금액</span><span>{formatCurrency(collectingItem.amount)}원</span></div>
|
||||
<div className="flex justify-between"><span className="text-gray-500">기수금액</span><span>{formatCurrency(collectingItem.collectedAmount)}원</span></div>
|
||||
<div className="flex justify-between font-bold"><span className="text-blue-600">잔액</span><span className="text-blue-600">{formatCurrency(collectingItem.amount - collectingItem.collectedAmount)}원</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-4">
|
||||
<div><label className="block text-sm font-medium text-gray-700 mb-1">수금일</label><input type="date" value={collectDate} onChange={(e) => setCollectDate(e.target.value)} className="w-full px-3 py-2 border border-gray-300 rounded-lg" /></div>
|
||||
<div><label className="block text-sm font-medium text-gray-700 mb-1">수금액 *</label><input type="text" value={formatInputCurrency(collectAmount)} onChange={(e) => setCollectAmount(parseInputCurrency(e.target.value))} placeholder="0" className="w-full px-3 py-2 border border-gray-300 rounded-lg text-right" /></div>
|
||||
</div>
|
||||
<div className="flex gap-3 mt-6">
|
||||
<button onClick={() => setShowCollectModal(false)} className="flex-1 px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50">취소</button>
|
||||
<button onClick={processCollection} className="flex-1 px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-white rounded-lg">수금 처리</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// ==================== 메인 컴포넌트 ====================
|
||||
function ReceivablesManagement() {
|
||||
const [activeTab, setActiveTab] = useState('ledger');
|
||||
@@ -733,7 +384,6 @@ function ReceivablesManagement() {
|
||||
const tabs = [
|
||||
{ id: 'ledger', label: '외상매출금 원장', icon: BookOpen },
|
||||
{ id: 'summary', label: '거래처별 요약', icon: Building },
|
||||
{ id: 'manual', label: '수동관리', icon: FileText },
|
||||
];
|
||||
|
||||
return (
|
||||
@@ -772,7 +422,6 @@ className={`flex items-center gap-2 px-4 py-3 text-sm font-medium border-b-2 tra
|
||||
{/* 탭 콘텐츠 */}
|
||||
{activeTab === 'ledger' && <LedgerTab key={ledgerPartnerFilter} initialPartner={ledgerPartnerFilter} />}
|
||||
{activeTab === 'summary' && <SummaryTab onSelectPartner={handleSelectPartner} />}
|
||||
{activeTab === 'manual' && <ManualTab />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user