added signups to forms listing
This commit is contained in:
@ -15,6 +15,10 @@ const columns = [
|
||||
name: 'segments',
|
||||
label: MailPoet.I18n.t('segments')
|
||||
},
|
||||
{
|
||||
name: 'signups',
|
||||
label: MailPoet.I18n.t('signups')
|
||||
},
|
||||
{
|
||||
name: 'created_at',
|
||||
label: MailPoet.I18n.t('createdOn'),
|
||||
@ -149,6 +153,9 @@ const FormList = React.createClass({
|
||||
<td className="column-format" data-colname={MailPoet.I18n.t('segments')}>
|
||||
{ segments }
|
||||
</td>
|
||||
<td className="column-format" data-colname={MailPoet.I18n.t('signups')}>
|
||||
{ form.signups }
|
||||
</td>
|
||||
<td className="column-date" data-colname={MailPoet.I18n.t('createdOn')}>
|
||||
<abbr>{ MailPoet.Date.format(form.created_at) }</abbr>
|
||||
</td>
|
||||
|
@ -39,6 +39,11 @@ class Form extends Model {
|
||||
return parent::save();
|
||||
}
|
||||
|
||||
function withSignups() {
|
||||
$this->signups = StatisticsForms::where('form_id', $this->id)->count();
|
||||
return $this;
|
||||
}
|
||||
|
||||
static function search($orm, $search = '') {
|
||||
return $orm->whereLike('name', '%'.$search.'%');
|
||||
}
|
||||
|
@ -29,7 +29,10 @@ class Forms {
|
||||
|
||||
// fetch segments relations for each returned item
|
||||
foreach($listing_data['items'] as $key => $form) {
|
||||
$form = $form->asArray();
|
||||
$form = $form
|
||||
->withSignups()
|
||||
->asArray();
|
||||
|
||||
$form['segments'] = (
|
||||
!empty($form['settings']['segments'])
|
||||
? $form['settings']['segments']
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
'formName': __('Name'),
|
||||
'segments': __('Lists'),
|
||||
'signups': __('Signups'),
|
||||
'createdOn': __('Created on'),
|
||||
'oneFormTrashed': __('1 form was moved to the trash'),
|
||||
'multipleFormsTrashed': __('%$1d forms were moved to the trash'),
|
||||
|
Reference in New Issue
Block a user