From 7ad8b00a47d538539e13ac16909153429fe592c2 Mon Sep 17 00:00:00 2001 From: pro Date: Fri, 23 Jan 2026 15:16:17 +0900 Subject: [PATCH] =?UTF-8?q?feat:=EC=B9=B4=EB=93=9C=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EB=82=B4=EC=97=AD=20=EA=B3=B5=EC=A0=9C/=EC=A6=9D=EB=B9=99/?= =?UTF-8?q?=EB=82=B4=EC=97=AD=20=ED=95=84=EB=93=9C=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 공제 필드: 공제/불공 선택 가능 (불공은 적색 표시) - 증빙/판매자상호 필드: 텍스트 입력으로 수정 가능 - 내역 필드: 텍스트 입력으로 수정 가능 - CardTransaction 모델에 deduction_type, evidence_name, description 필드 추가 - 마이그레이션 추가 - 컨트롤러에서 새 필드 저장/로드 처리 Co-Authored-By: Claude Opus 4.5 --- .../Controllers/Barobill/EcardController.php | 12 ++++- app/Models/Barobill/CardTransaction.php | 3 ++ ...ds_to_barobill_card_transactions_table.php | 34 ++++++++++++ .../views/barobill/ecard/index.blade.php | 54 +++++++++++++++---- 4 files changed, 91 insertions(+), 12 deletions(-) create mode 100644 database/migrations/2026_01_23_180000_add_editable_fields_to_barobill_card_transactions_table.php diff --git a/app/Http/Controllers/Barobill/EcardController.php b/app/Http/Controllers/Barobill/EcardController.php index 9a95e2cb..ea02227b 100644 --- a/app/Http/Controllers/Barobill/EcardController.php +++ b/app/Http/Controllers/Barobill/EcardController.php @@ -548,6 +548,10 @@ private function parseTransactionLogs($resultData, $savedData = null): array // 저장된 계정과목 정보 병합 'accountCode' => $savedItem?->account_code ?? '', 'accountName' => $savedItem?->account_name ?? '', + // 수정 가능한 필드들 (저장된 값 또는 기본값) + 'deductionType' => $savedItem?->deduction_type ?? ($log->UseStoreCorpNum ? 'deductible' : 'non_deductible'), + 'evidenceName' => $savedItem?->evidence_name ?? ($log->UseStoreName ?? ''), + 'description' => $savedItem?->description ?? ($log->UseStoreBizType ?? $log->Memo ?? ''), 'isSaved' => $savedItem !== null, ]; @@ -716,6 +720,9 @@ public function save(Request $request): JsonResponse 'use_key' => $trans['useKey'] ?? '', 'account_code' => $trans['accountCode'] ?? null, 'account_name' => $trans['accountName'] ?? null, + 'deduction_type' => $trans['deductionType'] ?? null, + 'evidence_name' => $trans['evidenceName'] ?? null, + 'description' => $trans['description'] ?? null, ]; // Upsert: 있으면 업데이트, 없으면 생성 @@ -727,10 +734,13 @@ public function save(Request $request): JsonResponse ->first(); if ($existing) { - // 계정과목만 업데이트 + // 계정과목 및 수정 가능한 필드들 업데이트 $existing->update([ 'account_code' => $data['account_code'], 'account_name' => $data['account_name'], + 'deduction_type' => $data['deduction_type'], + 'evidence_name' => $data['evidence_name'], + 'description' => $data['description'], ]); $updated++; } else { diff --git a/app/Models/Barobill/CardTransaction.php b/app/Models/Barobill/CardTransaction.php index bd4da981..369b45c5 100644 --- a/app/Models/Barobill/CardTransaction.php +++ b/app/Models/Barobill/CardTransaction.php @@ -38,6 +38,9 @@ class CardTransaction extends Model 'use_key', 'account_code', 'account_name', + 'deduction_type', + 'evidence_name', + 'description', ]; protected $casts = [ diff --git a/database/migrations/2026_01_23_180000_add_editable_fields_to_barobill_card_transactions_table.php b/database/migrations/2026_01_23_180000_add_editable_fields_to_barobill_card_transactions_table.php new file mode 100644 index 00000000..52623721 --- /dev/null +++ b/database/migrations/2026_01_23_180000_add_editable_fields_to_barobill_card_transactions_table.php @@ -0,0 +1,34 @@ +string('deduction_type', 20)->nullable()->after('account_name')->comment('공제유형: deductible/non_deductible'); + // 증빙/판매자상호 (사용자 수정용) + $table->string('evidence_name', 255)->nullable()->after('deduction_type')->comment('증빙/판매자상호 (수정용)'); + // 내역 (사용자 수정용) + $table->string('description', 500)->nullable()->after('evidence_name')->comment('내역 (수정용)'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('barobill_card_transactions', function (Blueprint $table) { + $table->dropColumn(['deduction_type', 'evidence_name', 'description']); + }); + } +}; diff --git a/resources/views/barobill/ecard/index.blade.php b/resources/views/barobill/ecard/index.blade.php index e706a641..9e4a8725 100644 --- a/resources/views/barobill/ecard/index.blade.php +++ b/resources/views/barobill/ecard/index.blade.php @@ -471,6 +471,7 @@ className="flex-1 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 t totalCount, accountCodes, onAccountCodeChange, + onFieldChange, onSave, onExport, saving, @@ -644,22 +645,39 @@ className="p-1.5 text-purple-500 hover:bg-purple-100 rounded-lg transition-color - - {log.merchantBizNum ? '공제' : '불공제'} - + -
{log.merchantName || '-'}
+ onFieldChange(index, 'evidenceName', e.target.value)} + className="w-full px-2 py-1 text-sm border border-stone-200 rounded focus:outline-none focus:ring-1 focus:ring-purple-500 focus:border-purple-500" + placeholder="판매자상호" + /> {log.merchantBizNum && ( -
{log.merchantBizNum}
+
{log.merchantBizNum}
)} - - {log.merchantBizType || log.memo || '-'} + + onFieldChange(index, 'description', e.target.value)} + className="w-full px-2 py-1 text-sm border border-stone-200 rounded focus:outline-none focus:ring-1 focus:ring-purple-500 focus:border-purple-500" + placeholder="내역" + /> @@ -935,6 +953,19 @@ className="text-xs text-amber-600 hover:text-amber-700 underline" setHasChanges(true); }, []); + // 필드 변경 핸들러 (공제, 증빙/판매자상호, 내역) + const handleFieldChange = useCallback((index, field, value) => { + setLogs(prevLogs => { + const newLogs = [...prevLogs]; + newLogs[index] = { + ...newLogs[index], + [field]: value + }; + return newLogs; + }); + setHasChanges(true); + }, []); + // 저장 핸들러 const handleSave = async () => { if (logs.length === 0) return; @@ -1095,6 +1126,7 @@ className="text-xs text-amber-600 hover:text-amber-700 underline" totalCount={summary.count || logs.length} accountCodes={accountCodes} onAccountCodeChange={handleAccountCodeChange} + onFieldChange={handleFieldChange} onSave={handleSave} onExport={handleExport} saving={saving}