2020-08-04 09:04:04 +00:00
|
|
|
module VenueAdminHelper
|
2020-08-07 14:03:30 +00:00
|
|
|
include ActionView::Helpers::FormOptionsHelper
|
2020-08-04 09:04:04 +00:00
|
|
|
include OrbitFormHelper
|
|
|
|
alias :org_datetime_picker :datetime_picker
|
|
|
|
def datetime_picker(*arg,**args)
|
|
|
|
tp = org_datetime_picker(*arg,**args)
|
|
|
|
venue = @template.instance_variable_get(:@venue)
|
|
|
|
if !venue.nil?
|
2020-08-07 14:03:30 +00:00
|
|
|
base_name = @object.class.to_s.underscore
|
|
|
|
calendar_types = @template.instance_variable_get(:@calendar_types)
|
2020-08-04 09:04:04 +00:00
|
|
|
style_attr = ''
|
2020-08-07 14:03:30 +00:00
|
|
|
calendar_show = !@object['calendar_dict'][arg[0]].nil?
|
|
|
|
hide_style = " style=\"display: none;\""
|
2020-08-04 09:04:04 +00:00
|
|
|
if !@object.send(arg[0].to_s+'_reminder')
|
2020-08-07 14:03:30 +00:00
|
|
|
style_attr = hide_style
|
2020-08-04 09:04:04 +00:00
|
|
|
end
|
2020-08-07 14:03:30 +00:00
|
|
|
style_attr2 = calendar_show ? '' : hide_style
|
2020-08-04 09:04:04 +00:00
|
|
|
onclick_func = "function reminder_switch(ele){
|
|
|
|
if ($(ele).prop('checked')){
|
|
|
|
$(ele).parents('.controls').find('.email_reminder').show()
|
|
|
|
}else{
|
|
|
|
$(ele).parents('.controls').find('.email_reminder').hide()
|
|
|
|
}
|
|
|
|
};reminder_switch(this)"
|
2020-08-07 14:03:30 +00:00
|
|
|
onclick_func1 = "function reminder_switch_calendar(ele){
|
|
|
|
if ($(ele).prop('checked')){
|
|
|
|
$(ele).parents('.controls').find('.calendar_div').show()
|
|
|
|
}else{
|
|
|
|
$(ele).parents('.controls').find('.calendar_div').hide()
|
|
|
|
}
|
|
|
|
};reminder_switch_calendar(this)"
|
2020-08-04 09:04:04 +00:00
|
|
|
tp2 = content_tag(:div, :style => "float: left;flex-wrap: wrap;display: inline-flex;margin-left: 1em;align-items: center;") do
|
2020-08-07 14:03:30 +00:00
|
|
|
self.check_box((arg[0].to_s+'_reminder').to_sym,:onclick => onclick_func) + "#{I18n.t('venue_management.send_email_reminder')}<div class=\"email_reminder\"#{style_attr}>: #{I18n.t('venue_management.before')}#{self.number_field((arg[0].to_s+'_reminder_day').to_sym, :class => 'input-mini')}#{I18n.t('venue_management.day_send_email')}</div>".html_safe
|
|
|
|
end
|
|
|
|
calendar_type_key = "#{base_name}[calendar_data][type][#{arg[0]}]"
|
|
|
|
calendar_type = @object['calendar_data']['type'][arg[0]] rescue nil
|
|
|
|
tp3 = content_tag(:div, :style => "float: left;flex-wrap: wrap;display: inline-flex;margin-left: 1em;align-items: center;") do
|
|
|
|
check_box_tag("#{base_name}[calendar_data][key][]",arg[0],calendar_show,:onclick => onclick_func1) + "#{I18n.t('venue_management.add_to_calendar')}<div class=\"calendar_div\"#{style_attr2}>: #{select_tag(calendar_type_key,options_for_select(calendar_types,calendar_type))}</div>".html_safe
|
2020-08-04 09:04:04 +00:00
|
|
|
end
|
2020-08-07 14:03:30 +00:00
|
|
|
tp = content_tag(:div, tp , :style=>"float: left;")+ tp2 + tp3
|
2020-08-04 09:04:04 +00:00
|
|
|
end
|
|
|
|
tp
|
|
|
|
end
|
|
|
|
end
|