Skip to content

Commit

Permalink
Added sent filter to contact activity
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Jul 5, 2021
1 parent 56581e2 commit 6c6942d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/models/ContactCampaignModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class ContactCampaignModel extends BaseModel
// Constants
// =========================================================================

const INTERACTIONS = ['opened', 'clicked', 'unsubscribed', 'complained', 'bounced'];
const INTERACTIONS = ['opened', 'clicked', 'unsubscribed', 'complained', 'bounced', 'sent'];
const DEFAULT_INTERACTIONS = ['opened', 'clicked', 'unsubscribed', 'complained', 'bounced'];

// Properties
// =========================================================================
Expand Down
1 change: 1 addition & 0 deletions src/models/ContactMailingListModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ContactMailingListModel extends BaseModel
// =========================================================================

const INTERACTIONS = ['subscribed', 'unsubscribed', 'complained', 'bounced'];
const DEFAULT_INTERACTIONS = ['subscribed', 'unsubscribed', 'complained', 'bounced'];

// Properties
// =========================================================================
Expand Down
2 changes: 1 addition & 1 deletion src/services/ReportsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ private function _getActivity(array $models, string $interaction = null, int $li

foreach ($models as $model) {
/** @var ContactCampaignModel|ContactMailingListModel $model */
$interactionTypes = ($interaction !== null && in_array($interaction, $model::INTERACTIONS)) ? [$interaction] : $model::INTERACTIONS;
$interactionTypes = ($interaction !== null && in_array($interaction, $model::INTERACTIONS)) ? [$interaction] : $model::DEFAULT_INTERACTIONS;

foreach ($interactionTypes as $key => $interactionType) {
if ($model->{$interactionType} !== null) {
Expand Down
17 changes: 11 additions & 6 deletions src/templates/reports/campaigns/_includes/contact-activity.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
{{ "Filter by interaction"|t('campaign') }}:
<div class="select">
<select class="interaction-filter">
<option value="">{{ "All"|t('campaign') }}</option>
<option value="opened" {{ interaction == 'opened' ? 'selected' }}>{{ "Opened"|t('campaign') }}</option>
<option value="clicked" {{ interaction == 'clicked' ? 'selected' }}>{{ "Clicked"|t('campaign') }}</option>
<option value="unsubscribed" {{ interaction == 'unsubscribed' ? 'selected' }}>{{ "Unsubscribed"|t('campaign') }}</option>
<option value="complained" {{ interaction == 'complained' ? 'selected' }}>{{ "Complained"|t('campaign') }}</option>
<option value="bounced" {{ interaction == 'bounced' ? 'selected' }}>{{ "Bounced"|t('campaign') }}</option>
<optgroup label="{{ "Interactions"|t('campaign') }}">
<option value="">{{ "All"|t('campaign') }}</option>
<option value="opened" {{ interaction == 'opened' ? 'selected' }}>{{ "Opened"|t('campaign') }}</option>
<option value="clicked" {{ interaction == 'clicked' ? 'selected' }}>{{ "Clicked"|t('campaign') }}</option>
<option value="unsubscribed" {{ interaction == 'unsubscribed' ? 'selected' }}>{{ "Unsubscribed"|t('campaign') }}</option>
<option value="complained" {{ interaction == 'complained' ? 'selected' }}>{{ "Complained"|t('campaign') }}</option>
<option value="bounced" {{ interaction == 'bounced' ? 'selected' }}>{{ "Bounced"|t('campaign') }}</option>
</optgroup>
<optgroup label="{{ "Other"|t('campaign') }}">
<option value="sent" {{ interaction == 'sent' ? 'selected' }}>{{ "Sent"|t('campaign') }}</option>
</optgroup>
</select>
</div>
<br/><br/>
Expand Down

0 comments on commit 6c6942d

Please sign in to comment.