@extends('admin.layouts.app')

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

<h2 class="mb-3"> {{awtTrans('طلبات التصنيع')}}</h2>
<form action="{{ route('admin.manufacturing-request.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="dataTablemanufacturing_requests" width="100%" cellspacing="0">
                    <thead>
                        <tr>
                            <th>{{ awtTrans('Delete') }}</th>
                            <th>{{ awtTrans('Name') }}</th>
                            <th>{{ awtTrans('Email') }}</th>
                            <th>{{ awtTrans('Phone') }}</th>
                            <th>{{ awtTrans('Information') }}</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('Information') }}</th>
                            <th>{{ awtTrans('Created At') }} </th>
                            <th>{{ awtTrans('Actions') }} </th>
                        </tr>
                    </tfoot>
                    <tbody>
                        @if (!empty($manufacturing_requests))
                        @foreach ($manufacturing_requests as $manufacturing_request)
                        <tr>
                            <td><input type="checkbox" name="ids[]" value="{{ $manufacturing_request->id }}" class="from-control bluck-delete"> </td>
                            <td>{{ $manufacturing_request->name }}</td>
                            <td><a href="mailto:{{ $manufacturing_request->email }}">{{ $manufacturing_request->email }}</a></td>
                            <td><a href="tel:{{ $manufacturing_request->phone }}">{{ $manufacturing_request->phone }}</a></td>
                            <td>{{ $manufacturing_request->information }}</td>
                            <td>{{ $manufacturing_request->created_at->diffForHumans() }}</td>
                            <td>
                                <a href=" {{ route('admin.manufacturing-requests.destroy', $manufacturing_request->id) }}" data-id="{{$manufacturing_request->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() {
        $('#dataTablemanufacturing_requests').DataTable({
            manufacturing_request: [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