<commit_before>-extends "frame.haml"

-load temba compress
-load i18n

-block page-top

-block html-tag
  <html lang="en" ng-app="analytics">

-block content
  #scope{ ng-controller:"FieldController", ng-cloak:''}
    #controls{ ui-scrollfix:"-15" }
      %h5{ ng-show:"reports.length > 0"}
        -trans "Reports"

      %ul.reports.nav.nav-list.level1{ng-show:"reports.length > 0"}
        %li.report{ng-repeat:'report in reports | orderBy:"-text"', ng-class:'{active:report.id == currentReport.id, inactive: report.id != currentReport.id}'}
          %a.report-label{ng-click:'showReport(report)'} [[report.text]]

      #field-selector{ style:"width:95%" }

      %h5{ ng-show:"filters.length > 0"}
        -trans "Filters"
      %ul.filters
        %li.filter{ng-repeat:"filter in filters track by $index", ng-class:"{inactive:!filter.isActive, active:filter.isActive}" }
          %span.icon.type{ ng-click:"toggleFilter(filter)"} &#xe057;
          %span.icon.field-button{ ng-click:"removeFilter(filter)" } &#xe058;
          %span.filter-label{ ng-click:"toggleFilter(filter)"} [[filter.label]]

          %ul.filter-categories
            <li ng-animate="'slide'" ng-show="filter.isGroupFilter && filter.isActive" class="filter-category field-visible-[[filter.isGroupFilter && filter.showAllContacts]]">
              %span.icon.field-visible-check{ ng-click:"activateAllContacts($event, filter)" }
                %span All Contacts
            </li>

            <li ng-animate="'slide'" ng-show="filter.isActive" ng-repeat="category in filter.categories" class="filter-category field-visible-[[category.isFilter]]">
              %span.icon.field-visible-check{ ng-click:"toggleCategoryFilter($event, filter, category.label)" }
                %span [[ category.label ]]
            </li>

      %h5{ ng-show:"segments.length > 0"}
        -trans "Segment Variable"
      %ul.segments
        %li.segment.field{ ng-repeat:"segment in segments", ng-class:"{inactive:!segment.isSegment, active:segment.isSegment}"}
          %span.icon.field-button{ ng-click:"removeSegment(segment)" } &#xe058;
          %span.icon.type{ ng-click:"toggleSegment(segment)"} &#xe014;
          %span.segment-label{ ng-click:"toggleSegment(segment)"} [[segment.label]]
          %ul.segment-categories
            <li ng-animate="'slide'" ng-show="segment.isSegment" ng-repeat="category in segment.categories" class="segment-category field-visible-[[category.isSegment]]">
              %span.icon.field-visible-check{ ng-click:"toggleCategorySegment($event, segment, category.label)" }
                // {style:"background-color:[[category.color]]"}
                %span.segment-category-label [[ category.label ]]
            </li>

      %h5{ ng-show:"fields.length > 0"}
        -trans "Charts"
      %ul.fields{ ng-model:"fields", ui-sortable:"true" }
        %li.field{ ng-repeat:"field in fields", class:"field-visible-[[field.isVisible && field.isLoaded]]" }
          %span.icon.field-button{ ng-click:"remove(field)", ng-show:"field.isLoaded"} &#xe058;
          %span.icon.field-button{ ng-click:"addFilter(field)", ng-show:"field.isLoaded"} &#xe057;
          %span.icon.field-button{ ng-click:"addSegment(field)", ng-show:"field.isLoaded"} &#xe014;
          %span.field-loading{ ng-show:"!field.isLoaded"}
          %span.icon.field-visible-check{ ng-click:"toggleVisibility(field)" }
          %span.field-label [[field.label]]

      %ul.fields{ ng-show:"groups.length > 0 && fields.length > 0"}
        %li.field.field-visible-check
          %span.icon.field-button{ ng-click:"addGroupFilter()"} &#xe057;
          %span.icon.field-button{ ng-click:"addGroupSegment()"} &#xe014;
          %h5 Contact Groups


    .results
      .preview{ ng-show:"fields.length == 0"}
        .samples.by-responses{ng-model:"flows"}
          %h2
            -trans "Most Active"
          .flow{ng-repeat:'flow in flows | orderBy:"-stats.contacts" | limitTo:4 '}
            .message-count{ ng-click: 'addFlowFields(flow)' }
              [[flow.stats.contacts]]
              .message-label
                <ng-pluralize count="flow.stats.contacts" when="{'0': '{% trans "contacts" %}', 'one': '{% trans "contact" %}', 'other': '{% trans "contacts" %}' }">
                </ng-pluralize>

            .flow-name{ ng-click: 'addFlowFields(flow)' }
              [[flow.text]]
            .field-count
              <ng-pluralize count="flow.rules.length" when="{'0': '{% trans "No fields." %}', 'one': '{% trans "1 field" %}', 'other': '{% trans "{} fields" %}' }">
              </ng-pluralize>
            .last-message
              {% trans "Created on" %}
              [[ flow.stats.created_on | date:'mediumDate']]

        .samples.by-recency{ng-model:"flows"}
          %h2
            -trans "Most Recent"
          .flow{ng-repeat:'flow in flows | orderBy:"-stats.created_on" | limitTo:4 ', data:'[[flow.id]]'}
            .message-count{ ng-click: 'addFlowFields(flow)' }
              [[flow.stats.contacts]]
              .message-label
                <ng-pluralize count="flow.stats.contacts" when="{'0': '{% trans "contacts" %}', 'one': '{% trans "contact" %}', 'other': '{% trans "contacts" %}' }">
                </ng-pluralize>

            .flow-name{ ng-click: 'addFlowFields(flow)' }
              [[flow.text]]
            .field-count
              <ng-pluralize count="flow.rules.length" when="{'0': '{% trans "No fields." %}', 'one': '{% trans "1 field" %}', 'other': '{% trans "{} fields" %}' }">
              </ng-pluralize>
            .last-message
              {% trans "Created on" %}
              [[ flow.stats.created_on | date:'mediumDate']]

      - if org_perms.reports.report_create
        %h2.current-report-title{ ng-show:"currentReport"}
          %a.btn.btn-primary.pull-right{ ng-show:"fields.length > 0", ng-click: "showSaveReportModal()"}
            New Report

          %a#rename-btn.pull-right.btn.btn-primary{ ng-click:'showSaveReportModal(currentReport)'}
            [[renameButtonText]]
          #dirty-notification.pre.alert.pull-right{ ng-show:"dirty"}
            Unsaved changes!
          .current-report-label
            [[currentReport.text]]

          .current-report-description
            [[currentReport.description]]

        %h2.current-report-title{ ng-show:"!currentReport"}
          %a.btn.btn-primary.pull-right{ ng-show:"fields.length > 0", ng-click: "showSaveReportModal()"}
            New Report

      %ul.charts{ ng-model:"fields", ui-sortable:"true" }

        %li.chart-container{ ng-repeat:"field in fields | filter:{ isVisible: true, isLoaded: true }", class:'selection-[[field.chartType]] chart-container-size-[[field.chartSize]]'}
          %h2.chart-title
            .chart-title-responses [[field.total]]
              -trans "responses"
            [[field.label]]

          .chart-options
            -if org_supports_map
              .chart-table.glyph.chart-button.icon-earth{ ng-click:'toggleChoropleth(field)', ng-class:'{active:field.showChoropleth==true}'}
            .chart-table.glyph.chart-button.icon-menu-2{ ng-click:'toggleDataTable(field)', ng-class:'{active:field.showDataTable==true}'}

            .chart-types
              %div{ ng-click:'setChartType(field, chartType.type)', ng-repeat:'chartType in chartTypes', ng-class:"{selected:field.chartType==chartType.type}", class:'glyph chart-button [[chartType.icon]] option-[[chartType.type]]'}

            .chart-sizes
              %span.chart-size.chart-size-1{ ng-click:'setChartSize(field, 1)', ng-class:"{active:field.chartSize==1}" } &nbsp;
              %span.chart-size.chart-size-2{ ng-click:'setChartSize(field, 2)', ng-class:"{active:field.chartSize==2}" } &nbsp;

          -if org_supports_map
            .choropleth-map{ng-show:'field.showChoropleth', choropleth:'', id:'choropleth-[[field.id]]', show-choropleth:'field.showChoropleth', chart-size:'field.chartSize', osm-id:'"{{user_org.country.osm_id}}"', rule-id:'[[field.id]]'}

          %chart{config:'field.chart'}
          %datatable{config:'field.table'}


    - if org_perms.reports.report_create
      .creation.hide
        .title
          -trans "Save Report"

        .body
          %form.smartmin-form.form-horizontal{method:"post", enctype:"multipart/form-data"}
            %fieldset
              .control-group
                %label.control-label
                  Title
                .controls
                  %input#id_title{maxlength:"64", name:"title", type:"text"}
                  %p.help-block
                    The title of this report

              .control-group
                %label.control-label
                  Description
                .controls
                  %textarea#id_description{name:"description", rows:"5", cols:"40"}
                  %p.help-block
                    The full description for the report
<commit_msg>Fix angular maps not display due to 1.2 change<commit_after>-extends "frame.haml"

-load temba compress
-load i18n

-block page-top

-block html-tag
  <html lang="en" ng-app="analytics">

-block content
  #scope{ ng-controller:"FieldController", ng-cloak:''}
    #controls{ ui-scrollfix:"-15" }
      %h5{ ng-show:"reports.length > 0"}
        -trans "Reports"

      %ul.reports.nav.nav-list.level1{ng-show:"reports.length > 0"}
        %li.report{ng-repeat:'report in reports | orderBy:"-text"', ng-class:'{active:report.id == currentReport.id, inactive: report.id != currentReport.id}'}
          %a.report-label{ng-click:'showReport(report)'} [[report.text]]

      #field-selector{ style:"width:95%" }

      %h5{ ng-show:"filters.length > 0"}
        -trans "Filters"
      %ul.filters
        %li.filter{ng-repeat:"filter in filters track by $index", ng-class:"{inactive:!filter.isActive, active:filter.isActive}" }
          %span.icon.type{ ng-click:"toggleFilter(filter)"} &#xe057;
          %span.icon.field-button{ ng-click:"removeFilter(filter)" } &#xe058;
          %span.filter-label{ ng-click:"toggleFilter(filter)"} [[filter.label]]

          %ul.filter-categories
            <li ng-animate="'slide'" ng-show="filter.isGroupFilter && filter.isActive" class="filter-category field-visible-[[filter.isGroupFilter && filter.showAllContacts]]">
              %span.icon.field-visible-check{ ng-click:"activateAllContacts($event, filter)" }
                %span All Contacts
            </li>

            <li ng-animate="'slide'" ng-show="filter.isActive" ng-repeat="category in filter.categories" class="filter-category field-visible-[[category.isFilter]]">
              %span.icon.field-visible-check{ ng-click:"toggleCategoryFilter($event, filter, category.label)" }
                %span [[ category.label ]]
            </li>

      %h5{ ng-show:"segments.length > 0"}
        -trans "Segment Variable"
      %ul.segments
        %li.segment.field{ ng-repeat:"segment in segments", ng-class:"{inactive:!segment.isSegment, active:segment.isSegment}"}
          %span.icon.field-button{ ng-click:"removeSegment(segment)" } &#xe058;
          %span.icon.type{ ng-click:"toggleSegment(segment)"} &#xe014;
          %span.segment-label{ ng-click:"toggleSegment(segment)"} [[segment.label]]
          %ul.segment-categories
            <li ng-animate="'slide'" ng-show="segment.isSegment" ng-repeat="category in segment.categories" class="segment-category field-visible-[[category.isSegment]]">
              %span.icon.field-visible-check{ ng-click:"toggleCategorySegment($event, segment, category.label)" }
                // {style:"background-color:[[category.color]]"}
                %span.segment-category-label [[ category.label ]]
            </li>

      %h5{ ng-show:"fields.length > 0"}
        -trans "Charts"
      %ul.fields{ ng-model:"fields", ui-sortable:"true" }
        %li.field{ ng-repeat:"field in fields", class:"field-visible-[[field.isVisible && field.isLoaded]]" }
          %span.icon.field-button{ ng-click:"remove(field)", ng-show:"field.isLoaded"} &#xe058;
          %span.icon.field-button{ ng-click:"addFilter(field)", ng-show:"field.isLoaded"} &#xe057;
          %span.icon.field-button{ ng-click:"addSegment(field)", ng-show:"field.isLoaded"} &#xe014;
          %span.field-loading{ ng-show:"!field.isLoaded"}
          %span.icon.field-visible-check{ ng-click:"toggleVisibility(field)" }
          %span.field-label [[field.label]]

      %ul.fields{ ng-show:"groups.length > 0 && fields.length > 0"}
        %li.field.field-visible-check
          %span.icon.field-button{ ng-click:"addGroupFilter()"} &#xe057;
          %span.icon.field-button{ ng-click:"addGroupSegment()"} &#xe014;
          %h5 Contact Groups


    .results
      .preview{ ng-show:"fields.length == 0"}
        .samples.by-responses{ng-model:"flows"}
          %h2
            -trans "Most Active"
          .flow{ng-repeat:'flow in flows | orderBy:"-stats.contacts" | limitTo:4 '}
            .message-count{ ng-click: 'addFlowFields(flow)' }
              [[flow.stats.contacts]]
              .message-label
                <ng-pluralize count="flow.stats.contacts" when="{'0': '{% trans "contacts" %}', 'one': '{% trans "contact" %}', 'other': '{% trans "contacts" %}' }">
                </ng-pluralize>

            .flow-name{ ng-click: 'addFlowFields(flow)' }
              [[flow.text]]
            .field-count
              <ng-pluralize count="flow.rules.length" when="{'0': '{% trans "No fields." %}', 'one': '{% trans "1 field" %}', 'other': '{% trans "{} fields" %}' }">
              </ng-pluralize>
            .last-message
              {% trans "Created on" %}
              [[ flow.stats.created_on | date:'mediumDate']]

        .samples.by-recency{ng-model:"flows"}
          %h2
            -trans "Most Recent"
          .flow{ng-repeat:'flow in flows | orderBy:"-stats.created_on" | limitTo:4 ', data:'[[flow.id]]'}
            .message-count{ ng-click: 'addFlowFields(flow)' }
              [[flow.stats.contacts]]
              .message-label
                <ng-pluralize count="flow.stats.contacts" when="{'0': '{% trans "contacts" %}', 'one': '{% trans "contact" %}', 'other': '{% trans "contacts" %}' }">
                </ng-pluralize>

            .flow-name{ ng-click: 'addFlowFields(flow)' }
              [[flow.text]]
            .field-count
              <ng-pluralize count="flow.rules.length" when="{'0': '{% trans "No fields." %}', 'one': '{% trans "1 field" %}', 'other': '{% trans "{} fields" %}' }">
              </ng-pluralize>
            .last-message
              {% trans "Created on" %}
              [[ flow.stats.created_on | date:'mediumDate']]

      - if org_perms.reports.report_create
        %h2.current-report-title{ ng-show:"currentReport"}
          %a.btn.btn-primary.pull-right{ ng-show:"fields.length > 0", ng-click: "showSaveReportModal()"}
            New Report

          %a#rename-btn.pull-right.btn.btn-primary{ ng-click:'showSaveReportModal(currentReport)'}
            [[renameButtonText]]
          #dirty-notification.pre.alert.pull-right{ ng-show:"dirty"}
            Unsaved changes!
          .current-report-label
            [[currentReport.text]]

          .current-report-description
            [[currentReport.description]]

        %h2.current-report-title{ ng-show:"!currentReport"}
          %a.btn.btn-primary.pull-right{ ng-show:"fields.length > 0", ng-click: "showSaveReportModal()"}
            New Report

      %ul.charts{ ng-model:"fields", ui-sortable:"true" }

        %li.chart-container{ ng-repeat:"field in fields | filter:{ isVisible: true, isLoaded: true }", class:'selection-[[field.chartType]] chart-container-size-[[field.chartSize]]'}
          %h2.chart-title
            .chart-title-responses [[field.total]]
              -trans "responses"
            [[field.label]]

          .chart-options
            -if org_supports_map
              .chart-table.glyph.chart-button.icon-earth{ ng-click:'toggleChoropleth(field)', ng-class:'{active:field.showChoropleth==true}'}
            .chart-table.glyph.chart-button.icon-menu-2{ ng-click:'toggleDataTable(field)', ng-class:'{active:field.showDataTable==true}'}

            .chart-types
              %div{ ng-click:'setChartType(field, chartType.type)', ng-repeat:'chartType in chartTypes', ng-class:"{selected:field.chartType==chartType.type}", class:'glyph chart-button [[chartType.icon]] option-[[chartType.type]]'}

            .chart-sizes
              %span.chart-size.chart-size-1{ ng-click:'setChartSize(field, 1)', ng-class:"{active:field.chartSize==1}" } &nbsp;
              %span.chart-size.chart-size-2{ ng-click:'setChartSize(field, 2)', ng-class:"{active:field.chartSize==2}" } &nbsp;

          -if org_supports_map
            .choropleth-map{ng-if:'field.showChoropleth', choropleth:'', id:'choropleth-[[field.id]]', show-choropleth:'field.showChoropleth', chart-size:'field.chartSize', osm-id:'"{{user_org.country.osm_id}}"', rule-id:'[[field.id]]'}

          %chart{config:'field.chart'}
          %datatable{config:'field.table'}

    - if org_perms.reports.report_create
      .creation.hide
        .title
          -trans "Save Report"

        .body
          %form.smartmin-form.form-horizontal{method:"post", enctype:"multipart/form-data"}
            %fieldset
              .control-group
                %label.control-label
                  Title
                .controls
                  %input#id_title{maxlength:"64", name:"title", type:"text"}
                  %p.help-block
                    The title of this report

              .control-group
                %label.control-label
                  Description
                .controls
                  %textarea#id_description{name:"description", rows:"5", cols:"40"}
                  %p.help-block
                    The full description for the report

{'fraction_non_alphanumeric': 0.17323848997423547, 'fraction_numerical': 0.008401478660244203, 'mean_word_length': 2.4303554274735832, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 51, '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': '960947', 'n_tokens_mistral': 5603, 'n_tokens_neox': 5380, 'n_words': 850}