<style>.setting-avatar {
    width: 100px;
    margin-right: 10px;
    margin: 0 auto;
    display: block;
}
</style>
<div class="container-fluid">
    <div>
        <h3>Manage Stickers</h3>
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a href="#">Home</a>
                </li>
                <li class="breadcrumb-item">
                    <a href="#">Stickers</a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">Manage Stickers</li>
            </ol>
        </nav>
    </div>
    <!-- Vertical Layout -->
    <div class="row">
        <div class="col-lg-12 col-md-12">
            <div class="card">
                <div class="card-body">
                  <h6 class="card-title">Manage Stickers</h6>
                   <input type="hidden" id="hash_id" name="hash_id" value="<?php echo Wo_CreateSession();?>">
                   <div class="clearfix"></div>
                   <div class="table-responsive1">
                        <table class="table table-bordered table-striped table-hover">
                            <thead>
                                <tr>
                                  <th><input type="checkbox" id="check-all" class="filled-in check-all" ><label for="check-all"></label></th>
                                      <th>ID</th>
					                  <th>Media</th>
                                      <th>Premium</th>
					                  <th>Added</th>
					                  <th>Action</th>
                                </tr>
                            </thead>
                            <tbody>
                               <?php 
				                foreach (Wo_GetAllStickers(50000) as $wo['stickerlist']) {
				                  echo Wo_LoadAdminPage('manage-stickers/list');
				                }
				               ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="clearfix"></div>
                    <div class="row">
                        <div class="col-lg-3 col-md-3">
                            <span>&nbsp;</span>
                            <button type="button" class="btn btn-primary waves-effect delete-selected d-block" disabled>Delete Selected<span></span></button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
    <!-- #END# Vertical Layout -->
<div class="modal fade" id="DeleteModal" tabindex="-1" role="dialog" aria-labelledby="exampleModal1Label" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModal1Label">Delete Sticker?</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                Are you sure you want to delete this Sticker?
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary" data-dismiss="modal">Delete</button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="SelectedDeleteModal" tabindex="-1" role="dialog" aria-labelledby="exampleModal1Label" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModal1Label">Delete Sticker?</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                Are you sure that you want to remove the selected Sticker(s)?
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary" onclick="DeleteSelected()" data-dismiss="modal">Submit</button>
            </div>
        </div>
    </div>
</div>
<script>
$('.image-popup').magnificPopup({
    type: 'image',
    zoom: {
        enabled: true,
        duration: 300,
        easing: 'ease-in-out',
        opener: function(openerElement) {
            return openerElement.is('img') ? openerElement : openerElement.find('img');
        }
    }
});
$('.check-all').on('click', function(event) {
  $('input:checkbox').not(this).prop('checked', this.checked);
});
$('.delete-checkbox, .check-all').change(function(event) {
  $('.delete-selected').attr('disabled', false);
  $('.delete-selected').find('span').text(' (' + $('.delete-checkbox:checked').length + ')');
});

$('.delete-selected').on('click', function(event) {
  event.preventDefault();
  $('#SelectedDeleteModal').modal('show');
});
function DeleteSelected() {
  data = new Array();
  $('td input:checked').parents('tr').each(function () {
      data.push($(this).attr('data_selected'));
  });
  $('.delete-selected').attr('disabled', true);
  $('.delete-selected').text('Please wait..');
  $.post(Wo_Ajax_Requests_File()+"?f=admin_setting&s=remove_multi_sticker", {ids: data}, function () {
      $.each( data, function( index, value ){
          $("#StickerID_"+value).remove();
      });
      $('.delete-selected').text('Delete Selected');
  });
}
jQuery(document).ready(function($) {
   $(".delete-sticker").click(function(event) {
	    	$("#delete-sticker").attr('data-sticker-ident', $(this).attr('id')).modal('show');
	    });
});

function Wo_DeleteSticker(sticker_id,type = 'show') {
  if (type == 'hide') {
    $('#DeleteModal').find('.btn-primary').attr('onclick', "Wo_DeleteSticker('"+sticker_id+"')");
    $('#DeleteModal').modal('show');
    return false;
  }
  $('#StickerID_' + sticker_id).fadeOut(300, function() {
    $(this).remove();
  });
  $.get(Wo_Ajax_Requests_File(),{f:'admin_setting',s:'delete_sticker', p: 'manage-stickers', sticker_id: sticker_id});
}
</script>