mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
Pre-fetch forms for student card
This commit is contained in:
@ -35,20 +35,20 @@
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if profile.customer %}
|
||||
<h3>{% trans %}Student cards{% endtrans %}</h3>
|
||||
{% if student_card %}
|
||||
{% with
|
||||
form=student_card.form,
|
||||
action=student_card.context.action,
|
||||
customer=student_card.context.customer,
|
||||
student_cards=student_card.context.student_cards
|
||||
%}
|
||||
{% include student_card.template %}
|
||||
{% endwith %}
|
||||
|
||||
<p class="justify">
|
||||
{% trans %}You can add a card by asking at a counter or add it yourself here. If you want to manually
|
||||
add a student card yourself, you'll need a NFC reader. We store the UID of the card which is 14 characters long.{% endtrans %}
|
||||
</p>
|
||||
<div
|
||||
hx-get="{{ url('counter:add_student_card', customer_id=profile.customer.pk) }}"
|
||||
hx-trigger="load"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
<div aria-busy="true" style="min-height: 100px;"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<p class="justify">
|
||||
{% trans %}You can add a card by asking at a counter or add it yourself here. If you want to manually
|
||||
add a student card yourself, you'll need a NFC reader. We store the UID of the card which is 14 characters long.{% endtrans %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
@ -71,6 +71,7 @@ from core.views.forms import (
|
||||
UserProfileForm,
|
||||
)
|
||||
from counter.models import Refilling, Selling
|
||||
from counter.views.student_card import StudentCardFormView
|
||||
from eboutic.models import Invoice
|
||||
from subscription.models import Subscription
|
||||
from trombi.views import UserTrombiForm
|
||||
@ -575,6 +576,10 @@ class UserPreferencesView(UserTabsMixin, CanEditMixin, UpdateView):
|
||||
hasattr(self.object, "trombi_user") and self.request.user.trombi_user.trombi
|
||||
):
|
||||
kwargs["trombi_form"] = UserTrombiForm()
|
||||
if hasattr(self.object, "customer"):
|
||||
kwargs["student_card"] = StudentCardFormView.get_template_data(
|
||||
self.request, self.object.customer
|
||||
).as_dict()
|
||||
return kwargs
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user