Merge branch 'addorder' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -6,12 +6,34 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
# GET /crm/customers.json
|
# GET /crm/customers.json
|
||||||
def index
|
def index
|
||||||
filter = params[:filter]
|
filter = params[:filter]
|
||||||
|
type = params[:type]
|
||||||
if filter.nil?
|
if filter.nil?
|
||||||
@crm_customers = Customer.all
|
@crm_customers = Customer.all
|
||||||
else
|
else
|
||||||
@crm_customers = Customer.search(filter)
|
@crm_customers = Customer.search(filter)
|
||||||
|
# search account no from paypar
|
||||||
|
if !@crm_customers.present? && type == "card"
|
||||||
|
response = Customer.search_paypar_account_no(filter)
|
||||||
|
if response["status"] == true
|
||||||
|
@crm_customers = Customer.new
|
||||||
|
@crm_customers.name = response["customer_data"]["name"]
|
||||||
|
@crm_customers.contact_no = response["customer_data"]["phone"]
|
||||||
|
@crm_customers.email = response["customer_data"]["email"]
|
||||||
|
@crm_customers.date_of_birth = response["customer_data"]["DOB"]
|
||||||
|
@crm_customers.nrc_no = response["customer_data"]["NRC"]
|
||||||
|
@crm_customers.address = response["customer_data"]["address"]
|
||||||
|
@crm_customers.card_no = response["customer_data"]["customer_card_no"]
|
||||||
|
@crm_customers.paypar_account_no = filter
|
||||||
|
@crm_customers.membership_id = response["customer_data"]["id"]
|
||||||
|
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
|
||||||
|
@crm_customers.customer_type = "Dinein"
|
||||||
|
@crm_customers.tax_profiles = ["1", "2"]
|
||||||
|
@crm_customers.save
|
||||||
|
@crm_customers = Customer.search(filter)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
puts @crm_customers
|
||||||
#@crm_customers = Customer.all
|
#@crm_customers = Customer.all
|
||||||
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
||||||
@crm_customer = Customer.new
|
@crm_customer = Customer.new
|
||||||
|
|||||||
@@ -9,13 +9,39 @@ class Origami::CustomersController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_customer
|
def get_customer
|
||||||
|
|
||||||
filter = params[:filter]
|
filter = params[:filter]
|
||||||
|
type = params[:type]
|
||||||
|
|
||||||
if filter.nil?
|
if filter.nil?
|
||||||
@crm_customers = Customer.order("customer_id").page(params[:page])
|
@crm_customers = Customer.order("customer_id").page(params[:page])
|
||||||
#@products = Product.order("name").page(params[:page]).per(5)
|
#@products = Product.order("name").page(params[:page]).per(5)
|
||||||
else
|
else
|
||||||
@crm_customers = Customer.search(filter)
|
@crm_customers = Customer.search(filter)
|
||||||
|
# search account no from paypar
|
||||||
|
if !@crm_customers.present? && type == "card"
|
||||||
|
response = Customer.search_paypar_account_no(filter)
|
||||||
|
if response["status"] == true
|
||||||
|
@crm_customers = Customer.new
|
||||||
|
@crm_customers.name = response["customer_data"]["name"]
|
||||||
|
@crm_customers.contact_no = response["customer_data"]["phone"]
|
||||||
|
@crm_customers.email = response["customer_data"]["email"]
|
||||||
|
@crm_customers.date_of_birth = response["customer_data"]["DOB"]
|
||||||
|
@crm_customers.nrc_no = response["customer_data"]["NRC"]
|
||||||
|
@crm_customers.address = response["customer_data"]["address"]
|
||||||
|
@crm_customers.card_no = 121212
|
||||||
|
@crm_customers.paypar_account_no = filter
|
||||||
|
@crm_customers.membership_id = response["customer_data"]["id"]
|
||||||
|
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
|
||||||
|
@crm_customers.customer_type = "Dinein"
|
||||||
|
@crm_customers.tax_profiles = ["1", "2"]
|
||||||
|
@crm_customers.save
|
||||||
|
else
|
||||||
|
@crm_customers = {:status=> response["status"],:message=>response["message"] }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
puts @crm_customers
|
||||||
render :json => @crm_customers.to_json
|
render :json => @crm_customers.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -203,6 +203,41 @@ class Customer < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.search_paypar_account_no(account_no)
|
||||||
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
|
memberaction = MembershipAction.find_by_membership_type("search_paypar_account_no")
|
||||||
|
merchant_uid = memberaction.merchant_account_id.to_s
|
||||||
|
auth_token = memberaction.auth_token.to_s
|
||||||
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
|
begin
|
||||||
|
response = HTTParty.get(url,
|
||||||
|
:body => { paypar_account_no:account_no,
|
||||||
|
merchant_uid:merchant_uid,
|
||||||
|
auth_token:auth_token
|
||||||
|
}.to_json,
|
||||||
|
:headers => {
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
'Accept' => 'application/json'
|
||||||
|
},
|
||||||
|
:timeout => 10
|
||||||
|
)
|
||||||
|
rescue HTTParty::Error
|
||||||
|
response = {status: false, message: "Server Error"}
|
||||||
|
|
||||||
|
rescue Net::OpenTimeout
|
||||||
|
response = { status: false , message: "Server Time out"}
|
||||||
|
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
response = { status: false, message: "Can't connect server"}
|
||||||
|
|
||||||
|
rescue SocketError
|
||||||
|
response = { status: false, message: "Can't connect server"}
|
||||||
|
end
|
||||||
|
puts "sssssssssssss"
|
||||||
|
puts response.to_json
|
||||||
|
return response
|
||||||
|
end
|
||||||
|
|
||||||
def self.search(search)
|
def self.search(search)
|
||||||
if search
|
if search
|
||||||
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
|
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
|
||||||
|
|||||||
@@ -169,6 +169,7 @@
|
|||||||
if(cardNo.length == 16){
|
if(cardNo.length == 16){
|
||||||
$("#paypar_account_no").val(cardNo);
|
$("#paypar_account_no").val(cardNo);
|
||||||
$("#search").val(cardNo);
|
$("#search").val(cardNo);
|
||||||
|
$("#type").val("card");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
<%= form_tag crm_customers_path, :id => "filter_form", :method => :get do %>
|
<%= form_tag crm_customers_path, :id => "filter_form", :method => :get do %>
|
||||||
<div class="input-append col-md-7 form-group pull-left">
|
<div class="input-append col-md-7 form-group pull-left">
|
||||||
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" id="search" class="form-control input-xs col-md-9">
|
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" id="search" class="form-control input-xs col-md-9">
|
||||||
|
<input type="hidden" name="type" id="type" value="">
|
||||||
<button type="submit" class="btn btn-primary btn-md">Search</button>
|
<button type="submit" class="btn btn-primary btn-md">Search</button>
|
||||||
<!-- <a href="modal-window" data-toggle= "modal" data-target="#modal-window" class="btn btn-primary btn-md" id="card_read" >Read Card</a> -->
|
<!-- <a href="modal-window" data-toggle= "modal" data-target="#modal-window" class="btn btn-primary btn-md" id="card_read" >Read Card</a> -->
|
||||||
|
|
||||||
|
|||||||
@@ -50,48 +50,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Large modal -->
|
|
||||||
<button class="btn btn-primary" data-toggle="modal" data-target=".sx_item_detailModal">Large modal</button>
|
|
||||||
|
|
||||||
<div class="modal fade sx_item_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
|
||||||
<div class="modal-dialog modal-lg">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header" style="background-color: #54A5AF;">
|
|
||||||
<h4 class="modal-title" style="color:#fff;" id="title_name"></h4>
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-5">
|
|
||||||
<%= image_tag "logo.png" ,width: '', height: '', :style => '' %>
|
|
||||||
<br><br>
|
|
||||||
<div class="form-group">
|
|
||||||
<h4 class="col-md-12">Quantity</h4>
|
|
||||||
<input type="number" name="qty" class="form-control col-md-12 input-number" id="modal-qty" value="" min="1" max="100">
|
|
||||||
</div>
|
|
||||||
<div class="form-group row">
|
|
||||||
<h4 class="col-md-6">Total</h4>
|
|
||||||
<h4 class="col-md-6" id="total_price"> 2500 Ks</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-7">
|
|
||||||
<h4>Options</h4>
|
|
||||||
|
|
||||||
<h4>Attributes</h4>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
|
|
||||||
<button type="button" class="btn btn-primary" data-dismiss="modal" id="close">Close</button>
|
|
||||||
<button type="button" class="btn btn-success" data-dismiss="modal" id="save_order">Add Order</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Modal -->
|
<!-- Modal -->
|
||||||
<div class="modal fade" id="sx_itemModal" tabindex="-1" role="dialog" aria-labelledby="sx_itemModalLabel" aria-hidden="true">
|
<div class="modal fade" id="sx_itemModal" tabindex="-1" role="dialog" aria-labelledby="sx_itemModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
@@ -130,6 +88,48 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Large modal -->
|
||||||
|
|
||||||
|
<div class="modal fade sx_item_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header" style="background-color: #54A5AF;">
|
||||||
|
<h4 class="modal-title" style="color:#fff;" id="title_name"></h4>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<%= image_tag "logo.png" ,width: '', height: '', :style => '' %>
|
||||||
|
<br><br>
|
||||||
|
<div class="form-group">
|
||||||
|
<h4 class="col-md-12">Quantity</h4>
|
||||||
|
<input type="number" name="qty" class="form-control col-md-12 input-number change_qty" id="change_qty" value="" min="1" max="100">
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<h4 class="col-md-6">Total</h4>
|
||||||
|
<h4 class="col-md-6" id="total_price"> </h4>
|
||||||
|
<p class="hidden" id="unit_price"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-7">
|
||||||
|
<div class="attributes-list">
|
||||||
|
</div>
|
||||||
|
<div class="option-list">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-primary" data-dismiss="modal" id="close">Close</button>
|
||||||
|
<button type="button" class="btn btn-success" data-dismiss="modal" id="save_order">Add Order</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
@@ -142,6 +142,13 @@ $(function(){
|
|||||||
});
|
});
|
||||||
//End menu category Click
|
//End menu category Click
|
||||||
|
|
||||||
|
$(".change_qty").change(function(){
|
||||||
|
qty = $(this).val();
|
||||||
|
price = $("#unit_price").text();
|
||||||
|
$("#total_price").text(qty*price);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
//show menu item list when click menu category
|
//show menu item list when click menu category
|
||||||
function show_menu_item_list(url_item){
|
function show_menu_item_list(url_item){
|
||||||
var menu_list = $('.menu_items_list');
|
var menu_list = $('.menu_items_list');
|
||||||
@@ -154,43 +161,39 @@ $(function(){
|
|||||||
data: {},
|
data: {},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
console.log(data);
|
|
||||||
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(data);
|
|
||||||
for(var field in menu_items) {
|
for(var field in menu_items) {
|
||||||
|
|
||||||
var code = menu_items[field].instances[0].code
|
instances = menu_items[field].instances ;
|
||||||
var name = menu_items[field].instances[0].name
|
|
||||||
var price = parseFloat(menu_items[field].instances[0].price).toFixed(2);
|
|
||||||
var is_available = menu_items[field].instances[0].is_available
|
|
||||||
var is_on_promotion = menu_items[field].instances[0].is_on_promotion
|
|
||||||
var item_attributes = menu_items[field].instances[0].item_attributes
|
|
||||||
var promotion_price = menu_items[field].instances[0].promotion_price
|
|
||||||
|
|
||||||
|
$(instances).each(function(i){
|
||||||
|
if (instances[i].is_default === true) {
|
||||||
|
code = instances[i].code;
|
||||||
|
name = instances[i].name;
|
||||||
|
price = parseFloat(instances[i].price).toFixed(2);
|
||||||
|
is_available = instances[i].is_available ;
|
||||||
|
is_on_promotion = instances[i].is_on_promotion;
|
||||||
|
item_attributes = instances[i].item_attributes;
|
||||||
|
promotion_price = instances[i].promotion_price;
|
||||||
|
code = instances[i].code;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
row = '<div class="card">'
|
row = '<div class="card">'
|
||||||
+'<div class="card-head" style="line-height:14px;">'
|
+'<div class="card-head" style="line-height:14px;">'
|
||||||
+'<small class="col-md-9">'+ menu_items[field].name +'</small>'
|
+'<small class="col-md-9">'+ menu_items[field].name +'</small>'
|
||||||
+'<div class="col-md-3 add_icon"'
|
+"<div class='col-md-3 add_icon' data-item-code='"+ menu_items[field].item_code +"' data-name='"+ menu_items[field].name +"' data-price = '"+ price +"' data-instance-code = '"+ code +"' data-instance = '"+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"+ JSON.stringify(item_attributes) +"'>'"
|
||||||
+'data-id="'+ menu_items[field].name +'"'
|
|
||||||
+'data-item-code="'+ menu_items[field].item_code +'"'
|
|
||||||
+'data-name="'+ menu_items[field].name +'"'
|
|
||||||
+'data-price="'+ price +'"'
|
|
||||||
+'data-available="'+ is_available +'"'
|
|
||||||
+'data-promotion="'+ is_on_promotion +'"'
|
|
||||||
+'data-attributes="'+ item_attributes +'"'
|
|
||||||
+'data-instance-code="'+ code +'"'
|
|
||||||
+'data-instance="'+ name +'"'
|
|
||||||
+'data-promotion-price="'+ promotion_price +'"'
|
|
||||||
+'>'
|
|
||||||
+'<i class="fa fa-plus "'
|
+'<i class="fa fa-plus "'
|
||||||
+ 'style="margin-top:4px;">'
|
+ 'style="margin-top:4px;">'
|
||||||
+'</i></div>'
|
+'</i></div>'
|
||||||
+'</div>'
|
+'</div>'
|
||||||
|
|
||||||
+'<div class="menu_item_box" data-toggle="modal" data-target=".sx_item_detailModal">'
|
+"<div class='menu_item_box' data-instance = '"+JSON.stringify(menu_items[field].instances)+"' data-id = '"+JSON.stringify(menu_items[field].attributes)+"' data-item = '"+JSON.stringify(item_attributes)+"' data-toggle='modal' data-target='.sx_item_detailModal'>'"
|
||||||
|
|
||||||
+'<div class="card-block">'
|
+'<div class="card-block">'
|
||||||
+'<%= image_tag "logo.png" ,width: '75', height: '75', :style => '' %>'
|
+'<%= image_tag "logo.png" ,width: '75', height: '75', :style => '' %>'
|
||||||
+'</div>'
|
+'</div>'
|
||||||
@@ -206,7 +209,68 @@ $(function(){
|
|||||||
});
|
});
|
||||||
//end Ajax
|
//end Ajax
|
||||||
}
|
}
|
||||||
//end show detail function
|
//end show list function
|
||||||
|
|
||||||
|
//click item row for add order
|
||||||
|
$(document).on('click', '.menu_item_box', function(event){
|
||||||
|
$('.attributes-list').empty();
|
||||||
|
$('.attributes-list').empty();
|
||||||
|
|
||||||
|
data = $(this).parent().children().children('.add_icon');
|
||||||
|
attributes = $(this).data('id');
|
||||||
|
selected_item = $(this).data('item');
|
||||||
|
instances = $(this).data('instance');
|
||||||
|
|
||||||
|
for(var field in attributes) {
|
||||||
|
value = attributes[field]["value"];
|
||||||
|
type = attributes[field]["type"]
|
||||||
|
row = "<h4>"+attributes[field]["type"]+"</h4>"
|
||||||
|
|
||||||
|
$(value).each(function(i){
|
||||||
|
status ="";
|
||||||
|
if(parseInt(jQuery.inArray(value[i], selected_item))!== -1){
|
||||||
|
status = "selected-option";
|
||||||
|
}
|
||||||
|
|
||||||
|
row +="<button id='selected-option' data-instances='"+JSON.stringify(instances)+"' data-type='"+type+"' data-value='"+value[i]+"' class='btn btn-default attribute_btn "+ status +" "+ type +" '>"+value[i]+"</button>";
|
||||||
|
|
||||||
|
});
|
||||||
|
$(".attributes-list").append(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#change_qty').val(1);
|
||||||
|
$('#title_name').text(data.attr('data-name'));
|
||||||
|
$('#total_price').text(data.attr('data-price'));
|
||||||
|
$('#unit_price').text(data.attr('data-price'));
|
||||||
|
});
|
||||||
|
|
||||||
|
// click select option icon for add
|
||||||
|
$(document).on('click', '.attribute_btn', function(event){
|
||||||
|
value = $(this).data('value');
|
||||||
|
type = $(this).data('type');
|
||||||
|
instances = $(this).data('instances');
|
||||||
|
if ($(".attribute_btn").attr("data-type")==type){
|
||||||
|
$('.'+type).removeClass("selected-option");
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this).addClass('selected-option');
|
||||||
|
|
||||||
|
selected_item = $('.selected-option').text();
|
||||||
|
|
||||||
|
qty = $('#change_qty').val();
|
||||||
|
|
||||||
|
// for(var field in instances) {
|
||||||
|
// item_attr = instances[field].item_attributes;
|
||||||
|
|
||||||
|
// status ="";
|
||||||
|
// if(parseInt(jQuery.inArray(selected_item, item_attr))!== -1){
|
||||||
|
// status = "selected-option";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
}); //End selecct Click
|
||||||
|
|
||||||
|
|
||||||
// click plus icon for add
|
// click plus icon for add
|
||||||
$(document).on('click', '.add_icon', function(event){
|
$(document).on('click', '.add_icon', function(event){
|
||||||
@@ -219,9 +283,9 @@ $(function(){
|
|||||||
qty = 1;
|
qty = 1;
|
||||||
append = 0;
|
append = 0;
|
||||||
price = parseFloat(data.attr('data-price')).toFixed(2);
|
price = parseFloat(data.attr('data-price')).toFixed(2);
|
||||||
instance_code = data.attr('data-instance');
|
instance_name = data.attr('data-instance');
|
||||||
|
|
||||||
if (instance_code == "undefined"){
|
if (instance_name == "undefined"){
|
||||||
instance = '';
|
instance = '';
|
||||||
}else{
|
}else{
|
||||||
instance = "("+data.attr('data-instance')+")";
|
instance = "("+data.attr('data-instance')+")";
|
||||||
@@ -243,9 +307,9 @@ $(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (append===0) {
|
if (append===0) {
|
||||||
row ="<tr class='item_box' data-price ='"+price+ "'data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"+instance+ "'data-code='"+data.attr('data-item-code')+"'>"
|
row ="<tr class='item_box' data-price ='"+price+ "'data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"+instance+ "' data-code='"+data.attr('data-item-code')+"' data-instance-code='"+data.attr('data-instance-code')+"' data-attributes='"+data.attr('data-attributes')+"'>"
|
||||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||||
+'<td class="item-cell-name" id="item_name" >' + data.attr('data-name')+ ' ' + instance + '</td>'
|
+'<td class="item-cell-name" id="item_name" >' + data.attr('data-name')+ ' ' + instance + data.attr('data-attributes')+'</td>'
|
||||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||||
+'<td class="item-cell-price" id="item_price">'
|
+'<td class="item-cell-price" id="item_price">'
|
||||||
+ parseFloat(price).toFixed(2)
|
+ parseFloat(price).toFixed(2)
|
||||||
@@ -265,14 +329,6 @@ $(function(){
|
|||||||
$('#modal-qty').val(qty);
|
$('#modal-qty').val(qty);
|
||||||
});
|
});
|
||||||
|
|
||||||
//click item row for update qty
|
|
||||||
$(document).on('click', '.menu_item_box', function(event){
|
|
||||||
|
|
||||||
data = $(this).parent().children().children('.add_icon');
|
|
||||||
$('#title_name').text(data.attr('data-name'));
|
|
||||||
console.log(data);
|
|
||||||
});
|
|
||||||
|
|
||||||
//click remove buttom in modal box
|
//click remove buttom in modal box
|
||||||
$('#sx_itemModal').on('click','#remove', function(){
|
$('#sx_itemModal').on('click','#remove', function(){
|
||||||
$('.summary-items tr').filter(function(){
|
$('.summary-items tr').filter(function(){
|
||||||
@@ -406,6 +462,17 @@ $(function(){
|
|||||||
padding-top: 100px;
|
padding-top: 100px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.selected-option {
|
||||||
|
color: #fff !important;
|
||||||
|
background-color: green !important;
|
||||||
|
}
|
||||||
|
.attribute_btn {
|
||||||
|
white-space: normal !important;
|
||||||
|
height: 60px;
|
||||||
|
width: 90px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
<%= form_tag path, :id => "filter_form", :method => :get do %>
|
<%= form_tag path, :id => "filter_form", :method => :get do %>
|
||||||
<div class="input-append col-md-7 form-group pull-left">
|
<div class="input-append col-md-7 form-group pull-left">
|
||||||
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-9">
|
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-9">
|
||||||
|
<input type="hidden" name="type" id="type" value="">
|
||||||
<button type="submit" class="btn btn-primary btn-sm">Search</button>
|
<button type="submit" class="btn btn-primary btn-sm">Search</button>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -258,9 +259,14 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "get_customer" ,
|
url: "get_customer" ,
|
||||||
data: { filter : customer_mamber_card_no },
|
data: { filter : customer_mamber_card_no ,type :"card"},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
if (data.status == false) {
|
||||||
|
alert(data.message)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
customer_id = data[0].customer_id;
|
customer_id = data[0].customer_id;
|
||||||
customer_name = data[0].name;
|
customer_name = data[0].name;
|
||||||
update_sale(customer_id, customer_name,sale_id);
|
update_sale(customer_id, customer_name,sale_id);
|
||||||
@@ -282,6 +288,7 @@
|
|||||||
if(cardNo.length == 16){
|
if(cardNo.length == 16){
|
||||||
$("#paypar_account_no").val(cardNo);
|
$("#paypar_account_no").val(cardNo);
|
||||||
$("#search").val(cardNo);
|
$("#search").val(cardNo);
|
||||||
|
$("#type").val("card")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user