{{-- resources/views/tenant/profile/show.blade.php --}} {{-- Tenant Profile — Full view with meter readings, payment history --}} @extends('layouts.tenant') @section('title', 'My Profile') @section('content')
{{-- Hero Header --}}
{{-- Avatar --}}
@if($user->avatar) {{ $user->name }} @else
{{ strtoupper(substr($user->name,0,2)) }}
@endif

{{ $user->name }}

Flat {{ $tenant->flat->flat_number }} · {{ $tenant->flat->block }} Block

✓ Active Tenant Since {{ $tenant->lease_start->format('M Y') }}
৳{{ number_format($tenant->monthly_rent + $tenant->service_charge, 0) }}
Monthly Charge
{{-- Body --}}
{{-- LEFT: Meter Readings --}}
{{-- ⚡ Meter Reading Cards --}}

⚡ Last Meter Readings

{{-- Electricity --}}
Electricity
৳{{ number_format($tenant->flat->electricity_rate ?? 8, 2) }}/unit
@if($lastElectricity)
Previous {{ number_format($lastElectricity->previous_reading, 2) }}
Current {{ number_format($lastElectricity->current_reading, 2) }}
Units Used {{ number_format($lastElectricity->units_consumed, 2) }}
Bill ৳{{ number_format($lastElectricity->bill_amount, 2) }}
📅 {{ $lastElectricity->reading_date->format('d M Y') }}
@else
No reading yet
@endif
{{-- Gas --}}
🔥
Gas
৳12.50/unit
@if($lastGas)
Previous{{ number_format($lastGas->previous_reading, 2) }}
Current{{ number_format($lastGas->current_reading, 2) }}
Units Used{{ number_format($lastGas->units_consumed, 2) }}
Bill৳{{ number_format($lastGas->bill_amount, 2) }}
📅 {{ $lastGas->reading_date->format('d M Y') }}
@else
No reading yet
@endif
{{-- Water --}}
💧
Water
৳5.00/unit
@if($lastWater)
Previous{{ number_format($lastWater->previous_reading, 2) }}
Current{{ number_format($lastWater->current_reading, 2) }}
Units Used{{ number_format($lastWater->units_consumed, 2) }}
Bill৳{{ number_format($lastWater->bill_amount, 2) }}
📅 {{ $lastWater->reading_date->format('d M Y') }}
@else
No reading yet
@endif
{{-- Meter History Table --}} @if($meterHistory->isNotEmpty())

Reading History

@foreach($meterHistory->flatten() as $reading) @endforeach
Type Month Prev Current Units Bill
{{ ucfirst($reading->meter_type) }} {{ $reading->reading_month->format('M Y') }} {{ number_format($reading->previous_reading, 2) }} {{ number_format($reading->current_reading, 2) }} {{ number_format($reading->units_consumed, 2) }} ৳{{ number_format($reading->bill_amount, 2) }}
@endif
{{-- Payment History --}}

💳 Payment History

@forelse($paymentHistory as $payment)
{{ match($payment->method) { 'bkash'=>'📱', 'nagad'=>'🟠', 'bank'=>'🏦', default=>'💵' } }}
{{ $payment->bill->invoice_number }}
{{ $payment->paid_at->format('d M Y, g:i A') }}
৳{{ number_format($payment->amount, 2) }}
{{ strtoupper($payment->method) }}
@empty
No verified payments yet.
@endforelse
{{-- RIGHT: Profile Edit + Flat Info --}}
{{-- Flat Info Card --}}

🏠 My Flat

Flat No{{ $tenant->flat->flat_number }}
Block{{ $tenant->flat->block ?? '—' }}
Floor{{ $tenant->flat->floor ?? '—' }}
Bedrooms{{ $tenant->flat->bedrooms }}
Size{{ $tenant->flat->size_sqft ?? '—' }} sqft
Rent৳{{ number_format($tenant->monthly_rent, 0) }}
Service৳{{ number_format($tenant->service_charge, 0) }}
Security৳{{ number_format($tenant->security_deposit, 0) }}
{{-- Edit Profile Form --}}

✏️ Edit Profile

@if(session('success'))
✅ {{ session('success') }}
@endif
@csrf
{{-- Change Password --}}

🔒 Change Password

@csrf
@error('current_password')

{{ $message }}

@enderror
@endsection