1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-08-03 14:16:54 +02:00

Compare commits

..

3 Commits

Author SHA1 Message Date
mcngnt
414e103686 finitio le message sda 2025-01-05 23:17:01 +01:00
quark
7975fe47a6 Merge branch 'sda' into 'main'
Donation goal la note kfet x les SdA

See merge request bde/nk20!277
2024-10-10 23:44:22 +02:00
quark
476fbceeea Donation goal la note kfet x les SdA 2024-10-10 01:48:23 +02:00
6 changed files with 60 additions and 102 deletions

View File

@@ -1,8 +1,6 @@
# Copyright (C) 2018-2024 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
import datetime
from django.utils import timezone
from django.utils.html import escape
from django.utils.safestring import mark_safe
@@ -79,9 +77,6 @@ def get_row_class(record):
c += " table-info"
elif record.note.balance < 0:
c += " table-danger"
# MODE VIEUXCON=ON
if (datetime.datetime.utcnow().timestamp() - record.note.created_at.timestamp()) > 3600 * 24 * 365 * 2.5:
c += " font-weight-bold underline"
return c

View File

@@ -263,23 +263,13 @@ class ActivityEntryView(LoginRequiredMixin, SingleTableMixin, TemplateView):
balance=F("note__balance"))
# Keep only users that have a note
note_qs = note_qs.filter(note__noteuser__isnull=False).exclude(note__inactivity_reason='forced')
if activity.activity_type.name != "Pot Vieux":
# Keep only members
note_qs = note_qs.filter(
note__noteuser__user__memberships__club=activity.attendees_club,
note__noteuser__user__memberships__date_start__lte=timezone.now(),
note__noteuser__user__memberships__date_end__gte=timezone.now(),
)
note_qs = note_qs.filter(note__noteuser__isnull=False)
# Keep only valid members
# note_qs = note_qs.filter(
# note__noteuser__user__memberships__club=activity.attendees_club,
# note__noteuser__user__memberships__date_start__lte=timezone.now(),
# note__noteuser__user__memberships__date_end__gte=timezone.now(),
# )
note_qs = note_qs.filter(
note__noteuser__user__memberships__club=activity.attendees_club,
note__noteuser__user__memberships__date_start__lte=timezone.now(),
note__noteuser__user__memberships__date_end__gte=timezone.now()).exclude(note__inactivity_reason='forced')
# Filter with permission backend
note_qs = note_qs.filter(PermissionBackend.filter_queryset(self.request, Alias, "view"))

View File

@@ -3800,54 +3800,6 @@
"description": "Voir les utilisateurs adhérents au club parent"
}
},
{
"model": "permission.permission",
"pk": 242,
"fields": {
"model": [
"note",
"transaction"
],
"query": "[\"AND\", {\"destination\": [\"club\", \"note\"]}, [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}}, {\"valid\": false}]]",
"type": "add",
"mask": 2,
"field": "",
"permanent": false,
"description": "Créer une transaction vers la note d'un club"
}
},
{
"model": "permission.permission",
"pk": 243,
"fields": {
"model": [
"member",
"profile"
],
"query": "{\"user__memberships__club\": [\"club\"], \"user__memberships__date_start__lte\": [\"today\"],\"user__memberships__date_end__gte\": [\"today\"]}",
"type": "view",
"mask": 3,
"field": "",
"permanent": false,
"description": "Voir les profils des membres du club"
}
},
{
"model": "permission.permission",
"pk": 244,
"fields": {
"model": [
"member",
"membership"
],
"query": "{\"club\": 2}",
"type": "view",
"mask": 1,
"field": "",
"permanent": false,
"description": "Voir les adhérent·e·s Kfet"
}
},
{
"model": "permission.role",
"pk": 1,
@@ -4386,10 +4338,8 @@
168,
176,
177,
178,
197,
211,
244
211
]
}
},
@@ -4427,7 +4377,7 @@
238
]
}
},
},
{
"model": "wei.weirole",
"pk": 12,

74
note_kfet/static/css/custom.css Normal file → Executable file
View File

@@ -65,7 +65,10 @@ mark {
/* Last BDE colors */
.bg-primary {
background-color: rgb(102, 83, 105) !important;
/* background-color: rgb(18, 67, 4) !important; */
/* MODE VIEUXCON=ON */
/* background-color: rgb(166, 0, 2) !important; */
background-color: rgb(100, 30, 100) !important;
}
html {
@@ -80,54 +83,81 @@ body {
.btn-outline-primary:hover,
.btn-outline-primary:not(:disabled):not(.disabled).active,
.btn-outline-primary:not(:disabled):not(.disabled):active {
color: #fff;
background-color: rgb(102, 83, 105);
border-color: rgb(102, 83, 105);
color: rgb(240, 200, 240);
background-color: rgb(30, 120, 150);
border-color: rgb(190, 150, 190);
}
.btn-outline-primary {
color: rgb(102, 83, 105);
background-color: rgba(248, 249, 250, 0.9);
border-color: rgb(102, 83, 105);
color: #a2a;
background-color: #6bc;
border-color: #719;
}
.turbolinks-progress-bar {
background-color: #12432E;
background-color: #12342E;
}
.btn-primary:hover,
.btn-primary:not(:disabled):not(.disabled).active,
.btn-primary:not(:disabled):not(.disabled):active {
color: #fff;
background-color: rgb(102, 83, 105);
border-color: rgb(102, 83, 105);
color: rgb(150, 200, 240);
background-color: rgb(50, 100, 140);
border-color: rgb(0, 0, 0);
}
.btn-primary {
color: rgba(248, 249, 250, 0.9);
background-color: rgb(102, 83, 105);
border-color: rgb(102, 83, 105);
color: #eae;
background-color: #616;
border-color: #000000;
}
.border-primary {
border-color: rgb(115, 15, 115) !important;
border-color: rgb(222, 180, 222) !important;
}
.btn-secondary {
color: #eae;
background-color: #616;
border-color: #000000;
}
.btn-secondary:hover,
.btn-secondary:not(:disabled):not(.disabled).active,
.btn-secondary:not(:disabled):not(.disabled):active {
color: rgb(150, 200, 240);
background-color: rgb(50, 100, 140);
border-color: rgb(0, 0, 0);
}
.btn-outline-dark {
color: #000000;
border-color: #000000;
}
.btn-outline-dark:hover,
.btn-outline-dark:not(:disabled):not(.disabled).active,
.btn-outline-dark:not(:disabled):not(.disabled):active {
color: rgb(50, 100, 160);
background-color: rgb(240, 150, 240);
border-color: rgb(50, 100, 160);
}
a {
color: rgb(102, 83, 105);
color: rgb(0, 150, 150);
}
a:hover {
color: rgb(200, 30, 200);
color: rgb(200, 0, 200);
}
.form-control:focus {
box-shadow: 0 0 0 0.25rem rgba(200, 30, 200, 0.25);
border-color: rgb(200, 30, 200);
box-shadow: 0 0 0 0.25rem rgb(0 150 150 / 50%);
border-color: rgb(0, 200, 200);
}
.btn-outline-primary.focus {
box-shadow: 0 0 0 0.25rem rgba(200, 30, 200, 0.5);
box-shadow: 0 0 0 0.25rem rgb(0 150 150 / 22%);
}

View File

@@ -96,13 +96,11 @@ function displayStyle (note) {
if (!note) { return '' }
const balance = note.balance
var css = ''
var ms_per_year = 31536000000 // 365 * 24 * 3600 * 1000
if (balance < -2000) { css += ' text-danger bg-dark' }
else if (balance < -1000) { css += ' text-danger' }
else if (balance < 0) { css += ' text-warning' }
if (!note.email_confirmed) { css += ' bg-primary' }
else if (!note.is_active || (note.membership && note.membership.date_end < new Date().toISOString())) { css += ' bg-info' }
if (((Date.now() - Date.parse(note.created_at))/ms_per_year) > 2.5) { css += ' font-weight-bold underline' }
return css
}

View File

@@ -158,12 +158,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
</div>
</nav>
<div class="{% block containertype %}container{% endblock %} my-3">
<div id="messages">
{% if user.is_authenticated %}
<div class="alert alert-info">
Les fossiles sont à l'honneur cette semaine, la Note change d'habit rien pour elleux !
</div>
{% endif %}
<div id="messages">
{% if user.is_authenticated %}
{% if not user|is_member:"BDE" %}
<div class="alert alert-danger">