Class: PresetJobsController
- Inherits:
-
PresetJobsControllerBase
- Object
- ActionController::Base
- ApplicationController
- PresetJobsControllerBase
- PresetJobsController
- Defined in:
- app/controllers/preset_jobs_controller.rb
Overview
== Schema Information
Table name: service_jobs
id :integer not null, primary key
measurecomp_job_number :string(255)
customer_id :integer
address_id :integer
cross_street1 :string(255)
cross_street2 :string(255)
cross_street1_direction :string(255)
cross_street2_direction :string(255)
home_phone_contact_point_id :integer
cell_phone_contact_point_id :integer
business_phone_contact_point_id :integer
estimated_size_sqft :float
job_date :datetime
measurecomp_order_number :string(255)
job_comments :string(255)
state :string(255)
creator_id :integer
updater_id :integer
created_at :datetime
updated_at :datetime
reference_number :string(255)
serial_number :string(255)
tstat_count :integer
type :string(255)
order_id :integer
email_contact_point_id :integer
delivery_id :integer
display_format_celsius :boolean default(FALSE), not null
early_start :boolean default(TRUE), not null
temperature_control_mode :string(255) default("F"), not null
temperature_comfort :integer default(82), not null
temperature_economy :integer default(68), not null
temperature_vacation :integer default(50), not null
monday_periods_hour :integer default(["6", "8", "17", "23"]), is an Array
monday_periods_minute :integer default(["0", "30", "0", "0"]), is an Array
is_specified :boolean default(FALSE), not null
line_item_id :integer
monday_periods :string(255) default([""6:00"", ""8:30"", ""17:00"", ""23:00""]), is an Array
tuesday_periods :string(255) default([""6:00"", ""8:30"", ""17:00"", ""23:00""]), is an Array
wednesday_periods :string(255) default([""6:00"", ""8:30"", ""17:00"", ""23:00""]), is an Array
thursday_periods :string(255) default([""6:00"", ""8:30"", ""17:00"", ""23:00""]), is an Array
friday_periods :string(255) default([""6:00"", ""8:30"", ""17:00"", ""23:00""]), is an Array
saturday_periods :string(255) default([""6:00"", "NULL", "NULL", ""23:00""]), is an Array
sunday_periods :string(255) default([""6:00"", "NULL", "NULL", ""23:00""]), is an Array
floor_temperature_max :integer default(82), not null
floor_temperature_min :integer default(41), not null
completed_on :date
contact_id :integer
Customer-portal Smart PreSet configuration jobs — the in-warehouse
thermostat programming workflow for PresetJob. See
PresetJobsControllerBase for the show/confirm/save actions shared with
the CRM-side installer flow.
Constant Summary
Constants included from Controllers::MasqueradeGuarded
Controllers::MasqueradeGuarded::DEFAULT_BLOCK_MESSAGE
Constants included from Controllers::AnalyticsEvents
Controllers::AnalyticsEvents::MAX_QUEUED_EVENTS, Controllers::AnalyticsEvents::SESSION_KEY
Constants included from Controllers::ErrorRendering
Controllers::ErrorRendering::NON_CONTENT_PATH_PREFIXES
Instance Method Summary collapse
-
#finish_confirm ⇒ void
Confirms the customer has reviewed the in-warehouse programming details, advancing the job's state.
-
#index ⇒ void
Lists the customer's preset jobs.
-
#redirect_to_show_if_confirmed ⇒ void
protected
Skips straight to the show page for jobs that are already confirmed/complete.
-
#set_report_errors_for ⇒ Object
protected
This controller instance set the model to use for detecting errors in the application_controller#write_flash_to_cookie method.
-
#set_variables ⇒ void
protected
Loads the customer and, if
params[:id]is present, the preset job (and its order), redirecting away if the job isn't found/authorized.
Methods inherited from PresetJobsControllerBase
#confirm, #edit, #extract_periods, #fetch_preset_job_options, #parse_time_string, #show, #update, #update_preset_job_options
Methods included from Controllers::MasqueradeGuarded
block_while_masquerading, #masquerade_blocks?
Methods inherited from ApplicationController
#account_impersonated?, #add_to_flash, #after_sign_in_path_for, #bypass_forgery_protection?, #chat_enabled?, #cloudflare_cleared?, #default_catalog, #default_url_options, #enable_turbo_frames, #find_publication, #fix_invalid_accept_header, #init_js_utils, #is_globals_call?, #layout_by_resource, #locale_store, #redirect_to, #require_employee_for_crm, #set_base_host, #set_real_ip, #should_render_layout?, #skip_layout_for_turbo_frame?, #stamp_impersonation_context, #tab_frame_breakout_request?, #warmlyyours_canada_ip?, #warmlyyours_ip?, #y
Methods included from Controllers::ReturnPathHandling
#check_for_return_path, #redirect_to_return_path_or_default
Methods included from Controllers::AnalyticsEvents
#consume_queued_analytics_events, #registration_lead_type, #track_event
Methods included from Controllers::DeviceDetection
Methods included from Controllers::SubdomainDetection
#is_crm_request?, #is_www_request?, #json_request?
Methods included from Controllers::TurboSafeRedirect
Methods included from Controllers::TrackingDetection
#bot_request?, #gdpr_country?, #gdpr_country_data, #prevent_bots, #set_tracking_cookie, #track_visitor?
Methods included from Controllers::AcceleratedFileSending
#send_file_accelerated, #send_upload_accelerated
Methods included from Controllers::ErrorRendering
#excp_string, #mail_to_for_error_reporting, #render_400, #render_404, #render_406, #render_410, #render_500, #render_invalid_authenticity_token, #render_ip_spoof_error, #render_unpermitted_parameters, #safe_referer_or_fallback
Methods included from Controllers::TurnstileVerification
#load_turnstile_script_tag, #turnstile_lazy_widget, #turnstile_script_tag, #turnstile_widget, #validate_turnstile!
Methods included from Controllers::CloudflareCaching
edge_cached, #edge_cached_action?, #reset_cloudflare_cache, #set_cloudflare_cache, #skip_edge_cache!, #skip_session
Methods included from Controllers::Webpackable
#preload_webpack_fonts, #webpack_css_include, #webpack_css_url, #webpack_js_include, #wpd_is_running?
Methods included from Controllers::Localizable
#cloudflare_country_locale, #determine_request_locale, #geocoder_locale, #guest_user_locale_check, #locale_optional_www_auth_path?, #param_locale, #set_locale, #set_request_locale, #skip_localization?, #warmlyyours_ip_locale
Methods included from Controllers::Authenticable
#access_denied, #authenticate_account, #authenticate_account!, #authenticate_account_from_login_token!, #check_is_a_manager, #check_is_a_sales_manager, #check_is_an_admin, #check_is_an_employee, #check_party, #clear_mismatched_guest_user, #create_guest_user, #credentials?, #current_or_guest_user, #current_or_guest_user_id_read_only, #current_user, #devise_mapping, #fully_logged_in?, #generate_bot_id, #guest_user, #identifiable?, #init_current_user, #initialize_guest, #load_context_user, #logging_in, #resource, #resource_name, #restrict_access_for_non_employees, #scrubbed_request_path, #user_object, #warn_on_session_guest_id_leak
Methods included from UrlsHelper
#catalog_breadcrumb_links, #catalog_link, #catalog_link_for_product_line, #catalog_link_for_sku, #cms_link, #delocalized_path, #path_to_sales_product_sku, #path_to_sales_product_sku_for_product_line, #path_to_sales_product_sku_for_product_line_slug, #product_line_from_catalog_link, #protocol_neutral_url, #sanitize_external_url, #valid_external_url?
Instance Method Details
#finish_confirm ⇒ void
This method returns an undefined value.
Confirms the customer has reviewed the in-warehouse programming
details, advancing the job's state.
81 82 83 84 85 86 87 88 89 90 |
# File 'app/controllers/preset_jobs_controller.rb', line 81 def finish_confirm if @preset_job.update(params[:preset_job]) @preset_job.programming_details_provided! flash[:info] = 'Smart PreSet In-Warehouse Programming Details Successfully Confirmed!' redirect_to my_account_order_path(@preset_job.order) else flash.now[:error] = "There was an issue confirming these details: #{@preset_job.errors.}." render :confirm, status: :unprocessable_content end end |
#index ⇒ void
This method returns an undefined value.
Lists the customer's preset jobs.
72 73 74 75 |
# File 'app/controllers/preset_jobs_controller.rb', line 72 def index @customer = @context_user.customer @pagy, @preset_jobs = pagy((@context_user || @party).preset_jobs) end |
#redirect_to_show_if_confirmed ⇒ void (protected)
This method returns an undefined value.
Skips straight to the show page for jobs that are already
confirmed/complete.
126 127 128 129 130 |
# File 'app/controllers/preset_jobs_controller.rb', line 126 def redirect_to_show_if_confirmed return unless @preset_job && (@preset_job.programming_details_provided? || @preset_job.complete?) redirect_to preset_job_path(@preset_job) end |
#set_report_errors_for ⇒ Object (protected)
This controller instance set the model to use for detecting errors in the application_controller#write_flash_to_cookie method.
95 96 97 98 |
# File 'app/controllers/preset_jobs_controller.rb', line 95 def set_report_errors_for @report_errors_for ||= [] @report_errors_for << @preset_job end |
#set_variables ⇒ void (protected)
This method returns an undefined value.
Loads the customer and, if params[:id] is present, the preset job
(and its order), redirecting away if the job isn't found/authorized.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'app/controllers/preset_jobs_controller.rb', line 104 def set_variables @customer = @context_user.customer return if params[:id].blank? @preset_job = begin @customer.preset_jobs.where(id: params[:id]).includes([:customer]).first rescue StandardError nil end if @preset_job.present? @order = @preset_job.order else flash[:error] = 'Smart PreSet Job not found or not authorized' redirect_back_or_to(my_account_url) nil end end |