{% extends "panel.html" %}
{% load i18n %}
{% load inventree_extras %}

{% block label %}currencies{% endblock %}

{% block heading %}
{% trans "Currency Settings" %}
{% endblock %}

{% block content %}

<table class='table table-striped table-condensed'>
    <tbody>
        {% include "InvenTree/settings/setting.html" with key="INVENTREE_DEFAULT_CURRENCY" icon="fa-globe" %}

        <tr>
            <td></td>
            <th>{% trans "Base Currency" %}</th>
            <th>{{ base_currency }}</th>
        </tr>
        <tr>
            <td></td>
            <th colspan='4'>{% trans "Exchange Rates" %}</th>
        </tr>
        {% for rate in rates %}
        <tr>
            <td></td>
            <td>{{ rate.value }}</td>
            <td>{{ rate.currency }}</td>
            <td></td>
            <td></td>
        </tr>
        {% endfor %}
        <tr>
            <th></th>
            <th>
                {% trans "Last Update" %}
            </th>
            <td colspan="3">
                {% if rates_updated %}
                {{ rates_updated }}
                {% else %}
                <em>{% trans "Never" %}</em>
                {% endif %}
                <form action='{% url "settings-currencies-refresh" %}' method='post'>
                    <div id='refresh-rates-form'>
                        {% csrf_token %}
                        <button type='submit' id='update-rates' class='btn btn-primary float-right'>{% trans "Update Now" %}</button>
                    </div>
                </form>
            </td>
        </tr>
    </tbody>
</table>

{% endblock %}