@extends('layout')

@section('title', __('admin/modules.dummyproduct_view_test2_title'))

@section('content')
<div class="container py-5">
    <div class="mb-4">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="{{ route('store.auth.dashboard') }}">{{ __('store.clientarea_nav_dashboard') }}</a></li>
                <li class="breadcrumb-item"><a href="{{ route('store.auth.services') }}">{{ __('store.clientarea_nav_services') }}</a></li>
                <li class="breadcrumb-item"><a href="{{ route('store.auth.services.details', $service->id) }}">{{ $service->product->name ?? __('store.service') }}</a></li>
                <li class="breadcrumb-item active">{{ $actionConfig['label'] }}</li>
            </ol>
        </nav>
    </div>

    <div class="row">
        {{-- Main Content --}}
        <div class="col-lg-8">
            <div class="card">
                <div class="card-header bg-success text-white">
                    <h4 class="mb-0">
                        <i class="{{ $actionConfig['icon'] }} me-2"></i>{{ $actionConfig['label'] }}
                    </h4>
                </div>
                <div class="card-body">
                    @if($errors->any())
                        <div class="alert alert-danger">
                            <ul class="mb-0">
                                @foreach($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    @endif

                    <div class="alert alert-success">
                        <i class="fas fa-info-circle me-2"></i>
                        <strong>Bilgi:</strong> Bu bir test işlemidir. Girdiğiniz sayı 2 ile çarpılarak geri döndürülecektir.
                    </div>

                    <form action="{{ route('store.auth.services.action.handle', [$service->id, 'test2']) }}" method="POST">
                        @csrf

                        <div class="mb-3">
                            <label for="value" class="form-label">Sayı Değeri</label>
                            <input type="number"
                                   class="form-control @error('value') is-invalid @enderror"
                                   id="value"
                                   name="value"
                                   placeholder="Bir sayı girin..."
                                   step="0.01"
                                   required>
                            @error('value')
                                <div class="invalid-feedback">{{ $message }}</div>
                            @enderror
                            <div class="form-text">Bu sayı 2 ile çarpılacaktır.</div>
                        </div>

                        <div class="mb-3">
                            <label class="form-label">Hizmet Bilgileri</label>
                            <div class="card ">
                                <div class="card-body">
                                    <div class="row">
                                        <div class="col-md-6">
                                            <strong>Kullanıcı Adı:</strong> {{ $service->username }}
                                        </div>
                                        <div class="col-md-6">
                                            <strong>Domain:</strong> {{ $service->domain ?? 'N/A' }}
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="d-flex gap-2">
                            <button type="submit" class="btn btn-success">
                                <i class="fas fa-calculator me-2"></i>Hesapla
                            </button>
                            <a href="{{ route('store.auth.services.details', $service->id) }}" class="btn btn-outline-secondary">
                                <i class="fas fa-times me-2"></i>İptal
                            </a>
                        </div>
                    </form>
                </div>
            </div>

            <div class="card mt-4">
                <div class="card-header">
                    <h6 class="mb-0"><i class="fas fa-lightbulb me-2"></i>Örnek Kullanım</h6>
                </div>
                <div class="card-body">
                    <p class="mb-0">
                        5 girerseniz, sonuç 10 olarak döner.<br>
                        12.5 girerseniz, sonuç 25 olarak döner.
                    </p>
                </div>
            </div>
        </div>

        {{-- Sidebar --}}
        <div class="col-lg-4">
            @php $currentAction = $action; @endphp
            @include('clientarea.services.partials.module-actions-sidebar')
        </div>
    </div>
</div>
@endsection
