{% import 'agent/input.html.twig' as inputM %}
{% if dep is defined %}
<div id="depChoisedByAgent" data-dep-choiced-agent="{{dep}}" {% if codinsee is defined %} data-codinsee-choiced-agent="{{codinsee}}" {% endif %}></div>
{% endif %}
<div class='d-flex justify-content-start flex-row mb-2 flex-wrap'>
{% for item in items %}
{% set itemLength= items |length %}
<div class="card_to_validate w-50 border border-dark " id={{"card_num_"~item.id}} data-fiche-index={{ item.id }}>
<div class ="card-header row" id={{'head_card_'~loop.index}}>
<div class="d-flex justify-content-start flex-row mb-2">
<div class="container">
<div class="row mx-2">
<div class="col col-md-12 col-sm-12">
<button type="button" class="btn btn-primary btn-lg nextFiche" data-mdb-toggle="tooltip" data-mdb-placement="bottom" title="passez à la ficher suivante" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens :"no-cdns"}} >fiche suivante</button>
<button type="button" class="btn btn-primary btn-lg retour-carte" data-mdb-toggle="tooltip" data-mdb-placement="bottom" title="revenir à la carte" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens :"no-cdns"}} >Revenir à la carte</button>
{% if (loop.index == 1) %}
{% if dep is defined %}
<span class="compteur" data-fiche-dep="{{ dep }}" {% if codinsee is defined %} data-codinsee="{{codinsee}}" {% endif %}>0000</span>
{% endif %}
{% endif %}
</div>
</div>
</div>
<div class="container">
<div class="row mx-2">
<button type="button" class="btn btn-primary" data-fiche-id={{ item.id }} data-mdb-toggle="modal" data-mdb-target="#seeFiche" onclick="seeAllFiche(event)">regardez toute la fiche</button>
<button type="button" class="btn btn-primary recherche-google" data-cle-nom="{{item.denominationF}}" data-cle-adresse="{{item.numvoie ~ ' ' != null ? item.numvoie ~ ' ' :''}}{{item.typevoie != null ? item.typevoie ~ ' ' : ''}}{{item.nomvoie != null ? item.nomvoie ~ ' ': '' }}{{item.codpost != null ? item.codpost ~' ':'' }}{{item.commune != null ? item.commune :''}}" data-fiche-index={{item.id}} >recherche google</button>
<button type="button" class="btn btn-primary recherche-street-map" data-cle-nom="{{item.denominationF}}" data-cle-adresse="{{item.numvoie ~ ' ' != null ? item.numvoie ~ ' ' :''}}{{item.typevoie != null ? item.typevoie ~ ' ' : ''}}{{item.nomvoie != null ? item.nomvoie ~ ' ': '' }}{{item.codpost != null ? item.codpost ~' ':'' }}{{item.commune != null ? item.commune :''}}" data-fiche-index={{item.id}} >recherche map</button>
</div>
</div>
<div class="container">
<div class="row">
<button type="button" class="btn btn-danger dlink_rouge" data-mdb-toggle="modal" data-mdb-target="#areUsureToDlink" data-mdb-toggle="tooltip" data-mdb-placement="bottom" title="en appuyant sur delier , vous delierez les" data-fiche-index={{item.id}}>delier</button>
</div>
<div class="row">
<button type="button" class="btn btn-primary supprEVE" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens :"no-cdns"}}>supprimer eve</button>
</div>
<div class="row">
<button type="button" class="btn btn-primary" id="putToRappel" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens :"no-cdns"}} data-mdb-toggle="tooltip" data-mdb-placement="bottom" title="met le traitement d'une fiche ou des fiches en attente, attention les fiches ne sont pas traitées ni validées pour autant. Cliquez sur rappel dans la side bar pour voir vos rappel ">rappel</button>
</div>
<div class="row">
<button type="button" data-dep-choiced={% if dep is defined %} {{dep }} {% else %} {{item.dep}} {% endif %} class="btn btn-primary duplicateFiche" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens :"no-cdns"}} data-mdb-toggle="tooltip" data-mdb-placement="bottom" title="Créé une copie identique à cette fiche dans la base de donnée">dupliquer</button>
</div>
</div>
<div class="container">
<div class="row mx-2">
<button type="button" data-mdb-toggle="tooltip" data-mdb-placement="bottom" title="Trouver une correspondance à cette adresse dans la base de donnée" class="btn btn-primary" id="match-addr" data-fiche-postcode="{{item.codpost != "" ? item.codpost : "no-codpost"}}" data-cle-adresse="{{item.numvoie ~ ' ' != null ? item.numvoie ~ ' ' :''}}{{item.typevoie != null ? item.typevoie ~ ' ' : ''}}{{item.nomvoie != null ? item.nomvoie ~ ' ': '' }}{{item.codpost != null ? item.codpost ~' ':'' }}{{item.commune != null ? item.commune :''}}" data-fiche-index={{item.id}}>match adresse</button>
</div>
<div class="row mx-2">
<button type="button" class="btn btn-primary undo" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens :"no-cdns"}} data-mdb-toggle="tooltip" data-mdb-placement="bottom" title="retablir les valeurs par defaut" disabled>undo</button>
</div>
<div class="row mx-2">
{% if item.pasGarder !=1 %}
<button type="button" class="btn btn-warning trashed" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens :"no-cdns"}} > PAS GARDER</button>
<!--<i class="fa-solid fa-trash trashed" data-fiche-index={{ item.id}} data-fiche-cdns={{item.codens != null ? item.codens : "no-cdns" }} style="color:red"></i>-->
{% else %}
<button type="button" class="btn btn-warning no-trashed" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens :"no-cdns"}} > GARDER</button>
<!--<i class="fa-solid fa-trash no-trashed" data-fiche-index={{ item.id}} data-fiche-cdns={{item.codens != null ? item.codens : "no-cdns" }} style="color:green"></i>-->
{% endif %}
</div>
<div class="row mx-2">
<button type="button" class="btn btn-danger closingEtab" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens :"no-cdns"}} data-mdb-toggle="modal" data-mdb-target="#closingEtab">fermer / Ouvrir</button>
</div>
</div>
</div>
<div class="container">
<table class="table table-striped table-sm table-responsive">
<thead>
<tr>
<th>Code Extraction</th>
<th>codens</th>
<th>id</th>
<th>Type ligne</th>
<th>Saisie</th>
<th>Code événement</th>
<th>Garder</th>
<th>Déjà Traiter</th>
<th>select</th>
</tr>
</thead>
<tbody>
<tr>
<td>
</td>
<td>
{{item.codens != null ? item.codens :"" }}
</td>
<td>
{{item.id}}
</td>
<td>
{% if item.duplicated == 1%}
{{"ligne dupliquée"}}
{% elseif item.pj == 1 and item.ta != 1 %}
{{"page jaune"}}
{% elseif item.pj != 1 and item.ta == 1 %}
{{"Tripadvisor"}}
{% elseif item.pj != 1 and item.ta != 1 and item.stock == 1 %}
{{"stock"}}
{% endif %}
</td>
<td>
{{item.codeSaisie != null ? item.codeSaisie :"" }}
</td>
<td>
{{item.evenement != null ? item.evenement : ""}}
</td>
<td>
{% if item.pasGarder !=1 %}
{{ "OUI" }}
{% else %}
{{ "NON" }}
{% endif %}
</td>
<td>
{% if item.traite != 1 %}
{{"NON"}}
{% else %}
{{"OUI"}}
{% endif %}
</td>
<td>
<input class="unlink_CheckBox" type="checkbox" name="select_to_unlik" data-fiche-index={{item.id}} >
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="card-body row" id={{'body_card_'~loop.index}} data-fiche-cdns={{item.codens != null ? item.codens : "no-cdns" }} data-fiche-id={{item.id}}>
<div class= "container d-inline">
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="checkBoxFastFood" value="Fast Food" data-fiche-index={{item.id}} {% if (item.fastFood) %} checked {% endif %}/>
<label class="form-check-label" for="checkBoxFastFood">Fast Food</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="checkBoxRestaurant" value="Restaurant" data-fiche-index={{item.id}} {% if (item.restaurant) %} checked {% endif %}/>
<label class="form-check-label" for="checkBoxRestaurant">Restaurant</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="checkBoxCreperie" value="Creperie" data-fiche-index={{item.id}} {% if (item.creperie) %} checked {% endif %}/>
<label class="form-check-label" for="checkBoxCreperie">creperie</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="checkBoxBrasserie" value="Brasserie" data-fiche-index={{item.id}} {% if (item.brasserie) %} checked {% endif %}/>
<label class="form-check-label" for="checkBoxBrasserie">Brasserie</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="checkBoxPizzeria" value="Pizzeria" data-fiche-index={{item.id}} {% if (item.pizzeria) %} checked {% endif %}/>
<label class="form-check-label" for="checkBoxPizzeria">Pizzeria</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="checkBoxboulangerie" value="Boulangerie" data-fiche-index={{item.id}} {% if (item.boulangerie) %} checked {% endif %}/>
<label class="form-check-label" for="checkBoxboulangerie">Boulangerie-patisserie</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="checkBoxBar" value="Bar" data-fiche-index={{item.id}} {% if (item.bar) %} checked {% endif %}/>
<label class="form-check-label" for="checkBoxBar">Bar</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="checkBoxCuisineMonde" value="C Monde" data-fiche-index={{item.id}} {% if (item.cuisineMonde ) %} checked {% endif %}/>
<label class="form-check-label" for="checkBoxCuisineMonde">Cuisine monde</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="checkBoxCafe" value="Cafe" data-fiche-index={{item.id}} {% if (item.cafe ) %} checked {% endif %}/>
<label class="form-check-label" for="checkBoxCafe">Cafe</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="checkBoxThe" value="The" data-fiche-index={{item.id}} {% if (item.salonThe ) %} checked {% endif %}/>
<label class="form-check-label" for="checkBoxThe">Salon thé</label>
</div>
</div>
<div class="container">
<div class="row">
<table class="table table-responsive-sm">
<thead>
<tr>
<th>Denomination</th>
<th>siren</th>
<th>action</th>
</tr>
</thead>
<tbody>
<tr>
<td class="denominationF {% if item.nomOk == 1 %}flag_name{% endif %}" data-fiche-index={{item.id}} contenteditable="true" >{{ item.denominationF != "" ? item.denominationF : ""}}</td>
<td class="siren {% if item.sirenOk == 1 %} siren_valided {% endif %}" contenteditable="true">{{ item.siren != "" ? item.siren : ""}}</td>
<td>
<button type="button" data-mdb-toggle="modal" data-mdb-target="#ChangementNom" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens : "no-cdns"}} class="btn btn-primary btn-xs btn_valid_nom" id="btn_valid_nom_{{~ item.id}}" >valider nom</button>
<button type="button" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens : "no-cdns"}} class="btn btn-primary btn-xs btn_chang_siren" >valider siren</button>
{% if item.sirenOk == 1 %}
<button type="button" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens : "no-cdns"}} class="btn btn-primary btn-xs btn_undo_siren_validation"> Annuler la validation siren </button>
{% endif %}
{% if itemLength > 1 %}
<button type="button" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens : "no-cdns"}} class="btn btn-primary btn-xs btn_nom_ok {% if item.nomOk == 1 %}flag_name_actived{% endif %}" data-mdb-toggle="tooltip" data-mdb-placement="bottom" title="Pour dire que c'est le nom exacte">ok</button>
{% endif %}
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="container">
<div class="row adresse_champ" data-cle-adresse="{{item.numvoie ~ ' ' != null ? item.numvoie ~ ' ' :''}}{{item.typevoie != null ? item.typevoie ~ ' ' : ''}}{{item.nomvoie != null ? item.nomvoie ~ ' ': '' }}{{item.codpost != null ? item.codpost ~' ':'' }}{{item.commune != null ? item.commune :''}}">
{{ inputM.adresseTable(
item.id,
item.codens,
{
t1:"Num voie",
t2:"Type",
t3:"Nom voie",
t4:"Complément",
t5:"CP",
t6:"ville Norm",
t7: "Commune",
t8:"Btn action sur les adresse",
c1:"numvoie",
c2:"typevoie",
c3:"nomvoie",
c4:"compvoie",
c5:"codpost",
c6:"villenorm",
c7: "commune",
v1:item.numvoie,
v2:item.typevoie,
v3:item.nomvoie,
v4:item.compvoie,
v5:item.codpost,
v6:item.villenorm,
v7:item.commune,
isEditable: "true"
},true, itemLength,item.adresseOk)}}
</div>
</div>
<div class="container">
<table class="table table-striped table-sm table-responsive">
<thead>
<tr>
<th>Latitude</th>
<th>Longitude</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td id="lat_{{item.id}}" contenteditable >{{item.poiY}}</td>
<td id="lng_{{item.id}}" contenteditable>{{item.poiX}}</td>
<td>
<button type="button" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens : "no-cdns"}} class="btn btn-primary btn-sm px-3 btn_change_positionXY" >Changer la position</button>
</td>
</tr>
</tbody>
</table>
</div>
<div class="container">
<div class="row">
<table class="table table-striped table-responsive-sm">
<thead>
<tr>
<th>telephone</th>
<th>actions</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tel_container {% if item.telOk ==1 %} tel_validated {% endif %}"contenteditable> {{item.tel}}</td>
<td>
<button type="button" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens : "no-cdns"}} class="btn btn-primary btn-sm px-3 btn_valid_tel" >valider téléphone</button>
{% if item.telOk ==1 %}
<button type="button" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens : "no-cdns"}} class="btn btn-primary btn-sm px-3 btn_change_tel" >Annuler la validation téléphone</button>
{% endif %}
<button type="button" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens != null ? item.codens : "no-cdns"}} class="btn btn-danger btn-sm px-3 btn_suppr_tel" >supprimer</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="container">
<div class="row" style="weigth:944px">
<table class="table table-striped table-responsive-sm">
<thead>
<tr>
<th>commentaire N-1</th>
<th>commentaire N </th>
<th>action</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{inputM.textArea('commentLastYr_'~item.id,"")}}</td>
<td>{{inputM.textArea('commentCurtY_'~item.id,item.comVali)}}</td>
<td>
<button type="button" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens !=null ? item.codens : "no-cdns"}} class="btn btn-primary btn-sm px-3 btn_valid_comt_js" >valid</button>
<button type="button" data-fiche-index={{item.id}} data-fiche-cdns={{item.codens !=null ? item.codens : "no-cdns"}} class="btn btn-danger btn-sm px-3 btn_suppr_cmt_js" >suppr</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endfor %}
</div>