mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-08-19 21:53:41 +00:00
Merge branch 'master' into massive_use_bft_tag
This commit is contained in:
commit
e2d55b89c1
4 changed files with 61 additions and 46 deletions
|
@ -38,18 +38,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{{ venteform.management_form }}
|
{{ venteform.management_form }}
|
||||||
<!-- TODO: FIXME to include data-type="check" for right option in id_cheque select -->
|
<!-- TODO: FIXME to include data-type="check" for right option in id_cheque select -->
|
||||||
<h3>Articles de la facture</h3>
|
<h3>Articles de la facture</h3>
|
||||||
<div id="form_set">
|
<div id="form_set" class="form-group">
|
||||||
{% for form in venteform.forms %}
|
{% for form in venteform.forms %}
|
||||||
<div class='product_to_sell'>
|
<div class='product_to_sell form-inline'>
|
||||||
<p>
|
Article :
|
||||||
{{ form.as_table }}
|
{% bootstrap_form form label_class='sr-only' %}
|
||||||
</p>
|
|
||||||
|
<button class="btn btn-danger btn-sm"
|
||||||
|
id="id_form-0-article-remove" type="button">
|
||||||
|
<span class="glyphicon glyphicon-remove"></span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<p>
|
|
||||||
<input class="btn btn-primary btn-sm" role="button" value="Ajouter un article" id="add_one">
|
<input class="btn btn-primary btn-sm" role="button" value="Ajouter un article" id="add_one">
|
||||||
</p>
|
|
||||||
<p>
|
<p>
|
||||||
Prix total : <span id="total_price">0,00</span> €
|
Prix total : <span id="total_price">0,00</span> €
|
||||||
</p>
|
</p>
|
||||||
|
@ -63,19 +65,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
prices[{{ article.id|escapejs }}] = {{ article.prix }};
|
prices[{{ article.id|escapejs }}] = {{ article.prix }};
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
var template = `<p>{{ venteform.empty_form.as_table }}</p>`;
|
var template = `Article :
|
||||||
|
{% bootstrap_form venteform.empty_form label_class='sr-only' %}
|
||||||
|
|
||||||
|
<button class="btn btn-danger btn-sm"
|
||||||
|
id="id_form-__prefix__-article-remove" type="button">
|
||||||
|
<span class="glyphicon glyphicon-remove"></span>
|
||||||
|
</button>`
|
||||||
|
|
||||||
function add_article(){
|
function add_article(){
|
||||||
// Index start at 0 => new_index = number of items
|
// Index start at 0 => new_index = number of items
|
||||||
var new_index =
|
var new_index =
|
||||||
document.getElementsByClassName('product_to_sell').length;
|
document.getElementsByClassName('product_to_sell').length;
|
||||||
document.getElementById('id_form-TOTAL_FORMS').value =
|
document.getElementById('id_form-TOTAL_FORMS').value ++;
|
||||||
parseInt(document.getElementById('id_form-TOTAL_FORMS').value) + 1;
|
|
||||||
var new_article = document.createElement('div');
|
var new_article = document.createElement('div');
|
||||||
new_article.className = 'product_to_sell';
|
new_article.className = 'product_to_sell form-inline';
|
||||||
new_article.innerHTML = template.replace(/__prefix__/g, new_index);
|
new_article.innerHTML = template.replace(/__prefix__/g, new_index);
|
||||||
document.getElementById('form_set')
|
document.getElementById('form_set').appendChild(new_article);
|
||||||
.appendChild(new_article);
|
|
||||||
add_listenner_for_id(new_index);
|
add_listenner_for_id(new_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,18 +112,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
.addEventListener("onkeypress", update_price, true);
|
.addEventListener("onkeypress", update_price, true);
|
||||||
document.getElementById('id_form-' + i.toString() + '-quantity')
|
document.getElementById('id_form-' + i.toString() + '-quantity')
|
||||||
.addEventListener("change", update_price, true);
|
.addEventListener("change", update_price, true);
|
||||||
|
document.getElementById('id_form-' + i.toString() + '-article-remove')
|
||||||
|
.addEventListener("click", function(event) {
|
||||||
|
var article = event.target.parentNode;
|
||||||
|
article.parentNode.removeChild(article);
|
||||||
|
document.getElementById('id_form-TOTAL_FORMS').value --;
|
||||||
|
update_price();
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_cheque_info_visibility() {
|
function set_cheque_info_visibility() {
|
||||||
var visible = document.getElementById("id_paiement").value == document.getElementById("id_paiement").getAttribute('data-cheque');
|
var paiement = document.getElementById("id_Facture-paiement");
|
||||||
p = document.getElementById("id_paiement")
|
var visible = paiement.value == paiement.getAttribute('data-cheque');
|
||||||
console.log(p);
|
p = document.getElementById("id_Facture-paiement");
|
||||||
var display = 'none';
|
var display = 'none';
|
||||||
if (visible) {
|
if (visible) {
|
||||||
display = 'block';
|
display = 'block';
|
||||||
}
|
}
|
||||||
document.getElementById("id_cheque").parentNode.style.display = display;
|
document.getElementById("id_Facture-cheque")
|
||||||
document.getElementById("id_banque").parentNode.style.display = display;
|
.parentNode.style.display = display;
|
||||||
|
document.getElementById("id_Facture-banque")
|
||||||
|
.parentNode.style.display = display;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add events manager when DOM is fully loaded
|
// Add events manager when DOM is fully loaded
|
||||||
|
@ -129,7 +145,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
for (i = 0; i < product_count; ++i){
|
for (i = 0; i < product_count; ++i){
|
||||||
add_listenner_for_id(i);
|
add_listenner_for_id(i);
|
||||||
}
|
}
|
||||||
document.getElementById("id_paiement")
|
document.getElementById("id_Facture-paiement")
|
||||||
.addEventListener("change", set_cheque_info_visibility, true);
|
.addEventListener("change", set_cheque_info_visibility, true);
|
||||||
set_cheque_info_visibility();
|
set_cheque_info_visibility();
|
||||||
update_price();
|
update_price();
|
||||||
|
|
|
@ -54,7 +54,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if interfaceform %}
|
{% if interfaceform %}
|
||||||
{% if i_bft_param %}
|
{% if i_bft_param %}
|
||||||
{% massive_bootstrap_form interfaceform 'ipv4,machine' mbf_param=i_bft_param %}
|
{% massive_bootstrap_form interfaceform 'ipv4,machine' mbf_param=i_mbf_param %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% massive_bootstrap_form interfaceform 'ipv4,machine' %}
|
{% massive_bootstrap_form interfaceform 'ipv4,machine' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -381,20 +381,15 @@ def new_switch(request):
|
||||||
reversion.set_comment("Création")
|
reversion.set_comment("Création")
|
||||||
messages.success(request, "Le switch a été créé")
|
messages.success(request, "Le switch a été créé")
|
||||||
return redirect("/topologie/")
|
return redirect("/topologie/")
|
||||||
<<<<<<< HEAD
|
i_mbf_param = generate_ipv4_mbf_param( interface, False )
|
||||||
i_bft_param = generate_ipv4_mbf_param( interface, False )
|
|
||||||
return form({'topoform':switch, 'machineform': machine, 'interfaceform': interface, 'domainform': domain, 'i_bft_param': i_bft_param}, 'topologie/switch.html', request)
|
|
||||||
=======
|
|
||||||
i_bft_param = generate_ipv4_bft_param(interface, False)
|
|
||||||
return form({
|
return form({
|
||||||
'topoform': switch,
|
'topoform': switch,
|
||||||
'machineform': machine,
|
'machineform': machine,
|
||||||
'interfaceform': interface,
|
'interfaceform': interface,
|
||||||
'domainform': domain,
|
'domainform': domain,
|
||||||
'i_bft_param': i_bft_param
|
'i_mbf_param': i_mbf_param
|
||||||
}, 'topologie/switch.html', request)
|
}, 'topologie/switch.html', request)
|
||||||
|
|
||||||
>>>>>>> master
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('infra')
|
@permission_required('infra')
|
||||||
|
@ -454,20 +449,15 @@ def edit_switch(request, switch_id):
|
||||||
)
|
)
|
||||||
messages.success(request, "Le switch a bien été modifié")
|
messages.success(request, "Le switch a bien été modifié")
|
||||||
return redirect("/topologie/")
|
return redirect("/topologie/")
|
||||||
<<<<<<< HEAD
|
i_mbf_param = generate_ipv4_mbf_param( interface_form, False )
|
||||||
i_bft_param = generate_ipv4_mbf_param( interface_form, False )
|
|
||||||
return form({'topoform':switch_form, 'machineform': machine_form, 'interfaceform': interface_form, 'domainform': domain_form, 'i_bft_param': i_bft_param}, 'topologie/switch.html', request)
|
|
||||||
=======
|
|
||||||
i_bft_param = generate_ipv4_bft_param(interface_form, False)
|
|
||||||
return form({
|
return form({
|
||||||
'topoform': switch_form,
|
'topoform': switch_form,
|
||||||
'machineform': machine_form,
|
'machineform': machine_form,
|
||||||
'interfaceform': interface_form,
|
'interfaceform': interface_form,
|
||||||
'domainform': domain_form,
|
'domainform': domain_form,
|
||||||
'i_bft_param': i_bft_param
|
'i_mbf_param': i_mbf_param
|
||||||
}, 'topologie/switch.html', request)
|
}, 'topologie/switch.html', request)
|
||||||
|
|
||||||
>>>>>>> master
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('infra')
|
@permission_required('infra')
|
||||||
|
|
|
@ -35,19 +35,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<tbody>
|
||||||
<tr>
|
|
||||||
{% for key, values in userform.items %}
|
{% for key, values in userform.items %}
|
||||||
<th>{{ key }}</th>
|
<tr class="active">
|
||||||
{% endfor %}
|
<td>
|
||||||
|
<a data-toggle="collapse" href="#collapseRight_{{key}}" aria-expanded="false" aria-controls="collapseRights_{{key}}">
|
||||||
|
<b>{{ key }}</b> ( {{values.rights|length }} users )
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
|
||||||
<tr>
|
<tr>
|
||||||
{% for key, values in userform.items %}
|
<td>
|
||||||
{% bootstrap_form_errors values %}
|
<div class="collapse" id="collapseRight_{{key}}">
|
||||||
<th>{{ values.rights }}</th>
|
<ul class="list-group" style="margin-bottom: 0px">
|
||||||
|
{% for user in values.rights %}
|
||||||
|
<li class="list-group-item col-xs-6 col-sm-4 col-md-3" style="border: none;">{{ user }}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% bootstrap_button "Modifier" button_type="submit" icon="star" %}
|
{% bootstrap_button "Modifier" button_type="submit" icon="star" %}
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in a new issue