@extends('layouts.admin')
@section('content')
<!-- [ breadcrumb ] start -->
<div class="page-header">
    <div class="page-block">
        <div class="row align-items-center">
            <div class="col-md-12">
                <ul class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{ route('admin.dashboard') }}">হোম</a></li>
                    <li class="breadcrumb-item"><a href="javascript: void(0)">সংগঠন</a></li>
                    <li class="breadcrumb-item" aria-current="page">Divisions</li>
                </ul>
            </div>
            <div class="col-md-12">
                <div class="page-header-title">
                    <h2 class="mb-0">{{ __('Divisions') }}</h2>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- [ breadcrumb ] end -->

<div class="row mb-3">
    <div class="col-lg-12 text-end">
        <a class="btn btn-primary text-white" href="{{ route('division.create') }}">
            <i class="ti ti-plus me-1"></i> {{ __('Add New Division') }}
        </a>
    </div>
</div>

<div class="card tbl-card">
    <div class="card-header">
        <h5>{{ __('Divisions List') }}</h5>
    </div>
    <div class="card-body">
        @include('includes.admin.form-success')
        <div class="table-responsive">
            <table class="table table-hover table-borderless mb-0" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>{{ __('Name') }}</th>
                        <th>{{ __('Language') }}</th>
                        <th>{{ __('Actions') }}</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($divisions as $key => $division)
                    <tr>
                        <td>{{ $key + 1 }}</td>
                        <td>{{ $division->name }}</td>
                        <td>{{ $division->language->name ?? 'N/A' }}</td>
                        <td>
                            <a href="{{ route('division.edit', $division->id) }}" class="btn btn-sm btn-light-primary"><i class="ti ti-edit"></i></a>
                            <form action="{{ route('division.destroy', $division->id) }}" method="POST" style="display:inline;" onsubmit="return confirm('Are you sure?')">
                                @csrf @method('DELETE')
                                <button type="submit" class="btn btn-sm btn-light-danger"><i class="ti ti-trash"></i></button>
                            </form>
                        </td>
                    </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
    </div>
</div>
@endsection
