@extends('layouts.admin')

@section('title', 'Dashboard Petani')
@section('page-title', 'Overview Toko')

@section('content')
    <section class="row">
        <div class="col-12 col-lg-12">
            <div class="row">
                {{-- Card 1: Produk Saya --}}
                <div class="col-6 col-lg-4 col-md-6">
                    <div class="card">
                        <div class="card-body px-3 py-4-5">
                            <div class="row">
                                <div class="col-md-4 d-flex justify-content-center align-items-center">
                                    <div class="stats-icon purple"><i class="bi bi-people-fill"></i></div>
                                </div>
                                <div class="col-md-8">
                                    <h6 class="text-muted font-semibold">Produk Saya</h6>
                                    <h6 class="font-extrabold mb-0">{{ $totalProduk }}</h6>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                {{-- Card Pemesanan --}}
                <div class="col-6 col-lg-4 col-md-6">
                    <div class="card">
                        <div class="card-body px-3 py-4-5">
                            <div class="row">
                                <div class="col-md-4 d-flex justify-content-center align-items-center">
                                    <div class="stats-icon blue">
                                        <i class="bi bi-receipt"></i>
                                    </div>
                                </div>
                                <div class="col-md-8">
                                    <h6 class="text-muted font-semibold">Pemesanan</h6>
                                    <h6 class="font-extrabold mb-0">{{ $totalPemesanan }}</h6>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                {{-- Card Total Pendapatan --}}
                <div class="col-6 col-lg-4 col-md-6">
                    <div class="card">
                        <div class="card-body px-3 py-4-5">
                            <div class="row">
                                <div class="col-md-4 d-flex justify-content-center align-items-center">
                                    <div class="stats-icon green">
                                        <i class="bi bi-cash"></i>
                                    </div>
                                </div>
                                <div class="col-md-8">
                                    <h6 class="text-muted font-semibold">Total Pendapatan</h6>
                                    <h6 class="font-extrabold mb-0">Rp {{ number_format($totalPendapatan, 0, ',', '.') }}
                                    </h6>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-header">
                            <h4>Selamat Datang, {{ Auth::guard('petani')->user()->nama_lengkap }}!</h4>
                        </div>
                        <div class="card-body">
                            <p>Kelola produk dan pantau pesanan Anda melalui menu di sebelah kiri.</p>
                            <a href="{{ route('petani.produk.create') }}" class="btn btn-primary">Tambah Produk Baru</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
@endsection