Merge branch 'adminbsb_material_ui' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2017-11-22 18:40:38 +06:30
11 changed files with 73 additions and 35 deletions

View File

@@ -95,7 +95,6 @@ $(function() {
var menu_items_list = $('.menu_items_list'); var menu_items_list = $('.menu_items_list');
menu_items_list.empty(); menu_items_list.empty();
menu_items = data.menu_items; menu_items = data.menu_items;
console.log(menu_items);
for(var field in menu_items) { for(var field in menu_items) {
if (menu_items[field].is_sub_item == false) { if (menu_items[field].is_sub_item == false) {
@@ -194,6 +193,7 @@ $(function() {
$(document).on('click', '.set_item_box', function(event){ $(document).on('click', '.set_item_box', function(event){
$(".instance-list").empty(); $(".instance-list").empty();
$(".options-list").empty(); $(".options-list").empty();
$('.set_change_qty').val(1);
change_qty_plus_minus("set_count","set_plus","set_minus"); change_qty_plus_minus("set_count","set_plus","set_minus");
data = $(this).parent().children().children('.add_icon'); data = $(this).parent().children().children('.add_icon');
@@ -373,6 +373,8 @@ $(function() {
$('.add_to_order').removeAttr('data-attributes'); $('.add_to_order').removeAttr('data-attributes');
$('.add_to_order').removeAttr('data-options'); $('.add_to_order').removeAttr('data-options');
$('.change_qty').val(1);
change_qty_plus_minus("count","plus","minus"); change_qty_plus_minus("count","plus","minus");
data = $(this).parent().children().children('.add_icon'); data = $(this).parent().children().children('.add_icon');
@@ -513,7 +515,6 @@ $(function() {
// click select option icon for add // click select option icon for add
$(document).on('click', '.option_btn', function(event){ $(document).on('click', '.option_btn', function(event){
active =$(this).hasClass('selected-option'); active =$(this).hasClass('selected-option');
console.log(active);
value = $(this).data('value'); value = $(this).data('value');
type = $(this).data('type'); type = $(this).data('type');
group = $(this).data('group'); group = $(this).data('group');
@@ -558,8 +559,23 @@ $(function() {
if (item_row.length>0) { if (item_row.length>0) {
var instances = jQuery.parseJSON(item_row.attr('data-instances')); var instances = jQuery.parseJSON(item_row.attr('data-instances'));
for(var field in instances) {
if (JSON.stringify(attribute_arr) === JSON.stringify(instances[field].values)) {
for(var field in instances) {
attrbu = JSON.stringify(attribute_arr);
instan = JSON.stringify(instances[field].values);
var newarr = new Set(instan);
result = false;
for(var i in attrbu) {
if (newarr.has(attrbu[i])) {
result = true;
break;
}
}
if (JSON.stringify(attribute_arr) === JSON.stringify(instances[field].values) || result) {
$('.add_to_order').attr('data-instance-code',instances[field].code); $('.add_to_order').attr('data-instance-code',instances[field].code);
$('.add_to_order').attr('data-instance',instances[field].name); $('.add_to_order').attr('data-instance',instances[field].name);
$('.add_to_order').attr('data-price',instances[field].price); $('.add_to_order').attr('data-price',instances[field].price);
@@ -872,7 +888,7 @@ $(function() {
id = $(this).attr('id'); id = $(this).attr('id');
value = $(this).val(); value = $(this).val();
$('#count').attr('value',value); $('.change_qty').attr('value',value);
if (id=="count") { if (id=="count") {
price = $("#unit_price").text(); price = $("#unit_price").text();
$("#total_price").text(value*price); $("#total_price").text(value*price);
@@ -880,7 +896,7 @@ $(function() {
var item_row = $('.selected-instance'); var item_row = $('.selected-instance');
price = $("#set_unit_price").text(); price = $("#set_unit_price").text();
set_total_price = $("#set_total_price").text(); set_total_price = $("#set_total_price").text();
$("#set_count").val(value); $(".set_change_qty").val(value);
if (item_row.length > 1) { if (item_row.length > 1) {
total = 0 ; total = 0 ;
$(item_row).each(function(i){ $(item_row).each(function(i){

View File

@@ -45,7 +45,7 @@ class HomeController < ApplicationController
elsif @employee.role == "manager" elsif @employee.role == "manager"
session[:session_token] = @employee.token_session session[:session_token] = @employee.token_session
redirect_to dashboard_path redirect_to dashboard_path
elsif @employee.role == "supervisour" elsif @employee.role == "supervisor"
session[:session_token] = @employee.token_session session[:session_token] = @employee.token_session
redirect_to origami_root_path redirect_to origami_root_path
elsif @employee.role == "account" elsif @employee.role == "account"
@@ -151,7 +151,7 @@ class HomeController < ApplicationController
redirect_to oqs_root_path redirect_to oqs_root_path
elsif employee.role == "crm" elsif employee.role == "crm"
redirect_to crm_root_path redirect_to crm_root_path
elsif @employee.role == "supervisour" elsif @employee.role == "supervisor"
redirect_to origami_root_path redirect_to origami_root_path
elsif @employee.role == "account" elsif @employee.role == "account"
redirect_to reports_dailysale_index_path redirect_to reports_dailysale_index_path

View File

@@ -122,7 +122,7 @@ class Ability
can :index, :credit_payment can :index, :credit_payment
can :index, :void_sale can :index, :void_sale
elsif user.role == "supervisour" elsif user.role == "supervisor"
can :edit, :sale_edit can :edit, :sale_edit
can :item_void, :sale_edit can :item_void, :sale_edit

View File

@@ -45,7 +45,7 @@ class ReceiptBillPdf < Prawn::Document
delimiter = "" delimiter = ""
end end
header( shop_details) header(shop_details)
stroke_horizontal_rule stroke_horizontal_rule
@@ -60,12 +60,14 @@ class ReceiptBillPdf < Prawn::Document
customer(customer_name) customer(customer_name)
if discount_price_by_accounts.length > 0 if discount_price_by_accounts.length > 0 && shop_details.show_account_info
discount_account(discount_price_by_accounts,printer_settings.precision,delimiter) discount_account(discount_price_by_accounts,printer_settings.precision,delimiter)
end end
items_account(item_price_by_accounts,printer_settings.precision,delimiter) if shop_details.show_account_info
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
end
sign(sale_data) sign(sale_data)
footer(printed_status) footer(printed_status)
@@ -389,6 +391,8 @@ class ReceiptBillPdf < Prawn::Document
text "#{ customer_name }" , :size => self.item_font_size,:align => :right text "#{ customer_name }" , :size => self.item_font_size,:align => :right
end end
end end
def discount_account(discount_price_by_accounts,precision,delimiter) def discount_account(discount_price_by_accounts,precision,delimiter)
move_down 5 move_down 5
stroke_horizontal_rule stroke_horizontal_rule

View File

@@ -85,7 +85,7 @@
<div class="row m-b-15"> <div class="row m-b-15">
<% @employees.each do |employee| %> <% @employees.each do |employee| %>
<%if employee.role == "supervisour" %> <%if employee.role == "supervisor" %>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 empBtn" data-formid="#form_<%= employee.emp_id %>" > <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 empBtn" data-formid="#form_<%= employee.emp_id %>" >
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH"> <form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
</form> </form>

View File

@@ -51,7 +51,7 @@
<th class="item-attr">Price</th> <th class="item-attr">Price</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody class="font-13">
</tbody> </tbody>
</table> </table>

View File

@@ -143,7 +143,7 @@
<div class="row p-l-5 p-r-5"> <div class="row p-l-5 p-r-5">
<% if (!@sale_array.empty?) && (!@date.nil?) %> <% if (!@sale_array.empty?) && (!@date.nil?) %>
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
Receipt No: <span id="receipt_no"> &nbsp; Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %> <% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %> <%= @sale_array[0].receipt_no rescue '' %>
@@ -152,12 +152,12 @@
<br> <br>
</div> </div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right"> <div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span> Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span>
<br> <br>
</div> </div>
<% elsif !@date.nil? %> <% elsif !@date.nil? %>
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-7 col-md-7 col-sm-7">
Order No: <span id="order_no"> &nbsp; Order No: <span id="order_no">
<% if @status_order == 'order' %> <% if @status_order == 'order' %>
<%= @obj_order.order_id rescue '' %> <%= @obj_order.order_id rescue '' %>
@@ -165,8 +165,8 @@
</span> </span>
<br> <br>
</div> </div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right"> <div class="col-lg-5 col-md-5 col-sm-5 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span> Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %></span>
<br> <br>
</div> </div>
<% end %> <% end %>
@@ -176,11 +176,11 @@
<% if @status_sale == 'sale' %> <% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p> <p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
Customer : <%= @sale_array[0].customer.name rescue '' %> &nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
<% elsif @status_order == 'order' <% elsif @status_order == 'order'
%> %>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p> <p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
Customer : <%= @customer.name rescue "" %> &nbsp; Customer : <%= @customer.name rescue "" %>
<% end %> <% end %>
</div> </div>

View File

@@ -137,26 +137,41 @@
</div> </div>
<div class="card-block"> <div class="card-block">
<div class="card-title row p-l-5 p-r-5"> <div class="card-title row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
Receipt No: <span id="receipt_no"> <% if @status_sale == 'sale' %>
<% if @status_sale == 'sale' %> <div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No:
<span id="receipt_no">
<%= @obj_sale.receipt_no rescue '' %> <%= @obj_sale.receipt_no rescue '' %>
</span>
<% end %> </div>
</span> <% else %>
</div> <div class="col-lg-7 col-md-7 col-sm-7">
<div class="col-lg-6 col-md-6 col-sm-6 text-right"> &nbsp; Order No:
<span id="receipt_no">
<%= @obj_order.order_id rescue '' %>
</span>
</div>
<% end %>
<% if @status_sale == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span> Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span>
</div> </div>
<% else %>
<div class="col-lg-5 col-md-5 col-sm-5 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-'%></span>
</div>
<% end %>
</div> </div>
<div class="card-title row customer_detail p-l-5 p-r-5" > <div class="card-title row customer_detail p-l-5 p-r-5" >
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' %> <% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @obj_sale_sale.customer_id rescue '' %></p> <p class="hidden customer-id"><%= @obj_sale_sale.customer_id rescue '' %></p>
Customer : <%= @obj_sale.customer.name rescue '-' %> &nbsp; Customer : <%= @obj_sale.customer.name rescue '-' %>
<%else%> <%else%>
<p class="hidden customer-id"><%= @obj_order.customer_id rescue "-" %></p> <p class="hidden customer-id"><%= @obj_order.customer_id rescue "-" %></p>
Customer : <%= @customer.name rescue "-" %> &nbsp; Customer : <%= @customer.name rescue "-" %>
<%end%> <%end%>
</div> </div>

View File

@@ -15,12 +15,13 @@
<%= f.input :license_data %> <%= f.input :license_data %>
<%= f.input :base_currency %> <%= f.input :base_currency %>
<%= f.input :cloud_token %> <%= f.input :cloud_token %>
<%= f.input :cloud_url %> <%= f.input :cloud_url %>
<%= f.input :owner_token %> <%= f.input :owner_token %>
<%= f.input :id_prefix %> <%= f.input :id_prefix %>
<%= f.input :is_rounding_adj %> <%= f.input :is_rounding_adj %>
<%= f.input :quick_sale_summary %> <%= f.input :quick_sale_summary %>
<%= f.input :calc_tax_order %> <%= f.input :calc_tax_order %>
<%= f.input :show_account_info %>
</div> </div>

View File

@@ -23,6 +23,7 @@
<th>Rouding Adj</th> <th>Rouding Adj</th>
<th>View Sale Summary</th> <th>View Sale Summary</th>
<th>Calculate Tax</th> <th>Calculate Tax</th>
<th>Show Account Info</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
</thead> </thead>
@@ -36,7 +37,7 @@
<td><%= shop.is_rounding_adj %></td> <td><%= shop.is_rounding_adj %></td>
<td><%= shop.quick_sale_summary %></td> <td><%= shop.quick_sale_summary %></td>
<td><%= shop.calc_tax_order %></td> <td><%= shop.calc_tax_order %></td>
<td><%= shop.show_account_info %></td>
<td> <td>
<%= link_to t("views.btn.show"), settings_shop_path(shop),:class => 'btn btn-info btn-sm waves-effect' %> <%= link_to t("views.btn.show"), settings_shop_path(shop),:class => 'btn btn-info btn-sm waves-effect' %>
<%= link_to t("views.btn.edit"), edit_settings_shop_path(shop),:class => 'btn btn-primary btn-sm waves-effect' %> <%= link_to t("views.btn.edit"), edit_settings_shop_path(shop),:class => 'btn btn-primary btn-sm waves-effect' %>

View File

@@ -21,6 +21,7 @@ class CreateShops < ActiveRecord::Migration[5.1]
t.boolean :is_rounding_adj, :default => false t.boolean :is_rounding_adj, :default => false
t.boolean :quick_sale_summary, :default => false t.boolean :quick_sale_summary, :default => false
t.boolean :calc_tax_order, :default => false t.boolean :calc_tax_order, :default => false
t.boolean :show_account_info, :default => true
t.timestamps t.timestamps
end end
end end