@extends('layout')
@section('title','Modifier produit ')
@section('content')
		<br/>
          <div class="section-body">
            <div class="row">
              <div class="col-lg-10 offset-1 col-md-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
		<br/>
                <div class="card">
                  <div class="card-header">
                    <h4>Modifier produit (<h7><strong>Les champs en * sont obligatoires</strong></h7>)</h4>
                  </div>
                  <div class="card-body">
					<form  method="POST" action="{{route('modifierproduitPost', ['id'=>$produit->id])}}">
                         {{csrf_field()}}
				  <div class="row" style="padding-top: 30px">
					<div class="col-lg-4 col-md-4"> 
					  <div class="form-group">
                      <label>Catégorie <font color="red">*</font></label>
                      <select class="form-control select2" name="categorie">
                        <option value="{{$produit->categorie_id}}">{{DB::table('categorie')->where('idcat',$produit->categorie_id)->first()->libelle}}</option>
							@foreach($categorie as $categories)
							<option value="{{$categories->idcat}}">{{$categories->libelle}}</option>
							@endforeach
                      </select>
                    </div>
					</div>
					<div class="col-lg-4 col-md-4"> 
					  <div class="form-group">
                      <label>Référence </label>
                      <input type="text" class="form-control" name="code" value="{{$produit->barcode}}">
                    </div>
					</div>
                     <div class="col-lg-4 col-md-4"> 
					  <div class="form-group">
                      <label>Désignation </label>
                      <input type="text" class="form-control" name="designation" value="{{$produit->designation}}">
                    </div>
					</div>
					<div class="col-lg-4 col-md-4"> 
					  <div class="form-group">
                      <label>Prix de revient/Achat(FCFA)<font color="red">*</font></label>
                      <input type="text" class="form-control" name="pr"  value="{{$produit->pr}}">
                    </div>
					</div>
					<div class="col-lg-4 col-md-4"> 
					  <div class="form-group">
                      <label>Prix de revient/Achat(En Devise)<font color="red">*</font></label>
                      <input type="text" class="form-control" name="pr_en_devise"  value="{{$produit->pr_en_devise}}">
                    </div>
					</div>
					<div class="col-lg-4 col-md-4"> 
					  <div class="form-group">
                      <label>Prix détail<font color="red">*</font></label>
                      <input type="text" class="form-control" name="prix_detail"  value="{{$produit->prix_detail}}">
                    </div>
					</div>
					<div class="col-lg-4 col-md-4" hidden> 
					  <div class="form-group">
                      <label>Prix semi<font color="red">*</font></label>
                      <input type="text" class="form-control" name="prix_semigros"  value="{{$produit->prix_semigros}}">
                    </div>
					</div>
					<div class="col-lg-4 col-md-4"> 
					  <div class="form-group">
                      <label>Prix d'en gros <font color="red">*</font></label>
                      <input type="text" class="form-control" name="prix_gros"  value="{{$produit->prix_gros}}">
                    </div>
					</div>
					<div class="col-lg-4 col-md-4" hidden> 
					  <div class="form-group">
                      <label>Marque </label>
                      <input type="text" class="form-control" name="marque" style="text-transform:uppercase" value="{{$produit->marque}}">
                    </div>
					</div>
					<div class="col-lg-4 col-md-4"> 
					  <div class="form-group">
                      <label>Stock minimal <font color="red">*</font></label>
                      <input type="text" class="form-control" name="stock_mini" value="{{$produit->stock_mini}}">
                    </div>
					</div>
					<div class="col-lg-4 col-md-4" hidden> 
					  <div class="form-group">
                      <label>Caisse off <font color="red">*</font></label>
                      <select class="form-control select2" name="caisseoff">
                        <option @if($produit->caisseoff == "Non") selected @endif value="Non">Non</option>
                        <option @if($produit->caisseoff == "Oui") selected @endif value="Oui">Oui</option>
                      </select>
                    </div>
					</div>
					<div class="col-lg-3 col-md-3" hidden> 
					  <div class="form-group">
                      <label>Contenu du carton(en KG) <font color="red">*</font></label>
                      <input type="text" class="form-control" name="nbreencarton" value="{{$produit->nbreencarton}}" placeholder="">
                    </div>
					</div>
                      </div>
					 <hr>  	
                   <div class="pull-left">
                    <button href="{{route('liste-des-produits')}}" class="btn btn-icon icon-left btn-danger"><i class="fas fa-times"></i> Annuler</button>
                    <button class="btn btn-icon icon-left btn-success" type="submit"><i class="fas fa-check"></i> Enregistrer</button>
                  </div>
					<br><br>	  
				</form>
					  
					    </div>
						 
                    </div>
                  </div>
                </div>
          </div>
            </div>
          </div>
  
		  
	   @push('scripts') 

@endpush

@endsection