@extends('admin.layouts.app')
@section('title', 'Services')
@section('content')
<div class="action-bar">
    <span>{{ $services->total() }} services</span>
    <a href="{{ route('admin.services.create') }}" class="btn btn-primary">+ New Service</a>
</div>
<div class="card">
    <table>
        <tr><th>Icon</th><th>Title</th><th>Slug</th><th>Order</th><th>Active</th><th>Actions</th></tr>
        @foreach($services as $service)
        <tr>
            <td style="font-size:1.5rem">{!! $service->icon ? '<span class="icon">'.$service->icon.'</span>' : '—' !!}</td>
            <td><strong>{{ $service->title }}</strong></td>
            <td class="text-muted">{{ $service->slug }}</td>
            <td>{{ $service->order }}</td>
            <td>{!! $service->is_active ? '<span style="color:#6fcf97">Yes</span>' : '<span style="color:#e74c3c">No</span>' !!}</td>
            <td class="inline-flex">
                <a href="{{ route('admin.services.edit', $service) }}" class="btn btn-primary btn-sm">Edit</a>
                <form action="{{ route('admin.services.destroy', $service) }}" method="POST" onsubmit="return confirm('Delete?')">
                    @csrf @method('DELETE')
                    <button type="submit" class="btn btn-danger btn-sm">Delete</button>
                </form>
            </td>
        </tr>
        @endforeach
    </table>
    <div class="pagination">{{ $services->links() }}</div>
</div>
@endsection
