assign table ,membership transaction and queue
This commit is contained in:
@@ -23,6 +23,17 @@
|
||||
.assign .text-muted{
|
||||
color: #fff !important;
|
||||
}
|
||||
.red{
|
||||
color: #fff !important;
|
||||
background-color: red;
|
||||
}
|
||||
.green{
|
||||
color: #fff !important;
|
||||
background-color: green;
|
||||
}
|
||||
.required abbr{
|
||||
color: red !important;
|
||||
}
|
||||
.jconfirm-box-container{
|
||||
margin-left:-40px !important
|
||||
}
|
||||
@@ -47,14 +47,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(params[:id])
|
||||
response = Customer.get_member_account(@customer)
|
||||
|
||||
if(response["status"] == true)
|
||||
@membership = response["data"]
|
||||
else
|
||||
@membership = 0
|
||||
end
|
||||
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
#end customer amount
|
||||
|
||||
end
|
||||
@@ -180,7 +173,7 @@ end
|
||||
|
||||
else
|
||||
|
||||
flash[:errors] = @crm_customers.errors
|
||||
flash[:errors] = @crm_customer.errors
|
||||
format.html { redirect_to crm_customers_path}
|
||||
format.json { render json: @crm_customer.errors, status: :unprocessable_entity }
|
||||
end
|
||||
|
||||
@@ -84,12 +84,15 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
queue = DiningQueue.find(params[:id])
|
||||
table_id = params[:table_id]
|
||||
|
||||
queue.update_attributes(dining_facility_id: table_id,status:"Assign")
|
||||
DiningFacility.find(table_id).update_attributes(status: "occupied")
|
||||
respond_to do |format|
|
||||
format.html { redirect_to crm_dining_queues_path, notice: 'Table was successfully assigned.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
status = queue.update_attributes(dining_facility_id: table_id,status:"Assign")
|
||||
status = DiningFacility.find(table_id).update_attributes(status: "occupied")
|
||||
|
||||
|
||||
if status == true
|
||||
render json: JSON.generate({:status => true , notice: 'Dining queue was successfully assigned .'})
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -6,9 +6,10 @@ class Customer < ApplicationRecord
|
||||
has_many :orders
|
||||
has_many :sales
|
||||
|
||||
validates_presence_of :name, :contact_no, :email
|
||||
validates_presence_of :name, :contact_no, :email,:company,:card_no
|
||||
validates :contact_no, uniqueness: true
|
||||
validates :email, uniqueness: true
|
||||
validates :card_no, uniqueness: true
|
||||
|
||||
paginates_per 50
|
||||
|
||||
@@ -36,6 +37,30 @@ class Customer < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def self.get_membership_transactions(customer)
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("get_member_transactions")
|
||||
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
|
||||
# urltest =self.url_exist?(url)
|
||||
|
||||
begin
|
||||
response = HTTParty.get(url, :body => { membership_id: customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
end
|
||||
|
||||
return response;
|
||||
|
||||
end
|
||||
|
||||
def self.search(search)
|
||||
if search
|
||||
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
|
||||
|
||||
@@ -202,9 +202,9 @@ class SalePayment < ApplicationRecord
|
||||
customer_data = Customer.find_by_customer_id(self.sale.customer_id)
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
|
||||
puts 'membership_data["status"]'
|
||||
puts 'mmmmmmmmmmmmmmmmmmmmmmmmmmm'
|
||||
puts membership_data.to_json
|
||||
puts "amountttttttttttt"
|
||||
puts "amountttttttttttttttttttttt"
|
||||
puts self.received_amount
|
||||
if membership_data["status"]==true
|
||||
self.payment_method = "paypar"
|
||||
@@ -264,7 +264,7 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
def rebat(sObj)
|
||||
rebate_prices = SaleItem.calculate_food_beverage(sObj.sale_items)
|
||||
puts "rebate_prices"
|
||||
puts "eeeeeeeeeeeeeeeeeeeeeeee"
|
||||
puts rebate_prices
|
||||
generic_customer_id = sObj.customer.membership_id
|
||||
if generic_customer_id != nil || generic_customer_id != "" || generic_customer_id != 0
|
||||
|
||||
@@ -250,43 +250,30 @@ class ReceiptBillPdf < Prawn::Document
|
||||
end
|
||||
move_down 5
|
||||
end
|
||||
stroke_horizontal_rule
|
||||
end
|
||||
|
||||
# show member information
|
||||
def member_info(member_info,customer_name,rebate_amount,sale_data)
|
||||
|
||||
if rebate_amount != nil
|
||||
stroke_horizontal_rule
|
||||
if rebate_amount[1]["status"] == true
|
||||
total_redeem = 0.0
|
||||
amount = 0.0
|
||||
earm_amount = 0.0
|
||||
SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment|
|
||||
if payment.payment_method == "paypar"
|
||||
total_redeem = total_redeem + payment.payment_amount
|
||||
end
|
||||
end
|
||||
earm_amount = earm_amount + rebate_amount[1]["rebate_earned"].to_f
|
||||
amount = amount + total_redeem
|
||||
amount = amount + earm_amount
|
||||
old = rebate_amount[1]["total_rebate_amount"].to_f - amount
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Old Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{old}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down 5
|
||||
if rebate_amount["status"] == true
|
||||
rebate_amount["data"].each do |res|
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Earned Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ rebate_amount[1]["rebate_earned"] }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
if res["receipt_no"]== sale_data.receipt_no
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Rebate Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ res["rebate"] }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
if member_info["status"] == true
|
||||
@@ -297,7 +284,7 @@ class ReceiptBillPdf < Prawn::Document
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Rebate Balance", :size => self.item_font_size,:align => :left
|
||||
text "Current Balance", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ res["balance"] }" , :size => self.item_font_size,:align => :right
|
||||
|
||||
20
app/views/crm/customers/_card_read_form.html.erb
Normal file
20
app/views/crm/customers/_card_read_form.html.erb
Normal file
@@ -0,0 +1,20 @@
|
||||
<!-- Modal -->
|
||||
<div id="myModal" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog" style="margin-left:-180px">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Modal Header</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Some text in the modal.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,9 +0,0 @@
|
||||
<div class="form-group">
|
||||
<select class="selectpicker form-control col-md-12" name="membership_id">
|
||||
<option>Select Member Group</option>
|
||||
<% @member_group.each do |member| %>
|
||||
<option value="<%= member["id"] %>">
|
||||
<%= member["name"] %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</div>
|
||||
122
app/views/crm/customers/_new_form.html.erb
Normal file
122
app/views/crm/customers/_new_form.html.erb
Normal file
@@ -0,0 +1,122 @@
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
|
||||
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||
|
||||
<span class="patch_method"></span>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['name']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Salutation :</label><br>
|
||||
<label>
|
||||
<input type="radio" value="Mr" name="salutation" class="salutation mr" style="width: 30px">Mr
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Miss" name="salutation" class="salutation miss" style="width: 30px">Miss
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Mrs" name="salutation" class="salutation mrs" style="width: 30px">Mrs
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Mdm" name="salutation" class="salutation mdm" style="width: 30px">Mdm
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :name, :class => "form-control col-md-6 name", :required => true %>
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['name']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Gender :</label><br>
|
||||
<label>
|
||||
<input type="radio" value="Male" name="gender" class="gender male" style="width:30px;">Male
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Female" name="gender" class="gender female" style="width:30px;">Female
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :nrc_no, :class => "form-control nrc_no" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :company, :class => "form-control col-md-6 company",:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['company']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" ,:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['contact_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['contact_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :address, :class => "form-control col-md-6 address" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Sr.No</label>
|
||||
<input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Date Of Birth</label>
|
||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Select Member Group</label>
|
||||
<select class="selectpicker form-control col-md-12" name="member_group_id" style="height: 40px" >
|
||||
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
|
||||
<option value="<%= member.value %>">
|
||||
<%= member.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
|
||||
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %>
|
||||
<%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
@@ -11,8 +11,6 @@
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
|
||||
@@ -26,8 +24,11 @@
|
||||
<td colspan="6">
|
||||
<%= form_tag crm_customers_path, :method => :get do %>
|
||||
<div class="input-append col-md-12 form-group pull-left">
|
||||
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" class="form-control input-sm col-md-4">
|
||||
<button type="submit" class="btn btn-primary btn-sm">Search</button>
|
||||
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" id="search" class="form-control input-xs col-md-4">
|
||||
<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> -->
|
||||
|
||||
<button type="button" class="btn btn-info btn-md" data-toggle="modal" data-target="#myModal">Open Modal</button>
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
@@ -43,7 +44,6 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% if @crm_customers.count > 0 %>
|
||||
<% @i = 0 %>
|
||||
<% @crm_customers.each do |crm_customer| %>
|
||||
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
|
||||
@@ -60,9 +60,7 @@
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%else%>
|
||||
<tr><td colspan="5"><p style="text-align:center"><strong>There are no record for your search</strong></p></td></tr>
|
||||
<% end %>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
@@ -70,127 +68,17 @@
|
||||
<%= paginate @crm_customers %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render 'card_read_form' %>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4">
|
||||
|
||||
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||
<%= render 'new_form', crm_customer: @crm_customer %>
|
||||
|
||||
<span class="patch_method"></span>
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Salutation :</label><br>
|
||||
<label>
|
||||
<input type="radio" value="Mr" name="salutation" class="salutation mr" style="width: 30px">Mr
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Miss" name="salutation" class="salutation miss" style="width: 30px">Miss
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Mrs" name="salutation" class="salutation mrs" style="width: 30px">Mrs
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Mdm" name="salutation" class="salutation mdm" style="width: 30px">Mdm
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :name, :class => "form-control col-md-6 name", :required => true %>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['name']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Gender :</label><br>
|
||||
<label>
|
||||
<input type="radio" value="Male" name="gender" class="gender male" style="width:30px;">Male
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" value="Female" name="gender" class="gender female" style="width:30px;">Female
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :nrc_no, :class => "form-control nrc_no" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :company, :class => "form-control col-md-6 company",:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['company']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" ,:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['contact_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||
<%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['contact_no']}\"]"
|
||||
str.gsub!('["', '')
|
||||
str.gsub!('"]', '') %>
|
||||
<span class="help-block"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :address, :class => "form-control col-md-6 address" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Sr.No</label>
|
||||
<input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Date Of Birth</label>
|
||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Select Member Group</label>
|
||||
<select class="selectpicker form-control col-md-12" name="member_group_id" style="height: 40px" >
|
||||
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
|
||||
<option value="<%= member.value %>">
|
||||
<%= member.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
|
||||
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %>
|
||||
<%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<br>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<br>
|
||||
<a href="<%= crm_customers_path%>" class="btn btn-primary">
|
||||
<i class="fa fa-arrow-left fa-lg"></i> Back
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -203,9 +91,10 @@ $(function() {
|
||||
});
|
||||
$('.datepicker').attr('ReadOnly','true');
|
||||
$('.datepicker').css('cursor','pointer');
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click',".customer_tr",function(){
|
||||
$(document).on('click',".customer_tr",function(){
|
||||
// if(this.checked){
|
||||
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
|
||||
//$( "#checkbox_check" ).prop( "checked", true );
|
||||
@@ -233,6 +122,7 @@ $(function() {
|
||||
$('#customer_email').val(data.email);
|
||||
$('#customer_salution').val(data.salution);
|
||||
$('#customer_nrc_no').val(data.nrc_no);
|
||||
$('#customer_card_no').val(data.card_no);
|
||||
$('#customer_address').val(data.address);
|
||||
$('#customer_date_of_birth').val(data.date_of_birth);
|
||||
$('#customer_membership_type').val(data.membership_type);
|
||||
|
||||
@@ -1,61 +1,74 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="<%= crm_root_path %>">Home</a></li>
|
||||
<li class="active">
|
||||
<a href="<%= crm_customers_path %>">Customer</a>
|
||||
</li>
|
||||
<li><%= @customer.customer_id%></li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
<!-- Column One -->
|
||||
<div class="tab-pane active" id="queue" role="tabpanel"">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<br>
|
||||
<h4>Customer Profile</h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td><%= @crm_customer.name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Email</th>
|
||||
<td><%= @crm_customer.email %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Contact no</th>
|
||||
<td><%= @crm_customer.contact_no %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Company</th>
|
||||
<td><%= @crm_customer.company %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date Of Birth</th>
|
||||
<td><%= @crm_customer.date_of_birth %> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<br>
|
||||
<h4>Membership Detail</h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<% if @membership == 0 %>
|
||||
<tr>
|
||||
<td colspan="2">"There is no membership data"</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<% @membership.each do |member| %>
|
||||
<tr>
|
||||
<th><%= member["accountable_type"] %></th>
|
||||
<td><%= member["balance"] %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Card No</th>
|
||||
<th>Name</th>
|
||||
<th>Company</th>
|
||||
<th>Contact no</th>
|
||||
<th>Email</th>
|
||||
<th>NRC/Passport No</th>
|
||||
<th>Address</th>
|
||||
<th>DOB</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><%= @customer.card_no rescue '-'%></td>
|
||||
<td><%= @customer.name %></td>
|
||||
<td><%= @customer.company rescue '-' %></td>
|
||||
<td><%= @customer.contact_no %></td>
|
||||
<td><%= @customer.email %></td>
|
||||
<td><%= @customer.nrc_no %></td>
|
||||
<td><%= @customer.address%></td>
|
||||
<td><%= @customer.date_of_birth %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="8">Membership Transactions</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Redeem</th>
|
||||
<th>Rebate</th>
|
||||
<th>Balance</th>
|
||||
<th>Account No</th>
|
||||
<th>Status</th>
|
||||
<th>Receipt No</th>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
if @response["status"] == true %>
|
||||
<% @response["data"].each do |transaction| %>
|
||||
<tr>
|
||||
<td><%= transaction["date"]%></td>
|
||||
<td><%= transaction["redeem"]%></td>
|
||||
<td><%= transaction["rebate"] %></td>
|
||||
<td><%= transaction["balance"] %></td>
|
||||
<td><%= transaction["account_no"] %></td>
|
||||
<td><%= transaction["status"] %></td>
|
||||
<td><%= transaction["receipt_no"] %></td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,44 +1,112 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= root_path %>">Home</a></li>
|
||||
<li><a href="<%= crm_dining_queues_path %>">Queue</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<%= form_tag crm_assign_table_path, :method => :post do %>
|
||||
<input type="hidden" name="id" value="<%=@queue.id%>">
|
||||
<div class="form-group">
|
||||
<label>Queue No</label>
|
||||
<input type="text" name="queue" class="form-control" readonly="true" value="<%=@queue.queue_no%>">
|
||||
|
||||
</div>
|
||||
<div class="form-inputs">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Select Table</label>
|
||||
<select class="selectpicker form-control col-md-12" name="table_id" style="height: 40px" >
|
||||
<% @tables.each do |table| %>
|
||||
<option value="<%= table.id %>">
|
||||
<%= table.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-default">Assign Table</button>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Queue</li>
|
||||
<li>Assign Queue <%=@queue.queue_no%></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="active" id="tables" role="tabpanel">
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
|
||||
<% @i =0 %>
|
||||
<% DiningFacility.all.each do |table| %>
|
||||
<div class="card assign_table <%= table.status=="available" ? "green" : "red"%>" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden queue-id"><%= @queue.id %></p>
|
||||
<p class="hidden queue-status"><%= table.status %></p>
|
||||
<p style="text-align: center"><%= table.name %></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<br>
|
||||
<a href="<%= crm_dining_queues_path%>" class="btn btn-primary">
|
||||
<i class="fa fa-arrow-left fa-lg"></i> Back
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).on('click',".assign_table",function(){
|
||||
|
||||
var queue_id = $(this).find(".queue-id").text();
|
||||
var table_id = $(this).attr('data-id');
|
||||
url = '<%= crm_assign_table_path %>';
|
||||
var status = $(this).find(".queue-status").text()
|
||||
|
||||
if (status == "available") {
|
||||
assign_table(queue_id,table_id,url);
|
||||
} else {
|
||||
$.confirm({
|
||||
title: 'Alert!',
|
||||
content: 'You cannot assign this table',
|
||||
buttons: {
|
||||
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
function assign_table(id,table_id,url) {
|
||||
$.confirm({
|
||||
title: 'Confirm!',
|
||||
content: 'Are You Sure to assign this customer!',
|
||||
buttons: {
|
||||
|
||||
cancel: function () {
|
||||
|
||||
},
|
||||
confirm: {
|
||||
text: 'Confirm',
|
||||
btnClass: 'btn-green',
|
||||
keys: ['enter', 'shift'],
|
||||
action: function(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url ,
|
||||
data: {id:id,table_id:table_id},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status == true)
|
||||
{
|
||||
window.location.href = '<%=crm_dining_queues_path%>'
|
||||
}else{
|
||||
alert('Record not found!');
|
||||
location.reload();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -9,39 +9,38 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-11 col-md-11 col-sm-11" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
|
||||
<div class="row">
|
||||
<% @i = 0 %> .
|
||||
<% @dining_queues.each do |queue| %>
|
||||
<div class="col-md-3 ">
|
||||
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" style="border:1px solid #ccc;margin-bottom: 10px ">
|
||||
<div class="card-block">
|
||||
<p class="hidden queue-id"><%= queue.id %></p>
|
||||
<p class="hidden queue-status"><%= queue.status %></p>
|
||||
<h4 class="card-title"><%= @i += 1 %> . Queue No </h4>
|
||||
<h1 style="text-align: center"><%= queue.queue_no %></h1>
|
||||
<p class="card-text">
|
||||
<small class="text-muted">Name : <%= queue.name %></small> <br>
|
||||
<small class="text-muted">Contact : <%= queue.contact_no %></small>
|
||||
<br>
|
||||
<small class="text-muted">Status : <%= queue.status rescue '-' %></small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="active" id="tables" role="tabpanel">
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
|
||||
<% @i =0 %>
|
||||
<% @dining_queues.each do |queue| %>
|
||||
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" data-id="<%= queue.id %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden queue-id"><%= queue.id %></p>
|
||||
<p class="hidden queue-status"><%= queue.status %></p>
|
||||
<span class="card-title"><%= @i += 1 %> . Queue No </span>
|
||||
<h1 style="text-align: center"><%= queue.queue_no %></h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" id="assign" class="btn btn-primary btn-lg btn-block" disabled>Assign</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
@@ -53,7 +52,7 @@ $(function(){
|
||||
if(status != "Assign"){
|
||||
$("#assign").removeAttr("disabled");
|
||||
}else{
|
||||
$("#assign").addAttr("disabled");
|
||||
$("#assign").attr("disabled","disabled");
|
||||
}
|
||||
$("#assign").val($(this).find(".queue-id").text());
|
||||
}); //End Click
|
||||
|
||||
69
app/views/crm/dining_queues/index_bk.html.erb
Normal file
69
app/views/crm/dining_queues/index_bk.html.erb
Normal file
@@ -0,0 +1,69 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= %>">Home</a></li>
|
||||
<li>Queue</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")),new_crm_dining_queue_path,:class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-11 col-md-11 col-sm-11" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
|
||||
<div class="row">
|
||||
<% @i = 0 %> .
|
||||
<% @dining_queues.each do |queue| %>
|
||||
<div class="col-md-3 ">
|
||||
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" style="border:1px solid #ccc;margin-bottom: 10px ">
|
||||
<div class="card-block">
|
||||
<p class="hidden queue-id"><%= queue.id %></p>
|
||||
<p class="hidden queue-status"><%= queue.status %></p>
|
||||
<h4 class="card-title"><%= @i += 1 %> . Queue No </h4>
|
||||
<h1 style="text-align: center"><%= queue.queue_no %></h1>
|
||||
<p class="card-text">
|
||||
<small class="text-muted">Name : <%= queue.name %></small> <br>
|
||||
<small class="text-muted">Contact : <%= queue.contact_no %></small>
|
||||
<br>
|
||||
<small class="text-muted">Status : <%= queue.status rescue '-' %></small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" id="assign" class="btn btn-primary btn-lg btn-block" disabled>Assign</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
|
||||
$(".select-queue").on("click", function(){
|
||||
$('.select-queue').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
var status = $(this).find(".queue-status").text();
|
||||
if(status != "Assign"){
|
||||
$("#assign").removeAttr("disabled");
|
||||
}else{
|
||||
$("#assign").addAttr("disabled");
|
||||
}
|
||||
$("#assign").val($(this).find(".queue-id").text());
|
||||
}); //End Click
|
||||
|
||||
|
||||
});
|
||||
$('#assign').click(function() {
|
||||
var id = $(this).val();
|
||||
window.location.href = "dining_queues/"+id + "/assign"
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
class CreateCustomers < ActiveRecord::Migration[5.1]
|
||||
class CreateCustomers < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :customers, :id => false do |t|
|
||||
t.string :customer_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync
|
||||
@@ -15,7 +14,7 @@
|
||||
t.string :gender
|
||||
t.string :nrc_no
|
||||
t.string :address
|
||||
t.string :card_no
|
||||
t.string :card_no, :unique => true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
@@ -161,7 +161,8 @@ member_actions= MembershipAction.create([{membership_type:"get_account_balance",
|
||||
{membership_type:"update_membership_customer",gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
|
||||
{membership_type:"get_all_member_group",gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
|
||||
{membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
|
||||
{membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}
|
||||
{membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
|
||||
{membership_type:"get_member_transactions",gateway_url:"/api/generic_customer/get_membership_transactions",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}
|
||||
])
|
||||
|
||||
payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http://192.168.1.47:3006"})
|
||||
|
||||
Reference in New Issue
Block a user