diff --git a/Gemfile.lock b/Gemfile.lock index 7281b442..93c2a58f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -109,6 +109,7 @@ GEM nokogiri (1.7.2) mini_portile2 (~> 2.1.0) pdf-core (0.7.0) + pg (0.20.0) prawn (2.2.2) pdf-core (~> 0.7.0) ttfunk (~> 1.5) @@ -244,6 +245,7 @@ DEPENDENCIES kaminari (~> 0.16.3) listen (~> 3.0.5) mysql2 (>= 0.3.18, < 0.5) + pg prawn prawn-table puma (~> 3.0) diff --git a/app/controllers/crm/home_controller.rb b/app/controllers/crm/home_controller.rb index f3e82e41..43cc322a 100644 --- a/app/controllers/crm/home_controller.rb +++ b/app/controllers/crm/home_controller.rb @@ -13,6 +13,7 @@ class Crm::HomeController < BaseCrmController def print_order @booking = Booking.find(params[:id]) + unique_code="CrmOrderPdf" print_settings = PrintSetting.find_by_unique_code(unique_code) diff --git a/app/views/crm/home/_booking.html.erb b/app/views/crm/home/_booking.html.erb index 18b0a83e..53bc6b82 100644 --- a/app/views/crm/home/_booking.html.erb +++ b/app/views/crm/home/_booking.html.erb @@ -42,14 +42,27 @@ $(function(){ $(".summary-items tbody tr").remove(); $("#cancel").removeAttr("disabled"); $("#assign").removeAttr("disabled"); - $("#crm_print").removeAttr("disabled"); - //$("#crm_print").val($(this).attr('data')); + + + $("#crm_print").removeAttr("disabled"); var url = $(this).attr('data-ref'); show_details(url); }); - + $('.crm_print').click(function() { + var id = $(this).val(); + alert(id) + $.ajax({ + type: "GET", + url: "crm/print/"+id, + data: {}, + dataType: "json", + success: function(data) { + + } + }); + }); $('.assign').click(function(e){ var booking_id = $(this).val() diff --git a/app/views/crm/home/index.html.erb b/app/views/crm/home/index.html.erb index 657f0e6f..86a8d946 100644 --- a/app/views/crm/home/index.html.erb +++ b/app/views/crm/home/index.html.erb @@ -105,24 +105,7 @@