<%= form_for @subscription, :html => {:class => 'form-horizontal'} do |f| %> <%= f.hidden_field :bundle_id %> <%= f.hidden_field :account_id %> <%= f.hidden_field :product_category %> <% if @subscription.product_category == 'ADD_ON' %> <%= hidden_field_tag :base_product_name, @base_product_name %> <% elsif @subscription.product_category == 'BASE' %>
<%= f.label :bundle_external_key, 'Bundle Key', :class => 'col-sm-2 control-label' %>
<%= f.text_field :bundle_external_key, :class => 'form-control', :id => 'bundle_external_key' %>
Warning! External key already in use.
<% end %>
<%= f.label :subscription_external_key, 'Subscription Key', :class => 'col-sm-2 control-label' %>
<%= f.text_field :external_key, :class => 'form-control', :id => 'subscription_external_key' %>
Warning! External key already in use.
<%= label_tag :plan_name, 'Plan', :class => 'col-sm-2 control-label' %>
<%= select_tag :plan_name, options_for_select(@plans), :class => 'form-control' %>
<%= label_tag :price_override, 'Price Override', :class => 'col-sm-2 control-label' %>
<%= number_field_tag :price_override, nil, :class => 'form-control' %>
<%= label_tag :type_change do %> <%= radio_button_tag :type_change, 'IMM', :checked => true %> Immediate Creation <% end %>
<%= label_tag :type_change do %> <%= radio_button_tag :type_change, 'DATE' %> Specify a date <% end %>
<%= label_tag :requested_date, 'Date', :class => 'col-sm-2 control-label' %>
<%= text_field_tag :requested_date, Date.parse(Time.now.to_s).to_s, :class => 'form-control date-picker' %>
<%= submit_tag 'Save', :class => 'btn btn-default' %>
<% end %> <%= javascript_tag do %> function onTypeChange() { var value = $("input[type=radio]:checked").val(); if (value == "IMM") { $("#form_requested_date").hide(); } else if (value == "DATE") { $("#form_requested_date").show(); } } $(document).ready(function() { onTypeChange(); $( "input[type=radio]").on("click", function() { onTypeChange(); }); }); <% end %>