<div class="wrap">
   <div id="smpush-icon-tokens" class="icon32"><br></div>
   <h2><?php echo esc_html__('Manage Subscribers', 'smio-push-notification')?>
   <a href="<?php echo esc_url($pageurl);?>&remove_duplicates=1&noheader=1" class="add-new-h2 smio-delete" data-confirm="<?php echo esc_html__('It is highly recommended to take a backup from the table before start, Continue', 'smio-push-notification')?>?"><?php echo esc_html__('Remove Duplicates', 'smio-push-notification')?></a>
   <a href="javascript:" onclick="smpush_open_service(-1,2)" class="add-new-h2"><?php echo esc_html__('Add New Subscriber', 'smio-push-notification')?></a><img src="<?php echo smpush_imgpath.'/wpspin_light.gif';?>" alt="" class="smpush_service_-1_loading" style="display:none" />
   </h2>
   <div id="col-container">
      <div id="col-left" style="width: 100%">
      <form action="<?php echo esc_url($pageurl);?>" method="get">
      <input type="hidden" name="page" value="<?php echo esc_attr($pagname);?>" />
      <input type="hidden" name="noheader" value="1" id="smpush-noheader-value" />
         <div class="col-wrap">
          <p class="search-box smpush-canhide">
              <label class="screen-reader-text"><?php echo esc_html__('Search Subscribers:', 'smio-push-notification')?></label>
              <input type="search" name="query" value="<?php echo (!empty($_GET['query']))?$_GET['query']:'';?>">
              <input type="submit" id="search-submit" class="button" value="<?php echo esc_html__('Search Subscribers', 'smio-push-notification')?>">
           </p>
          <div class="tablenav top">
      		<div class="alignleft actions bulkactions smpush-canhide">
                <select name="doaction">
                  <option value="0"><?php echo esc_html__('Bulk Actions', 'smio-push-notification')?></option>
                  <option value="activate"><?php echo esc_html__('Activate', 'smio-push-notification')?></option>
                  <option value="deactivate"><?php echo esc_html__('Deactivate', 'smio-push-notification')?></option>
                  <option value="delete"><?php echo esc_html__('Delete', 'smio-push-notification')?></option>
                </select>
                <input type="submit" name="apply" class="button action" value="<?php echo esc_html__('Apply', 'smio-push-notification')?>">
                <input type="submit" name="applytoall" class="smpush-applytoall button action" value="<?php echo esc_html__('Apply to all', 'smio-push-notification')?>">
        	</div>
            <div class="alignleft actions smpush-canhide">
              <select name="device_type">
                <option value="0"><?php echo esc_html__('Show all platforms', 'smio-push-notification')?></option>
                <option value="<?php echo esc_attr($types_name->ios_name);?>" <?php if($_GET['device_type'] == $types_name->ios_name){?>selected="selected"<?php }?>>iOS</option>
                <option value="<?php echo esc_attr($types_name->iosfcm_name);?>" <?php if($_GET['device_type'] == $types_name->iosfcm_name){?>selected="selected"<?php }?>>iOS FCM</option>
                <option value="<?php echo esc_attr($types_name->android_name);?>" <?php if($_GET['device_type'] == $types_name->android_name){?>selected="selected"<?php }?>>Android</option>
                <option value="<?php echo esc_attr($types_name->wp_name);?>" <?php if($_GET['device_type'] == $types_name->wp_name){?>selected="selected"<?php }?>>Windows Phone</option>
                <option value="<?php echo esc_attr($types_name->wp10_name);?>" <?php if($_GET['device_type'] == $types_name->wp10_name){?>selected="selected"<?php }?>>Windows 10</option>
                <option value="<?php echo esc_attr($types_name->bb_name);?>" <?php if($_GET['device_type'] == $types_name->bb_name){?>selected="selected"<?php }?>>BlackBerry</option>
                <option value="<?php echo esc_attr($types_name->chrome_name);?>" <?php if($_GET['device_type'] == $types_name->chrome_name){?>selected="selected"<?php }?>>Chrome</option>
                <option value="<?php echo esc_attr($types_name->safari_name);?>" <?php if($_GET['device_type'] == $types_name->safari_name){?>selected="selected"<?php }?>>Safari</option>
                <option value="<?php echo esc_attr($types_name->firefox_name);?>" <?php if($_GET['device_type'] == $types_name->firefox_name){?>selected="selected"<?php }?>>Firefox</option>
                <option value="<?php echo esc_attr($types_name->opera_name);?>" <?php if($_GET['device_type'] == $types_name->opera_name){?>selected="selected"<?php }?>>Opera</option>
                <option value="<?php echo esc_attr($types_name->edge_name);?>" <?php if($_GET['device_type'] == $types_name->edge_name){?>selected="selected"<?php }?>>Edge</option>
                <option value="<?php echo esc_attr($types_name->samsung_name);?>" <?php if($_GET['device_type'] == $types_name->samsung_name){?>selected="selected"<?php }?>>Samsung Browser</option>
                <option value="<?php echo esc_attr($types_name->viber_name);?>" <?php if($_GET['device_type'] == $types_name->viber_name){?>selected="selected"<?php }?>>Viber</option>
                <option value="<?php echo esc_attr($types_name->fbmsn_name);?>" <?php if($_GET['device_type'] == $types_name->fbmsn_name){?>selected="selected"<?php }?>>Facebook Messenger</option>
                <option value="<?php echo esc_attr($types_name->fbnotify_name);?>" <?php if($_GET['device_type'] == $types_name->fbnotify_name){?>selected="selected"<?php }?>>Facebook Notification</option>
                <option value="<?php echo esc_attr($types_name->email_name);?>" <?php if($_GET['device_type'] == $types_name->email_name){?>selected="selected"<?php }?>>Newsletter</option>
              </select>
              <select name="status">
              <option value="0"><?php echo esc_html__('Show all status', 'smio-push-notification')?></option>
              <option value="1" <?php if($_GET['status'] == 1) echo 'selected="selected"';?>><?php echo esc_html__('Active', 'smio-push-notification')?></option>
              <option value="2" <?php if($_GET['status'] == 2) echo 'selected="selected"';?>><?php echo esc_html__('Inactive', 'smio-push-notification')?></option>
              </select>
              <?php if($types_name->dbtype == 'localhost'){?>
              <select name="channel_id" class="postform">
              <option value="0"><?php echo esc_html__('View all channels', 'smio-push-notification')?></option>
              <?php foreach($channels as $channel){?>
              <option value="<?php echo esc_attr($channel->id);?>" <?php if($_GET['channel_id'] == $channel->id) echo 'selected="selected"';?>><?php echo esc_attr($channel->title); ?></option>
              <?php }?>
              </select>
              <?php }?>
              <input type="text" name="userid" placeholder="User ID" value="<?php echo (!empty($_GET['userid']))?$_GET['userid']:'';?>">
              <input type="submit" id="post-query-submit" class="button" value="<?php echo esc_html__('Filter', 'smio-push-notification')?>">
            </div>
            <div class="tablenav-pages one-page">
              <div class="alignleft" style="margin-top: 5px;margin-right: 35px">
                <button type="button" onclick="if(confirm('<?php echo esc_html__('Are you sure you want to delete all invalid subscribers ?', 'smio-push-notification')?>')) window.location = '<?php echo esc_url($pageurl);?>&remove_deads=1&noheader=1'" class="button-link button-link-delete widget-control-remove"><?php echo esc_html__('Delete invalid subscribers', 'smio-push-notification')?></button>
                <span class="widget-control-close-wrapper"></span>
              </div>
              <span class="displaying-num"><?php echo self::$paging['result'];?> <?php echo esc_html__('items', 'smio-push-notification')?></span>
            </div>
        	<br class="clear">
        	</div>
             <table class="wp-list-table widefat fixed tags" cellspacing="0" <?php if(get_bloginfo('version') < 3.8){?>style="table-layout: auto"<?php }?>>
                <thead>
                   <tr>
                      <th scope="col" id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1"><?php echo esc_html__('Select All', 'smio-push-notification')?></label><input id="cb-select-all-1" type="checkbox"></th>
                      <th scope="col" class="manage-column" style="width:110px"><span><?php echo esc_html__('ID', 'smio-push-notification')?></span></th>
                      <th scope="col" class="manage-column smpush-canhide"><span><?php echo esc_html__('Subscriber Token', 'smio-push-notification')?></span></th>
                      <th scope="col" class="manage-column smpush-center"><span><?php echo esc_html__('Platform', 'smio-push-notification')?></span></th>
                      <th scope="col" class="manage-column smpush-center"><span><?php echo esc_html__('User', 'smio-push-notification')?></span></th>
                      <th scope="col" class="manage-column smpush-center"><span><?php echo esc_html__('Location', 'smio-push-notification')?></span></th>
                      <th scope="col" class="manage-column smpush-canhide"><span><?php echo esc_html__('Information', 'smio-push-notification')?></span></th>
                      <th scope="col" class="manage-column smpush-canhide"><span><?php echo esc_html__('Time', 'smio-push-notification')?></span></th>
                      <th scope="col" class="manage-column column-categories smpush-center" style="width:75px"><?php echo esc_html__('Active', 'smio-push-notification')?><span></span></th>
                      <th scope="col" class="manage-column column-categories" style="width:155px"><?php echo esc_html__('Action', 'smio-push-notification')?><span></span></th>
                   </tr>
                </thead>
                <tfoot>
                   <tr>
                      <th scope="col" id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1"><?php echo esc_html__('Select All', 'smio-push-notification')?></label><input id="cb-select-all-1" type="checkbox"></th>
                      <th scope="col" class="manage-column" style="width:110px"><span><?php echo esc_html__('ID', 'smio-push-notification')?></span></th>
                      <th scope="col" class="manage-column smpush-canhide"><span><?php echo esc_html__('Subscriber Token', 'smio-push-notification')?></span></th>
                      <th scope="col" class="manage-column smpush-center"><span><?php echo esc_html__('Platform', 'smio-push-notification')?></span></th>
                      <th scope="col" class="manage-column smpush-center"><span><?php echo esc_html__('User', 'smio-push-notification')?></span></th>
                      <th scope="col" class="manage-column smpush-center"><span><?php echo esc_html__('Location', 'smio-push-notification')?></span></th>
                      <th scope="col" class="manage-column smpush-canhide"><span><?php echo esc_html__('Information', 'smio-push-notification')?></span></th>
                      <th scope="col" class="manage-column smpush-canhide"><span><?php echo esc_html__('Time', 'smio-push-notification')?></span></th>
                      <th scope="col" class="manage-column column-categories smpush-center"><?php echo esc_html__('Active', 'smio-push-notification')?><span></span></th>
                      <th scope="col" class="manage-column column-categories"><?php echo esc_html__('Action', 'smio-push-notification')?><span></span></th>
                   </tr>
                </tfoot>
                <tbody id="push-token-list">
                <?php if($tokens){$counter = 0;foreach($tokens AS $token){$counter++;?>
                   <tr id="smpush-service-tab-<?php echo esc_attr($token->id);?>" class="smpush-service-tab <?php if($counter%2 == 0){echo 'alternate';}?>">
                      <th scope="row" class="check-column">
                        <label class="screen-reader-text"></label>
                        <input type="checkbox" name="device[]" value="<?php echo esc_attr($token->id);?>">
                        <div class="locked-indicator"></div>
                      </th>
                      <td class="name column-name"><strong><?php echo esc_attr($token->id);?></strong></td>
                      <td class="name column-name smpush-canhide"><span><?php echo esc_attr($token->device_token);?></span></td>
                      <td class="name column-name smpush-center"><?php echo esc_attr($token->device_type);?></td>
                      <td class="name column-name smpush-center"><?php if(!empty($token->user))echo esc_attr($token->user);?></td>
                      <td class="name column-name smpush-center"><?php if(!empty($token->latitude) && $token->latitude != '0.00000000'):?><a href="https://www.google.com/maps?q=loc:<?php echo esc_attr($token->latitude) ?>,<?php echo esc_attr($token->longitude) ?>" target="_blank"><img src="<?php echo smpush_imgpath.'/gps.png';?>" /></a><?php endif;?></td>
                      <td class="name column-name smpush-canhide"><span><?php echo esc_attr($token->information);?></span></td>
                      <td class="name column-name smpush-canhide"><span><?php echo gmdate(self::$wpdateformat, strtotime($token->timepost))?></span></td>
                      <td class="description column-comments smpush-center"><?php echo ($token->active == 1)? esc_html__('Yes', 'smio-push-notification') : esc_html__('No', 'smio-push-notification');?></td>
                      <td class="description column-categories">
                      <input type="button" class="button action smpush-open-btn" value="<?php echo esc_html__('Edit', 'smio-push-notification')?>" onclick="smpush_open_service(<?php echo esc_attr($token->id); ?>,2)" />
                      <input type="button" class="button action smpush-open-btn" value="<?php echo esc_html__('Delete', 'smio-push-notification')?>" onclick="smpush_delete_service(<?php echo esc_attr($token->id); ?>)" />
                      <img src="<?php echo smpush_imgpath.'/wpspin_light.gif';?>" alt="" class="smpush_service_<?php echo esc_attr($token->id); ?>_loading" style="display:none" />
                      </td>
                   </tr>
                <?php }}else{?>
                <tr class="no-items"><td class="colspanchange" colspan="7"><?php echo esc_html__('No items found.', 'smio-push-notification')?></td></tr>
                <?php }?>
                </tbody>
             </table>
             <div class="tablenav bottom">
        		<div class="alignleft actions bulkactions">
                <select name="doaction2">
                  <option value="0"><?php echo esc_html__('Bulk Actions', 'smio-push-notification')?></option>
                  <option value="activate"><?php echo esc_html__('Activate', 'smio-push-notification')?></option>
                  <option value="deactivate"><?php echo esc_html__('Deactivate', 'smio-push-notification')?></option>
                  <option value="delete"><?php echo esc_html__('Delete', 'smio-push-notification')?></option>
                </select>
                <input type="submit" name="apply" class="button action" value="<?php echo esc_html__('Apply', 'smio-push-notification')?>">
                <input type="submit" name="applytoall" class="smpush-applytoall button action" value="<?php echo esc_html__('Apply to all', 'smio-push-notification')?>">
            	</div>
                <div class="tablenav-pages"><span class="displaying-num"><?php echo self::$paging['result'];?> <?php echo esc_html__('items', 'smio-push-notification')?></span>
                  <span class="pagination-links">
                  <?php echo paginate_links($paging_args);?>
                  </span>
                </div>
            	<br class="clear">
             </div>
         </div>
      </form>
      </div>
      <div id="col-right" class="smpush_form_ajax" style="width: 45%;display:none;"></div>
   </div>
</div>
<script type="text/javascript">
var smpush_pageurl = '<?php echo esc_url($pageurl);?>';
</script>
