@extends('layouts.master')
@section('title', 'Create Addiction')
@section('content')
    <div class="page-content">
        <nav class="page-breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="#">Master</a></li>
                <li class="breadcrumb-item"><a href="{{ route('admin.addictions.index') }}">Addictions</a></li>
                <li class="breadcrumb-item active" aria-current="page">Create Addiction</li>
            </ol>
        </nav>
        <div class="row">
            <div class="col-12 grid-margin stretch-card">
                <div class="card">
                    <div class="card-body">
                        <h4 class="card-title">Addiction Form</h4>
                        <form class="custom-validation" action="{{ route('admin.addictions.store') }}" method="POST" enctype="multipart/form-data">
                            @csrf
                            @method('POST')
                            <div class="row">
                                <div class="col-md-12 col-lg-6">
                                    <div class="mb-3">
                                        <label class="form-label">Code</label>
                                        <input type="text" name="code" id="code" class="form-control @error('code') is-invalid @enderror" required placeholder="Enter code" value="{{ old('code') }}" />
                                        @error('code')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $message }}</strong>
                                            </span>
                                        @enderror
                                    </div>
                                    <div class="mb-3">
                                        <label class="form-label">Name</label>
                                        <input type="text" name="name" id="name" class="form-control @error('name') is-invalid @enderror" required placeholder="Enter name" value="{{ old('name') }}" />
                                        @error('name')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $message }}</strong>
                                            </span>
                                        @enderror
                                    </div>

                                    <div class="mb-3">
                                        <label class="form-label">Description</label>
                                        <textarea name="description" id="description" rows="5" class="form-control @error('description') is-invalid @enderror" placeholder="Enter description">{{ old('description') }}</textarea>
                                        @error('description')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $message }}</strong>
                                            </span>
                                        @enderror
                                    </div>
                                </div>
                                <div class="col-md-12 col-lg-6">
                                    <div class="mb-3">
                                        <label class="form-label">Min Percentage</label>
                                        <input type="number" step="0.01" min="0" max="100" name="min_percentage" id="min_percentage" class="form-control @error('min_percentage') is-invalid @enderror" required placeholder="Enter percentage" value="{{ old('min_percentage') }}" />
                                        @error('min_percentage')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $message }}</strong>
                                            </span>
                                        @enderror
                                    </div>

                                    <div class="mb-3">
                                        <label class="form-label">Max Percentage</label>
                                        <input type="number" step="0.01" min="0" max="100" name="max_percentage" id="max_percentage" class="form-control @error('max_percentage') is-invalid @enderror" required placeholder="Enter percentage" value="{{ old('max_percentage') }}" />
                                        @error('max_percentage')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $message }}</strong>
                                            </span>
                                        @enderror
                                    </div>

                                    <div class="mb-3">
                                        <label class="form-label">Solution</label>
                                        <textarea name="solution" id="solution" rows="5" class="form-control @error('solution') is-invalid @enderror" placeholder="Enter solution">{{ old('solution') }}</textarea>
                                        @error('solution')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $message }}</strong>
                                            </span>
                                        @enderror
                                    </div>

                                    <div class="mb-3">
                                        <label class="form-label">Status</label>
                                        <select name="status" id="statusAddiction" class="form-select" required>
                                            <option value="active">Active</option>
                                            <option value="inactive">Inactive</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="mb-0 text-end">
                                <div>
                                    <button type="reset" class="btn btn-secondary waves-effect me-1">
                                        Cancel
                                    </button>
                                    <button type="submit" class="btn btn-primary waves-effect waves-light">
                                        Submit
                                    </button>
                                </div>
                            </div>
                        </form>

                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
