@php $products = $products ?? collect(); $orders = $orders ?? collect(); $tenantAiCredit = $tenantAiCredit ?? []; $pendingOrder = $pendingOrder ?? null; $paymentInfo = $paymentInfo ?? null; $monthlyLimit = (int) ($tenantAiCredit['monthly_credit_limit'] ?? 0); $monthlyUsed = (int) ($tenantAiCredit['monthly_credit_used'] ?? 0); $monthlyRemaining = (int) ($tenantAiCredit['monthly_credit_remaining'] ?? 0); $purchasedRemaining = (int) ($tenantAiCredit['purchased_credit_remaining'] ?? 0); $totalRemaining = (int) ($tenantAiCredit['total_credit_remaining'] ?? 0); $monthlyPeriodLabel = null; if (! empty($tenantAiCredit['period_start']) && ! empty($tenantAiCredit['period_end'])) { $monthlyPeriodLabel = $tenantAiCredit['period_start']->format('Y.m.d') . ' ~ ' . $tenantAiCredit['period_end']->format('Y.m.d'); } $selectedProductId = (int) ($selectedProductId ?? old('credit_product_id') ?? $pendingOrder?->credit_product_id ?? 0); $selectedProduct = $products->firstWhere('id', $selectedProductId) ?? $products->first(); $pendingDepositorName = data_get($pendingOrder?->metadata, 'depositor_name'); $storeAction = tenant_admin_url(null, 'credit-topups'); if ($selectedProduct) { $selectedProductId = (int) $selectedProduct->id; } $statusLabels = [ 'pending' => '입금 대기', 'completed' => '충전 완료', 'cancelled' => '취소', ]; $statusVariants = [ 'pending' => 'warning', 'completed' => 'success', 'cancelled' => 'secondary', ]; $formatWon = static fn (int|float|string $value): string => number_format((float) $value) . '원'; $productMap = $products->mapWithKeys(static function ($product) { return [ $product->id => [ 'id' => (int) $product->id, 'name' => $product->name, 'credits' => (int) $product->credits, 'price' => (int) round((float) $product->price), 'currency' => (string) $product->currency, ], ]; })->all(); @endphp
@if (session('status')) {{ session('status') }} @endif @if (isset($errors) && $errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
총 사용 가능 Credit
{{ number_format($totalRemaining) }}
월 잔여 Credit + 충전 Credit
월 Credit
{{ number_format($monthlyRemaining) }} /{{ number_format($monthlyLimit) }}
{{ $monthlyPeriodLabel ? '기간 ' . $monthlyPeriodLabel : '월 제공 Credit 기간' }}
충전 Credit
{{ number_format($purchasedRemaining) }}
관리자 충전 및 주문 승인으로 누적되는 잔액
@if ($pendingOrder)

입금 대기

입금이 확인되면 Credit이 반영됩니다.

입금 대기
입금하실 금액
{{ $formatWon($pendingOrder->amount) }}
지급 예정
{{ number_format((int) $pendingOrder->credits) }} Credit
입금자명
{{ $pendingDepositorName ?: '-' }}
입금 계좌
{{ $paymentInfo?->credit_topup_bank_name ?: '-' }}
{{ $paymentInfo?->credit_topup_account_number ?: '-' }}
예금주 {{ $paymentInfo?->credit_topup_account_holder ?: '-' }}
@if ($paymentInfo?->credit_topup_account_number) 계좌번호 복사 @endif
※ 위 입금자명과 정확한 금액으로 입금해 주세요.
@endif

상품 선택

원하는 Credit 상품을 선택하면 충전 신청 화면이 표시됩니다.

결제방법: 계좌이체
@if ($products->isEmpty())
@else
@csrf
@foreach ($products as $product) @endforeach
확인

충전 신청 확인

지급 Credit
{{ $selectedProduct ? number_format((int) $selectedProduct->credits) : '0' }}
결제금액
{{ $selectedProduct ? $formatWon($selectedProduct->price) : '0원' }}
결제방법
계좌이체

입력한 입금자명으로 꼭 입금해 주세요. 실제 입금 명의와 다르면 확인이 늦어질 수 있습니다.

충전 신청
@endif

충전내역

최근 Credit 충전 신청과 처리 상태를 확인할 수 있습니다.

@if ($orders->isEmpty())
@else
@foreach ($orders as $order) @endforeach
신청일 처리일 상품 결제금액 지급 Credit 상태
{{ $order->created_at?->format('Y.m.d H:i') }} {{ $order->approved_at?->format('Y.m.d H:i') ?? '-' }}
{{ $order->product_name_snapshot }}
{{ $order->payment_method === 'bank_transfer' ? '계좌이체' : ($order->payment_method ?? '-') }}
{{ $formatWon($order->amount) }}
{{ number_format((int) $order->credits) }}
{{ $statusLabels[$order->status] ?? $order->status }}
@endif