feat: [approval] 지출결의서 법인카드/송금 계좌 선택 기능

- 법인카드 선택 시 카드 목록 패널 슬라이드-다운 표시
- 송금 선택 시 출금 계좌 목록 표시, 대표계좌 자동 선택
- 선택된 카드/계좌 정보를 content JSON에 스냅샷 저장
- 상세 페이지에서 선택된 카드/계좌 정보 읽기전용 표시
This commit is contained in:
김보곤
2026-03-04 20:29:25 +09:00
parent 087ad1c7b9
commit e006f25427
5 changed files with 176 additions and 5 deletions

View File

@@ -2,6 +2,8 @@
namespace App\Http\Controllers;
use App\Models\Finance\BankAccount;
use App\Models\Finance\CorporateCard;
use App\Services\ApprovalService;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@@ -36,8 +38,9 @@ public function create(Request $request): View|Response
$forms = $this->service->getApprovalForms();
$lines = $this->service->getApprovalLines();
[$cards, $accounts] = $this->getCardAndAccountData();
return view('approvals.create', compact('forms', 'lines'));
return view('approvals.create', compact('forms', 'lines', 'cards', 'accounts'));
}
/**
@@ -57,8 +60,9 @@ public function edit(Request $request, int $id): View|Response
$forms = $this->service->getApprovalForms();
$lines = $this->service->getApprovalLines();
[$cards, $accounts] = $this->getCardAndAccountData();
return view('approvals.edit', compact('approval', 'forms', 'lines'));
return view('approvals.edit', compact('approval', 'forms', 'lines', 'cards', 'accounts'));
}
/**
@@ -110,4 +114,22 @@ public function completed(Request $request): View|Response
return view('approvals.completed');
}
private function getCardAndAccountData(): array
{
$tenantId = session('selected_tenant_id');
$cards = CorporateCard::forTenant($tenantId)
->active()
->select('id', 'card_name', 'card_company', 'card_number', 'card_holder_name')
->get();
$accounts = BankAccount::where('tenant_id', $tenantId)
->active()
->ordered()
->select('id', 'bank_name', 'account_number', 'account_holder', 'is_primary')
->get();
return [$cards, $accounts];
}
}