nk20/templates/wei/weimembership_form.html

208 lines
10 KiB
HTML

{% extends "member/noteowner_detail.html" %}
{% load crispy_forms_tags %}
{% load i18n %}
{% load pretty_money %}
{% load perms %}
{% block profile_info %}
{% include "wei/weiclub_info.html" %}
{% endblock %}
{% block profile_content %}
<div class="card bg-light shadow">
<div class="card-header text-center">
<h4>{% trans "Review registration" %}</h4>
</div>
<div class="card-body">
<dl class="row">
<dt class="col-xl-6">{% trans 'name'|capfirst %}, {% trans 'first name' %}</dt>
<dd class="col-xl-6">{{ registration.user.last_name }} {{ registration.user.first_name }}</dd>
<dt class="col-xl-6">{% trans 'username'|capfirst %}</dt>
<dd class="col-xl-6">{{ registration.user.username }}</dd>
<dt class="col-xl-6">{% trans 'email'|capfirst %}</dt>
<dd class="col-xl-6"><a href="mailto:{{ registration.user.email }}">{{ registration.user.email }}</a></dd>
{% if not registration.user.profile.email_confirmed and "member.change_profile_email_confirmed"|has_perm:registration.user.profile %}
<dd class="col-xl-12">
<div class="alert alert-warning">
{% trans "This user doesn't have confirmed his/her e-mail address." %}
<a href="{% url "registration:email_validation_resend" pk=registration.user.pk %}">{% trans "Click here to resend a validation link." %}</a>
</div>
</dd>
{% endif %}
<dt class="col-xl-6">{% trans 'department'|capfirst %}</dt>
<dd class="col-xl-6">{{ registration.user.profile.department }}</dd>
<dt class="col-xl-6">{% trans 'ENS year'|capfirst %}</dt>
<dd class="col-xl-6">{{ registration.user.profile.ens_year }}</dd>
<dt class="col-xl-6">{% trans 'section'|capfirst %}</dt>
<dd class="col-xl-6">{{ registration.user.profile.section }}</dd>
<dt class="col-xl-6">{% trans 'address'|capfirst %}</dt>
<dd class="col-xl-6">{{ registration.user.profile.address }}</dd>
<dt class="col-xl-6">{% trans 'phone number'|capfirst %}</dt>
<dd class="col-xl-6">{{ registration.user.profile.phone_number }}</dd>
<dt class="col-xl-6">{% trans 'paid'|capfirst %}</dt>
<dd class="col-xl-6">{{ registration.user.profile.paid|yesno }}</dd>
<hr>
<dt class="col-xl-6">{% trans 'first year'|capfirst %}</dt>
<dd class="col-xl-6">{{ registration.first_year|yesno }}</dd>
<dt class="col-xl-6">{% trans 'gender'|capfirst %}</dt>
<dd class="col-xl-6">{{ registration.gender }}</dd>
<dt class="col-xl-6">{% trans 'birth date'|capfirst %}</dt>
<dd class="col-xl-6">{{ registration.birth_date }}</dd>
<dt class="col-xl-6">{% trans 'health issues'|capfirst %}</dt>
<dd class="col-xl-6">{{ registration.health_issues }}</dd>
<dt class="col-xl-6">{% trans 'emergency contact name'|capfirst %}</dt>
<dd class="col-xl-6">{{ registration.emergency_contact_name }}</dd>
<dt class="col-xl-6">{% trans 'emergency contact phone'|capfirst %}</dt>
<dd class="col-xl-6">{{ registration.emergency_contact_phone }}</dd>
<dt class="col-xl-6">{% trans 'Register on the mailing list to stay informed of the events of the campus (1 mail/week)' %}</dt>
<dd class="col-xl-6">{{ registration.ml_events_registration|yesno }}</dd>
<dt class="col-xl-6">{% trans 'Register on the mailing list to stay informed of the sport events of the campus (1 mail/week)' %}</dt>
<dd class="col-xl-6">{{ registration.ml_sport_registration|yesno }}</dd>
<dt class="col-xl-6">{% trans 'Register on the mailing list to stay informed of the art events of the campus (1 mail/week)' %}</dt>
<dd class="col-xl-6">{{ registration.ml_art_registration|yesno }}</dd>
<dt class="col-xl-6">{% trans 'Payment from Société générale' %}</dt>
<dd class="col-xl-6">{{ registration.soge_credit|yesno }}</dd>
{% if registration.first_year %}
<dt class="col-xl-6">{% trans 'Suggested bus from the survey:' %}</dt>
{% if registration.information.valid or True %}
<dd class="col-xl-6">{{ suggested_bus }}</dd>
<div class="card-header text-center col-xl-12">
<h5>{% trans 'Raw survey information' %}</h5>
</div>
{% with information=registration.information %}
{% for key, value in information.items %}
<dt class="col-xl-6">{{ key }}</dt>
<dd class="col-xl-6">{{ value }}</dd>
{% endfor %}
{% endwith %}
{% else %}
<dd class="col-xl-6"><em>{% trans "The algorithm didn't run." %}</em></dd>
{% endif %}
{% else %}
<dt class="col-xl-6">{% trans 'caution check given'|capfirst %}</dt>
<dd class="col-xl-6">{{ registration.caution_check|yesno }}</dd>
{% with information=registration.information %}
<dt class="col-xl-6">{% trans 'preferred bus'|capfirst %}</dt>
<dd class="col-xl-6">{{ information.preferred_bus_name|join:', ' }}</dd>
<dt class="col-xl-6">{% trans 'preferred team'|capfirst %}</dt>
<dd class="col-xl-6">{{ information.preferred_team_name|join:', ' }}</dd>
<dt class="col-xl-6">{% trans 'preferred roles'|capfirst %}</dt>
<dd class="col-xl-6">{{ information.preferred_roles_name|join:', ' }}</dd>
{% endwith %}
{% endif %}
</dl>
</div>
<div class="card-footer text-center">
<a class="btn btn-primary btn-sm" href="{% url 'member:user_update_profile' registration.user.pk %}">{% trans 'Update Profile' %}</a>
<a class="btn btn-primary btn-sm" href="{% url 'wei:wei_update_registration' registration.pk %}">{% trans 'Update registration' %}</a>
</div>
</div>
<hr>
<div class="card bg-light shadow">
<form method="post">
<div class="card-header text-center" >
<h4> {% trans "Validate registration" %}</h4>
</div>
{% if registration.is_validated %}
<div class="alert alert-warning">
{% trans "The registration is already validated and can't be unvalidated." %}
{% trans "The user joined the bus" %} {{ registration.membership.bus }}
{% if registration.membership.team %}{% trans "in the team" %} {{ registration.membership.team }},
{% else %}{% trans "in no team (staff)" %},{% endif %} {% trans "with the following roles:" %} {{ registration.membership.roles.all|join:", " }}
</div>
{% else %}
{% if registration.soge_credit %}
<div class="alert alert-warning">
{% blocktrans %}
The WEI will be paid by Société générale. The membership will be created even if the bank didn't pay the BDE yet.
The membership transaction will be created but will be invalid. You will have to validate it once the bank
validated the creation of the account, or to change the payment method.
{% endblocktrans %}
</div>
{% else %}
{% if registration.user.note.balance < fee %}
<div class="alert alert-danger">
{% with pretty_fee=fee|pretty_money %}
{% blocktrans with balance=registration.user.note.balance|pretty_money %}
The note don't have enough money ({{ balance }}, {{ pretty_fee }} required). The registration may fail.
{% endblocktrans %}
{% endwith %}
</div>
{% else %}
<div class="alert alert-success">
{% trans "The note has enough money, the registration is possible." %}
</div>
{% endif %}
{% endif %}
{% if not registration.caution_check and not registration.first_year %}
<div class="alert alert-danger">
{% trans "The user didn't give her/his caution check." %}
</div>
{% endif %}
{% if not kfet_member %}
<div class="alert alert-danger">
{% url 'registration:future_user_detail' pk=registration.user.pk as future_user_detail %}
{% url 'member:club_detail' pk=club.parent_club.parent_club.pk as club_detail %}
{% blocktrans %}
This user is not a member of the Kfet club. Please adhere
<a href="{{ future_user_detail }}">here if he/she is in her/his first year</a>
or <a href="{{ club_detail }}">here if he/she was an old member</a> before you validate
the registration of the WEI.
{% endblocktrans %}
</div>
{% endif %}
<div class="card-body" id="profile_infos">
{% csrf_token %}
{{ form|crispy }}
</div>
<div class="card-footer text-center">
<button class="btn btn-success btn-sm">{% trans 'Validate registration' %}</button>
</div>
{% endif %}
</form>
</div>
{% endblock %}
{% block extrajavascript %}
<script>
function autocompleted(obj, prefix) {
console.log(prefix);
if (prefix === "id_bus") {
console.log(obj);
$("#id_team").attr('api_url', '/api/wei/team/?bus=' + obj.id);
}
}
</script>
{% endblock %}