<% extends 'layout.html' %>

<% block content %>
  <div id="forms_container"></div>

  <div>
    <p class="mailpoet_sending_methods_help help">
      <%= __('<strong>Tip:</strong> we have a [link]list of plugins[/link] that work with MailPoet if you need fancier forms.')
      |replaceLinkTags('https://kb.mailpoet.com/article/198-list-of-forms-plugins-that-work-with-mailpoet?utm_source=plugin&utm_medium=settings&utm_campaign=helpdocs', {'target': '_blank', id: 'mailpoet_helper_link', 'data-beacon-article': '5953a9720428637ff8d42272'})
      |raw
      %>
    </p>
  </div>

  <script type="text/javascript">
    var mailpoet_listing_per_page = <%= items_per_page %>;
    var mailpoet_segments = <%= json_encode(segments) %>;
    var mailpoet_form_edit_url =
      "<%= admin_url('admin.php?page=mailpoet-form-editor&id=') %>";
    var mailpoet_beacon_articles = [
      '5e43d3ec2c7d3a7e9ae79da9',
      '5e3a166204286364bc94dda4',
      '5e95cc092c7d3a7e9aeae815',
      '58a718a6dd8c8e56bfa7cad6',
      '57ce079f903360649f6e56fc',
      '5d1f468504286369ad8d57ff'
    ];

    var mailpoet_display_nps_poll = <%= json_encode(display_nps_survey) %>;

    <%if display_nps_survey %>
      var mailpoet_display_nps_form = true;
      var mailpoet_premium_active = <%= json_encode(premium_plugin_active) %>;
      var mailpoet_site_url = "<%= site_url %>";
      var mailpoet_current_wp_user = <%= json_encode(current_wp_user) %>;
      var mailpoet_current_wp_user_firstname = '<%= current_wp_user_firstname %>';
      var mailpoet_review_request_illustration_url = '<%= cdn_url('review-request/review-request-illustration.20190815-1427.svg') %>';
      var mailpoet_installed_days_ago = <%= installed_days_ago %>;
    <%endif%>
  </script>
<% endblock %>

<% block translations %>
  <%= localize({
    'pageTitle': __('Forms'),
    'searchLabel': __('Search'),
    'loadingItems': __('Loading forms...'),
    'noItemsFound': __('No forms were found. Why not create a new one?'),
    'selectAllLabel': __('All forms on this page are selected.'),
    'selectedAllLabel': __('All %d forms are selected.'),
    'selectAllLink': __('Select all forms on all pages'),
    'clearSelection': __('Clear selection'),
    'permanentlyDeleted': __('%d forms permanently deleted.'),
    'selectBulkAction': __('Select bulk action'),
    'bulkActions': __('Bulk Actions'),
    'apply': __('Apply'),
    'filter': __('Filter'),
    'emptyTrash': __('Empty Trash'),
    'selectAll': __('Select All'),
    'restore': __('Restore'),
    'deletePermanently': __('Delete Permanently'),

    'previousPage': __('Previous page'),
    'firstPage': __('First page'),
    'nextPage': __('Next page'),
    'lastPage': __('Last page'),
    'currentPage': __('Current Page'),
    'pageOutOf': __('of'),
    'numberOfItemsSingular': __('1 item'),
    'numberOfItemsMultiple': __('%$1d items'),

    'formName': __('Name'),
    'noName': _x('no name', 'fallback for forms without a name in a form list'),
    'segments': __('Lists'),
    'userChoice': __('User choice:'),
    'signups': __('Sign-ups'),
    'createdOn': __('Created On'),
    'oneFormTrashed': __('1 form was moved to the trash.'),
    'multipleFormsTrashed': __('%$1d forms were moved to the trash.'),
    'oneFormDeleted': __('1 form was permanently deleted.'),
    'multipleFormsDeleted': __('%$1d forms were permanently deleted.'),
    'oneFormRestored': __('1 form has been restored from the trash.'),
    'multipleFormsRestored': __('%$1d forms have been restored from the trash.'),
    'edit': __('Edit'),
    'duplicate': __('Duplicate'),
    'formDuplicated': __('Form "%$1s" has been duplicated.'),
    'trash': __('Trash'),
    'moveToTrash': __('Move to trash'),
    'new': __('Add New'),
  }) %>
<% endblock %>

<% block after_javascript %>
<script type="text/javascript">
  jQuery('#mailpoet_helper_link').on('click', function() {
    MailPoet.trackEvent('Forms page > link to doc page', {
      'MailPoet Free version': window.mailpoet_version
    });
  });
</script>
<% endblock %>
