@extends('layouts.admin')

@section('title', 'Exports de Données')
@section('page-title', 'Exports de Données')

@section('content')
<div class="row g-4">
    <div class="col-md-6 col-lg-4">
        <div class="card h-100">
            <div class="card-body">
                <div class="d-flex align-items-center mb-3">
                    <div class="bg-primary bg-opacity-10 rounded-3 p-3 me-3">
                        <i class="bi bi-percent text-primary fs-4"></i>
                    </div>
                    <div>
                        <h5 class="card-title mb-0">Commissions</h5>
                        <small class="text-muted">Export des commissions MLM</small>
                    </div>
                </div>
                <form action="{{ route('admin.exports.commissions') }}" method="GET" class="mt-3">
                    <div class="row g-2 mb-3">
                        <div class="col-6">
                            <label class="form-label small">Du</label>
                            <input type="date" name="date_from" class="form-control form-control-sm">
                        </div>
                        <div class="col-6">
                            <label class="form-label small">Au</label>
                            <input type="date" name="date_to" class="form-control form-control-sm">
                        </div>
                    </div>
                    <button type="submit" class="btn btn-primary w-100">
                        <i class="bi bi-download me-2"></i>Télécharger CSV
                    </button>
                </form>
            </div>
        </div>
    </div>

    <div class="col-md-6 col-lg-4">
        <div class="card h-100">
            <div class="card-body">
                <div class="d-flex align-items-center mb-3">
                    <div class="bg-success bg-opacity-10 rounded-3 p-3 me-3">
                        <i class="bi bi-bag-check text-success fs-4"></i>
                    </div>
                    <div>
                        <h5 class="card-title mb-0">Commandes</h5>
                        <small class="text-muted">Export des commandes</small>
                    </div>
                </div>
                <form action="{{ route('admin.exports.orders') }}" method="GET" class="mt-3">
                    <div class="row g-2 mb-3">
                        <div class="col-6">
                            <label class="form-label small">Du</label>
                            <input type="date" name="date_from" class="form-control form-control-sm">
                        </div>
                        <div class="col-6">
                            <label class="form-label small">Au</label>
                            <input type="date" name="date_to" class="form-control form-control-sm">
                        </div>
                    </div>
                    <div class="mb-3">
                        <label class="form-label small">Statut</label>
                        <select name="status" class="form-select form-select-sm">
                            <option value="">Tous</option>
                            <option value="pending">En attente</option>
                            <option value="confirmed">Confirmée</option>
                            <option value="shipped">Expédiée</option>
                            <option value="delivered">Livrée</option>
                            <option value="cancelled">Annulée</option>
                        </select>
                    </div>
                    <button type="submit" class="btn btn-success w-100">
                        <i class="bi bi-download me-2"></i>Télécharger CSV
                    </button>
                </form>
            </div>
        </div>
    </div>

    <div class="col-md-6 col-lg-4">
        <div class="card h-100">
            <div class="card-body">
                <div class="d-flex align-items-center mb-3">
                    <div class="bg-info bg-opacity-10 rounded-3 p-3 me-3">
                        <i class="bi bi-people text-info fs-4"></i>
                    </div>
                    <div>
                        <h5 class="card-title mb-0">Utilisateurs</h5>
                        <small class="text-muted">Export des membres</small>
                    </div>
                </div>
                <form action="{{ route('admin.exports.users') }}" method="GET" class="mt-3">
                    <div class="mb-3">
                        <label class="form-label small">Rôle</label>
                        <select name="role" class="form-select form-select-sm">
                            <option value="">Tous</option>
                            <option value="user">Membre</option>
                            <option value="seller">Vendeur</option>
                            <option value="affiliate">Affilié</option>
                            <option value="admin">Admin</option>
                        </select>
                    </div>
                    <div class="mb-3">
                        <label class="form-label small">Statut</label>
                        <select name="status" class="form-select form-select-sm">
                            <option value="">Tous</option>
                            <option value="active">Actif</option>
                            <option value="inactive">Inactif</option>
                        </select>
                    </div>
                    <button type="submit" class="btn btn-info w-100">
                        <i class="bi bi-download me-2"></i>Télécharger CSV
                    </button>
                </form>
            </div>
        </div>
    </div>

    <div class="col-md-6 col-lg-4">
        <div class="card h-100">
            <div class="card-body">
                <div class="d-flex align-items-center mb-3">
                    <div class="bg-warning bg-opacity-10 rounded-3 p-3 me-3">
                        <i class="bi bi-wallet2 text-warning fs-4"></i>
                    </div>
                    <div>
                        <h5 class="card-title mb-0">Portefeuilles</h5>
                        <small class="text-muted">Soldes des wallets</small>
                    </div>
                </div>
                <form action="{{ route('admin.exports.wallets') }}" method="GET" class="mt-3">
                    <p class="text-muted small mb-3">
                        Exporte les soldes actuels de tous les portefeuilles utilisateurs.
                    </p>
                    <button type="submit" class="btn btn-warning w-100">
                        <i class="bi bi-download me-2"></i>Télécharger CSV
                    </button>
                </form>
            </div>
        </div>
    </div>

    <div class="col-md-6 col-lg-4">
        <div class="card h-100">
            <div class="card-body">
                <div class="d-flex align-items-center mb-3">
                    <div class="bg-secondary bg-opacity-10 rounded-3 p-3 me-3">
                        <i class="bi bi-arrow-left-right text-secondary fs-4"></i>
                    </div>
                    <div>
                        <h5 class="card-title mb-0">Transactions</h5>
                        <small class="text-muted">Mouvements wallet</small>
                    </div>
                </div>
                <form action="{{ route('admin.exports.transactions') }}" method="GET" class="mt-3">
                    <div class="row g-2 mb-3">
                        <div class="col-6">
                            <label class="form-label small">Du</label>
                            <input type="date" name="date_from" class="form-control form-control-sm">
                        </div>
                        <div class="col-6">
                            <label class="form-label small">Au</label>
                            <input type="date" name="date_to" class="form-control form-control-sm">
                        </div>
                    </div>
                    <div class="mb-3">
                        <label class="form-label small">Type</label>
                        <select name="type" class="form-select form-select-sm">
                            <option value="">Tous</option>
                            <option value="credit">Crédit</option>
                            <option value="debit">Débit</option>
                            <option value="commission">Commission</option>
                            <option value="withdrawal">Retrait</option>
                            <option value="purchase">Achat</option>
                        </select>
                    </div>
                    <button type="submit" class="btn btn-secondary w-100">
                        <i class="bi bi-download me-2"></i>Télécharger CSV
                    </button>
                </form>
            </div>
        </div>
    </div>

    <div class="col-md-6 col-lg-4">
        <div class="card h-100">
            <div class="card-body">
                <div class="d-flex align-items-center mb-3">
                    <div class="bg-danger bg-opacity-10 rounded-3 p-3 me-3">
                        <i class="bi bi-cash-stack text-danger fs-4"></i>
                    </div>
                    <div>
                        <h5 class="card-title mb-0">Retraits</h5>
                        <small class="text-muted">Demandes de retrait</small>
                    </div>
                </div>
                <form action="{{ route('admin.exports.withdrawals') }}" method="GET" class="mt-3">
                    <div class="row g-2 mb-3">
                        <div class="col-6">
                            <label class="form-label small">Du</label>
                            <input type="date" name="date_from" class="form-control form-control-sm">
                        </div>
                        <div class="col-6">
                            <label class="form-label small">Au</label>
                            <input type="date" name="date_to" class="form-control form-control-sm">
                        </div>
                    </div>
                    <div class="mb-3">
                        <label class="form-label small">Statut</label>
                        <select name="status" class="form-select form-select-sm">
                            <option value="">Tous</option>
                            <option value="pending">En attente</option>
                            <option value="approved">Approuvé</option>
                            <option value="rejected">Rejeté</option>
                            <option value="completed">Complété</option>
                        </select>
                    </div>
                    <button type="submit" class="btn btn-danger w-100">
                        <i class="bi bi-download me-2"></i>Télécharger CSV
                    </button>
                </form>
            </div>
        </div>
    </div>
</div>
@endsection
