41 lines
801 B
Ruby
41 lines
801 B
Ruby
class Crm::HomeController < BaseCrmController
|
|
def index
|
|
|
|
@booking = Booking.all
|
|
@customer = Customer.all
|
|
|
|
end
|
|
|
|
def show
|
|
end
|
|
|
|
#print for crm
|
|
def print_order
|
|
|
|
@booking = Booking.find(params[:id])
|
|
unique_code="CrmOrderPdf"
|
|
|
|
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
|
|
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
|
|
|
printer.print_crm_order(@booking,print_settings)
|
|
|
|
end
|
|
|
|
def update_sale_by_customer
|
|
|
|
sale = Sale.find(params[:sale_id])
|
|
status = sale.update_attributes(customer_id: params[:customer_id])
|
|
|
|
if status == true
|
|
render json: JSON.generate({:status => true})
|
|
else
|
|
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
|
|
|
end
|
|
end
|
|
|
|
end
|
|
|