merge with crm

This commit is contained in:
Yan
2017-06-26 14:23:56 +06:30
9 changed files with 78 additions and 90 deletions

View File

@@ -69,7 +69,7 @@ class Crm::CustomersController < BaseCrmController
def create def create
@crm_customers = Customer.new(customer_params) @crm_customers = Customer.new(customer_params)
respond_to do |format| respond_to do |format|
if @crm_customers.save if @crm_customers.save
name = customer_params[:name] name = customer_params[:name]
@@ -78,6 +78,7 @@ class Crm::CustomersController < BaseCrmController
dob = customer_params[:date_of_birth] dob = customer_params[:date_of_birth]
address = customer_params[:address] address = customer_params[:address]
nrc = customer_params[:nrc_no] nrc = customer_params[:nrc_no]
card_no = customer_params[:card_no]
member_group_id = params[:member_group_id] member_group_id = params[:member_group_id]
if !member_group_id.nil? if !member_group_id.nil?
@@ -88,16 +89,17 @@ class Crm::CustomersController < BaseCrmController
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
begin begin
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email, response = HTTParty.post(url,
dob: dob,address: address,nrc:nrc, :body => {name: name,phone: phone,email: email,
member_group_id: member_group_id, dob: dob,address: address,nrc:nrc,card_no:card_no,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json, member_group_id: member_group_id,
:headers => { merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
'Content-Type' => 'application/json', :headers => {
'Accept' => 'application/json' 'Content-Type' => 'application/json',
'Accept' => 'application/json'
}, },
:timeout => 10 :timeout => 10
) )
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = { status: false } response = { status: false }
end end
@@ -150,10 +152,12 @@ end
dob = customer_params[:date_of_birth] dob = customer_params[:date_of_birth]
address = customer_params[:address] address = customer_params[:address]
nrc = customer_params[:nrc_no] nrc = customer_params[:nrc_no]
card_no = customer_params[:card_no]
id = @crm_customer.membership_id id = @crm_customer.membership_id
member_group_id = params[:member_group_id] member_group_id = params[:member_group_id]
if id.nil? && !member_group_id.nil? if id.nil? && !member_group_id.nil?
membership = MembershipSetting.find_by_membership_type("paypar_url") membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("create_membership_customer") memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
merchant_uid = memberaction.merchant_account_id.to_s merchant_uid = memberaction.merchant_account_id.to_s
@@ -161,16 +165,17 @@ end
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
begin begin
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email, response = HTTParty.post(url,
dob: dob,address: address,nrc:nrc, :body => { name: name,phone: phone,email: email,
member_group_id: member_group_id, dob: dob,address: address,nrc:nrc,
merchant_uid:merchant_uid,auth_token:auth_token}.to_json, card_no:card_no,member_group_id: member_group_id,
:headers => { merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
'Content-Type' => 'application/json', :headers => {
'Accept' => 'application/json' 'Content-Type' => 'application/json',
'Accept' => 'application/json'
}, },
:timeout => 10 :timeout => 10
) )
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = { status: false } response = { status: false }
end end
@@ -186,20 +191,22 @@ end
end end
else else
membership = MembershipSetting.find_by_membership_type("paypar_url") membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("update_membership_customer") memberaction = MembershipAction.find_by_membership_type("update_membership_customer")
merchant_uid = memberaction.merchant_account_id.to_s merchant_uid = memberaction.merchant_account_id.to_s
auth_token = memberaction.auth_token.to_s auth_token = memberaction.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
begin begin
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email, response = HTTParty.post(url,
dob: dob,address: address,nrc:nrc, :body => {name: name,phone: phone,email: email,
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, dob: dob,address: address,nrc:nrc,card_no:card_no,
:headers => { id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
'Content-Type' => 'application/json', :headers => {
'Accept' => 'application/json' 'Content-Type' => 'application/json',
'Accept' => 'application/json'
}, },
:timeout => 10 :timeout => 10
) )
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = { status: false } response = { status: false }

View File

@@ -93,10 +93,10 @@ class ReceiptBillPdf < Prawn::Document
y_position = cursor y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
text "Time In: #{ sale_data.bookings[0].checkin_at.strftime('%I:%M %p') }", :size => self.item_font_size,:align => :left text "Time In: #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') }", :size => self.item_font_size,:align => :left
end end
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
text "Time Out: #{ sale_data.bookings[0].checkout_at.strftime('%I:%M %p') }" , :size => self.item_font_size,:align => :right text "Time Out: #{ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p') }" , :size => self.item_font_size,:align => :right
end end
move_down 5 move_down 5

View File

@@ -11,24 +11,20 @@
<% str="[\"#{msg['name']}\"]" <% str="[\"#{msg['name']}\"]"
str.gsub!('["', '') str.gsub!('["', '')
str.gsub!('"]', '') %> str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-10px"><%= str %></span> <span class="help-block" style="margin-top:-6px"><%= str %></span>
<% end -%> <% end -%>
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Salutation :</label><br> <label>Salutation :</label><br>
<label> <label>Mr</label>
<input type="radio" value="Mr" name="salutation" class="salutation mr" style="width: 30px">Mr <%= f.radio_button :salutation,"Mr", :class => "salutation mr", :value=>"Mr", :style=>"width: 30px"%>
</label> <label>Miss</label>
<label> <%= f.radio_button :salutation,"Mrs", :class => "salutation mrs", :value=>"Mrs", :style=>"width: 30px"%>
<input type="radio" value="Miss" name="salutation" class="salutation miss" style="width: 30px">Miss <label>Mrs</label>
</label> <%= f.radio_button :salutation,"Miss", :class => "salutation miss", :value=>"Miss", :style=>"width: 30px"%>
<label> <label>Mdm</label>
<input type="radio" value="Mrs" name="salutation" class="salutation mrs" style="width: 30px">Mrs <%= f.radio_button :salutation,"Mdm", :class => "salutation mdm", :value=>"Mdm", :style=>"width: 30px"%>
</label>
<label>
<input type="radio" value="Mdm" name="salutation" class="salutation mdm" style="width: 30px">Mdm
</label>
</div> </div>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>"> <div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
@@ -37,18 +33,16 @@
<% str="[\"#{msg['name']}\"]" <% str="[\"#{msg['name']}\"]"
str.gsub!('["', '') str.gsub!('["', '')
str.gsub!('"]', '') %> str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-10px"><%= str %></span> <span class="help-block" style="margin-top:-6px"><%= str %></span>
<% end -%> <% end -%>
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Gender :</label><br> <label>Gender :</label><br>
<label> <label>Male</label>
<input type="radio" value="Male" name="gender" class="gender male" style="width:30px;">Male <%= f.radio_button :gender,"Male", :class => "gender male", :value=>"Male", :style=>"width: 30px"%>
</label> <label>Female</label>
<label> <%= f.radio_button :gender,"Female", :class => "gender female", :value=>"Female", :style=>"width: 30px"%>
<input type="radio" value="Female" name="gender" class="gender female" style="width:30px;">Female
</label>
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -62,7 +56,7 @@
<% str="[\"#{msg['company']}\"]" <% str="[\"#{msg['company']}\"]"
str.gsub!('["', '') str.gsub!('["', '')
str.gsub!('"]', '') %> str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-10px"><%= str %></span> <span class="help-block" style="margin-top:-6px"><%= str %></span>
<% end -%> <% end -%>
</div> </div>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>"> <div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
@@ -72,7 +66,7 @@
<% str="[\"#{msg['contact_no']}\"]" <% str="[\"#{msg['contact_no']}\"]"
str.gsub!('["', '') str.gsub!('["', '')
str.gsub!('"]', '') %> str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-10px"><%= str %></span> <span class="help-block" style="margin-top:-6px"><%= str %></span>
<% end -%> <% end -%>
</div> </div>
@@ -83,7 +77,7 @@
<% str="[\"#{msg['contact_no']}\"]" <% str="[\"#{msg['contact_no']}\"]"
str.gsub!('["', '') str.gsub!('["', '')
str.gsub!('"]', '') %> str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-10px"><%= str %></span> <span class="help-block" style="margin-top:-6px"><%= str %></span>
<% end -%> <% end -%>
</div> </div>

View File

@@ -152,7 +152,6 @@ $(document).on('click',".customer_tr",function(){
$("#new_customer").attr('class', 'simple_form edit_customer'); $("#new_customer").attr('class', 'simple_form edit_customer');
var id = "edit_customer_"+customer_id; var id = "edit_customer_"+customer_id;
alert(id)
$("#new_customer").attr('id', id); $("#new_customer").attr('id', id);
$(".edit_customer").attr('id', id); $(".edit_customer").attr('id', id);

View File

@@ -55,12 +55,14 @@
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<% if @response["status"] == true && $response["data"] != "[]"%>
<tr> <tr>
<th colspan="5">Membership Transactions</th> <th colspan="5">Membership Transactions</th>
<% if @response["status"] == true %> <% if @response["status"] == true %>
<th>Current Balance : <%= @response["data"][0]["balance"]%></th> <th>Current Balance : <%= @response["data"][0]["balance"]%></th>
<% end %> <% end %>
</tr> </tr>
<% end %>
<tr> <tr>
<th>Date</th> <th>Date</th>
<th>Redeem</th> <th>Redeem</th>

View File

@@ -88,18 +88,14 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Salutation :</label><br> <label>Salutation :</label><br>
<label> <label>Mr</label>
<input type="radio" value="Mr" name="salutation" class="salutation mr" style="width: 30px">Mr <%= f.radio_button :salutation,"Mr", :class => "salutation mr", :value=>"Mr", :style=>"width: 30px"%>
</label> <label>Miss</label>
<label> <%= f.radio_button :salutation,"Mrs", :class => "salutation mrs", :value=>"Mrs", :style=>"width: 30px"%>
<input type="radio" value="Miss" name="salutation" class="salutation miss" style="width: 30px">Miss <label>Mrs</label>
</label> <%= f.radio_button :salutation,"Miss", :class => "salutation miss", :value=>"Miss", :style=>"width: 30px"%>
<label> <label>Mdm</label>
<input type="radio" value="Mrs" name="salutation" class="salutation mrs" style="width: 30px">Mrs <%= f.radio_button :salutation,"Mdm", :class => "salutation mdm", :value=>"Mdm", :style=>"width: 30px"%>
</label>
<label>
<input type="radio" value="Mdm" name="salutation" class="salutation mdm" style="width: 30px">Mdm
</label>
</div> </div>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>"> <div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
@@ -115,12 +111,10 @@
<div class="form-group"> <div class="form-group">
<label>Gender :</label><br> <label>Gender :</label><br>
<label> <label>Male</label>
<input type="radio" value="Male" name="gender" class="gender male" style="width:30px;">Male <%= f.radio_button :gender,"Male", :class => "gender male", :value=>"Male", :style=>"width: 30px"%>
</label> <label>Female</label>
<label> <%= f.radio_button :gender,"Female", :class => "gender female", :value=>"Female", :style=>"width: 30px"%>
<input type="radio" value="Female" name="gender" class="gender female" style="width:30px;">Female
</label>
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -161,10 +155,10 @@
<%= f.input :address, :class => "form-control col-md-6 address" %> <%= f.input :address, :class => "form-control col-md-6 address" %>
</div> </div>
<div class="form-group"> <!-- <div class="form-group">
<label>Sr.No</label> <label>Sr.No</label>
<input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true"> <input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true">
</div> </div> -->
<div class="form-group"> <div class="form-group">
<label>Date Of Birth</label> <label>Date Of Birth</label>
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%> <%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
@@ -327,16 +321,4 @@
}) })
</script> </script>
class CreateDiningQueues < ActiveRecord::Migration[5.1]
def change
create_table :dining_queues do |t|
t.string :name
t.string :contact_no
t.string :queue_no
t.string :status
t.references :dining_facility, foreign_key: true
t.timestamps
end
end
end

View File

@@ -129,8 +129,10 @@
<div class="card-title row"> <div class="card-title row">
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
<p class="hidden customer-id"><%= @customer.customer_id %></p> <%if @customer %>
<p>Customer : <%= @customer.name %></p> <p class="hidden customer-id"><%= @customer.customer_id %></p>
<p>Customer : <%= @customer.name %></p>
<%end%>
</div> </div>
</div> </div>
@@ -292,7 +294,7 @@
<% end %> <% end %>
<!-- Cashier Buttons --> <!-- Cashier Buttons -->
<button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> <!-- <button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> -->
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@@ -189,7 +189,7 @@
<% if @sale_status != 'completed' %> <% if @sale_status != 'completed' %>
<button type="button" class="btn btn-primary btn-block" id='move'>MOVE</button> <button type="button" class="btn btn-primary btn-block" id='move'>MOVE</button>
<% end %> <% end %>
<button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> <!-- <button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> -->
</div> </div>
</div> </div>
<script> <script>

View File

@@ -129,8 +129,10 @@
</div> </div>
<div class="card-title row customer_detail hide"> <div class="card-title row customer_detail hide">
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
<%if @customer %>
<p class="hidden customer-id"><%= @customer.customer_id %></p> <p class="hidden customer-id"><%= @customer.customer_id %></p>
<p>Customer : <%= @customer.name %></p> <p>Customer : <%= @customer.name %></p>
<%end%>
</div> </div>
</div> </div>
@@ -250,7 +252,7 @@
<button type="button" id="discount" class="btn btn-primary btn-block">Discount</button> <button type="button" id="discount" class="btn btn-primary btn-block">Discount</button>
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button> --> <!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button> -->
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button> <button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
<button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> <!-- <button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> -->
</div> </div>
</div> </div>
<script> <script>