mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-29 04:40:55 +02:00
Finish script, finish view, make some progress on template
This commit is contained in:
76
apps/wrapped/templates/wrapped/1/wrapped_base.html
Normal file
76
apps/wrapped/templates/wrapped/1/wrapped_base.html
Normal file
@ -0,0 +1,76 @@
|
||||
{% load static i18n pretty_money getenv %}
|
||||
{% comment %}
|
||||
Copyright (C) 2018-2024 by BDE ENS Paris-Saclay
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
{% endcomment %}
|
||||
<!DOCTYPE html>
|
||||
{% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %}
|
||||
<html lang="{{ LANGUAGE_CODE|default:"en" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %} class="postition-relative h-100">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>
|
||||
{% block title %}{{ title }}{% endblock title %} - {{ request.site.name }}
|
||||
</title>
|
||||
<meta name="description" content="{% trans "The ENS Paris-Saclay BDE note." %}">
|
||||
|
||||
{# Favicon #}
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{% static "wrapped/favicon/1/apple-touch-icon.png" %}">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{% static "wrapped/favicon/1/favicon-32x32.png" %}">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{% static "wrapped/favicon/1/favicon-16x16.png" %}">
|
||||
<link rel="manifest" href="{% static "wrapped/favicon/1/site.webmanifest" %}">
|
||||
<link rel="mask-icon" href="{% static "wrapped/favicon/1/safari-pinned-tab.svg" %}" color="#5bbad5">
|
||||
<link rel="shorcut icon" href="{% static "wrapped/favicon/1/favicon.ico" %}">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="msapplication-config" content="{% static "wrapped/favicon/1/browserconfig.xml" %}">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
{# Bootstrap, Font Awesome and custom CSS #}
|
||||
<link rel="stylesheet" href="{% static "bootstrap4/css/bootstrap.min.css" %}">
|
||||
<link rel="stylesheet" href="{% static "font-awesome/css/font-awesome.min.css" %}">
|
||||
<link rel="stylesheet" href="{% static "wrapped/css/1/custom.css" %}">
|
||||
|
||||
{# JQuery, Bootstrap and Turbolinks JavaScript #}
|
||||
<script src="{% static "jquery/jquery.min.js" %}"></script>
|
||||
<script src="{% static "popper.js/umd/popper.min.js" %}"></script>
|
||||
<script src="{% static "bootstrap4/js/bootstrap.min.js" %}"></script>
|
||||
<script src="{% static "js/turbolinks.js" %}"></script>
|
||||
<script src="{% static "js/base.js" %}"></script>
|
||||
<script src="{% static "js/konami.js" %}"></script>
|
||||
|
||||
{# Translation in javascript files #}
|
||||
<script src="{% static "js/jsi18n/"|add:LANGUAGE_CODE|add:".js" %}"></script>
|
||||
|
||||
{# If extra ressources are needed for a form, load here #}
|
||||
{% if form.media %}
|
||||
{{ form.media }}
|
||||
{% endif %}
|
||||
|
||||
{% block extracss %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% block content %}
|
||||
<p>Default content...</p>
|
||||
{% endblock %}
|
||||
<br>
|
||||
<div class="wrap-container">
|
||||
<h2>{% trans "The NoteKfet this year it's also:" %}</h2>
|
||||
<ul class="list" id="glob_top3_conso">
|
||||
<li>{{ glob_nb_transaction }} {% trans " transactions" %}</li>
|
||||
<li>{{ glob_nb_soiree }} {% trans " party" %}</li>
|
||||
<li>{{ glob_nb_entree_pot }} {% trans " Pot entries" %}</li>
|
||||
<script>
|
||||
let liste = {{ glob_top3_conso | safe }};
|
||||
let ul = document.getElementById("glob_top3_conso");
|
||||
liste.forEach(item => {
|
||||
let li = document.createElement("li");
|
||||
li.textContent = item[1] + " " + item[0];
|
||||
ul.appendChild(li);
|
||||
});
|
||||
</script>
|
||||
<li>{{ glob_nb_vieux_con }} {% trans " old asshole behind the bar" %} </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,8 +0,0 @@
|
||||
{% comment %}
|
||||
Copyright (C) 2018-2024 by BDE ENS Paris-Saclay
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
{% endcomment %}
|
||||
{% block content %}
|
||||
{{ wrapped.data_json }}
|
||||
{% endblock %}
|
||||
|
30
apps/wrapped/templates/wrapped/1/wrapped_view_club.html
Normal file
30
apps/wrapped/templates/wrapped/1/wrapped_view_club.html
Normal file
@ -0,0 +1,30 @@
|
||||
{% extends "wrapped/1/wrapped_base.html" %}
|
||||
{% comment %}
|
||||
COPYRIGHT (C) 2018-2024 BDE ENS Paris-Saclay
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
{% endcomment %}
|
||||
{% load i18n pretty_money %}
|
||||
{% block content %}
|
||||
<div class="wrap-container">
|
||||
<h2>{% trans "NoteKfet Wrapped" %}</h2>
|
||||
<h1 id="name">{{ wrapped.note.club.name }}</h1>
|
||||
{% trans "Your best consumer:" %}
|
||||
<div class="category" id="consumer"></div>
|
||||
{% trans "Your worst creditor:" %}
|
||||
<div class="category" id="creditor"></div>
|
||||
<ul class="list">
|
||||
<li>{{ nb_soiree_orga }}{% trans " party organised" %}</li>
|
||||
<li>{{ nb_member }}{% trans " distinct members" %}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<script>
|
||||
let con = {{ big_consumer | safe }};
|
||||
let cre = {{ big_creancier | safe }};
|
||||
let d1 = document.getElementById("consumer");
|
||||
let d2 = document.getElementById("creditor");
|
||||
if (con) { d1.textContent = con[0] + " with " + con[1] + "€";}
|
||||
else { d1.textContent = "Infortunately, you doesn't have consumer this year...";};
|
||||
if (cre) { d2.textContent = cre[0] + " with " + cre[1] + "€";}
|
||||
else { d2.textContent = "Congratulations you are a real rat !" };
|
||||
</script>
|
||||
{% endblock %}
|
58
apps/wrapped/templates/wrapped/1/wrapped_view_user.html
Normal file
58
apps/wrapped/templates/wrapped/1/wrapped_view_user.html
Normal file
@ -0,0 +1,58 @@
|
||||
{% extends "wrapped/1/wrapped_base.html" %}
|
||||
{% comment %}
|
||||
COPYRIGHT (C) 2018-2024 BDE ENS Paris-Saclay
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
{% endcomment %}
|
||||
{% load i18n pretty_money %}
|
||||
{% block content %}
|
||||
<div class="wrap-container">
|
||||
<h2>{% trans "NoteKfet Wrapped" %}</h2>
|
||||
<h1 id="name">{{ wrapped.note.user.username }}</h1>
|
||||
<div class="category" id="wei">
|
||||
You participate to the wei: {{ wei }} in the bus {{ bus }}
|
||||
</div>
|
||||
<div class="ranking-bar">
|
||||
<div class="ranking-progress" id="pot_bar">
|
||||
{{ nb_pot_entry }}/{{ nb_pots }} pots !
|
||||
</div>
|
||||
<script>
|
||||
const percentage = ({{ nb_pot_entry }} / {{ nb_pots }}) *100;
|
||||
document.getElementById("pot_bar").style.width = percentage + '%';
|
||||
</script>
|
||||
</div>
|
||||
<ul class="list" id="user_conso">
|
||||
<li>Your first conso: {{ first_conso }}</li>
|
||||
<li>Ta catégorie de conso préférée: {{ top_category }}</li>
|
||||
<script>
|
||||
let top3 = {{ top3_conso | safe }};
|
||||
let l = document.getElementById("user_conso");
|
||||
top3.forEach(item => {
|
||||
let li = document.createElement("li");
|
||||
li.textContent = item[1] + " " + item[0];
|
||||
l.appendChild(li);
|
||||
});
|
||||
</script>
|
||||
</ul>
|
||||
<div class="category">
|
||||
Tu as rechargé ta note {{ nb_rechargement }} fois.
|
||||
</div>
|
||||
Tes dépenses globales
|
||||
<div class="ranking-bar">
|
||||
<div class="ranking-progress" id="all_bar">
|
||||
{{ class_conso_all }}/{{ class_part_all }} with {{ amount_conso_all }}€
|
||||
</div>
|
||||
</div>
|
||||
<br>Tes dépenses au BDE
|
||||
<div class="ranking-bar">
|
||||
<div class="ranking-progress" id="bde_bar">
|
||||
{{ class_conso_bde }}/{{ class_part_bde }} with {{ amount_conso_bde }}€
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const p_all = 100 - ({{ class_conso_all }} / {{ class_part_all }}) * 100;
|
||||
const p_bde = 100 - ({{ class_conso_bde }} / {{ class_part_bde }}) * 100;
|
||||
document.getElementById("all_bar").style.width = p_all + '%';
|
||||
document.getElementById("bde_bar").style.width = p_bde + '%';
|
||||
</script>
|
||||
</div>
|
||||
{% endblock %}
|
@ -22,10 +22,17 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
{% block extrajavascript %}
|
||||
<script type="text/javascript">
|
||||
let club_not_public = {{ club_not_public }};
|
||||
if (club_not_public) { (addMsg("{% trans "Do not forget to ask permission to people who are in your wrapped before to make them public" %}", 'warning'));}
|
||||
function refreshTable() {
|
||||
$("#wrapped_table").load(location.pathname + " #wrapped_table");
|
||||
}
|
||||
|
||||
function copylink(id) {
|
||||
navigator.clipboard.writeText({{ request.get_full_path }} + id)
|
||||
.then(() => { addMsg("{% trans "Link copied" %}", 'success', 1000);});
|
||||
}
|
||||
|
||||
function makepublic(id, isprivate) {
|
||||
const makepublic_obj = $('#makepublic_'+id)
|
||||
|
||||
|
Reference in New Issue
Block a user