<% sub_managers = @module_app.sub_managers sub_managers.delete(nil) all_statuses = [[t('top'),'is_top'],[t('hot'),'is_hot']] tp1 = select_tag("announcement_setting[anns_status_settings][-1][status]",options_for_select(all_statuses)) tp2 = select_tag("announcement_setting[anns_status_settings][-1][role_id]",options_for_select(Role.all.map{|r| [r.title,r.id]})) tp3 = number_field_tag("announcement_setting[anns_status_settings][-1][top_limit]",nil, min: 0,required: true) tp4 = "" all_tp = "
#{tp1}
#{tp2}
#{tp3}
#{tp4}
" %>
<%= t("announcement.click_on_submit") %>
<%= form_for @setting, url: (@setting.new_record? ? admin_announcement_createsettings_path : admin_announcement_updatesettings_path), html: {class: "form-horizontal main-forms"} do |f| %>
<%= f.label :top_limit, t("announcement.top_limit"), :class => "control-label muted" %>
<%= f.number_field :top_limit, :min => "0" %> <%= t("announcement.for_unlimited") %>
<%= t('status') %>
<%= t('role') %>
<%= t('announcement.top_limit') %>
<% (AnnouncementSetting.first.anns_status_settings rescue []).each_with_index do |v,i| %>
<%= hidden_field_tag("announcement_setting[anns_status_settings][#{i}][_id]",v.id) %>
<%= select_tag("announcement_setting[anns_status_settings][#{i}][status]",options_for_select(all_statuses,:selected => v['status'])) %>
<%= select_tag("announcement_setting[anns_status_settings][#{i}][role_id]",options_for_select(Role.all.map{|r| [r.title,r.id]},:selected => v['role_id'])) %>
<%= number_field_tag("announcement_setting[anns_status_settings][#{i}][top_limit]",v['top_limit'], min: 0,required: true) %>
<% end %>
<% if AnnouncementSetting.is_pro? %> <% if !sub_managers.blank? %>
<%= f.label "Approver Setting", :class => "control-label muted" %>
<%= t("announcement.approvers_list") %> <%= @setting.approvers.count %>
<% else %>
<%= t("announcement.click_set_sub_manager") %>
<% end %>
<%= f.label "Send emails to", :class => "control-label muted" %>
> <%= t("admin") %> > <%= t("manager") %> > <%= t("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 AnnouncementSetting.is_pro? %> <% end %>