merge with august_spring
This commit is contained in:
@@ -195,7 +195,7 @@
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="card" id="backend" onclick="location.href='<%= inventory_inventory_path %>'">
|
||||
<div class="card" id="backend" onclick="location.href='<%= inventory_path %>'">
|
||||
<div class="card-content dashboard-nav">Inventory</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
40
app/views/inventory/inventory/_inventory_list.html.erb
Normal file
40
app/views/inventory/inventory/_inventory_list.html.erb
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h2> Inventoy Product Lists</h2></div>
|
||||
<div class="col-md-4"><button id='new_inventory_product' class='btn btn-primary' style='margin-top:15px;'>New Inventory Product</button></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Product</th>
|
||||
<th>Min Order</th>
|
||||
<th>Max Stock</th>
|
||||
<th>Created by</th>
|
||||
<th>Created Time</th>
|
||||
</tr>
|
||||
<%
|
||||
count = 0
|
||||
@products.each do |item|
|
||||
count += 1
|
||||
%>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td><%= item.item_code rescue ""%></td>
|
||||
<td><%= item.min_order_level %></td>
|
||||
<td><%= item.max_stock_level %></td>
|
||||
<td><%= item.created_by%></td>
|
||||
<td><%= item.created_at%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('#new_inventory_product').on('click',function(){
|
||||
window.location.href = '/inventory/inventory_definitions/new';
|
||||
})
|
||||
</script>
|
||||
@@ -1,17 +1,22 @@
|
||||
# Hello Inventory
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||
<%= render 'inventory_list' %>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
<button id="refreshbutton" type="button" class="btn btn-block"> Inventory Product Lists</button>
|
||||
<button id="cash_in" type="button" class="btn btn-block btn-primary"> Stock Taking </button>
|
||||
<button id="cash_out" type="button" class="btn btn-block btn-primary"> Stock Check Report</button>
|
||||
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
|
||||
<button id="back" type="button" class="btn btn-block btn-primary"><i class="fa fa-home fa-lg"></i> Back
|
||||
</button>
|
||||
<button id="back" type="button" class="btn btn-block btn-primary"> Back </button>
|
||||
<%end%>
|
||||
|
||||
<button id="stock_taking" type="button" class="btn btn-block btn-primary"> New Stock Taking </button>
|
||||
<button id="stock_check_report" type="button" class="btn btn-block btn-primary"> Stock Check Report</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('#stock_taking').on('click',function(){
|
||||
window.location.href = '/inventory/stock_checks';
|
||||
})
|
||||
$('#stock_check_report').on('click', function(){
|
||||
window.location.href = '';
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
<%= simple_form_for(@inventory_definition) do |f| %>
|
||||
|
||||
<%= simple_form_for([:inventory,@inventory_definition]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :item_code %>
|
||||
<%= f.input :min_order_level %>
|
||||
<%= f.input :max_stock_level %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
<h1>New Inventory Definition</h1>
|
||||
|
||||
<%= render 'form', inventory_definition: @inventory_definition %>
|
||||
|
||||
<%= link_to 'Back', inventory_definitions_path %>
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= inventory_path %>">Product Inventory</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render 'form', inventory: @inventory_definition %>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<%= simple_form_for(@stock_check) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1,2 +0,0 @@
|
||||
json.extract! stock_check, :id, :created_at, :updated_at
|
||||
json.url stock_check_url(stock_check, format: :json)
|
||||
1
app/views/inventory/stock_checks/create.json.jbuilder
Normal file
1
app/views/inventory/stock_checks/create.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.stock_id @check.id
|
||||
@@ -1,6 +0,0 @@
|
||||
<h1>Editing Stock Check</h1>
|
||||
|
||||
<%= render 'form', stock_check: @stock_check %>
|
||||
|
||||
<%= link_to 'Show', @stock_check %> |
|
||||
<%= link_to 'Back', stock_checks_path %>
|
||||
@@ -1,25 +1,102 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<h1>Stock Checks</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<input type='text' id='stock_check_reason' class='form-control' placeholder="Set Stock Check Reason" value=''></input>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-2">
|
||||
Product
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<input type='text' class='form-control' placeholder="Product Name" id='product_sku' value=''></input>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-2">
|
||||
Qty
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<input type='text' class='form-control' placeholder="Qty" id='product_qty' value=''></input>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-4"></div>
|
||||
<div class="col-md-7">
|
||||
<button class="btn btn-primary form-control" id='save_to_stock_check'> Save </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<div class="col-md-5">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<table class="table table-striped" id='stock_item'>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Product</th>
|
||||
<th>Balance</th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="row">
|
||||
<button class="btn btn-primary pull-right form-control" style='margin-bottom:2px;' id='finish'> Finish </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tbody>
|
||||
<% @stock_checks.each do |stock_check| %>
|
||||
<tr>
|
||||
<td><%= link_to 'Show', stock_check %></td>
|
||||
<td><%= link_to 'Edit', edit_stock_check_path(stock_check) %></td>
|
||||
<td><%= link_to 'Destroy', stock_check, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
var count = 0
|
||||
|
||||
<br>
|
||||
$('#save_to_stock_check').on('click', function(){
|
||||
count += 1;
|
||||
product_sku = $('#product_sku').val();
|
||||
product_qty = $('#product_qty').val();
|
||||
var tr = '<tr>'
|
||||
+ '<td>'+ count +'</td>'
|
||||
+ '<td><input type=text value="'+ product_sku +'" id="item_sku_'+ count +'" name='+count+'></input></td>'
|
||||
+ '<td><input type=text value="'+ product_qty +'" id="item_qty_'+ count +'" name='+count+'></input></td>'
|
||||
+ '</tr>'
|
||||
$('#stock_item').append(tr)
|
||||
$('#product_sku').val('');
|
||||
$('#product_qty').val('');
|
||||
})
|
||||
|
||||
<%= link_to 'New Stock Check', new_stock_check_path %>
|
||||
$('#finish').on('click',function(){
|
||||
var reason = $('#stock_check_reason').val();
|
||||
var arr = [];
|
||||
var jsonStr = ''
|
||||
|
||||
for(var i = 1; i <= count; i++){
|
||||
itemname = $('#item_sku_'+i ).val();
|
||||
itemqty = $('#item_qty_'+i ).val();
|
||||
arr.push({sku:itemname, qty:itemqty})
|
||||
jsonStr = JSON.stringify(arr)
|
||||
}
|
||||
console.log(jsonStr)
|
||||
$.ajax({
|
||||
type: 'Post',
|
||||
url: '<%= inventory_stock_check_save_path %>',
|
||||
data:'stock_item='+ jsonStr + '&reason='+ reason,
|
||||
success:function(data){
|
||||
alert(data['stock_id'])
|
||||
window.location.href = '/inventory/stock_checks/'+ data['stock_id'];
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
json.array! @stock_checks, partial: 'stock_checks/stock_check', as: :stock_check
|
||||
@@ -1,5 +0,0 @@
|
||||
<h1>New Stock Check</h1>
|
||||
|
||||
<%= render 'form', stock_check: @stock_check %>
|
||||
|
||||
<%= link_to 'Back', stock_checks_path %>
|
||||
@@ -1,4 +1,74 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
<div class="row">
|
||||
<input type='hidden' id='stock_check_id' value='<%= @check.id %>'/>
|
||||
<div class="col-md-10">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
Check by
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<%= @check.check_by %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
Check At
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<%= @check.created_at %></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
Reason
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<%= @check.reason %>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<table class="table table-striped col-md-12">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Product</th>
|
||||
<th>Stock Count</th>
|
||||
<th>Stock Balance</th>
|
||||
<th>Different</th>
|
||||
<th>Remark</th>
|
||||
</tr>
|
||||
<%
|
||||
count = 0
|
||||
@check.stock_check_items.each do |item|
|
||||
count += 1
|
||||
%>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td><%= item.item_code %></td>
|
||||
<td><%= item.stock_count %></td>
|
||||
<td><%= item.stock_balance %></td>
|
||||
<td><%= item.different %></td>
|
||||
<td><%= item.remark %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button id="back" type="button" class="btn btn-block btn-primary"> Back </button>
|
||||
<button id="save_to_journal" type="button" class="btn btn-block btn-primary"> Save to Journal </button>
|
||||
<button id="print" type="button" class="btn btn-block btn-primary"> Print </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= link_to 'Edit', edit_stock_check_path(@stock_check) %> |
|
||||
<%= link_to 'Back', stock_checks_path %>
|
||||
<script>
|
||||
$('#save_to_journal').on('click', function(){
|
||||
check_id = $('#stock_check_id').val();
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '<%= inventory_save_to_journal_path %>',
|
||||
data: 'data='+ check_id,
|
||||
success: function(){
|
||||
alert('success')
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
json.partial! "stock_checks/stock_check", stock_check: @stock_check
|
||||
@@ -9,7 +9,7 @@
|
||||
<title>SmartSales : Restaurant</title>
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
<%= stylesheet_link_tag 'inventory', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= stylesheet_link_tag 'origami', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
<%= stylesheet_link_tag 'jquery-confirm', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'jquery-confirm', 'data-turbolinks-track': 'reload' %>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -49,32 +49,79 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6"><%= f.input :original_product,collection: MenuItem.order("name desc").pluck(:name,:item_code),input_html: { selected: 2 } %></div>
|
||||
<% arr = MenuItem.active.order("name desc").pluck(:name,:item_code) %>
|
||||
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
|
||||
<% arr.push(p) %>
|
||||
<% end %>
|
||||
<div class="col-md-3">
|
||||
<label class="control-label"><abbr title="required">*</abbr> Item</label>
|
||||
<select class="form-control item_code_place">
|
||||
<% if !@promotion.original_product.nil? %>
|
||||
<% menuiteminstance = MenuItemInstance.find_by_item_instance_code(@promotion.original_product) %>
|
||||
<% if menuiteminstance.nil?%>
|
||||
<% code = @promotion.original_product %>
|
||||
<% else %>
|
||||
<% code = menuiteminstance.menu_item.item_code %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% arr.each do |a| %>
|
||||
<% if a[1] == code %>
|
||||
<option value="<%= a[1]%>" selected><%= a[0] %></option>
|
||||
<% else %>
|
||||
<option value="<%= a[1]%>"><%= a[0] %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<% sample = [] %>
|
||||
<% if !@promotion.original_product.nil? %>
|
||||
<% if !MenuItemInstance.find_by_item_instance_code(@promotion.original_product).nil? %>
|
||||
<% sample = MenuItemInstance.where("item_instance_code=?",@promotion.original_product).pluck(:item_instance_name,:item_instance_code)%>
|
||||
<% else %>
|
||||
<% sample = Product.where("item_code=?",@promotion.original_product).pluck(:name,:item_code)%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="col-md-3"><%= f.input :original_product,collection: sample %></div>
|
||||
<!-- <div class="col-md-6"><%= f.input :original_product,collection: MenuItemInstance.order("item_instance_name desc").pluck(:item_instance_name,:item_instance_code),input_html: { selected: 2 } %></div> -->
|
||||
<div class="col-md-6"><%= f.input :min_qty %></div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="" style="border: 1px solid #cccccc;padding:1%">
|
||||
<div class="row">
|
||||
<div class="col-md-2" style="text-align:center">Item Code</div>
|
||||
<div class="col-md-4" style="text-align:center">Item Code</div>
|
||||
<div class="col-md-2" style="text-align:center">Min Qty</div>
|
||||
<div class="col-md-2" style="text-align:center">Net off</div>
|
||||
<div class="col-md-2" style="text-align:center">Net Price</div>
|
||||
<div class="col-md-2" style="text-align:center">Percentage</div>
|
||||
<div class="col-md-2" style="text-align:center"></div>
|
||||
<div class="col-md-1" style="text-align:center">Percentage</div>
|
||||
<div class="col-md-1" style="text-align:center"></div>
|
||||
</div>
|
||||
<div class="row"></div >
|
||||
<%= f.fields_for :promotion_products do |pro| %>
|
||||
<div class="row">
|
||||
<div class="col-md-2"><%= pro.input :item_code, label: false,collection: MenuItem.order("name desc").pluck(:name,:item_code)%></div>
|
||||
<% arr = MenuItem.active.order("name desc").pluck(:name,:item_code) %>
|
||||
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
|
||||
<% arr.push(p) %>
|
||||
<% end %>
|
||||
<div class="col-md-2" style="text-align:left">
|
||||
<select class="form-control item_code_place1">
|
||||
<% arr.each do |a| %>
|
||||
<option value="<%= a[1 ]%>"><%= a[0] %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
<% sample = [] %>
|
||||
<div class="col-md-2" style="text-align:left"><%= pro.input :item_code, :class => 'promoproduct', collection: sample,input_html: { selected: 2 }, label: false %></div>
|
||||
<div class="col-md-2"><%= pro.input :min_qty , label: false%></div>
|
||||
<div class="col-md-2"><%= pro.input :net_off , label: false %></div>
|
||||
<div class="col-md-2"><%= pro.input :net_price , label: false %></div>
|
||||
<div class="col-md-2"><%= pro.input :percentage , label: false %></div>
|
||||
<div class="col-md-2" style="text-align:right"><%= pro.link_to_remove "X" %></div>
|
||||
<div class="col-md-1"><%= pro.input :percentage , label: false %></div>
|
||||
<div class="col-md-1" style="text-align:right"><%= pro.link_to_remove "X" %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="col-md-12" style="text-align:right;"><%= f.link_to_add "Add Product", :promotion_products, :class => 'btn btn-primary' %></div>
|
||||
<div class="col-md-12" style="text-align:right;"><%= f.link_to_add "Add Product", :promotion_products, :class => 'btn btn-primary addProduct' %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -103,5 +150,56 @@ $(document).ready(function(){
|
||||
datepicker:false,
|
||||
format:'H:m'
|
||||
});
|
||||
$("#promotion_original_product").select2();
|
||||
$(".item_code_place").select2();
|
||||
$(".item_code_place").on('change', function(event) {
|
||||
var ajax_url = "<%= settings_find_item_instance_path %>";
|
||||
var item_code = this.value;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
data: 'item_code=' + item_code,
|
||||
success: function (result) {
|
||||
$("#promotion_original_product").empty();
|
||||
var itemlist;
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
itemlist += "<option value ="+result[i][1]+">"+result[i][0]+"</option>"
|
||||
}
|
||||
$("#promotion_original_product").append(itemlist);
|
||||
$("#promotion_original_product").select2();
|
||||
}
|
||||
});
|
||||
});
|
||||
$(".promotion_promotion_products_item_code select").select2();
|
||||
$(".item_code_place1").select2();
|
||||
callforpromoproduct();
|
||||
$(".addProduct").on('click', function(event) {
|
||||
setTimeout(function(){
|
||||
$(".promotion_promotion_products_item_code select").select2();
|
||||
callforpromoproduct();
|
||||
}, 0);
|
||||
});
|
||||
function callforpromoproduct(){
|
||||
$(".item_code_place1").select2();
|
||||
$(".item_code_place1").on('change', function(event) {
|
||||
id = $(this).parent().next().find("select").attr("id");
|
||||
var ajax_url = "<%= settings_find_item_instance_path %>";
|
||||
var item_code = this.value;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
data: 'item_code=' + item_code,
|
||||
success: function (result) {
|
||||
$("#"+id).empty();
|
||||
var itemlist;
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
itemlist += "<option value ="+result[i][1]+">"+result[i][0]+"</option>"
|
||||
}
|
||||
$("#"+id).append(itemlist);
|
||||
$("#"+id).select2();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user