@extends('layouts.master')
@section('title', 'Detail Item')
@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.items.index') }}">Items</a></li>
                <li class="breadcrumb-item active" aria-current="page">Detail Item</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 Item</h4>
                        <form class="custom-validation" action="{{ route('admin.items.update', $item->id) }}" 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">Factor</label>
                                        <select name="factor_id" id="factor_id" class="form-select" disabled>
                                            <option value="" hidden>Select Factor</option>
                                            @foreach ($factors as $factor)
                                                <option value="{{ $factor->id }}" {{ $item->factor_id == $factor->id ? 'selected' : '' }}>{{ $factor->name }}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                    <div class="mb-3">
                                        <label class="form-label">Item</label>
                                        <input type="text" name="code" id="code" class="form-control @error('code') is-invalid @enderror" disabled placeholder="Enter item" value="{{ old('code', $item->code) }}" />
                                        @error('code')
                                            <span class="invalid-feedback" role="alert">
                                                <strong>{{ $message }}</strong>
                                            </span>
                                        @enderror
                                    </div>
                                    <div class="mb-3">
                                        <label class="form-label">Value</label>
                                        <input type="number" step="0.01" min="0" name="value" id="value" class="form-control @error('value') is-invalid @enderror" disabled placeholder="Enter vakue" value="{{ old('vakue', $item->value) }}" />
                                        @error('value')
                                            <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">Item Content</label>
                                        <textarea name="content" id="content" rows="5" class="form-control @error('content') is-invalid @enderror" placeholder="Enter content" disabled>{{ old('content', $item->content) }}</textarea>
                                        @error('content')
                                            <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="statusItem" class="form-select" disabled>
                                            <option value="active" {{ $item->status == 'active' ? 'selected' : '' }}>Active</option>
                                            <option value="inactive" {{ $item->status == 'inactive' ? 'selected' : '' }}>Inactive</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </form>

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