[% site_config.title = c.loc('Call Distribution') -%]
[%
    USE date;
    today = date.format(date.now, '%Y-%m-%d');

-%]
    <style>
        #circle circle {
          fill: none;
          pointer-events: all;
        }

        .group path {
          fill-opacity: .5;
        }

        path.chord {
          stroke: #000;
          stroke-width: .25px;
        }

        #circle:hover path.fade {
          display: none;
        }

        svg {
          font: 10px sans-serif;
        }

        .axis path, .axis line {
          fill: none;
          stroke: #000;
          shape-rendering: crispEdges;
        }

    </style>

    <script type="text/javascript" src="/js/libs/d3.v2.min-2.8.1.js"></script>
    <script type="text/javascript" src="/js/libs/ngcp-chord.js"></script>

    <div class="row">
        <span>
            <a class="btn btn-primary btn-large" href="[% c.uri_for('/back') %]"><i class="icon-arrow-left"></i> [% c.loc('Back') %]</a>
        </span>
    </div>
    [% back_created = 1 -%]
    <div class="ngcp-separator"></div>

    <p>[% c.loc('Mouseover on a country name to focus on calls to or from a single country. The thickness of links between countries encodes the relative frequency of calls between two countries: thicker links represent more calls.') %]</p>
    <p>[% c.loc('Links are colored by the more frequent origin. Mouseover on a link to see the direction details.') %]</p>

    <div class="row-fluid" style="margin-top:50px">
        <div class="span3">
            <label>[% c.loc('From Date:') %] <input type="text" id="datepicker_start" class="ngcp-datepicker" rel="tooltip" data-original-title="YYYY-MM-DD" value="[% today %]"/></label>
        </div>
        <div class="span3">
            <label>[% c.loc('To Date:') %] <input type="text" id="datepicker_end" class="ngcp-datepicker" rel="tooltip" data-original-title="YYYY-MM-DD" value="[% today %]"/></label>
        </div>
        <div class="span2">
            <a href="#" id="load-chord" class="btn btn-primary"><i class="icon-repeat" style="padding-top:3px"></i> [% c.loc('Reload') %]</a>
        </div>
    </div>
    <script>
        $('#datepicker_start').datepicker({
            "dateFormat": "yy-mm-dd",
        });
        $('#datepicker_end').datepicker({
            "dateFormat": "yy-mm-dd"
        });
        $('#load-chord').click(function(e) {
            $('svg').remove();
            loadChord();
        });
        // load diagram after document is ready
        $(function() {
            loadChord();
        });
    </script>

    <div class="offset2 span6" id="ngcp-cdr-chord" style="margin-top:20px">
    </div>
[% # vim: set tabstop=4 syntax=html expandtab: -%]
