app/views/chargeback_rate/_tier_first_row.haml
- i = params[:detail_index]
- r = @edit[:new][:details][i.to_i]
- url = url_for_only_path(:action => 'form_field_changed', :id => (@edit[:rec_id] || "new"))
- n = @edit[:new][:num_tiers][i.to_i]
- breakdown_present = @edit[:new][:details].any? { |d| d[:sub_metric].present? }
%tr.rdetail{:id => "rate_detail_row_#{i}_0"}
%td{:rowspan => n.to_s}
= h(rate_detail_group(r[:group]))
%td{:rowspan => n.to_s}
= r[:description]
- if breakdown_present
%td{:rowspan => n.to_s}
- sub_metrics = r[:sub_metrics]
- if sub_metrics.present?
= r[:sub_metric_human]
%td{:rowspan => n.to_s}
= select_tag("per_time_#{i}",
options_for_select(ChargebackRateDetail::PER_TIME_TYPES.map { |x, y| [x, _(y)] }.to_h.invert, @edit[:new][:details][i.to_i][:per_time]),
"data-miq_observe" => {:url => url}.to_json)
- measure = @edit[:new][:details][i.to_i][:detail_measure]
- if measure.nil?
/if the rate detail don't have a metric associated, display the per_unit_display
%td{:rowspan => n.to_s}
= r[:per_unit_display]
- else
/if the rate detail have a metric associated, display an options field with per_unit selected
%td{:rowspan => n.to_s}
= select_tag("per_unit_#{i}", options_for_select(measure[:measures], r[:per_unit]), "data-miq_observe" => {:url => url}.to_json)
= render :partial => 'cb_tier_edit_values', :locals => {:detail_index => i.to_i, :url => url, :row_within_rate => 0}
%td.action-cell
= button_tag(_("Add"),
:class => "btn btn-default",
:alt => t = _("Add a new tier"),
:title => t,
:onclick => "miqAjaxButton('#{url_for_only_path(:action => "tier_add",
:detail_index => i,
:button => "add")}');")