merge with august spring

This commit is contained in:
Yan
2017-08-28 18:33:49 +06:30
50 changed files with 1677 additions and 976 deletions

View File

@@ -28,8 +28,8 @@
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
<hr class="hr_advance" />
<li><%= link_to "Employees", settings_employees_path, :tabindex =>"-1" %></li>
<li><%= link_to "Commissions", origami_commissions_path , :tabindex =>"-1" %></li>
<li><%= link_to "Commissioners", origami_commissioners_path , :tabindex =>"-1" %></li>
<li><%= link_to "Commissions", settings_commissions_path , :tabindex =>"-1" %></li>
<li><%= link_to "Commissioners", settings_commissioners_path , :tabindex =>"-1" %></li>
<hr class="hr_advance" />
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
<hr class="hr_advance" />
@@ -55,6 +55,7 @@
<li><%= link_to "Shift Sale Report", reports_shiftsale_index_path, :tabindex =>"-1" %></li>
<li><%= link_to "Credit Sale Report", reports_credit_payment_index_path, :tabindex =>"-1" %></li>
<li><%= link_to "Void Sale Report", reports_void_sale_index_path, :tabindex =>"-1" %></li>
<!--<li><% link_to "Commission Report", reports_commission_index_path, :tabindex =>"-1" %></li>-->
</ul>
</li>
<li class="navbar-nav mr-auto">

View File

@@ -1,21 +0,0 @@
<div class="col-md-3">
<%= simple_form_for([:origami, @commissioner]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :name %>
<%= f.label :emp_id %>
<%= f.collection_select :emp_id, Employee.all.order('name asc'), :id, :name, {prompt: 'Select an Employee'}, {class: "form-control"} %><br/>
<%= f.label :commission_type %>
<%= f.select :commission_type, Commission.all.map{ |l| [l.menu_item.name, l.id] } %>
<br/>
<label><%= f.check_box :is_active %> Active </label>
</div><br/>
<div class="form-actions">
<%= link_to 'Back', origami_commissioners_path, class: 'btn btn-success' %>
<%= f.button :submit, class: 'btn btn-info' %>
</div>
<% end %>
</div>

View File

@@ -1,47 +0,0 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
<span style="float: right">
</span>
</ul>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Commissioner</h4>
<table class="table">
<tbody>
<tr>
<td style="width:20%">Name</td>
<td><%= @commissioner.name %></td>
</tr>
<tr>
<td style="width:20%">Employee Name</td>
<td>
<%= @commissioner.employee.name rescue '-' %>
</td>
</tr>
<tr>
<td style="width:20%">Commission Type</td>
<td><%= @commissioner.commission.menu_item.name rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Active</td>
<td><%= @commissioner.is_active %></td>
</tr>
<tr>
<td style="width:20%">Created By</td>
<td><%= Employee.find(@commissioner.created_by).name %></td>
</tr>
</tbody>
</table>
<%= link_to 'Back', origami_commissioners_path, class: 'btn btn-success' %>
<%= link_to 'Edit', edit_origami_commissioner_path(@commissioner), class: 'btn btn-info' %>
<%= link_to 'Destroy', origami_commissioner_path(@commissioner), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
</div>
</div>
</div>

View File

@@ -1,9 +1,12 @@
<%= simple_form_for @in_juty,:url => origami_create_for_in_juty_path, :method => :post do |f| %>
<%= 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-6 " %>
<label>Dining Name:</label>
<%= @table.name %>
<br/>
@@ -12,14 +15,14 @@
<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/>
<%= f.text_field :in_time, :value=>'',: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"%>
<%= f.text_field :out_time, :value=>'',:class=>"form-control datepicker"%>
</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 =>'disabled', :id => 'update' %>
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update' %>
<%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %>
</div>
@@ -30,11 +33,18 @@
$(function() {
$('.datepicker').datepicker({
format : 'dd-mm-yyyy',
format : 'yyyy-mm-dd',
autoclose: true
});
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');
});
$('#reset').click(function() {
// window.location.href = '/origami/assign_in_juty/'+ table_id;
location.reload();
return false;
});
</script>

View File

@@ -2,8 +2,7 @@
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :dinning_id %>
<%= f.input :commissioner_ids %>
<%= 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>

View File

@@ -4,6 +4,7 @@
<table class="table table-striped">
<thead>
<tr>
<th>Select</th>
<th>Dining Facility Name</th>
<th>Commissioner Ids</th>
<th>In time</th>
@@ -21,13 +22,12 @@
<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 'Back', origami_path(in_juty.dining_facility.id) %></td>
<td><%= link_to 'Edit', origami_edit_in_juty_path(in_juty.dining_facility.id,in_juty) %></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">
@@ -35,40 +35,45 @@
</div>
</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',".injuty_tr",function(){
debugger;
// if(this.checked){
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
//$( "#checkbox_check" ).prop( "checked", true );
var in_juty_id = $(this).attr('data-ref');
var table_id = "<%= @table.id %>";
var url = "/origami/table/" + table_id + "/in_juty/" + in_juty_id + "/edit";
var url = "/origami/assign_in_juty/table/" + table_id + "/in_juty/" + in_juty_id + "/edit";
$.ajax({
type: "GET",
url: url,
data: {},
dataType: "json",
success: function(data) {
// Selected for Taxes
$('#in_juty_commissioner_ids').val(data.commissioner.name);
$('#in_juty_in_time').val(data.in_time);
$('#in_juty_out_time').val(data.out_time);
$('#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.split('T')[0]);
$('#in_juty_out_time').val(data.in_juty.out_time.split('T')[0]);
$('#update').removeAttr('disabled');
$('#update').removeAttr('disabled').val('');
$('#update').attr('value', 'Update');
$('#create').attr('disabled','disabled');
$("#new_in_juty").attr('class', 'simple_form new_in_juty');
var id = customer_id;
$("#new_customer").attr('id', id);
$("#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_customer").attr('id', id);
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
$(".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">');
}
});
@@ -76,4 +81,9 @@ $(document).on('click',".injuty_tr",function(){
// }
})
$('#back').on('click', function () {
window.location.href = '/origami/table/'+ "<%= @table.id %>";
})
</script>

View File

@@ -0,0 +1,119 @@
<div class="row">
<div class="col-md-12">
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
<% if period_type != false %>
<div class="row">
<div class="form-group col-md-2">
<label>Select Period</label>
<select name="period" id="sel_period" class="form-control">
<option value="0">Today</option>
<option value="1">Yesterday</option>
<option value="2">This week</option>
<option value="3">Last week</option>
<option value="4">Last 7 days</option>
<option value="5">This month</option>
<option value="6">Last month</option>
<option value="7">Last 30 days</option>
<option value="8">This year</option>
<option value="9">Last year</option>
</select>
</div>
<div class="form-group col-md-3">
<!-- <label class="">Select Shift Period</label> -->
<label class="">From</label>
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
</div>
<div class="form-group col-md-3">
<label class="">To</label>
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
</div>
<div class="form-group col-md-2">
<label class="">All Shift</label>
<select class="form-control select" name="shift_name" id="shift_name" >
</select>
</div>
<div class="form-group col-md-2 margin-top-20">
<input type="submit" value="Generate Report" class='btn btn-primary'>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
<script type="text/javascript">
$(function(){
$('#custom_excel').hide();
$('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url)
$('#frm_report').submit();
// window.location = url;
});
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'order'){
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
else if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
}
else{
$('#waiter').hide();
$('#cashier').show();
$("#item").val('sale');
}
});
//Reset the form to pervious values
<% if params[:shift_name].to_i > 0%>
shift_id = '<%= params[:shift_name] %>'
local_date = '<%= @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")%> -<%= @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p") %>'
var shift = $('#shift_name');
str = '<option value="'+ shift_id +'" '+ 'selected = "selected"' +'>' + local_date + '</option>';
shift.append(str);
<% end %>
$("#from").val("<%=params[:from]%>");
$("#to").val("<%=params[:to]%>");
$("#sel_period").val(<%=params[:period]%>);
$("#sel_sale_type").val(<%=params[:sale_type]%>);
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
$("#rd_period_type_1").attr("checked","checked");
<% else %>
$("#rd_period_type_0").attr("checked","checked");
<% end %>
$(".btn-group button").removeClass("active");
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
$("#btn_report_type_<%= report_type %>").addClass("active");
$('#item').change(function(){
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
if(payment_type){
$('#payment_type').show();
}
}
else{
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
});
</script>

View File

@@ -0,0 +1,211 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= dashboard_path %>">Home</a></li>
<li>Commission Report</li>
</ul>
</div>
<div class="container">
<%= render :partial=>'commission_report_filter',
:locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_commission_index_path} %>
<hr />
</div>
<div class="container">
<div class="row">
<div class="col-md-12 text-right">
<a href="javascript:export_to('<%=reports_commission_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
</div>
</div>
</div>
<div class="container margin-top-20">
<!-- <div class="span11">
<div id="report_container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</div> -->
<div class="card row">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>
- To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
</th>
</tr>
<% if @shift_from %>
<tr>
<% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %>
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr>
<% end %>
<tr>
<th>Cashier Station</th>
<th>Cashier Name</th>
<th>Shift Name</th>
<!-- <th>Void Amount</th> -->
<th>Cash Payment</th>
<!-- <th>Credit Charges</th> -->
<th>Credit Payment</th>
<!-- <th>FOC Payment</th> -->
<th>Other Payment</th>
<!-- <th>Grand Total
<br/>Rounding Adj</th> -->
<!-- <th>Rounding Adj</th> -->
<th>Grand Total</th>
</tr>
</thead>
<tbody>
<% void = 0%>
<% cash = 0%>
<% credit = 0%>
<% accept_credit = 0%>
<% foc = 0%>
<% card = 0%>
<% total = 0%>
<% rounding_adj = 0%>
<% g_total = 0 %>
<% @sale_data.each do |result|%>
<tr>
<td>
<%= result.cashier_terminal.name rescue '-'%>
</td>
<td>
<%= result.employee.name rescue '-'%>
</td>
<td><%= result.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> -
<%= result.shift_closed_at.strftime("%e %b %I:%M%p") rescue '-' %>
</td>
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result.void_amount.to_f.to_d rescue '-'%>)</td> -->
<td><%= sprintf "%.2f",result.cash_sales.to_f.to_d rescue '-'%></td>
<td><%= sprintf "%.2f",result.credit_sales.to_f.to_d rescue '-'%></td>
<!-- <td><%= sprintf "%.2f",result.accept_credit_amount.to_f.to_d rescue '-'%></td> -->
<!-- <td><%= sprintf "%.2f",result.foc_amount.to_f.to_d rescue '-'%></td>
<td><%= sprintf "%.2f",result.card_amount.to_f.to_d rescue '-'%></td> -->
<td><%= sprintf "%.2f",result.other_sales.to_f.to_d rescue '-'%></td>
<td><%= sprintf "%.2f",result.grand_total.to_f.to_d rescue '-'%></td>
<!-- <td><%= sprintf "%.2f",result.rounding_adj.to_f.to_d rescue '-'%></td> -->
<% grand_total = result.grand_total.to_f %>
<!-- <td><%= sprintf "%.2f",grand_tota.to_f.to_d rescue '-'%></td> -->
</tr>
<% cash += result.cash_sales.to_f %>
<% credit += result.credit_sales.to_f %>
<% card += result.other_sales.to_f %>
<% total += result.grand_total.to_f %>
<% g_total += grand_total.to_f %>
<% end %>
<tr style="border-top: 3px solid grey;">
<td colspan="3"></td>
<!-- <td style='color:red;'><b>(<%= sprintf("%.2f",void) rescue '-'%>)</b></td> -->
<td><b><%= sprintf("%.2f",cash) rescue '-'%></b></td>
<td><b><%= sprintf("%.2f",credit) rescue '-'%></b></td>
<!-- <td><b><%= sprintf("%.2f",accept_credit) rescue '-'%></b></td> -->
<!-- <td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td> -->
<td><b><%= sprintf("%.2f",card) rescue '-'%></b></td>
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script>
$(function(){
var check_arr = [];
$('#sel_period').change(function(){
search_by_period();
});
function search_by_period(){
var period = $('#sel_period').val();
var period_type = 0;
var from = "";
var to = "";
show_shift_name(period,period_type,from,to,'shift_item');
}
$('#from').change(function(){
search_by_date();
});
$('#to').change(function(){
search_by_date();
});
function search_by_date(){
var from = $('#from').val();
var to = $('#to').val();
var period = 0;
var period_type = 1;
if(to != '' && from != ''){
shift_name = from + ',' + to;
check_arr.push(to);
console.log(check_arr.length)
if(check_arr.length == 1){
show_shift_name(period,period_type,from,to,'shift_item');
}
if(check_arr.length == 3){
check_arr = [];
}
}
}
function show_shift_name(period,period_type,from,to,shift_item){
var shift = $('#shift_name');
shift.empty();
var str = '';
var param_shift = '';
var param_shift = '<%= params[:shift_name] rescue '-'%>';
url = '<%= reports_get_shift_by_date_path %>';
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
str = '<option value="0">--- All Shift ---</option>';
$(data.message).each(function(index){
var local_date = data.message[index].local_opening_date + ' - ' + data.message[index].local_closing_date;
var sh_date = data.message[index].opening_date + ' - ' + data.message[index].closing_date;
var shift_id = data.message[index].shift_id ;
if(param_shift != ''){
if(shift_id == param_shift){
selected = 'selected = "selected"';
}
else{
selected = '';
}
}else{
selected = '';
}
str += '<option value="'+ shift_id +'" '+ selected +'>' + local_date + '</option>';
// console.log(sh_date)
})
shift.append(str);
});
}
});
</script>

View File

@@ -0,0 +1,100 @@
<div class="container margin-top-20">
<!-- <div class="span11">
<div id="report_container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</div> -->
<div class="card row">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %>
- To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
</th>
</tr>
<% if @shift_from %>
<tr>
<% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %>
<th colspan="7">Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr>
<% end %>
<tr>
<th>Cashier Station</th>
<th>Cashier Name</th>
<th>Shift Name</th>
<!-- <th>Void Amount</th> -->
<th>Cash Payment</th>
<!-- <th>Credit Charges</th> -->
<th>Credit Payment</th>
<!-- <th>FOC Payment</th> -->
<th>Other Payment</th>
<!-- <th>Grand Total
<br/>Rounding Adj</th> -->
<!-- <th>Rounding Adj</th> -->
<th>Grand Total</th>
</tr>
</thead>
<tbody>
<% void = 0%>
<% cash = 0%>
<% credit = 0%>
<% accept_credit = 0%>
<% foc = 0%>
<% card = 0%>
<% total = 0%>
<% rounding_adj = 0%>
<% g_total = 0 %>
<% @sale_data.each do |result|%>
<tr>
<td>
<%= result.cashier_terminal.name rescue '-'%>
</td>
<td>
<%= result.employee.name rescue '-'%>
</td>
<td><%= result.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> -
<%= result.shift_closed_at.strftime("%e %b %I:%M%p") rescue '-' %>
</td>
<!-- <td style='color:red;'>(<%= sprintf "%.2f",result.void_amount.to_f.to_d rescue '-'%>)</td> -->
<td><%= sprintf "%.2f",result.cash_sales.to_f.to_d rescue '-'%></td>
<td><%= sprintf "%.2f",result.credit_sales.to_f.to_d rescue '-'%></td>
<!-- <td><%= sprintf "%.2f",result.accept_credit_amount.to_f.to_d rescue '-'%></td> -->
<!-- <td><%= sprintf "%.2f",result.foc_amount.to_f.to_d rescue '-'%></td>
<td><%= sprintf "%.2f",result.card_amount.to_f.to_d rescue '-'%></td> -->
<td><%= sprintf "%.2f",result.other_sales.to_f.to_d rescue '-'%></td>
<td><%= sprintf "%.2f",result.grand_total.to_f.to_d rescue '-'%></td>
<!-- <td><%= sprintf "%.2f",result.rounding_adj.to_f.to_d rescue '-'%></td> -->
<% grand_total = result.grand_total.to_f %>
<!-- <td><%= sprintf "%.2f",grand_tota.to_f.to_d rescue '-'%></td> -->
</tr>
<% cash += result.cash_sales.to_f %>
<% credit += result.credit_sales.to_f %>
<% card += result.other_sales.to_f %>
<% total += result.grand_total.to_f %>
<% g_total += grand_total.to_f %>
<% end %>
<tr style="border-top: 3px solid grey;">
<td colspan="3"></td>
<!-- <td style='color:red;'><b>(<%= sprintf("%.2f",void) rescue '-'%>)</b></td> -->
<td><b><%= sprintf("%.2f",cash) rescue '-'%></b></td>
<td><b><%= sprintf("%.2f",credit) rescue '-'%></b></td>
<!-- <td><b><%= sprintf("%.2f",accept_credit) rescue '-'%></b></td> -->
<!-- <td><b><%= sprintf("%.2f",foc) rescue '-'%></b></td> -->
<td><b><%= sprintf("%.2f",card) rescue '-'%></b></td>
<!-- <td><b><%= sprintf("%.2f",total) rescue '-'%></b></td> -->
<!-- <td><b><%= sprintf("%.2f",rounding_adj) rescue '-'%></b></td> -->
<td><b><%= sprintf("%.2f",g_total) rescue '-'%></b></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -0,0 +1,42 @@
<div class="col-md-3">
<%= simple_form_for([:settings, @commissioner]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :name %>
<%= f.label :emp_id, 'Employee' %>
<%= f.collection_select :emp_id, Employee.all.order('name asc'), :id, :name, {prompt: 'Select an Employee'}, {class: "form-control"} %>
<br/>
<%= f.label :commission_id, 'Commission' %><br/>
<%= f.select :commission_id, Commission.all.map {|l| [l.menu_item.name, l.id]}, {prompt: 'Select a Product'}, {class: 'form-control'} %>
<br/>
<%= f.label :joined_date %><br/>
<%= f.text_field :joined_date, {class: 'form-control', id: 'joined_date', readonly: true} %><br/>
<%= f.label :resigned_date %><br/>
<%= f.text_field :resigned_date, {class: 'form-control', id: 'resigned_date', readonly: true} %><br/>
<label><%= f.check_box :is_active %> Active </label>
</div>
<br/>
<div class="form-actions">
<%= link_to 'Back', settings_commissioners_path, class: 'btn btn-success' %>
<%= f.button :submit, class: 'btn btn-info' %>
</div>
<% end %>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#joined_date').datepicker({
format: 'yyyy-mm-dd',
autoclose: true
});
$('#resigned_date').datepicker({
format: 'yyyy-mm-dd',
autoclose: true
});
});
</script>

View File

@@ -1,8 +1,8 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
<li><a href="<%= settings_commissioners_path %>">Home</a></li>
<li><a href="<%= settings_commissioners_path %>">Commissioners</a></li>
<li>Edit</li>
</ul>
</div>

View File

@@ -1,9 +1,9 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= settings_commissioners_path %>">Home</a></li>
<li>Commissioner</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commissioner_path, :class => 'btn btn-primary btn-sm' %>
<%= link_to t('.new', :default => t("helpers.links.new")), new_settings_commissioner_path, :class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
@@ -16,8 +16,10 @@
<th>Name</th>
<th>Employee Name</th>
<th>Commission type</th>
<th>Joined Date</th>
<th>Resigned Date</th>
<th>Active</th>
<th colspan="3"></th>
<th colspan="4"></th>
</tr>
</thead>
@@ -29,10 +31,12 @@
<%= commissioner.employee.name rescue '-' %>
</td>
<td><%= commissioner.commission.menu_item.name rescue '-' %></td>
<td><%= commissioner.joined_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %></td>
<td><%= commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %></td>
<td><%= commissioner.is_active %></td>
<td><%= link_to 'Show', origami_commissioner_path(commissioner) %></td>
<td><%= link_to 'Edit', edit_origami_commissioner_path(commissioner) %></td>
<td><%= link_to 'Destroy', origami_commissioner_path(commissioner), method: :delete, data: {confirm: 'Are you sure?'} %></td>
<td><%= link_to 'Show', settings_commissioner_path(commissioner) %></td>
<td><%= link_to 'Edit', edit_settings_commissioner_path(commissioner) %></td>
<td><%= link_to 'Destroy', settings_commissioner_path(commissioner), method: :delete, data: {confirm: 'Are you sure?'} %></td>
</tr>
<% end %>
</tbody>

View File

@@ -1,8 +1,8 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
<li><a href="<%= settings_commissioners_path %>">Home</a></li>
<li><a href="<%= settings_commissioners_path %>">Commissioners</a></li>
<li>New</li>
</ul>
</div>

View File

@@ -0,0 +1,132 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= settings_commissioner_path %>">Home</a></li>
<li><a href="<%= settings_commissioner_path %>">Commissioners</a></li>
<span style="float: right">
</span>
</ul>
</div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#info" role="tab">Info</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#transaction" id="transaction_tab" role="tab">Transaction</a>
</li>
</ul>
<!-- Nav tabs - End -->
<div class="tab-content">
<!--- Panel 0 - Info -->
<div class="tab-pane active" id="info" role="tabpanel" style="max-height:670px; overflow:auto">
<div class="card">
<div class="card-block">
<table class="table">
<tbody>
<tr>
<td style="width:20%">Name</td>
<td><%= @commissioner.name %></td>
</tr>
<tr>
<td style="width:20%">Employee Name</td>
<td><%= @commissioner.employee.name rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Commission Type</td>
<td><%= @commissioner.commission.menu_item.name rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Joined Date</td>
<td><%= @commissioner.joined_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Resigned Date</td>
<td><%= @commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d') rescue '-' %></td>
</tr>
<tr>
<td style="width:20%">Active</td>
<td><%= @commissioner.is_active %></td>
</tr>
<tr>
<td style="width:20%">Created By</td>
<td><%= Employee.find(@commissioner.created_by).name %></td>
</tr>
</tbody>
</table>
<%= link_to 'Back', settings_commissioners_path, class: 'btn btn-success' %>
<%= link_to 'Edit', edit_settings_commissioner_path(@commissioner), class: 'btn btn-info' %>
<%= link_to 'Destroy', settings_commissioner_path(@commissioner), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
</div>
</div>
</div>
<!--- Panel 1 - Transaction -->
<div class="tab-pane" id="transaction" role="tabpanel" style="max-height:670px; overflow:auto">
<div class="card">
<div class="card-block">
<table class="table" id="myTable">
<thead>
<tr>
<th><%= 'Product Type' %></th>
<th><%= 'Product Name' %></th>
<th><%= 'Qty' %></th>
<th><%= 'Price' %></th>
<th><%= 'Amount' %></th>
<th><%= 'Date' %></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<br/>
</div>
<script type="text/javascript">
$(document).ready(function () {
$("#transaction_tab").click(function () {
get_transaction();
});
function get_transaction() {
var commissioner_id = <%= @commissioner.id %>
paramlist = 'commissioner_id=' + commissioner_id ;
$.ajax({
type: 'GET',
url: '<%= settings_get_transaction_by_commissioner_path() %>',
data: paramlist,
success: function (data) {
// $('#myTable').DataTable().destroy();
$('#myTable tbody > tr').remove();
$.each(data, function (i, item) {
tr = "<tr>" + "<td>" + data[i][0].product_type + "</td>" + "<td>" + data[i][1] + "</td>" + "<td>" + data[i][0].qty + "</td>" + "<td>" + data[i][0].price + "</td>" + "<td>" + data[i][0].amount + "</td>" + "<td>" + new Date(data[i][0].updated_at).toISOString().split('T')[0] + "</td>" + "</tr>";
$('#myTable tbody').append(tr);
});
// $('#myTable').DataTable({
// data: data,
// columns: [
// {data: 'product_type'},
// {data: 'product_code'},
// {data: 'commission_id'},
// {data: 'qty'},
// {data: 'price'},
// {data: 'amount'}
// ],
// "order": [[0, "desc"]]
// });
}
});
}
});
</script>

View File

@@ -1,17 +1,17 @@
<div class="col-md-3">
<%= simple_form_for([:origami,@commission]) do |f| %>
<%= simple_form_for([:settings,@commission]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.label :product_id %>
<%= f.collection_select :product_id, @products, :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %><br/>
<%= f.input :amount %>
<%= f.label :product_code, 'Product' %>
<%= f.collection_select :product_code, @products, :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %><br/>
<%= f.input :commission_type, :collection => ['Percentage','Net Amount'], prompt: 'Select Commission Type', class: 'form-control' %>
<%= f.input :amount %>
<label><%= f.check_box :is_active %> Active </label>
</div><br>
<div class="form-actions">
<%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %>
<%= link_to 'Back', settings_commissions_path, class: 'btn btn-success' %>
<%= f.button :submit, class: 'btn btn-info' %>
</div>
<% end %>

View File

@@ -1,8 +1,8 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_commissions_path %>">Commissions</a></li>
<li><a href="<%= settings_commissions_path %>">Home</a></li>
<li><a href="<%= settings_commissions_path %>">Commissions</a></li>
<li>Edit</li>
</ul>
</div>

View File

@@ -1,9 +1,9 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= settings_commissions_path %>">Home</a></li>
<li>Commissions</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commission_path, :class => 'btn btn-primary btn-sm' %>
<%= link_to t('.new', :default => t("helpers.links.new")), new_settings_commission_path, :class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
@@ -14,8 +14,8 @@
<thead>
<tr>
<th>Product Name</th>
<th>Commission Type</th>
<th>Amount</th>
<th>Commission type</th>
<th>Active</th>
<th colspan="3"></th>
</tr>
@@ -25,12 +25,12 @@
<% @commissions.each do |commission| %>
<tr>
<td><%= commission.menu_item.name rescue '-' %></td>
<td><%= commission.amount rescue '-' %></td>
<td><%= commission.commission_type rescue '-' %></td>
<td><%= commission.amount rescue '-' %></td>
<td><%= commission.is_active rescue '-' %></td>
<td><%= link_to 'Show', origami_commission_path(commission) %></td>
<td><%= link_to 'Edit', edit_origami_commission_path(commission) %></td>
<td><%= link_to 'Destroy', origami_commission_path(commission), method: :delete, data: {confirm: 'Are you sure?'} %></td>
<td><%= link_to 'Show', settings_commissions_path(commission) %></td>
<td><%= link_to 'Edit', edit_settings_commission_path(commission) %></td>
<td><%= link_to 'Destroy', settings_commission_path(commission), method: :delete, data: {confirm: 'Are you sure?'} %></td>
</tr>
<% end %>
</tbody>

View File

@@ -1,8 +1,8 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_commissions_path %>">Commissions</a></li>
<li><a href="<%= settings_commissions_path %>">Home</a></li>
<li><a href="<%= settings_commissions_path %>">Commissions</a></li>
<li>New</li>
</ul>
</div>

View File

@@ -2,8 +2,8 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= origami_root_path %>">Home</a></li>
<li><a href="<%= origami_commissions_path %>">Commissions</a></li>
<li><a href="<%= settings_commissions_path %>">Home</a></li>
<li><a href="<%= settings_commissions_path %>">Commissions</a></li>
<span style="float: right">
</span>
@@ -32,9 +32,9 @@
</tr>
</tbody>
</table>
<%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %>
<%= link_to 'Edit', edit_origami_commission_path(@commission), class: 'btn btn-info' %>
<%= link_to 'Destroy', origami_commission_path(@commission), method: :delete, class: 'btn btn-danger', data: {confirm: 'Are you sure?'} %>
<%= link_to 'Back', settings_commissions_path, class: 'btn btn-success' %>
<%= link_to 'Edit', edit_settings_commission_path(@commission), class: 'btn btn-info' %>
<%= link_to 'Destroy', settings_commissions_path(@commission), method: :delete, class: 'btn btn-danger', data: {confirm: 'Are you sure?'} %>
</div>
</div>