<div class="form-horizontal">
  <div class="portlet-body form">
    <div class="form-body">
      <div class="row">
        <div class="col-md-12">
          <div class="form-group">
             <%= label_tag :customer_id,  {:class=>"col-md-4 control-label"} do %>Cliente <span class="required">*</span> <% end %>
            <div class="col-md-6">
              <%= select_tag :customer_id, options_from_collection_for_select(@customers, :id, :nick_name), :include_blank => "Seleccione cliente",  class: "form-control select2" %>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="form-actions">
    <h4 class="form-section"> </h4>
    <div class="row">
      <div class="col-md-12">
        <button type="submit" class="btn green" onclick="createQuickDebt()">Abonar a crédito</button>
        <button type="button" class="btn default" onclick="cerrarDialog()">Cerrar</button>
      </div>
    </div>
  </div>
</div>
<script>
  App.init();

  function cerrarDialog() {
    $('#dialog').modal('toggle');
  }

  function createQuickDebt(argument) {
    var customerId = $('#customer_id').val();
    $.ajax({
    type: "GET",
    url: "/create_quick_debt_payment/" + customerId,
    dataType: "script",
    success: function(xhr, status, error) {
    }
    });
  }
</script>
