<commit_before>:ruby
  table_dom_id = SecureRandom.hex

#projects_table_actions.btn-group
  - if can? :create, CapitalProject
    = link_to new_capital_project_path, :class => 'btn btn-default' do
      %i.fa.fa-plus.fa-fw
      = " New Capital Project"

.table-responsive
  %table.table.table-condensed.table-hover{:id => table_dom_id, :data => {:toggle => 'table',
    :url => capital_projects_path(format: :json),
    :card_view => "false",
    :pagination => 'true',
    :side_pagination => 'server',
    :show_pagination_switch => 'true',
    :page_number => '1',
    :page_list => "[5, 10, 20, 50, 100, 200]",
    :page_size => current_user.num_table_rows,
    :search => 'false',
    :show_columns => 'true',
    :toolbar => "#projects_table_actions",
    :show_export => 'true',
    :row_style => 'row_style',
    :click_to_select => 'true',
    :query_params => "query_params",
    :show_export => 'true',
    :id_field => 'object_key',
    :export_types => "['csv', 'txt', 'excel']",
    :state_save => 'true',
    :state_save_id_table => "capital_projects_id",
    :state_save_expire => "1y",
    :single_select => 'true',
    :show_footer => 'true'}}
    %thead
      %tr
        - if @organization_list.count > 1
          %th.left{data: {field: 'agency', visible: "#{@organization_list.count > 1}"}} Agency
        %th.center.nowrap{data: {field: 'fy_year'}} FY
        %th.left.nowrap{data: {field: 'project_number'}} Project
        %th.center.nowrap{data: {field: 'scope'}} Scope
        %th.center{data: {field: 'is_emergency', formatter: 'boolean_formatter'}} Emgcy
        %th.center{data: {field: 'is_sogr', formatter: 'boolean_formatter'}} SOGR
        %th.center{data: {field: 'is_notional', formatter: 'boolean_formatter'}} Shadow
        %th.center{data: {field: 'is_multi_year', formatter: 'boolean_formatter'}} Multi Year

        %th.center{data: {field: 'type'}} Type
        %th.left{data: {field: 'title'}} Title
        -#%th.center Status
        %th{data: {field: 'total_cost', formatter: 'currency_formatter', footer_formatter: 'total_cost_formatter', align: 'right'}} Cost

        %th{data: {field: 'state_funds', formatter: 'currency_formatter', footer_formatter: 'total_state_funds_formatter', align: 'right'}} State
        %th{data: {field: 'federal_funds', formatter: 'currency_formatter', footer_formatter: 'total_federal_funds_formatter', align: 'right'}} Federal
        %th{data: {field: 'local_funds', formatter: 'currency_formatter', footer_formatter: 'total_local_funds_formatter', align: 'right'}} Local
        %th{data: {field: 'total_funds', formatter: 'currency_formatter', footer_formatter: 'total_funds_formatter', align: 'right'}} Total

        %th.center.project-icon-column{data: {field: 'popup_content', formatter: 'popup_formatter',footer_formatter: 'empty_footer_formatter'}}
        %th.center.project-icon-column{data: {field: 'has_early_replacement_assets', formatter: 'early_replacement_flag_formatter',footer_formatter: 'empty_footer_formatter'}}


:javascript
  $(document).ready(function() {
    $('#' + '#{table_dom_id}').bootstrapTable('resetWidth');
  });

  var path = '#{capital_project_path("x")}';
  function row_style(row, index) {
    return {
      classes: 'action-path'
    };
  };

  $('#' + '#{table_dom_id}').on('click-row.bs.table', function (e, row, $element) {
    var url = path.replace("x", row['object_key']);
    document.location.href = url;
  }).on('post-body.bs.table', function () {
    $('.transam-popover').popover({
      trigger: 'hover'
    });

    $('.transam-tooltip').tooltip();
  });

  $(window).resize(function() {
    $('#' + '#{table_dom_id}').bootstrapTable('resetView');
  });

  var org_filter = #{@org_filter || []};
  var fiscal_year_filter = #{@fiscal_year_filter || []};
  var capital_project_flag_filter = #{@capital_project_flag_filter || []};
  var capital_project_type_filter = #{@capital_project_type_filter || []};
  var asset_subtype_filter = #{@asset_subtype_filter || []};

  function query_params(params) {
    if(org_filter.length > 0) {
      params.org_filter = org_filter;
    }

    if(fiscal_year_filter.length > 0) {
      params.fiscal_year_filter = fiscal_year_filter;
    }

    if(capital_project_flag_filter.length > 0) {
      params.capital_project_flag_filter = capital_project_flag_filter;
    }

    if(capital_project_type_filter.length > 0) {
      params.capital_project_type_filter = capital_project_type_filter;
    }

    if(asset_subtype_filter.length > 0) {
      params.asset_subtype_filter = asset_subtype_filter;
    }

    return params;
  }

  var formatMoney = function(n, c, d, t) {
    var c = isNaN(c = Math.abs(c)) ? 0 : c,
    d = d == undefined ? "." : d,
    t = t == undefined ? "," : t,
    s = n < 0 ? "-" : "",
    i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
    j = (j = i.length) > 3 ? j % 3 : 0;
    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
  }

  function boolean_formatter(value) {
    if (value) {
      // add hidden div for exporting
      return '<i class="fa fa-check"></i><div style = "visibility: hidden;">Yes</div>';
    } else {
      return '<div style = "visibility: hidden;">No</div>';
    }
  }

  function currency_formatter(value) {
    return "$" + formatMoney(value);
  }

  function popup_formatter(value, data) {
    if(value) {
      return '<a class="transam-popover" data-container="body" data-content="' + value + '" data-html="true" data-placement="left" data-title="' + data.project_number + ': Activity Line Items" data-toggle="popover" tabindex="0" data-original-title="" title=""><i class="fa fa-info-circle fa-1-25x text-info"></i></a>';
    } else {
      return "";
    }
  }

  function early_replacement_flag_formatter(value) {
    if(value) {
      return '<a class="transam-tooltip" data-placement="left" data-title="Contains early replacement assets" data-toggle="tooltip" tabindex="0" data-original-title="" title=""><i class="fa fa-exclamation-triangle" style="color: red !important;"></i></a>';
    } else {
      return "";
    }
  }

  function total_cost_formatter(value) {
    return '#{format_as_currency(@total_projects_cost)}';
  }
  function total_state_funds_formatter(value) {
    return '#{format_as_currency(@projects.total_state_funds)}';
  }
  function total_federal_funds_formatter(value) {
    return '#{format_as_currency(@projects.total_federal_funds)}';
  }
  function total_local_funds_formatter(value) {
    return '#{format_as_currency(@projects.total_local_funds)}';
  }
  function total_funds_formatter(value) {
    return '#{format_as_currency(@projects.total_funds)}';
  }
  function empty_footer_formatter(value) {
    return 'apple';
  }
<commit_msg>[fixes#151499793] fix footer row on capital projs table<commit_after>:ruby
  table_dom_id = SecureRandom.hex

:css
  #capital_projects_table_div .fixed-table-footer {
      border-top: none;
  }

  #capital_projects_table_div .bootstrap-table .fixed-table-footer tbody>tr>td {
      padding: 0 !important;
      border: none;
  }

#projects_table_actions.btn-group
  - if can? :create, CapitalProject
    = link_to new_capital_project_path, :class => 'btn btn-default' do
      %i.fa.fa-plus.fa-fw
      = " New Capital Project"

#capital_projects_table_div.table-responsive
  %table.table.table-condensed.table-hover{:id => table_dom_id, :data => {:toggle => 'table',
    :url => capital_projects_path(format: :json),
    :card_view => "false",
    :pagination => 'true',
    :side_pagination => 'server',
    :show_pagination_switch => 'true',
    :page_number => '1',
    :page_list => "[5, 10, 20, 50, 100, 200]",
    :page_size => current_user.num_table_rows,
    :search => 'false',
    :show_columns => 'true',
    :toolbar => "#projects_table_actions",
    :show_export => 'true',
    :row_style => 'row_style',
    :click_to_select => 'true',
    :query_params => "query_params",
    :show_export => 'true',
    :id_field => 'object_key',
    :export_types => "['csv', 'txt', 'excel']",
    :state_save => 'true',
    :state_save_id_table => "capital_projects_id",
    :state_save_expire => "1y",
    :single_select => 'true',
    :show_footer => 'true'}}
    %thead
      %tr
        - if @organization_list.count > 1
          %th.left{data: {field: 'agency', visible: "#{@organization_list.count > 1}"}} Agency
        %th.center.nowrap{data: {field: 'fy_year'}} FY
        %th.left.nowrap{data: {field: 'project_number'}} Project
        %th.center.nowrap{data: {field: 'scope'}} Scope
        %th.center{data: {field: 'is_emergency', formatter: 'boolean_formatter'}} Emgcy
        %th.center{data: {field: 'is_sogr', formatter: 'boolean_formatter'}} SOGR
        %th.center{data: {field: 'is_notional', formatter: 'boolean_formatter'}} Shadow
        %th.center{data: {field: 'is_multi_year', formatter: 'boolean_formatter'}} Multi Year

        %th.center{data: {field: 'type'}} Type
        %th.left{data: {field: 'title'}} Title
        -#%th.center Status
        %th{data: {field: 'total_cost', formatter: 'currency_formatter', footer_formatter: 'total_cost_formatter', align: 'right'}} Cost

        %th{data: {field: 'state_funds', formatter: 'currency_formatter', footer_formatter: 'total_state_funds_formatter', align: 'right'}} State
        %th{data: {field: 'federal_funds', formatter: 'currency_formatter', footer_formatter: 'total_federal_funds_formatter', align: 'right'}} Federal
        %th{data: {field: 'local_funds', formatter: 'currency_formatter', footer_formatter: 'total_local_funds_formatter', align: 'right'}} Local
        %th{data: {field: 'total_funds', formatter: 'currency_formatter', footer_formatter: 'total_funds_formatter', align: 'right'}} Total

        %th.center.project-icon-column{data: {field: 'popup_content', formatter: 'popup_formatter'}}
        %th.center.project-icon-column{data: {field: 'has_early_replacement_assets', formatter: 'early_replacement_flag_formatter'}}


:javascript
  $(document).ready(function() {
    $('#' + '#{table_dom_id}').bootstrapTable('resetWidth');
  });

  var path = '#{capital_project_path("x")}';
  function row_style(row, index) {
    return {
      classes: 'action-path'
    };
  };

  $('#' + '#{table_dom_id}').on('click-row.bs.table', function (e, row, $element) {
    var url = path.replace("x", row['object_key']);
    document.location.href = url;
  }).on('post-body.bs.table', function () {
    $('.transam-popover').popover({
      trigger: 'hover'
    });

    $('.transam-tooltip').tooltip();
  });

  $(window).resize(function() {
    $('#' + '#{table_dom_id}').bootstrapTable('resetView');
  });

  var org_filter = #{@org_filter || []};
  var fiscal_year_filter = #{@fiscal_year_filter || []};
  var capital_project_flag_filter = #{@capital_project_flag_filter || []};
  var capital_project_type_filter = #{@capital_project_type_filter || []};
  var asset_subtype_filter = #{@asset_subtype_filter || []};

  function query_params(params) {
    if(org_filter.length > 0) {
      params.org_filter = org_filter;
    }

    if(fiscal_year_filter.length > 0) {
      params.fiscal_year_filter = fiscal_year_filter;
    }

    if(capital_project_flag_filter.length > 0) {
      params.capital_project_flag_filter = capital_project_flag_filter;
    }

    if(capital_project_type_filter.length > 0) {
      params.capital_project_type_filter = capital_project_type_filter;
    }

    if(asset_subtype_filter.length > 0) {
      params.asset_subtype_filter = asset_subtype_filter;
    }

    return params;
  }

  var formatMoney = function(n, c, d, t) {
    var c = isNaN(c = Math.abs(c)) ? 0 : c,
    d = d == undefined ? "." : d,
    t = t == undefined ? "," : t,
    s = n < 0 ? "-" : "",
    i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
    j = (j = i.length) > 3 ? j % 3 : 0;
    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
  }

  function boolean_formatter(value) {
    if (value) {
      // add hidden div for exporting
      return '<i class="fa fa-check"></i><div style = "visibility: hidden;">Yes</div>';
    } else {
      return '<div style = "visibility: hidden;">No</div>';
    }
  }

  function currency_formatter(value) {
    return "$" + formatMoney(value);
  }

  function popup_formatter(value, data) {
    if(value) {
      return '<a class="transam-popover" data-container="body" data-content="' + value + '" data-html="true" data-placement="left" data-title="' + data.project_number + ': Activity Line Items" data-toggle="popover" tabindex="0" data-original-title="" title=""><i class="fa fa-info-circle fa-1-25x text-info"></i></a>';
    } else {
      return "";
    }
  }

  function early_replacement_flag_formatter(value) {
    if(value) {
      return '<a class="transam-tooltip" data-placement="left" data-title="Contains early replacement assets" data-toggle="tooltip" tabindex="0" data-original-title="" title=""><i class="fa fa-exclamation-triangle" style="color: red !important;"></i></a>';
    } else {
      return "";
    }
  }

  function total_cost_formatter(value) {
    return '#{format_as_currency(@total_projects_cost)}';
  }
  function total_state_funds_formatter(value) {
    return '#{format_as_currency(@projects.total_state_funds)}';
  }
  function total_federal_funds_formatter(value) {
    return '#{format_as_currency(@projects.total_federal_funds)}';
  }
  function total_local_funds_formatter(value) {
    return '#{format_as_currency(@projects.total_local_funds)}';
  }
  function total_funds_formatter(value) {
    return '#{format_as_currency(@projects.total_funds)}';
  }

{'fraction_non_alphanumeric': 0.171989814477992, 'fraction_numerical': 0.006111313204801746, 'mean_word_length': 3.942826321467098, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 103, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '819225', 'n_tokens_mistral': 4890, 'n_tokens_neox': 4634, 'n_words': 845}