@extends('layouts.app') @section('title', 'Assisted Purchase Amount Collection') @section('content') @php $lines = $payment->items->map(function ($row) { return $row->assistedPurchaseRequest; })->filter()->values(); $suiteNumber = $payment->suite_number ?: optional($lines->first())->suite_number; $address = $payment->virtualAddress; $badges = $address ? $address->deliveryBadges() : null; $money = $payment->selectedMoney(); $currencyMark = $money['mark']; $pathway = 'b'; $methodLabel = 'Payment method - Pathway B: Maldives Post Link'; $statusLabel = $current ?: 'Pending From Customer'; $statusClass = $statusLabel === 'Customer Paid' ? 'is-done' : 'is-pending'; $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 = $money['code'] === 'USD' ? $payment->convenience_charge_usd : (in_array($money['code'], ['MVR', 'RF'], true) ? $payment->convenience_charge_rf : $payment->convenience_charge_inr); $lineSubtotal = ($money['subtotal'] !== null && $money['fee'] !== null) ? round((float) $money['subtotal'] + (float) $money['fee'], 2) : null; $purchaseFlow = \App\Support\AssistedPurchaseFlow::purchase($payment, 'b', 'partner'); $shipmentFlow = \App\Support\AssistedPurchaseFlow::shipment($payment); $summaryNote = 'Maldives Post will send a payment link by WhatsApp or email for collecting the payment.'; @endphp
{{ $badges['name'] }} - {{ $badges['phone'] }} ({{ $badges['label'] }})
@if(!empty($badges['address'])){{ $badges['address'] }}
@endif @endif{{ implode(', ', $shipmentFlow['numbers']) }}
@endif