venue_management/app/models/venue_management_contract.rb

59 lines
1.9 KiB
Ruby
Raw Normal View History

2020-07-30 17:30:14 +00:00
# frozen_string_literal: true
require 'orbit_form_helper'
class VenueManagementContract
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Enum
PAYERS = [ :school, :vendor ].freeze
BID_RESULTS = [ :failure, :abandoned, :qualified ].freeze
# Copy from Inviting
field :case_no, type: String
field :publish_times, type: Integer
field :start_date, type: Date, default: Time.now
field :end_date, type: Date
field :close_date, type: Date
field :bid_date, type: Date
field :evaluation_date, type: Date
field :early_rent, type: Integer
field :operation_rent, type: Integer
field :royalty, type: Integer
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
# Other fields
field :vendor # save user_id
field :contract_start_date, type: Date
field :contract_end_date, type: Date
field :construction_start_date, type: Date
field :construction_end_date, type: Date
field :operation_start_date, type: Date
field :operation_end_date, type: Date
field :free_period_start_date, type: Date
field :free_period_end_date, type: Date
field :renewal_permission, type: Boolean
field :sign_date, type: Date
field :handover_date, type: Date
field :deposit_payment_date, type: Date
field :deposit_type, type: String
field :deposit_exp_date, type: Date
field :insurance_type, type: String
field :insurance_payment_deadline, type: Date
field :insurance_payment_date, type: Date
field :other_commitment, localize: true
field :note, localize: true
belongs_to :venue_management_main
belongs_to :venue_management_inviting
has_many :venue_management_links, :as => :venue_object, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :venue_management_links, :allow_destroy => true
end