@extends('layouts.admin')

@section('content')
<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="page-title-box">
                <div class="page-title-right">
                    <a href="{{ route('admin.shipping.methods.index') }}" class="btn btn-secondary">
                        <i class="fas fa-arrow-left"></i> Back to Methods
                    </a>
                </div>
                <h4 class="page-title">Add Shipping Method</h4>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <form action="{{ route('admin.shipping.methods.store') }}" method="POST">
                        @csrf
                        <div class="row">
                            <div class="col-md-6">
                                <div class="mb-3">
                                    <label for="name" class="form-label">Method Name</label>
                                    <input type="text" class="form-control" id="name" name="name" required>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="mb-3">
                                    <label for="carrier" class="form-label">Carrier</label>
                                    <select class="form-select" id="carrier" name="carrier" required>
                                        <option value="">Select Carrier</option>
                                        @foreach($carriers as $value => $label)
                                            <option value="{{ $value }}">{{ $label }}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-6">
                                <div class="mb-3">
                                    <label for="service_type" class="form-label">Service Type</label>
                                    <input type="text" class="form-control" id="service_type" name="service_type" required>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="mb-3">
                                    <label for="estimated_days" class="form-label">Estimated Days</label>
                                    <input type="number" class="form-control" id="estimated_days" name="estimated_days" min="1" required>
                                </div>
                            </div>
                        </div>

                        <div class="mb-3">
                            <div class="form-check">
                                <input type="checkbox" class="form-check-input" id="is_active" name="is_active" value="1" checked>
                                <label class="form-check-label" for="is_active">Active</label>
                            </div>
                        </div>

                        <div class="text-end">
                            <button type="submit" class="btn btn-primary">Save Method</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection