Skip to content

Commit

Permalink
Display saved rated assigments for Tags and Labels
Browse files Browse the repository at this point in the history
  • Loading branch information
lpichler committed Aug 8, 2018
1 parent 5e9f0cd commit 0705b27
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions app/views/chargeback/_cb_assignments.html.haml
Expand Up @@ -48,9 +48,9 @@
- show_type = @edit[:new][:cbshow_typ]
- if !(show_type.ends_with?("-tags") || show_type.ends_with?("-labels")) || @edit[:new][:cbtag_cat].present? || @edit[:new][:cblabel_key].present?
%hr
%h3
= _('Selections')
- if @edit[:new][:cbshow_typ] == "tenant"
%h3
= _('Selections')
%table.table.table-bordered.table-hover.table-treegrid
%thead
%tr
Expand Down Expand Up @@ -84,6 +84,26 @@
:javascript
$('.table-treegrid').treegrid({})
- elsif @edit[:new][:cbshow_typ].ends_with?("-tags")
- if @edit[:current_assignment].try(:first).try(:[], :tag) && "#{@edit[:current_assignment].try(:first).try(:[], :tag).second}-tags" == @edit[:new][:cbshow_typ]
%h3
= _('Saved Items')
%table.table.table-bordered.table-striped
%thead
%tr
%th= _('Tag Category')
%th= _('Tag Name')
%th= _('Rate')
- @edit[:current_assignment].sort_by{|x| x[:tag].first.parent.description }.each do |value|
%tr
%td
= value[:tag].first.parent.description
%td
= value[:tag].first.description
%td
= value[:cb_rate].description
%hr
%h3
= _('Selections')
%table.table.table-bordered.table-striped
%thead
%tr
Expand All @@ -103,6 +123,26 @@
miqInitSelectPicker();
miqSelectPickerEvent("#{@edit[:new][:cbshow_typ]}__#{id}", "#{url}")
- elsif @edit[:new][:cbshow_typ].ends_with?("-labels")
- if @edit[:current_assignment].try(:first).try(:[], :label)
%h3
= _('Saved Items')
%table.table.table-bordered.table-striped
%thead
%tr
%th= _('Section')
%th= _('Label')
%th= _('Rate')
- @edit[:current_assignment].sort_by{|x| x[:label].first.name }.each do |value|
%tr
%td
= value[:label].first.name
%td
= value[:label].first.value
%td
= value[:cb_rate].description
%hr
%h3
= _('Selections')
%table.table.table-bordered.table-striped
%thead
%tr
Expand All @@ -122,6 +162,8 @@
miqInitSelectPicker();
miqSelectPickerEvent("#{@edit[:new][:cbshow_typ]}__#{id}", "#{url}")
- else
%h3
= _('Selections')
%table.table.table-bordered.table-striped
%thead
%tr
Expand Down

0 comments on commit 0705b27

Please sign in to comment.