@extends('layouts.app')

@section('page_title', 'Fuel Price On-Demand')

@section('content')
<div class="card-header border-0 bg-transparent py-2">
    <h5 class="mb-0 fw-bold text-dark" style="font-size: 1.25rem;font-weight:500">Fuel Price On-Demand</h5>
</div>
    <div class="row justify-content-center align-items-center">
        <div class="col-12 col-md-8 col-lg-6">
            <div class="card-body p-3">
                <form id="fuelPriceForm">
                    <!-- Import File Section -->
                    <div class="mb-3">
                        <label class="form-label fw-bold" style="font-size: 1.5rem;">Import File</label>
                        <div class="input-group mb-3">
                            <input type="file" class="form-control" id="fuelPriceFile" style="font-size: 0.9rem; margin: 10px;">
                        </div>
                    </div>
                   

                    <!-- Buttons -->
                    <div class="d-flex justify-content-center gap-3" >
                        <button type="submit" class="btn btn-primary d-flex align-items-center" style="background-color: #E74610; border-color: #E74610; font-size: 1.2rem; padding: 10px 20px;">
                            SUBMIT <i class="fas fa-paper-plane ms-2"></i>
                        </button>
                        <button type="button" id="exportFuelPrices" class="btn btn-secondary d-flex align-items-center" style="font-size: 1.2rem; padding: 10px 20px;">
                            EXPORT FUEL PRICES <i class="fas fa-cloud-download-alt ms-2"></i>
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <style>
        .card {
            border-radius: 5px;
            border: 1px solid #dee2e6;
        }
        .form-label {
            font-size: 1.2rem;
        }
        .form-control {
            font-size: 1.2rem;
        }
        .btn-primary:hover {
            background-color: #e07b30;
            border-color: #e07b30;
        }
        .btn-secondary {
            background-color: #6c757d;
            border-color: #6c757d;
        }
        .btn-secondary:hover {
            background-color: #5a6268;
            border-color: #5a6268;
        }
        .d-flex.justify-content-center {
            gap: 1rem; /* Space between buttons */
        }
    </style>

    <script>
        document.getElementById('fuelPriceForm').addEventListener('submit', function(e) {
            e.preventDefault();

            const fileInput = document.getElementById('fuelPriceFile');
            if (!fileInput.files.length) {
                alert('Please select a file to import.');
                return;
            }

            // Simulate file import (frontend-only)
            alert('File imported successfully!');
            fileInput.value = ''; // Reset file input
        });

        document.getElementById('exportFuelPrices').addEventListener('click', function() {
            // Simulate export action (frontend-only)
            alert('Fuel prices exported successfully!');
        });
    </script>
@endsection