merge with august_spring
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
<%= f.input :in_time, :placeholder => "From Date", :class => "form-control" %>
|
||||
|
||||
<%= f.input :out_time, :placeholder => "From Date", :class => "form-control" %>
|
||||
<%= f.input :out_time, :placeholder => "To Date", :class => "form-control" %>
|
||||
|
||||
</div><br>
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<%= simple_form_for([:origami,@in_juty]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
<%= simple_form_for([:origami, @in_juty]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %><br/><br/>
|
||||
<%= f.input :in_time %>
|
||||
<%= f.input :out_time %>
|
||||
</div>
|
||||
<div class="form-inputs">
|
||||
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>
|
||||
<br/><br/>
|
||||
<%= f.input :in_time %>
|
||||
<%= f.input :out_time %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,33 +1,43 @@
|
||||
<div class="col-md-3">
|
||||
<%= simple_form_for([:origami,@in_juty]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
<%= simple_form_for @in_juty, :url => origami_index_in_juty_path(@table.id), :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">
|
||||
|
||||
<%= f.hidden_field :dinning_id, :value => @table.id, :class => "form-control col-md-4 " %>
|
||||
|
||||
<label>Dining Name:</label>
|
||||
<%= @table.name %>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<label>Commissioner Name:</label>
|
||||
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>
|
||||
<br/><br/>
|
||||
|
||||
<%= f.input :in_time, :placeholder => "From Date", :class => "form-control" %>
|
||||
|
||||
<%= f.input :out_time, :placeholder => "To Date", :class => "form-control" %>
|
||||
|
||||
</div><br>
|
||||
|
||||
<div class="form-group">
|
||||
<% f.button :submit, "Create", :class => 'btn btn-primary ', :id => 'create' %>
|
||||
<% f.button :submit, "Update", :class => 'btn btn-primary ', :disabled => '', :id => 'update' %>
|
||||
<% f.button :button, "Reset", :class => 'btn btn-danger ', :id => 'reset' %>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit, :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.label :dinning_id %>
|
||||
<%= f.collection_select :dinning_id, DiningFacility.all, :id, :name, {prompt: 'Select Dining Facilities'}, {class: 'form-control'} %><br/>
|
||||
<%= f.label :commissioner_ids %>
|
||||
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %><br/>
|
||||
<label>In time</label>
|
||||
<%= f.text_field :in_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%><br/>
|
||||
<label>Out time</label>
|
||||
<%= f.text_field :out_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%>
|
||||
</div><br>
|
||||
<div class="form-actions">
|
||||
<%= link_to 'Back', origami_in_juties_path, class: 'btn btn-success' %>
|
||||
<%= f.button :submit, class: 'btn btn-info' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
$('.datepicker').datepicker({
|
||||
format : 'dd-mm-yyyy',
|
||||
autoclose: true
|
||||
});
|
||||
$('.datepicker').attr('ReadOnly','true');
|
||||
$('.datepicker').css('cursor','pointer');
|
||||
});
|
||||
$(document).ready(function () {
|
||||
|
||||
</script>
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -1,38 +1,91 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li>In Juties</li>
|
||||
<span style="float: right">
|
||||
<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>
|
||||
<% @juties_in.each do |in_juty| %>
|
||||
<tr class="injuty_tr" data-ref="<%= in_juty.id %>">
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check"></td>
|
||||
<td><%= in_juty.dining_facility.name rescue '-' %></td>
|
||||
<td><%= in_juty.commissioner.name rescue '-' %></td>
|
||||
<td><%= in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= link_to 'Destroy', origami_destroy_in_juty_path(in_juty.dining_facility.id, in_juty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= paginate @juties_in %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 partial">
|
||||
<%= render 'form', in_juty: @in_juty, table: @table %>
|
||||
</div>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_in_juty_path, :class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="card">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Dining Facility Name</th>
|
||||
<th>Commissioner Ids</th>
|
||||
<th>In time</th>
|
||||
<th>Out time</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @in_juties.each do |in_juty| %>
|
||||
<tr>
|
||||
<td><%= in_juty.dining_facility.name rescue '-' %></td>
|
||||
<td><%= in_juty.commissioner.name rescue '-' %></td>
|
||||
<td><%= in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= link_to 'Show', origami_in_juty_path(in_juty) %></td>
|
||||
<td><%= link_to 'Edit', edit_origami_in_juty_path(in_juty) %></td>
|
||||
<td><%= link_to 'Destroy', origami_in_juty_path(in_juty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="col-md-1">
|
||||
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).on('click', ".injuty_tr", function () {
|
||||
|
||||
$(this).closest('tr').find('.checkbox_check').prop("checked", true);
|
||||
|
||||
var in_juty_id = $(this).attr('data-ref');
|
||||
var table_id = "<%= @table.id %>";
|
||||
var url = "/origami/assign_in_juty/table/" + table_id + "/in_juty/" + in_juty_id + "/edit";
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
|
||||
success: function (data) {
|
||||
debugger;
|
||||
$('.partial').empty().append(data);
|
||||
// $('#in_juty_id').val(data.in_juty.id);
|
||||
// $('#in_juty_commissioner_ids').val(data.commissioner.id);
|
||||
// $('#in_juty_in_time').val(data.in_juty.in_time);
|
||||
// $('#in_juty_out_time').val(data.in_juty.out_time);
|
||||
//
|
||||
// $('#update').removeAttr('disabled').val('');
|
||||
// $('#update').attr('value', 'Update');
|
||||
// $('#create').attr('disabled', 'disabled');
|
||||
//
|
||||
// $("#new_in_juty").attr('class', 'simple_form edit_in_juty');
|
||||
// var id = "edit_in_juty_" + in_juty_id;
|
||||
// $("#new_in_juty").attr('id', id);
|
||||
//
|
||||
// $(".edit_in_juty").attr('id', id);
|
||||
// $(".edit_in_juty").attr('action', '/origami/edit_in_juty/' + $('#in_juty_id').val());
|
||||
// $(".edit_in_juty").attr('action', '/origami/edit_in_juty/' + $('#in_juty_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>
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<td><%= in_juty.commissioner.name rescue '-' %></td>
|
||||
<td><%= in_juty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= in_juty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
<td><%= link_to 'Destroy', origami_destroy_in_juty_path(in_juty.dining_facility.id, in_juty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
<td><%= link_to 'Remove', origami_destroy_in_juty_path(in_juty.dining_facility.id, in_juty), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
@@ -30,11 +30,16 @@
|
||||
<%= paginate @juties_in %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<%= render 'assign_in_juty', in_juty: @in_juty, table: @table %>
|
||||
<div class="col-md-4 partial">
|
||||
<%= render 'form', in_juty: @in_juty, table: @table %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<button type="button" class="col-md-1 btn btn-primary btn-block" id='back'>Back</button>
|
||||
<button class="col-md-1 btn btn-info" id="reset">New</button>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).on('click', ".injuty_tr", function () {
|
||||
|
||||
@@ -50,29 +55,48 @@
|
||||
data: {},
|
||||
|
||||
success: function (data) {
|
||||
debugger;
|
||||
$('.partial').empty().append(data);
|
||||
// $('#in_juty_id').val(data.in_juty.id);
|
||||
// $('#in_juty_commissioner_ids').val(data.commissioner.id);
|
||||
// $('#in_juty_in_time').val(data.in_juty.in_time);
|
||||
// $('#in_juty_out_time').val(data.in_juty.out_time);
|
||||
//
|
||||
// $('#update').removeAttr('disabled').val('');
|
||||
// $('#update').attr('value', 'Update');
|
||||
// $('#create').attr('disabled', 'disabled');
|
||||
//
|
||||
// $("#new_in_juty").attr('class', 'simple_form edit_in_juty');
|
||||
// var id = "edit_in_juty_" + in_juty_id;
|
||||
// $("#new_in_juty").attr('id', id);
|
||||
//
|
||||
// $(".edit_in_juty").attr('id', id);
|
||||
// $(".edit_in_juty").attr('action', '/origami/edit_in_juty/' + $('#in_juty_id').val());
|
||||
// $(".edit_in_juty").attr('action', '/origami/edit_in_juty/' + $('#in_juty_id').val());
|
||||
// $(".patch_method").html('<input type="hidden" name="_method" value="patch">');
|
||||
|
||||
$('#in_juty_id').val(data.in_juty.id);
|
||||
$('#in_juty_commissioner_ids').val(data.commissioner.id);
|
||||
$('#in_juty_in_time').val(data.in_juty.in_time);
|
||||
$('#in_juty_out_time').val(data.in_juty.out_time);
|
||||
|
||||
$('#update').removeAttr('disabled').val('');
|
||||
$('#update').attr('value', 'Update');
|
||||
$('#create').attr('disabled', 'disabled');
|
||||
|
||||
$("#new_in_juty").attr('class', 'simple_form edit_in_juty');
|
||||
var id = "edit_in_juty_" + in_juty_id;
|
||||
$("#new_in_juty").attr('id', id);
|
||||
|
||||
$(".edit_in_juty").attr('id', id);
|
||||
$(".edit_in_juty").attr('action', '/origami/edit_in_juty/' + $('#in_juty_id').val());
|
||||
$(".edit_in_juty").attr('action', '/origami/edit_in_juty/' + $('#in_juty_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 %>";
|
||||
})
|
||||
});
|
||||
|
||||
$('#reset').click(function () {
|
||||
var url = "<%= new_origami_in_juty_path %>";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: { table_id: <%= @table.id %> },
|
||||
success: function (data) {
|
||||
$('.partial').empty().append(data);
|
||||
$('.injuty_tr > td > .checkbox_check').prop("checked", false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', in_juty: @in_juty %>
|
||||
<%= render 'form', in_juty: @in_juty, table: @table %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user