<commit_before><div class="small-12 columns">
  <%= form_for(@commande) do |f| %>
      <div class="form-steps-container">
        <ul id="formprogress">
          <li class="active">Restaurants</li>
          <li>Menus & Plats</li>
          <li>Sommaire</li>
          <li>Confirmation</li>
        </ul>
      </div>
    <% if @commande.errors.any? %>
      <div id="error_explanation">
        <h2><%= pluralize(@commande.errors.count, "error") %> prohibited this commande from being saved:</h2>

        <ul>
        <% @commande.errors.full_messages.each do |message| %>
          <li><%= message %></li>
        <% end %>
        </ul>
      </div>
    <% end %>
    <fieldset>
      <legend>Restaurants</legend>
      <% Restaurant.all.each do |restaurant| %>
        <a class="next" data-restaurant-id='<%= restaurant.id%>' onclick='select_restaurant(this);'><%= restaurant.nom %></a>
      <% end %>
    </fieldset>
    <fieldset>
      <legend>Menus & Plats</legend>
      <div id="current_menu"></div>
      <div class="row">
        <div class="small-12 columns">
          <a href="#" class="button tiny secondary previous">Prev</a>
          <a href="#" class="button tiny secondary next right" onclick="summary()">Soumettre</a>
        </div>
      </div>
    </fieldset>
    <fieldset>
      <legend>Sommaire</legend>
      <div id="sommaire" class="row">
        <table style="width: 100%">
          <thead>
            <tr>
              <th>No.</th>
              <th>Plat</th>
              <th>Prix</th>
              <th>Qté</th>
              <th>Sous Total</th>
            </tr>
          </thead>
          <tbody></tbody>
        </table>
      </div>
      <div class="row">
        <div class="small-12 columns">
          <a href="#" class="button tiny secondary previous">Prev</a>
          <a href="#" class="button tiny secondary next right" onclick="summary()">Soumettre</a>
        </div>
      </div>
    </fieldset>
    <fieldset>
      <legend>Confirmation</legend>
      <div class="row">
        <div class="small-12 medium-6 columns">
          <%= f.collection_select(:adresse_id, current_user.adresse.all, :id, :value) %>
        </div>
        <div class="orborder small-12 medium-6 columns">
          <%= f.fields_for :adresse_attributes do |ff| %>
            <%= ff.text_field :value, label: 'Adresse' %>
          <% end %>
        </div>
        <div class="small-12 columns datetime">
          <%= f.datetime_select :date_de_livraison, {}, {} %>
        </div>
      </div>
      <div class="row">
        <div class="small-12 columns">
          <%= f.submit %>
          <%= f.hidden_field :restaurant_id %>
        </div>
      </div>
    </fieldset>
  <% end %>
</div>

<script>
  var menus_template, ligne_commande_template, menus;
  $(function(){
    menus_template = _.template($('#menu_template').html());
    ligne_commande_template = _.template($('#ligne_commande_template').html());
  })
  function select_restaurant(event) {
    $event = $(event);
    id_restaurant = $event.data('restaurant-id');
    $.get('/restaurants/'+id_restaurant+'/menus.json', function(data){<commit_msg>FIX : toujours afficher la dernier adresse en premier<commit_after><div class="small-12 columns">
  <%= form_for(@commande) do |f| %>
      <div class="form-steps-container">
        <ul id="formprogress">
          <li class="active">Restaurants</li>
          <li>Menus & Plats</li>
          <li>Sommaire</li>
          <li>Confirmation</li>
        </ul>
      </div>
    <% if @commande.errors.any? %>
      <div id="error_explanation">
        <h2><%= pluralize(@commande.errors.count, "error") %> prohibited this commande from being saved:</h2>

        <ul>
        <% @commande.errors.full_messages.each do |message| %>
          <li><%= message %></li>
        <% end %>
        </ul>
      </div>
    <% end %>
    <fieldset>
      <legend>Restaurants</legend>
      <% Restaurant.all.each do |restaurant| %>
        <a class="next" data-restaurant-id='<%= restaurant.id%>' onclick='select_restaurant(this);'><%= restaurant.nom %></a>
      <% end %>
    </fieldset>
    <fieldset>
      <legend>Menus & Plats</legend>
      <div id="current_menu"></div>
      <div class="row">
        <div class="small-12 columns">
          <a href="#" class="button tiny secondary previous">Prev</a>
          <a href="#" class="button tiny secondary next right" onclick="summary()">Soumettre</a>
        </div>
      </div>
    </fieldset>
    <fieldset>
      <legend>Sommaire</legend>
      <div id="sommaire" class="row">
        <table style="width: 100%">
          <thead>
            <tr>
              <th>No.</th>
              <th>Plat</th>
              <th>Prix</th>
              <th>Qté</th>
              <th>Sous Total</th>
            </tr>
          </thead>
          <tbody></tbody>
        </table>
      </div>
      <div class="row">
        <div class="small-12 columns">
          <a href="#" class="button tiny secondary previous">Prev</a>
          <a href="#" class="button tiny secondary next right" onclick="summary()">Soumettre</a>
        </div>
      </div>
    </fieldset>
    <fieldset>
      <legend>Confirmation</legend>
      <div class="row">
        <div class="small-12 medium-6 columns">
          <%= f.collection_select(:adresse_id, current_user.adresse.all.order(created_at: :desc), :id, :value) %>
        </div>
        <div class="orborder small-12 medium-6 columns">
          <%= f.fields_for :adresse_attributes do |ff| %>
            <%= ff.text_field :value, label: 'Adresse' %>
          <% end %>
        </div>
        <div class="small-12 columns datetime">
          <%= f.datetime_select :date_de_livraison, {}, {} %>
        </div>
      </div>
      <div class="row">
        <div class="small-12 columns">
          <%= f.submit %>
          <%= f.hidden_field :restaurant_id %>
        </div>
      </div>
    </fieldset>
  <% end %>
</div>

<script>
  var menus_template, ligne_commande_template, menus;
  $(function(){
    menus_template = _.template($('#menu_template').html());
    ligne_commande_template = _.template($('#ligne_commande_template').html());
  })
  function select_restaurant(event) {
    $event = $(event);
    id_restaurant = $event.data('restaurant-id');
    $.get('/restaurants/'+id_restaurant+'/menus.json', function(data){
{'fraction_non_alphanumeric': 0.18247601069686958, 'fraction_numerical': 0.0066068900424728644, 'mean_word_length': 2.212733703890854, 'pattern_counts': {'":': 0, '<': 223, '<?xml version=': 0, '>': 223, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2867559', 'n_tokens_mistral': 2166, 'n_tokens_neox': 2035, 'n_words': 393}