<%= stylesheet_link_tag "select2/select2" %> <%= javascript_include_tag 'validator' %> <%= javascript_include_tag "select2/select2.min" %> <% content_for :page_specific_css do %> <%= stylesheet_link_tag "lib/main-forms" %> <% end %> <% sub_managers = @module_app.sub_managers sub_managers.delete(nil) all_statuses = [[t('top'),'is_top'],[t('hot'),'is_hot']] tp1 = select_tag("custom_announcement_setting[custom_anns_status_settings][-1][status]",options_for_select(all_statuses)) tp2 = select_tag("custom_announcement_setting[custom_anns_status_settings][-1][role_id]",options_for_select(Role.all.map{|r| [r.title,r.id]})) tp3 = number_field_tag("custom_announcement_setting[custom_anns_status_settings][-1][top_limit]",nil, min: 0,required: true) tp4 = "" all_tp = "
#{tp1}
#{tp2}
#{tp3}
#{tp4}
" %>
<%= t("custom_announcement.click_on_submit") %>
<%= form_for @setting, url: (@setting.new_record? ? admin_custom_announcement_createsettings_path : admin_custom_announcement_updatesettings_path), html: {class: "form-horizontal main-forms"} do |f| %>
<%= f.label :only_manager_can_edit_status, t("custom_announcement.only_manager_can_edit_status"), :class => "control-label muted" %>
<%= f.check_box :only_manager_can_edit_status %>
<%= f.label :is_display_edit_only, t("custom_announcement.is_display_edit_only"), :class => "control-label muted" %>
<%= f.check_box :is_display_edit_only %>
<%= f.label :top_limit, t("custom_announcement.top_limit"), :class => "control-label muted" %>
<%= f.number_field :top_limit, :min => "0" %> <%= t("custom_announcement.for_unlimited") %>
<%= t('status') %>
<%= t('role') %>
<%= t('custom_announcement.top_limit') %>
<% (CustomAnnouncementSetting.first.custom_anns_status_settings rescue []).each_with_index do |v,i| %>
<%= hidden_field_tag("custom_announcement_setting[custom_anns_status_settings][#{i}][_id]",v.id) %>
<%= select_tag("custom_announcement_setting[custom_anns_status_settings][#{i}][status]",options_for_select(all_statuses,:selected => v['status'])) %>
<%= select_tag("custom_announcement_setting[custom_anns_status_settings][#{i}][role_id]",options_for_select(Role.all.map{|r| [r.title,r.id]},:selected => v['role_id'])) %>
<%= number_field_tag("custom_announcement_setting[custom_anns_status_settings][#{i}][top_limit]",v['top_limit'], min: 0,required: true) %>
<% end %>
<% if CustomAnnouncementSetting.is_pro? %> <% if !sub_managers.blank? %>
<%= f.label "Approver Setting", :class => "control-label muted" %>
<%= t("custom_announcement.approvers_list") %> <%= @setting.approvers.count %>
<% else %>
<%= t("custom_announcement.click_set_sub_manager") %>
<% end %>
<%= f.label "Send emails to", :class => "control-label muted" %>
> <%= t("admin") %> > <%= t("manager") %> > <%= t("custom_announcement.approver") %>
<% sub_managers.each do |sm| %> <% if @setting.approvers.include?(sm.id.to_s) %> <% end %> <% end %>
<% end %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<% end %> <% if CustomAnnouncementSetting.is_pro? %> <% end %> <%= fields_for :iframe do |f| %>
<%=t('custom_announcement.custom_announcement_setting_for_iframe')%>
<%= f.label :layout_type, t("custom_announcement.layout_type"), :class => "control-label muted" %>
<% @layout_types = get_layouts(@module_app.key) %> <% if @layout_types.first.kind_of?(Hash) %> <% else %> <%= f.select(:layout, @layout_types) %> <% end %>
<%= f.label :tags, t(:tags), :class => "control-label muted" %>
<% @module_app.tags.each_with_index do |t,index| %> <% end %>
<% @module_app.categories.each_with_index do |c,index| %> <% end %>
<%= f.label :authors, t('custom_announcement.table.author'), :class => "control-label muted" %>
<%= render partial: 'admin/members/generate_modal_select' , locals: { :@sorted_members => @sorted_members ,:member_form_id => "card-list-members",:member_field_name=>"iframe[member_ids][]" } %>
<%= f.label :show_page, t('custom_announcement.show_page'), :class => "control-label muted" %>
<%=f.check_box :show_page ,{:checked=>'checked'},'true','false'%>
<%= f.label :data_count, t(:data_count), :class => "control-label muted" %>
<%=f.number_field :data_count, {min: 0,:value=> 10} %>
<% end %>