Class: Employee
- Inherits:
-
Party
- Object
- ActiveRecord::Base
- ApplicationRecord
- Party
- Employee
- Includes:
- EmployeeDisplay, EmployeeManagement, EmployeePhonePresence, EmployeeSelectOptions, EmployeeTimeOffAccruals, EmployeeWatchList, EmployeeWorkStatus, Memery, Models::Lineage
- Defined in:
- app/models/employee.rb
Overview
Employee model — core HR entity (profile, time-off, scheduling, CRM).
== Schema Information
Table name: parties
Database name: primary
id :integer not null, primary key
activities_count :integer default(0)
affiliations :text default([]), is an Array
annual_revenue :integer
authorization_code_required :boolean
available_credit :decimal(14, 2) default(0.0)
banner :text
best_time_to_call :string(255)
bill_shipping_to_customer :boolean
calculate_profiling :boolean default(FALSE), not null
can_pay_by_cod_business_check :boolean
consent_preferences :jsonb
contact_roles :string(255) is an Array
creation_method :integer default("crm"), not null
credit_limit :decimal(8, 2) default(0.0)
credit_score :integer
credit_score_date :datetime
currency :string(255)
default_payment_method :string
do_not_auto_assign :boolean default(FALSE), not null
dob :date
early_payment_discount :integer
early_payment_timescale :integer
estimated_landed_cost_ptg :float
force_logout :boolean default(FALSE), not null
full_name :string(255)
full_name_tsv :tsvector
gclid :string
gender :string(1)
inactive :boolean default(FALSE), not null
job_title :string(255)
lead_time :integer
lead_time_override :integer
lead_verification_score :integer
lead_verified_at :datetime
merged_from_ids :integer is an Array
name1 :string(255)
name2 :string(255)
name3 :string(255)
number_of_employees :integer
number_of_offices :string
on_hold :boolean default(FALSE), not null
on_hold_reason :text
open_sales_activity :boolean default(FALSE), not null
ordering_instructions :text
preferred_language :string
preferred_shipping_method :string(255)
prefix :string(10)
profile_info :text
projects_per_year :string
purchase_order_required :boolean default(FALSE), not null
qc_orders :boolean default(TRUE), not null
rating :string(255)
report_grouping :string(255)
requires_rma_reference :boolean
sales_priority_index :integer default(0)
send_statement :boolean default(FALSE), not null
send_statement_reason :string(255)
shipment_instructions :text
source_info :text
spiff_enrolled :boolean
state :string(255)
state_code :string(255)
suffix :string(10)
terms :string(255)
timezone_name :string
type :string(255)
uploads_count :integer default(0)
uuid :uuid not null
verbal_po :boolean default(FALSE), not null
watch :integer
created_at :datetime
updated_at :datetime
active_spiff_enrollment_id :integer
billing_address_id :integer
bot_id :string
business_unit_id :integer
buying_group_id :integer
catalog_id :integer
company_id :integer
creator_id :integer
customer_id :integer
gl_offset_account_id :integer
ledger_detail_project_id :integer
legacy_tier2_program_pricing_id :integer
local_sales_rep_id :integer
mailing_address_id :integer
original_source_id :integer
parent_id :integer
paypal_vault_customer_id :string
paypal_vault_token_id :string
primary_sales_rep_id :integer
profile_id :integer
profile_image_id :integer
secondary_sales_rep_id :integer
service_rep_id :integer
shipping_address_id :integer
source_id :integer
spiff_address_id :integer
spiff_payable_id :integer
stripe_customer_id :string
tier2_program_pricing_id :integer
updater_id :integer
visit_id :bigint
Indexes
idx_parties_full_name_trg (full_name) USING gin
idx_party_main_address (COALESCE(shipping_address_id, billing_address_id, mailing_address_id))
idx_state_type (state,type)
idx_type_billing_address_id (type,billing_address_id)
idx_type_creation_method_state (type,creation_method,state)
idx_type_customer_id (type,customer_id)
idx_type_id_credit_limit (type,id,credit_limit)
idx_type_inactive (type,inactive)
idx_type_primary_sales_rep_id_watch (type,primary_sales_rep_id,watch)
index_parties_on_affiliations (affiliations) USING gin
index_parties_on_billing_address_id (billing_address_id)
index_parties_on_bot_id (bot_id) WHERE (bot_id IS NOT NULL)
index_parties_on_catalog_id (catalog_id)
index_parties_on_company_id (company_id)
index_parties_on_full_name_tsv (full_name_tsv) USING gin
index_parties_on_gclid (gclid) WHERE (gclid IS NOT NULL)
index_parties_on_local_sales_rep_id (local_sales_rep_id)
index_parties_on_mailing_address_id (mailing_address_id)
index_parties_on_merged_from_ids (merged_from_ids) USING gin
index_parties_on_open_sales_activity (open_sales_activity)
index_parties_on_parent_id (parent_id)
index_parties_on_primary_sales_rep_id (primary_sales_rep_id)
index_parties_on_profile_image_id (profile_image_id) USING hash
index_parties_on_report_grouping (report_grouping)
index_parties_on_secondary_sales_rep_id (secondary_sales_rep_id)
index_parties_on_service_rep_id (service_rep_id)
index_parties_on_source_id (source_id)
index_parties_on_tier2_program_pricing_id (tier2_program_pricing_id)
index_parties_on_uuid (uuid) UNIQUE
index_parties_on_visit_id (visit_id) WHERE (visit_id IS NOT NULL) USING hash
index_parties_on_watch (watch)
parties_buying_group_id_idx (buying_group_id)
parties_customer_id_index (customer_id)
parties_profile_id_idx (profile_id)
parties_shipping_address_id_idx (shipping_address_id)
parties_spiff_address_id_idx (spiff_address_id)
parties_spiff_payable_id_idx (spiff_payable_id)
Foreign Keys
fk_rails_... (profile_image_id => digital_assets.id) ON DELETE => nullify
fk_rails_... (source_id => sources.id)
fk_rails_... (visit_id => visits.id) ON DELETE => nullify
parties_billing_address_id_fk (billing_address_id => addresses.id) ON DELETE => nullify
parties_buying_group_id_fk (buying_group_id => buying_groups.id)
parties_catalog_id_fk (catalog_id => catalogs.id)
parties_company_id_fk (company_id => companies.id)
parties_customer_id_fk (customer_id => parties.id) ON DELETE => cascade
parties_mailing_address_id_fk (mailing_address_id => addresses.id) ON DELETE => nullify
parties_parent_id_fk (parent_id => parties.id) ON DELETE => nullify
parties_primary_sales_rep_id_fk (primary_sales_rep_id => parties.id) ON DELETE => nullify
parties_profile_id_fk (profile_id => profiles.id)
parties_secondary_sales_rep_id_fk (secondary_sales_rep_id => parties.id) ON DELETE => nullify
parties_shipping_address_id_fk (shipping_address_id => addresses.id) ON DELETE => nullify
parties_source_id_fk (source_id => sources.id)
parties_spiff_address_id_fk (spiff_address_id => addresses.id) ON DELETE => nullify
parties_spiff_payable_id_fk (spiff_payable_id => parties.id) ON DELETE => nullify
parties_tier2_program_pricing_id_fk (tier2_program_pricing_id => coupons.id)
Defined Under Namespace
Classes: BirthdayMessage, WorkAnniversaryMessage
Constant Summary collapse
- SCOTT =
82- SALES_REP_ASSIGNMENT_WEIGHTS =
[0, 1, 2, 3].freeze
- FULL_DAY_IN_SECONDS =
25_200
Constants inherited from Party
Constants included from Models::Auditable
Models::Auditable::ALWAYS_IGNORED
Instance Attribute Summary collapse
- #full_name ⇒ Object readonly
Attributes inherited from Party
Belongs to collapse
- #billing_address ⇒ Address
- #mailing_address ⇒ Address
- #manager ⇒ Employee
- #shipping_address ⇒ Address
Methods inherited from Party
#catalog, #company, #customer, #gl_offset_account, #profile_image, #visit
Methods included from Models::Auditable
Has one collapse
- #employee_account ⇒ Account
- #employee_phone_status ⇒ EmployeePhoneStatus
- #employee_record ⇒ EmployeeRecord
- #scheduler_profile ⇒ SchedulerProfile
Methods inherited from Party
Has many collapse
- #activities ⇒ ActiveRecord::Relation<Activity>
- #authored_posts ⇒ ActiveRecord::Relation<Post>
- #course_enrollments ⇒ ActiveRecord::Relation<CourseEnrollment>
- #created_rmas ⇒ ActiveRecord::Relation<Rma>
- #customer_drop_events ⇒ ActiveRecord::Relation<CustomerDropEvent>
- #email_templates ⇒ ActiveRecord::Relation<EmailTemplate>
- #employee_events ⇒ ActiveRecord::Relation<EmployeeEvent>
- #employee_events_email_settings ⇒ ActiveRecord::Relation<EmployeeEventsEmailSetting>
- #employee_goals ⇒ ActiveRecord::Relation<EmployeeGoal>
- #employee_reviews ⇒ ActiveRecord::Relation<EmployeeReview>
- #employee_survey_enrollments ⇒ ActiveRecord::Relation<EmployeeSurveyEnrollment>
- #employee_time_offs ⇒ ActiveRecord::Relation<EmployeeTimeOff>
- #employee_topics ⇒ ActiveRecord::Relation<EmployeeTopic>
- #employee_work_schedules ⇒ ActiveRecord::Relation<EmployeeWorkSchedule>
- #it_assets ⇒ ActiveRecord::Relation<ItAsset>
- #managed_employees ⇒ ActiveRecord::Relation<Employee>
- #praises ⇒ ActiveRecord::Relation<Praise>
- #roles ⇒ ActiveRecord::Relation<Role>
- #sales_goals ⇒ ActiveRecord::Relation<SalesGoal>
- #scheduler_booking_pages ⇒ ActiveRecord::Relation<SchedulerBookingPage>
- #scheduler_bookings ⇒ ActiveRecord::Relation<SchedulerBooking>
- #scheduler_hosts ⇒ ActiveRecord::Relation<SchedulerHost>
- #searches ⇒ ActiveRecord::Relation<Search>
- #showcases ⇒ ActiveRecord::Relation<Showcase>
- #survey_enrollments ⇒ ActiveRecord::Relation<SurveyEnrollment>
- #technical_support_invoices ⇒ ActiveRecord::Relation<Invoice>
- #time_off_balances ⇒ ActiveRecord::Relation<TimeOffBalance>
- #time_off_policies ⇒ ActiveRecord::Relation<TimeOffPolicy>
- #time_off_policy_assignments ⇒ ActiveRecord::Relation<TimeOffPolicyAssignment>
- #time_off_requests ⇒ ActiveRecord::Relation<TimeOffRequest>
- #trainer_contact_training_topics ⇒ ActiveRecord::Relation<ContactTrainingTopic>
- #trainer_employee_topics ⇒ ActiveRecord::Relation<EmployeeTopic>
- #work_schedules ⇒ ActiveRecord::Relation<WorkSchedule>
Methods inherited from Party
#accounts, #addresses, #agreement_participants, #agreements, #assistant_conversations, #billing_credit_memos, #consignment_stores, #contact_points, #contacts, #credit_memos, #destination_call_logs, #destination_call_records, #inbound_communications, #notifications, #opportunity_participants, #origin_call_logs, #origin_call_records, #outbound_communications, #outgoing_payments, #party_topics, #purchase_orders, #queue_call_logs, #receipts, #recipient_sms_messages, #room_plans, #sender_sms_messages, #support_case_participants, #support_cases, #uploads, #visit_events, #visits, #voucher_items, #vouchers
Delegated Instance Attributes collapse
-
#calendly_link ⇒ Object
Alias for Employee_record#calendly_link.
-
#certifications ⇒ Object
Alias for Employee_record#certifications.
-
#effective_scheduler_link ⇒ Object
Alias for Employee_record#effective_scheduler_link.
-
#has_role? ⇒ Object
Alias for Account#has_role?.
-
#heatwave_preferences ⇒ Object
Alias for Employee_record#heatwave_preferences.
-
#hide_signature_call_text_me_directly ⇒ Object
Alias for Employee_record#hide_signature_call_text_me_directly.
-
#interesting_fact ⇒ Object
Alias for Employee_record#interesting_fact.
-
#is_admin? ⇒ Object
Alias for Account#is_admin?.
-
#is_document_maintainer? ⇒ Object
Alias for Account#is_document_maintainer?.
-
#is_local_sales_rep? ⇒ Object
Alias for Account#is_local_sales_rep?.
-
#is_manager? ⇒ Object
Alias for Account#is_manager?.
-
#is_marketing_manager? ⇒ Object
Alias for Account#is_marketing_manager?.
-
#is_sales_manager? ⇒ Object
Alias for Account#is_sales_manager?.
-
#job_description ⇒ Object
Alias for Employee_record#job_description.
-
#job_title ⇒ Object
Alias for Employee_record#job_title.
-
#monitor_group_sms_numbers ⇒ Object
Alias for Employee_record#monitor_group_sms_numbers.
-
#monitor_unlinked_extensions ⇒ Object
Alias for Employee_record#monitor_unlinked_extensions.
-
#print_node_computer_id ⇒ Object
Alias for Employee_record#print_node_computer_id.
-
#scheduler_link_type ⇒ Object
Alias for Employee_record#scheduler_link_type.
-
#selected_menu_options ⇒ Object
Alias for Employee_record#selected_menu_options.
-
#show_calendly_link ⇒ Object
Alias for Employee_record#show_calendly_link.
-
#show_signature_photo ⇒ Object
Alias for Employee_record#show_signature_photo.
-
#signature_picture_small ⇒ Object
Alias for Employee_record#signature_picture_small.
Methods inherited from Party
#can?, #cannot?, #is_sales_rep?, #locale, #main_address
Class Method Summary collapse
-
.active_employees ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are active employees.
-
.blog_employees ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are blog employees.
-
.by_direct_role ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are by direct role.
-
.by_direct_role_id ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are by direct role id.
-
.by_role ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are by role.
-
.by_role_id ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are by role id.
-
.engineers ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are engineers.
-
.from_cad ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are from cad.
-
.from_ind ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are from ind.
-
.from_ndl ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are from ndl.
-
.from_usa ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are from usa.
-
.in_sales_rep_assignment_queue ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are in sales rep assignment queue.
-
.inactive_employees ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are inactive employees.
-
.local_sales_reps ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are local sales reps.
-
.phone_enabled ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are phone enabled.
-
.primary_sales_reps ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are primary sales reps.
- .ransackable_scopes(_auth_object = nil) ⇒ Object
-
.sales_reps ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are sales reps.
-
.secondary_sales_reps ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are secondary sales reps.
-
.sorted ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are sorted.
-
.technical_support_reps ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are technical support reps.
-
.with_associations ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are with associations.
-
.with_open_activities ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are with open activities.
-
.with_strengh_in_top_five ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are with strengh in top five.
Methods included from EmployeeDisplay
#assigned_or_requested_employee_topics, #check_online, #check_pto, #company_phone, #country, #days_until_birthday, #default_printer_profile, #direct_phone, #employee_work_schedule, #locale, #name_and_email, #name_and_extension, #name_and_fax, #name_and_phone, #name_with_paired, #online?, #open_employee_goals, #open_employee_reviews, #reference_number, #sales_rep?, #short_name, #signature, #sms_enabled?, #sms_enabled_numbers, #start_year_at_warmlyyours, #state_code, #store, #tech_rep?, #time_off?, #time_off_budget, #to_liquid, #unescheduled_on_day?, #versions_for_audit_trail, #work_schedule?, #work_timezone, #years_at_warmlyyours
Methods included from EmployeeManagement
#current_review, #drop_customer_event, #manages, #manages?, #manages_and_self, #manages_ids, #role_cleanup, #schema_dot_org_structure, #to_json_ld
Methods included from EmployeeWatchList
#effective_watch_list_ids, #monitor_group_sms_numbers=, #monitor_unlinked_extensions=, #selected_watch_list_employee_ids, #selected_watch_list_employee_ids=, #selected_watch_list_role_ids, #selected_watch_list_role_ids=, #selected_watch_list_roles_employees, #watch_list
Methods included from EmployeePhonePresence
#auto_away_after, #pbx_did, #pbx_did_contact_point, #pbx_extension, #presence, #presence_timestamp, #set_presence, #sub_presence, #working_from_home?, #working_from_home_number
Methods included from EmployeeSelectOptions
#manager_select_options, #manages_and_self_select_options
Methods included from EmployeeWorkStatus
#active_work_schedule, #capacity_ratio, #current_company_holidays_array, #day_employee_events, #day_status_employee_event, #day_status_holiday_check, #day_status_work_schedule, #employee_events_loaded, #next_business_day, #next_business_day_closing_time, #next_working_day, #preload_time_off_events, #preload_working_hours, #work_status_on_day, #working_hours_on_date, #working_on_day?
Methods included from EmployeeActivityCapacity
#activity_load_on_day, #can_take_activities_on_day?, #maximum_activities_per_day, #maximum_priority_tier_activities_per_day, #maximum_standard_tier_activities_per_day, #priority_tier_activities_ratio
Methods included from EmployeeTimeOffAccruals
#current_time_off_policy_for, #process_accruals, #process_work_schedule_transitions
Methods included from EmployeeTimeOffRollover
#process_policy_transitions, #process_rollover_and_expiry
Methods included from EmployeeTimeOffDeductions
Methods included from Models::Lineage
#ancestors, #ancestors_ids, #children_and_roots, #descendants, #descendants_ids, #ensure_non_recursive_lineage, #family_members, #generate_full_name, #generate_full_name_array, #lineage, #lineage_array, #lineage_simple, #root, #root_id, #self_ancestors_and_descendants, #self_ancestors_and_descendants_ids, #self_and_ancestors, #self_and_ancestors_ids, #self_and_children, #self_and_descendants, #self_and_descendants_ids, #self_and_siblings, #self_and_siblings_ids, #siblings, #siblings_ids
Methods inherited from Party
#digital_assets, #linked_activities, #product_lines, #set_full_name, #set_state_code, #set_timezone
Methods included from CrmLinkable
#crm_link, #crm_link_with_host
Methods included from PartyAccount
#ability, #build_account, #create_account, #online_account_invite, #refuse_silent_account_replacement!, search_for_authenticable_linked_party_by_email
Methods included from PartyCart
#all_uploads, #assign_chained_activities?, #cart, #cart=, #cart?, #cart_id, #cart_info, #create_activity, #create_quote_builder_project, #load_cart, #store_original_source
Methods included from PartyIdentity
#active?, #admin?, #aka, #aka=, #all_activities, #blog_admin?, #broadcast_product_interest_changed, #can_be_certified?, #can_list_all_contact_resources?, #clear_individual_names, #clear_names, #contact?, #customer?, #determine_company_id, #direct_commercial?, #direct_pro?, #employee?, #first_name, #first_name=, #guest_individual_name?, #guest_name?, #homeowner?, #id_and_name, #last_name, #last_name=, #manager?, #middle_name, #middle_name=, #name, #name=, #organization?, #person?, #primary_party, #public_facing_full_name, #public_facing_full_name=, #show_name_four, #to_s, #update_product_interests
Methods included from PartyAddresses
#addresses_options_for_select, #can_change_country?, #catalog_country, #catalog_country_iso, #catalog_country_iso3, #city, #country, #country_iso, #country_iso3, #first_address, #flag, #location_name, #most_recent_visit, #new_address, #store, #street1, #street2, #street3, #timezone, #unique_addresses, #visit_data, #visit_location, #zip
Methods included from PartyContactInfo
#all_support_cases, #call_records?, #cell_phone, #cell_phone=, #cell_phone_formatted, #contact_point_options_for_select, #contactable?, #email, #email=, #email_options_for_select, #email_with_name, #emails, #fax, #fax=, #fax_formatted, #fax_options_for_select, #first_callable_contact_point, #first_contact_point_by_category, #phone, #phone=, #phone_formatted, #phone_options_for_select, #set_email_from_account, #set_primary_contact_point, #sms_enabled_numbers, #sms_messages, #tracking_email_address, #tracking_email_prefix, #website, #website=, #website_options_for_select
Methods included from PartySearch
active, address_search, customer_or_contact, email_search, inactive, lookup, phone_search, searchable, with_main_address
Methods included from Models::Notable
Methods included from Models::Auditable
#all_skipped_columns, #audit_reference_data, #should_not_save_version, #stamp_record
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Instance Attribute Details
#full_name ⇒ Object (readonly)
297 |
# File 'app/models/employee.rb', line 297 validates :full_name, presence: { message: 'must be specified for this employee.' } |
Class Method Details
.active_employees ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are active employees. Active Record Scope
250 |
# File 'app/models/employee.rb', line 250 scope :active_employees, -> { where(inactive: false).where(Party[:full_name].not_eq('www.warmlyyours.com')) } |
.blog_employees ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are blog employees. Active Record Scope
249 |
# File 'app/models/employee.rb', line 249 scope :blog_employees, -> { where(Party[:full_name].not_eq('www.warmlyyours.com')) } |
.by_direct_role ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are by direct role. Active Record Scope
246 |
# File 'app/models/employee.rb', line 246 scope :by_direct_role, ->(role_name) { joins(account: :roles).where(roles: { name: role_name }) } |
.by_direct_role_id ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are by direct role id. Active Record Scope
247 |
# File 'app/models/employee.rb', line 247 scope :by_direct_role_id, ->(role_id) { joins(account: :roles).where('roles.id': role_id) } |
.by_role ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are by role. Active Record Scope
238 |
# File 'app/models/employee.rb', line 238 scope :by_role, ->(role_names) { by_role_id(Role.where(name: role_names).pluck(:id)) } |
.by_role_id ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are by role id. Active Record Scope
239 240 241 242 243 244 245 |
# File 'app/models/employee.rb', line 239 scope :by_role_id, lambda { |role_ids| if role_ids.present? where('exists(select 1 from accounts_roles ar inner join accounts a on a.id = ar.account_id where a.party_id = parties.id and ar.role_id in (?))', Role.self_and_ancestors_ids(role_ids)) else none end } |
.engineers ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are engineers. Active Record Scope
260 |
# File 'app/models/employee.rb', line 260 scope :engineers, -> { by_role('engineering_rep') } |
.from_cad ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are from cad. Active Record Scope
275 |
# File 'app/models/employee.rb', line 275 scope :from_cad, -> { where(company_id: 2) } |
.from_ind ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are from ind. Active Record Scope
276 |
# File 'app/models/employee.rb', line 276 scope :from_ind, -> { where(company_id: 3) } |
.from_ndl ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are from ndl. Active Record Scope
277 |
# File 'app/models/employee.rb', line 277 scope :from_ndl, -> { where(company_id: 4) } |
.from_usa ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are from usa. Active Record Scope
274 |
# File 'app/models/employee.rb', line 274 scope :from_usa, -> { where(company_id: 1) } |
.in_sales_rep_assignment_queue ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are in sales rep assignment queue. Active Record Scope
252 253 254 |
# File 'app/models/employee.rb', line 252 scope :in_sales_rep_assignment_queue, lambda { |store_country, type_sym| active_employees.where("parties.sales_rep_assignment_weight_#{store_country.downcase}_#{type_sym} in (1,2,3)") } |
.inactive_employees ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are inactive employees. Active Record Scope
251 |
# File 'app/models/employee.rb', line 251 scope :inactive_employees, -> { where(inactive: true) } |
.local_sales_reps ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are local sales reps. Active Record Scope
263 |
# File 'app/models/employee.rb', line 263 scope :local_sales_reps, -> { joins(:employee_record).where(employee_records: { local_sales_rep: true }) } |
.phone_enabled ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are phone enabled. Active Record Scope
265 |
# File 'app/models/employee.rb', line 265 scope :phone_enabled, -> { joins(:employee_phone_status) } |
.primary_sales_reps ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are primary sales reps. Active Record Scope
261 |
# File 'app/models/employee.rb', line 261 scope :primary_sales_reps, -> { joins(:employee_record).where(employee_records: { primary_sales_rep: true }) } |
.ransackable_scopes(_auth_object = nil) ⇒ Object
304 305 306 |
# File 'app/models/employee.rb', line 304 def self.ransackable_scopes(_auth_object = nil) [:with_strengh_in_top_five] end |
.sales_reps ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are sales reps. Active Record Scope
259 |
# File 'app/models/employee.rb', line 259 scope :sales_reps, -> { joins(:employee_record).where('true IN (primary_sales_rep,secondary_sales_rep,local_sales_rep)') } |
.secondary_sales_reps ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are secondary sales reps. Active Record Scope
262 |
# File 'app/models/employee.rb', line 262 scope :secondary_sales_reps, -> { joins(:employee_record).where(employee_records: { secondary_sales_rep: true }) } |
.sorted ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are sorted. Active Record Scope
248 |
# File 'app/models/employee.rb', line 248 scope :sorted, -> { order(:full_name) } |
.technical_support_reps ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are technical support reps. Active Record Scope
264 |
# File 'app/models/employee.rb', line 264 scope :technical_support_reps, -> { by_direct_role(%w[technical_support_rep technical_support_manager]) } |
.with_associations ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are with associations. Active Record Scope
255 |
# File 'app/models/employee.rb', line 255 scope :with_associations, -> { includes({ account: :roles }, :contact_points, employee_record: :strength_themes) } |
.with_open_activities ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are with open activities. Active Record Scope
256 257 258 |
# File 'app/models/employee.rb', line 256 scope :with_open_activities, lambda { where('exists(select 1 from activities a where a.assigned_resource_id = parties.id and a.activity_type_id IS NOT NULL and a.activity_result_type_id IS NULL)') } |
.with_strengh_in_top_five ⇒ ActiveRecord::Relation<Employee>
A relation of Employees that are with strengh in top five. Active Record Scope
266 267 268 269 270 271 272 273 |
# File 'app/models/employee.rb', line 266 scope :with_strengh_in_top_five, lambda { |*clifton_strength_ids| ids = clifton_strength_ids.filter_map(&:presence).uniq where( 'exists(select 1 from strength_themes st inner join employee_records er on er.id = st.employee_record_id ' \ 'inner join parties p on p.id = er.party_id where p.id = parties.id and st.priority <= 5 and st.clifton_strength_id IN (?))', ids ) } |
Instance Method Details
#activities ⇒ ActiveRecord::Relation<Activity>
202 |
# File 'app/models/employee.rb', line 202 has_many :activities, foreign_key: 'assigned_resource_id', dependent: :nullify, inverse_of: :assigned_resource |
#authored_posts ⇒ ActiveRecord::Relation<Post>
227 |
# File 'app/models/employee.rb', line 227 has_many :authored_posts, class_name: 'Post', foreign_key: :user_id, inverse_of: :user, dependent: :nullify |
#billing_address ⇒ Address
193 |
# File 'app/models/employee.rb', line 193 belongs_to :billing_address, class_name: 'Address', optional: true |
#calendly_link ⇒ Object
Alias for Employee_record#calendly_link
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#certifications ⇒ Object
Alias for Employee_record#certifications
232 |
# File 'app/models/employee.rb', line 232 has_many :certifications, foreign_key: 'party_id', dependent: :destroy, inverse_of: :party |
#course_enrollments ⇒ ActiveRecord::Relation<CourseEnrollment>
231 |
# File 'app/models/employee.rb', line 231 has_many :course_enrollments, foreign_key: 'party_id', dependent: :destroy, inverse_of: :party |
#created_rmas ⇒ ActiveRecord::Relation<Rma>
228 |
# File 'app/models/employee.rb', line 228 has_many :created_rmas, class_name: 'Rma', foreign_key: :creator_id, dependent: :nullify, inverse_of: :creator |
#customer_drop_events ⇒ ActiveRecord::Relation<CustomerDropEvent>
213 |
# File 'app/models/employee.rb', line 213 has_many :customer_drop_events, dependent: :destroy, foreign_key: 'sales_rep_id', inverse_of: :employee |
#effective_scheduler_link ⇒ Object
Alias for Employee_record#effective_scheduler_link
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#email_templates ⇒ ActiveRecord::Relation<EmailTemplate>
217 |
# File 'app/models/employee.rb', line 217 has_many :email_templates, as: :resource, dependent: :destroy, inverse_of: :employee |
#employee_account ⇒ Account
197 |
# File 'app/models/employee.rb', line 197 has_one :employee_account, class_name: 'Account', foreign_key: 'party_id', dependent: :destroy, inverse_of: :employee |
#employee_events ⇒ ActiveRecord::Relation<EmployeeEvent>
203 |
# File 'app/models/employee.rb', line 203 has_many :employee_events, dependent: :destroy, inverse_of: :employee |
#employee_events_email_settings ⇒ ActiveRecord::Relation<EmployeeEventsEmailSetting>
219 |
# File 'app/models/employee.rb', line 219 has_many :employee_events_email_settings, inverse_of: :employee, dependent: :destroy |
#employee_goals ⇒ ActiveRecord::Relation<EmployeeGoal>
224 |
# File 'app/models/employee.rb', line 224 has_many :employee_goals, through: :employee_reviews |
#employee_phone_status ⇒ EmployeePhoneStatus
199 |
# File 'app/models/employee.rb', line 199 has_one :employee_phone_status, dependent: :destroy, inverse_of: :employee |
#employee_record ⇒ EmployeeRecord
Validations:
198 |
# File 'app/models/employee.rb', line 198 has_one :employee_record, foreign_key: :party_id, dependent: :destroy, inverse_of: :party |
#employee_reviews ⇒ ActiveRecord::Relation<EmployeeReview>
223 |
# File 'app/models/employee.rb', line 223 has_many :employee_reviews, through: :employee_record |
#employee_survey_enrollments ⇒ ActiveRecord::Relation<EmployeeSurveyEnrollment>
229 |
# File 'app/models/employee.rb', line 229 has_many :employee_survey_enrollments, dependent: :destroy, inverse_of: :employee |
#employee_time_offs ⇒ ActiveRecord::Relation<EmployeeTimeOff>
221 |
# File 'app/models/employee.rb', line 221 has_many :employee_time_offs, inverse_of: :employee, dependent: :destroy |
#employee_topics ⇒ ActiveRecord::Relation<EmployeeTopic>
200 |
# File 'app/models/employee.rb', line 200 has_many :employee_topics, foreign_key: :party_id, dependent: :destroy, inverse_of: :employee |
#employee_work_schedules ⇒ ActiveRecord::Relation<EmployeeWorkSchedule>
220 |
# File 'app/models/employee.rb', line 220 has_many :employee_work_schedules, inverse_of: :employee, dependent: :destroy |
#has_role? ⇒ Object
Alias for Account#has_role?
279 280 281 |
# File 'app/models/employee.rb', line 279 delegate :has_role?, :is_admin?, :is_manager?, :is_sales_manager?, :is_local_sales_rep?, :is_marketing_manager?, :is_document_maintainer?, to: :account |
#heatwave_preferences ⇒ Object
Alias for Employee_record#heatwave_preferences
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#hide_signature_call_text_me_directly ⇒ Object
Alias for Employee_record#hide_signature_call_text_me_directly
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#interesting_fact ⇒ Object
Alias for Employee_record#interesting_fact
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#is_admin? ⇒ Object
Alias for Account#is_admin?
279 280 281 |
# File 'app/models/employee.rb', line 279 delegate :has_role?, :is_admin?, :is_manager?, :is_sales_manager?, :is_local_sales_rep?, :is_marketing_manager?, :is_document_maintainer?, to: :account |
#is_document_maintainer? ⇒ Object
Alias for Account#is_document_maintainer?
279 280 281 |
# File 'app/models/employee.rb', line 279 delegate :has_role?, :is_admin?, :is_manager?, :is_sales_manager?, :is_local_sales_rep?, :is_marketing_manager?, :is_document_maintainer?, to: :account |
#is_local_sales_rep? ⇒ Object
Alias for Account#is_local_sales_rep?
279 280 281 |
# File 'app/models/employee.rb', line 279 delegate :has_role?, :is_admin?, :is_manager?, :is_sales_manager?, :is_local_sales_rep?, :is_marketing_manager?, :is_document_maintainer?, to: :account |
#is_manager? ⇒ Object
Alias for Account#is_manager?
279 280 281 |
# File 'app/models/employee.rb', line 279 delegate :has_role?, :is_admin?, :is_manager?, :is_sales_manager?, :is_local_sales_rep?, :is_marketing_manager?, :is_document_maintainer?, to: :account |
#is_marketing_manager? ⇒ Object
Alias for Account#is_marketing_manager?
279 280 281 |
# File 'app/models/employee.rb', line 279 delegate :has_role?, :is_admin?, :is_manager?, :is_sales_manager?, :is_local_sales_rep?, :is_marketing_manager?, :is_document_maintainer?, to: :account |
#is_sales_manager? ⇒ Object
Alias for Account#is_sales_manager?
279 280 281 |
# File 'app/models/employee.rb', line 279 delegate :has_role?, :is_admin?, :is_manager?, :is_sales_manager?, :is_local_sales_rep?, :is_marketing_manager?, :is_document_maintainer?, to: :account |
#it_assets ⇒ ActiveRecord::Relation<ItAsset>
218 |
# File 'app/models/employee.rb', line 218 has_many :it_assets, dependent: :destroy, inverse_of: :employee |
#job_description ⇒ Object
Alias for Employee_record#job_description
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#job_title ⇒ Object
Alias for Employee_record#job_title
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#mailing_address ⇒ Address
194 |
# File 'app/models/employee.rb', line 194 belongs_to :mailing_address, class_name: 'Address', optional: true |
#managed_employees ⇒ ActiveRecord::Relation<Employee>
201 |
# File 'app/models/employee.rb', line 201 has_many :managed_employees, class_name: 'Employee', foreign_key: 'parent_id', dependent: :nullify, inverse_of: :manager |
#manager ⇒ Employee
192 |
# File 'app/models/employee.rb', line 192 belongs_to :manager, class_name: 'Employee', foreign_key: 'parent_id', optional: true, inverse_of: :managed_employees |
#monitor_group_sms_numbers ⇒ Object
Alias for Employee_record#monitor_group_sms_numbers
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#monitor_unlinked_extensions ⇒ Object
Alias for Employee_record#monitor_unlinked_extensions
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#praises ⇒ ActiveRecord::Relation<Praise>
222 |
# File 'app/models/employee.rb', line 222 has_many :praises, through: :employee_record |
#print_node_computer_id ⇒ Object
Alias for Employee_record#print_node_computer_id
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#roles ⇒ ActiveRecord::Relation<Role>
216 |
# File 'app/models/employee.rb', line 216 has_many :roles, through: :account |
#sales_goals ⇒ ActiveRecord::Relation<SalesGoal>
214 |
# File 'app/models/employee.rb', line 214 has_many :sales_goals, dependent: :destroy, inverse_of: :employee |
#scheduler_booking_pages ⇒ ActiveRecord::Relation<SchedulerBookingPage>
235 |
# File 'app/models/employee.rb', line 235 has_many :scheduler_booking_pages, through: :scheduler_hosts |
#scheduler_bookings ⇒ ActiveRecord::Relation<SchedulerBooking>
236 |
# File 'app/models/employee.rb', line 236 has_many :scheduler_bookings, dependent: :destroy |
#scheduler_hosts ⇒ ActiveRecord::Relation<SchedulerHost>
234 |
# File 'app/models/employee.rb', line 234 has_many :scheduler_hosts, dependent: :destroy |
#scheduler_link_type ⇒ Object
Alias for Employee_record#scheduler_link_type
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#scheduler_profile ⇒ SchedulerProfile
206 |
# File 'app/models/employee.rb', line 206 has_one :scheduler_profile, dependent: :destroy |
#searches ⇒ ActiveRecord::Relation<Search>
215 |
# File 'app/models/employee.rb', line 215 has_many :searches, dependent: :destroy, inverse_of: :employee |
#selected_menu_options ⇒ Object
Alias for Employee_record#selected_menu_options
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#shipping_address ⇒ Address
195 |
# File 'app/models/employee.rb', line 195 belongs_to :shipping_address, class_name: 'Address', optional: true |
#show_calendly_link ⇒ Object
Alias for Employee_record#show_calendly_link
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#show_signature_photo ⇒ Object
Alias for Employee_record#show_signature_photo
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#showcases ⇒ ActiveRecord::Relation<Showcase>
204 |
# File 'app/models/employee.rb', line 204 has_many :showcases, dependent: :nullify, inverse_of: :employee |
#signature_picture_small ⇒ Object
Alias for Employee_record#signature_picture_small
282 283 284 285 286 287 |
# File 'app/models/employee.rb', line 282 delegate :heatwave_preferences, :job_title, :job_description, :interesting_fact, :certifications, :signature_picture_small, :print_node_computer_id, :selected_menu_options, :hide_signature_call_text_me_directly, :show_calendly_link, :calendly_link, :show_signature_photo, :monitor_group_sms_numbers, :monitor_unlinked_extensions, :scheduler_link_type, :effective_scheduler_link, to: :employee_record, allow_nil: true |
#survey_enrollments ⇒ ActiveRecord::Relation<SurveyEnrollment>
230 |
# File 'app/models/employee.rb', line 230 has_many :survey_enrollments, through: :employee_survey_enrollments |
#technical_support_invoices ⇒ ActiveRecord::Relation<Invoice>
233 |
# File 'app/models/employee.rb', line 233 has_many :technical_support_invoices, class_name: 'Invoice', foreign_key: 'technical_support_rep_id', dependent: :nullify, inverse_of: :technical_support_rep |
#time_off_balances ⇒ ActiveRecord::Relation<TimeOffBalance>
209 |
# File 'app/models/employee.rb', line 209 has_many :time_off_balances, dependent: :destroy, inverse_of: :employee |
#time_off_policies ⇒ ActiveRecord::Relation<TimeOffPolicy>
210 211 212 |
# File 'app/models/employee.rb', line 210 has_many :time_off_policies, -> { select('time_off_policies.*, time_off_policy_assignments.accrual_start_date AS accrual_start_date') }, through: :time_off_policy_assignments |
#time_off_policy_assignments ⇒ ActiveRecord::Relation<TimeOffPolicyAssignment>
208 |
# File 'app/models/employee.rb', line 208 has_many :time_off_policy_assignments, dependent: :destroy, inverse_of: :employee |
#time_off_requests ⇒ ActiveRecord::Relation<TimeOffRequest>
207 |
# File 'app/models/employee.rb', line 207 has_many :time_off_requests, dependent: :destroy, inverse_of: :employee |
#trainer_contact_training_topics ⇒ ActiveRecord::Relation<ContactTrainingTopic>
226 |
# File 'app/models/employee.rb', line 226 has_many :trainer_contact_training_topics, class_name: 'ContactTrainingTopic', foreign_key: 'trainer_party_id', inverse_of: :trainer_party, dependent: :destroy |
#trainer_employee_topics ⇒ ActiveRecord::Relation<EmployeeTopic>
225 |
# File 'app/models/employee.rb', line 225 has_many :trainer_employee_topics, class_name: 'EmployeeTopic', foreign_key: 'trainer_party_id', inverse_of: :trainer_party, dependent: :destroy |
#work_schedules ⇒ ActiveRecord::Relation<WorkSchedule>
205 |
# File 'app/models/employee.rb', line 205 has_many :work_schedules, dependent: :destroy, inverse_of: :employee |