mirror of
https://github.com/ae-utbm/sith.git
synced 2025-10-14 16:58:31 +00:00
Compare commits
1 Commits
update_sub
...
subscripti
Author | SHA1 | Date | |
---|---|---|---|
|
500af2f73a |
@@ -76,20 +76,18 @@
|
|||||||
It will stay hidden for other users until it has been published.
|
It will stay hidden for other users until it has been published.
|
||||||
{% endtrans %}
|
{% endtrans %}
|
||||||
</p>
|
</p>
|
||||||
{%- if user.has_perm("com.moderate_news") -%}
|
{% if user.has_perm("com.moderate_news") %}
|
||||||
{# This is an additional query for each non-moderated news,
|
{# This is an additional query for each non-moderated news,
|
||||||
but it will be executed only for admin users, and only one time
|
but it will be executed only for admin users, and only one time
|
||||||
(if they do their job and moderate news as soon as they see them),
|
(if they do their job and moderated news as soon as they see them),
|
||||||
so it's still reasonable #}
|
so it's still reasonable #}
|
||||||
<div
|
<div
|
||||||
{% if news is integer or news is string -%}
|
{% if news is integer or news is string %}
|
||||||
x-data="{ nbEvents: 0 }"
|
x-data="{ nbEvents: 0 }"
|
||||||
x-init="nbEvents = await nbToPublish()"
|
x-init="nbEvents = await nbToPublish()"
|
||||||
{%- elif news.is_published -%}
|
{% else %}
|
||||||
x-data="{ nbEvents: 0 }"
|
|
||||||
{%- else -%}
|
|
||||||
x-data="{ nbEvents: {{ news.dates.count() }} }"
|
x-data="{ nbEvents: {{ news.dates.count() }} }"
|
||||||
{%- endif -%}
|
{% endif %}
|
||||||
>
|
>
|
||||||
<template x-if="nbEvents > 1">
|
<template x-if="nbEvents > 1">
|
||||||
<div>
|
<div>
|
||||||
|
@@ -77,22 +77,22 @@
|
|||||||
<div class="notification" x-data="{display: false}" :class="{white: display}">
|
<div class="notification" x-data="{display: false}" :class="{white: display}">
|
||||||
<a href="#" @click.prevent="display = !display">
|
<a href="#" @click.prevent="display = !display">
|
||||||
<i :class="`fa-${display ? 'solid': 'regular'} fa-bell`" x-transition></i>
|
<i :class="`fa-${display ? 'solid': 'regular'} fa-bell`" x-transition></i>
|
||||||
{% set notifications = user.notifications.filter(viewed=False).order_by("-date")|list %}
|
{% set notification_count = user.notifications.filter(viewed=False).count() %}
|
||||||
|
|
||||||
{%- if notifications|length > 0 -%}
|
{% if notification_count > 0 %}
|
||||||
<span>
|
<span>
|
||||||
{% if notifications|length < 100 %}
|
{% if notification_count < 100 %}
|
||||||
{{ notifications|length }}
|
{{ notification_count }}
|
||||||
{%- else -%}
|
{% else %}
|
||||||
99+
|
|
||||||
{%- endif -%}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</a>
|
</a>
|
||||||
<div id="header_notif" x-show="display" x-cloak x-transition @click.outside="display = false">
|
<div id="header_notif" x-show="display" x-cloak x-transition @click.outside="display = false">
|
||||||
<ul>
|
<ul>
|
||||||
{%- if notifications|length > 0 -%}
|
{% if user.notifications.filter(viewed=False).count() > 0 %}
|
||||||
{%- for n in notifications -%}
|
{% for n in user.notifications.filter(viewed=False).order_by('-date') %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ url("core:notification", notif_id=n.id) }}">
|
<a href="{{ url("core:notification", notif_id=n.id) }}">
|
||||||
<div class="datetime">
|
<div class="datetime">
|
||||||
@@ -108,10 +108,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{%- endfor -%}
|
{% endfor %}
|
||||||
{%- else -%}
|
{% else %}
|
||||||
<li class="empty-notification">{% trans %}You do not have any unread notification{% endtrans %}</li>
|
<li class="empty-notification">{% trans %}You do not have any unread notification{% endtrans %}</li>
|
||||||
{%- endif -%}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
<div class="options">
|
<div class="options">
|
||||||
<a href="{{ url('core:notification_list') }}">
|
<a href="{{ url('core:notification_list') }}">
|
||||||
|
@@ -1,13 +1,12 @@
|
|||||||
{% spaceless %}
|
{% for js in statics.js %}
|
||||||
{% for js in statics.js %}
|
|
||||||
<script-once type="module" src="{{ js }}"></script-once>
|
<script-once type="module" src="{{ js }}"></script-once>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% for css in statics.css %}
|
{% for css in statics.css %}
|
||||||
<link-once rel="stylesheet" type="text/css" href="{{ css }}" defer></link-once>
|
<link-once rel="stylesheet" type="text/css" href="{{ css }}" defer></link-once>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<{{ component }} name="{{ widget.name }}" {% include "django/forms/widgets/attrs.html" %}>
|
<{{ component }} name="{{ widget.name }}" {% include "django/forms/widgets/attrs.html" %}>
|
||||||
{% for group_name, group_choices, group_index in widget.optgroups %}
|
{% for group_name, group_choices, group_index in widget.optgroups %}
|
||||||
{% if group_name %}
|
{% if group_name %}
|
||||||
<optgroup label="{{ group_name }}">
|
<optgroup label="{{ group_name }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -17,9 +16,8 @@
|
|||||||
{% if group_name %}
|
{% if group_name %}
|
||||||
</optgroup>
|
</optgroup>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if initial %}
|
{% if initial %}
|
||||||
<slot style="display:none" name="initial">{{ initial }}</slot>
|
<slot style="display:none" name="initial">{{ initial }}</slot>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</{{ component }}>
|
</{{ component }}>
|
||||||
{% endspaceless %}
|
|
@@ -881,6 +881,7 @@ class Selling(models.Model):
|
|||||||
if (
|
if (
|
||||||
self.product
|
self.product
|
||||||
and self.product.id == settings.SITH_PRODUCT_SUBSCRIPTION_ONE_SEMESTER
|
and self.product.id == settings.SITH_PRODUCT_SUBSCRIPTION_ONE_SEMESTER
|
||||||
|
and self.counter.type == "EBOUTIC"
|
||||||
):
|
):
|
||||||
sub = Subscription(
|
sub = Subscription(
|
||||||
member=user,
|
member=user,
|
||||||
@@ -904,6 +905,7 @@ class Selling(models.Model):
|
|||||||
elif (
|
elif (
|
||||||
self.product
|
self.product
|
||||||
and self.product.id == settings.SITH_PRODUCT_SUBSCRIPTION_TWO_SEMESTERS
|
and self.product.id == settings.SITH_PRODUCT_SUBSCRIPTION_TWO_SEMESTERS
|
||||||
|
and self.counter.type == "EBOUTIC"
|
||||||
):
|
):
|
||||||
sub = Subscription(
|
sub = Subscription(
|
||||||
member=user,
|
member=user,
|
||||||
|
@@ -67,13 +67,13 @@
|
|||||||
<option value="FIN">{% trans %}Confirm (FIN){% endtrans %}</option>
|
<option value="FIN">{% trans %}Confirm (FIN){% endtrans %}</option>
|
||||||
<option value="ANN">{% trans %}Cancel (ANN){% endtrans %}</option>
|
<option value="ANN">{% trans %}Cancel (ANN){% endtrans %}</option>
|
||||||
</optgroup>
|
</optgroup>
|
||||||
{%- for category in categories.keys() -%}
|
{% for category in categories.keys() %}
|
||||||
<optgroup label="{{ category }}">
|
<optgroup label="{{ category }}">
|
||||||
{%- for product in categories[category] -%}
|
{% for product in categories[category] %}
|
||||||
<option value="{{ product.id }}">{{ product }}</option>
|
<option value="{{ product.id }}">{{ product }}</option>
|
||||||
{%- endfor -%}
|
{% endfor %}
|
||||||
</optgroup>
|
</optgroup>
|
||||||
{%- endfor -%}
|
{% endfor %}
|
||||||
</counter-product-select>
|
</counter-product-select>
|
||||||
|
|
||||||
<input type="submit" value="{% trans %}Go{% endtrans %}"/>
|
<input type="submit" value="{% trans %}Go{% endtrans %}"/>
|
||||||
|
@@ -4974,47 +4974,47 @@ msgstr "Suppression de rechargement"
|
|||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "One semester"
|
msgid "One semester"
|
||||||
msgstr "Un semestre"
|
msgstr "Un semestre, 20 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "Two semesters"
|
msgid "Two semesters"
|
||||||
msgstr "Deux semestres"
|
msgstr "Deux semestres, 35 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "Common core cursus"
|
msgid "Common core cursus"
|
||||||
msgstr "Cursus tronc commun"
|
msgstr "Cursus tronc commun, 60 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "Branch cursus"
|
msgid "Branch cursus"
|
||||||
msgstr "Cursus branche"
|
msgstr "Cursus branche, 60 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "Alternating cursus"
|
msgid "Alternating cursus"
|
||||||
msgstr "Cursus alternant"
|
msgstr "Cursus alternant, 30 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "Honorary member"
|
msgid "Honorary member"
|
||||||
msgstr "Membre honoraire"
|
msgstr "Membre honoraire, 0 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "Assidu member"
|
msgid "Assidu member"
|
||||||
msgstr "Membre d'Assidu"
|
msgstr "Membre d'Assidu, 0 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "Amicale/DOCEO member"
|
msgid "Amicale/DOCEO member"
|
||||||
msgstr "Membre de l'Amicale/DOCEO"
|
msgstr "Membre de l'Amicale/DOCEO, 0 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "UT network member"
|
msgid "UT network member"
|
||||||
msgstr "Cotisant du réseau UT"
|
msgstr "Cotisant du réseau UT, 0 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "CROUS member"
|
msgid "CROUS member"
|
||||||
msgstr "Membres du CROUS"
|
msgstr "Membres du CROUS, 0 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "Sbarro/ESTA member"
|
msgid "Sbarro/ESTA member"
|
||||||
msgstr "Membre de Sbarro ou de l'ESTA"
|
msgstr "Membre de Sbarro ou de l'ESTA, 20 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "One semester Welcome Week"
|
msgid "One semester Welcome Week"
|
||||||
@@ -5041,28 +5041,28 @@ msgid "One day"
|
|||||||
msgstr "Un jour"
|
msgstr "Un jour"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "GA staff member (2 weeks)"
|
msgid "GA staff member"
|
||||||
msgstr "Membre staff GA (2 semaines)"
|
msgstr "Membre staff GA (2 semaines), 1 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "One semester (-20%)"
|
msgid "One semester (-20%)"
|
||||||
msgstr "Un semestre (-20%)"
|
msgstr "Un semestre (-20%), 12 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "Two semesters (-20%)"
|
msgid "Two semesters (-20%)"
|
||||||
msgstr "Deux semestres (-20%)"
|
msgstr "Deux semestres (-20%), 22 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "Common core cursus (-20%)"
|
msgid "Common core cursus (-20%)"
|
||||||
msgstr "Cursus tronc commun (-20%)"
|
msgstr "Cursus tronc commun (-20%), 36 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "Branch cursus (-20%)"
|
msgid "Branch cursus (-20%)"
|
||||||
msgstr "Cursus branche (-20%)"
|
msgstr "Cursus branche (-20%), 36 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "Alternating cursus (-20%)"
|
msgid "Alternating cursus (-20%)"
|
||||||
msgstr "Cursus alternant (-20%)"
|
msgstr "Cursus alternant (-20%), 24 €"
|
||||||
|
|
||||||
#: sith/settings.py
|
#: sith/settings.py
|
||||||
msgid "One year for free(CA offer)"
|
msgid "One year for free(CA offer)"
|
||||||
|
@@ -541,7 +541,7 @@ SITH_SUBSCRIPTIONS = {
|
|||||||
"duration": 4,
|
"duration": 4,
|
||||||
},
|
},
|
||||||
"cursus-branche": {"name": _("Branch cursus"), "price": 60, "duration": 6},
|
"cursus-branche": {"name": _("Branch cursus"), "price": 60, "duration": 6},
|
||||||
"cursus-alternant": {"name": _("Alternating cursus"), "price": 35, "duration": 6},
|
"cursus-alternant": {"name": _("Alternating cursus"), "price": 30, "duration": 6},
|
||||||
"membre-honoraire": {"name": _("Honorary member"), "price": 0, "duration": 666},
|
"membre-honoraire": {"name": _("Honorary member"), "price": 0, "duration": 666},
|
||||||
"assidu": {"name": _("Assidu member"), "price": 0, "duration": 2},
|
"assidu": {"name": _("Assidu member"), "price": 0, "duration": 2},
|
||||||
"amicale/doceo": {"name": _("Amicale/DOCEO member"), "price": 0, "duration": 2},
|
"amicale/doceo": {"name": _("Amicale/DOCEO member"), "price": 0, "duration": 2},
|
||||||
@@ -553,6 +553,8 @@ SITH_SUBSCRIPTIONS = {
|
|||||||
"price": 0,
|
"price": 0,
|
||||||
"duration": 1,
|
"duration": 1,
|
||||||
},
|
},
|
||||||
|
"un-mois-essai": {"name": _("One month for free"), "price": 0, "duration": 0.166},
|
||||||
|
"deux-mois-essai": {"name": _("Two months for free"), "price": 0, "duration": 0.33},
|
||||||
"benevoles-euroks": {"name": _("Eurok's volunteer"), "price": 5, "duration": 0.1},
|
"benevoles-euroks": {"name": _("Eurok's volunteer"), "price": 5, "duration": 0.1},
|
||||||
"six-semaines-essai": {
|
"six-semaines-essai": {
|
||||||
"name": _("Six weeks for free"),
|
"name": _("Six weeks for free"),
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
# Generated by Django 5.2.3 on 2025-10-06 11:24
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
import subscription.models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
dependencies = [("subscription", "0015_alter_subscription_location_and_more")]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name="subscription",
|
|
||||||
name="subscription_type",
|
|
||||||
field=models.CharField(
|
|
||||||
choices=subscription.models.get_subscription_types,
|
|
||||||
max_length=255,
|
|
||||||
verbose_name="subscription type",
|
|
||||||
),
|
|
||||||
)
|
|
||||||
]
|
|
@@ -38,19 +38,16 @@ def validate_payment(value):
|
|||||||
raise ValidationError(_("Bad payment method"))
|
raise ValidationError(_("Bad payment method"))
|
||||||
|
|
||||||
|
|
||||||
def get_subscription_types():
|
|
||||||
return (
|
|
||||||
(k, f"{v['name']}, {v['price']}€")
|
|
||||||
for k, v in sorted(settings.SITH_SUBSCRIPTIONS.items())
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Subscription(models.Model):
|
class Subscription(models.Model):
|
||||||
member = models.ForeignKey(
|
member = models.ForeignKey(
|
||||||
User, related_name="subscriptions", on_delete=models.CASCADE
|
User, related_name="subscriptions", on_delete=models.CASCADE
|
||||||
)
|
)
|
||||||
subscription_type = models.CharField(
|
subscription_type = models.CharField(
|
||||||
_("subscription type"), max_length=255, choices=get_subscription_types
|
_("subscription type"),
|
||||||
|
max_length=255,
|
||||||
|
choices=(
|
||||||
|
(k, v["name"]) for k, v in sorted(settings.SITH_SUBSCRIPTIONS.items())
|
||||||
|
),
|
||||||
)
|
)
|
||||||
subscription_start = models.DateField(_("subscription start"))
|
subscription_start = models.DateField(_("subscription start"))
|
||||||
subscription_end = models.DateField(_("subscription end"))
|
subscription_end = models.DateField(_("subscription end"))
|
||||||
|
Reference in New Issue
Block a user