167 lines
5.3 KiB
HTML
167 lines
5.3 KiB
HTML
{% load sekizai_tags %}
|
|
{% load i18n %}
|
|
|
|
{% addtoblock "js" %}
|
|
<script type="text/javascript">
|
|
var popup;
|
|
var timer;
|
|
|
|
function checkpopup() {
|
|
if(popup.closed) {
|
|
document.getElementById('wip').style.display='none';
|
|
document.forms['tipi'].reset();
|
|
clearInterval(timer);
|
|
}
|
|
}
|
|
|
|
function tipi() {
|
|
var params = {'refdet': function(id) {
|
|
var idpiece = document.getElementById('idpiece').value.trim();
|
|
var idligne = document.getElementById('idligne').value.trim();
|
|
var exer = params.exer('exer');
|
|
if (!idpiece || isNaN(idpiece)) {
|
|
document.getElementById('refdet_error').style.display='inline';
|
|
return false;
|
|
}
|
|
idpiece = '0000' + idpiece;
|
|
|
|
if (!idligne || isNaN(idligne)) {
|
|
document.getElementById('refdet_error').style.display='inline';
|
|
return false;
|
|
}
|
|
idligne = '0' + idligne;
|
|
{% if instance.saisie == 'T' %}
|
|
return "999900000000999999";
|
|
{% else %}
|
|
return exer + idpiece + idligne;
|
|
{% endif %}
|
|
}, 'montant': function(id) {
|
|
var euros = document.getElementById(id + '_euros').value.trim();
|
|
var cents = document.getElementById(id + '_cents').value.trim();
|
|
if (euros && cents) {
|
|
if (isNaN(euros) && isNaN(cents)) {
|
|
document.getElementById(value + '_error').style.display='inline';
|
|
return false;
|
|
}
|
|
return (parseInt(euros) + parseInt(cents)/100) * 100;
|
|
}
|
|
document.getElementById(id + '_error').style.display='inline';
|
|
return false;
|
|
}, 'mel': function(id) {
|
|
var mel = document.getElementById(id).value.trim();
|
|
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
if(re.test(mel))
|
|
return mel;
|
|
document.getElementById(id + '_error').style.display='inline';
|
|
return false;
|
|
}, 'exer': function(id) {
|
|
var exer = document.getElementById(id).value.trim();
|
|
if (isNaN(exer)) {
|
|
document.getElementById('refdet_error').style.display='inline';
|
|
return false;
|
|
}
|
|
{% if instance.saisie == 'T' %}
|
|
return "9999";
|
|
{% else %}
|
|
return exer;
|
|
{% endif %}
|
|
};
|
|
var tipi_url = '{{ instance.url }}?saisie={{ instance.saisie }}&numcli=' + document.getElementById('numcli').value;
|
|
var url_params = '&';
|
|
|
|
for (var field in params) {
|
|
var valid = params[field](field);
|
|
if(!valid) {
|
|
return false;
|
|
} else {
|
|
if (document.getElementById(field + '_error'))
|
|
document.getElementById(field + '_error').style.display='none';
|
|
url_params += field + '=' + valid + '&';
|
|
}
|
|
}
|
|
|
|
var url = tipi_url;
|
|
url = tipi_url + url_params;
|
|
popup = window.open(url, 'tipi', 'height=800, width=900, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
|
|
document.getElementById('wip').style.display='block';
|
|
timer = setInterval(checkpopup, 400);
|
|
return false;
|
|
}
|
|
</script>
|
|
{% endaddtoblock %}
|
|
{% addtoblock "css" %}
|
|
<style>
|
|
#tipi {
|
|
position: relative;
|
|
}
|
|
#tipi li {
|
|
list-style-type: none;
|
|
margin-bottom: .25em;
|
|
}
|
|
#tipi li label {
|
|
float: left;
|
|
width: 12em;
|
|
font-weight: bold;
|
|
}
|
|
#tipi li label:after {
|
|
content: ':'
|
|
}
|
|
#tipi li input[type=text] {
|
|
border: 1px solid #bbb;
|
|
}
|
|
#tipi .error {
|
|
color: #f00;
|
|
font-size:.9em;
|
|
display: none;
|
|
}
|
|
#tipi #wip {
|
|
position: absolute;
|
|
background: #fff;
|
|
opacity: .8;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
display: none;
|
|
text-align: center;
|
|
}
|
|
</style>
|
|
{% endaddtoblock %}
|
|
<div id="tipi">
|
|
<div id="wip">
|
|
<h3>{% trans "Paiement en cours..." %}</h3>
|
|
</div>
|
|
<form action='javascript:tipi()' name='tipi'>
|
|
<ul
|
|
<li>
|
|
<label>{% trans "Identifiant collectivité" %}</label>
|
|
<select name="numcli">
|
|
<option value="005955">CAM</option>
|
|
<option value="005956">CAM assainissement</option>
|
|
<option value="005957">CAM pompes funèbres</option>
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label>{% trans "Réference titre" %}</label>
|
|
<input type='text' id='exer' maxlength=4 size=4 />
|
|
<input type='text' id='idpiece' maxlength=4 size=4 />
|
|
<input type='text' id='idligne' maxlength=5 size=5 />
|
|
<span class="error" id="refdet_error">{% trans "numéro invalide" %}</span>
|
|
</li>
|
|
<li>
|
|
<label>{% trans "Montant" %}</label>
|
|
<input type='text' id='montant_euros' size="4" maxlength="4" placeholder="0000" /> ,
|
|
<input type='text' id='montant_cents size="2" maxlength="2" placeholder="00" />
|
|
<span class="error" id="montant_error">{% trans "montant invalide" %}</span>
|
|
</li>
|
|
<li>
|
|
<label>{% trans "Votre courriel" %}</label>
|
|
<input type='email' id='mel' {% if request.user.email %}value="{{ request.user.email }}" {% else %}placeholder="{% trans "nom@domaine.com" %}"{% endif %} />
|
|
<span class="error" id="mel_error">{% trans "courriel invalide" %}</span></li>
|
|
<li>
|
|
<input type='submit' value='{% trans "Payer" %}' />
|
|
</li>
|
|
</ul>
|
|
</form>
|
|
</div>
|