<commit_before>###!
  Copyright 2013 <NAME> (<EMAIL>)
  Licensed under the Apache License v2.0
  http://www.apache.org/licenses/LICENSE-2.0
###

removeDishHandler = (event) ->
  dishes = $(this).parents(".dishes")
  $(this).parent(".dish").remove()
  updateTotalPrice.call(dishes.get(0), event)

addDishHandler = (event) ->
  dish = $("#dish-template").clone(true)
  dish.removeAttr "id"
  dish.removeClass "hidden"
  dish.insertBefore ".dishes a.add"

toggleFormEnabled = (event) ->
  restaurant = $(this).val()
  restaurantIsEmpty = restaurant.length == 0
  $('#today-order .dishes input, #today-order .dishes select').prop('disabled', restaurantIsEmpty)
  $('#today-order .dishes a').toggleClass('hidden', restaurantIsEmpty)
  $('#today-order .dishes a + label').toggleClass('hidden', !restaurantIsEmpty)
  $('#today-order .payer select').prop('disabled', restaurantIsEmpty)
  $('#today-order .payer label').toggleClass('muted', restaurantIsEmpty)
  $('#today-order button.save').prop('disabled', restaurantIsEmpty)

refreshDishSuggestions = (event) ->
  restaurant = $(this).val()
  order_form = $(this).parents('.order')
  dishes = Object.keys(Storage.dishes_with_prices[restaurant] || {})
  dish_fields = order_form.find(".dish input[name='dish[]']")
  if dish_fields.data('typeahead')<commit_msg>Little improvements in scripts<commit_after>###!
  Copyright 2013 <NAME> (<EMAIL>)
  Licensed under the Apache License v2.0
  http://www.apache.org/licenses/LICENSE-2.0
###

removeDishHandler = (event) ->
  dishes = $(this).parents(".dishes")
  $(this).parent(".dish").remove()
  updateTotalPrice.call(dishes.get(0), event)

addDishHandler = (event) ->
  dish = $("#dish-template").clone(true)
  dish.removeAttr "id"
  dish.removeClass "hidden"
  dish.insertBefore ".dishes a.add"

toggleFormEnabled = (event) ->
  restaurant = $(this).val()
  restaurantIsEmpty = restaurant.length == 0
  order_form = $(this).parents('.order')
  order_form.find('.dishes input, .dishes select').prop('disabled', restaurantIsEmpty)
  order_form.find('.dishes a').toggleClass('hidden', restaurantIsEmpty)
  order_form.find('.dishes a + label').toggleClass('hidden', !restaurantIsEmpty)
  order_form.find('.payer select').prop('disabled', restaurantIsEmpty)
  order_form.find('.payer label').toggleClass('muted', restaurantIsEmpty)
  order_form.find('button.save').prop('disabled', restaurantIsEmpty)

refreshDishSuggestions = (event) ->
  restaurant = $(this).val()
  order_form = $(this).parents('.order')
  dishes = Object.keys(Storage.dishes_with_prices[restaurant] || {})
  dish_fields = order_form.find(".dish input[name='dish[]']")
  if dish_fields.data('typeahead')
{'fraction_non_alphanumeric': 0.182913059841927, 'fraction_numerical': 0.007527286413248024, 'mean_word_length': 5.467153284671533, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1331322', 'n_tokens_mistral': 868, 'n_tokens_neox': 871, 'n_words': 151}