{% extends "base.html" %}

{% block head %}
{{ super() }}
<script type="text/javascript">
function getPricePerMonth()
{
    var period = 0;
    var periodselect = document.getElementById('period');
    period = periodselect.value;
    return period;
}

function calculateTotal()
{
    var period = getPricePerMonth();
    var ppm = {{ ppm }};
    var total = 0;
    total = period * ppm;
    var divobj = document.getElementById('totalPrice');
    divobj.innerHTML = "Total Price: "+total+" {{ currency }}";
}
</script>
{% endblock %}

{% block title %}Activate service{% endblock %}

{% block page_content %}

<div class="row">

<div class="col-md-12">
<div class="panel panel-info">
<div class="panel-heading">Activate service {{ service.description }}</div>
<div class="panel-body">

<form method="POST" action"{{ url_for('smanager.activate', itemid=service.pid) }}">
<p>
{{ form.period.label }} {{ form.period(**{"onchange":"calculateTotal()"}) }}<br />
   {% for error in form.period.errors %}
       {{ error }}<br />
   {% endfor %}
<h3>
---<br />
<div id="totalPrice">Previous Period: {{ total }} {{ currency }}</div>
</h3>

    {{ form.csrf_token() }}
    {{ form.submit }}
</p>

</div>
</div>
</div>

{% endblock %}

