@extends('employee.layouts.app')
@section('title', 'Buat Aturan | Career Development and Consultation (CDC)')
@section('navigation')
    <h1 class="my-1 d-flex align-items-center text-dark fw-bolder fs-3">Aturan
        <span class="mx-2 border-gray-200 h-20px border-start ms-3"></span>
        <small class="my-1 text-muted fs-7 fw-bold ms-1">Buat Aturan</small>
    </h1>
@endsection
@section('content')
    <div class="card">
        <div class="pt-4 border card-body">
            <form action="{{ route('rules.store') }}" method="POST" class="form" autocomplete="off">
                @csrf
                <div class="pt-4 mb-8 d-flex flex-column fv-row">
                    <label class="mb-2 d-flex align-items-center fs-6 fw-bold">
                        <span class="required">Kode</span>
                        <i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip"
                            title="Kode aturan dibuat secara otomatis"></i>
                    </label>
                    <input type="text" class="form-control form-control-solid" placeholder="Kode" name="rule_code"
                        value="{{ $generateRuleCode }}" readonly />
                    @error('rule_code')
                        <div class="fv-plugins-message-container invalid-feedback">
                            <span>{{ $message }}</span>
                        </div>
                    @enderror
                </div>
                <div class="pt-4 mb-8 d-flex flex-column fv-row">
                    <label class="mb-2 d-flex align-items-center fs-6 fw-bold">
                        <span class="required">Statemen</span>
                        <i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip"
                            title="Statemen/pernyataan"></i>
                    </label>
                    <select class="form-select form-select-solid" data-control="select2" name="statement_id"
                        data-placeholder="Silahkan pilih statemen">
                        <option></option>
                        @foreach ($statements as $statement)
                            <option value="{{ $statement->id }}">
                                [{{ $statement->statement_code }}]
                                {{ $statement->statement }}
                            </option>
                        @endforeach
                    </select>
                    @error('statement_id')
                        <div class="fv-plugins-message-container invalid-feedback">
                            <span>{{ $message }}</span>
                        </div>
                    @enderror
                </div>
                <div class="pt-4 mb-8 d-flex flex-column fv-row">
                    <label class="mb-2 d-flex align-items-center fs-6 fw-bold">
                        <span class="required">Tipe Kepribadian</span>
                        <i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip"
                            title="Tipe kepribadian merujuk pada statemen"></i>
                    </label>
                    <select class="form-select form-select-solid" data-control="select2" name="personality_id"
                        data-placeholder="Silahkan pilih tipe kepribadian">
                        <option></option>
                        @foreach ($personalities as $personality)
                            <option value="{{ $personality->id }}">
                                [{{ $personality->personality_code }}]
                                {{ $personality->personality }}
                            </option>
                        @endforeach
                    </select>
                    @error('personality_id')
                        <div class="fv-plugins-message-container invalid-feedback">
                            <span>{{ $message }}</span>
                        </div>
                    @enderror
                </div>
                <div class="pt-4 mb-8 d-flex flex-column fv-row">
                    <label class="mb-2 d-flex align-items-center fs-6 fw-bold">
                        <span class="required">Nilai bobot</span>
                        <i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip"
                            title="Nilai bobot merujuk pada statemen dan tipe kepribadian"></i>
                    </label>
                    <select class="form-select form-select-solid" data-control="select2" name="weight_id"
                        data-placeholder="Silahkan pilih nilai bobot">
                        <option></option>
                        @foreach ($weights as $weight)
                            <option value="{{ $weight->id }}">
                                {{ $weight->weight }}
                            </option>
                        @endforeach
                    </select>
                    @error('weight_id')
                        <div class="fv-plugins-message-container invalid-feedback">
                            <span>{{ $message }}</span>
                        </div>
                    @enderror
                </div>
                <div class="d-flex justify-content-end">
                    <a href="{{ route('rules') }}" class="btn btn-light btn-active-light-primary me-2">Kembali</a>
                    <button type="submit" class="btn btn-primary">Simpan</button>
                </div>
            </form>
        </div>
    </div>
@endsection
