@extends('layouts.master')
@section('css')
    @toastr_css
@section('title')
{{ trans('Report_trans.title_page') }} - {{ trans('Certificat_trans.Certificates') }}
@stop
@endsection
@section('page-header')
<!-- breadcrumb -->
<div class="page-title">
    <div class="row">
        <div class="col-sm-6">
            <h4 class="mb-0"> {{ trans('Certificat_trans.reports') }} / {{ trans('Certificat_trans.print_certificat') }}</h4>
        </div>
        <div class="col-sm-6">
            <ol class="breadcrumb pt-0 pr-0 float-left float-sm-right ">
                <li class="breadcrumb-item"><a href="#" class="default-color">{{ trans('main_trans.Dashboard') }}</a></li>
                <li class="breadcrumb-item active"> {{ trans('Certificat_trans.reports') }} </li>
            </ol>
        </div>
    </div>
</div>
<!-- breadcrumb -->
@endsection
@section('content')
<!-- row -->
<div class="row">

    <div class="col-md-12 mb-30">
        <div class="card card-statistics h-100">
            <div class="card-body">

                @if ($errors->any())
                    <div class="alert alert-danger">
                        <ul>
                            @foreach ($errors->all() as $error)
                                <li>{{ $error }}</li>
                            @endforeach
                        </ul>
                    </div>
                @endif


                <br><br> 
            </a>
                <div class="table-responsive">
                    <table id="datatable" class="table table-striped table-bordered p-0">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th> {{ trans('Certificat_trans.language') }}</th>
                                <th>{{ trans('Certificat_trans.First_name') }}</th>
                                <th> {{ trans('Certificat_trans.Second_name') }}</th>
                                <th>{{ trans('Certificat_trans.Third_name') }}</th>
                                <th>{{ trans('Certificat_trans.Last_name') }}</th>
                                <th>{{ trans('Depts_trans.Name_Dept') }}</th>
                                <th>{{ trans('Certificat_trans.certificat_type') }}</th>
                                <th>{{ trans('Depts_trans.Processes') }}</th>
                            </tr>
                        </thead>
                        <tboby>
                            @foreach ($certificats as $index => $certificat)
                                <tr>
                                    
                                    <td>{{ $index + 1 }}</td>
                                    <td>
                                        @if ($certificat->lang ==["11"])
                                        {{ trans('Certificat_trans.Arabic') }}
                                        @elseif ($certificat->lang == ["21"])
                                        {{ trans('Certificat_trans.English') }}
                                        @elseif ($certificat->lang == ["21","21"])
                                        {{ trans('Certificat_trans.English') }}
                                        @elseif ($certificat->lang == ["11","11"])
                                        {{ trans('Certificat_trans.Arabic') }}
                                        @else
                                        {{ trans('Certificat_trans.Arabic') }} - {{ trans('Certificat_trans.English') }}
                                        @endif
                                    </td>
                                   
                                    @if (isset($certificat->first_name[0]) && !isset($certificat->first_name[1]))
                                    <td> {{ $certificat->first_name[0] }}</td>
                                    @elseif(isset($certificat->first_name[0]) && isset($certificat->first_name[1]))
                                    <td> {{ $certificat->first_name[0] }} - {{ $certificat->first_name[1] }}</td>
                                    @elseif(!isset($certificat->first_name[0]) && isset($certificat->first_name[1]))
                                    <td> {{ $certificat->first_name[1] }}</td>
                                    @endif

                                    @if (isset($certificat->second_name[0]) && !isset($certificat->second_name[1]))
                                    <td> {{ $certificat->second_name[0] }}</td>
                                    @elseif(isset($certificat->second_name[0]) && isset($certificat->second_name[1]))
                                    <td> {{ $certificat->second_name[0] }} - {{ $certificat->second_name[1] }}</td>
                                    @elseif(!isset($certificat->second_name[0]) && isset($certificat->second_name[1]))
                                    <td> {{ $certificat->second_name[1] }}</td>
                                    @elseif(!isset($certificat->second_name[0]) && isset($certificat->second_name[1]))
                                    <td> {{ $certificat->second_name[1] }}</td>
                                    @endif

                                    @if (isset($certificat->midell_name[0]) && !isset($certificat->midell_name[1]))
                                    <td> {{ $certificat->midell_name[0] }}</td>
                                    @elseif(isset($certificat->midell_name[0]) && isset($certificat->midell_name[1]))
                                    <td> {{ $certificat->midell_name[0] }} - {{ $certificat->midell_name[1] }}</td>
                                    @elseif(!isset($certificat->midell_name[0]) && isset($certificat->midell_name[1]))
                                    <td> {{ $certificat->midell_name[1] }}</td>
                                    @endif

                                    @if (isset($certificat->last_name[0]) && !isset($certificat->last_name[1]))
                                    <td> {{ $certificat->last_name[0] }}</td>
                                    @elseif(isset($certificat->last_name[0]) && isset($certificat->last_name[1]))
                                    <td> {{ $certificat->last_name[0] }} - {{ $certificat->last_name[1] }}</td>
                                    @elseif(!isset($certificat->last_name[0]) && isset($certificat->last_name[1]))
                                    <td> {{ $certificat->last_name[1] }}</td>
                                    @endif
                                    <td >{{ $certificat->dept->name }}</td>
                                    <td>
                                        @if ($certificat->certificat_type == ["1"])
                                        {{ trans('Certificat_trans.Details') }}
                                        @elseif ($certificat->certificat_type == ["2"])
                                        {{ trans('Certificat_trans.Regular') }}
                                        @else
                                                {{ trans('Certificat_trans.Regular') }} - {{ trans('Certificat_trans.Details') }}
                                        @endif
                                    </td>
                                   <td width="150">
                                       <a href="{{ route('certificats.show', encrypt($certificat->id)) }}">
                                        <button  type="button" class="btn btn-success btn-sm" data-toggle="modal"
                                        
                                        title="{{ trans('Certificat_trans.show') }}"><i
                                            class="fa fa-eye"> {{ trans('Certificat_trans.show') }}</i></button>
                                       </a>
                                       <a href="{{ url('Printcertificat', $certificat->id) }}">
                                        <button  type="button" class="btn btn-info btn-sm" data-toggle="modal"
                                        
                                        title="{{ trans('Certificat_trans.print') }}"><i
                                            class="fa fa-print"> {{ trans('Certificat_trans.print') }}</i></button>
                                       </a>
                                   </td>
                                 
                                    {{-- <td>
                                        @if ($certificat->lang ==["11"])
                                        {{ trans('Certificat_trans.Arabic') }}
                                        @elseif ($certificat->lang == ["21"])
                                        {{ trans('Certificat_trans.English') }}
                                        @else
                                        {{ trans('Certificat_trans.Arabic') }} - {{ trans('Certificat_trans.English') }}
                                        @endif
                                    </td>
                                    <td>
                                        @if ($certificat->certificat_type == ["1"])
                                        {{ trans('Certificat_trans.Details') }}
                                        @elseif ($certificat->certificat_type == ["2"])
                                        {{ trans('Certificat_trans.Regular') }}
                                        @else
                                                {{ trans('Certificat_trans.Regular') }} - {{ trans('Certificat_trans.Details') }}
                                        @endif
                                    </td> --}}
                                    {{-- <td>{{ $certificat->certificat_number }}</td>
                                    <td>{{ $certificat->notification_number }}</td>
                                    <td>{{ $certificat->amount }}</td> --}}
                                    {{-- @can('المالية')
                                    <td>
                                        @if ($certificat->f_status == '0')
                                            <span class="label text-info">
                                                 {{ trans('Statment_trans.processing') }}
                                            </span>
                                        @elseif ($certificat->f_status == '1')
                                        <span class="label text-success">
                                            {{ trans('Statment_trans.complate') }}
                                        </span>
                                        @else
                                        <span class="label text-danger">
                                            {{ trans('Statment_trans.reject') }}
                                        </span>
                                        @endif
                                    </td>
                                    @endcan
                                    @can('النتيجة')
                                    <td>
                                        @if ($certificat->r_status == '0')
                                            <span class="label text-info">
                                                 {{ trans('Statment_trans.processing') }}
                                            </span>
                                        @elseif ($certificat->r_status == '1')
                                        <span class="label text-success">
                                            {{ trans('Statment_trans.complate') }}
                                        </span>
                                        @else
                                        <span class="label text-danger">
                                            {{ trans('Statment_trans.reject') }}
                                        </span>
                                        @endif
                                    </td>
                                    @endcan --}}
                                </tr>

                            @endforeach


                        </tboby>
                    </table>
                </div>
            </div>
        </div>
    </div>

</div>
<!-- row closed -->
@endsection
@section('js')
@toastr_js
@toastr_render
@endsection
