2020-07-27 16:34:33 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'orbit_form_helper'
|
|
|
|
|
|
|
|
class VenueManagementInviting
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
include Mongoid::Enum
|
2020-08-02 13:33:41 +00:00
|
|
|
include OrbitTag::Taggable
|
|
|
|
PAYERS = [ :school, :vendor].freeze
|
|
|
|
BID_RESULTS = [ :failure, :abandoned, :qualified].freeze
|
2020-07-27 16:34:33 +00:00
|
|
|
|
|
|
|
field :case_no, type: String
|
|
|
|
field :publish_times, type: Integer
|
|
|
|
field :start_date, type: Date, default: Time.now
|
2020-07-30 17:30:14 +00:00
|
|
|
field :end_date, type: Date
|
|
|
|
field :close_date, type: Date
|
|
|
|
field :bid_date, type: Date
|
|
|
|
field :evaluation_date, type: Date
|
2020-07-27 16:34:33 +00:00
|
|
|
field :early_rent, type: Integer
|
|
|
|
field :operation_rent, type: Integer
|
2020-08-09 13:47:41 +00:00
|
|
|
field :royalty, type: String
|
2020-07-27 16:34:33 +00:00
|
|
|
field :contractor_manager # save user_id
|
|
|
|
enum :house_tax_payer, PAYERS
|
|
|
|
enum :land_tax_payer, PAYERS
|
|
|
|
enum :bid_result, BID_RESULTS
|
|
|
|
field :details, localize: true
|
|
|
|
|
2020-08-02 13:33:41 +00:00
|
|
|
has_many :venue_management_contracts
|
|
|
|
has_many :venue_management_memorabilias, :class_name => 'VenueManagementMemorabilia', :foreign_key => "venue_management_memorabilia_ids"
|
2020-07-27 16:34:33 +00:00
|
|
|
belongs_to :venue_management_main
|
2020-08-02 13:33:41 +00:00
|
|
|
include VenueLinkFile
|
2020-09-14 14:55:39 +00:00
|
|
|
def display_case_no
|
|
|
|
return (self.case_no.blank? ? I18n.t(:empty) : self.case_no)
|
|
|
|
end
|
2020-08-02 13:33:41 +00:00
|
|
|
before_save do
|
|
|
|
contracts = self.venue_management_contracts
|
2020-08-05 07:54:33 +00:00
|
|
|
org_inviting = VenueManagementInviting.find(self.id) rescue nil
|
2020-08-02 13:33:41 +00:00
|
|
|
contracts.each do |contract|
|
2020-08-05 07:54:33 +00:00
|
|
|
contract.update_inviting(self,org_inviting,contract)
|
2020-08-02 13:33:41 +00:00
|
|
|
end
|
|
|
|
end
|
2020-07-27 16:34:33 +00:00
|
|
|
end
|