@extends('admin.layouts.app')

@section('content')


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

@if (session('manufacturing_stage_action_success_msg'))
<div class="alert alert-danger">
    {{ session('manufacturing_stage_action_success_msg') }}
</div>
@endif



<h2 class="mb-3">{{awtTrans('All Manufacturing Stages')}}</h2>
<form action="{{ route('admin.manufacturing-stage.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>
                <a href="{{ route('admin.manufacturing-stages.create') }}" title="{{ awtTrans('add') }}" class="btn btn-primary btn-circle btn-sm">
                    <i class="fas fa-plus"></i>
                </a>
            </h6>
        </div>
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-bordered table-striped" id="dataTablemanufacturing-stages" width="100%" cellspacing="0">
                    <thead>
                        <tr>
                            <th>{{ awtTrans('Delete') }}</th>
                            <th>{{ awtTrans('Title Arabic') }}</th>
                            <th>{{ awtTrans('Title English') }}</th>
                            <th>{{ awtTrans('Image') }}</th>
                            <th>{{ awtTrans('Created At') }} </th>
                            <th>{{ awtTrans('Actions') }} </th>
                        </tr>
                    </thead>
                    <tfoot>
                        <tr>
                            <th>{{ awtTrans('Delete') }}</th>
                            <th>{{ awtTrans('Title Arabic') }}</th>
                            <th>{{ awtTrans('Title English') }}</th>
                            <th>{{ awtTrans('Image') }}</th>
                            <th>{{ awtTrans('Created At') }} </th>
                            <th>{{ awtTrans('Actions') }} </th>
                        </tr>
                    </tfoot>
                    <tbody>
                        @if (!empty($manufacturing_stages))
                        @foreach ($manufacturing_stages as $service)
                        <tr>
                            <td><input type="checkbox" name="ids[]" value="{{ $service->id }}" class="from-control bluck-delete"> </td>
                            <td><a href="{{ route('admin.manufacturing-stages.edit', $service->id) }}">{{ $service->title_ar }}</a></td>
                            <td><a href="{{ route('admin.manufacturing-stages.edit', $service->id) }}">{{ $service->title_en }}</a></td>
                            <td><img height="44" src="{{  $service->photo }}" alt=""></td>
                            <td>{{ $service->created_at->diffForHumans() }}</td>
                            <td>
                                <a href=" {{ route('admin.manufacturing-stages.destroy', $service->id) }}" data-id="{{$service->id}}" class="btn btn-danger btn-circle btn-sm item-delete">
                                    <i class="fas fa-trash"></i>
                                </a>
                                <a href="#" class="btn btn-info btn-circle btn-sm" data-toggle="modal" data-target="#exampleModalLong{{$service->id}}">
                                    <i class="fas fa-eye"></i>
                                </a>
                                <a href="{{ route('admin.manufacturing-stages.edit', $service->id) }}" class="btn btn-success btn-circle btn-sm">
                                    <i class="fas fa-edit"></i>
                                </a>
                            </td>
                        </tr>
                        <!-- Modal -->
                        <div class="modal fade" id="exampleModalLong{{$service->id}}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <h5 class="modal-title" id="exampleModalLongTitle">{{ awtTrans('Details') }}</h5>
                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                            <span aria-hidden="true">&times;</span>
                                        </button>
                                    </div>
                                    <div class="modal-body">
                                        <div class="row">
                                            <div class="col-lg-12">
                                                <div class="row">
                                                    <div class="col-lg-5">
                                                        <b>{{ awtTrans('Name Arabic') }} : </b>
                                                    </div>
                                                    <div class="col-lg-7">
                                                        {{$service->title_ar}}
                                                    </div>
                                                </div>
                                                <div class="row">
                                                    <div class="col-lg-5">
                                                        <b>{{ awtTrans('Name English') }} : </b>
                                                    </div>
                                                    <div class="col-lg-7">
                                                        {{$service->title_en}}
                                                    </div>
                                                </div>

                                                <div class="row">
                                                    <div class="col-lg-5">
                                                        <b>{{ awtTrans('Image') }} : </b>
                                                    </div>
                                                    <div class="col-lg-7">
                                                        <img height="44" src="{{ $service->photo }}" alt="">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-primary" data-dismiss="modal">{{ awtTrans('إغلاق') }}</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        @endforeach
                        @endif
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</form>

@endsection

@section('scripts')
<script>
    $(document).ready(function() {
        $('#dataTablemanufacturing-stages').DataTable({
            order: [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