@extends('admin.layouts.app')

@section('content')
@if (session('employment_application_action_msg'))
<div class="alert alert-success">
    {{ session('employment_application_action_msg') }}
</div>
@endif

<h2 class="mb-3"> {{awtTrans('طلبات التوظيف')}}</h2>
<form action="{{ route('admin.employment-application.bluck-delete') }}" method="post">
    @csrf
    <div class="card shadow mb-4">
        <div class="card-header py-3">
            <h6 class="m-0 font-weight-bold text-primary text-left">
                <button type="submit" style="display: none;" title="{{ awtTrans('delete') }}" class="btn btn-danger bluck-button btn-circle btn-sm">
                    <i class="fas fa-trash"></i>
                </button>
            </h6>
        </div>
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-bordered table-striped" id="dataTableemployment_applications" width="100%" cellspacing="0">
                    <thead>
                        <tr>
                            <th>{{ awtTrans('Delete') }}</th>
                            <th>{{ awtTrans('Name') }}</th>
                            <th>{{ awtTrans('Email') }}</th>
                            <th>{{ awtTrans('Phone') }}</th>
                            <th>{{ awtTrans('Cv') }}</th>
                            <th>{{ awtTrans('Created At') }} </th>
                            <th>{{ awtTrans('Actions') }} </th>
                        </tr>
                    </thead>
                    <tfoot>
                        <tr>
                            <th>{{ awtTrans('Delete') }}</th>
                            <th>{{ awtTrans('Name') }}</th>
                            <th>{{ awtTrans('Email') }}</th>
                            <th>{{ awtTrans('Phone') }}</th>
                            <th>{{ awtTrans('Cv') }}</th>
                            <th>{{ awtTrans('Created At') }} </th>
                            <th>{{ awtTrans('Actions') }} </th>
                        </tr>
                    </tfoot>
                    <tbody>
                        @if (!empty($employment_applications))
                        @foreach ($employment_applications as $employment_application)
                        <tr>
                            <td><input type="checkbox" name="ids[]" value="{{ $employment_application->id }}" class="from-control bluck-delete"> </td>
                            <td>{{ $employment_application->name }}</td>
                            <td>{{ $employment_application->email }}</td>
                            <td>{{ $employment_application->phone }}</td>
                            <td><a href="{{ url($employment_application->cv) }}" target="_blank">{{ $employment_application->cv }}</a></td>
                            <td>{{ $employment_application->created_at->diffForHumans() }}</td>
                            <td>
                                <a href=" {{ route('admin.employment-applications.destroy', $employment_application->id) }}" data-id="{{$employment_application->id}}" class="btn btn-danger btn-circle btn-sm item-delete">
                                    <i class="fas fa-trash"></i>
                                </a>
                            </td>
                        </tr>
                        @endforeach
                        @endif
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</form>
@endsection


@section('scripts')
<script>
    $(document).ready(function() {
        $('#dataTableemployment_applications').DataTable({
            employment_application: [0, 'desc'],
            'language': {
                'url': "{{ app()->getLocale() == 'ar' ? 'https://cdn.datatables.net/plug-ins/1.10.12/i18n/Arabic.json' : 'https://cdn.datatables.net/plug-ins/1.10.12/i18n/English.json' }}",
            },
        });
    });
</script>
@endsection