<%= form_for @portforwarding_group, as: :portforwarding_group, method: (@portforwarding_group.id.blank? ? "post" : "put"), html: { class: "form-horizontal portforward-group-form" , role: "form"} do |pfg| %>
<%=pfg.fields_for :port_forwardings, @port_forwardings do |f|%>
<% end %>
<%= pfg.label :group_name,"Group Name*".html_safe, :class=>"col-sm-4 control-label" %>
<%= pfg.text_field :group_name, :data => {validation: 'required'}, :class=>"form-control" ,:style => 'width:330px'%>
<% selected_resource = @portforwarding_group.associated_resources %>
<%= render 'shared/resources_dropdown',
field_id: 'portforwarding_resources',
label_text: 'Devices / Device Tags / Network*',
placeholder: 'Type to select Devices / Device Tags / Network',
input_name: 'portforwarding_group[associated_resources][]',
resource_model: @portforwarding_group,
selected_values: selected_resource,
resource_types: 'network,device,tag',
container_class: 'col-sm-10',
label_class: 'col-sm-2 control-label',
custom_class: 'portforwarding-group',
dropdown_width: '330px',
validation_data: { 'validation' => 'required', 'validation-error-msg-container' => '#portforwarding_resource-error' } %>
<%=link_to " Add Port Forwarding Rules".html_safe,"javascript:void(0);", {:class => "btn btn-warning add-nwt-rows pull-right"} %>
<%=label_tag :rule_name, "Rule Name*".html_safe %>
<%=label_tag :protocol, "Protocol*".html_safe %>
<%=label_tag :external_port, "External Port*".html_safe%>
<%=label_tag :ip_address, "IP Address*".html_safe%>
<%=label_tag :internal_port, "Internal Port*".html_safe%>
<%= f.text_field :rule_name, :data => {validation: 'required'},:class=>"form-control rule_name", :placeholder=>"Rule Name"%>
<%= f.select :protocol,['TCP','UDP'],{},{:class=>"form-control protocol"}%>
<%= f.text_field :external_port,:class=>"form-control external_port", :data => {validation: 'required port_group'}, :placeholder=>"External Port"%>
<%= f.text_field :ip_address,:class=>"form-control ip_address ip-mask", :data => {validation: 'required ip'}, :placeholder=>"IP Address"%>
<%= f.text_field :internal_port,:class=>"form-control internal_port", :data => {validation: 'required port_group'}, :placeholder=>"Internal Port"%>
<%= f.hidden_field :id, :class => "pf_id" %>
<%= f.hidden_field :_destroy, :class => "policy_destroy" %>
<%= link_to " X ","javascript:void(0);", {:class => "pull-right icon-delete btn btn-danger"} %>
<%= pfg.submit (@portforwarding_group.id.blank? ? "Create Portforwarding" : "Update Portforwarding"), class: "btn btn-success"%>
<%= link_to 'Cancel', portforwarding_groups_path, :class => "btn btn-primary" %>
<% end %>