jQuery(document).ready(function($) {

	"use strict";

	// Process approve action on Profile on Moderation panel
	$(document).on('click', '#datebook-moderate-approve-profile', function() {
		
		var profileid = $(this).val();

		$.ajax({
			url: datebookajaxlocal.ajax_url,
			type: 'GET',
			dataType: "json",
			data : {
				action : 'datebook_ajax_admin',
				id : profileid,
				whatisit : 'profile_approve_moderate'
			},
			success: function(data) {

				$("#" + data.profileid).fadeOut("slow");
				$('.datebook-profile-popup').html(data.successtext).slideDown("slow").delay(1000).slideUp("slow");

			}
		});
	});

	// Process delete action on Profile on Moderation panel
	$(document).on('click', '#datebook-moderate-delete-profile', function() {
		
		var profileid = $(this).val();

		$.ajax({
			url: datebookajaxlocal.ajax_url,
			type: 'GET',
			dataType: "json",
			data : {
				action : 'datebook_ajax_admin',
				id : profileid,
				whatisit : 'profile_delete_moderate'
			},
			success: function(data) {

				$("#" + data.profileid).fadeOut("slow");
				$('.datebook-profile-popup').html(data.successtext).slideDown("slow").delay(1000).slideUp("slow");

			}
		});
	});

});