PHRAS-3695 Prod - basket and feedback displayed informations improvement (#4056)

* display information improvement
* change string
* autocomplete off on datepicker
* add subject in mailto
This commit is contained in:
Aina Sitraka
2022-06-14 17:29:00 +03:00
committed by GitHub
parent 9b4edf0948
commit 24fec8e52c
21 changed files with 915 additions and 725 deletions

View File

@@ -13,5 +13,5 @@ module.exports = {
setupDir: _root + 'tests/setup/node.js',
karmaConf: _root + 'config/karma.conf.js',
// change this version when you change JS file for lazy loading
assetFileVersion: 63
assetFileVersion: 64
};

View File

@@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=63";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=64";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {

View File

@@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=63";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=64";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {

View File

@@ -91,7 +91,7 @@
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=63";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=64";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {

View File

@@ -91,7 +91,7 @@
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=63";
/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=64";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {

View File

@@ -18416,7 +18416,7 @@ var pushOrShare = function pushOrShare(services, container) {
// normal "send button"
//
buttons[localeService.t('send')] = function () {
buttons[localeService.t('feedbackSend')] = function () {
// if we must create a new basket, we must get a name for it
if ($el.data('feedback-action') !== 'adduser') {

View File

@@ -18416,7 +18416,7 @@ var pushOrShare = function pushOrShare(services, container) {
// normal "send button"
//
buttons[localeService.t('send')] = function () {
buttons[localeService.t('feedbackSend')] = function () {
// if we must create a new basket, we must get a name for it
if ($el.data('feedback-action') !== 'adduser') {

View File

@@ -243,7 +243,7 @@ const pushOrShare = function (services, container) {
// normal "send button"
//
buttons[localeService.t('send')] = function () {
buttons[localeService.t('feedbackSend')] = function () {
// if we must create a new basket, we must get a name for it
if ($el.data('feedback-action') !== 'adduser') {

View File

@@ -62,6 +62,7 @@ class LanguageController
'removeTitle' => $translator->trans('panier::Supression d\'un element d\'un reportage'),
'removeRecordFeedbackTitle' => $translator->trans('basket:feedback Delete item'),
'feedbackSaveNotNotify' => $translator->trans('feedback:: save users and users rights'),
'feedbackSend' => $translator->trans('feedback:: send'),
'feedbackReminderTitle' => $translator->trans('prod::workzone:manual feedback reminder title'),
'reminderMessageToCheck' => $translator->trans('prod::workzone:manual feedback reminder provide a message!'),
'reminderParticipantToCheck' => $translator->trans('prod::workzone:manual feedback reminder select a participant!'),

View File

@@ -618,6 +618,11 @@ class PushController extends Controller
*/
public function updateExpirationAction(Request $request)
{
$ret = [
'success' => false,
'message' => 'Expiration date not updated!'
];
// sanity check
if (is_null($request->request->get('date'))) {
throw new Exception('The provided date is null!');
@@ -629,40 +634,49 @@ class PushController extends Controller
$basket = $this->getBasketRepository()->findUserBasket($request->request->get('basket_id'), $this->app->getAuthenticatedUser(), true);
$expirationDate = new DateTime($request->request->get('date') . " 23:59:59");
if (!$basket->isVoteBasket()) {
throw new Exception('Unable to find the validation session');
}
// update validation tokens expiration
//
/** @var BasketParticipant $participant */
foreach($basket->getParticipants() as $participant) {
try {
if(!is_null($token = $this->getTokenRepository()->findValidationToken($basket, $participant->getUser()))) {
if($participant->getUser()->getId() === $basket->getVoteInitiator()->getId()) {
// the initiator keeps a no-expiration token
$token->setExpiration(null); // shoud already be null, but who knows...
}
else {
// the "normal" user token is fixed
$token->setExpiration($expirationDate);
if ($basket->isVoteBasket()) {
// update validation tokens expiration
//
/** @var BasketParticipant $participant */
foreach($basket->getParticipants() as $participant) {
try {
if(!is_null($token = $this->getTokenRepository()->findValidationToken($basket, $participant->getUser()))) {
if($participant->getUser()->getId() === $basket->getVoteInitiator()->getId()) {
// the initiator keeps a no-expiration token
$token->setExpiration(null); // shoud already be null, but who knows...
}
else {
// the "normal" user token is fixed
$token->setExpiration($expirationDate);
}
}
}
catch (Exception $e) {
// not unique token ? should not happen.
// no-op
}
}
catch (Exception $e) {
// not unique token ? should not happen.
// no-op
}
}
$basket->setVoteExpires($expirationDate);
$manager->persist($basket);
$manager->flush();
$manager->commit();
$ret = [
'success' => true,
'message' => $this->app->trans('Expiration date successfully updated!')
];
$basket->setVoteExpires($expirationDate);
$manager->persist($basket);
$manager->flush();
$manager->commit();
$ret = [
'success' => true,
'message' => $this->app->trans('Expiration date successfully updated!')
];
} elseif ($basket->getParticipants()->count() > 0 && !$basket->isVoteBasket()) {
$basket->setShareExpires($expirationDate);
$manager->persist($basket);
$manager->flush();
$manager->commit();
$ret = [
'success' => true,
'message' => $this->app->trans('Expiration date successfully updated!')
];
}
}
catch (Exception $e) {
$ret = [

View File

@@ -830,6 +830,23 @@ class Basket
return $date_obj > $this->getVoteExpires();
}
/**
* returns null if the basket has no shareExpires date
*
* @return bool|null
* @throws \Exception
*/
public function isShareExpires()
{
if (is_null($this->getShareExpires())) {
return null;
}
$date_obj = new DateTime();
return $date_obj > $this->getShareExpires();
}
public function getVoteString(Application $app, User $user)
{
if ($this->isVoteInitiator($user)) {

View File

@@ -59,7 +59,7 @@ class PhraseanetExtension extends \Twig_Extension
{
return [
// change this version when you change JS file to force the navigation to reload js file
'assetFileVersion' => 63
'assetFileVersion' => 64
];
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2022-06-03T14:23:38Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
<file date="2022-06-14T13:10:18Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2022-06-03T14:23:53Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<file date="2022-06-14T13:10:32Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2022-06-03T14:24:13Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
<file date="2022-06-14T13:10:49Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file date="2022-06-03T14:24:34Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
<file date="2022-06-14T13:11:09Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>

View File

@@ -90,9 +90,11 @@
{% endif %}
</div>
{% if basket.isVoteBasket() and basket.getUser().getId() == app.getAuthenticatedUser().getId() %}
{% set nparticipants = basket.getParticipants | length %}
{% if nparticipants > 0 and basket.getUser().getId() == app.getAuthenticatedUser().getId() %}
{% set disabled = '' %}
{% if basket.isVoteFinished() %}
{% if (basket.isVoteBasket() and basket.isVoteFinished()) or (not basket.isVoteBasket() and basket.isShareExpires()) %}
{% set disabled = 'disabled' %}
{% endif %}
@@ -101,39 +103,71 @@
<div class="feedback-info">
{% set nb_records = basket.getElements()|length %}
{% set date = app['date-formatter'].getPrettyString(basket.getUpdated()) %}
{% set date = app['date-formatter'].getPrettyString(basket.getCreated()) %}
<p class="create-date">
{{ 'prod:workzone:basket:creation-date' | trans }} : {{ date }}
</p>
<div class="record-number"> {% trans with {'%nb_records%' : nb_records} %}%nb_records% records{% endtrans %}</div>
<div class="record-number">
{% trans with {'%nb_records%' : nb_records} %}%nb_records% records{% endtrans %}
</div>
{% if basket.isVoteBasket() %}
{% set dateExpired = app['date-formatter'].getFormatedDate(basket.getVoteExpires()) %}
{% else %}
{% set dateExpired = app['date-formatter'].getFormatedDate(basket.getShareExpires()) %}
{% endif %}
{% set dateExpired = app['date-formatter'].getFormatedDate(basket.getVoteExpires()) %}
<div class="expiredDate">
{% if basket.getVoteExpires() < date() %}
<span>{{ 'workzone:feedback:expiration-closed' | trans }} :</span>
{% if basket.isVoteBasket() %}
{% if basket.isVoteFinished() %}
<span>{{ 'workzone:feedback:expiration-closed' | trans }} :</span>
{% else %}
<span>{{ 'workzone:feedback:expiration-open' | trans }} :</span>
{% endif %}
{% else %}
<span>{{ 'workzone:feedback:expiration-open' | trans }} :</span>
{% if basket.isShareExpires() %}
<span>{{ 'workzone:shared:expiration-closed' | trans }} :</span>
{% else %}
<span>{{ 'workzone:shared:expiration-open' | trans }} :</span>
{% endif %}
{% endif %}
<form class="update-feed-validation">
<input type="hidden" name="feedbackId" value={{ basket.getId}} />
<input type="hidden" name="feedbackDate" class="alternate" />
<input type="text" class="btn feed-datepicker" name="feedback-deadline" value="{{ dateExpired }}">
<input type="text" class="btn feed-datepicker" name="feedback-deadline" value="{{ dateExpired }}" autocomplete="off">
<button type="submit" class="submit submit-validation btn-not-shown" title="{{ 'workzone:feedback:update' | trans }}"><svg width="22" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="calendar-check" class="svg-inline--fa fa-calendar-check fa-w-14" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M436 160H12c-6.627 0-12-5.373-12-12v-36c0-26.51 21.49-48 48-48h48V12c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v52h128V12c0-6.627 5.373-12 12-12h40c6.627 0 12 5.373 12 12v52h48c26.51 0 48 21.49 48 48v36c0 6.627-5.373 12-12 12zM12 192h424c6.627 0 12 5.373 12 12v260c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V204c0-6.627 5.373-12 12-12zm333.296 95.947l-28.169-28.398c-4.667-4.705-12.265-4.736-16.97-.068L194.12 364.665l-45.98-46.352c-4.667-4.705-12.266-4.736-16.971-.068l-28.397 28.17c-4.705 4.667-4.736 12.265-.068 16.97l82.601 83.269c4.667 4.705 12.265 4.736 16.97.068l142.953-141.805c4.705-4.667 4.736-12.265.068-16.97z"/></svg></button>
<span class="cancel-date btn-not-shown"><i class="fa fa-times"></i></span>
</form>
<p class="message text-right" style="opacity: 0;transition: all 0.2s; color: green; display: block; ">{{ 'prod:workzone:basket:updated-message' | trans }}</p>
</div>
{% endif %}
</div>
{% endif %}
{% set mailto_basket_user_name = '<a href="mailto:' ~ basket.getUser().getEmail() ~ '?subject=' ~ basket.getName() ~ '" target="_blank" style="color:#FFA500; color:#FFA500 !important; text-decoration:underline; cursor:pointer;">' ~
basket.getUser().displayName() ~'</a>' %}
{% if not basket.isVoteBasket() and basket.getUser().getId() != app.getAuthenticatedUser().getId() %}
<p>
{% if basket.getShareExpires() is null %}
{% trans with {'%user_name%' : mailto_basket_user_name } %}Basket shared by %user_name% indefinitely{% endtrans %}
{% else %}
{% trans with {'%user_name%' : mailto_basket_user_name, '%expires%': app['date-formatter'].getFormatedDate(basket.getShareExpires()) } %}Basket shared by %user_name% until %expires%{% endtrans %}
{% endif %}
</p>
{% elseif basket.isVoteBasket() and basket.getUser().getId() != app.getAuthenticatedUser().getId() %}
<p>
{% trans with {'%user_name%' : mailto_basket_user_name, '%vote_expires%': app['date-formatter'].getFormatedDate(basket.getVoteExpires()) } %}Feedback request by %user_name% until %vote_expires%{% endtrans %}
</p>
{% endif %}
</div>
{% set basket_length = basket.getElements()|length %}
<div class="alert_datas_changed ui-corner-all">{{ 'Certaines donnees du panier ont change' | trans }} <a class="basket_refresher" href="#">{{ 'rafraichir' | trans }}</a></div>
{% if basket_length == 0 %}
<div style="height:120px;"></div>
{% endif %}
{% if basket_length == 0 %}
<div style="height:120px;"></div>
{% endif %}
{% set basket_scope = 'objects' %}
@@ -142,12 +176,12 @@
{% if basket.isVoteBasket() %}
{{ Macros.display_validation(app, basket, ordre) }}
{% else %}
{{ Macros.display_basket(app, basket) }}
{% endif %}
{% else %}
{{ Macros.display_basket(app, basket) }}
{% endif %}
</div>
{% if basket.isVoteBasket() and basket.getUser().getId() == app.getAuthenticatedUser().getId() %}
{% if basket.getUser().getId() == app.getAuthenticatedUser().getId() %}
<script type="text/javascript">
$( function() {