Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(user-info): display additional data #201

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/t_roles/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
flash,
current_app,
)
import re

from pypnusershub import routes as fnauth
from pypnusershub.db.models import check_and_encrypt_password
Expand Down Expand Up @@ -294,6 +295,11 @@ def buildUserFullName(user):
return " ".join(fullname)


@route.app_template_filter()
def pretty_json_key(key):
return re.sub("([a-z])([A-Z])", "\g<1> \g<2>", key)


def pops(form, with_group=True):
"""
Methode qui supprime les éléments indésirables du formulaires
Expand Down
2 changes: 1 addition & 1 deletion app/temp_users/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def temp_users_list():
temp_users = []
for d in data:
temp_user = d.as_dict()
temp_user["full_name"] = temp_user["nom_role"] + " " + temp_user["prenom_role"]
temp_user["full_name"] = f"{temp_user['nom_role']} {temp_user['prenom_role']}"
app = db.session.query(TApplications).get(temp_user["id_application"])
temp_user["app_name"] = None
if app:
Expand Down
54 changes: 35 additions & 19 deletions app/templates/info_user.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
{%set is_organisme = organisme is not none and organisme['nom_organisme'] != '' %}
{%set is_desc = user['desc_role'] is not none and user['desc_role'] != '' %}
{%set is_remarques = user['remarques'] is not none and user['remarques'] != '' %}
{%set is_champs_addi = user['champs_addi']['organisme'] is not none
{%set is_orga_champ_addi = user['champs_addi']['organisme'] is not none
and user['champs_addi']['organisme'] != '' %}
{%set is_date_insert = user['date_insert'] is not none and user['date_insert'] != '' %}
{%set is_date_update = user['date_update'] is not none and user['date_update'] != '' %}
{%set is_champs_addi = user['champs_addi'] is not none and user['champs_addi'] != '' %}
{%set is_mail = user['email'] is not none and user['email'] != '' %}
{%set is_group = groups|length > 0 %}
{%set is_list = lists|length > 0 %}
Expand All @@ -32,32 +33,47 @@ <h3>Utilisateur "{{fullname}}"</h3>
{% endif %}
{% if is_organisme %}
<br /><strong>Organisme :</strong> {{organisme.nom_organisme}}
{% elif is_champs_addi %}
{% elif is_orga_champ_addi %}
<br /><strong>Organisme :</strong> {{user['champs_addi']['organisme']}}
{% endif %}
{% if is_remarques %}
<br /><strong>Remarques :</strong> {{user['remarques']}}
{% endif %}
{% if user['pass_plus'] == "" or user["pass_plus"] is none %}
<br /><strong>Mot de passe Plus :</strong> Non
{%else %}
<br /><strong>Mot de passe Plus :</strong> Oui
{% endif %}
{% if user['pass_md5'] == "" or user["pass_md5"] is none %}
<br /><strong>Mot de passe Md5 :</strong> Non
{%else %}
<br /><strong>Mot de passe Md5 :</strong> Oui
{% endif %}
{% if user['active'] == True %}
<br /><strong>Compte Actif :</strong> Oui
{%else %}
<br /><strong>Compte Actif :</strong> Non
{% endif %}


<br /><strong>Mot de passe Plus :</strong> {"Non" if user['pass_plus'] == "" or user["pass_plus"] is none else "Oui"}
<br /><strong>Mot de passe Md5 :</strong> {"Non" if user['pass_md5'] == "" or user["pass_md5"] is none else "Oui"}
<br /><strong>Compte Actif :</strong> {{"Oui" if user["active"] else "Non" }}
{% if is_date_insert %}
<br /><strong class="text-muted">Date de création :</strong> {{user['date_insert']|truncate(10, True, '', 0)}}
<br /><strong>Date de création :</strong> {{user['date_insert']|truncate(10, True, '', 0)}}
{% endif %}
{% if is_date_update %}
<br /><strong class="text-muted">Date de mise à jour :</strong> {{user['date_update']|truncate(10, True, '', 0)}}
<br /><strong>Date de mise à jour :</strong> {{user['date_update']|truncate(10, True, '', 0)}}
{% endif %}
{% if is_champs_addi %}
<dl class="list-def-inline">
{% for key, value in user.champs_addi.items() %}
<dt>{{ key|pretty_json_key|capitalize }} : </dt>
<dd>
{% if value is iterable and (value is not string and value is not mapping) %}
<ul>
{% for item in value %}
<li>{{ item }}</li>
{% endfor %}
</ul>
{% elif value is mapping %}
<dl class="list-def-inline">
{% for key, value in value.items() %}
<dt>{{ key|e|capitalize }} : </dt>
<dd>{{ value }} </dd>
{% endfor %}
</dl>
{% else %}
{{ value }}
{% endif %}
</dd>
{% endfor %}
</dl>
{% endif %}
</small>
</div>
Expand Down
32 changes: 22 additions & 10 deletions app/templates/librairies.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,20 @@
{% block title %}UsersHub V2{% endblock %}

{% block styles %}

<style type="text/css">
dl.list-def-inline {
display: grid;
grid-template-columns: max-content auto;
}

dl.list-def-inline dt {
grid-column-start: 1;
}

dl.list-def-inline dd {
grid-column-start: 2;
}

#add {
-ms-transform: rotate(180deg); /* IE 9 */
Expand All @@ -19,7 +31,7 @@
.font-medium {
font-size: 25px !important;
}

.forms {
padding: 40px !important;
}
Expand Down Expand Up @@ -65,20 +77,20 @@


{% block scripts %}
<script
<script
src="{{ url_for('static', filename='node_modules/jquery/dist/jquery.min.js') }}"
type="text/javascript"
></script>
<script
></script>
<script
src="{{ url_for('static', filename='node_modules/bootstrap/dist/js/bootstrap.js') }}"
type="text/javascript"
></script>
<script
></script>
<script
src=" {{url_for('static', filename='node_modules/datatables.net/js/jquery.dataTables.min.js')}} "
type="text/javascript"
></script>
<script src="{{ url_for('constants_js') }} " type="text/javascript"></script>
<script
></script>
<script src="{{ url_for('constants_js') }} " type="text/javascript"></script>
<script
src="{{ url_for('static', filename='transfer.js') }}"
type="text/javascript"
></script>
Expand Down
Loading