mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
FIX [render] use isAbsent method to render user as absent or not + place homepage msg above searchbar
This commit is contained in:
parent
f76c031ff3
commit
bb7d072cc8
@ -304,7 +304,7 @@ class User implements UserInterface
|
||||
|
||||
public function isAbsent(): bool
|
||||
{
|
||||
return null !== $this->getAbsenceStart() ? true : false;
|
||||
return (null !== $this->getAbsenceStart() && $this->getAbsenceStart() <= new DateTimeImmutable('now')) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,7 @@
|
||||
{%- if opts['main_scope'] and user.mainScope is not null %}
|
||||
<span class="main-scope">({{ user.mainScope.name|localize_translatable_string }})</span>
|
||||
{%- endif -%}
|
||||
{%- if opts['absence'] and user.absenceStart is not null %}
|
||||
{%- if opts['absence'] and user.isAbsent %}
|
||||
{%- if date(user.absenceStart) < date() %}
|
||||
<span class="fa-stack fa-holder" title="{{ 'absence.Absent'|trans }}">
|
||||
<i class="fa fa-circle fa-stack-1x text-danger"></i>
|
||||
|
@ -1,10 +1,5 @@
|
||||
<div class="col-10 mt-5">
|
||||
|
||||
{# vue component #}
|
||||
{% if app.user.absenceStart is not null and date(app.user.absenceStart) < date() %}
|
||||
<p class="alert alert-warning" role="alert">{{'absence.You are marked as being absent'|trans }}</p>
|
||||
{% endif %}
|
||||
|
||||
<div id="homepage_widget"></div>
|
||||
|
||||
{% include '@ChillMain/Homepage/fast_actions.html.twig' %}
|
||||
|
@ -69,6 +69,11 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="col-8 main_search">
|
||||
{% if app.user.isAbsent %}
|
||||
<div class="row mb-5">
|
||||
<p class="alert alert-warning" role="alert">{{'absence.You are marked as being absent'|trans }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
<h2>{{ 'Search'|trans }}</h2>
|
||||
|
||||
<form action="{{ path('chill_main_search') }}" method="get">
|
||||
|
@ -71,7 +71,7 @@ class UserRender implements ChillEntityRenderInterface
|
||||
|
||||
$current_date = new DateTimeImmutable();
|
||||
|
||||
if (null !== $entity->getAbsenceStart() && $entity->getAbsenceStart() < $current_date && $opts['main_scope']) {
|
||||
if ($entity->isAbsent() && $opts['main_scope']) {
|
||||
$str .= ' (' . $this->translator->trans('absence.Absent') . ')';
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user