merge with august_spring
This commit is contained in:
34
app/views/origami/in_duties/_assign_in_duty.html.erb
Normal file
34
app/views/origami/in_duties/_assign_in_duty.html.erb
Normal file
@@ -0,0 +1,34 @@
|
||||
<%= 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>Commissioner Name:</label>
|
||||
<%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>
|
||||
<%= 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' %>
|
||||
|
||||
<button type="button" class="btn btn-inverse pull-right" id='back'><i class="fa fa-arrow-left"></i> Back</button>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#reset').click(function () {
|
||||
location.reload();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
14
app/views/origami/in_duties/_edit_in_duty.html.erb
Normal file
14
app/views/origami/in_duties/_edit_in_duty.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<%= simple_form_for([:origami, @in_duty]) 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-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
36
app/views/origami/in_duties/_form.html.erb
Normal file
36
app/views/origami/in_duties/_form.html.erb
Normal file
@@ -0,0 +1,36 @@
|
||||
<%= simple_form_for @in_duty, :url => origami_index_in_duty_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">
|
||||
<label>Dining Name:</label>
|
||||
<%= @table.name %>
|
||||
<br/><br/>
|
||||
<%= 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" %>
|
||||
</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>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
2
app/views/origami/in_duties/_in_duty.json.jbuilder
Normal file
2
app/views/origami/in_duties/_in_duty.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! in_duty, :id, :created_at, :updated_at
|
||||
json.url in_duty_url(in_duty, format: :json)
|
||||
64
app/views/origami/in_duties/assign_in_duty.html.erb
Normal file
64
app/views/origami/in_duties/assign_in_duty.html.erb
Normal file
@@ -0,0 +1,64 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<h3>Create In Duty</h3>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<%= simple_form_for([:origami,@in_duty]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<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/>
|
||||
<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">
|
||||
<div class='row'>
|
||||
<div class="col-md-2">
|
||||
<%= link_to 'Back', origami_index_in_duty_path(@table.id), class: 'btn btn-success' %>
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<button type="button" class="btn btn-primary btn-block" id='in_duty'>Create In Duty</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
$('.datepicker').datepicker({
|
||||
format : 'dd-mm-yyyy',
|
||||
autoclose: true
|
||||
});
|
||||
$('.datepicker').attr('ReadOnly','true');
|
||||
$('.datepicker').css('cursor','pointer');
|
||||
});
|
||||
|
||||
$('#in_duty').on('click', function () {
|
||||
var ajax_url = "/origami/assign_in_duty";
|
||||
var commissioner_ids = $('#in_duty_commissioner_ids').val();
|
||||
var in_time = $('#in_duty_in_time').val();
|
||||
var out_time = $('#in_duty_out_time').val();
|
||||
var dining_id = '<%= @table.id %>'
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'dining_id=' + dining_id + "&commissioner_ids=" + commissioner_ids +'&in_time=' + in_time + "&out_time=" + out_time,
|
||||
success: function (result) {
|
||||
window.location.href = '/origami/assign_in_duty/'+ dining_id;
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
</script>
|
||||
10
app/views/origami/in_duties/edit.html.erb
Normal file
10
app/views/origami/in_duties/edit.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_in_duties_path %>">In Duties</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', in_duty: @in_duty %>
|
||||
</div>
|
||||
6
app/views/origami/in_duties/edit_in_duty.html.erb
Normal file
6
app/views/origami/in_duties/edit_in_duty.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<h3>Update In Duty</h3>
|
||||
</div>
|
||||
<%= render 'edit_in_duty', in_duty: @in_duty %>
|
||||
</div>
|
||||
91
app/views/origami/in_duties/index.html.erb
Normal file
91
app/views/origami/in_duties/index.html.erb
Normal file
@@ -0,0 +1,91 @@
|
||||
<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 'Destroy', 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('.new', :default => t("helpers.links.new")), new_origami_in_duty_path, :class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<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', ".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>
|
||||
|
||||
1
app/views/origami/in_duties/index.json.jbuilder
Normal file
1
app/views/origami/in_duties/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @in_duties, partial: 'in_duties/in_duty', as: :in_duty
|
||||
106
app/views/origami/in_duties/index_in_duty.html.erb
Normal file
106
app/views/origami/in_duties/index_in_duty.html.erb
Normal file
@@ -0,0 +1,106 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-7">
|
||||
<label>Dining Name:</label>
|
||||
<%= @table.name %>
|
||||
<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>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= paginate @duties_in %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 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>
|
||||
<button class="form-control btn btn-info btn-block" id="reset">New</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 %>";
|
||||
});
|
||||
|
||||
$('#reset').click(function () {
|
||||
var url = "<%= new_origami_in_duty_path %>";
|
||||
$.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>
|
||||
10
app/views/origami/in_duties/new.html.erb
Normal file
10
app/views/origami/in_duties/new.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_in_juties_path %>">In Duties</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', in_duty: @in_duty, table: @table %>
|
||||
</div>
|
||||
43
app/views/origami/in_duties/show.html.erb
Normal file
43
app/views/origami/in_duties/show.html.erb
Normal file
@@ -0,0 +1,43 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_in_duties_path %>">In Duties</a></li>
|
||||
|
||||
<span style="float: right">
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">In Duty</h4>
|
||||
<table class="table">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td style="width:20%">Dining Facility Name</td>
|
||||
<td><%= @in_duty.dining_facility.name%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Commissioner Name</td>
|
||||
<td>
|
||||
<%= @in_duty.commissioner.name rescue '-' %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">In Time</td>
|
||||
<td><%= @in_duty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:20%">Out Time</td>
|
||||
<td><%= @in_duty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= link_to 'Back', origami_in_duties_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Edit', edit_origami_in_duty_path(@in_duty), class: 'btn btn-info' %>
|
||||
<%= link_to 'Destroy', origami_in_duty_path(@in_duty), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
1
app/views/origami/in_duties/show.json.jbuilder
Normal file
1
app/views/origami/in_duties/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "in_duties/in_duty", in_duty: @in_duty
|
||||
Reference in New Issue
Block a user