Merge remote-tracking branch 'origin/master' into calendar/finalization

This commit is contained in:
2022-06-17 16:53:56 +02:00
35 changed files with 852 additions and 170 deletions

View File

@@ -54,9 +54,9 @@ class PrivateCommentEmbeddable
return $this;
}
public function setCommentForUser(User $user, string $content): self
public function setCommentForUser(User $user, ?string $content): self
{
$this->comments[$user->getId()] = trim($content);
$this->comments[$user->getId()] = trim((string) $content);
return $this;
}

View File

@@ -43,6 +43,7 @@ class UserCurrentLocationType extends AbstractType
},
'placeholder' => 'Pick a location',
'required' => false,
'attr' => ['class' => 'select2'],
]);
}
}

View File

@@ -109,6 +109,7 @@ class WorkflowStepType extends AbstractType
'multiple' => false,
'expanded' => true,
'choices' => $choices,
'constraints' => [new NotNull()],
'choice_label' => function (Transition $transition) use ($workflow) {
$meta = $workflow->getMetadataStore()->getTransitionMetadata($transition);
@@ -208,24 +209,28 @@ class WorkflowStepType extends AbstractType
$transition = $form['transition']->getData();
$toFinal = true;
foreach ($transition->getTos() as $to) {
$meta = $workflow->getMetadataStore()->getPlaceMetadata($to);
if (
!array_key_exists('isFinal', $meta) || false === $meta['isFinal']
) {
$toFinal = false;
}
}
$destUsers = $form['future_dest_users']->getData();
$destEmails = $form['future_dest_emails']->getData();
if (!$toFinal && [] === $destUsers && [] === $destEmails) {
if (null === $transition) {
$context
->buildViolation('workflow.You must add at least one dest user or email')
->atPath('future_dest_users')
->addViolation();
->buildViolation('workflow.You must select a next step, pick another decision if no next steps are available');
} else {
foreach ($transition->getTos() as $to) {
$meta = $workflow->getMetadataStore()->getPlaceMetadata($to);
if (
!array_key_exists('isFinal', $meta) || false === $meta['isFinal']
) {
$toFinal = false;
}
}
$destUsers = $form['future_dest_users']->getData();
$destEmails = $form['future_dest_emails']->getData();
if (!$toFinal && [] === $destUsers && [] === $destEmails) {
$context
->buildViolation('workflow.You must add at least one dest user or email')
->atPath('future_dest_users')
->addViolation();
}
}
}
),

View File

@@ -15,26 +15,69 @@
<span v-if="forceRedirect">{{ $t('wait_redirection') }}</span>
</div>
<div v-if="showMessageWhenNoAddress" class="mt-5">
<p class="chill-no-data-statement">
{{ $t('not_yet_address') }}
</p>
<div v-if="(!this.context.edit && !this.flag.success && this.context.target.name !== 'household')" class="mt-5">
<div class="no-address-yet">
<i class="fa fa-map-marker" aria-hidden="true"></i>
<p class="chill-no-data-statement">
{{ $t('not_yet_address') }}
</p>
<action-buttons
:options="this.options"
:defaultz="this.defaultz"
class="add-address-btn">
<template v-slot:action>
<button @click.prevent="$emit('openEditPane')"
class="btn" :class="getClassButton"
type="button" name="button" :title="$t(getTextButton)">
<span v-if="displayTextButton">{{ $t(getTextButton) }}</span>
</button>
</template>
</action-buttons>
</div>
</div>
<div v-if="this.context.edit" class="mb-3 row">
<div class="col-sm-4"></div>
<div class="address-container col-sm-8">
<address-render-box :address="address" :isMultiline="false" :useDatePane="useDatePane"></address-render-box>
</div>
</div>
<div v-if="this.context.target.name === 'household' || this.context.edit">
<action-buttons
:options="this.options"
:defaultz="this.defaultz">
<template v-slot:action>
<button @click.prevent="$emit('openEditPane')"
class="btn btn-sm" :class="getClassButton"
type="button" name="button" :title="$t(getTextButton)">
<span v-if="displayTextButton">{{ $t(getTextButton) }}</span>
</button>
</template>
</action-buttons>
</div>
<div v-if="!this.context.edit">
<address-render-box :address="address" :isMultiline="false" :useDatePane="useDatePane"></address-render-box>
</div>
<address-render-box :address="address" :useDatePane="useDatePane"></address-render-box>
</div>
<action-buttons
:options="this.options"
:defaultz="this.defaultz">
<template v-slot:action>
<button @click.prevent="$emit('openEditPane')"
class="btn" :class="getClassButton"
type="button" name="button" :title="$t(getTextButton)">
<span v-if="displayTextButton">{{ $t(getTextButton) }}</span>
</button>
</template>
</action-buttons>
<div v-if="onlyButton">
<action-buttons
:options="this.options"
:defaultz="this.defaultz"
class="add-address-btn">
<template v-slot:action>
<button @click.prevent="$emit('openEditPane')"
class="btn" :class="getClassButton"
type="button" name="button" :title="$t(getTextButton)">
<span v-if="displayTextButton">{{ $t(getTextButton) }}</span>
</button>
</template>
</action-buttons>
</div>
</template>
@@ -58,6 +101,9 @@ export default {
'useDatePane'
],
emits: ['openEditPane'],
mounted() {
console.log('context', this.context)
},
computed: {
address() {
return this.entity.address;
@@ -91,13 +137,35 @@ export default {
forceRedirect() {
return (!(this.context.backUrl === null || typeof this.context.backUrl === 'undefined'));
},
showMessageWhenNoAddress() {
let showMessageWhenNoAddress = this.options.showMessageWhenNoAddress === undefined ? this.defaultz.showMessageWhenNoAddress : this.options.showMessageWhenNoAddress;
if (showMessageWhenNoAddress === true || showMessageWhenNoAddress === false) {
return !this.context.edit && !this.address.id && showMessageWhenNoAddress;
}
return !this.context.edit && !this.address.id && this.options.stickyActions;
}
// showMessageWhenNoAddress() {
// let showMessageWhenNoAddress = this.options.showMessageWhenNoAddress === undefined ? this.defaultz.showMessageWhenNoAddress : this.options.showMessageWhenNoAddress;
// if (showMessageWhenNoAddress === true || showMessageWhenNoAddress === false) {
// return !this.context.edit && !this.address.id && showMessageWhenNoAddress;
// }
// return !this.context.edit && !this.address.id && this.options.stickyActions;
// }
}
};
</script>
<style lang="scss">
.address-container {
display:flex;
justify-content:flex-end;
border-radius: 5px;
}
.no-address-yet {
text-align: center;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
padding:1.5rem;
margin-bottom:2rem;
i {
font-size:2rem;
margin-bottom:2rem;
}
.add-address-btn {
display: block
}
}
</style>

View File

@@ -1,5 +1,5 @@
<template>
<div class="alert alert-light">{{ $t('my_tasks.description_warning') }}</div>
<span v-if="noResultsAlert" class="chill-no-data-statement">{{ $t('no_data') }}</span>
<tab-table v-else>
@@ -11,7 +11,8 @@
</template>
<template v-slot:tbody>
<tr v-for="(t, i) in tasks.alert.results" :key="`task-alert-${i}`">
<td>{{ $d(t.warningDate.datetime, 'short') }}</td>
<td v-if="null !== t.warningDate">{{ $d(t.warningDate.datetime, 'short') }}</td>
<td v-else></td>
<td>
<span class="outdated">{{ $d(t.endDate.datetime, 'short') }}</span>
</td>
@@ -24,7 +25,7 @@
</tr>
</template>
</tab-table>
<div class="alert alert-light">{{ $t('my_tasks.description_alert') }}</div>
<span v-if="noResultsWarning" class="chill-no-data-statement">{{ $t('no_data') }}</span>
<tab-table v-else>
@@ -49,7 +50,7 @@
</tr>
</template>
</tab-table>
</template>
<script>

View File

@@ -115,5 +115,6 @@
{% endfor %}
</div>
{% endif %}
{{ chill_pagination(paginator) }}
</div>
{% endblock %}

View File

@@ -16,6 +16,7 @@ use Chill\MainBundle\Notification\Counter\NotificationByUserCounter;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\MainBundle\Workflow\Counter\WorkflowByUserCounter;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -25,6 +26,8 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
private NotificationByUserCounter $notificationByUserCounter;
private RequestStack $requestStack;
private Security $security;
private TranslatorInterface $translator;
@@ -36,13 +39,15 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
WorkflowByUserCounter $workflowByUserCounter,
Security $security,
TranslatorInterface $translator,
ParameterBagInterface $parameterBag
ParameterBagInterface $parameterBag,
RequestStack $requestStack
) {
$this->notificationByUserCounter = $notificationByUserCounter;
$this->workflowByUserCounter = $workflowByUserCounter;
$this->security = $security;
$this->translator = $translator;
$this->parameterBag = $parameterBag;
$this->requestStack = $requestStack;
}
public function buildMenu($menuId, \Knp\Menu\MenuItem $menu, array $parameters)
@@ -59,7 +64,12 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
$menu
->addChild(
$locationTextMenu,
['route' => 'chill_main_user_currentlocation_edit']
[
'route' => 'chill_main_user_currentlocation_edit',
'routeParameters' => [
'returnPath' => $this->requestStack->getCurrentRequest()->getRequestUri(),
],
]
)
->setExtras([
'order' => -9999999,

View File

@@ -463,6 +463,7 @@ workflow:
Previous transitionned: Anciens workflows
Previous workflow transitionned help: Workflows où vous avez exécuté une action.
For: Pour
You must select a next step, pick another decision if no next steps are available: Il faut une prochaine étape. Choissisez une autre décision si nécessaire.
Subscribe final: Recevoir une notification à l'étape finale