@extends('layout_admin')
@section('title','Paiements ')
@section('description','Liste des transactions')
@section('content')

	<!--=====  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">

						<!-- My Account Tab Menu Start -->
						<div class="col-lg-3 col-12">
							<div class="myaccount-tab-menu nav" role="tablist" data-layout="horizontale">
								<a href="{{route('Accueil_admin')}}"  ><i class="fa fa-dashboard"></i>
									Tableau de bord</a>

								<a href="{{route('Nouvelle_information')}}"  ><i class="fa fa-edit"></i> Enregistrer information</a>
								<a href="{{route('nouveau_fournisseur')}}"><i class="fa fa-edit"></i> Nouveau fournisseur </a>
								<a href="{{route('Nouveau_categorie')}}" ><i class="fa fa-edit"></i> Enregistrer catégorie</a>
								
								<a href="{{route('Nouveau_produit')}}" ><i class="fa fa-edit"></i> Enregistrer produit</a>

								<a href="{{route('Liste_information')}}" ><i class="fa fa-info"></i> Liste des informations</a>

								<a href="{{route('Liste_categorie')}}"  ><i class="fa fa-map-marker"></i> Liste des catégories</a>

								<a href="{{route('Liste_produit')}}"   ><i class="fa fa-shopping-bag"></i> Liste des produits</a>
								
								<a href="{{route('liste_client')}}"  ><i class="fa fa-users"></i> Liste des clients</a>

								<a href="{{route('liste_commande')}}" ><i class="fa fa-cart-arrow-down"></i> Liste des commandes</a>
								
								<a href="{{route('liste_transaction')}}" class="active"><i class="fa fa-money"></i> Liste des transactions</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 transactions</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">{{ __('messages.ref') }}</th>
										<th class="text-center">{{ __('messages.no') }}</th>
										<th class="text-center">{{ __('messages.amo') }}</th>
										<th class="text-center">{{ __('messages.ddp') }}</th>
										<th class="text-center">{{ __('messages.stat') }}</th>
										<th class="text-center">{{ __('messages.mopai') }}</th>
										
									</tr>
								</thead>
								<tbody>
								
								@foreach($paie as $paies)
								
								  @php 
										  
										    $ref = DB::table('commande')->where('id', $paies->commande_id)->first()->reference;
											
										    $dc = DB::table('commande')->where('id', $paies->commande_id)->first()->datecmde;
											
											
										  @endphp
								
									<tr>
									    <td class="text-center"><span>{{$loop->iteration}}</span></td>
										
										 <td class="text-center"><span>{{$ref}}</span></td>
										 
										 <td class="text-center"><span>{{$paies->nom}}</span></td>
										 
										 <td class="text-center"><span>{{$paies->montant}} USD</span></td>
										  
										  <td class="text-center"> {{ implode('/', array_reverse(explode('-', $paies->datepaie))) }} - {{ implode('/', array_reverse(explode('-', $paies->heurepaie))) }} </td>
										 
									        <td class="text-center">
												
												@if($paies->status == "Terminé" )
										  
										          <span style="padding:7px; border-radius:15px; color:white" class="bg bg-success"> {{$paies->status}} </span>
												  
												@else
													
												   <span style="padding:7px; border-radius:15px; color:white" class="bg bg-warning"> {{$paies->status}} </span>
												   
												@endif
										  
										  </td> 
										  
										  <td class="text-center">
												
												@if($paies->payment == "Virement bancaire" )
										  
										          <span style="padding:7px; border-radius:15px; color:white" class="bg bg-warning"> Virement </span>
												  
												@elseif($paies->payment == "Stripe" )
													
												  <span style="background-color: #dc3545; padding:7px; border-radius:15px; color:white" > {{$paies->payment}} </span>
												  
										        @elseif($paies->payment == "Paypal" )
													
												  <span style="padding:7px; border-radius:15px; color:white" class="bg bg-primary"> {{$paies->payment}} </span>
												  
												@else
													
												   <span style="background-color: indigo; padding:7px; border-radius:15px; color:white" class="bg bg-indigo"> {{$paies->payment}} </span>
												   
												@endif
										  
										  </td>
										
									</tr>
									
								@endforeach	
									
								</tbody>
							</table>
						
						
						</div>
								
									
									</div>
								</div>
								<!-- Single Tab Content End -->

								<!-- Single Tab Content Start -->
							
								<!-- Single Tab Content End -->
							</div>
							
									<div class="pagination-container">
						<div class="container">
							<div class="row">
								<div class="col-lg-12">
									<!--=======  pagination-content  =======-->

									<div class="pagination-content text-center" style="text-align:center">
										<ul style="text-align:center">
											{{ $paie->links() }}
											
										</ul>
									</div>

									<!--=======  End of pagination-content  =======-->
								</div>
							</div>
						</div>
					</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')}}" method="post" style="display: inline">
                        {{csrf_field()}}
                     
                      <button type="submit" class="btn btn-success">Oui</button>

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

		</div>
	</div>

		 
@push('scripts') 
	   
	
		
@endpush

@endsection