@extends('layouts.app') @section('title', 'Purchase') @section('content') @php $badges = $delivery['badges'] ?? null; $suiteNumber = $payment->suite_number ?: $primary->suite_number; $money = $payment->selectedMoney(); $currencyMark = $money['mark']; $purchaseCount = max($lines->count(), 1); $statusLabel = optional($payment->tracking)->status ?: ($payment->status ?: 'Pending From Customer'); $statusClass = $statusLabel === 'Customer Paid' ? 'is-done' : 'is-pending'; $warehouseMarked = $pathway === 'c' && $payment->trackingHistory->contains(function ($row) { return $row->status === 'Customer Paid' && $row->wuser_id; }); if ($pathway === 'c' && $statusLabel === 'Customer Paid' && !$warehouseMarked) { $statusLabel = 'Transaction Successful'; $statusClass = 'is-done'; } $payStatus = strtolower((string) $payment->payment_status); $cardPaid = in_array($payStatus, ['success', 'completed'], true); $cardFailed = $pathway === 'a' && !$cardPaid && in_array($payStatus, ['failed', 'cancelled', 'canceled'], true); if ($cardFailed) { $statusLabel = 'Failed'; $statusClass = 'is-fail'; } elseif ($pathway === 'a' && $cardPaid) { $statusLabel = 'Customer Paid'; $statusClass = 'is-done'; } $pathwayNames = ['a' => 'Card Gateway', 'b' => 'Maldives Post Link', 'c' => 'Cash / Bank Transfer']; $methodLabel = isset($pathwayNames[$pathway]) ? 'Payment method - Pathway '.strtoupper($pathway).': '.$pathwayNames[$pathway] : 'Payment method'; $receiptDate = optional($payment->bank_transaction_date)->format('Y-m-d'); $storeIcons = $lines->map(function ($line) { $path = trim((string) $line->store_icon); if ($path === '') { $path = \App\Support\AssistedStoreIcon::match($line->url)['path']; } return [ 'store' => trim((string) $line->store) ?: 'Store', 'icon' => asset($path), ]; })->unique('store')->values(); $payCurrency = in_array(strtoupper((string) $payment->currency), ['USD', 'INR'], true) ? strtoupper((string) $payment->currency) : 'INR'; @endphp
Suite {{ $suiteNumber ?: 'N/A' }} @if($badges && !empty($badges['name']))

{{ $badges['name'] }} - {{ $badges['phone'] ?? '—' }} ({{ $badges['label'] ?? '—' }})

@endif @if(!empty($delivery['address']))

{{ $delivery['address'] }}

@endif
@foreach($storeIcons as $storeIcon) {{ $storeIcon['store'] }} @endforeach
{{ $statusLabel }} {{ $methodLabel }}
    @forelse($lines as $line)
  1. {{ $loop->iteration }} {{ $line->title }} @if($line->url) @endif
  2. @empty
  3. 1 {{ $primary->title ?: 'Purchase' }}
  4. @endforelse

{{ $purchaseCount }} {{ $purchaseCount === 1 ? 'purchase' : 'purchases' }}

@if($pathway === 'a')
Card transaction

Status{{ $cardPaid ? 'Paid' : ($cardFailed ? 'Failed' : 'Pending') }}

Amount{{ $money['total'] !== null ? $currencyMark.number_format($money['total'], 2) : '—' }}

Paid at{{ optional($payment->paid_at)->format('d M Y, h:i A') ?: '—' }}

Order ID{{ $payment->provider_order_id ?: '—' }}

Payment ID{{ $payment->provider_payment_id ?: '—' }}

Provider{{ $payment->payment_method ?: '—' }}

@if(!$cardPaid) @endif
Order summary

Item subtotal{{ $money['subtotal'] !== null ? $currencyMark.number_format($money['subtotal'], 2) : '—' }}

Service charge{{ $money['fee'] !== null ? $currencyMark.number_format($money['fee'], 2) : '—' }}

Total payable{{ $money['total'] !== null ? $currencyMark.number_format($money['total'], 2) : '—' }}

@elseif($pathway === 'b')
Maldivian Post will send you a WhatsApp message or email with the payment link.
@include('partials.assisted-purchase-money', ['payment' => $payment])
@elseif($pathway === 'c')
@include('partials.assisted-purchase-money', ['payment' => $payment])
@if($locked)
@if($selectedBank)
{{ $selectedBank->bank_name ?: 'Bank' }}

Account holder{{ $selectedBank->account_holder_name ?: '—' }}

Account No.{{ $selectedBank->account_number ?: '—' }}

Currency{{ $selectedBank->currency ?: '—' }}

@else

Bank account is not available.

@endif
Recorded transaction

Date{{ $receiptDate ?: '—' }}

Transaction ID{{ $payment->bank_transactionID ?: '—' }}

@if($payment->screenshot_path) View screenshot Payment screenshot @endif
@else
Bank account
@forelse($banks as $bank) @empty

No active bank account is available.

@endforelse
Transaction

@endif @endif
Purchase flow
    @foreach($purchaseFlow as $step)
  1. {{ $step['label'] }}
  2. @endforeach
Shipment flow
    @foreach($shipmentFlow['steps'] as $step)
  1. {{ $step['label'] }}
  2. @endforeach
@if(!empty($shipmentFlow['numbers']))

{{ implode(', ', $shipmentFlow['numbers']) }}

@endif
@include('kuser.partials.surface-styles') @endsection @push('scripts') @endpush