@extends('layout')
@section('title','Mon compte ')
@section('description','Mon compte')
@section('content')
	<br/>
	<!--=====  End of breadcrumb area  ======-->

	<!--=============================================
	=            My account page section         =
	=============================================-->

	<div class="my-account-section section position-relative mb-50 fix">
		<div class="container">
			<div class="row">
				<div class="col-12">

					<div class="row">
						@php
					$profil = DB::table('client')->where('id', $idcli)->first()->profil;
					@endphp
					

						<!-- My Account Tab Menu Start -->
						<div class="col-lg-3 col-12">
							<div class="myaccount-tab-menu nav" role="tablist">
								<a href="{{route('compte')}}"><i class="fa fa-dashboard"></i> Tableau de bord</a>
								@if ($profil == "Client/Vendeur" || $profil == "Client")
								<a href="{{route('client_commande')}}" ><i class="fa fa-cart-arrow-down"></i> Mes commandes</a>
								<a href="{{route('client_commande')}}" ><i class="fa fa-cart-arrow-down"></i> Mes paiements</a>
								@endif
								@if ($profil == "Client/Vendeur" || $profil == "Vendeur")
								<a href="{{route('mes-publications')}}" class="active"><i class="fa fa-cart-arrow-down"></i> Mes publications</a>
								@endif
								
								<a href="{{route('detail_compte')}}" ><i class="fa fa-user"></i> Détails compte</a>

								<a href="#" data-tooltip="Quick view" data-toggle="modal" data-target="#quick-view-modal-container"> <i class="fa fa-sign-out"></i> Déconnexion </a>
								
							</div>
						</div>
						<!-- My Account Tab Menu End -->

						<!-- My Account Tab Content Start -->
						<div class="col-lg-9 col-12">
							<div class="tab-content" id="myaccountContent">
								<!-- Single Tab Content Start -->
								<div class="tab-pane fade show active"  role="tabpanel">
									<div class="myaccount-content">
										<h3>Liste des produits</h3>


                    @if (session('status'))
                        <div class="alert alert-success" style="font-size: 15px; background-color: #328039; color: white">
                            <i class="ti-check"></i> {{ session('status') }}
                        </div>
                    @endif

                    @if (session('error'))
                        <div class="alert alert-danger" style="font-size: 15px; background-color: #fb5757; color: white">
                            <i class="ti-na"></i> {{ session('error') }}
                        </div>
                    @endif
                    @if ($errors->any())
                        <div class="alert alert-danger" style="font-size: 15px; background-color: #fb5757; color: white" >
                            <ul>
                                @foreach ($errors->all() as $error)
                                    <li> <i class="ti-na"></i> {{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    @endif
								
                     <div class="cart-table table-responsive mb-40">
						<table class="table">
								<thead>
									<tr>
										<th class="text-center">N°</th>
										<th class="text-center">Images</th>
										<th class="text-center">Désignation</th>
										
										
										<th class="text-center">Nouveau</th>
										<th class="text-center">Actions</th>
										
									</tr>
								</thead>
								<tbody>
								
								@foreach($prod as $prods)
								
									<tr>
									    <td class="text-center"><span>{{$loop->iteration}}</span></td>
										<td class="text-center"><a href="#"><img src="{{asset('storage/'.$prods->image_produit)}}"
													 style="height: 30px" alt=""></a></td>
										 <td class="text-center"><span>{{$prods->designation}}</span></td>
										 
										 
										 @if( $prods->nouveau == "Oui")  
										 <td><label class="badge badge-warning">{{$prods->nouveau}}</label></td>
										  @else
											<td><label class="badge badge-success">{{$prods->nouveau}}</label></td>
										  @endif
										 
										 <td class="text-center">
										 
										  <a type="button" href="{{route('nouveau_photo',['id'=>$prods->id])}}" data-toggle="tooltip" data-placement="bottom" title="Ajouter images similaires" class="btn btn-outline-warning"><i class="fa fa-image"></i> </a>
										 
										 <a type="button" href="{{route('liste_photo',['id'=>$prods->id])}}" data-toggle="tooltip" data-placement="bottom" title="Images similaires" class="btn btn-outline-primary"><i class="fa fa-list"></i> </a>
										 
										 <a type="button" href="" data-toggle="tooltip" data-placement="bottom" title="Offre sur le produit" class="btn btn-outline-success"><i class="fa fa-bell"></i> </a>
										 
										 <a type="button" href="{{route('modification_produit',['id'=>$prods->id])}}" data-toggle="tooltip" data-placement="bottom" title="Consulter & modifier" class="btn btn-outline-primary"><i class="fa fa-edit"></i> </a>
										 
										 <a type="button" href="#" data-id="{{$prods->id}}" data-toggle="tooltip" data-placement="bottom" title="Supprimer" class="btn btn-outline-danger data-supprimer"><i class="fa fa-trash-o"></i> </a>
										 
										 </td>
										
									</tr>
									
								@endforeach	
									
								</tbody>
								
							</table>
							<tfoot>
								{{ $prod->links() }}
								</tfoot>
						</div>
								
									
									</div>
								</div>
								<!-- Single Tab Content End -->

								<!-- Single Tab Content Start -->
							
								<!-- Single Tab Content End -->
							</div>
						</div>
						<!-- My Account Tab Content End -->
					</div>

				</div>
			</div>
		</div>
	</div>
  
  
  	<div class="modal fade quick-view-modal-container"  id="quick-view-modal-container" tabindex="-1" role="dialog"
		aria-hidden="true">
		<div class="modal-dialog modal-dialog-centered" role="document">
			<div class="modal-content modal-sm">
				
				<div class="modal-body">
					Voulez-vous vraiment vous déconnecter ?
				</div>
				 <div class="modal-footer bg-whitesmoke br" style="background-color:#ffffff" >
                  <button type="button" class=" btn btn-light" data-dismiss="modal">Non</button>
                      <form action="{{route('Deconnexion_client')}}" method="post" style="display: inline">
                        {{csrf_field()}}
                     
                      <button type="submit" class="btn btn-success">Oui</button>

            </form>
              </div>
			</div>

		</div>
	</div>
   
   
   
<div class="modal fade" id="Supprimermodal" >
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Suppression </h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
              <div class="modal-body">
                Voulez-vous vraiment supprimer ce produit ?
              </div>
              <div class="modal-footer bg-whitesmoke br" style="background-color:#ffffff" id="delete">
                
              </div>
            </div>
          </div>
        </div>
	
   @push('scripts')
   <script>
        $(".data-supprimer").on('click', function () {
                var id=$(this).data('id');
                $.get(location.origin+'/Produits/'+id, function (data) {
                  var html = `
            <button type="button" class=" btn btn-light" data-dismiss="modal">Non</button>
                      <form action="{{route('SupprimerprouPost')}}" method="post" style="display: inline">
                        {{csrf_field()}}
                      <input type="hidden" value="`+data.produ.id+`" name="id" >
                      <button type="submit" class="btn btn-success">Oui</button>

            </form>`
            ;
            $('#delete').html('').append(html);
          })
          $('#Supprimermodal').modal();
        });
    </script>
   
   
  
    @endpush	
	

@endsection