<div class="row">
  <div class="col-lg-12">
    <ol class="breadcrumb">
       <li><a href="<%= crm_root_path %>">Home</a></li>
       <li class="active">
           <a href="<%= transactions_sales_path %>">Sale</a>
       </li>
       
    </ol>
  </div>
</div>

<div class="row">
  <div class="col-lg-12">
      <div class="main-box-body clearfix">
        <div class="table-responsive">
          <table class="table table-striped">
            <thead>
              <tr>
                 <td colspan="8">
                    <%= form_tag transactions_sales_path, :method => :get do %>
                      <div class="input-append form-group pull-right col-md-6">
                        <input class="datepicker col-md-3 form-control" name="date" id="date" type="text" placeholder="Receipt date" style="margin-right: 10px">
      
                         <input type="text" name="receipt_no" class="col-md-5 form-control" placeholder="Receipt No" style="margin-right: 10px">
                        <button type="submit" class="btn btn-primary btn">Search</button>
                      </div>
                    <% end %>
                 </td>
              </tr>
              <tr>
                <th>Sale Id </th>
                <th>Receipt no </th>
                <th>Grand total</th>
                <th>Tax amount</th>
                <th>Cashier</th>
                <th>Sales status</th>
                <th>Receipt Date</th>
              </tr>
            </thead>

            <tbody>
              <% if @sales != 0 %>
                  <% @sales.each do |sale| %>
                    <tr>
                      <td><%= link_to sale.sale_id, transactions_sale_path(sale) %></td>
                      <td><%= sale.receipt_no %></td>
                      <td><%= sale.grand_total rescue '-' %></td>
                      <td><%= sale.total_tax %></td>
                      <td><%= sale.cashier_name rescue '-' %></td>
                      <td> <%= sale.sale_status %> </td>
                      <td> <%= sale.receipt_date.strftime("%d-%m-%Y") %> </td>
                    </tr>
                  <% end %>
              <% else %>
                    <tr><td colspan="8"><strong><p style="text-align: center">There is no data for search....</p></strong></td></tr>
              <% end %>
            </tbody>
          </table>
          <br>
           <% if @sales != 0 %>
               <%= paginate @sales %>
           <% end %>
        </div>
      </div>

  </div>
</div>

<script type="text/javascript">
  $(function () {

            $('.datepicker').datepicker({
               format : 'dd-mm-yyyy',
               autoclose: true
            });
            $('.datepicker').attr('ReadOnly','true');
            $('.datepicker').css('cursor','pointer');

     
  });
</script>



     

