@extends('layouts.app')
@section('page-title')
    {{ __('Option') }}
@endsection
@section('breadcrumb')
    <li class="breadcrumb-item"><a href="{{ route('dashboard') }}">{{ __('Dashboard') }}</a></li>
    <li class="breadcrumb-item" aria-current="page">{{ __('Option') }}</li>
@endsection
@section('card-action-btn')
    @if (Gate::check('manage options'))
        <a class="btn btn-secondary btn-sm ml-20 customModal" href="#" data-size="md"
            data-url="{{ route('option.create') }}" data-title="{{ __('Create Option') }}"> <i class="ti ti-circle-plus align-text-bottom"></i>
            {{ __('Create Option') }}
        </a>
    @endif
@endsection
@section('content')
    <div class="row">
        <div class="col-12">
            <div class="card table-card">
                <div class="card-header">
                    <div class="row align-items-center g-2">
                        <div class="col">
                            <h5>{{ __('Option List') }}</h5>
                        </div>
                        <div class="col-auto">
                            @if (Gate::check('manage options'))
                                <a class="btn btn-secondary  customModal" href="#" data-size="md"
                                    data-url="{{ route('option.create') }}" data-title="{{ __('Create Option') }}"> <i class="ti ti-circle-plus align-text-bottom"></i>
                                    {{ __('Create Option') }}
                                </a>
                            @endif
                        </div>
                    </div>
                </div>
                <div class="card-body pt-0">
                    <div class="dt-responsive table-responsive">
                        <table class="table table-hover advance-datatable">
                            <thead>
                                <tr>
                                    <th>{{ __('Option') }}</th>
                                    @if (Gate::check('edit options') || Gate::check('delete options'))
                                        <th>{{ __('Action') }}</th>
                                    @endif
                                </tr>
                            </thead>
                            <tbody>
                                @foreach ($options as $option)
                                    <tr>
                                        <td>{{ $option->name }} </td>
                                        @if (Gate::check('edit options') || Gate::check('delete options'))
                                            <td>
                                                <div class="cart-action">
                                                    {!! Form::open(['method' => 'DELETE', 'route' => ['option.destroy', $option->id]]) !!}
                                                    @can('edit options')
                                                        <a class="avtar avtar-xs btn-link-secondary text-secondary customModal"
                                                            data-bs-toggle="tooltip"
                                                            data-bs-original-title="{{ __('Edit') }}" href="#"
                                                            data-size="md" data-url="{{ route('option.edit', $option) }}"
                                                            data-title="{{ __('Edit Option') }}"> <i
                                                                data-feather="edit"></i></a>
                                                    @endcan
                                                    @can('delete options')
                                                        <a class=" avtar avtar-xs btn-link-danger text-danger confirm_dialog"
                                                            data-bs-toggle="tooltip"
                                                            data-bs-original-title="{{ __('Detete') }}" href="#"> <i
                                                                data-feather="trash-2"></i></a>
                                                    @endcan
                                                    {!! Form::close() !!}
                                                </div>

                                            </td>
                                        @endif

                                    </tr>
                                @endforeach

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
