forked from ManageIQ/manageiq-ui-classic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_cb_rate_show.html.haml
91 lines (89 loc) · 3.19 KB
/
_cb_rate_show.html.haml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
= render :partial => 'layouts/flash_msg'
- breakdown_present = @record.chargeback_rate_details.any? { |d| d.sub_metric.present? }
%h3= _('Basic Info')
.form-horizontal
.form-group
%label.col-md-2.control-label
= _('Description')
.col-md-8
%p.form-control-static
= h(@record.description)
.form-group
%label.col-md-2.control-label
= _('Type')
.col-md-8
%p.form-control-static
= h(@record.rate_type)
%hr
%h3= _('Rate Details')
%table.table.table-bordered
%thead
%tr
%th{:rowspan => "2"}= _('Group')
%th{:rowspan => "2"}
= _('Description')
%br
= _('(Column Name in Report)')
- if breakdown_present
%th{:rowspan => '2'}= _('Sub Metric')
%th{:colspan => "2"}= _('Range')
%th{:colspan => "2"}= _('Rate')
%th{:rowspan => "2"}= _('Units')
%tr
%th= _("Start")
%th= _("Finish")
%th= _("Fixed")
%th= _("Variable")
%tbody
/Currency code is the same for all the chargeback_rate_details
- @record.chargeback_rate_details.to_a.sort_by { |rd| [rd.chargeable_field[:group].downcase, rd.chargeable_field[:description].downcase, rd[:sub_metric].to_s.downcase] }.each_with_index do |detail, detail_index|
- tiers = detail.chargeback_tiers.order(:start)
- @cur_group = detail.chargeable_field[:group] if @cur_group.nil?
- if @cur_group != detail.chargeable_field[:group]
- @cur_group = detail.chargeable_field[:group]
%tr
%td.active{:colspan => "9", :style => "background-color: #f5f5f5;"}
- num_tiers = detail.chargeback_tiers.to_a.blank? ? "1" : tiers.to_a.length.to_s
%tr.rdetail
%td{:rowspan => num_tiers}
= h(rate_detail_group(detail.chargeable_field[:group]))
%td{:rowspan => num_tiers}
= detail.chargeable_field[:description]
%br
= Dictionary.gettext(detail.chargeable_field.metric_key, :type => :column, :notfound => :titleize)
- if breakdown_present
%td{:rowspan => num_tiers}
- if detail.sub_metrics.present?
= detail.sub_metric_human
- tier = tiers.first
%td
= tier.start ? tier.start : 0
%td
= tier.finish ? tier.finish : Float::INFINITY.to_s
%td{:align => "right"}
= tier.fixed_rate ? tier.fixed_rate : 0.0
%td{:align => "right"}
= detail[:group] == 'fixed' && tier.variable_rate.zero? ? '-' : tier.variable_rate
%td{:align => "right", :rowspan => num_tiers}
= detail.show_rates
- (1..num_tiers.to_i - 1).each do |tier_index|
- tier = tiers.to_a[tier_index]
%tr.rdetail
%td
= tier.start
%td
= tier.finish
%td{:align => "right"}
= tier.fixed_rate
%td{:align => "right"}
= (detail.chargeable_field[:group] == 'fixed' && tier.variable_rate.zero?) ? '-' : tier.variable_rate
%tr
%td{:colspan => "9"}
:javascript
$('tbody tr.rdetail').hover(
function () {
$("tr[id = '"+this.id+"']").addClass("active");
}, function() {
$("tr[id = '"+this.id+"']").removeClass("active");
}
);