@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-12"> 
					  <div class="form-group">
                      <label>Désignation <font color="red">*</font></label>
                      <input type="text" class="form-control" name="designation" value="{{$produit->designation}}">
                    </div>
					</div>
					<div class="col-lg-4 col-md-12"> 
					  <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-12"> 
					  <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-12"> 
					  <div class="form-group">
                      <label>Prix de 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-12"> 
					  <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>
					 <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