Compare commits

...

45 Commits

Author SHA1 Message Date
73ccdd8b6e Pipeline fixes 2025-03-27 19:04:46 +01:00
4f170bf4cf Move cancel reason into red label 2025-03-27 18:45:34 +01:00
cfbf7b4599 Use translation with capital letter 2025-03-27 18:40:17 +01:00
8941016038 Merge branch 'master' into 285-cancel-calendar 2025-03-27 18:35:20 +01:00
f059edcc8e Add button unique signature zone 2025-03-24 12:49:32 +01:00
55c7dbf44e Only change sms status upon cancellation if sendSMS is true 2025-03-03 13:25:08 +01:00
8336a93aeb Re-establish canceled tag and strikethrough 2025-03-03 13:21:35 +01:00
caf0407451 Resolve merge conflicts after rebase 2025-03-03 13:14:00 +01:00
e3b666921e Add condition for preparing cancellation message 2025-03-03 13:10:36 +01:00
0306af1a0c template adjustments + add missing translations 2025-03-03 13:10:04 +01:00
309cc64275 work on syncing with remote calendar 2025-03-03 12:18:50 +01:00
129690ca3f Set the sms status to 'canceled' 2025-03-03 12:18:50 +01:00
54d9f7152b Add translation, make reason required, and change template for form 2025-03-03 12:18:14 +01:00
809fda470b Fix form to submit cancel reason 2025-03-03 12:18:14 +01:00
42b3ab3698 Add cancel reason form 2025-03-03 12:18:11 +01:00
be532cb14c Initial setup of controller and templates 2025-03-03 12:17:48 +01:00
4ed3bec115 Pipeline corrections 2025-03-03 12:14:30 +01:00
8f84b1e137 Adjust display of canceled calendar items in the list 2025-03-03 12:14:30 +01:00
88a84ed996 Add a logger notice when calendar is canceled 2025-03-03 12:14:30 +01:00
d87523beb7 Set the sms status to 'canceled' 2025-03-03 12:14:30 +01:00
33edb22b50 Use a different button type 2025-03-03 12:14:30 +01:00
607f1b7c3f Only show cancel button with EDIT permission 2025-03-03 12:14:30 +01:00
57bc61b218 Add translation, make reason required, and change template for form 2025-03-03 12:14:30 +01:00
5efbec9b42 Fix form to submit cancel reason 2025-03-03 12:14:30 +01:00
626a77b040 Add cancel reason form 2025-03-03 12:14:30 +01:00
a0e0d600e6 Initial setup of controller and templates 2025-03-03 12:14:30 +01:00
f1221286f3 work on syncing with remote calendar 2025-01-15 11:22:38 +01:00
ed99d8d60b resolve merge conflict 2025-01-14 13:37:07 +01:00
b2e27700bb Pipeline corrections 2025-01-14 13:34:16 +01:00
63b207a2e7 Adjust display of canceled calendar items in the list 2025-01-14 13:34:16 +01:00
b1c3daf246 Add a logger notice when calendar is canceled 2025-01-14 13:34:16 +01:00
761b0a3ecc Set the sms status to 'canceled' 2025-01-14 13:34:16 +01:00
e8587d5be8 Use a different button type 2025-01-14 13:34:16 +01:00
9d159e79fa Only show cancel button with EDIT permission 2025-01-14 13:34:16 +01:00
c779f53617 Add translation, make reason required, and change template for form 2025-01-14 13:34:16 +01:00
c4560b3d89 Fix form to submit cancel reason 2025-01-14 13:34:16 +01:00
6472c45b42 Add cancel reason form 2025-01-14 13:34:16 +01:00
c307aa5a12 Initial setup of controller and templates 2025-01-14 13:34:16 +01:00
5c85f0478b Set the sms status to 'canceled' 2024-12-18 13:48:56 +01:00
45be73161a Use a different button type 2024-12-18 13:36:20 +01:00
e76e815c49 Only show cancel button with EDIT permission 2024-12-18 13:20:17 +01:00
cce79de711 Add translation, make reason required, and change template for form 2024-12-17 16:04:05 +01:00
d0d3be9bc1 Fix form to submit cancel reason 2024-12-17 09:35:52 +01:00
ace377abba Add cancel reason form 2024-12-16 19:08:42 +01:00
fc3eda7b76 Initial setup of controller and templates 2024-12-12 15:40:51 +01:00
12 changed files with 315 additions and 47 deletions

View File

@@ -13,6 +13,7 @@ namespace Chill\CalendarBundle\Controller;
use Chill\CalendarBundle\Entity\Calendar;
use Chill\CalendarBundle\Form\CalendarType;
use Chill\CalendarBundle\Form\CancelType;
use Chill\CalendarBundle\RemoteCalendar\Connector\RemoteCalendarConnectorInterface;
use Chill\CalendarBundle\Repository\CalendarACLAwareRepositoryInterface;
use Chill\CalendarBundle\Security\Voter\CalendarVoter;
@@ -30,6 +31,7 @@ use Chill\PersonBundle\Repository\PersonRepository;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Doctrine\ORM\EntityManagerInterface;
use http\Exception\UnexpectedValueException;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -60,6 +62,7 @@ class CalendarController extends AbstractController
private readonly UserRepositoryInterface $userRepository,
private readonly TranslatorInterface $translator,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
private readonly EntityManagerInterface $em,
) {}
/**
@@ -111,6 +114,52 @@ class CalendarController extends AbstractController
]);
}
#[Route(path: '/{_locale}/calendar/calendar/{id}/cancel', name: 'chill_calendar_calendar_cancel')]
public function cancelAction(Calendar $calendar, Request $request): Response
{
// Deal with sms being sent or not
// Communicate cancellation with the remote calendar.
$this->denyAccessUnlessGranted(CalendarVoter::EDIT, $calendar);
[$person, $accompanyingPeriod] = [$calendar->getPerson(), $calendar->getAccompanyingPeriod()];
$form = $this->createForm(CancelType::class, $calendar);
$form->add('submit', SubmitType::class);
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$view = '@ChillCalendar/Calendar/cancelCalendarByAccompanyingCourse.html.twig';
$redirectRoute = $this->generateUrl('chill_calendar_calendar_list_by_period', ['id' => $accompanyingPeriod->getId()]);
} elseif ($person instanceof Person) {
$view = '@ChillCalendar/Calendar/cancelCalendarByPerson.html.twig';
$redirectRoute = $this->generateUrl('chill_calendar_calendar_list_by_person', ['id' => $person->getId()]);
} else {
throw new \RuntimeException('nor person or accompanying period');
}
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$calendar->setStatus($calendar::STATUS_CANCELED);
if ($calendar->getSendSMS()) {
$calendar->setSmsStatus($calendar::SMS_CANCEL_PENDING);
}
$this->em->flush();
$this->addFlash('success', $this->translator->trans('chill_calendar.calendar_canceled'));
return new RedirectResponse($redirectRoute);
}
return $this->render($view, [
'calendar' => $calendar,
'form' => $form->createView(),
'accompanyingCourse' => $accompanyingPeriod,
'person' => $person,
]);
}
/**
* Edit a calendar item.
*/

View File

@@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Form;
use Chill\CalendarBundle\Entity\Calendar;
use Chill\CalendarBundle\Entity\CancelReason;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CancelType extends AbstractType
{
public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper) {}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('cancelReason', EntityType::class, [
'class' => CancelReason::class,
'required' => true,
'choice_label' => fn (CancelReason $cancelReason) => $this->translatableStringHelper->localize($cancelReason->getName()),
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Calendar::class,
]);
}
}

View File

@@ -21,6 +21,7 @@ namespace Chill\CalendarBundle\Messenger\Doctrine;
use Chill\CalendarBundle\Entity\Calendar;
use Chill\CalendarBundle\Messenger\Message\CalendarMessage;
use Chill\CalendarBundle\Messenger\Message\CalendarRemovedMessage;
use Chill\MainBundle\Entity\User;
use Doctrine\ORM\Event\PostPersistEventArgs;
use Doctrine\ORM\Event\PostRemoveEventArgs;
use Doctrine\ORM\Event\PostUpdateEventArgs;
@@ -31,6 +32,17 @@ class CalendarEntityListener
{
public function __construct(private readonly MessageBusInterface $messageBus, private readonly Security $security) {}
private function getAuthenticatedUser(): User
{
$user = $this->security->getUser();
if (!$user instanceof User) {
throw new \LogicException('Expected an instance of User.');
}
return $user;
}
public function postPersist(Calendar $calendar, PostPersistEventArgs $args): void
{
if (!$calendar->preventEnqueueChanges) {
@@ -38,7 +50,7 @@ class CalendarEntityListener
new CalendarMessage(
$calendar,
CalendarMessage::CALENDAR_PERSIST,
$this->security->getUser()
$this->getAuthenticatedUser()
)
);
}
@@ -50,7 +62,7 @@ class CalendarEntityListener
$this->messageBus->dispatch(
new CalendarRemovedMessage(
$calendar,
$this->security->getUser()
$this->getAuthenticatedUser()
)
);
}
@@ -58,12 +70,21 @@ class CalendarEntityListener
public function postUpdate(Calendar $calendar, PostUpdateEventArgs $args): void
{
if ($calendar->getStatus() === $calendar::STATUS_CANCELED) {
$this->messageBus->dispatch(
new CalendarRemovedMessage(
$calendar,
$this->getAuthenticatedUser()
)
);
}
if (!$calendar->preventEnqueueChanges) {
$this->messageBus->dispatch(
new CalendarMessage(
$calendar,
CalendarMessage::CALENDAR_UPDATE,
$this->security->getUser()
$this->getAuthenticatedUser()
)
);
}

View File

@@ -70,6 +70,8 @@ class CalendarRemovedMessage
public function getRemoteId(): string
{
dump($this->remoteId);
return $this->remoteId;
}
}

View File

@@ -10,6 +10,9 @@
<div class="item-col">
<div class="wrap-header">
<div class="wl-row">
{% if calendar.status == 'canceled' %}
<p class="badge rounded-pill bg-danger">{{ 'chill_calendar.canceled'|trans }}: <span>{{ calendar.cancelReason.name|localize_translatable_string }}</span></p>
{% endif %}
<div class="wl-col title">
<p class="date-label">
{% if context == 'person' and calendar.context == 'accompanying_period' %}
@@ -19,6 +22,9 @@
</span>
</a>
{% endif %}
{% if calendar.status == 'canceled' %}
<del>
{% endif %}
{% if calendar.endDate.diff(calendar.startDate).days >= 1 %}
{{ calendar.startDate|format_datetime('short', 'short') }}
- {{ calendar.endDate|format_datetime('short', 'short') }}
@@ -26,13 +32,21 @@
{{ calendar.startDate|format_datetime('short', 'short') }}
- {{ calendar.endDate|format_datetime('none', 'short') }}
{% endif %}
</p>
{% if calendar.status == 'canceled' %}
</del>
{% endif %}
{# {% if calendar.status == 'canceled' %}#}
{# <p>#}
{# <span>{{ 'chill_calendar.cancel_reason'|trans }}:</span>#}
{##}
{# </p>#}
{# {% endif %}#}
<div class="duration short-message">
<i class="fa fa-fw fa-hourglass-end"></i>
{{ calendar.duration|date('%H:%I') }}
{% if false == calendar.sendSMS or null == calendar.sendSMS %}
<!-- no sms will be send -->
<!-- no sms will be sent -->
{% else %}
{% if calendar.smsStatus == 'sms_sent' %}
<span title="{{ 'SMS already sent'|trans }}" class="badge bg-info">
@@ -63,8 +77,7 @@
</div>
</div>
{% if calendar.comment.comment is not empty
or calendar.users|length > 0
{% if calendar.users|length > 0
or calendar.thirdParties|length > 0
or calendar.users|length > 0 %}
<div class="item-row details separator">
@@ -103,12 +116,13 @@
</div>
{% endif %}
<div class="item-row separator column">
<div>
{{ include('@ChillCalendar/Calendar/_documents.twig.html') }}
{% if calendar.documents is not empty %}
<div class="item-row separator column">
<div>
{{ include('@ChillCalendar/Calendar/_documents.twig.html') }}
</div>
</div>
</div>
{% endif %}
{% if calendar.activity is not null %}
<div class="item-row separator">
@@ -151,7 +165,7 @@
<div class="item-row separator">
<ul class="record_actions">
{% if is_granted('CHILL_CALENDAR_DOC_EDIT', calendar) %}
{% if is_granted('CHILL_CALENDAR_DOC_EDIT', calendar) and calendar.status is not constant('STATUS_CANCELED', calendar) %}
{% if templates|length == 0 %}
<li>
<a class="btn btn-create"
@@ -191,6 +205,7 @@
or
(calendar.context == 'person' and is_granted('CHILL_ACTIVITY_CREATE', calendar.person))
)
and calendar.status is not constant('STATUS_CANCELED', calendar)
%}
<li>
<a class="btn btn-create"
@@ -213,11 +228,16 @@
class="btn btn-show "></a>
</li>
{% endif %}
{% if is_granted('CHILL_CALENDAR_CALENDAR_EDIT', calendar) %}
{% if is_granted('CHILL_CALENDAR_CALENDAR_EDIT', calendar) and calendar.status is not constant('STATUS_CANCELED', calendar) %}
<li>
<a href="{{ chill_path_add_return_path('chill_calendar_calendar_edit', { 'id': calendar.id }) }}"
class="btn btn-update "></a>
</li>
<li>
<a href="{{ chill_path_add_return_path('chill_calendar_calendar_cancel', { 'id': calendar.id } ) }}"
class="btn btn-remove">{{ 'Cancel'|trans }}</a>
</li>
{% endif %}
{% if is_granted('CHILL_CALENDAR_CALENDAR_DELETE', calendar) %}
<li>

View File

@@ -0,0 +1,29 @@
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
{% block title 'chill_calendar.cancel_calendar_item'|trans %}
{% block content %}
{{ form_start(form) }}
{{ form_row(form.cancelReason) }}
<ul class="record_actions sticky-form-buttons">
<li class="save">
<a
class="btn btn-cancel"
href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'id': accompanyingCourse.id } )}}"
>
{{ 'Cancel'|trans|chill_return_path_label }}
</a>
</li>
<li>
{{ form_widget(form.submit, { 'attr' : { 'class': 'btn btn-save' }, 'label': 'Save' } ) }}
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@@ -0,0 +1,29 @@
{% extends "@ChillPerson/Person/layout.html.twig" %}
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
{% block title 'chill_calendar.cancel_calendar_item'|trans %}
{% block content %}
{{ form_start(form) }}
{{ form_row(form.cancelReason) }}
<ul class="record_actions sticky-form-buttons">
<li class="save">
<a
class="btn btn-cancel"
href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'id': person.id } )}}"
>
{{ 'Cancel'|trans|chill_return_path_label }}
</a>
</li>
<li>
{{ form_widget(form.submit, { 'attr' : { 'class': 'btn btn-save' }, 'label': 'Save' } ) }}
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@@ -19,6 +19,7 @@ declare(strict_types=1);
namespace Chill\CalendarBundle\Service\ShortMessageNotification;
use Chill\CalendarBundle\Entity\Calendar;
use Chill\CalendarBundle\Entity\CancelReason;
use libphonenumber\PhoneNumberFormat;
use libphonenumber\PhoneNumberUtil;
use Symfony\Component\Notifier\Message\SmsMessage;
@@ -57,7 +58,7 @@ class DefaultShortMessageForCalendarBuilder implements ShortMessageForCalendarBu
$this->phoneUtil->format($person->getMobilenumber(), PhoneNumberFormat::E164),
$this->engine->render('@ChillCalendar/CalendarShortMessage/short_message.txt.twig', ['calendar' => $calendar]),
);
} elseif (Calendar::SMS_CANCEL_PENDING === $calendar->getSmsStatus()) {
} elseif (Calendar::SMS_CANCEL_PENDING === $calendar->getSmsStatus() && !(CancelReason::CANCELEDBY_PERSON === $calendar->getCancelReason()->getCanceledBy())) {
$toUsers[] = new SmsMessage(
$this->phoneUtil->format($person->getMobilenumber(), PhoneNumberFormat::E164),
$this->engine->render('@ChillCalendar/CalendarShortMessage/short_message_canceled.txt.twig', ['calendar' => $calendar]),

View File

@@ -44,6 +44,10 @@ crud:
title_edit: Modifier le motif d'annulation
chill_calendar:
canceled: Annulé
cancel_reason: Raison d'annulation
cancel_calendar_item: Annuler rendez-vous
calendar_canceled: Le rendez-vous a été annulé
Document: Document d'un rendez-vous
form:
The main user is mandatory. He will organize the appointment.: L'utilisateur principal est obligatoire. Il est l'organisateur de l'événement.
@@ -66,8 +70,6 @@ chill_calendar:
Are you sure you want to remove the doc?: Êtes-vous sûr·e de vouloir supprimer le document associé ?
Document outdated: La date et l'heure du rendez-vous ont été modifiés après la création du document
remote_ms_graph:
freebusy_statuses:
busy: Occupé

View File

@@ -2,26 +2,26 @@
<teleport to="body">
<modal v-if="modalOpen" @close="modalOpen = false">
<template v-slot:header>
<h2>{{ $t("signature_confirmation") }}</h2>
<h2>{{ trans(SIGNATURES_SIGNATURE_CONFIRMATION) }}</h2>
</template>
<template v-slot:body>
<div class="signature-modal-body text-center" v-if="loading">
<p>{{ $t("electronic_signature_in_progress") }}</p>
<p>{{ trans(SIGNATURES_ELECTRONIC_SIGNATURE_IN_PROGRESS) }}</p>
<div class="loading">
<i
class="fa fa-circle-o-notch fa-spin fa-3x"
:title="$t('loading')"
:title="trans(SIGNATURES_LOADING)"
></i>
</div>
</div>
<div class="signature-modal-body text-center" v-else>
<p>{{ $t("you_are_going_to_sign") }}</p>
<p>{{ $t("are_you_sure") }}</p>
<p>{{ trans(SIGNATURES_YOU_ARE_GOING_TO_SIGN) }}</p>
<p>{{ trans(SIGNATURES_ARE_YOU_SURE) }}</p>
</div>
</template>
<template v-slot:footer>
<button class="btn btn-action" @click.prevent="confirmSign">
{{ $t("yes") }}
{{ trans(SIGNATURES_YES) }}
</button>
</template>
</modal>
@@ -82,7 +82,7 @@
@change="toggleMultiPage"
/>
<label class="form-check-label" for="checkboxMulti">
{{ $t("all_pages") }}
{{ trans(SIGNATURES_ALL_PAGES) }}
</label>
</template>
</div>
@@ -95,7 +95,7 @@
class="btn btn-light btn-sm"
@click="turnSignature(-1)"
>
{{ $t("last_zone") }}
{{ trans(SIGNATURES_LAST_ZONE) }}
</button>
<span>|</span>
<button
@@ -103,7 +103,7 @@
class="btn btn-light btn-sm"
@click="turnSignature(1)"
>
{{ $t("next_zone") }}
{{ trans(SIGNATURES_NEXT_ZONE) }}
</button>
</div>
<div class="col text-end" v-if="signedState !== 'signed'">
@@ -112,9 +112,9 @@
:hidden="!userSignatureZone"
@click="undoSign"
v-if="signature.zones.length > 1"
:title="$t('choose_another_signature')"
:title="trans(SIGNATURES_CHOOSE_ANOTHER_SIGNATURE)"
>
{{ $t("another_zone") }}
{{ trans(SIGNATURES_ANOTHER_ZONE) }}
</button>
<button
class="btn btn-misc btn-sm"
@@ -122,7 +122,7 @@
@click="undoSign"
v-else
>
{{ $t("cancel") }}
{{ trans(SIGNATURES_CANCEL) }}
</button>
<button
v-if="userSignatureZone === null"
@@ -134,7 +134,7 @@
active: canvasEvent === 'add',
}"
@click="toggleAddZone()"
:title="$t('add_sign_zone')"
:title="trans(SIGNATURES_ADD_SIGN_ZONE)"
>
<template v-if="canvasEvent === 'add'">
<div
@@ -186,7 +186,7 @@
@change="toggleMultiPage"
/>
<label class="form-check-label" for="checkboxMulti">
{{ $t("see_all_pages") }}
{{ trans(SIGNATURES_SEE_ALL_PAGES) }}
</label>
</template>
</div>
@@ -199,7 +199,7 @@
class="btn btn-light btn-sm"
@click="turnSignature(-1)"
>
{{ $t("last_zone") }}
{{ trans(SIGNATURES_LAST_ZONE) }}
</button>
<span>|</span>
<button
@@ -207,11 +207,20 @@
class="btn btn-light btn-sm"
@click="turnSignature(1)"
>
{{ $t("next_zone") }}
{{ trans(SIGNATURES_NEXT_ZONE) }}
</button>
</div>
<div v-if="signature.zones.length === 1 && signedState !== 'signed'"
class="col-4 d-none d-xl-flex p-0 text-center turnSignature">
<button
class="btn btn-light btn-sm"
@click="goToSignatureZoneUnique"
>
{{ trans(SIGNATURES_GO_TO_SIGNATURE_UNIQUE) }}
</button>
</div>
<div
v-if="signature.zones.length > 0 && signedState !== 'signed'"
v-if="signature.zones.length > 1 && signedState !== 'signed'"
class="col-4 d-none d-xl-flex p-0 text-center turnSignature"
>
<button
@@ -219,7 +228,7 @@
class="btn btn-light btn-sm"
@click="turnSignature(-1)"
>
{{ $t("last_sign_zone") }}
{{ trans(SIGNATURES_LAST_SIGN_ZONE) }}
</button>
<span>|</span>
<button
@@ -227,7 +236,7 @@
class="btn btn-light btn-sm"
@click="turnSignature(1)"
>
{{ $t("next_sign_zone") }}
{{ trans(SIGNATURES_NEXT_SIGN_ZONE) }}
</button>
</div>
<div class="col text-end" v-if="signedState !== 'signed'">
@@ -237,7 +246,7 @@
@click="undoSign"
v-if="signature.zones.length > 1"
>
{{ $t("choose_another_signature") }}
{{ trans(SIGNATURES_CHOOSE_ANOTHER_SIGNATURE) }}
</button>
<button
class="btn btn-misc btn-sm"
@@ -245,7 +254,7 @@
@click="undoSign"
v-else
>
{{ $t("cancel") }}
{{ trans(SIGNATURES_CANCEL) }}
</button>
<button
v-if="userSignatureZone === null"
@@ -257,13 +266,13 @@
active: canvasEvent === 'add',
}"
@click="toggleAddZone()"
:title="$t('add_sign_zone')"
:title="trans(SIGNATURES_ADD_SIGN_ZONE)"
>
<template v-if="canvasEvent !== 'add'">
{{ $t("add_zone") }}
{{ trans(SIGNATURES_ADD_ZONE) }}
</template>
<template v-else>
{{ $t("click_on_document") }}
{{ trans(SIGNATURES_CLICK_ON_DOCUMENT) }}
<div
class="spinner-border spinner-border-sm"
role="status"
@@ -297,10 +306,10 @@
v-if="signedState !== 'signed'"
:href="getReturnPath()"
>
{{ $t("cancel") }}
{{ trans(SIGNATURES_CANCEL) }}
</a>
<a class="btn btn-misc" v-else :href="getReturnPath()">
{{ $t("return") }}
{{ trans(SIGNATURES_RETURN) }}
</a>
</div>
<div class="col text-end" v-if="signedState !== 'signed'">
@@ -309,7 +318,7 @@
:disabled="!userSignatureZone"
@click="sign"
>
{{ $t("sign") }}
{{ trans(SIGNATURES_SIGN) }}
</button>
</div>
<div class="col-4" v-else></div>
@@ -329,13 +338,39 @@ import {
SignedState,
ZoomLevel,
} from "../../types";
import { makeFetch } from "../../../../../ChillMainBundle/Resources/public/lib/api/apiMethods";
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
import * as pdfjsLib from "pdfjs-dist";
import {
PDFDocumentProxy,
PDFPageProxy,
} from "pdfjs-dist/types/src/display/api";
import {
SIGNATURES_YES,
SIGNATURES_ARE_YOU_SURE,
SIGNATURES_YOU_ARE_GOING_TO_SIGN,
SIGNATURES_SIGNATURE_CONFIRMATION,
SIGNATURES_SIGN,
SIGNATURES_CHOOSE_ANOTHER_SIGNATURE,
SIGNATURES_CANCEL,
SIGNATURES_LAST_SIGN_ZONE,
SIGNATURES_NEXT_SIGN_ZONE,
SIGNATURES_ADD_SIGN_ZONE,
SIGNATURES_CLICK_ON_DOCUMENT,
SIGNATURES_LAST_ZONE,
SIGNATURES_NEXT_ZONE,
SIGNATURES_ADD_ZONE,
SIGNATURES_ANOTHER_ZONE,
SIGNATURES_ELECTRONIC_SIGNATURE_IN_PROGRESS,
SIGNATURES_LOADING,
SIGNATURES_RETURN,
SIGNATURES_SEE_ALL_PAGES,
SIGNATURES_ALL_PAGES,
SIGNATURES_GO_TO_SIGNATURE_UNIQUE,
trans
} from "translator";
// @ts-ignore incredible but the console.log is needed
import * as PdfWorker from "pdfjs-dist/build/pdf.worker.mjs";
console.log(PdfWorker);
@@ -415,8 +450,10 @@ const $toast = useToast();
const signature = window.signature;
const isFirstSignatureZone = () =>
userSignatureZone.value?.index ? userSignatureZone.value.index < 1 : false;
const isFirstSignatureZone = () => {
console.log(userSignatureZone.value?.index)
return userSignatureZone.value?.index ? userSignatureZone.value.index < 1 : false;
}
const isLastSignatureZone = () =>
userSignatureZone.value?.index
? userSignatureZone.value.index >= signature.zones.length - 1
@@ -600,6 +637,15 @@ const turnPage = async (upOrDown: number) => {
}
};
const goToSignatureZoneUnique = () => {
let signatureZone = signature.zones[0];
page.value = signatureZone.PDFPage.index + 1;
const canvas = getCanvas(signatureZone.PDFPage.index + 1);
selectZone(signatureZone, canvas);
canvas.scrollIntoView();
}
const turnSignature = async (upOrDown: number) => {
let zoneIndex = userSignatureZone.value?.index ?? -1;
if (zoneIndex < -1) {

View File

@@ -99,3 +99,30 @@ CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE: Modifier un document
entity_display_title:
Document (n°%doc%): "Document (n°%doc%)"
Doc for evaluation (n°%eval%): Document de l'évaluation n°%eval%
# SIGNATURES
signatures:
yes: Oui
are_you_sure: Êtes-vous sûr·e?
you_are_going_to_sign: Vous allez signer le document
signature_confirmation: Confirmation de la signature
sign: Signer
choose_another_signature: Choisir une autre zone
cancel: Annuler
last_sign_zone: Zone de signature précédente
next_sign_zone: Zone de signature suivante
add_sign_zone: Ajouter une zone de signature
click_on_document: Cliquer sur le document
last_zone: Zone précédente
next_zone: Zone suivante
add_zone: Ajouter une zone
another_zone: Autre zone
electronic_signature_in_progress: Signature électronique en cours...
loading: Chargement...
remove_sign_zone: Enlever la zone
return: Retour
see_all_pages: Voir toutes les pages
all_pages: Toutes les pages
go_to_signature_unique: Aller vers zone de signature