<commit_before><% content_for :title, "Inventory" %>

<% content_for :content_size, "col-sm-9 col-md-10" %>

<% content_for :sidebar do %>
  <%= render "common/category_nav" %>
<% end %>

<% content_for :content do %>
  <h4>
    Edit Item Stock
    <%= link_to '', edit_item_path(@item), class: 'pull-right btn btn-default btn-xs glyphicon glyphicon-pencil', title: 'Edit Item' %>
  </h4>
  <%= form_for @item, data: { live_guarded: true } do |f| %>
    <div class="form-group">
      <%= f.label 'Description:', class: "control-label" %>
      <p class="form-control-static"><%= @item.description %></p>
    </div>
    <div class="form-group">
      <%= f.label 'Current Quantity In Stock:', class: "control-label" %>
      <p class="form-control-static"><%= @item.current_quantity %></p>
    </div>
    <div class="form-group">
      <%= f.label "Modify method:" %><br>
      <% Item.edit_methods.each do |label, index| %>
        <label class="radio-inline">
          <input type="radio" name="item[edit_method]" value="<%= label %>" data-guard="required" data-guard-required-target="#edit-method-error"> <%= label.to_s.humanize %>
        </label>
      <% end %>
      <span id="edit-method-error"></span>
    </div>
    <div class="form-group">
      <%= f.label 'Amount:' %>
      <%= f.text_field :edit_amount, class: "form-control", placeholder: "Enter the number", data: { guard: "required int", guard_int_min: 0 } %>
    </div>
    <div class="form-group">
      <%= f.label 'Reason for changing quantity in stock:' %><br>
      <% Item.selectable_edit_reasons.each do |reason, index| %>
        <label class="radio-inline">
          <input type="radio" name="item[edit_reason]" value="<%= reason %>" data-guard="required" data-guard-required-target="#edit-reason-error"> <%= reason.to_s.humanize %>
        </label>
      <% end %>
      <span id="edit-reason-error"></span>
    </div>
    <div class="form-group">
      <%= f.label 'Reason Details:' %>
      <%= f.text_field :edit_source, class: "form-control", placeholder: "Explain" %>
    </div>

    <%= f.submit "Save", class: "btn btn-primary" %>
    <%= link_to "Cancel", items_path(category_id: @item.category_id), type: "button", class: "btn btn-default" %><commit_msg>Add regex guard<commit_after><% content_for :title, "Inventory" %>

<% content_for :content_size, "col-sm-9 col-md-10" %>

<% content_for :sidebar do %>
  <%= render "common/category_nav" %>
<% end %>

<% content_for :content do %>
  <h4>
    Edit Item Stock
    <%= link_to '', edit_item_path(@item), class: 'pull-right btn btn-default btn-xs glyphicon glyphicon-pencil', title: 'Edit Item' %>
  </h4>
  <%= form_for @item, data: { live_guarded: true } do |f| %>
    <div class="form-group">
      <%= f.label 'Description:', class: "control-label" %>
      <p class="form-control-static"><%= @item.description %></p>
    </div>
    <div class="form-group">
      <%= f.label 'Current Quantity In Stock:', class: "control-label" %>
      <p class="form-control-static"><%= @item.current_quantity %></p>
    </div>
    <div class="form-group">
      <%= f.label "Modify method:" %><br>
      <% Item.edit_methods.each do |label, index| %>
        <label class="radio-inline">
          <input type="radio" name="item[edit_method]" value="<%= label %>" data-guard="required" data-guard-required-target="#edit-method-error"> <%= label.to_s.humanize %>
        </label>
      <% end %>
      <span id="edit-method-error"></span>
    </div>
    <div class="form-group">
      <%= f.label 'Amount:' %>
      <%= f.text_field :edit_amount, class: "form-control", placeholder: "Enter the number", data: { guard: "required int", guard_int_min: 0 } %>
    </div>
    <div class="form-group">
      <%= f.label 'Reason for changing quantity in stock:' %><br>
      <% Item.selectable_edit_reasons.each do |reason, index| %>
        <label class="radio-inline">
          <input type="radio" name="item[edit_reason]" value="<%= reason %>" data-guard="required" data-guard-required-target="#edit-reason-error" /> <%= reason.to_s.humanize %>
        </label>
      <% end %>
      <span id="edit-reason-error"></span>
    </div>
    <div class="form-group">
      <%= f.label 'Reason Details:' %>
      <%= f.text_field :edit_source, class: "form-control", placeholder: "Explain", data: { guard: "required regex", guard_regex_pattern: "[a-zA-Z]", guard_regex_message: "Must contain at lease one letter." } %>
    </div>

    <%= f.submit "Save", class: "btn btn-primary" %>
    <%= link_to "Cancel", items_path(category_id: @item.category_id), type: "button", class: "btn btn-default" %>
{'fraction_non_alphanumeric': 0.2029016890428757, 'fraction_numerical': 0.00259852750108272, 'mean_word_length': 3.378199052132701, 'pattern_counts': {'":': 0, '<': 119, '<?xml version=': 0, '>': 119, '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': '7372661', 'n_tokens_mistral': 1649, 'n_tokens_neox': 1530, 'n_words': 345}