@extends('layouts.admin.app')

@section('title', translate('messages.edit_color'))

@section('content')
    <div class="content container-fluid">
        <div class="page-header">
            <h1 class="page-header-title">
                <span class="page-header-icon">
                    <i class="tio-palette"></i>
                </span>
                <span>{{ translate('messages.edit_color') }}</span>
            </h1>
        </div>

        <div class="row">
            <div class="col-lg-6">
                <div class="card">
                    <div class="card-body">
                        <form action="{{ route('admin.color.update', $color->id) }}" method="post">
                            @csrf
                            <div class="form-group">
                                <label class="input-label" for="color_name">{{ translate('messages.name') }} <span class="text-danger">*</span></label>
                                <input type="text" name="name" id="color_name" class="form-control" value="{{ old('name', $color->name) }}" required>
                            </div>
                            <div class="form-group">
                                <label class="input-label" for="color_code">{{ translate('messages.color_code') }} <span class="text-danger">*</span></label>
                                <div class="d-flex gap-2">
                                    <input type="color" class="form-control p-1 max-w-80px" value="{{ old('code', $color->code) }}" onchange="document.getElementById('color_code').value = this.value.toUpperCase()">
                                    <input type="text" name="code" id="color_code" class="form-control" value="{{ old('code', $color->code) }}" required>
                                </div>
                            </div>
                            <div class="btn--container justify-content-end">
                                <a href="{{ route('admin.color.index') }}" class="btn btn--reset">{{ translate('messages.back') }}</a>
                                <button type="submit" class="btn btn--primary">{{ translate('messages.update') }}</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
