@extends('layouts.idara.panel')


@section('content')

<link
  rel="stylesheet"
  href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.15.2/css/selectize.default.min.css"
  integrity="sha512-pTaEn+6gF1IeWv3W1+7X7eM60TFu/agjgoHmYhAfLEU8Phuf6JKiiE8YmsNC0aCgQv4192s4Vai8YZ6VNM6vyQ=="
  crossorigin="anonymous"
  referrerpolicy="no-referrer"
/>
@include('backend.partials.import')

@include('backend.partials.features')



    <div class="card mt-4">
        <div class="card-header">
        Vous pouvez ajouter une image ou la modifie
        </div>
        <div class="card-body">
            

            <div class="container">
                @if(session('success'))
                <div class="alert alert-success">
                    {{ session('success') }}
                </div>
                @endif
                @if (count($errors) > 0)
                <div class="alert alert-danger">
                    <strong>Whoops!</strong> Some problems with your input.<br><br>
                    <ul>
                        @foreach ($errors->all() as $error)
                        <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
                @endif

                <form method="post" action="{{url('promotion/produit')}}" enctype="multipart/form-data">
                    

                    @csrf
                    <div class="row">
                      
                    <div class="form-group mt-4">
                    <label for="exampleFormControlTextarea1"><strong>Titre de la promotion :</strong></label>

                        <input type="text" class="form-control" id="" name="titre" placeholder="titre" value="{{old('titre')}}"required>
                    </div>

                    <div class="form-group categorie mt-4" id="categorie">


                        <label class="" for="exampleFormControlInput1"><strong>Produit</strong> :</label>
                        <br>
                        <select  onchange="optionCheck()"  class="form-control" name="produits" id="produits" class=" select seletizeData" aria-placeholder="votre produit" aria-describedby="validationServer04Feedback" style=" margin-bottom: 40px;" >

                            @if(! empty(old('produits')))
                            

                                <option value="{{ old('produits') }}" selected> {{ $produit->produits->nom }}</option>
                           
                                 
                             @else
                             <option></option>
                                 
                             @endif
                            


                        @foreach ($produits as $produit)


                        <option value="{{ $produit->id }}" {{ old('produit') == $produit->id  ? 'selected' : '' }}>  {{ $produit->nom }}</option>


                        @endforeach




                        </select>


                    </div>
                    <div class="form-group mt-4">
                    <label for="exampleFormControlTextarea1"><strong>Remise :</strong></label>
  
                            <input type="text" class="form-control" id="" name="remise" placeholder="la remise" value="{{old('remise')}}" >
                      </div>
                      <div class="row">
                            <div class="form-group mt-4 col-6">
                            <label for="exampleFormControlTextarea1"><strong>Début de la promotion :</strong></label>

                            <input  class="form-control" type="datetime-local" id="debut" name="debut" value="{{old('debut')}}" >
                            </div>

                            <div class="form-group mt-4 col-6">
                            <label for="exampleFormControlTextarea1"><strong>Fin de la promotion :</strong></label>

                            <input  class="form-control" type="datetime-local" id="fin" name="fin" value="{{old('fin')}}" >
                            </div>
                      </div>

                    <div class="form-group mt-4">
                        <label for="exampleFormControlTextarea1"><strong>description :</strong></label>
                        <textarea class="form-control" id="presentation" name="description" rows="6" value="">{{old('description')}}</textarea>
                    </div>

                    <div class="form-group col-md-4 mt-4">
                            <button type="submit" class="btn btn-success" style="margin-top:10px">Confirmer</button>
                        </div>
                    

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

</div>

@include('backend.partials.scriptIndex')
<style>
    .ck.ck-editor__main>.ck-editor__editable:not(.ck-focused) {
        border-color: var(--ck-color-base-border);
        height: 300px;
    }

</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.4/jquery.min.js" integrity="sha512-pumBsjNRGGqkPzKHndZMaAG+bir374sORyzM3uulLV14lN5LyykqNk8eEeUlUkB3U0M4FApyaHraT65ihJhDpQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<script
  src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.15.2/js/selectize.min.js"
  integrity="sha512-IOebNkvA/HZjMM7MxL0NYeLYEalloZ8ckak+NDtOViP7oiYzG5vn6WVXyrJDiJPhl4yRdmNAG49iuLmhkUdVsQ=="
  crossorigin="anonymous"
  referrerpolicy="no-referrer"
></script>
<script>
  $(function () {
    $("#produits").selectize({
  plugins: ["auto_select_on_type"],
});
  });
 
</script>

@endsection
