@extends('layouts.app') @section('title', 'Recycle & Earn') @push('styles') @endpush @section('content') @php $user = auth()->user(); $confirmedCount = $logs->where('status','confirmed')->count(); $totalKg = $logs->where('status','confirmed')->sum('weight_kg'); $totalCoins = $logs->where('status','confirmed')->sum('coins_earned'); $activePickups = $logs->filter(fn($l) => $l->type === 'pickup' && !in_array($l->status, ['confirmed','rejected'])); $rates = ['plastic'=>5,'paper'=>3,'metal'=>8,'e-waste'=>15,'organic'=>2,'glass'=>4,'other'=>2]; $tips = ['plastic'=>'Remove caps and rinse bottles. Flatten where possible.','paper'=>'Keep paper dry, remove staples. Flatten cardboard.','metal'=>'Rinse cans and remove lids. Aluminium earns the most!','e-waste'=>'Remove batteries first. E-waste earns the highest rate!','organic'=>'Separate from packaging. Dry organic waste earns more.','glass'=>'Rinse bottles and jars. Remove metal lids.','other'=>'Sort mixed waste where possible to earn higher rates.']; @endphp {{-- Hero --}}
♻️ Recycle & Earn
Schedule pickups, redeem machine codes, earn Nabola Coins
{{ $confirmedCount }}
Pickups Done
{{ number_format($totalKg, 1) }}
kg Recycled
{{ number_format($totalCoins) }}
NC Earned
{{ number_format($user->getCo2Saved(), 1) }}
kg CO₂ Saved
{{-- Streak bar --}} @if($streak > 0)
🔥
{{ $streak }}-Day Recycling Streak!
@if($streakBonus > 0) +{{ $streakBonus }}% bonus coins on your next pickup @else Keep going — 3-day streak unlocks +10% bonus! @endif
@for($i = 1; $i <= 7; $i++)
@endfor
@if($streakBonus > 0)
+{{ $streakBonus }}% BONUS
@endif
@endif {{-- This week card --}} @if($weekCoins > 0 || $weekKg > 0)
This Week
{{ number_format($weekCoins) }} NC earned
{{ number_format($weekKg, 1) }} kg recycled
Recycle 5kg plastic = 25 NC ≈ ₦250
@endif @if(session('success'))
{{ session('success') }}
@endif @if($errors->any())
{{ $errors->first() }}
@endif {{-- AI Pickup Scheduler Tip --}} @php $aiPickupTip = null; $lastLog = $logs->where('status','confirmed')->first(); $daysSinceLast = $lastLog ? $lastLog->created_at->diffInDays(now()) : null; $topCatData = $logs->where('status','confirmed')->groupBy('waste_category')->map->count()->sortDesc()->keys()->first(); if ($daysSinceLast !== null && $daysSinceLast >= 7) { $aiPickupTip = "It's been {$daysSinceLast} days since your last confirmed pickup. Schedule one now to keep your streak and earn coins."; } elseif ($streak >= 3 && $streakBonus > 0) { $aiPickupTip = "🔥 You have a {$streak}-day streak with +{$streakBonus}% bonus active! Recycle now to maximise your earnings."; } elseif ($topCatData) { $rates = ['plastic'=>5,'paper'=>3,'metal'=>8,'e-waste'=>15,'organic'=>2,'glass'=>4,'other'=>2]; $rate = $rates[$topCatData] ?? 2; $aiPickupTip = "Your most recycled category is " . ucfirst($topCatData) . " ({$rate} NC/kg). Have more ready? Schedule a pickup now."; } @endphp @if($aiPickupTip)
🤖
{{ $aiPickupTip }}
Schedule Now
@endif {{-- Action Cards --}}
{{-- Schedule Pickup --}}
Schedule a Pickup
@csrf
{{-- Tip box --}}
Use the weight estimator if unsure {{-- Live earn preview --}}
You'll earn approximately
0 NC
≈ ₦0
@if($addresses->count())
Saved Addresses
@foreach($addresses as $addr) @endforeach
@endif
{{-- Photo upload --}}
Preview
Tap to add a photo
JPG, PNG · max 5MB
{{-- Machine Code --}}
Redeem Machine Code

Used a Nabola recycling machine? Enter the code to earn coins instantly.

@csrf
Coin Rates
@foreach(['💻 E-Waste'=>'15 NC/kg','🔩 Metal'=>'8 NC/kg','🧴 Plastic'=>'5 NC/kg','🍶 Glass'=>'4 NC/kg','📄 Paper'=>'3 NC/kg','🌿 Organic'=>'2 NC/kg'] as $type=>$rate)
{{ $type }}{{ $rate }}
@endforeach
{{-- Estimator card --}}
Quick Estimator
Enter weight to see estimate
Find a machine near you →
{{-- Active Pickups --}} @if($activePickups->count())
Active Pickups
@foreach($activePickups as $log) @php $step = $log->statusStep(); @endphp
{{ ucfirst($log->waste_category) }} Pickup
{{ $log->address }} @if($log->scheduled_date)  ·  {{ \Carbon\Carbon::parse($log->scheduled_date)->format('d M Y') }}@endif @if($log->scheduled_time)  {{ $log->scheduled_time }}@endif
@if($log->waste_photo)
Waste photo
@endif
{{ $log->statusLabel() }} @if($log->status === 'pending')
@csrf @method('DELETE')
@endif
{{-- Timeline --}} @php $tlSteps = [ [1,'fas fa-calendar-check','Scheduled', $log->created_at?->format('d M H:i') ?? ''], [2,'fas fa-user-check','Assigned', $log->assigned_at?->format('d M H:i') ?? 'Pending'], [3,'fas fa-truck','On the Way', $log->on_the_way_at?->format('d M H:i') ?? '—'], [4,'fas fa-coins','Confirmed', $log->confirmed_at?->format('d M H:i') ?? '—'], ]; @endphp
@foreach($tlSteps as $tlIdx => [$s,$icon,$label,$time]) @if($tlIdx > 0)
@endif
{{ $label }}
{{ $time }}
@endforeach
@if($log->collector)
@if($log->collector->avatar){{ $log->collector->name }} @else {{ strtoupper(substr($log->collector->name,0,2)) }} @endif
{{ $log->collector->name }}
Your Pickup Collector
@if($log->collector->phone) {{ $log->collector->phone }}@endif @if($log->collector->telegram_id) Telegram@endif Chat Support
@if($log->status === 'on_the_way')

On the Way!
@endif
@else
Waiting for a collector to be assigned. We'll notify you when one is on the way.
@endif @if($log->collector_note)
Collector note: {{ $log->collector_note }}
@endif
@endforeach
@endif {{-- History with tabs --}}
Recycling History
@forelse($logs as $log)
{{ ucfirst($log->waste_category) }} {{ ucfirst($log->type) }}
{{ $log->address ?? $log->machine_code ?? '—' }}{{ $log->weight_kg ? ' · '.$log->weight_kg.' kg' : '' }}
@if($log->waste_photo) @endif
{{ $log->coins_earned > 0 ? '+'.$log->coins_earned.' NC' : '' }}
{{ $log->created_at->format('d M Y') }}
{{ $log->statusLabel() }}
@empty
No recycling history yet

Schedule your first pickup or redeem a machine code above!

@endforelse @if($logs->hasPages())
{{ $logs->links() }}
@endif
@push('scripts') @endpush @endsection