moser/foxtrot_mike

View on GitHub
app/assets/javascripts/templates/flights/cost.hamlc

Summary

Maintainability
Test Coverage
%span.hint
  = I18n.t("views.cost_comment_age")
%table.table
  %thead
    %tr
      %th= I18n.t("activerecord.models.cost_rule")
      %th= I18n.t("activerecord.attributes.cost_rule.formula")
      %th= I18n.t("activerecord.attributes.cost_rule.value")
  %tbody
    - if @flight.cost && !@flight.cost.empty
      - for item in @flight.cost.items
        %tr
          %td= @flight.cost.cost_rule.name
          %td
            = "#{@flight.raw[item.cost_item.depends_on]()} * #{F.Util.currencyToString(item.cost_item.value)}"
            - if item.cost_item.additive_value != 0
              = " + #{F.Util.currencyToString(item.cost_item.additive_value)}"
          %td= F.Util.currencyToString(item.value)
    - if @flight.launch_type == "tow_launch" && @flight.launch.get("cost") && !@flight.launch.get("cost").empty
      - for item in @flight.launch.get("cost").items
        %tr
          %td= @flight.launch.get("cost").cost_rule.name
          %td
            = "#{@flight.launch[item.cost_item.depends_on]()} * #{F.Util.currencyToString(item.cost_item.value)}"
            - if item.cost_item.additive_value != 0
              = " + #{F.Util.currencyToString(item.cost_item.additive_value)}"
          %td= F.Util.currencyToString(item.value)
    - if @flight.launch_type == "wire_launch" && @flight.launch.get("cost") && !@flight.launch.get("cost").empty
      - for item in @flight.launch.get("cost").items
        %tr
          %td= @flight.launch.get("cost").cost_rule.name
          %td
          %td= F.Util.currencyToString(item.value)
    %tr
      %td= I18n.t("views.sum")
      %td
      %td= F.Util.currencyToString(@flight.cost_free_sum)