mirror of https://gitlab.crans.org/bde/nk20
Hide the credit interface when editing a WEI registration
This commit is contained in:
parent
6567d2f8cc
commit
3784e97d60
|
@ -129,7 +129,8 @@ class WEIMembershipForm(forms.ModelForm):
|
||||||
attrs={
|
attrs={
|
||||||
'api_url': '/api/wei/team/',
|
'api_url': '/api/wei/team/',
|
||||||
'placeholder': 'Équipe ...',
|
'placeholder': 'Équipe ...',
|
||||||
}
|
},
|
||||||
|
resetable=True,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,27 +16,29 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extrajavascript %}
|
{% block extrajavascript %}
|
||||||
<script>
|
{% if not object.membership %}
|
||||||
$(document).ready(function() {
|
<script>
|
||||||
function refreshTeams() {
|
$(document).ready(function() {
|
||||||
let buses = [];
|
function refreshTeams() {
|
||||||
$("input[name='bus']:checked").each(function(ignored) {
|
let buses = [];
|
||||||
buses.push($(this).parent().text().trim());
|
$("input[name='bus']:checked").each(function(ignored) {
|
||||||
});
|
buses.push($(this).parent().text().trim());
|
||||||
console.log(buses);
|
|
||||||
$("input[name='team']").each(function() {
|
|
||||||
let label = $(this).parent();
|
|
||||||
$(this).parent().addClass('d-none');
|
|
||||||
buses.forEach(function(bus) {
|
|
||||||
if (label.text().includes(bus))
|
|
||||||
label.removeClass('d-none');
|
|
||||||
});
|
});
|
||||||
});
|
console.log(buses);
|
||||||
}
|
$("input[name='team']").each(function() {
|
||||||
|
let label = $(this).parent();
|
||||||
|
$(this).parent().addClass('d-none');
|
||||||
|
buses.forEach(function(bus) {
|
||||||
|
if (label.text().includes(bus))
|
||||||
|
label.removeClass('d-none');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$("input[name='bus']").change(refreshTeams);
|
$("input[name='bus']").change(refreshTeams);
|
||||||
|
|
||||||
refreshTeams();
|
refreshTeams();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -607,6 +607,11 @@ class WEIUpdateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Update
|
||||||
if not PermissionBackend.check_perm(
|
if not PermissionBackend.check_perm(
|
||||||
self.request.user, "wei.change_membership_" + field_name, self.object.membership):
|
self.request.user, "wei.change_membership_" + field_name, self.object.membership):
|
||||||
field.widget = HiddenInput()
|
field.widget = HiddenInput()
|
||||||
|
del membership_form.fields["credit_type"]
|
||||||
|
del membership_form.fields["credit_amount"]
|
||||||
|
del membership_form.fields["first_name"]
|
||||||
|
del membership_form.fields["last_name"]
|
||||||
|
del membership_form.fields["bank"]
|
||||||
context["membership_form"] = membership_form
|
context["membership_form"] = membership_form
|
||||||
elif not self.object.first_year and PermissionBackend.check_perm(
|
elif not self.object.first_year and PermissionBackend.check_perm(
|
||||||
self.request.user, "wei.change_weiregistration_information_json", self.object):
|
self.request.user, "wei.change_weiregistration_information_json", self.object):
|
||||||
|
|
Loading…
Reference in New Issue