98 lines
4.0 KiB
Ruby
98 lines
4.0 KiB
Ruby
class VenueManagementMain
|
|
include Mongoid::Document
|
|
include Mongoid::Timestamps
|
|
include OrbitModel::Impression
|
|
# encoding: utf-8
|
|
include OrbitCategory::Categorizable
|
|
include Slug
|
|
|
|
field :title, as: :slug_title, type: String, localize: true
|
|
field :speaker, localize: true
|
|
field :content, localize: true
|
|
field :land_number, localize: true
|
|
field :area, localize: true
|
|
field :land_zoning, localize: true
|
|
field :act_place, localize: true
|
|
field :manager_ids, type: Array,default: []
|
|
field :contractor_ids, type: Array,default: []
|
|
field :coordinator_ids, type: Array,default: []
|
|
field :venue_management_start_date, :type => Date, :default => Time.now
|
|
field :venue_management_end_date, :type => Date, :default => Time.now
|
|
|
|
field :signup_start_date, :type => Date, :default => Time.now
|
|
field :signup_end_date, :type => Date, :default => Time.now
|
|
|
|
field :contribute_start_date, :type => Date
|
|
field :contribute_end_date, :type => Date
|
|
|
|
field :contribute_file_count, type: String
|
|
|
|
field :registration_status , :type => Array #C: 投稿者 G:一般
|
|
|
|
field :create_user_id
|
|
field :update_user_id
|
|
|
|
belongs_to :venue_management_item
|
|
|
|
has_many :venue_management_invitings, :autosave => true, :dependent => :destroy
|
|
has_many :venue_management_memorabilias, :autosave => true, :dependent => :destroy
|
|
has_many :venue_management_contracts, :autosave => true, :dependent => :destroy
|
|
has_many :venue_management_item_contents, :autosave => true, :dependent => :destroy
|
|
has_many :venue_management_signups, :autosave => true, :dependent => :destroy
|
|
has_many :venue_management_submission_fields, :autosave => true, :dependent => :destroy
|
|
has_many :venue_management_signup_fields, :autosave => true, :dependent => :destroy
|
|
has_many :venue_management_reviews, :autosave => true, :dependent => :destroy
|
|
has_many :venue_management_signup_field_sets, autosave: true, dependent: :destroy
|
|
has_many :venue_management_submission_field_sets, autosave: true, dependent: :destroy
|
|
has_many :venue_management_email_sets, autosave: true, dependent: :destroy
|
|
has_many :venue_management_signup_field_customs, :autosave => true, :dependent => :destroy
|
|
accepts_nested_attributes_for :venue_management_memorabilias, :allow_destroy => true
|
|
accepts_nested_attributes_for :venue_management_item_contents, :allow_destroy => true
|
|
accepts_nested_attributes_for :venue_management_signups, :allow_destroy => true
|
|
accepts_nested_attributes_for :venue_management_submission_fields, :allow_destroy => true
|
|
accepts_nested_attributes_for :venue_management_signup_fields, :allow_destroy => true
|
|
accepts_nested_attributes_for :venue_management_reviews, :allow_destroy => true
|
|
accepts_nested_attributes_for :venue_management_signup_field_sets, :allow_destroy => true
|
|
accepts_nested_attributes_for :venue_management_submission_field_sets, :allow_destroy => true
|
|
accepts_nested_attributes_for :venue_management_email_sets, :allow_destroy => true
|
|
accepts_nested_attributes_for :venue_management_signup_field_customs, :allow_destroy => true
|
|
include VenueLinkFile
|
|
def manager_emails
|
|
MemberProfile.where(:id.in => self.manager_ids).collect{|v| v.email}
|
|
end
|
|
def self.time_range(date1 = null, date2 = null)
|
|
|
|
if !date1.blank?
|
|
|
|
r = "#{date1.strftime('%Y-%m-%d')}"
|
|
|
|
if date2
|
|
r += " - #{date2.strftime('%Y-%m-%d')}"
|
|
else
|
|
r += " - #{I18n.t(:no_deadline)}"
|
|
end
|
|
|
|
r
|
|
|
|
end
|
|
|
|
end
|
|
|
|
def get_attribute_value(attribute_field, signup_id)
|
|
VenueManagementSignupValue.find_by(venue_management_signup_field_id: attribute_field.id, venue_management_signup_id: signup_id)
|
|
end
|
|
|
|
def get_attribute_values(attribute_type=nil)
|
|
@attribute_values = attribute_type.venue_management_signup_values rescue nil
|
|
end
|
|
|
|
def get_value_from_field_id(field_id,attribute_type=nil)
|
|
values = get_attribute_values(attribute_type)
|
|
value = values.detect {|value| value.venue_management_signup_field_id == field_id} rescue nil
|
|
value ? value : nil
|
|
end
|
|
def case_no
|
|
''
|
|
end
|
|
end
|