@extends('layouts.app') @section('title', 'Assisted Purchase') @section('content') @php $badges = $delivery['badges'] ?? null; $suiteNumber = $payment->suite_number ?: optional($primary)->suite_number; $money = $payment->selectedMoney(); $currencyMark = $money['mark']; $statusLabel = optional($payment->tracking)->status ?: ($payment->status ?: 'Pending From Customer'); $statusClass = $statusLabel === 'Customer Paid' ? 'is-done' : 'is-pending'; $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'; $currencyNames = ['INR' => 'INR (₹)', 'USD' => 'USD ($)', 'MVR' => 'MVR (Rf)', 'RF' => 'MVR (Rf)']; $currencyLabel = $currencyNames[$money['code']] ?? $money['code']; $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(); $formulaBits = $lines->map(function ($line) { $qty = max(1, (int) ($line->quantity ?? 1)); $unit = trim((string) $line->price_range); if ($unit !== '' && !preg_match('/[₹$]|Rf/u', $unit)) { $unit = '₹'.number_format((float) preg_replace('/[^\d.]/', '', $unit), 2); } return ($unit !== '' ? $unit : '—').' × '.$qty; }); $itemFormula = $formulaBits->implode(', '); $feePercents = $lines->pluck('overhead_percentage')->filter(function ($value) { return $value !== null && $value !== ''; })->map(function ($value) { return rtrim(rtrim(number_format((float) $value, 2, '.', ''), '0'), '.'); })->unique()->values(); $feeLabel = $feePercents->count() === 1 ? 'Service charge ('.$feePercents->first().'%)' : 'Service charge'; $convenienceAmount = null; if ($pathway === 'b') { if ($money['code'] === 'USD') { $convenienceAmount = $payment->convenience_charge_usd; } elseif (in_array($money['code'], ['MVR', 'RF'], true)) { $convenienceAmount = $payment->convenience_charge_rf; } else { $convenienceAmount = $payment->convenience_charge_inr; } } $lineSubtotal = ($money['subtotal'] !== null && $money['fee'] !== null) ? round((float) $money['subtotal'] + (float) $money['fee'], 2) : null; if ($pathway === 'a') { $summaryNote = 'Card payment is collected through the gateway. This warehouse page does not take that payment.'; } elseif ($pathway === 'b') { $summaryNote = 'Maldives Post will send a payment link by WhatsApp or email for collecting the payment.'; } else { $summaryNote = $canMark ? 'Mark Customer Paid only after this amount is already in the bank account.' : 'The customer records the transfer. Mark it after the cash is received.'; } @endphp

Assisted Purchase

Back
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif
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. @if($lines->count() > 1){{ $loop->iteration }}@endif {{ $line->title }} @include('partials.assisted-product-photos', ['photos' => is_array($line->meta ?? null) ? ($line->meta['images'] ?? []) : [], 'photoSize' => 'medium']) @if($line->url) @endif
  2. @empty
  3. 1Purchase
  4. @endforelse
@if($pathway === 'c')
@if($selectedBank)
{{ $selectedBank->bank_name ?: 'Bank' }}

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

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

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

Date{{ optional($payment->bank_transaction_date)->format('d M Y') ?: '—' }} Transaction ID{{ $payment->bank_transactionID ?: '—' }} @if($payment->screenshot_path) Screenshot @endif @if($canMark)
@csrf
@endif
@else

The customer has not recorded the bank transaction yet.

@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