Skip to content

Commit

Permalink
Merge pull request #899 from GemsTracker/2.x-token-no-email
Browse files Browse the repository at this point in the history
Don't show Email now button when token cannot be emailed, with separate message for staff tokens
  • Loading branch information
jvangestel authored Jan 30, 2025
2 parents ddff772 + 209edaf commit aca7fb3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Snippets/Token/ShowTrackTokenSnippet.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Zalt\Base\RequestInfo;
use Zalt\Base\TranslatorInterface;
use Zalt\Html\HtmlElement;
use Zalt\Late\Late;
use Zalt\Message\StatusMessengerInterface;
use Zalt\Model\Data\DataReaderInterface;
use Zalt\Model\MetaModelInterface;
Expand Down Expand Up @@ -136,8 +137,16 @@ protected function addCompletionBlock(ThreeColumnTableBridge $bridge)
protected function addContactBlock(ThreeColumnTableBridge $bridge)
{
// E-MAIL
$url = $this->menuSnippetHelper->getRouteUrl('respondent.tracks.token.email', $this->token->getMenuUrlParameters());
$buttons = Html::actionLink($url, $this->_('E-mail now!'));
if ($this->token->isMailable()) {
$url = $this->menuSnippetHelper->getRouteUrl('respondent.tracks.token.email', $this->token->getMenuUrlParameters());
$buttons = Html::actionLink($url, $this->_('E-mail now!'));
} else {
$buttons = Late::iff(
Late::comp($bridge->getLate('ggp_member_type'), '==', 'staff'),
Html::actionDisabled($this->_('This token is for a staff member and cannot be E-mailed')),
Html::actionDisabled($this->_('This token cannot be E-mailed'))
);
}

$bridge->addWithThird('gto_mail_sent_date', 'gto_mail_sent_num', $buttons);

Expand Down

0 comments on commit aca7fb3

Please sign in to comment.