@extends('layouts.master')
@section('title', 'Detail 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">Detail 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">Detail Addiction</h4>
                        <form class="custom-validation" action="{{ route('admin.addictions.update', $addiction->id) }}" method="POST" enctype="multipart/form-data" id="update-user-form') }}" method="POST" enctype="multipart/form-data">
                            @csrf
                            @method('PUT')
                            <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" disabled placeholder="Enter code" value="{{ old('code', $addiction->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" disabled placeholder="Enter name" value="{{ old('name', $addiction->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('password') is-invalid @enderror" placeholder="Enter description" disabled>{{ old('description', $addiction->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" disabled placeholder="Enter percentage" value="{{ old('min_percentage', $addiction->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" disabled placeholder="Enter percentage" value="{{ old('max_percentage', $addiction->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">Status</label>
                                        <select name="status" id="statusAddiction" class="form-select" disabled>
                                            <option value="active" {{ $addiction->status == 'active' ? 'selected' : '' }}>Active</option>
                                            <option value="inactive" {{ $addiction->status == 'inactive' ? 'selected' : '' }}>Inactive</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </form>

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