update customre
This commit is contained in:
@@ -179,3 +179,9 @@ select.form-control {
|
||||
tr.discount-item-row:hover {
|
||||
background-color: #e3e3e3 !important;
|
||||
}
|
||||
|
||||
/* Jquery Confirm */
|
||||
|
||||
.jconfirm-box-container{
|
||||
margin-left:-40px !important
|
||||
}
|
||||
@@ -44,17 +44,22 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
id = params[:sale_id][0,3]
|
||||
if(id == "SAL")
|
||||
sale = Sale.find(params[:sale_id])
|
||||
status = sale.update_attributes(customer_id: params[:customer_id])
|
||||
else
|
||||
sale = Order.find(params[:sale_id])
|
||||
end
|
||||
@booking = BookingOrder.find_by_order_id(params[:sale_id])
|
||||
@orders = BookingOrder.where("booking_id = ? ", @booking.booking_id)
|
||||
|
||||
status = sale.update_attributes(customer_id: params[:customer_id])
|
||||
@orders.each do |bo|
|
||||
order = Order.find(bo.order_id)
|
||||
status = order.update_attributes(customer_id: params[:customer_id])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if status == true
|
||||
render json: JSON.generate({:status => true})
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class Customer < ApplicationRecord
|
||||
has_many :orders
|
||||
has_many :sales
|
||||
|
||||
validates_presence_of :name, :contact_no, :email,:company,:card_no
|
||||
validates_presence_of :name, :contact_no, :email,:card_no
|
||||
validates :contact_no, uniqueness: true
|
||||
validates :email, uniqueness: true
|
||||
validates :card_no, uniqueness: true
|
||||
|
||||
@@ -246,7 +246,7 @@
|
||||
|
||||
$('#update_customer').removeAttr('disabled').val('');
|
||||
$('#update_customer').attr('value', 'Update');
|
||||
$('#submit_customer').attr('disabled','disabled');
|
||||
// $('#submit_customer').attr('disabled','disabled');
|
||||
|
||||
$("#new_customer").attr('class', 'simple_form edit_customer');
|
||||
var id = "edit_customer_"+$('#customer_id').val();
|
||||
|
||||
@@ -298,7 +298,7 @@ $(document).ready(function(){
|
||||
// bind customer to order or sale
|
||||
$("#customer").on('click', function(){
|
||||
var sale = $('#sale_id').val();
|
||||
if (sale!="") {
|
||||
if (sale) {
|
||||
var sale_id = sale
|
||||
}else{
|
||||
var sale_id = $('#save_order_id').attr('data-order');
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
class CreateCustomers < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :customers, :id => false do |t|
|
||||
create_table :customers, :id => false do |t|
|
||||
t.string :customer_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync
|
||||
t.string :name, :null => false
|
||||
t.string :company
|
||||
t.string :contact_no, :unique => true
|
||||
t.string :email
|
||||
t.date :date_of_birth
|
||||
t.string :membership_id
|
||||
t.string :membership_type
|
||||
t.string :membership_authentication_code
|
||||
t.string :salution
|
||||
t.string :contact_no, :unique => true
|
||||
t.date :date_of_birth
|
||||
t.string :salutation
|
||||
t.string :gender
|
||||
t.string :nrc_no
|
||||
t.string :address
|
||||
t.string :card_no, :unique => true
|
||||
|
||||
t.timestamps
|
||||
t.string :membership_id
|
||||
t.string :membership_type
|
||||
t.string :membership_authentication_code
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -84,7 +84,7 @@ void_reason = Lookup.create([{lookup_type:'void_reason', name: 'Approve By Manag
|
||||
|
||||
#WALK CUSTOMER - Default CUSTOMER (take key 1)
|
||||
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000",card_no:"000"})
|
||||
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111",card_no:"000"})
|
||||
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111",card_no:"111"})
|
||||
|
||||
#Default ZOne
|
||||
# zone = Zone.create({id:1, name: "Normal Zone", is_active:true, created_by: "SYSTEM DEFAULT"})
|
||||
|
||||
Reference in New Issue
Block a user