Revert "refactor:일반전표 상태(status) 열 제거, 기본상태를 confirmed로 변경"

This reverts commit 6ecbcfd428.
This commit is contained in:
김보곤
2026-02-10 19:02:26 +09:00
parent 6ecbcfd428
commit 93fe51ea9b
2 changed files with 40 additions and 10 deletions

View File

@@ -77,6 +77,8 @@ public function index(Request $request): JsonResponse
'totalCount' => $entries->count(),
'totalDebit' => $entries->sum('total_debit'),
'totalCredit' => $entries->sum('total_credit'),
'draftCount' => $entries->where('status', 'draft')->count(),
'confirmedCount' => $entries->where('status', 'confirmed')->count(),
];
return response()->json([
@@ -172,7 +174,7 @@ public function store(Request $request): JsonResponse
'description' => $request->description,
'total_debit' => $totalDebit,
'total_credit' => $totalCredit,
'status' => 'confirmed',
'status' => 'draft',
'created_by_name' => auth()->user()?->name ?? '시스템',
'attachment_note' => $request->attachment_note,
]);
@@ -485,7 +487,7 @@ public function storeFromBank(Request $request): JsonResponse
'description' => $request->description,
'total_debit' => $totalDebit,
'total_credit' => $totalCredit,
'status' => 'confirmed',
'status' => 'draft',
'source_type' => 'bank_transaction',
'source_key' => $request->source_key,
'created_by_name' => auth()->user()?->name ?? '시스템',

View File

@@ -1360,6 +1360,7 @@ className={`px-6 py-2 text-sm font-medium rounded-lg flex items-center gap-1 tra
const [loading, setLoading] = useState(false);
const [stats, setStats] = useState({});
const [searchTerm, setSearchTerm] = useState('');
const [filterStatus, setFilterStatus] = useState('all');
const [dateRange, setDateRange] = useState({
start: getKoreanDate(-30),
end: getKoreanDate(),
@@ -1374,6 +1375,7 @@ className={`px-6 py-2 text-sm font-medium rounded-lg flex items-center gap-1 tra
const params = new URLSearchParams({
start_date: dateRange.start,
end_date: dateRange.end,
status: filterStatus,
search: searchTerm,
});
const res = await fetch(`/finance/journal-entries/list?${params}`);
@@ -1420,9 +1422,14 @@ className={`px-6 py-2 text-sm font-medium rounded-lg flex items-center gap-1 tra
<ArrowLeft className="w-4 h-4" /> 목록으로
</button>
</div>
<div className="grid grid-cols-2 md:grid-cols-3 gap-4 text-sm">
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 text-sm">
<div><span className="text-stone-500">전표번호: </span><span className="font-mono font-medium text-emerald-600">{selectedEntry.entry_no}</span></div>
<div><span className="text-stone-500">전표일자: </span><span className="font-medium">{selectedEntry.entry_date}</span></div>
<div><span className="text-stone-500">상태: </span>
<span className={`px-2 py-0.5 rounded-full text-xs font-medium ${selectedEntry.status === 'confirmed' ? 'bg-emerald-100 text-emerald-700' : 'bg-amber-100 text-amber-700'}`}>
{selectedEntry.status === 'confirmed' ? '확정' : '임시저장'}
</span>
</div>
<div><span className="text-stone-500">작성자: </span><span className="font-medium">{selectedEntry.created_by_name || '-'}</span></div>
</div>
{selectedEntry.description && <p className="mt-2 text-sm text-stone-600">적요: {selectedEntry.description}</p>}
@@ -1482,7 +1489,7 @@ className="px-4 py-2 text-sm text-red-600 bg-red-50 rounded-lg hover:bg-red-100
return (
<div>
{/* 통계 카드 */}
<div className="grid grid-cols-3 gap-4 mb-6">
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
<div className="bg-white rounded-xl shadow-sm border border-stone-100 p-4">
<div className="flex items-center gap-3">
<div className="p-2 bg-emerald-50 rounded-lg"><FileText className="w-5 h-5 text-emerald-600" /></div>
@@ -1494,19 +1501,28 @@ className="px-4 py-2 text-sm text-red-600 bg-red-50 rounded-lg hover:bg-red-100
</div>
<div className="bg-white rounded-xl shadow-sm border border-stone-100 p-4">
<div className="flex items-center gap-3">
<div className="p-2 bg-blue-50 rounded-lg"><Save className="w-5 h-5 text-blue-600" /></div>
<div className="p-2 bg-blue-50 rounded-lg"><Edit className="w-5 h-5 text-blue-600" /></div>
<div>
<p className="text-xs text-stone-500">차변 합계</p>
<p className="text-lg font-bold text-stone-800">{formatCurrency(stats.totalDebit)}</p>
<p className="text-xs text-stone-500">임시저장</p>
<p className="text-lg font-bold text-stone-800">{stats.draftCount || 0}</p>
</div>
</div>
</div>
<div className="bg-white rounded-xl shadow-sm border border-stone-100 p-4">
<div className="flex items-center gap-3">
<div className="p-2 bg-red-50 rounded-lg"><Save className="w-5 h-5 text-red-600" /></div>
<div className="p-2 bg-emerald-50 rounded-lg"><CheckCircle className="w-5 h-5 text-emerald-600" /></div>
<div>
<p className="text-xs text-stone-500">대변 합계</p>
<p className="text-lg font-bold text-stone-800">{formatCurrency(stats.totalCredit)}</p>
<p className="text-xs text-stone-500">확정</p>
<p className="text-lg font-bold text-stone-800">{stats.confirmedCount || 0}</p>
</div>
</div>
</div>
<div className="bg-white rounded-xl shadow-sm border border-stone-100 p-4">
<div className="flex items-center gap-3">
<div className="p-2 bg-amber-50 rounded-lg"><Save className="w-5 h-5 text-amber-600" /></div>
<div>
<p className="text-xs text-stone-500">차변 합계</p>
<p className="text-lg font-bold text-stone-800">{formatCurrency(stats.totalDebit)}</p>
</div>
</div>
</div>
@@ -1522,6 +1538,12 @@ className="px-3 py-1.5 text-sm border border-stone-200 rounded-lg focus:ring-2 f
<input type="date" value={dateRange.end} onChange={(e) => setDateRange(prev => ({ ...prev, end: e.target.value }))}
className="px-3 py-1.5 text-sm border border-stone-200 rounded-lg focus:ring-2 focus:ring-emerald-500 outline-none" />
</div>
<select value={filterStatus} onChange={(e) => setFilterStatus(e.target.value)}
className="px-3 py-1.5 text-sm border border-stone-200 rounded-lg focus:ring-2 focus:ring-emerald-500 outline-none">
<option value="all">전체 상태</option>
<option value="draft">임시저장</option>
<option value="confirmed">확정</option>
</select>
<div className="relative flex-1 min-w-[200px]">
<Search className="w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-stone-400" />
<input type="text" value={searchTerm} onChange={(e) => setSearchTerm(e.target.value)}
@@ -1555,6 +1577,7 @@ className="w-full pl-9 pr-3 py-1.5 text-sm border border-stone-200 rounded-lg fo
<th className="px-4 py-3 text-left font-medium text-stone-600">적요</th>
<th className="px-4 py-3 text-right font-medium text-stone-600">차변합계</th>
<th className="px-4 py-3 text-right font-medium text-stone-600">대변합계</th>
<th className="px-4 py-3 text-center font-medium text-stone-600">상태</th>
</tr>
</thead>
<tbody>
@@ -1565,6 +1588,11 @@ className="w-full pl-9 pr-3 py-1.5 text-sm border border-stone-200 rounded-lg fo
<td className="px-4 py-3 text-stone-800 max-w-[300px] truncate">{entry.description || '-'}</td>
<td className="px-4 py-3 text-right font-medium text-blue-600">{formatCurrency(entry.total_debit)}</td>
<td className="px-4 py-3 text-right font-medium text-red-600">{formatCurrency(entry.total_credit)}</td>
<td className="px-4 py-3 text-center">
<span className={`px-2 py-0.5 rounded-full text-xs font-medium ${entry.status === 'confirmed' ? 'bg-emerald-100 text-emerald-700' : 'bg-amber-100 text-amber-700'}`}>
{entry.status === 'confirmed' ? '확정' : '임시저장'}
</span>
</td>
</tr>
))}
</tbody>