<?php

if(isset($_POST['btnLogout']))
{
	session_start();
	session_destroy();
} 
include('rights.php');
include('config.php');
include('includes/_admin_top.php');

?>

<div class="flex flex-col md:flex-row">
	<?php include('includes/_admin_menus.php') ?>

	<div class="main-content flex-1 bg-gray-100 md:mt-2 pb-24 md:pb-5">
            <div class="bg-blue-800 p-2 shadow text-xl text-white">
                <div class="d-table">
                	<div class="pull-left">
                	<h3 class="font-bold pl-2">Default Values</h3>
                </div>
                <div class="pull-right">
                	
                </div>
                </div>
            </div>
            <div class="w-full col-md-12 p-3 " id="stickerpackstable">
				<div class="card">
					<div class="card-body">
							<div class="col-sm-12">
                                        <div class="form-group">
	                                        <label>Default Publisher Name </label>
	                                        <input name="Publisher" id="Publisher" type="text" value="<?php echo $__default_publisher ?>" class="form-control" placeholder="StickerAdmin">
	                                    </div>

	                                    <div class="form-group">
	                                        <label>Default Publisher Email Id </label>
	                                        <input name="Publisher_email" id="Publisher_email" value="<?php echo $__default_publisher_email ?>" type="text" class="form-control" placeholder="StickerAdmin@gmail.com">
	                                    </div>

	                                    <div class="form-group">
	                                        <label>Default Publisher WebSite </label>
	                                        <input name="Publisher_website" id="Publisher_website"  value="<?php echo $__default_PublisherWebsite ?>" type="text" class="form-control" placeholder="www.StickerAdmin.com">
	                                    </div>

	                                    <div class="form-group">
	                                        <label>Default Publisher WebSite </label>
	                                       <input name="FCM_SERVER_KEY" id="FCM_SERVER_KEY" type="text" value="<?php echo $__FCM_SERVER_KEY ?>" class="form-control" placeholder="AAAA6_A3syw:APA...">
	                                    </div>
                                        
                                    </div>

                                    <div class="d-table">
                                    	<div class="pull-right">
                                    		<button type="button" onclick="UpdateInfo()" class="btn btn-success"> <i class="fa fa-pen"></i> Update </button>
                                    	</div>
                                    </div>
					</div>
				</div>                
            </div>
        </div>
</div>

<?php  include('includes/_admin_bottom.php')?>


<script type="text/javascript">
	



	function UpdateInfo()
	{
		HoldOn.open();
		$.ajax({
		    url:'writeconfig.php?ONLYINFO=1&default_publisher='+$('#Publisher').val() + '&default_publisher_email='+$('#Publisher_email').val() + '&default_PublisherWebsite='+$('#Publisher_website').val() + 'FCM_SERVER_KEY='+$('#FCM_SERVER_KEY').val(),
		    method:'GET',
		    success:function(data)
		    {
		    	if(data="success")
		    	{
		    		ShowSuccess("Defaults Updated Successfully")
		    		HoldOn.close();
		    	}	
		    },
		    error:function()
		    {
		    	ShowError("Error");
		    	HoldOn.close()
		    }
		})
	}
</script>