
<div class="row">
  <div class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
    <div class="card">
      <div class="body">
        <%= simple_form_for(@print_setting) do |f| %>
        <%= f.error_notification %>

        <div class="form-inputs">
          <%= f.input :name %>
          <%= f.input :unique_code %>
          <%= f.input :template %>
          <%= f.input :font %>
          <%= f.input :printer_name %>
          <%= f.input :api_settings %>
          <%= f.input :page_width %>
          <%= f.input :page_height %>
          <%= f.input :print_copies, input_html: { min: 1, step: '1', :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanOne(this.value);" } %>
          <%= f.input :precision, input_html: { min: 0, max: 2, :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanTwo(this.value);" } %>
          <%= f.input :delimiter %>
          <%= f.input :heading_space %>
        </div>

        <div class="form-actions">
        <%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
        </div>
        <% end %>
      </div>
    </div>
  </div>
  <div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
    <div class="card">
      <div class="body">
        <h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
        <p>
        1) <%= t("views.right_panel.detail.name") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.print_settings_txt") %> <%= t("views.right_panel.detail.name_txt2") %> <br>
        2) <%= t("views.right_panel.detail.unique_code") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.unique_code_txt") %> <br>
        3) <%= t("views.right_panel.detail.template") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.template_txt") %> <br>
        4) <%= t("views.right_panel.detail.font") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.font_txt") %> <br>
        5) <%= t("views.right_panel.detail.printer_name") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.printer_txt") %> <br>
        6) <%= t("views.right_panel.detail.api_settings") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.api_settings_txt") %> <br>
        7) <%= t("views.right_panel.detail.page_width") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.page_width_txt") %> <br>
        8) <%= t("views.right_panel.detail.page_height") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.page_height_txt") %> <br>
        9) <%= t("views.right_panel.detail.print_copies") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.print_copies_txt") %> <br>
        10) <%= t("views.right_panel.detail.precision") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.checkbox") %> <br>
        11) <%= t("views.right_panel.detail.delimiter") %> - <%= t("views.right_panel.detail.checkbox") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.delimiter_txt") %> <br>
        12) <%= t("views.right_panel.detail.heading_space") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.heading_space_txt") %> <br>
        </p>
        <h5><i class="material-icons md-18">list <%= t("views.right_panel.header.button_lists") %></i> </h5>
        <p>
        1) <%= t("views.right_panel.button.submit") %> - <%= t("views.right_panel.detail.submit_btn_txt") %> <%= t("views.right_panel.detail.print_settings_txt") %> <br>
        </p>
        <h5><i class="material-icons md-18">list <%= t("views.right_panel.header.link_lists") %></i> </h5>
        <p>
          1) <%= t("views.right_panel.button.home") %> - <%= t("views.right_panel.detail.home_txt") %> <br>
          2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.print_settings_txt") %> <br>
        </p>
      </div>
    </div>  
  </div>
</div>

<script type="text/javascript">
  function isNumberKey(evt) {
      var charCode = (evt.which) ? evt.which : event.keyCode;
      if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
          return false;
      } else {
          return true;
      }      
  }

  function greaterThanOne(val){
    if(parseInt(val)==0) $("#print_setting_print_copies").val(1);
  }

  function greaterThanTwo(val){
    if(parseInt(val)>2) $("#print_setting_precision").val(2);
  }
</script>