{% extends 'base.html.twig' %}
{% block title %}IAI{% endblock %}
{% block body %}
{# dump(response) #}
{#<div class="tutorial">
<a href="javascript:void(0);" id="startTutBtn">Start Tutorial</a>
</div>#}
<div class="container-fluid">
<form name="form" method="post" id="filterForm">
<div class="row">
<div class="col-12">
<h1 id="title"><span class="primary-title">ALUMINIUM SECTOR TRADE FLOWS</span></h1>
<h2 id="sectitle"><span class="secondary-title">{{ title }}</span></h2>
</div>
<div class="col-9">
<canvas id="canvas"></canvas>
<div class="products row fboxProducts" style="border-width: 1px; border-style: solid; border-color: #495057; margin-left: 12px; padding: 12px; border-radius: 15px;">
<div class="col-2"><span class="contextTitle">Products</span>
<a href="javascript:;" class="selectall">Select All</a>
<a href="javascript:;" class="deselectall">Deselect All</a>
</div>
<div id="legend-container" class="col-8">
{#
<a href="javascript:;" data-name="Alumina" data-id="7601" class="picon alumina activated"></a>
<a href="javascript:" data-name="Aluminium" data-id="7602" class="picon aluminium activated active"></a>
<a href="javascript:" data-name="Bauxite" data-id="7603" class="picon bauxite activated"></a>
<a href="javascript:" data-name="Extrusion" class="picon extrusion activated"></a>
<a href="javascript:" data-name="Foil" class="picon foil3 activated"></a>
<a href="javascript:" data-name="Rolled" class="picon rolled_products activated"></a>
<a href="javascript:" data-name="Scrap" class="picon scrap activated"></a>
#}
</div>
<div class="col-2">
<span class="desc_right">Please select the product icon/s that you would like to see data for. Greyed out product icon/s do not have a data set available.</span>
</div>
</div>
<br /><br />
<span style="font-size: 12px;">Trade Flow Visualization provided by the <a href="https://www.international-aluminium.org" target="_blank">International Aluminium Institute</a> | Data source: <a href="https://comtrade.un.org/" target="_blank">UNComtrade and International Trade Centre</a>.</span>
</div>
<div class="col-3 contextCol">
<div class="fboxTradeVisu">
<span class="contextTitle">Trade Visualization
<a href="#" id="tradeTglr" class="qicon popover-toggle" title="Trade Visualization"><i class="bi bi-question-circle-fill"></i></a>
<div id="tradeContent" style="display: none">
This visualisation aims to increase transparency of aluminium specific trade between countries. The data is shown in kilograms for bauxite, alumina, aluminium, scrap, rolled products, extrusions and foil. Annual data is based on <a class="popoverlink" href="https://comtrade.un.org/" target="_blank">UN Comtrade Database</a> and monthly data on <a href="https://www.trademap.org" class="popoverlink" target="_blank">International Trade Centre</a>.
</div>
</span>
<div class="filterbox tradeVisu">
<div class="row iconRow">
{#<div class="col-2">
<a href="" class="chartIcon">
<svg width="2em" height="2em" viewBox="0 0 16 16" class="bi bi-bar-chart-steps" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M.5 0a.5.5 0 0 1 .5.5v15a.5.5 0 0 1-1 0V.5A.5.5 0 0 1 .5 0z"/>
<rect width="5" height="2" x="2" y="1" rx=".5"/>
<rect width="8" height="2" x="4" y="5" rx=".5"/>
<path d="M6 9.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-6a.5.5 0 0 1-.5-.5v-1zm2 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-1z"/>
</svg>
</a>
</div>#}
<div class="col-2">
<a href="" class="chartIcon active">
<svg width="2em" height="2em" viewBox="0 0 16 16" class="bi bi-bar-chart-line" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M11 2a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v12h.5a.5.5 0 0 1 0 1H.5a.5.5 0 0 1 0-1H1v-3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v3h1V7a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v7h1V2zm1 12h2V2h-2v12zm-3 0V7H7v7h2zm-5 0v-3H2v3h2z"/>
</svg>
</a>
</div>
<!--div class="col-4">
Treemap
</div-->
</div>
</div>
</div>
<div class="fboxImportExport">
<span class="contextTitle">Import/Export</span>
<div class="filterbox filterbox-noborder imexport">
<div data-toggle="buttons">
<label class="btn btn-secondary">
{{ form_widget(filterForm.export) }}
</label>
<label class="btn btn-secondary">
{{ form_widget(filterForm.import) }}
</label>
<label class="btn btn-secondary">
{{ form_widget(filterForm.nettrade) }}
</label>
</div>
</div>
</div>
<div class="fboxInterval">
<div class="filterbox filterbox-noborder interval">
<span class="contextTitle">Interval</span>
<div class="filterbox monthanu">
{{ form_widget(filterForm.monthly_annual, { 'disabled': 'disabled' }) }}
</div>
</div>
</div>
<div class="filterbox filterbox-noborder country fboxCountry">
<span class="contextTitle">Country
<a href="#" id="countryTglr" class="qicon popover-toggle" title="Country"><i class="bi bi-question-circle-fill"></i></a>
<div id="countryContent" style="display: none">
To view, please follow these steps:
<ol>
<li>chose the country you would like to visualise the trade for;</li>
<li>chose the trading partner; and</li>
<li>chose whether you would like the data reported by the country you are visualising or its trading partner. </li>
</ol>
</div>
</span>
<div class="filterbox country">
<div class="selectfilterbox">
{{ form_label(filterForm.reporter) }}
{{ form_widget(filterForm.reporter) }}
</div>
<div class="selectfilterbox">
{{ form_label(filterForm.tradingpartner) }}
{{ form_widget(filterForm.tradingpartner) }}
</div>
<div class="selectfilterbox">
{{ form_label(filterForm.reportingcountry) }}
{{ form_widget(filterForm.reportingcountry) }}
</div>
</div>
</div>
<div class="filterbox filterbox-noborder period fboxPeriod">
<span class="contextTitle">Period
<a href="#" id="periodTglr" class="qicon popover-toggle" title="Country"><i class="bi bi-question-circle-fill"></i></a>
<div id="periodContent" style="display: none">
Chose a period for the data.
</div>
</span>
<div class="filterbox period">
<div class="selectfilterbox">
<div class="input-group input-daterange">
{{ form_widget(filterForm.periodFrom ) }} {# { 'disabled': 'disabled' } #}
<span class="input-group-addon">to</span>
{{ form_widget(filterForm.periodTo ) }} {# { 'disabled': 'disabled' } #}
</div>
</div>
{#<div class="selectfilterbox disabled">
{{ form_label(filterForm.to) }}
{{ form_widget(filterForm.to, { 'disabled': 'disabled' }) }}
</div>#}
</div>
</div>
<div class="filterbox filterbox-noborder country fboxDownload">
<span class="contextTitle">Data Download
<a href="#" id="downloadTglr" class="qicon popover-toggle" title="Data Download"><i class="bi bi-question-circle-fill"></i></a>
<div id="downloadContent" style="display: none">
Download the filtered data as CSV to use it in Excel.
</div>
</span>
<div class="filterbox download">
{{ form_widget(filterForm.download, { 'attr': {'class': 'btn-secondary'} }) }}
</div>
</div>
</div>
</div>
</form>
</div>
<div style="clear: both;"></div>
<style>
canvas {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
{% if isFirstRequest %}
canvas, .products.row {
opacity: 0.4;
}
{% endif %}
</style>
{#<script src="{{ app.request.getSchemeAndHttpHost() }}/members/trade/public/js/Chart_3.4.1.js"></script>#}
{#<script src="/members/trade/public/js/Chart_2.9.4.js"></script>#}
{#<script src="https://cdn.jsdelivr.net/npm/chart.js@3.4.1/dist/chart.min.js"></script>#}
{#<script src="https://cdn.jsdelivr.net/npm/chart.js@3.9.0/dist/chart.min.js"></script>#}
{#<script src="{{ app.request.getSchemeAndHttpHost() }}/members/trade/public/js/d3.min.js"></script>#}
{# dump(filterForm.vars.value.import ) #}
<script src="{{ app.request.getSchemeAndHttpHost() }}/members/trade/public/js/data.js"></script>
{#<script src="{{ app.request.getSchemeAndHttpHost() }}/members/trade/public/js/data_test.js"></script>#}
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
<script src="{{ app.request.getSchemeAndHttpHost() }}/members/trade/public/js/chart.js-3.9.0/dist/chart.js"></script>
<script src="{{ app.request.getSchemeAndHttpHost() }}/members/trade/public/js/bootstrap-datepicker-1.9.0-dist/js/bootstrap-datepicker.min.js"></script>
<script src="{{ app.request.getSchemeAndHttpHost() }}/members/trade/public/js/moment-with-locales.js"></script>
<script src="{{ app.request.getSchemeAndHttpHost() }}/members/trade/public/js/app.js"></script>
{% block javascript %}
<script>
let filters = JSON.parse('{{ defaults | json_encode | raw }}');
let isFirstRequest = {{ isFirstRequest }};
let myOptions = [];
myOptions['title'] = "";
{% if isFirstRequest == 0 %}
var firstRequest = 0;
{# var barChartData = {{ response|raw }}; #}
var reportingCountry = "{{ reportingCountry }}";
var reporter = "{{ reporter }}";
var tradingpartner = "{{ tradingpartner }}";
{% else %}
var firstRequest = 1;
var reportingCountry = "";
var reporter = "{{ reporter }}";
var tradingpartner = "{{ tradingpartner }}";
{% endif %}
var barChartData = {{ data|raw }};
</script>
{% endblock %}
{% endblock %}