mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
Fixes for features "allow to set user absences"
This commit is contained in:
parent
f1ebc089c3
commit
6749758b46
@ -304,7 +304,7 @@ class User implements UserInterface
|
|||||||
|
|
||||||
public function isAbsent(): bool
|
public function isAbsent(): bool
|
||||||
{
|
{
|
||||||
return (null !== $this->getAbsenceStart() && $this->getAbsenceStart() <= new DateTimeImmutable('now')) ? true : false;
|
return null !== $this->getAbsenceStart() && $this->getAbsenceStart() <= new DateTimeImmutable('now');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +35,7 @@ export interface User {
|
|||||||
id: number;
|
id: number;
|
||||||
username: string;
|
username: string;
|
||||||
text: string;
|
text: string;
|
||||||
|
text_without_absence: string;
|
||||||
email: string;
|
email: string;
|
||||||
user_job: Job;
|
user_job: Job;
|
||||||
label: string;
|
label: string;
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<span class="chill-entity entity-user">
|
<span class="chill-entity entity-user">
|
||||||
{{ user.label }}
|
{{ user.label }}
|
||||||
<span class="user-job" v-if="user.user_job !== null">({{ user.user_job.label.fr }})</span>
|
<span class="user-job" v-if="user.user_job !== null">({{ user.user_job.label.fr }})</span> <span class="main-scope" v-if="user.main_scope !== null">({{ user.main_scope.name.fr }})</span> <span v-if="user.isAbsent" class="badge bg-danger rounded-pill" :title="Absent">A</span>
|
||||||
<span class="main-scope" v-if="user.main_scope !== null">({{ user.main_scope.name.fr }})</span>
|
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -7,11 +7,6 @@
|
|||||||
<span class="main-scope">({{ user.mainScope.name|localize_translatable_string }})</span>
|
<span class="main-scope">({{ user.mainScope.name|localize_translatable_string }})</span>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if opts['absence'] and user.isAbsent %}
|
{%- if opts['absence'] and user.isAbsent %}
|
||||||
{%- if date(user.absenceStart) < date() %}
|
<span class="badge bg-danger rounded-pill" title="{{ 'absence.Absent'|trans|escape('html_attr') }}">{{ 'absence.A'|trans }}</span>
|
||||||
<span class="fa-stack fa-holder" title="{{ 'absence.Absent'|trans }}">
|
|
||||||
<i class="fa fa-circle fa-stack-1x text-danger"></i>
|
|
||||||
<i class="fa fa-stack-1x text-white">A</i>
|
|
||||||
</span>
|
|
||||||
{%- endif %}
|
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
</span>
|
</span>
|
||||||
|
@ -31,6 +31,7 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
|
|||||||
'id' => '',
|
'id' => '',
|
||||||
'username' => '',
|
'username' => '',
|
||||||
'text' => '',
|
'text' => '',
|
||||||
|
'text_without_absent' => '',
|
||||||
'label' => '',
|
'label' => '',
|
||||||
'email' => '',
|
'email' => '',
|
||||||
];
|
];
|
||||||
@ -82,6 +83,7 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
|
|||||||
'id' => $object->getId(),
|
'id' => $object->getId(),
|
||||||
'username' => $object->getUsername(),
|
'username' => $object->getUsername(),
|
||||||
'text' => $this->userRender->renderString($object, []),
|
'text' => $this->userRender->renderString($object, []),
|
||||||
|
'text_without_absent' => $this->userRender->renderString($object, ['absence' => false]),
|
||||||
'label' => $object->getLabel(),
|
'label' => $object->getLabel(),
|
||||||
'email' => (string) $object->getEmail(),
|
'email' => (string) $object->getEmail(),
|
||||||
'user_job' => $this->normalizer->normalize($object->getUserJob(), $format, $userJobContext),
|
'user_job' => $this->normalizer->normalize($object->getUserJob(), $format, $userJobContext),
|
||||||
|
@ -69,7 +69,9 @@ class UserRender implements ChillEntityRenderInterface
|
|||||||
->localize($entity->getMainScope()->getName()) . ')';
|
->localize($entity->getMainScope()->getName()) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
$current_date = new DateTimeImmutable();
|
if ($entity->isAbsent() && $opts['absence']) {
|
||||||
|
$str .= ' (' . $this->translator->trans('absence.Absent') . ')';
|
||||||
|
}
|
||||||
|
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
@ -587,6 +587,8 @@ saved_export:
|
|||||||
|
|
||||||
|
|
||||||
absence:
|
absence:
|
||||||
|
# single letter for absence
|
||||||
|
A: A
|
||||||
My absence: Mon absence
|
My absence: Mon absence
|
||||||
Unset absence: Supprimer la date d'absence
|
Unset absence: Supprimer la date d'absence
|
||||||
Set absence date: Indiquer une date d'absence
|
Set absence date: Indiquer une date d'absence
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
</span>
|
</span>
|
||||||
<span v-if="accompanyingCourse.user" class="d-md-block ms-3 ms-md-0">
|
<span v-if="accompanyingCourse.user" class="d-md-block ms-3 ms-md-0">
|
||||||
<span class="item-key">{{ $t('course.referrer') }}:</span>
|
<span class="item-key">{{ $t('course.referrer') }}:</span>
|
||||||
<span v-if="accompanyingCourse.user.isAbsent" class="fa-stack fa-holder" :title="$t('course.absent')">
|
|
||||||
<i class="fa fa-circle fa-stack-1x text-danger"></i>
|
|
||||||
<i class="fa fa-stack-1x text-white">A</i>
|
|
||||||
</span>
|
|
||||||
<b>{{ accompanyingCourse.user.text }}</b>
|
<b>{{ accompanyingCourse.user.text }}</b>
|
||||||
|
<template v-if="accompanyingCourse.user.isAbsent">
|
||||||
|
|
||||||
|
<span class="badge bg-danger rounded-pill" title="Absent">A</span>
|
||||||
|
</template>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
@ -64,13 +64,15 @@
|
|||||||
import ToggleFlags from './Banner/ToggleFlags';
|
import ToggleFlags from './Banner/ToggleFlags';
|
||||||
import SocialIssue from './Banner/SocialIssue.vue';
|
import SocialIssue from './Banner/SocialIssue.vue';
|
||||||
import PersonsAssociated from './Banner/PersonsAssociated.vue';
|
import PersonsAssociated from './Banner/PersonsAssociated.vue';
|
||||||
|
import UserRenderBoxBadge from 'ChillMainAssets/vuejs/_components/Entity/UserRenderBoxBadge.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Banner',
|
name: 'Banner',
|
||||||
components: {
|
components: {
|
||||||
ToggleFlags,
|
ToggleFlags,
|
||||||
SocialIssue,
|
SocialIssue,
|
||||||
PersonsAssociated
|
PersonsAssociated,
|
||||||
|
UserRenderBoxBadge,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
accompanyingCourse() {
|
accompanyingCourse() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user