@extends('layouts.content') @section('content')

Profil Pengguna

Kelola data diri, alamat pengiriman, dan pantau status pesanan Anda di Tanjoeng Farm

@if ($errors->any()) @endif @if (session('success')) @endif @if (session('error')) @endif
@if ($profile && $profile->avatar_url) {{-- Sudah ada avatar: klik buka modal Ganti/Hapus --}} Avatar @else {{-- Belum ada avatar: klik buka file picker langsung --}}
@csrf
@endif
{{ $profile->full_name ?? ($user->username ?? 'Pengguna') }}

{{ $user->email }}

{{-- Tombol Logout Mobile --}}
@csrf
Informasi Akun
Username
{{ $user->username }}
Email
{{ $user->email }}
Nama Lengkap
{{ $profile->full_name ?? '-' }}
Nomor Telepon
{{ $user->phone_number ?? '-' }}
Jenis Kelamin
@if ($profile && $profile->gender) {{ $profile->gender == 'male' ? 'Laki-laki' : 'Perempuan' }} @else - @endif
Tanggal Lahir
{{ $profile && $profile->birth_date ? \Carbon\Carbon::parse($profile->birth_date)->translatedFormat('d M Y') : '-' }}
Bio
{{ $profile->bio ?? '-' }}
Tanggal Registrasi
{{ $user->created_at->translatedFormat('d M Y') }}
@php $formattedOrders = $orders->map(function($order) { $statusColor = '#f59e0b'; $statusLabel = 'Menunggu'; if ($order->order_status === 'processing') { $statusLabel = 'Dikemas'; $statusColor = '#f59e0b'; } elseif ($order->order_status === 'shipped') { $statusLabel = 'Dikirim'; $statusColor = '#3b82f6'; } elseif ($order->order_status === 'completed') { $statusLabel = 'Selesai'; $statusColor = '#10b981'; } elseif ($order->order_status === 'cancelled') { $statusLabel = 'Dibatalkan'; $statusColor = '#ef4444'; } return [ 'id' => $order->order_id, 'invoice' => $order->invoice_number, 'date' => $order->created_at->format('Y-m-d'), 'total' => (int) $order->total_payment, 'statusKey' => $order->order_status === 'pending' || $order->order_status === 'processing' ? 'dikemas' : ($order->order_status === 'shipped' ? 'dikirim' : ($order->order_status === 'completed' ? 'selesai' : 'dibatalkan')), 'statusLabel' => $statusLabel, 'statusColor' => $statusColor, 'estimated' => (!empty($order->tracking_number) && trim($order->tracking_number) !== '') ? 'Resi: ' . $order->tracking_number : ($order->order_status === 'completed' ? 'Tiba di tujuan' : 'Diproses'), 'items' => $order->details->sum('quantity'), ]; }); @endphp @endsection