merge with origin

This commit is contained in:
Yan
2017-10-27 17:06:07 +06:30
parent 0f24cc0999
commit 5c27dcff66
15 changed files with 135 additions and 250 deletions

View File

@@ -1,18 +1,43 @@
<%= simple_form_for @in_duty, :url => origami_index_in_duty_path(@table.id), :method => :post do |f| %>
<br>
<%= simple_form_for @in_duty, :url => origami_index_in_duty_path, :method => :post do |f| %>
<span class="patch_method"></span>
<%= f.error_notification %>
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
<div class="form-inputs">
<label>Dining Name:</label>
<%= @table.name %>
<br/><br/>
<div class="form-inputs form-group">
<%= f.hidden_field :dinning_id, :value => @table.id, :class => "form-control col-md-4 " %>
<label>Commissioner Name:</label>
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>
<br/>
<%= f.input :in_time, :placeholder => "From Date", :class => "form-control" %>
<%= f.input :out_time, :placeholder => "To Date", :class => "form-control" %>
<!-- <%= f.input :in_time, :placeholder => "From Date", :class => "form-control datetimepicker" %>
<%= f.input :out_time, :placeholder => "To Date", :class => "form-control datetimepicker" %>-->
<div class="form-group">
<label class="font-14">* In Time</label>
<div class="input-group">
<span class="input-group-addon">
<i class="material-icons">date_range</i>
</span>
<% if !@in_duty.in_time.nil?%>
<input type="text" name="in_duty[in_time]" value="<%= @in_duty.in_time.strftime('%A, %d-%m-%Y') %>" class="datepicker form-control col-md-12" placeholder="Start Date...">
<% else %>
<input type="text" name="in_duty[in_time]" class="datetimepicker form-control col-md-12" placeholder="In Time...">
<% end %>
</div>
</div>
<div class="form-group">
<label>* Out Time</label>
<div class="input-group">
<span class="input-group-addon">
<i class="material-icons">date_range</i>
</span>
<% if !@in_duty.out_time.nil?%>
<input type="text" name="in_duty[out_time]" value="<%= @in_duty.out_time.strftime('%A, %d-%m-%Y') %>" class="datepicker form-control col-md-12" placeholder="Start Date...">
<% else %>
<input type="text" name="in_duty[out_time]" class="datetimepicker form-control col-md-12" placeholder="Out Time...">
<% end %>
</div>
</div>
</div><br>
<div class="form-group">
@@ -21,7 +46,7 @@
<% f.button :button, "Reset", :class => 'btn bg-danger ', :id => 'reset' %>
</div>
<div class="form-actions">
<%= f.button :submit, :class => 'btn bg-blue' %>
<%= f.submit "Create In Duty", :class => 'btn bg-blue' %>
</div>
<% end %>

View File

@@ -40,7 +40,7 @@
</div>
<div class="col-md-1">
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
<button type="button" class="btn btn-default btn-block" id='back'>Back</button>
</div>
</div>
<script type="text/javascript">

View File

@@ -1,45 +1,62 @@
<div class="row">
<div class="col-md-7">
<label>Dining Name:</label>
<%= @table.name %>
<div class="col-md-8">
<br/>
<table class="table table-striped">
<thead>
<tr>
<th>Select</th>
<th>Dining Facility Name</th>
<th>Commissioner Ids</th>
<th>In time</th>
<th>Out time</th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
<% @duties_in.each do |in_duty| %>
<tr class="induty_tr" data-ref="<%= in_duty.id %>">
<td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check"></td>
<td><%= in_duty.dining_facility.name rescue '-' %></td>
<td><%= in_duty.commissioner.name rescue '-' %></td>
<td><%= in_duty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
<td><%= in_duty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
<td><%= link_to 'Remove', origami_destroy_in_duty_path(in_duty.dining_facility.id, in_duty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
<div class="card">
<div class="card-header">
<label>Dining Name:</label>
<%= @table.name %>
</div>
<div class="card-block">
<table class="table table-striped">
<thead>
<tr>
<th>Select</th>
<th>Table Name</th>
<th>Commissioner Ids</th>
<th>In time</th>
<th>Out time</th>
<th>Action</th>
</tr>
<% end %>
</tbody>
</table>
</thead>
<tbody>
<% @duties_in.each do |in_duty| %>
<tr class="induty_tr" data-ref="<%= in_duty.id %>">
<td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check"></td>
<td><%= in_duty.dining_facility.name rescue '-' %></td>
<td><%= in_duty.commissioner.name rescue '-' %></td>
<td><%= in_duty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
<td><%= in_duty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
<td>
<button class="delete btn btn-danger btn-sm waves-effect" data-ref="../table/<%=in_duty.dining_facility.id%>/destroy_in_duty/<%=in_duty.id%>" data-method="delete">
Remove
</button>
<span class="hidden" id="delete_text">
<h6>Are you sure you want to remove this row ?</h6>
<h6>This action can't be undo. </h6>
</span>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<%= paginate @duties_in %>
</div>
</div>
<div class="col-md-4 partial">
<div class="col-md-3 partial">
<%= render 'form', in_duty: @in_duty, table: @table %>
</div>
<div class="col-md-1">
<button type="button" class="form-control btn btn-primary btn-block" id='back'>Back</button>
<br>
<button type="button" class="form-control btn btn-default btn-block" id='back'>Back</button>
<button class="form-control btn btn-info btn-block" id="reset">New</button>
</div>
</div>
@@ -89,18 +106,18 @@
$('#back').on('click', function () {
window.location.href = '/origami/table/' + "<%= @table.id %>";
});
$('#reset').click(function () {
var url = "<%= new_origami_in_duty_path %>";
$('#reset').click(function () {
location.reload();
/*var url = "<%= origami_index_in_duty_path %>";
console.log(url);
$.ajax({
type: "GET",
url: url,
data: { table_id: <%= @table.id %> },
success: function (data) {
$('.partial').empty().append(data);
$('.induty_tr > td > .checkbox_check').prop("checked", false);
}
});
});*/
});
</script>