@extends('layout')
@section('title','Journal de caisse recette')
@section('description','Journal de caisse')
@section('content')
			<br/>
          <div class="section-body">
		  <div class="row">
              <div class="col-12">
			  @if (session('status'))
            <div class="alert alert-warning" style="font-size: 15px; background-color: #328039; color: white">
                <i class="fa fa-check"></i> &nbsp; {{ 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="card" hidden>
                  <div class="card-header">
                    <h4>Recherche par magasin</h4>
                  </div>
                  <div class="card-body">
				<form>
                         {{csrf_field()}}
				  <div class="row" style="padding-top: 30px">
					<div class="col-lg-6 col-md-12"> 
					  <div class="form-group">
                      <label>Magasin<font color="red">*</font></label>
                      <select class="form-control select2" name="magasin">
                        <option value="0">Recettes général</option>
						 @foreach($magasin as $magasins)
						<option value="{{$magasins->id}}">{{$magasins->nom}} </option>
						@endforeach
                      </select>
                    </div>
					</div>
                    <div class="col-lg-3 col-md-12" hidden> 
					  <div class="form-group">
                      <label>Date début <font color="red">*</font></label>
                      <input type="text" class="form-control" name="date_debut" id="champ_date">
					  <div id="calendarMain"></div>
                    </div>
					</div>
					<div class="col-lg-3 col-md-12" hidden> 
					  <div class="form-group">
                      <label>Date fin <font color="red">*</font></label>
                      <input type="text" class="form-control" name="date_fin" id="champ_date2">
					  <div id="calendarMain2"></div>
                    </div>
					</div>
					<div class="col-lg-2 col-md-12"> 
                      <button class="btn btn-icon icon-left btn-success"><i class="fas fa-search"></i> Rech</button>
					</div>
                      </div>
					<br><br>	  
				</form>
					    </div>
                    </div>
			  </div>
		  </div>
			<div class="row">
              <div class="col-12">
                <div class="card">
                  <div class="card-header">
                    <h4>Journal caisse recette</h4>
                  </div>
                  <div class="card-body">
                    <div class="table-responsive">
                      <table class="table table-striped" id="table-1">
                        <thead>
                          <tr>
                            <th style="text-align:center;">N°</th>
                             <th style="text-align:center;">Nature</th>
							<th style="text-align:center;">Date</th>
							<th style="text-align:center;">Montant</th>
							<th style="text-align:center;" hidden>Client</th>
                          </tr>
                        </thead>
                        <tbody>
						@foreach($solde as $soldes)
						@php
						/*if ($soldes->nature == "Vente"){
						$client = DB::table('vente_client')->where('id', $soldes->vente_id)->first()->client_id;
						}else {
						$client = DB::table('paiement_client')->where('id', $soldes->paie_cli_ext_id)->first()->client_id;
						}*/
						@endphp
						<tr>
							@php
							$dd = $soldes->date;
							$dd= explode('-', $dd);
							$dd= array_reverse($dd);
							$dd= implode('/', $dd);
							@endphp
							<td>{{$soldes->id}}</td>
							<td style="text-align:center;">{{$soldes->nature}}</td>
							<td style="text-align:center;">{{$dd}}</td>
							<td style="text-align:center;">
							@php
							$lhh = $soldes->montant;
							$lhh1 =  number_format($lhh, 0, ' ', ' ');
							echo $lhh1."&nbsp;F";
							@endphp
							</td>
							<td style="text-align:center;">
							   
							   
							   
							</td>
						</tr>
						@endforeach
						</tbody>
						</table>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
		
@endsection