@extends('usuarios.clientes.master.layoutcliente')
@section('conteudo')
<script src="{{asset('js/jquery.dataTables.min.js') }}"></script>
{{-- SELECT STYLE --}}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css">
@php $i=1; @endphp

    <div class="container-fluid">
        <div class="page-header">
            <div class="row align-items-end">
                <div class="col-lg-8">
                    <div class="page-header-title">
                           <div class="card-body"> 
                            <a  href="{{route('us.admin.cliente.GestSolicitacao.solicitacao.destruicao')}}"><i class="ik ik-trash bg-danger"></i><h4> Criar Nova Solicitação</h4></a>
                            
                        </div>
                        <div class="d-inline">
                           
                            
                        </div>
                    </div>
                </div>
                <div class="col-lg-4">
                    <nav class="breadcrumb-container" aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item">
                                <a href="../index.html"><i class="ik ik-home"></i></a>
                            </li>
                            <li class="breadcrumb-item">
                                <a href="#">Listar</a>
                            </li>
                            <li class="breadcrumb-item active" aria-current="page">solicitações Destruições</li>
                        </ol>
                    </nav>
                </div>
            </div>
        </div>

        <div class="page-header" width="100%">
            <div class="row align-items-end">
                <div class="col-lg-6">
                    @can('clientes_view','cadastar funcionarios')
                    <div class="page-header-title">

                        <div class="">
                                <a data-toggle="modal" href="#demoModal"><i class="ik ik-plus bg-blue"></i><h4>Novo</h4></a>
                            <div class="d-inline">
                           </div>
                       </div>


                    </div>
                    @endcan

                </div>
            </div>

        </div>


                               
        @if(session()->has('sucessoFuncioanrio'))
        <script type="text/javascript">     
                $(document).ready(function()
                    {
                    const Toast = Swal.mixin({
                                    toast: true,
                                    position: 'top-end',
                                    showConfirmButton: false,
                                    timer: 5500,
                                    timerProgressBar: false,
                                
                                    });

                                    Toast.fire({
                                    icon: 'success',
                                    title: 'Eliminado com sucesso',
                                        });
                    });
        </script>
        @endif

        <div class="row">
            <div class="col-md-12">
                <div class="card">
                    <div class="card-body"> 
                        <div class="table-responsive">
                                        <table id="example1" class="table container  table-striped table-hover">
                            <thead>
                                <tr>
                                   
                                    <th>Funcionário</th>
                                    <th>Categoria</th>
                                    <th>Tema</th>
                                    <th>Número</th>
                                    <th>tipoDocumento</th>
                                    <th>Data Envio</th>
                                    <th>Estado</th>
                                    <th>Ver files</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach($dados as $dado)
                                <tr>

                                    @php $meu_nome=\App\Models\Cliente::find($dado->cliente_id)->getUser->getPessoa; @endphp
                                    <td>{{$dado->nome}}</td>
                                    <td>{{$dado->categoriacliente}}</td>
                                    <td>{{$dado->assuntosolicitacao}}</td>
                                    <td>{{$dado->numerosocilitacao}}</td>
                                    <td>{{$dado->tipodocumentosolicitacao}}</td>
                                    <td>{{$dado->created_at}}</td>
                                    <td>Espera</td>
                                    
                                       <td>
                                                    {{--<a href="{{route('us.admin.cliente.Gestfuncionario.funcionario.show',$dado->id)}}" class="btn btn-sm btn-outline-success"> <i class="fa fa-eye"></i></a>--}}
                                                    
                                                        @php 
                                                    //use Illuminate\Support\Facades\Crypt;
                                                  
                                                    try {
                                                         
                                                    $decrypted =Crypt::encryptString($dado->id);
                                                     
                                                    } catch (DecryptException $e) {
                                                        $decrypted=0;
                                                    }  
                                                    
                                                    @endphp
                                                    <form  action="{{route('us.admin.cliente.exibir.solictacao.index')}}" method="post">
                                                        @csrf
                                                        <input type="text" value="{{$decrypted}}" hidden  name="meufile_solcitacao" >
                                                        <button  class="btn btn-sm btn-outline-success" type="submit"> <i class="fa fa-eye"></i></button>
                                                    </form>
                                                
                                                
                                                </td>
                                </tr>
                                @endforeach
                             
                            </tbody>
                        </table>
                        </div>
                    </div>
                </div>
            </div>
        
        </div>
        
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/js/bootstrap-select.min.js"></script>

<!-- (Optional) Latest compiled and minified JavaScript translation files -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/js/i18n/defaults-*.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.js"></script>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@10"></script>

<script>
 
    $(function () {
        $("#example1").DataTable();
        $('#example2').DataTable({
            "paging": true,
            "lengthChange": false,
            "searching": true,
            "ordering": true,
            "info": true,
            "autoWidth": false,
        });
    });
    </script>

    <script>
            $(function () {
                $("#tabela").DataTable();
                $('#example2').DataTable({
                    "paging": true,
                    "lengthChange": false,
                    "searching": false,
                    "ordering": true,
                    "info": true,
                    "autoWidth": true,
                });
            });

  </script>

@endsection