@extends('admin.layouts.app')
@section('panel')
<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-body p-0">
                <div class="table-responsive--sm table-responsive">
                    <table class="table table--light style--two">
                        <thead>
                            <tr>
                                <th>@lang('Name')</th>
                                <th>@lang('Status')</th>
                                <th>@lang('Action')</th>
                            </tr>
                        </thead>
                        <tbody>
                            @forelse($extensions as $extension)
                            <tr>
                                <td>
                                    <div class="user">
                                        <span class="name">{{ __($extension->name) }}</span>
                                    </div>
                                </td>
                                <td>
                                    @php echo $extension->statusBadge @endphp

                                </td>
                                <td>
                                    <div class="button--group">
                                        <button class="btn btn-outline--primary cuModalBtn btn-sm"
                                                data-modal_title="@lang('Update Extension')"
                                                data-resource="{{ $extension }}">
                                            <i class="las la-pen"></i>@lang('Edit')
                                        </button>

                                        @if($extension->status == Status::ENABLE)
                                            <button class="btn btn-sm btn-outline--danger ms-1 confirmationBtn" data-question="@lang('Are you sure to disable this extension?')" data-action="{{ route('admin.extension.domain.status',$extension->id) }}">
                                                <i class="la la-eye-slash"></i> @lang('Disable')
                                            </button>
                                        @else
                                            <button class="btn btn-sm btn-outline--success ms-1 confirmationBtn" data-question="@lang('Are you sure to enable this extension?')" data-action="{{ route('admin.extension.domain.status',$extension->id) }}">
                                                <i class="la la-eye"></i> @lang('Enable')
                                            </button>
                                        @endif
                                    </div>
                                </td>
                            </tr>
                            @empty
                                <tr>
                                    <td class="text-muted text-center" colspan="100%">{{ __($emptyMessage) }}</td>
                                </tr>
                            @endforelse

                        </tbody>
                    </table>
                </div>
            </div>
            @if($extensions->hasPages())
            <div class="card-footer py-4">
                {{ paginateLinks($extensions) }}
            </div>
            @endif
        </div>
    </div>
</div>


<div class="modal fade" id="cuModal" role="dialog" tabindex="-1">
    <div class="modal-dialog " role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title"></h5>
                <button class="close" data-bs-dismiss="modal" type="button" aria-label="Close">
                    <i class="las la-times"></i>
                </button>
            </div>
            <form action="{{ route('admin.extension.domain.store') }}" method="POST" enctype="multipart/form-data">
                @csrf
                <div class="modal-body">

                    <div class="row">
                        <div class="form-group col-md-12">
                            <label>@lang('Extension Name')</label>
                            <input type="text" class="form-control" name="name" required value="{{ old('name') }}" />
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button class="btn btn--primary w-100 h-45" type="submit">@lang('Submit')</button>
                </div>
            </form>
        </div>
    </div>
</div>

<x-confirmation-modal />

@endsection

@push('breadcrumb-plugins')
<button type="button" class="btn btn-sm btn-outline--primary cuModalBtn" data-modal_title="@lang('Add New Extension')"><i class="las la-plus"></i>@lang('Add New')
</button>

<x-search-form placeholder='Extension Name' />

@endpush
