Update dynamic segment listing to display all and subscribed count
[MAILPOET-3077]
This commit is contained in:
committed by
Veljko V
parent
cdc090fc15
commit
f6808404f2
@ -12,11 +12,21 @@ const columns = [
|
|||||||
label: MailPoet.I18n.t('nameColumn'),
|
label: MailPoet.I18n.t('nameColumn'),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
label: MailPoet.I18n.t('description'),
|
||||||
|
sortable: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'count',
|
name: 'count',
|
||||||
label: MailPoet.I18n.t('subscribersCountColumn'),
|
label: MailPoet.I18n.t('subscribersCountColumn'),
|
||||||
sortable: false,
|
sortable: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'subscribed',
|
||||||
|
label: MailPoet.I18n.t('subscribed'),
|
||||||
|
sortable: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'updated_at',
|
name: 'updated_at',
|
||||||
label: MailPoet.I18n.t('updatedAtColumn'),
|
label: MailPoet.I18n.t('updatedAtColumn'),
|
||||||
@ -105,8 +115,14 @@ function renderItem(item, actions) {
|
|||||||
</strong>
|
</strong>
|
||||||
{ actions }
|
{ actions }
|
||||||
</td>
|
</td>
|
||||||
|
<td className="column-date" data-colname={MailPoet.I18n.t('description')}>
|
||||||
|
<abbr>{ item.description }</abbr>
|
||||||
|
</td>
|
||||||
<td className="column" data-colname={MailPoet.I18n.t('subscribersCountColumn')}>
|
<td className="column" data-colname={MailPoet.I18n.t('subscribersCountColumn')}>
|
||||||
{ parseInt(item.count, 10).toLocaleString() }
|
{ parseInt(item.count_all, 10).toLocaleString() }
|
||||||
|
</td>
|
||||||
|
<td className="column" data-colname={MailPoet.I18n.t('subscribed')}>
|
||||||
|
{ parseInt(item.count_subscribed, 10).toLocaleString() }
|
||||||
</td>
|
</td>
|
||||||
<td className="column" data-colname={MailPoet.I18n.t('updatedAtColumn')}>
|
<td className="column" data-colname={MailPoet.I18n.t('updatedAtColumn')}>
|
||||||
{ MailPoet.Date.format(item.updated_at) }
|
{ MailPoet.Date.format(item.updated_at) }
|
||||||
|
@ -12,6 +12,7 @@ use MailPoet\DynamicSegments\Mappers\DBMapper;
|
|||||||
use MailPoet\DynamicSegments\Mappers\FormDataMapper;
|
use MailPoet\DynamicSegments\Mappers\FormDataMapper;
|
||||||
use MailPoet\DynamicSegments\Persistence\Loading\SingleSegmentLoader;
|
use MailPoet\DynamicSegments\Persistence\Loading\SingleSegmentLoader;
|
||||||
use MailPoet\DynamicSegments\Persistence\Saver;
|
use MailPoet\DynamicSegments\Persistence\Saver;
|
||||||
|
use MailPoet\Entities\SubscriberEntity;
|
||||||
use MailPoet\Listing\BulkActionController;
|
use MailPoet\Listing\BulkActionController;
|
||||||
use MailPoet\Listing\Handler;
|
use MailPoet\Listing\Handler;
|
||||||
use MailPoet\Models\Model;
|
use MailPoet\Models\Model;
|
||||||
@ -200,7 +201,8 @@ class DynamicSegments extends APIEndpoint {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$row = $segment->asArray();
|
$row = $segment->asArray();
|
||||||
$row['count'] = $this->segmentSubscriberRepository->getSubscribersCount($segment->id);
|
$row['count_all'] = $this->segmentSubscriberRepository->getSubscribersCount($segment->id);
|
||||||
|
$row['count_subscribed'] = $this->segmentSubscriberRepository->getSubscribersCount($segment->id, SubscriberEntity::STATUS_SUBSCRIBED);
|
||||||
$data[] = $row;
|
$data[] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user