@extends('layouts.app') @section('title', 'Public User Dashboard') @section('content')

Welcome, {{ Auth::guard('kuser')->user()->name }}

@include('kuser.partials.shipping-instructions')
Active shipments {{ $activeCount ?? 0 }}
Delivered {{ $deliveredCount ?? 0 }}
@php $dashboardAddresses = []; $kuserName = optional(Auth::guard('kuser')->user())->name; foreach ($virtualAddresses as $virtualAddress) { $address = $virtualAddress->wuser ?: $virtualAddress->address; if (!$address) { continue; } $suiteNumber = $virtualAddress->suite_number; $phone = $address->phonenumber ?: $address->phone; if (filled($phone)) { $phoneDigits = preg_replace('/\D+/', '', $phone); if (str_starts_with($phoneDigits, '91') && strlen($phoneDigits) > 10) { $phoneDigits = substr($phoneDigits, 2); } $phone = '+91 ' . $phoneDigits; } $place = collect([$address->city, $address->district, $address->state])->filter()->implode(', '); $warehouseName = $address->name; $headline = collect([$kuserName, $suiteNumber])->filter()->implode(' - '); $fullAddress = ($headline !== '' ? $headline . "\n" : '') . ($warehouseName ? $warehouseName . "\n" : '') . ($address->line1 ? $address->line1 . "\n" : '') . ($address->line2 ? $address->line2 . "\n" : '') . ($address->city ? $address->city . ', ' : '') . ($address->district ? $address->district . ', ' : '') . ($address->state ? $address->state . "\n" : '') . ($address->pincode ? $address->pincode . ', ' : '') . ($address->country ? $address->country : '') . ($phone ? "\nPhone: " . $phone : ''); $dashboardAddresses[] = [ 'id' => $virtualAddress->id, 'name' => $headline, 'warehouse' => $warehouseName, 'line1' => $address->line1, 'line2' => $address->line2, 'place' => $place, 'pincode' => $address->pincode, 'country' => $address->country, 'phone' => $phone, 'full' => $fullAddress, ]; } @endphp
@foreach($dashboardAddresses as $card)
Virtual address
@if($card['name'])

{{ $card['name'] }}

@endif @if($card['warehouse'])

{{ $card['warehouse'] }}

@endif

@if($card['line1']){{ $card['line1'] }}
@endif @if($card['line2']){{ $card['line2'] }}
@endif @if($card['place'] !== ''){{ $card['place'] }}
@endif @if($card['pincode'] || $card['country']) @if($card['pincode']){{ $card['pincode'] }}@endif @if($card['pincode'] && $card['country']), @endif @if($card['country']){{ $card['country'] }}@endif @if($card['phone'])
@endif @endif @if($card['phone'])Phone: {{ $card['phone'] }}@endif

Scan address
@endforeach
Recent Shipments
View All Shipments
@forelse($recentShipments ?? [] as $shipment) @php // Determine badge color based on display status $badgeClass = 'bg-info'; $statusText = $shipment['display_status']; if ($shipment['display_status'] === 'Delivered') { $badgeClass = 'bg-success'; } elseif ($shipment['display_status'] === 'In Transit') { $badgeClass = 'bg-warning'; } elseif ($shipment['display_status'] === 'Out for Delivery') { $badgeClass = 'bg-primary'; } elseif ($shipment['display_status'] === 'Processing' || $shipment['display_status'] === 'Processed') { $badgeClass = 'bg-info'; } elseif ($shipment['display_status'] === 'Package Received') { $badgeClass = 'bg-secondary'; } // Format last update time as exact date & time $lastUpdate = $shipment['last_update']; $lastUpdateText = $lastUpdate ? $lastUpdate->format('d M Y, h:i A') : 'N/A'; @endphp @empty @endforelse
Tracking # Status Origin Destination Last Update Actions
{{ $shipment['tracking_number'] }} {{ $statusText }} {{ $shipment['origin'] }} {{ $shipment['destination'] }} {{ $lastUpdateText }} @php $encryptedId = encrypt($shipment['id']); $paymentStatus = $shipment['payment_status'] ?? null; $isPaymentDone = in_array($paymentStatus, ['success', 'completed']); $isProcessing = $shipment['display_status'] === 'Processing'; @endphp @if($shipment['display_status'] === 'Delivered') View Details @elseif(!$isPaymentDone) {{ $isProcessing ? 'Process Payment' : 'Pay Now' }} @else Track @endif
No shipments found.
Assisted Purchase Requests
View All
@forelse(($assistedPurchaseRequests ?? []) as $r) @php $meta = is_array($r->meta) ? $r->meta : (json_decode($r->meta ?? '{}', true) ?: []); $approvedAmount = $meta['approved_amount'] ?? null; $statusLabel = $r->status === 'pending' ? 'Pending for Approval' : ucfirst(str_replace('_', ' ', (string) $r->status)); @endphp {{ $r->title }} @if($r->store){{ $r->store }}@else Store not set @endif @if($r->price_range) · {{ $r->price_range }}@endif @if($r->status === 'approved' && $approvedAmount) · Approved ₹{{ number_format($approvedAmount, 2) }}@endif @if($r->created_at) · {{ $r->created_at->format('d M Y') }}@endif {{ $statusLabel }} @empty

No assisted purchase requests yet. Create your first request.

@endforelse
@endsection @push('styles') @endpush @push('scripts') @endpush