93 lines
3.3 KiB
Plaintext
93 lines
3.3 KiB
Plaintext
<div class="conatiner-fluid">
|
|
<div class="row">
|
|
|
|
<div class="col-md-8">
|
|
<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 t("views.btn.delete"), origami_destroy_in_duty_path(in_duty.dining_facility.id, in_duty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<%= paginate @duties_in %>
|
|
</div>
|
|
|
|
<div class="col-md-4 partial">
|
|
<%= render 'form', in_duty: @in_duty, table: @table %>
|
|
</div>
|
|
<span style="float: right">
|
|
<%= link_to t("views.btn.new"), new_origami_in_duty_path, :class => 'btn bg-blue' %>
|
|
</span>
|
|
</div>
|
|
|
|
<div class="col-md-1">
|
|
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$(document).on('click', ".induty_tr", function () {
|
|
|
|
$(this).closest('tr').find('.checkbox_check').prop("checked", true);
|
|
|
|
var in_duty_id = $(this).attr('data-ref');
|
|
var table_id = "<%= @table.id %>";
|
|
var url = "/origami/assign_in_duty/table/" + table_id + "/in_duty/" + in_duty_id + "/edit";
|
|
|
|
$.ajax({
|
|
type: "GET",
|
|
url: url,
|
|
data: {},
|
|
|
|
success: function (data) {
|
|
debugger;
|
|
$('.partial').empty().append(data);
|
|
// $('#in_duty_id').val(data.in_duty.id);
|
|
// $('#in_duty_commissioner_ids').val(data.commissioner.id);
|
|
// $('#in_duty_in_time').val(data.in_duty.in_time);
|
|
// $('#in_duty_out_time').val(data.in_duty.out_time);
|
|
//
|
|
// $('#update').removeAttr('disabled').val('');
|
|
// $('#update').attr('value', 'Update');
|
|
// $('#create').attr('disabled', 'disabled');
|
|
//
|
|
// $("#new_in_duty").attr('class', 'simple_form edit_in_duty');
|
|
// var id = "edit_in_duty_" + in_duty_id;
|
|
// $("#new_in_duty").attr('id', id);
|
|
//
|
|
// $(".edit_in_duty").attr('id', id);
|
|
// $(".edit_in_duty").attr('action', '/origami/edit_in_duty/' + $('#in_duty_id').val());
|
|
// $(".edit_in_duty").attr('action', '/origami/edit_in_duty/' + $('#in_duty_id').val());
|
|
// $(".patch_method").html('<input type="hidden" name="_method" value="patch">');
|
|
|
|
// setInterval(function () {
|
|
// $('.partial').load('/controller_name/action_name');
|
|
// }, 3000);
|
|
}
|
|
});
|
|
});
|
|
|
|
$('#back').on('click', function () {
|
|
window.location.href = '/origami/table/' + "<%= @table.id %>";
|
|
})
|
|
</script>
|
|
|