Fix a lot things.

Add reminder.
This commit is contained in:
BoHung Chiu 2020-09-22 23:19:59 +08:00
parent 7a1de22911
commit 8e672b38e9
23 changed files with 583 additions and 72 deletions

View File

@ -42,6 +42,7 @@ class Admin::VenueManagementContractsController < Admin::VenueAdminController
end
def create
OrbitHelper.set_params(params,current_user)
@venue_management_contract = VenueManagementContract.new(venue_management_contract_params)
@venue_management_contract.save
@ -53,6 +54,7 @@ class Admin::VenueManagementContractsController < Admin::VenueAdminController
end
def update
OrbitHelper.set_params(params,current_user)
@venue_management_contract.update_attributes!(venue_management_contract_params)
redirect_to venue_management_contracts_admin_venue_management_path(@venue_management_contract.venue_management_main_id)
end

View File

@ -26,8 +26,8 @@ class Admin::VenueManagementsController < Admin::VenueAdminController
"venue_management.contractor",
'venue_management.event_during',
'venue_management.signup_during',
'venue_management.contract_history',
'venue_management.inviting_history',
'venue_management.contract_history',
'venue_management.memorabilia',
'venue_management.bills',
'venue_management.export'

View File

@ -125,9 +125,9 @@ module Admin::VenueManagementsFieldHelper
concat (content_tag :span, :class => 'add-on clearDate' do
content_tag :i, nil, :class => 'icons-cross-3'
end)
concat (content_tag :span, :class => 'add-on iconbtn' do
content_tag :i, nil, 'data-time-icon' => 'icons-clock', 'data-date-icon' => 'icons-calendar', :class=>"icons-calendar"
end)
# concat (content_tag :span, :class => 'add-on iconbtn' do
# content_tag :i, nil, 'data-time-icon' => 'icons-clock', 'data-date-icon' => 'icons-calendar', :class=>"icons-calendar"
# end)
end
end

View File

@ -7,7 +7,7 @@ module VenueAdminHelper
venue = @template.instance_variable_get(:@venue)
if !venue.nil?
module_pages = @template.instance_variable_get(:@module_pages)
base_name = @object.class.to_s.underscore
base_name = self.object_name
calendar_types = @template.instance_variable_get(:@calendar_types)
style_attr = ''
calendar_show = !@object['calendar_dict'][arg[0]].nil?

View File

@ -16,10 +16,13 @@ module VenueLinkFile
tmp = self.to_s.underscore.to_sym
VenueManagementFile.send(:belongs_to,tmp, :class_name => self.to_s, :foreign_key => "#{tmp}_id")
VenueManagementLink.send(:belongs_to,tmp, :class_name => self.to_s, :foreign_key => "#{tmp}_id")
VenueManagementReminder.send(:belongs_to,tmp, :class_name => self.to_s, :foreign_key => "#{tmp}_id")
self.has_many :venue_management_files, :autosave => true, :dependent => :destroy
self.accepts_nested_attributes_for :venue_management_files, :allow_destroy => true
self.has_many :venue_management_links, :autosave => true, :dependent => :destroy
self.accepts_nested_attributes_for :venue_management_links, :allow_destroy => true
self.has_many :venue_management_reminders, :autosave => true, :dependent => :destroy
self.accepts_nested_attributes_for :venue_management_reminders, :allow_destroy => true
self.fields.values.each do|v|
if v.type==Date || v.type==DateTime
self.field v.name+'_reminder', type: Boolean,default: false
@ -30,7 +33,7 @@ module VenueLinkFile
self.field :calendar_dict,type: Hash,default: {}
def to_calendar_param
venue_main = self.class.to_s == 'VenueManagementMain' ? self : VenueManagementMain.find(self.venue_management_main_id)
self.case_no+'-'+self.id.to_s+'?method=show_'+self.class.to_s.underscore.gsub('venue_management_','').gsub('main','data')
self.case_no.to_s+'-'+self.id.to_s+'?method=show_'+self.class.to_s.underscore.gsub('venue_management_','').gsub('main','data')
end
def calendar_id(field)
self.calendar_dict[field]

View File

@ -43,18 +43,28 @@ class VenueManagementContract
field :renewal_permission, type: Boolean
field :sign_date, type: Date
field :handover_date, type: Date
field :deposit_amount, type: String
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 :insurance_type2, type: String
field :insurance_payment_deadline2, type: Date
field :insurance_payment_date2, type: Date
field :insurance_type3, type: String
field :insurance_payment_deadline3, type: Date
field :insurance_payment_date3, type: Date
field :other_commitment, localize: true
field :note, localize: true
belongs_to :venue_management_main
belongs_to :venue_management_inviting
include VenueLinkFile
def display_royalty
self.royalty.to_s.gsub("\r\n","<br>").html_safe
end
def update_inviting(inviting,check_inviting,org_contract=nil,save_flag=true)
if !inviting.nil?
%i(case_no publish_times start_date end_date close_date bid_date evaluation_date contractor_manager bid_result details).each do |attr_|

View File

@ -8,15 +8,15 @@ class VenueManagementInviting
include Mongoid::Enum
include OrbitTag::Taggable
PAYERS = [ :school, :vendor].freeze
BID_RESULTS = [ :failure, :abandoned, :qualified].freeze
BID_RESULTS = [ :empty ,:failure, :abandoned, :qualified].freeze
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 :close_date, type: DateTime
field :bid_date, type: DateTime
field :evaluation_date, type: DateTime
field :early_rent, type: Integer
field :operation_rent, type: Integer
field :royalty, type: String
@ -30,6 +30,18 @@ class VenueManagementInviting
has_many :venue_management_memorabilias, :class_name => 'VenueManagementMemorabilia', :foreign_key => "venue_management_memorabilia_ids"
belongs_to :venue_management_main
include VenueLinkFile
def display_royalty
self.royalty.to_s.gsub("\r\n","<br>").html_safe
end
def display_close_date
self.close_date.strftime("%Y/%m/%d %H:%M") rescue ""
end
def display_bid_date
self.bid_date.strftime("%Y/%m/%d %H:%M") rescue ""
end
def display_evaluation_date
self.evaluation_date.strftime("%Y/%m/%d %H:%M") rescue ""
end
def display_case_no
return (self.case_no.blank? ? I18n.t(:empty) : self.case_no)
end

View File

@ -10,6 +10,8 @@ class VenueManagementMain
field :speaker, localize: true
field :content, localize: true
field :land_number, localize: true
field :land_area, localize: true
field :building_area, localize: true
field :area, localize: true
field :land_zoning, localize: true
field :act_place, localize: true

View File

@ -0,0 +1,104 @@
# encoding: utf-8
class VenueManagementReminder
include Mongoid::Document
include Mongoid::Timestamps
field :description, localize: true
field :reminder_date, type: Date
field :reminder_date_reminder, type: Boolean,default: false
field :reminder_date_reminder_day, type: Integer
field :calendar_data,type: Hash,default: {type:{},key:[],page_id: {}}
field :calendar_dict,type: Hash,default: {}
has_many :venue_management_emails, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :venue_management_emails, :allow_destroy => true
def to_calendar_param
vm_contract = self.venue_management_contract rescue VenueManagementContract.all.select{|v| v.venue_management_reminder_ids.include? self.id}.first
venue_main = vm_contract.venue_management_main
self.description+'-'+vm_contract.id.to_s+'?method=show_contract'
end
def calendar_id(field)
self.calendar_dict[field]
end
before_save do
venue_main = self.venue_management_contract.venue_management_main rescue VenueManagementContract.all.select{|v| v.venue_management_reminder_ids.include? self.id}.first.venue_management_main
calendar_keys = Array(self.calendar_data['key'])
(self.calendar_dict.keys - calendar_keys).each do |key_deleted|
event = Event.where(:id => self.calendar_dict[key_deleted]).first
event.model_class = nil
event.destroy
self.calendar_dict.delete(key_deleted)
end
if !calendar_keys.blank?
calendar_keys.each do |key|
key_id = self.calendar_id(key)
current_user_id = OrbitHelper.current_user.id rescue nil
in_use_locales = Site.first.in_use_locales
title_tp = {}
note_tp = {}
titles = venue_main['title'].select{|k,v| v.present?}.to_h
notes = self.description_translations.select{|k,v| v.present?}.to_h
in_use_locales.each do |locale|
if titles[locale].nil?
title_tp[locale] = titles.values.first.to_s + " " + I18n.t("venue_management.reminder")
else
title_tp[locale] = venue_main['title'][locale].to_s + " " + I18n.t("venue_management.reminder")
end
note_tp[locale] = self.description_translations[locale].blank? ? I18n.t(:url_alt) +': ' + notes.values.first.to_s : I18n.t(:url_alt) +': ' + self.description_translations[locale]
end
update_dict = {key: key,model_class: self.class.to_s,model_id: self.id,update_user_id: current_user_id,calendar_type_id: calendar_data['type'][key],all_day: true,start: self.send(key),end: self.send(key),title_translations: title_tp,note_translations: note_tp,module_key: 'venue_management',model_page_id: calendar_data['page_id'][key]}
if key_id.nil?
self.calendar_dict[key] = Event.create(update_dict.merge(create_user_id: current_user_id)).id
else
calendar = Event.find(key_id) rescue nil
if calendar.nil?
self.calendar_dict[key] = Event.create(update_dict.merge(create_user_id: current_user_id)).id
else
calendar.update_attributes(update_dict)
end
end
end
end
self.venue_management_emails.each do |venue_mail|
email = venue_mail.email
if !email.nil?
email.destroy
end
end
self.venue_management_emails = []
manager_emails = venue_main.manager_emails
self.fields.values.each do|v|
if v.type==Date || v.type==DateTime
if self.send(v.name+'_reminder')
title = venue_main.title + ' ' + self.description.to_s + ' ' + get_trans(v.name)
send_time = self.send(v.name)-self.send(v.name+'_reminder_day').day rescue nil
if !send_time.nil?
new_email = Email.create(mail_to: manager_emails,
module_app_key:"venue_management",
template:"email/reminder_email.html.erb",
mail_sentdate: send_time,
mail_subject: title,
template_data:{'title'=>title,'send_time'=>self.send(v.name),'locale'=>I18n.locale})
self.venue_management_emails << VenueManagementEmail.new(email_id: new_email.id)
end
end
end
end
end
before_destroy do
calendar_keys = Array(self.calendar_data['key'])
calendar_keys.each do |key|
key_id = self.calendar_id(key)
event = Event.find(key_id) rescue nil
event.destroy
end
end
def get_trans(field)
class_name = self.class.to_s
if class_name == 'VenueManagementMain'
I18n.t("venue_management.#{field}")
else
class_name = class_name.underscore.gsub('venue_management','vm')
I18n.t("#{class_name}.#{field}")
end
end
end

View File

@ -1,7 +1,7 @@
<script>
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
</script>
<% if 'venue_management_memorabilias' == params[:action] %>
<% if 'venue_management_bills' == params[:action] %>
<h4><%= @venue_management.title %></h4>
<% end %>
<table class="table main-list">

View File

@ -51,7 +51,7 @@
<div class="control-group">
<label class="control-label muted"><%= t('vm_inviting.royalty') %></label>
<div class="controls">
<%= f.text_field :royalty %>
<%= f.text_area :royalty %>
</div>
</div>
<div class="control-group">
@ -66,18 +66,6 @@
<%= f.select :land_tax_payer, VenueManagementInviting::PAYERS.map { |p| [t("vm_inviting.enums.#{p}"), p] } %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.renewal_permission') %></label>
<div class="controls">
<%= f.check_box :renewal_permission,:id => 'renewal_permission' %>
</div>
</div>
<div class="control-group" id="renewal_deadline" style="<%= 'display:none' if !@venue_management_contract.renewal_permission %>">
<label class="control-label muted"><%= t('vm_contract.renewal_deadline') %></label>
<div class="controls">
<%= f.datetime_picker :renewal_deadline, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.contract_start_date') %></label>
<div class="controls">
@ -90,6 +78,18 @@
<%= f.datetime_picker :contract_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.free_period_start_date') %></label>
<div class="controls">
<%= f.datetime_picker :free_period_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.free_period_end_date') %></label>
<div class="controls">
<%= f.datetime_picker :free_period_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.construction_start_date') %></label>
<div class="controls">
@ -114,18 +114,6 @@
<%= f.datetime_picker :operation_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.free_period_start_date') %></label>
<div class="controls">
<%= f.datetime_picker :free_period_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.free_period_end_date') %></label>
<div class="controls">
<%= f.datetime_picker :free_period_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.sign_date') %></label>
<div class="controls">
@ -138,6 +126,12 @@
<%= f.datetime_picker :handover_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.deposit_amount') %></label>
<div class="controls">
<%= f.text_field :deposit_amount %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.deposit_payment_date') %></label>
<div class="controls">
@ -176,6 +170,54 @@
<%= f.datetime_picker :insurance_payment_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.insurance_type2') %></label>
<div class="controls">
<%= f.text_field :insurance_type2 %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.insurance_payment_deadline2') %></label>
<div class="controls">
<%= f.datetime_picker :insurance_payment_deadline2, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.insurance_payment_date2') %></label>
<div class="controls">
<%= f.datetime_picker :insurance_payment_date2, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.insurance_type3') %></label>
<div class="controls">
<%= f.text_field :insurance_type3 %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.insurance_payment_deadline3') %></label>
<div class="controls">
<%= f.datetime_picker :insurance_payment_deadline3, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.insurance_payment_date3') %></label>
<div class="controls">
<%= f.datetime_picker :insurance_payment_date3, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_contract.renewal_permission') %></label>
<div class="controls">
<%= f.check_box :renewal_permission,:id => 'renewal_permission' %>
</div>
</div>
<div class="control-group" id="renewal_deadline" style="<%= 'display:none' if !@venue_management_contract.renewal_permission %>">
<label class="control-label muted"><%= t('vm_contract.renewal_deadline') %></label>
<div class="controls">
<%= f.datetime_picker :renewal_deadline, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_contract.new_record? %>
</div>
</div>
</div>
</div>
@ -221,7 +263,7 @@
</div>
<% end %>
<%= render partial: 'admin/venue_shared/venue_file_link',locals: {venue: @venue_management_contract,f: f} %>
<%= render partial: 'admin/venue_shared/venue_file_link_reminder',locals: {venue: @venue_management_contract,f: f} %>
</div>

View File

@ -36,7 +36,7 @@
<td><%= "#{contract.early_rent} / #{contract.operation_rent}" %></td>
<td><%= contract.royalty %></td>
<td><%= contract.display_royalty %></td>
<td><%= "#{contract.contract_start_date} / #{contract.contract_end_date}" %></td>
<td><%= contract.renewal_permission.present? ? t("vm_contract.renewal.#{contract.renewal_permission}") : t("vm_contract.renewal.false") %></td>

View File

@ -50,19 +50,19 @@
<div class="control-group">
<label class="control-label muted"><%= t('vm_inviting.close_date') %></label>
<div class="controls">
<%= f.datetime_picker :close_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_inviting.new_record? %>
<%= f.datetime_picker :close_date, :no_label => true, :format=>"yyyy/MM/dd HH:mm", :new_record => @venue_management_inviting.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_inviting.bid_date') %></label>
<div class="controls">
<%= f.datetime_picker :bid_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_inviting.new_record? %>
<%= f.datetime_picker :bid_date, :no_label => true, :format=>"yyyy/MM/dd HH:mm", :new_record => @venue_management_inviting.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('vm_inviting.evaluation_date') %></label>
<div class="controls">
<%= f.datetime_picker :evaluation_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management_inviting.new_record? %>
<%= f.datetime_picker :evaluation_date, :no_label => true, :format=>"yyyy/MM/dd HH:mm", :new_record => @venue_management_inviting.new_record? %>
</div>
</div>
<div class="control-group">
@ -80,7 +80,7 @@
<div class="control-group">
<label class="control-label muted"><%= t('vm_inviting.royalty') %></label>
<div class="controls">
<%= f.text_field :royalty %>
<%= f.text_area :royalty %>
</div>
</div>
<div class="control-group">

View File

@ -19,7 +19,7 @@
<td><%= inviting.venue_management_main.title %></td>
<% end %>
<td>
<%= link_to inviting.case_no, (@venue_management_page_url.blank? ? "#" : "/#{I18n.locale}"+@venue_management_page_url+"/#{inviting.case_no.strip}-#{inviting.id}?method=show_inviting"), :target => '_self' %>
<%= link_to inviting.display_case_no, (@venue_management_page_url.blank? ? "#" : "/#{I18n.locale}"+@venue_management_page_url+"/#{inviting.display_case_no.strip}-#{inviting.id}?method=show_inviting"), :target => '_self' %>
<div class="quick-edit">
<ul class="nav nav-pills">
@ -34,7 +34,7 @@
<td><%= inviting.publish_times %></td>
<td><%= inviting.start_date.to_s + "/" + inviting.end_date.to_s %></td>
<td><%= "#{inviting.early_rent} / #{inviting.operation_rent}" %></td>
<td><%= inviting.royalty %></td>
<td><%= inviting.display_royalty %></td>
<td><%= t("vm_inviting.enums.#{inviting.house_tax_payer}") + "/" + t("vm_inviting.enums.#{inviting.land_tax_payer}") %></td>
<td><%= inviting.contractor_manager %></td>
<td><%= t("vm_inviting.enums.bid_result.#{inviting.bid_result}") %></td>

View File

@ -430,7 +430,7 @@
</div>
</div>
<!-- Speaker -->
<!-- Address -->
<div class="control-group input-title">
<label class="control-label muted"><%= t('venue_management.speaker') %></label>
<div class="controls">
@ -450,18 +450,19 @@
</div>
</div>
</div>
<% areas = ['land_area','building_area','area'] %>
<% areas.each do |area| %>
<div class="control-group input-content">
<label class="control-label muted"><%= t('venue_management.area') %></label>
<label class="control-label muted"><%= t("venue_management.#{area}") %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :area_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", :value => (@venue_management.area_translations[locale] rescue nil),placeholder: t('venue_management.area') %>
<%= f.text_field locale, class: "input-block-level", :value => (@venue_management.send("#{area}_translations")[locale] rescue nil),placeholder: t("venue_management.#{area}") %>
<% end %>
</div>
</div>
</div>
<% end %>
<div class="control-group input-content">
<label class="control-label muted"><%= t('venue_management.land_zoning') %></label>
<div class="controls">

View File

@ -41,10 +41,10 @@
<td><%= venue_management.display_event_during %></td>
<td><%= venue_management.display_signup_during %></td>
<td>
<%= link_to venue_management.venue_management_contracts.count, venue_management_contracts_admin_venue_management_path(venue_management.id) %>
<%= link_to venue_management.venue_management_invitings.count, venue_management_invitings_admin_venue_management_path(venue_management.id) %>
</td>
<td>
<%= link_to venue_management.venue_management_invitings.count, venue_management_invitings_admin_venue_management_path(venue_management.id) %>
<%= link_to venue_management.venue_management_contracts.count, venue_management_contracts_admin_venue_management_path(venue_management.id) %>
</td>
<td>
<%= link_to venue_management.venue_management_memorabilias.count, venue_management_memorabilias_admin_venue_management_path(venue_management.id) %>

View File

@ -0,0 +1,110 @@
<div class="start-line">
<div style="float: left;">
<span class="add-on icons-pencil" title="<%= t(:url_alt) %>" style="float: left;"></span>
<span class="tab-content" style="float: left;">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :description_translations do |f| %>
<%= f.text_field locale, :class => "input-large", placeholder: t(:url_alt), :value => (form_reminder.description_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
</div>
<%= f.datetime_picker :reminder_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => (form_reminder.nil? || form_reminder.new_record?) %>
<% if form_reminder.nil? || form_reminder.new_record? %>
<span class="delete_link add-on btn" title="<%= t(:delete_) %>">
<a class="icon-trash"></a>
</span>
<% else %>
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<%= f.hidden_field :id %>
<a class="icon-remove"></a>
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
</span>
<% end %>
</div>
<script type="text/javascript">
if ($('.default_picker,.time_picker,.date_picker,.datetimepick').find('input').length!=0){
$('.default_picker,.time_picker,.date_picker,.datetimepick').find('.iconbtn').css('display','none')
$('.default_picker,.date_picker,.datetimepick').each(function(i,v){
v = $(v).find('input')[0]
$(v).attr('autocomplete','off')
var org_format = $(v).data('format') || $(v).attr('placeholder')
var format = org_format.toLowerCase().replace(/yyyy/,'yy')
var H_flag = false
if (org_format.search(/tt|H/)!= null ){
H_flag = true
}
var M_flag = false
if (org_format.match(/[hH].*M/)!=null){
M_flag = true
}
if (format.search(/h/)!= -1){
var result = format.match(/\W+[?=h]/)
if (result == null){
result = format.match(/h/)
}
var indice = result.index
var dateformat = format.slice(0,8)
var time_format_start = format.search(/h/)
var time_format = format.slice(time_format_start)
if (H_flag){
time_format = time_format.replace(/h/g,'H')
}
if (M_flag){
time_format = time_format.replace(/m/g,'M')
}
$(v).ui_datetimepicker({
dateFormat: dateformat,
controlType: 'select',
timeInput: true,
oneLine: true,
timeFormat: time_format
})
}else{
var show_view = ''
if (format.split(/\W/).slice(-1)[0].slice(-1)[0]=='m'){
show_view = 'month'
}
if (format.split(/\W/).slice(-1)[0].slice(-1)[0]=='y'){
show_view = 'year'
}
$(v).ui_datepicker({dateFormat: format,show_view: show_view})
}
})
$('.default_picker,.time_picker,.date_picker').find('.clearDate').click(function(){
$(this).parents('.default_picker,.time_picker,.date_picker').eq(-1).find('input').val('')
$(this).parents('.default_picker,.time_picker,.date_picker').eq(-1).find('input').trigger('change')
})
$('.time_picker input').each(function(i,v){
$(v).ui_timepicker({timeFormat: $(v).data('format'),
controlType: 'select',
timeInput: true,
oneLine: true})
})
$('.separated_picker').find('.date_picker,.time_picker').find('input').change(function(){
var parent_div = $(this).parents('.separated_picker').eq(-1)
var date_picker_value = parent_div.find('.date_picker>input').val()
var time_picker_value = parent_div.find('.time_picker>input').val()
if (date_picker_value == '' || time_picker_value == ''){
parent_div.children('input[type=hidden]').val('')
}
else{
parent_div.children('input[type=hidden]').val(date_picker_value+' '+time_picker_value)
}
})
}
$('.simple-date-picker').find('input[type="text"],select').change(function(){
var parent_div = $(this).parents('.simple-date-picker').eq(-1)
var year = parent_div.find('.span3').val()
var month = parent_div.find('.span2').val()
var day = parent_div.find('.span1').val()
if (year != '' && month != '' && day != ''){
parent_div.find('input[type="hidden"]').eq(-1).val(year+'-'+month+'-'+day)
}
})
$(document).on('click', '.delete_link', function(){
$(this).parents('.start-line').remove();
});
</script>

View File

@ -0,0 +1,131 @@
<!-- Link -->
<div class="control-group">
<label class="control-label muted"><%= t(:link) %></label>
<div class="controls add-input">
<!-- Exist -->
<% if !venue.nil? && !venue.venue_management_links.blank? %>
<div class="exist">
<% venue.venue_management_links.each_with_index do |venue_management_link, i| %>
<%= f.fields_for :venue_management_links, venue_management_link do |f| %>
<%= render :partial => 'admin/venue_shared/form_link', :locals => {:f => f, :i => i,form_link: venue_management_link} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'venue_management_link_field_count', venue.venue_management_links.count %>
<a id="add_link" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
<!-- File -->
<div class="control-group">
<label class="control-label muted"><%= t(:file_) %></label>
<div class="controls">
<!-- Exist -->
<% if !venue.nil? && !venue.venue_management_files.blank? %>
<div class="exist">
<% venue.venue_management_files.each_with_index do |venue_management_file, i| %>
<%= f.fields_for :venue_management_files, venue_management_file do |f| %>
<%= render :partial => 'admin/venue_shared/form_file', :locals => {:f => f, :i => i,form_file: venue_management_file} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'venue_management_file_field_count', venue.venue_management_files.count %>
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
<!-- Reminder -->
<div class="control-group">
<label class="control-label muted"><%= t("venue_management.reminder") %></label>
<div class="controls">
<!-- Exist -->
<% if !venue.nil? && !venue.venue_management_reminders.blank? %>
<div class="exist">
<% venue.venue_management_reminders.each_with_index do |venue_management_reminder, i| %>
<%= f.fields_for :venue_management_reminders, venue_management_reminder do |f| %>
<%= render :partial => 'admin/venue_shared/form_reminder', :locals => {:f => f, :i => i,form_reminder: venue_management_reminder} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'venue_management_reminder_field_count', venue.venue_management_reminders.count %>
<a id="add_reminder" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
</div>
<script type="text/javascript">
$(function() {
$(document).on('click', '#add_reminder', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_venue_management_reminders", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'admin/venue_shared/form_reminder', f, :venue_management_reminders) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.tab-content').children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
formTip();
});
$(document).on('click', '#add_link', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_venue_management_links", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'admin/venue_shared/form_link', f, :venue_management_links) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.tab-content').children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
formTip();
});
$(document).on('click', '#add_file', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_venue_management_files", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'admin/venue_shared/form_file', f, :venue_management_files) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
});
formTip();
});
$(document).on('click', '.delete_link', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.remove_existing_record', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);
$(this).parents('.start-line').hide();
}
});
});
</script>

View File

@ -27,7 +27,7 @@
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.royalty') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.royalty %></td>
<td class="venue_managementive-title-value"><%= @venue_management_contract.display_royalty %></td>
</tr>
<tr>
<tr>
@ -62,6 +62,10 @@
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.handover_date') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.handover_date %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-money fa-fw"></i><%= t('vm_contract.deposit_amount') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.deposit_amount %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.deposit_payment_date') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.deposit_payment_date %></td>
@ -86,6 +90,34 @@
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.insurance_payment_date') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.insurance_payment_date %></td>
</tr>
<% if @venue_management_contract.insurance_type2.present? %>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_contract.insurance_type2') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.insurance_type2 %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.insurance_payment_deadline2') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.insurance_payment_deadline2 %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.insurance_payment_date2') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.insurance_payment_date2 %></td>
</tr>
<% end %>
<% if @venue_management_contract.insurance_type3.present? %>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_contract.insurance_type3') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.insurance_type3 %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.insurance_payment_deadline3') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.insurance_payment_deadline3 %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('vm_contract.insurance_payment_date3') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.insurance_payment_date3 %></td>
</tr>
<% end %>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_contract.other_commitment') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.other_commitment %></td>

View File

@ -27,12 +27,34 @@
<th class="venue_managementive-title-field"><%= t('venue_management.title') %></th>
<td class="venue_managementive-title-value"><%= @venue_management.title %></td>
</tr>
<% if !@venue_management.speaker.blank? %>
<% if !@venue_management.speaker.blank? #address %>
<tr>
<th class="venue_managementive-title-field"><%= t('venue_management.speaker') %></th>
<td class="venue_managementive-title-value"><%= @venue_management.speaker %></td>
</tr>
<% end %>
<% if !@venue_management.land_number.blank? %>
<tr>
<th class="venue_managementive-title-field"><%= t('venue_management.land_number') %></th>
<td class="venue_managementive-title-value"><%= @venue_management.land_number %></td>
</tr>
<% end %>
<% areas = ['land_area','building_area','area'] %>
<% areas.each do |area| %>
<% if !@venue_management.send(area).blank? %>
<tr>
<th class="venue_managementive-title-field"><%= t("venue_management.#{area}") %></th>
<td class="venue_managementive-title-value"><%= @venue_management.send(area) %></td>
</tr>
<% end %>
<% end %>
<% if !@venue_management.land_zoning.blank? %>
<tr>
<th class="venue_managementive-title-field"><%= t('venue_management.land_zoning') %></th>
<td class="venue_managementive-title-value"><%= @venue_management.land_zoning %></td>
</tr>
<% end %>
<% if !@venue_management.content.blank? %>
<tr>
<th class="venue_managementive-title-field"><%= t('venue_management.content') %></th>
@ -106,7 +128,7 @@
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.royalty') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.royalty %></td>
<td class="venue_managementive-title-value"><%= @venue_management_contract.display_royalty %></td>
</tr>
<tr>
<tr>
@ -199,8 +221,8 @@
<br />
<ul class="venue_management-plugins nav nav-pills" role="tablist" data-list="plugins" data-level="0">
<li class="active"><a href="#contract_history" role="tab" data-toggle="tab" title="<%=t('venue_management.contract_history')%>" aria-expanded="true"><%=t('venue_management.contract_history')%></a></li>
<li class=""><a href="#inviting_history" role="tab" data-toggle="tab" title="<%=t('venue_management.inviting_history')%>" aria-expanded="false"><%=t('venue_management.inviting_history')%></a></li>
<li class="active"><a href="#contract_history" role="tab" data-toggle="tab" title="<%=t('venue_management.contract_history')%>" aria-expanded="true"><%=t('venue_management.contract_history')%></a></li>
<li class=""><a href="#memorabilia" role="tab" data-toggle="tab" title="<%=t('venue_management.memorabilia')%>" aria-expanded="false"><%=t('venue_management.memorabilia')%></a></li>
<li class=""><a href="#bills" role="tab" data-toggle="tab" title="<%=t('venue_management.bills')%>" aria-expanded="false"><%=t('venue_management.bills')%></a></li>
</ul>
@ -310,7 +332,7 @@
</td>
<td><%= inviting.publish_times %></td>
<td><%= "#{inviting.early_rent} / #{inviting.operation_rent}" %></td>
<td><%= inviting.royalty %></td>
<td><%= inviting.display_royalty %></td>
<td><%= t("vm_inviting.enums.#{inviting.house_tax_payer}") + "/" + t("vm_inviting.enums.#{inviting.land_tax_payer}") %></td>
<td><%= inviting.contractor_manager %></td>
<td><%= t("vm_inviting.enums.bid_result.#{inviting.bid_result}") %></td>

View File

@ -21,13 +21,29 @@
<th class="venue_managementive-title-field"><%= t('vm_inviting.publish_times') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_inviting.publish_times %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.start_end') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_inviting.start_date.to_s + "/" + @venue_management_inviting.end_date.to_s %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.close_date') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_inviting.display_close_date %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.bid_date') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_inviting.display_bid_date %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.evaluation_date') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_inviting.display_evaluation_date %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.rents') %></th>
<td class="venue_managementive-title-value"><%= "#{@venue_management_inviting.early_rent} / #{@venue_management_inviting.operation_rent}" %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.royalty') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_inviting.royalty %></td>
<td class="venue_managementive-title-value"><%= @venue_management_inviting.display_royalty %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.house_land_tax_payer') %></th>

View File

@ -22,6 +22,7 @@ en:
verification_failed: Verification Failed #驗證碼錯誤
venue_management:
reminder: Reminder
print_pdf: Print
send_email_reminder: Send email reminder
before: Before
@ -30,7 +31,10 @@ en:
manager: Manager
contractor: Contractor
land_number: Land number
area: Area
area: Other Area
land_area: Land Area
building_area: Building Area
other_area: Other Area
land_zoning: Land zoning
coordinator: Coordinator
email_signup_success: Contract end date reminder
@ -177,6 +181,7 @@ en:
school: School
vendor: Vendor
bid_result:
empty: ''
failure: Failure
abandoned: Abandoned
qualified: Qualified
@ -236,11 +241,18 @@ en:
'false': 'No'
sign_date: Sign Date
handover_date: Handover Date
deposit_amount: Deposit amount
deposit_payment_date: Deposit Payment Date
deposit_type: Deposit Type
deposit_exp_date: Deposit EXP Date
insurance_type: Insurance Type
insurance_payment_deadline: Insurance Payment Deadline
insurance_payment_date: Insurance Payment Date
insurance_type: Insurance 1
insurance_payment_deadline: Insurance 1 Expiry Date
insurance_payment_date: Insurance 1 Payment Date
insurance_type2: Insurance 2
insurance_payment_deadline2: Insurance 2 Expiry Date
insurance_payment_date2: Insurance 2 Payment Date
insurance_type3: Insurance 3
insurance_payment_deadline3: Insurance 3 Expiry Date
insurance_payment_date3: Insurance 3 Payment Date
other_commitment: Other Commitments
note: Note

View File

@ -22,6 +22,7 @@ zh_tw:
verification_failed: 驗證碼錯誤
venue_management:
reminder: 提醒
print_pdf: 列印
send_email_reminder: 寄送Email提醒
before: 提前
@ -30,7 +31,10 @@ zh_tw:
manager: 管理人
contractor: 廠商
land_number: 地號
area: 面積
area: 其他面積
land_area: 場地面積
building_area: 建物面積
other_area: 其他面積
land_zoning: 土地使用分區
coordinator: 承辦人
email_signup_success: 履約期限
@ -177,6 +181,7 @@ zh_tw:
school: 學校
vendor: 廠商
bid_result:
empty: ''
failure: 流標
abandoned: 廢標
qualified: 決標
@ -187,7 +192,7 @@ zh_tw:
vm_bill:
contractor: 廠商
accounting_month: 列帳年月
bill_type: 收入
bill_type: 費用
caculation_basis: 計算基礎
reason: 說明
amount: 金額
@ -236,11 +241,18 @@ zh_tw:
'false':
sign_date: 簽約日期
handover_date: 點交日期
deposit_amount: 履約保證金額
deposit_payment_date: 履約保證金繳交日期
deposit_type: 履約保證金繳交形式
deposit_exp_date: 履約保證金效期
insurance_type: 保險種類
insurance_payment_deadline: 保險繳交期限
insurance_payment_date: 保險繳交日期
insurance_type: 保險一
insurance_payment_deadline: 保險一有效期限
insurance_payment_date: 保險一繳交日期
insurance_type2: 保險二
insurance_payment_deadline2: 保險二有效期限
insurance_payment_date2: 保險二繳交日期
insurance_type3: 保險三
insurance_payment_deadline3: 保險三有效期限
insurance_payment_date3: 保險三繳交日期
other_commitment: 其他回饋或承諾事項
note: 備註