<%= form_for(alert, as: :alert, method: alert.new_record? ? :post : :put, html: { class: "form-horizontal alerts-form" , role: "form"}) do |f| %>

Alert - <%= alert.new_record? ? "New" : "Edit" %>

<%= f.label 'Alert Name', :class => "col-sm-2 control-label" %>
<%= f.text_field :name,:placeholder => "Alert Name", :class => "form-control", :data => { validation: 'required'} %>
<%= f.label 'Subject', :class => "col-sm-2 control-label" %>
<%= f.text_field :subject,:maxlength => 255, :placeholder => "Subject", :class => "form-control", :data => { validation: 'required'} %> Note: Use {} tag for access device data. Possible data are listed here:
{ap_mac} = Device MAC address
{client_mac} = Client MAC address
{value} = Value from alert criteria
{ssid} = SSID name
{uplink_name} = Uplink Name
{network_name} = Network Name
{device_name} = Device Name
<%= f.label 'Message', :class => "col-sm-2 control-label" %>
<%= f.text_area :message, :class => "form-control", :rows => 3, :data => { validation: 'required'} %> Note: Use {} tag for access device data. Possible data are listed here:
{ap_mac} = Device MAC address
{client_mac} = Client MAC address
{value} = Value from alert criteria
{ssid} = SSID name
{uplink_name} = Uplink Name
{network_name} = Network Name
{device_name} = Device Name
<%= f.label 'Category', :class => "col-sm-2 control-label" %>
<%= f.select :category, [['Device Alert', 'router'], ['Client Alert', 'client'],['Network Alert','network'], ['Activity Alert', 'activity']], {}, :class => "form-control" %>
<%= hidden_field_tag 'hb_freq',@current_network.hb_freq%>
  • <%= f.radio_button(:severity_color, "#e93400", :id => "colorDanger") %>
  • <%= f.radio_button(:severity_color, "#8ece5a", :id => "colorInfo") %>
  • <%= f.radio_button(:severity_color, "#56c8f3", :id => "colorSuccess") %>
  • <%= f.radio_button(:severity_color, "#ffaa3a", :id => "colorWarning") %>
<%= f.text_field :tag_list ,:class=>"form-control tag_list"%>
<%= f.fields_for :alert_rules do |rule| %>
<%= f.label 'Rules', :class => "col-sm-2 control-label" %>
<%= rule.select :alert_on, AlertRule::ALERT_ON.values.flatten, {}, :class => "form-control rule_alert_on" %>
<%= rule.select :condition, AlertRule::ALERT_CONDITION.to_a, {}, :class => "form-control rule_condition" %>
<%= rule.text_field :value, :class => "form-control rule_value", :data => { :validation => 'required phone-only-integer'} %>
<% end -%>
<%= f.select :notification_group_ids, grouped_options_for_select(@noti_group.map{|p| [p[2], [p[1],p[0]]]}.group_by {|s| s.first}.map {|d| [d.first, d.last.map(&:last)]}, alert.notification_group_ids), {}, :class=>"form-control tag_list_actions","data-validation" => "required", :multiple => true %>
<%= f.submit alert.new_record? ? "Create Alert" : "Update Alert", :class => "btn btn-success" %> <%= link_to "Cancel", alerts_path, :class => "btn btn-primary" %>
<% end %>