Class: Crm::Customers::OnboardingController

Inherits:
CrmController
  • Object
show all
Defined in:
app/controllers/crm/customers/onboarding_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



11
12
13
14
15
# File 'app/controllers/crm/customers/onboarding_controller.rb', line 11

def edit
  authorize!(:manage, ExportedCatalogItemPacket)
  load_customer_record
  prepare_contact_points
end

#showObject



2
3
4
5
6
7
8
9
# File 'app/controllers/crm/customers/onboarding_controller.rb', line 2

def show
  authorize!(:manage, ExportedCatalogItemPacket)
  load_customer_record
  params[:q] ||= { inactive_eq: 0 }
  @q = @customer.exported_catalog_item_packets.ransack(params[:q])
  @q.sorts = 'updated_at DESC' if @q.sorts.blank?
  @pagy, @packets = pagy(@q.result, limit: params[:per])
end

#updateObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/crm/customers/onboarding_controller.rb', line 17

def update
  authorize!(:manage, ExportedCatalogItemPacket)
  load_customer_record
  if @customer_record.update(onboarding_params)
    redirect_to_return_path_or_default customer_onboarding_path(@customer)
  else
    render :edit, status: :unprocessable_entity
  end
end