<div class="page-header">
  <ol class="breadcrumb">
    <li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
    <li class="breadcrumb-item active"><%= t :shiftsale %></li>
    <span class="float-right">
      <%= link_to 'Back', dashboard_path %>
    </span>
  </ol>
</div>
<div class="row">
  <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
      <div class="main-box-body clearfix p-l-5 p-r-5">
        <!--  <div class="table-responsive">
          <table class="table table-">
            <tbody>
              <tr>
                 <td colspan="8">
                    <%= form_tag transactions_shift_sales_path, :method => :get do %>
                    <div class="row clearfix">
                       <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
                         <label><%= t("views.right_panel.detail.enter_keyboards") %></label>
                         <input type="text" name="receipt_no" class="form-control" placeholder="" style="margin-right: 10px">
                       </div>
                       <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3"> 
                         <label class=""><%= t("views.right_panel.detail.from") %></label>
                         <input class="form-control datepicker" name="from" id="from date" type="text" placeholder="From date">
                      </div>
                      <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
                        <label class=""><%= t("views.right_panel.detail.to") %></label>
                        <input class="form-control datepicker" name="to" id="to date" type="text" placeholder="To date">
                      </div>
                      
                      <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
                        <label></label>
                        <br><input type="submit" value="Search" class='btn btn-primary btn-md'>
                      </div>
                    </div>
                    <% end %>
                 </td>
              </tr>
            </tbody>
          </table>
        </div> -->
        <div class="card">
          <div class="table-responsive">
          <table class="table table-bordered table-striped table-hover">
            <thead>
               <tr>
                <th>Cashier Name</th>
                <th>Cashier Terminal </th>
                <th>Opening Time </th>
                <th>Closing Time </th>
                <th>Opening float </th>
                <th>Closing Amount </th>
                <th>Cast In </th>
                <th>Cast Out </th>
                <th>Total Receipt </th>
                <th>Dining Count </th>
                <th>Takeaway Count </th>
                <th>Total Void</th>
                <th>Action</th>
              </tr>
            </thead>

            <tbody>
              <% if @shift_sales != 0 %>
                  <% @shift_sales.each do |shift_sale| %>
                    <tr>
                      <td><%= shift_sale.employee.name%></td>
                      <td><%=shift_sale.cashier_terminal.name%></td>
                      <td><%= shift_sale.shift_started_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') %>
                      </td>
                       <td><%= shift_sale.shift_closed_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') rescue '-' %>
                      </td>
                      <td><%=shift_sale.opening_balance %></td>
                      <td><%=shift_sale.closing_balance %></td>
                      <td><%=shift_sale.cash_in %></td>
                      <td><%=shift_sale.cash_out %></td>
                      <th><%= shift_sale.total_receipt %></th>
                      <th><%= shift_sale.dining_count %></th>
                      <th><%= shift_sale.takeaway_count %></th>
                      <th>(<%= shift_sale.total_void.round(2) %>)</th>
                      <td><%= link_to t("views.btn.show"), transactions_shift_sale_path(shift_sale),:class => 'btn btn-info btn-sm waves-effect' %></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 @shift_sales != 0 %>
               <%= paginate @shift_sales %>
           <% end %>
        </div>
        </div>
      </div>

  </div>
</div>

<script type="text/javascript">
  $(function(){
    $("#receipt_no").val("<%=params[:receipt_no]%>");
    $("#from").val("<%=params[:from]%>");
    $("#to").val("<%=params[:to]%>");
  });

</script>

     

