@extends('Admin.layout')

<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@latest/tabler-icons.min.css">

<style>
    .card-level {
        border: none;
        border-radius: 14px;
        overflow: hidden;
    }

    .card-level .card-header {
        background: #138fa7;
        color: #fff;
        padding: 1.5rem;
        border-bottom: none;
    }

    .card-level .card-title {
        margin-bottom: 0;
        display: flex;
        align-items: center;
        justify-content: start;
        gap: 10px;
        font-weight: 600;
        font-size: 1.3rem;
        color: #fff;
    }
</style>

@section('content')
<meta name="csrf-token" content="{{ csrf_token() }}">

<div class="row d-flex justify-content-between">
    <div class="col-auto">
        <h5>
<button type="button" class="btn btn-icon bg-white me-2 waves-effect waves-light" style="box-shadow: 0px 9px 12px -2px #66328E1F;">
            <a href="{{ route('admin.silver_advance') }}">
                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler">
                    <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
                    <path d="M15 6l-6 6l6 6"></path>
                </svg>
            </a>
        </button>
    Profit Generation
</h5>
    </div>
    <div class="col-auto">
        <a href="{{ route('admin.profit_report_silver') }}" class="btn btn-primary">
            <i class="ti tabler-chart-bar"></i>&nbsp;
             Report
        </a>
    </div>
</div>
<div class="container mt-5">

    <div class="row justify-content-center">
        <div class="col-lg-5 col-md-7 col-sm-12">

            <div class="card card-level shadow-lg">

                <div class="card-header">
                    <h5 class="card-title">
                        <i class="ti tabler-chart-bar"></i>
                        Profit Generation
                    </h5>
                </div>

                <div class="card-body p-4">

                    <form id="levelForm" action="#">
                        @csrf

                        <div class="mb-4">
                            <label class="form-label fw-semibold mb-2">Process Date</label>

                            <div class="input-group">
                                <span class="input-group-text bg-light">
                                    <i class="ti tabler-calendar-event text-primary"></i>
                                </span>
                                <input type="date"
                                    name="generate_date"
                                    class="form-control form-control-lg"
                                    required
                                    value="{{ old('generate_date', date('Y-m-d')) }}">
                            </div>
                            @error('generate_date')
                            <small class="text-danger">{{ $message }}</small>
                            @enderror

                            <small class="text-muted d-block mt-2">
                                Defaulted to today's date.
                            </small>
                        </div>

                        <div class="d-grid gap-2 mt-5">
                            <button type="submit" id="submit_btn" class="btn btn-primary btn-submit fw-bold">
                                <i class="ti tabler-rocket"></i> Submit & Generate
                            </button>

                        </div>

                    </form>

                </div>
            </div>

        </div>
    </div>

</div>
<script>
    document.getElementById('levelForm').addEventListener('submit', function() {
        const btn = document.getElementById('submit_btn');
        btn.disabled = true;
        btn.innerText = 'Processing...';
    });
</script>
@endsection