{% extends './stock_add.html' %}
{% load static %}

{% block navbar_content %}
          <div class="row">
            <div class="px-2"> <a href="/customers/" class="badge text-primary2"><i class="material-icons">subdirectory_arrow_left</i> Retour</a></div>
          </div>
          {% endblock %}

{% block main_content %}
		<form method="POST" onsubmit="getInfos()" id='art_form' action="/customers/add/form/">
		{% csrf_token %}
        <div class="container-fluid">
          <div class="row">
            <div class="col-md-12">
              <div class="card">
                <div class="card-header bg-primary2">
                  {% if personnel == None %}
                  <h4 class="card-title">Nouveau Client</h4>
                  {% else %}
                  <h4 class="card-title">Edition - {{personnel}}</h4>
                  {% endif %}
                </div>
                <div class="card-body">
                  <div>
                    <input type="hidden" id="name-form" name="name">
                    <div class="row d-flex">
                      <div class="col-md-6 p-2">
                        <div class="form-group">
                          <label class="bmd-label-floating">Prénom</label>
                          <input value="{{product.m_name}}" type="text" class="name-form form-control">
                        </div>
                      </div>

                      <div class="col-md-6 p-2">
                        <div class="form-group">
                          <label class="bmd-label-floating">Nom</label>
                          <input value="{{product.m_name}}" type="text" class="name-form form-control">
                        </div>
                      </div>                      
                    </div>
                    <div class="row">
                      <div class="col-md-12">
                        <div class="form-group">
                          <label class="bmd-label-floating">Adresse mail</label>
                          <input type="text" {% if product.m_price != None %} value="{{product.m_price}}" {% endif %} name="mail" class="form-control">
                          <!-- <small class="text-success"> + Ajouter une Adresse </small> -->
                        </div>
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-md-12">
                        <div class="form-group">
                          <label class="bmd-label-floating">Numéro de Téléphone</label>
                          <input type="text" {% if product.m_price != None %} value="{{product.m_price}}" {% endif %} name="tel" class="form-control">
                          <!-- <small class="text-success"> + Ajouter un Numéro de Téléphone </small> -->
                        </div>
                      </div>
                    </div>
                    <input type="hidden" name="attributes" id='att_elt'>
                    <!--
                    <div class="row">
                      <div class="col-md-12">
                        <div class="">
                          <label class="">Adress</label>
                          <input type="file" >
                        </div>
                      </div>
                    </div>
                -->
                    <div class="row d-none" id='descri_div'>

                    </div>
                    <input type="hidden" {% if product != None %} value="{{product.id}}" {% else %} value="0" {% endif %} name="edit_id">
                    <button type="submit" class="btn btn-success pull-right">Enregistrer</button>
                    <div class="clearfix"></div>
                  </div>
                </div>
              </div>
            </div>
            <div class="col-md-4 d-none">
              <div class="card card-profile">
                <div class="card-body">
                  <h6 class="card-category text-gray">Sélectionner un Poste</h6>
                  <!-- <p>
                    <a class="badge badge-success p-2" href="#newTypePrdModal" data-toggle='modal'>Ajouter un </a>
                  </p> -->
                  <p class="card-description">
                    <ul class="list-group" style="max-height: 400px;overflow-y: auto;">
                  	{% for t in roles %}
                  	<li class="list-group-item m-0 p-0 text-left"><a href="javascript:;" data-id="{{t.id}}" data-specis="" class="btn btn-white ty_bt w-100">{{t}}</a></li>
                    {% empty %}
                    <li>
                      <span> Aucun Poste déclaré</span>
                    </li>
                  	{% endfor %}
                  </ul>
                  </p>
                  <input type="hidden" name="typ" id='typ_cat'>

                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
 	</form>
            <!-- ========== Give a Like Modal ======= -->
            <div class="modal fade" id="newTypePrdModal"  role="dialog" >
                <div class="modal-dialog" role="document">
                     <div class="modal-content">
                      <div class="modal-header bg-white"><h4 class="modal-title"> Ajout d'un Rôle </h4>
                    <button type="button" class="text-danger close" data-dismiss="modal" aria-label="Close" id="giLoClose"><span aria-hidden="true">&times;</span></button>
                      </div>
                      <div id="connec-text" style="background:none;" class="modal-body">
                         <div style="padding-top:20px;display:flex;justify-content:center;">
                        <div class="input-group mb-3">
                          <form  action="#" method="POST">
                          <div id='form_saler' style="width:100%;">
                            <div style="width:100%; justify-content:center;" class="d-flex justify-content-center">
                              <div class="input-group-append">
                              	<span class="btn btn-primary2">Nom</span>
                                <input style="border-radius:0%;background:#fff;" id="name_typ" class="code_val btn text-secondary" type="text" required placeholder="Entrez le nom">
                              </div>
                            </div>
                          </div>
                          </form>
                          <div style="max-height:400px;overflow-y: auto;" id='lines_content'>
                          	<div class="linefm pt-2 d-flex w-100 justify-content-between">
	                          		<div class="form-group">
			                          <label class="bmd-label-floating">Champs</label>
			                          <input type="text" class="linch form-control">
			                        </div>
			                        <div style="width:20px;"></div>
	                          		<div class="form-group" >
			                          <label class="bmd-label-floating">Type de Valeur</label>
                                <input type="datalist" class="linch form-control">
			                          <select class="d-none linch form-control">
                                  <option value="text">Texte</option>
                                  <option value="number">Texte</option>
                                  <option value="file">Image</option>
                                  <option value="file">Fichier</option>
                                  <option value="select">Booléen</option>
                                </select>
			                        </div>
			                        <div style="width:20px;"></div>
	                          		<div class="form-group">
			                          <label class="bmd-label-floating">Unité </label>
			                          <input type="text" class="linch form-control">
			                        </div>
                          	</div>
                          </div>

                          <div style="width:100%;">
                            <div class=''>
                                  <small style="cursor:pointer;" id="adder_line" class="adders_form badge text-success"><i class="fa fa-plus"></i> Ajouter une Ligne </small>
                            </div>
                          </div>
                          </div>
             
                         </div>
                      </div>
                      <div id="form_desc" style="width:100%;display:none;">
                            <p style="text-align:center;">
                              <span class="btn" style="color:#333;background:#fff;text-align:center;">Enregistrement de La Facture</span>
                            </p>
                      </div>
                      <div class="log-description w-100 modal-footer d-block" style="text-align:center;">
                      <div style='text-align: center;'> <span id='enreg_trans' class="btn btn-success"> Enregistrer </span> </div>
                      </div>
                    </div>
                 </div>
              </div>
            </div>
            <!-- ========== Give a Like Modal ======= -->
{% endblock %}
{% block script %}
<script>
function getInfos(){
  name_form = document.getElementsByClassName("name-form");
  name_form_input = document.getElementById("name-form")
  name_form_input.value = name_form[0].value + name_form[1].value
}
</script>
{% endblock %}
