//**************add ckeditor start*************//
$(document).ready(function(){
	 
    if($('#page_msg').length > 0){
		CKEDITOR.replace('page_msg');
	}
	
	if($('#longb_content').length > 0){
		CKEDITOR.replace('longblog_content');
	}
	
	if($('#term_condition').length > 0){
		CKEDITOR.replace('term_condition');
	}
	
	if($('#pp_content').length > 0){
		CKEDITOR.replace('pp_content');
	}
}); 
//***********add ckeditor end ***************//

//************remove error success message start***//
function remove_hs_message(){
	setTimeout(function(){ 
		$(".hs_message").removeClass("open_alert hs_error hs_success");
		$('.popup_message').text('');  }, 3000);
}
//***********remove error / success message end******// 

//**********delete confirmation**********************//
function delete_confirmation(){
	var ans=confirm("Are You Sure Delete This Data");
	if(ans == true){
		return true;
	}else{
		return false;
	}
}
//**********delete confirmation**********************//
 
//***************add new user start******************// 
function add_new_user(){
	 
	var baseurl =$("#baseurl").val();
	var user_name =$.trim($("#user_name").val());
	var user_email =$.trim($("#user_email").val());
	var user_mobile =$.trim($("#user_mobile").val());
	var user_password =$.trim($("#user_password").val());
	var user_confpassword =$.trim($("#user_confpassword").val());
	var user_address =$.trim($("#user_address").val());
	var user_email
	var user_status = 1;
	var pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$";
	var mobilepattern = /[^0-9]/g;
	var error=0;
	 
	var isChecked = $("#send_email").is(":checked");
	if (isChecked == true) {
	   
		var send_mail = 1;
	 
	} else {
		var send_mail = 0;
	   
	}
      
	if(user_name == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Name');
		error++;
	}else if (user_email == "")                                  
    {	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Email Address');
		error++;
    }else if (!user_email.match(pattern))                
    {	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Valid Email Address');  
        error++;
    }else if (user_mobile == "")                       
    {	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Phone No.');
        error++;
    }else if (mobilepattern.test(user_mobile) == true) 
	{  	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Valid Phone No.');
		error++;
	}else if(user_password == "")                       
    {  	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Password'); 
        error++;
    }else if(user_password.length<6)
	{ 	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Password Must be Six digit'); 
	    error++;
	}else if(user_confpassword == "")                       
    {  	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Confirm Password'); 
        error++;
    }else if(user_confpassword.length<6)
	{  	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Password Must be Six digit'); 
	    error++;
	}else if(user_password !== user_confpassword)
	{  	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Confirm Your Password'); 
	    error++;
	}else if(user_address == "")
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Address');
		error++;
	}  	
	
	if(error == 0){
		
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/add_user",
		data: {u_name: user_name ,u_email: user_email, u_mobile: user_mobile, u_password: user_password, u_address: user_address, u_emailsend: send_mail},
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Data Not Valid! Try Again');	
					}else if(resp == 2){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('This email id already registered');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('User Register Successfuly');
						window.location.href = baseurl + "admin/userslist";
					}  
				}
		}); 
	} 
	remove_hs_message();
}
//***************add new user end***********************// 

//***************update user start**********************//
function update_user(){
	 
	var baseurl =$("#baseurl").val();
	var user_id =$.trim($("#user_id").val());
	var user_mobile =$.trim($("#user_mobile").val());
	var user_address =$.trim($("#user_address").val());
	var mobilepattern= /[^0-9]/g;
	var error=0;
	 
	if(user_mobile !== "")                       
	{  
		if(mobilepattern.test(user_mobile) == true) 
		{  	$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Please Enter Valid Phone No.');
			error++; 
		}
	} 	

	if(error == 0){
		
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_user",
		data: {u_id: user_id, u_mobile: user_mobile, u_address: user_address},
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Data not valid');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('user update successfully');
						window.location.href = baseurl + "admin/userslist";
					}  
				}
		}); 
	}  
	remove_hs_message();
}
//***************update user end**********************//

//***************update admin email/password start**********//
$(document).ready(function(){ 
	 
	$("#change_password_form").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var u_email  =$.trim($("#user_email").val());
	var u_newpass =$.trim($("#user_newpwd").val());
	var pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$";
	var error=0;
	  
	event.preventDefault();
	 
	if(u_email == "")                                  
    {	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter email address');
		error++;
	}else if(!u_email.match(pattern))                
    { 	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter valid email address'); 
		error++;
	}else if (u_newpass !== "")                       
    { 	if(u_newpass.length<6)
		{   $(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Password must be at least 6 characters long');
			error++;
		}
	}  
	
    if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/change_admin_password",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data Update successfully');
					}    
				}
		});  
	}   
	   remove_hs_message();
});
//***************change user password end****************//	 
	
//************change web mail address start*************//
//basic mail info setting  
$("#change_mail_form").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var sender_name =$.trim($("#sender_name").val());
	var sender_email =$.trim($("#sender_mailid").val());
	var pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$";
	var error=0;

	event.preventDefault();
	 
	if(sender_name == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter name');
		error++;
	}else if(sender_email == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter email address');
		error++;
	}else if(!sender_email.match(pattern))                
    { 	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter valid email address'); 
		error++;
	}  	
	  
	if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_webmail",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
											
				}
		});  
	}   
	remove_hs_message();
	 
});

// smtp setting  
$("#change_smtp_setting").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	event.preventDefault();
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_smtp_setting",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
											
				}
		});  
	 remove_hs_message();
	 
});



	
//email verification mail setting
$("#email_verification_form").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var evsubject =$.trim($("#everifi_subject").val());
	var evtemplate =$.trim($("#everifi_template").val());
	var evlink =$.trim($("#everifi_link").val());
	var error=0;
	event.preventDefault();
	 
	if(evsubject == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter subject');
		error++;
	}else if(evtemplate == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter template text');
		error++;
	}else if(evlink == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter link text');
		error++;
	}  	
	  
	if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_webmail",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
											
				}
		});  
	}   
	remove_hs_message();
	 
});
	
//table booking mail setting 
$("#tb_email_setting_form").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var tbsubject =$.trim($("#tablebook_subject").val());
	var tbtemplate =$.trim($("#tablebook_template").val());
	var error=0;

	event.preventDefault();
	 
	if(tbsubject == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter subject');
		error++;
	}else if(tbtemplate == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter template text');
		error++;
	}   	
	  
	if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_webmail",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
											
				}
		});  
	}   
	remove_hs_message();
	 
});
	
	
//table booking confirmed mail setting 
$("#tbconfirm_setting_form").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var tbcon_subject =$.trim($("#tbconfirm_subject").val());
	var tbcon_template =$.trim($("#tbconfirm_tamplate").val());
	var error=0;

	event.preventDefault();
	 
	if(tbcon_subject == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter subject');
		error++;
	}else if(tbcon_template == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter template text');
		error++;
	}   	
	  
	if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_webmail",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
											
				}
		});  
	}   
	remove_hs_message();
	 
});
	
//table booking canceled mail setting 
$("#tbcancel_email_setting_form").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var tbcsubject =$.trim($("#tbcancel_subject").val());
	var tbctemplate =$.trim($("#tbcancel_template").val());
	var error=0;

	event.preventDefault();
	 
	if(tbcsubject == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter subject');
		error++;
	}else if(tbctemplate == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter template text');
		error++;
	}   	
	  
	if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_webmail",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
											
				}
		});  
	}   
	remove_hs_message();
	 
});
	
//admin order booking mail setting 
$("#admin_odrbook").submit(function(){

	var baseurl = $("#baseurl").val();
	var adodr_subject = $.trim($("#adminodr_subject").val());
	var adodr_template = $.trim($("#adminodr_template").val());
	var error=0;
	event.preventDefault();
	 
	if(adodr_subject == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter subject');
		error++;
	}else if(adodr_template == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter template text');
		error++;
	}   	
	  
	if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_webmail",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){	
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
											
				}
		});  
	}   
	remove_hs_message();
	 
});
	
	
//admin table booking mail setting 
$("#admin_tablebook_email").submit(function(){
	  
	var baseurl = $("#baseurl").val();
	var atbook_subject = $.trim($("#admintbook_template").val());
	var atbook_template = $.trim($("#admintbook_template").val());
	 
	var error=0;

	event.preventDefault();
	 
	if(atbook_subject == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter subject');
		error++;
	}else if(atbook_template == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter template text');
		error++;
	}   	
	  
	if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_webmail",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){	
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
											
				}
		});  
	}   
	remove_hs_message();
	 
});
	
//order booking mail setting 
$("#odrbook_email_setting_form").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var order_subject =$.trim($("#orderbook_subject").val());
	var order_template =$.trim($("#orderbook_template").val());
	var error=0;
	event.preventDefault();
	 
	if(order_subject == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter subject');
		error++;
	}else if(order_template == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter template text');
		error++;
	}   	
	  
	if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_webmail",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){	
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
											
				}
		});  
	}   
	remove_hs_message();
	 
});
	
 //order booking intransit mail setting 
$("#odrintransit_form").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var orderintra_subject =$.trim($("#odr_intransit_subject").val());
	var orderintra_template =$.trim($("#odr_intransit_template").val());

	var error=0;

	event.preventDefault();
	 
	if(orderintra_subject == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter subject');
		error++;
	}else if(orderintra_template == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter template text');
		error++;
	}   	
	  
	if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_webmail",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){	
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
											
				}
		});  
	}   
	remove_hs_message();
	 
});
	
//order booking canceled mail setting 
$("#odrcanceled_form").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var orderc_subject =$.trim($("#odr_canceled_subject").val());
	var orderc_template =$.trim($("#odr_canceled_template").val());

	var error=0;

	event.preventDefault();
	 
	if(orderc_subject == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter subject');
		error++;
	}else if(orderc_template == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter template text');
		error++;
	}   	
	  
	if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_webmail",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){	
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
											
				}
		});  
	}   
	remove_hs_message();
	 
});
	
//order booking delivered mail setting 
$("#odr_delivered_form").submit(function(){

	var baseurl =$("#baseurl").val();
	var orddeli_subject =$.trim($("#odr_delivered_subject").val());
	var orddeli_template =$.trim($("#odr_delivered_template").val());
	 
	var error=0;

	event.preventDefault();
	 
	if(orddeli_subject == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter subject');
		error++;
	}else if(orddeli_template == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter template text');
		error++;
	}   	
	  
	if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_webmail",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){	
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
				}
		});  
	}   
	remove_hs_message();
	 
});
	
	

//forgot password mail setting 
$("#forgot_pass_emailsetting_form").submit(function(){
  
	var baseurl =$("#baseurl").val();
	var forgot_subject =$.trim($("#forgotpwd_mailsubject").val());
	var forgot_template =$.trim($("#forgotpwd_template").val());
	var forgot_link = $.trim($("#forgotpwd_link").val());
	var error=0;
  
	event.preventDefault();
	 
	if(forgot_subject == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter subject');
		error++;
	}else if(forgot_template == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter template text');
		error++;
	}else if(forgot_link == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter link text');
		error++;
	}    	
	  
	if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_webmail",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){	
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
											
				}
		});  
	}   
	remove_hs_message();
	 
});
	
// invoice mail setting 
$("#invoice_mail_setting_form").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var invoice_subject =$.trim($("#invoice_subject").val());
	var invoice_template =$.trim($("#invoice_template").val());
	var error=0;

	event.preventDefault();
	 
	if(invoice_subject == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter subject');
		error++;
	}else if(invoice_template == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter template text');
		error++;
	}   	
	  
	if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_webmail",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){	
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
											
				}
		});  
	}   
	remove_hs_message();
	 
});
	
//user register by admin mail setting 
$("#user_regbyadmin_email").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var reg_subject =$.trim($("#register_subject").val());
	var reg_template =$.trim($("#register_template").val());
	var error=0;
  
	event.preventDefault();
 
	if(reg_subject == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter subject');
		error++;
	}else if(reg_template == "")                                  
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter template text');
		error++;
	}     	
	  
	if(error == 0){ 
		 
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_webmail",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){	
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrongh! Try Again.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully');
					}     
											
				}
		});  
	}   
	remove_hs_message();
	 
});
	
//************change web mail address end*************//  
});


// add products 
$(document).ready(function(){ 
	 
	$("#addproduct").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var p_name  =$.trim($("#p_name").val());
	var p_category =$.trim($("#p_category").val());
	var p_description=$.trim($("#p_description").val());
	var p_longdesc=$.trim($("#p_longdescription").val());
	var p_image = $.trim($("#exampleInputFile").val());
	var p_price = $.trim($("#p_price").val());
	var extension = p_image.split('.').pop();
	var error=0;
	var numpattern = /^\d+(\.\d+)?$/;
	//var numpattern = /[^0-9]/g;
	event.preventDefault();
	 
	if(p_name == "")                                  
    {   $(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Product Name');
		error++;
	}else if (p_category == 0)                       
    {   $(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Category.');
	    error++;
	}else if(p_description == "")
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Description.');
		error++;
	}else if(p_description.length > 85){
		
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Description should be 85 characters long only');
		error++;
		 
	}else if(p_longdesc == "")
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter long Description.');
		error++;
	}else if(p_image == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Image.');
	    error++;
	}else if((extension !== "jpg") && (extension !== "png") && (extension !== "gif") && (extension !== "jpeg")){
        $(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
		error++;
    }else if(p_price == "")
	{	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Price.');
		error++;
	}else if(numpattern.test(p_price) == false || p_price == 0) 
	{   
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Valid Price.');
		error++;
	}  
	
    if(error == 0){ 
		   
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/add_products",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						alert("data not valid");
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('product add successfully.');
						window.location.href = baseurl + "admin/productlist";
					}  
				}
		}); 
	}   
	remove_hs_message();
	 
	});
	  
});
  
//update products
$(document).ready(function(){ 
	 
    $("#updateproduct").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var p_name  =$.trim($("#p_name").val());
	var p_category =$.trim($("#p_category").val());
	var p_description=$.trim($("#p_description").val());
	var p_longdesc=$.trim($("#p_longdescription").val());
	var p_image =$.trim($("#exampleInputFile").val());
	var p_price =$.trim($("#p_price").val());
	var error=0;
	event.preventDefault();
	var numpattern = /^\d+(\.\d+)?$/;
	//var numpattern = /[^0-9]/g;
	 
	if(p_name == "")                                  
    {
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Product Name');
	    error++;
		 
    }else if (p_category == 0)                       
    {
        $(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Category.');
	    error++;
		
    }else if(p_description == ""){
		
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Description.');
		error++;
		 
	}else if(p_description.length > 85){
		
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Description should be 85 characters long only');
		error++;
		 
	}else if(p_longdesc == ""){
		
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter long Description.');
		error++;
		 
	}else if(p_image !== ""){

        var  extension = p_image.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg") {
        error = 0;
        }else
		{
            $(".hs_message").addClass("open_alert hs_error");
		    $("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
	    }
    }else if(p_price == ""){
		
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Price.');
		error++;
	}else if(numpattern.test(p_price) == false || p_price == 0) 
	{   
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Valid Price.');
		error++;
	}
	
	if(error == 0){ 
		   
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_products",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp){
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('product update successfully.');
						window.location.href = baseurl + "admin/productlist";
					}  
											
				}
		}); 
	}   
	  remove_hs_message();
});
});

 
//add product category.... 
 
$(document).ready(function(){ 
	 
	$("#add_cate_form").submit(function(){

	var baseurl =$("#baseurl").val();
	var cate_name =$.trim($("#catename").val());
	var cate_descri =$.trim($("#catedescription").val());
	var cate_img =$.trim($("#cateimage").val());
	var extension = cate_img.split('.').pop();
	var error = 0;	 
	event.preventDefault();
 
	if(cate_name == ""){
		  
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Category Name');
		error++;
	}else if(cate_descri == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Category Descriprion');
	    error++;
	}else if(cate_img == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Image');
		error++;
	}else if ((extension !== "jpg") && (extension !== "png") && (extension !== "gif") && (extension !== "jpeg")){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
		error++;
    }
    	
	if(error == 0){
        
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/add_category",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp){

				if(resp == 0){
				 $(".hs_message").addClass("open_alert hs_error");
				 $("#popup_message").text('data not valid.');
				}else if(resp == 1){
				 $(".hs_message").addClass("open_alert hs_success");
				 $("#popup_message").text('Category Add successfully.');
				 window.location.href = baseurl + "admin/categorylist";
				} 
			}

	}); 
		
	}  
	remove_hs_message();
	});
 });
 
 
//update product category.... 
 
$(document).ready(function(){ 
	 
    $("#update_cate_form").submit(function(){
     
	var baseurl =$("#baseurl").val();
	var cate_name =$.trim($("#update_catename").val());
	var cate_descri =$.trim($("#update_catedescri").val());
	var cate_img =$.trim($("#update_cateimage").val());
	var error = 0;	 
	event.preventDefault();
 
	if(cate_name == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Category Name');
		error++;
	}else if(cate_descri == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Category Descriprion');
		error++;
	}else if(cate_img !== ""){

        var  extension = cate_img.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg") {
			error = 0;
        }else
		{
            $(".hs_message").addClass("open_alert hs_error");
		    $("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
	    }
    }	 
    
	if(error == 0){
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_category",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
		  
					if(resp == 0){
					 $(".hs_message").addClass("open_alert hs_error");
					 $("#popup_message").text('data not valid.');
					}else if(resp == 1){
					 $(".hs_message").addClass("open_alert hs_success");
					 $("#popup_message").text('category update successfully.');
					 window.location.href = baseurl + "admin/categorylist";
					} 
			}

		}); 
		
	}  
   
	remove_hs_message();
	});
 });
 
//edit category
function edit_category(cate_id){
	var baseurl =$("#baseurl").val();
	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/edit_category",
	dataType: 'json',
	data: {cate_id: cate_id},
	success: function(resp) {
			
				 if(resp  == ""){
				 $(".hs_message").addClass("open_alert hs_error");
				 $("#popup_message").text('data not valid.');
				}else {  
				 $("#old_cateid").val(resp.all_category[0].category_id);
				 $("#update_catename").val(resp.all_category[0].category_name);
				 $("textarea#update_catedescri").val(resp.all_category[0].category_description);
				 $('#update_category').modal('show');
				}  
			}
		});  
	remove_hs_message();  
 }
 
  //view order details
 function view_order_details(orderid){

	if(orderid !==''){
		 $("#ouname").text($("#name_"+orderid).text())
		 $("#orderid").text($("#uniqid_"+orderid).text()); ; 
		 $("#contact_id").text($("#contact_"+orderid).text());
		 $("#proid").html($("#pid_"+orderid).html());
		 $("#odate").text($("#date_"+orderid).val()); 
		 $("#oemail").text($("#email_"+orderid).val());
		 $("#od_add").text($("#add_"+orderid).text());
		 $("#od_city").text($("#city_"+orderid).val());
		 $("#od_pincode").text($("#pincode_"+orderid).val());
		 $("#od_staus").text($("#order_status_"+orderid).val());
		 $("#od_amount").text($("#amount_"+orderid).val());
		 $("#od_disamount").text($("#discount_amount_"+orderid).val());
		 $("#od_paymode").text($("#paymode_"+orderid).val());
		 $("#od_paystaus").text($("#paystatus_"+orderid).val()); 
		 $("#view_order_info").modal('show');
	}
} 
 
//view reservation details
function view_reservation_details(reserv_id){
	 
	if(reserv_id !==''){
		$("#runiqid_").text($("#rdate_"+reserv_id).text());	
		$("#rdate").text($("#rdate_"+reserv_id).text());
		$("#rtime").text($("#rtime_"+reserv_id).text());
		$("#rpeople").text($("#rpeople_"+reserv_id).text());
		$("#roccasion").text($("#roccasion_"+reserv_id).text());
		$("#rfood").text($("#rpname_"+reserv_id).text());
		$("#rmsg").text($("#rmsg_"+reserv_id).val());
		$("#rname").text($("#rname_"+reserv_id).text());
		$("#remail").text($("#remail_"+reserv_id).val());
		$("#rtable_no").text($("#rtable_"+reserv_id).text());
		$("#rstatus").text($("#rstatus_"+reserv_id).val());
		$("#view_reservation_info").modal('show');
	}
} 
 
  
//add blog category
function addblogcategory(){
    
	var baseurl =$("#baseurl").val();
    var c_name =$.trim($("#category_name").val());
	 
	if(c_name == ""){
	    $(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Category Name');  
	 
	}else{
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/add_blogcategory",
		data: {cate_name: c_name},
		success: function(resp) {
		  
					if(resp == 0){
					 $(".hs_message").addClass("open_alert hs_error");
					 $("#popup_message").text('data not valid.');
					}else if(resp == 1){
					   $(".hs_message").addClass("open_alert hs_success");
					   $("#popup_message").text('category Add successfully.');
					   window.location.href = baseurl + "admin/blog_catelist";
					} 
				}
		});
	}
	remove_hs_message();	
 }
 
 //***********edit blog category start********************//
 function edit_blogcategory(blogcate_id,blogcate_name){
	
	 if(blogcate_id !== '' && blogcate_name !== '' ){
		 $("#old_bcateid").val(blogcate_id);
		 $("#update_bcate_name").val(blogcate_name);
		 $('#update_blogcate').modal('show');
	}
}
//***********edit blog category end********************//
 
//***************update blog category start*********************// 
function update_blog_category(){
    
	var baseurl =$("#baseurl").val();
    var c_id =$.trim($("#old_bcateid").val());
    var c_name =$.trim($("#update_bcate_name").val());
	 
	if(c_name == ""){
	    $(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Category Name');  
	}else{
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_blogcategory",
		data: {bcate_id: c_id, cate_name: c_name},
		success: function(resp) {
		  
					if(resp == 0){
					  $(".hs_message").addClass("open_alert hs_error");
					 $("#popup_message").text('data not valid.');
					}else if(resp == 1){
					   $(".hs_message").addClass("open_alert hs_success");
					   $("#popup_message").text('category update successfully.');
					   window.location.href = baseurl + "admin/blog_catelist";
					} 
				}
		});
	}
	remove_hs_message();	
 } 
 
//***************update blog category end*********************// 
 

//add blogs
 
$(document).ready(function(){ 
	 
    $("#addblogs").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var blog_title  =$.trim($("#b_title").val());
	var blog_cate  =$.trim($("#b_category").val());
	var blog_content =$.trim($("#b_content").val());
	var blog_image =$.trim($("#exampleInputFile").val());
	var extension = blog_image.split('.').pop();
	var blog_longcontent = CKEDITOR.instances.longb_content.getData();
	var error=0;
	for (instance in CKEDITOR.instances) 
	{
		CKEDITOR.instances[instance].updateElement();
	}
	event.preventDefault();
	 
	if(blog_title == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Blog Title');  
		error++;
	}else if (blog_cate == 0)                                  
    {	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Blog Category');  
		error++;
	}else if(blog_image == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Image');  
		error++;
	}else if((extension !== "jpg") && (extension !== "png") && (extension !== "gif") && (extension !== "jpeg") ) {
        $(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
		error++;
    }else if (blog_content == "")                       
    {	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Blog Content');   
	    error++;
	}else if (blog_longcontent == "")                       
    {	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter long Blog Content');  
	    error++;
	}   
	
    if(error == 0){ 
		   
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/add_blog_data",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp){
			 
					if(resp == 0){
					  $(".hs_message").addClass("open_alert hs_error");
					  $("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Blog add successfully.');
						window.location.href = baseurl + "admin/bloglist";
					}  
											
				}
		}); 
	}   
   remove_hs_message();
 });
});
  
 
// update blogs..
$(document).ready(function(){ 
	 
	$("#updateblogs").submit(function(){

	var baseurl =$("#baseurl").val();
	var blog_title  =$.trim($("#b_title").val());
	var blog_cate  =$.trim($("#b_category").val());
	var blog_image =$.trim($("#exampleInputFile").val());
	var blog_content =$.trim($("#b_content").val());
	var blog_longcontent = CKEDITOR.instances.longb_content.getData();
	for (instance in CKEDITOR.instances) 
	{
	CKEDITOR.instances[instance].updateElement();
	} 
	var error=0;
	
	event.preventDefault();
	 
	if(blog_title == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Blog Title'); 
		error++;
	}else if(blog_cate == 0)                                  
    {	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Blog Category'); 
		error++;
	}else if(blog_image !== ""){
		var  extension = blog_image.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg") {
        error = 0;
        }else
		{	$(".hs_message").addClass("open_alert hs_error");
		    $("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
	    }
    }else if(blog_content == "")                       
    {	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Blog Content');  
	    error++;
	}else if(blog_longcontent == "")                       
    {	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter long Blog Content');  
	    error++;
	}  
	
    if(error == 0){ 
		   
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_blog_data",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp){

				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not valid.');
				}else if(resp == 1){
					$(".hs_message").addClass("open_alert hs_success");
					$("#popup_message").text('Blog update successfully.');
					window.location.href = baseurl + "admin/bloglist";
				}  
									
			}
		});  
	} 
	remove_hs_message();
  });
});
 
//add testimonial.....
 
$(document).ready(function(){ 
	 
	$("#addtestimonial").submit(function(){

	var baseurl =$("#baseurl").val();
	var testi_name  =$.trim($("#testimo_name").val());
	var testi_desig  =$.trim($("#testimo_desig").val());
	var testi_image =$.trim($("#exampleInputFile").val());
	var testi_msg =$.trim($("#testimo_msg").val());
	var extension = testi_image.split('.').pop();
	var error=0;
	event.preventDefault();
	 
	if(testi_name == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Testimonial Name');
		error++;
	}else if (testi_desig == 0)                                  
    {	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Testimonial Designation');
		error++;
	}else if (testi_image == "")                       
    {	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Image');
	    error++;
	}else if ((extension !== "jpg") && (extension !== "png") && (extension !== "gif") && (extension !== "jpeg")) {
        $(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
		error++;
    }else if(testi_msg == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Message');
		error++;
	}  
	
    if(error == 0){ 
		   
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/add_testimonial",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
					  $(".hs_message").addClass("open_alert hs_error");
					  $("#popup_message").text('data not valid.');
					}else if(resp == 1){
					   $(".hs_message").addClass("open_alert hs_success");
					   $("#popup_message").text('testimonial add successfully.');
					   window.location.href = baseurl + "admin/testimoniallist";
					}  
											
				}
		}); 
	}   
	remove_hs_message();
 });
});
  
//update testimonial
  
$(document).ready(function(){ 
	 
	$("#updatetestimonial").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var testi_name  =$.trim($("#testimo_name").val());
	var testi_desig  =$.trim($("#testimo_desig").val());
	var testi_image =$.trim($("#exampleInputFile").val());
	var testi_msg =$.trim($("#testimo_msg").val());
	var error=0;
	event.preventDefault();
	 
	if(testi_name == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Testimonial Name');
		error++;
	}else if (testi_desig == 0)                                  
    {   $(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Testimonial Designation');
		error++;
	}else if(testi_image !== ""){
		var  extension = testi_image.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg") {
        error = 0;
        }else
		{	$(".hs_message").addClass("open_alert hs_error");
		    $("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
	    }
    }else if(testi_msg == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Message');
		error++;
	}  
	
    if(error == 0){ 
		   
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/updatetestimo",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
					   $(".hs_message").addClass("open_alert hs_success");
					   $("#popup_message").text('testimonial update successfully.');
					   window.location.href = baseurl + "admin/testimoniallist";
					}  
											
				}
		}); 
	}   
	remove_hs_message();
 });
});
 
 
// add chef team member 
 
$(document).ready(function(){ 
	$("#addchef").submit(function(){

	var baseurl =$("#baseurl").val();
	var chef_name  =$.trim($("#chef_name_id").val());
	var chef_desig  =$.trim($("#chef_desig_id").val());
	var chef_image =$.trim($("#chef_image_id").val());
	var extension = chef_image.split('.').pop();
	var error=0;
	event.preventDefault();
	 
	if(chef_name == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Name');
		error++;
	}else if (chef_desig == 0)                                  
    {   $(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Designation');
		error++;
	}else if (chef_image == "")                       
    {   $(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Image');
	    error++;
	}else if ((extension !== "jpg") && (extension !== "png") && (extension !== "gif") && (extension !== "jpeg") ) {
        $(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
		error++;
    }  
	
    if(error == 0){ 
		   
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/add_chefmember",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('chef member add successfully.');
						window.location.href = baseurl + "admin/chefteamlist";
					}  
											
				}
		}); 
	}   
   remove_hs_message();
 });
}); 
 
 
//update chef team member
  
$(document).ready(function(){ 
	 
	$("#updatechef").submit(function(){

	var baseurl =$("#baseurl").val();
	var chef_name  =$.trim($("#chef_name_id").val());
	var chef_desig  =$.trim($("#chef_desig_id").val());
	var chef_image =$.trim($("#chef_image_id").val());
	var error=0;

	event.preventDefault();
	 
	if(chef_name == ""){
		  
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Name');
		error++;
		
	}else if (chef_desig == 0)                                  
    {
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Designation');
		error++;
		
    }else if(chef_image !== ""){

        var  extension = chef_image.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg") {
        error = 0;
        }else
		{
            $(".hs_message").addClass("open_alert hs_error");
		    $("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
	    }
    }    
	
 if(error == 0){ 
		   
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_chefmember",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('chef member update successfully.');
						window.location.href = baseurl + "admin/chefteamlist";
					}  
											
				}
		}); 
	}   
   remove_hs_message();
  });
});
 
 
//add portfolio 
 
$(document).ready(function(){ 
	$("#addportfolio").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var portfolio_image =$.trim($("#portfolio_image_id").val());
	var extension = portfolio_image.split('.').pop();
	var error=0;
	event.preventDefault();
	 
	if (portfolio_image == "")                       
    {
       $(".hs_message").addClass("open_alert hs_error");
	   $("#popup_message").text('Please Select Image');
	    error++;
		
    }else if ((extension !== "jpg") && (extension !== "png") && (extension !== "gif") && (extension !== "jpeg") ) {
	  $(".hs_message").addClass("open_alert hs_error");
	  $("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
	  error++;
	}

	if(error == 0){ 
		   
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/add_portfolio",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Portfolio add successfully.');
						window.location.href = baseurl + "admin/gallery_image_list";
					}  
				}
		}); 
	}   
	remove_hs_message();
 });
}); 
 
 
//add partners 
$(document).ready(function(){ 
	 
	$("#addpartners").submit(function(){

	var baseurl =$("#baseurl").val();
	var partner_image =$.trim($("#partner_image_id").val());
	var extension = partner_image.split('.').pop();
	var error=0;
	 
	event.preventDefault();
	 
	if(partner_image == "")                       
    {
       $(".hs_message").addClass("open_alert hs_error");
	   $("#popup_message").text('Please Select Image');
	   error++;
		
    }else if ((extension !== "jpg") && (extension !== "png") && (extension !== "gif") && (extension !== "jpeg") ) {
	  $(".hs_message").addClass("open_alert hs_error");
	  $("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
	  error++;
    }



	if(error == 0){ 
		   
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/add_partners",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Partner add successfully.');
						window.location.href = baseurl + "admin/partners_list";
					}  
											
				}
		}); 
	}   
	remove_hs_message();
 });
}); 
 
//***********edit/update partner start********************//
 function edit_partner(partner_id,partner_image){
	
	if(partner_id !== '' && partner_image !== '' ){
		$("#old_partnerid").val(partner_id);
		$('#update_partner_model').modal('show');
	}
}

$(document).ready(function(){ 
	 
	$("#update_partners").submit(function(){

	var baseurl =$("#baseurl").val();
	var partner_image =$.trim($("#update_partner_image").val());
	var extension = partner_image.split('.').pop();
	var error=0;
	event.preventDefault();
	 
	if(partner_image == "")                       
    {
       $(".hs_message").addClass("open_alert hs_error");
	   $("#popup_message").text('Please Select Image');
	    error++;
		
    }else if((extension !== "jpg") && (extension !== "png") && (extension !== "gif") && (extension !== "jpeg") ) 
	{
	  $(".hs_message").addClass("open_alert hs_error");
	  $("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
	  error++;
    }



	if(error == 0)
	{ 
		   
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_partners",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp){
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Partners update successfully.');
						window.location.href = baseurl + "admin/partners_list";
					}  
											
				}
		}); 
	}   
	remove_hs_message();
 });
}); 
//***********edit/update partner end********************// 
 
 
//***********edit/update portfolio start********************// 
 function edit_portfolio(portfolio_id,portfolio_image){
	
	if(portfolio_id !== '' && portfolio_image !== '' ){
		$("#old_portfolio_id").val(portfolio_id);
		$('#update_portfolio_model').modal('show');
	}
}

 
$(document).ready(function(){ 
	 
	$("#update_portfolio").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var portfolio_image =$.trim($("#update_portfolio_img").val());
	var extension = portfolio_image.split('.').pop();
	var error=0;

	event.preventDefault();
	 
	if(portfolio_image == "")                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Image');
		error++;
	
	}else if((extension !== "jpg") && (extension !== "png") && (extension !== "gif") && (extension !== "jpeg")) {
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
		error++;
	}

	if(error == 0){ 
	   
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_portfolio",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp){
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Portfolio update successfully.');
						window.location.href = baseurl + "admin/gallery_image_list";
					}  
				}
		}); 
	}   
	remove_hs_message();
});
});
 
//***********edit/update portfolio end********************// 

//************add/edit/update offers start******************//
function edit_offers(offerid){
	var baseurl =$("#baseurl").val();
	if(offerid !== ''){
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/edit_offer",
		data: {offer_id: offerid},
		success: function(resp) {
			 var respData = JSON.parse(resp);
			 if(respData['status'] == 1){ 
				 $("#old_offer_id").val(respData['edit_offer'][0]['offer_id']);
				 $("#up_offer_heading").val(respData['edit_offer'][0]['offer_heading']); 
				 $("#up_offer_descr").val(respData['edit_offer'][0]['offer_description']); 
				 $("#up_coupen_code").val(respData['edit_offer'][0]['coupen_code']); 
				 $("#up_coupen_uses_limit").val(respData['edit_offer'][0]['coupen_uses_limt']); 
				 $("#up_discount_type").val(respData['edit_offer'][0]['discount_type']);
				 $( "#up_discount_type" ).trigger( "change" );				 
				 $("#up_discount_amount").val(respData['edit_offer'][0]['discount_amount']); 
				 $("#up_apply_discount_to").val(respData['edit_offer'][0]['apply_discount_to']); 
				 $( "#up_apply_discount_to" ).trigger( "change" );
				  if(respData['edit_offer'][0]['apply_discount_to'] == 'single_product'){
						$("#up_discounted_product").val(respData['edit_offer'][0]['discounted_product']); 
					    $("#up_discounted_product" ).trigger( "change");
						$('#up_discounted_product').removeAttr('disabled');
				  } 
				 $("#up_discounted_product").val(respData['edit_offer'][0]['discounted_product']); 
				 $("#up_coupen_expire_date").val(respData['edit_offer'][0]['coupen_expire_date']); 
				 $("#update_offer").modal('show');  
			 }else{
				 $(".hs_message").addClass("open_alert hs_error");
				 $("#popup_message").text(respData['error']);
			 }
					  
		  }
		});
		remove_hs_message();		
	}
}





$(document).ready(function(){ 
	 
	 $("#apply_discount_to").change(function(){
	 var apply_to = $(this).val();
	 if(apply_to == 'Total_amount'){
		$('#discounted_product').attr('disabled', 'disabled');
		$('#discounted_product').val(0); 
		$("#discounted_product" ).trigger( "change");
	 }else{
		$('#discounted_product').removeAttr('disabled');
	 }
	 
	 });
	 
	 $("#up_apply_discount_to").change(function(){
	 var apply_to = $(this).val();
	 if(apply_to == 'Total_amount'){
		$('#up_discounted_product').attr('disabled', 'disabled');
		$('#up_discounted_product').val(0); 
		$("#up_discounted_product" ).trigger( "change");
	 }else{
		$('#up_discounted_product').removeAttr('disabled');
	 }
	 
	 });
	 
	$("#add_offer_form").submit(function(){

	var baseurl =$("#baseurl").val();
	var offer_heading =$.trim($("#offer_heading").val());
	var offer_descr =$.trim($("#offer_descr").val());
	var offer_image =$.trim($("#offer_image").val());
	var coupen_code =$.trim($("#coupen_code").val());
	var coupen_limit =$.trim($("#coupen_uses_limit").val());
	var discount_type = $.trim($("#discount_type").val());
	var discount_amount = $.trim($("#discount_amount").val());
	var apply_discount = $.trim($("#apply_discount_to").val());
	var discounted_prod = $.trim($("#discounted_product").val());
	var expire_date = $.trim($("#coupen_expire_date").val());
	var error=0;

	event.preventDefault();

	if(offer_heading == "")                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Fill All Fileds');
		error++;

	}else if(offer_descr == "")                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Fill All Fileds');
		error++;

	}else if(coupen_code == "")                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Coupen Code');
		error++;

	}else if(coupen_limit == "")                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Limit');
		error++;

	}else if(discount_type == 0)                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Discount Type');
		error++;

	}else if(discount_amount == "")                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Discount Amount');
		error++;

	}else if(apply_discount =='single_product')                       
	{
		if(discounted_prod == 0)                       
		{
			$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Please Select Product');
			error++;
		}

	}else if(expire_date == "")                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Expire Date');
		error++;
	}else if(offer_image !== "")                       
	{
		var  extension = offer_image.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg") {
			error = 0;
		}else
		{
			$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
		}

	}    

	if(error == 0){ 
	    jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/add_offer",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Offer add successfully.');
						window.location.href = baseurl + "admin/offers_list";
					}else if(resp == 2){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('This coupen code already exist. please enter another copen code');
					}  
				}
		}); 
	}    
	remove_hs_message();
	});
});

$(document).ready(function(){ 
	 
    $("#update_offer_form").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	var offer_heading =$.trim($("#up_offer_heading").val());
	var offer_descr =$.trim($("#up_offer_descr").val());
	var offer_image =$.trim($("#up_offer_image").val()); 
	var coupen_code =$.trim($("#up_coupen_code").val());
	var coupen_limit =$.trim($("#up_coupen_uses_limit").val());
	var discount_type = $.trim($("#up_discount_type").val());
	var discount_amount = $.trim($("#up_discount_amount").val());
	var apply_discount = $.trim($("#up_apply_discount_to").val());
	var discounted_prod = $.trim($("#up_discounted_product").val());
	var expire_date = $.trim($("#up_coupen_expire_date").val());
	var error=0;
	event.preventDefault();

	if(offer_heading == "")                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Fill All Fileds');
		error++;

	}else if(offer_descr == "")                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Fill All Fileds');
		error++;

	}else if(coupen_code == "")                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Coupen Code');
		error++;

	}else if(coupen_limit == "")                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Limit');
		error++;

	}else if(discount_type == 0)                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Discount Type');
		error++;

	}else if(discount_amount == "")                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Discount Amount');
		error++;

	}else if(apply_discount =='single_product')                       
	{
		if(discounted_prod == 0)                       
		{
			$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Please Select Product');
			error++;
		}

	}else if(expire_date == "")                       
	{
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Expire Date');
		error++;
	}else if(offer_image !== "")                       
	{
		var  extension = offer_image.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg") {
			error = 0;
		}else
		{
			$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
		}
	}   

	if(error == 0){ 

		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_offer",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp){
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Offer update successfully.');
						window.location.href = baseurl + "admin/offers_list";
					}  
				}
		}); 
	}    
	remove_hs_message();
});
});

//update offer status
function update_offer_status(offer_id){
	 
	var baseurl =$("#baseurl").val();
	var isChecked = $("#offerstatus_"+offer_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
	 
	  
	if(val !== '' && offer_id !== ''){      
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_offer_status",
		data: {offer_value: val, offer_id: offer_id},
		success: function(resp){
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
					$(".hs_message").addClass("open_alert hs_success");
					$("#popup_message").text('data update successfully.');
				}  
										
			}
		});  
	 } 
	 remove_hs_message();
}

 

  
 //update pages  
 $(document).ready(function(){ 
	 
	$("#updatepages").submit(function(){

	var baseurl =$("#baseurl").val();
	var page_head  =$.trim($("#page_heading").val());
	var page_tit  =$.trim($("#page_title").val());
	var page_img =$.trim($("#page_image").val());
	var page_shortcontent =$.trim($("#page_shortcontn").val());
	var page_massg = CKEDITOR.instances.page_msg.getData();
	for (instance in CKEDITOR.instances) 
	{
	CKEDITOR.instances[instance].updateElement();
	}
	
	var error=0;
	event.preventDefault();
	 
	if(page_head == ""){
		  
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Page Heading');
		error++;
		
	}else if (page_tit == 0)                                  
    {
	    $(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Page Title');
		error++;
		
    }else if(page_img !== ""){

        var  extension = page_img.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg") {
        error = 0;
        }else
		{
            $(".hs_message").addClass("open_alert hs_error");
		    $("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
	    }
    }else if(page_shortcontent == ""){
		
		  $(".hs_message").addClass("open_alert hs_error");
		  $("#popup_message").text('Please Enter Page Short Contents');
		 error++;
	}else if(page_massg == ""){
		
		  $(".hs_message").addClass("open_alert hs_error");
		  $("#popup_message").text('Please Enter Page long Contents');
		 error++;
	}  
	
    if(error == 0){ 
		   
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_pages",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp){
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('page update successfully.');
					}  
											
				}
		}); 
	}   
	remove_hs_message();
 });
});

//*****************update Settings section start***********************// 

function edit_websetting(uniq_id,value_text){
	
	if(uniq_id !== '' && value_text !== '' ){
		$("#old_valueid").val(uniq_id);
		$("#update_valuetext").val(value_text);
		$('#update_websettings').modal('show');
	}
}

 
$(document).ready(function(){ 
	 
	$("#update_websetting").submit(function(){
		 
	var baseurl =$("#baseurl").val(); 
	var old_valuetxt_id = $.trim($("#old_valueid").val()); 
	var value_text = $.trim($("#update_valuetext").val());  
	event.preventDefault();
    
	if(value_text == ''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
	}else{
		
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_websettings",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Data update successfully.');
					   window.location.href = baseurl + "setting/site_setting";
					}  
											
				}
		}); 
	}
	remove_hs_message();
	});
});	 


function update_section_status(uniq_id){
	
	var baseurl =$("#baseurl").val();
	var isChecked = $("#textstatus_"+uniq_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}

	 if(val !== '' && uniq_id !== ''){      
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_section_status",
		data: {section_value: val, section_id: uniq_id},
		success: function(resp) {
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				}  
										
			}
		});  
	 }
	 remove_hs_message();
}
	
//*********website image update start*****************//

$(document).ready(function(){ 
	 
    $("#web_image_update").submit(function(){	
		   
	var baseurl =$("#baseurl").val();
	var preloader_img = $.trim($("#preloader_img").val());
	var fevicon_img = $.trim($("#favicon_img").val());  
	var logo_img = $.trim($("#logo_img").val());  
	var booking_section_img = $.trim($("#booking_section_img").val());
	var footer_logo_img = $.trim($("#footer_logo_img").val());
	var mobileapp_img = $.trim($("#mobileapp_img").val());
	var googlestore_img = $.trim($("#googlestore_img").val());
	var iosstore_img = $.trim($("#iosstore_img").val());				
	error=0; 
	event.preventDefault();
	
	if(preloader_img !== "" ){
		
		var  extension = preloader_img.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg") {
			error = 0;
		}else
		{
			$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
		}	
	}
		
	if(fevicon_img !== "" ){
		
		var  extension = fevicon_img.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg") {
			error = 0;
		}else
		{
			$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
		}	
	}	

	if(logo_img !== "" ){

		var  extension = logo_img.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg"){
			error = 0;
		}else
		{
			$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
		}
	}

	if(booking_section_img !== "" ){

		var  extension = booking_section_img.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg") {
			error = 0;
		}else
		{
			$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
		}	
	}
		
	if(footer_logo_img !== "" ){

		var  extension = footer_logo_img.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg") {
			error = 0;
		}else
		{
			$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
		}	
	}
		
	if(mobileapp_img !== "" ){

		var  extension = mobileapp_img.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg"){
			error = 0;
		}else
		{
			$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
		}	
	}
		
	if(googlestore_img !== "" ){

		var  extension = googlestore_img.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg"){
			error = 0;
		}else
		{
			$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
		}	
	}
		
	if(iosstore_img !== "" ){

		var  extension = iosstore_img.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg"){
			error = 0;
		}else
		{
			$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
		}	
	}
			
	if(error ==0){
	
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_website_image",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not valid');
				}else if(resp == 1){
					$(".hs_message").addClass("open_alert hs_success");
					$("#popup_message").text('image update successfully.');
				}  
										
			}
		});
	}  
	remove_hs_message(); 
	});
});	
//*********website image update end*****************//

//*********add/update banner slider start***********//
$(document).ready(function(){ 
	 
	$("#add_slider_form").submit(function(){

	var baseurl =$("#baseurl").val();
	event.preventDefault();  
		   
	jQuery.ajax({
	type: "POST",
	url: baseurl + "setting/addslider",
	data: new FormData(this),
	contentType: false,       
	cache: false,             
	processData:false,
	success: function(resp) {
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not valid.');
				}else if(resp == 1){
					$(".hs_message").addClass("open_alert hs_success");
					$("#popup_message").text('Slider add successfully.');
					window.location.href = baseurl + "setting/manage_slider";
				}  
			}
	}); 
		     
	remove_hs_message();
	});
});


$(document).ready(function(){ 
	 
    $("#update_slider_form").submit(function(){
	  
	var baseurl =$("#baseurl").val();
	event.preventDefault();
	jQuery.ajax({
	type: "POST",
	url: baseurl + "setting/updateslider",
	data: new FormData(this),
	contentType: false,       
	cache: false,             
	processData:false,
	success: function(resp) {
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not valid.');
				}else if(resp == 1){
					$(".hs_message").addClass("open_alert hs_success");
					$("#popup_message").text('Slider Update successfully.');
				}  
			}
	}); 
	     
	remove_hs_message();
	});
});

function update_slider_status(slider_id){
	
	var baseurl =$("#baseurl").val();
	var isChecked = $("#slidestatus_"+slider_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
			 
	if(val !== '' && slider_id !== ''){      
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_slider_status",
		data: {slider_value: val, slider_id: slider_id},
		success: function(resp){
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not update.');
					}else if(resp == 1){
					   $(".hs_message").addClass("open_alert hs_success");
					   $("#popup_message").text('data update successfully.');
					}  
											
				}
		});  
	 }
	 remove_hs_message();
}

//*********add/update banner slider end***********//

//**********Add/edit/update occasion start*******************//
function edit_occasion(occasion_id,opening_name){
	
	if(occasion_id !== '' && opening_name !== '' ){
		$("#old_occasid").val(occasion_id);
		$("#update_occaname").val(opening_name);
		$('#update_occasion').modal('show');
	}
}
//add occasion
$(document).ready(function(){ 
	
	$("#add_occasion_form").submit(function(){
	 
	var baseurl =$("#baseurl").val(); 
	var occasion_name = $.trim($("#occasion_name").val());  
	event.preventDefault();

	if(occasion_name == ''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
	}else{

		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/add_occasion",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('data update successfully.');
					   window.location.href = baseurl + "admin/occasion";
					}  
											
				}
		}); 
	}
	remove_hs_message();
});

//update occasion	
	$("#update_occasion_form").submit(function(){
		 
	var baseurl =$("#baseurl").val(); 
	var occasion_name = $.trim($("#update_occaname").val());  
	event.preventDefault();

	if(occasion_name == ''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
	}else{
		
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_occasion",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('data update successfully.');
					   window.location.href = baseurl + "admin/occasion";
					}  
											
				}
		}); 
	}
	remove_hs_message();
	});
});

function update_ocassion_status(occasion_id){
	
	var baseurl =$("#baseurl").val();
	var isChecked = $("#ocasnstatus_"+occasion_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
	 
	if(val !== '' && occasion_id !== ''){      
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_occasion_status",
		data: {occasion_value: val, occasion_id: occasion_id},
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not update.');
					}else if(resp == 1){
					   $(".hs_message").addClass("open_alert hs_success");
					   $("#popup_message").text('data update successfully.');
					}  
											
				}
		});  
	 }
	 remove_hs_message();
}
 
//**********Add/edit/update occasion start******************//

//*********opening schedule setting section start********//
function edit_opening_hours(opening_id,opening_time){
	
	if(opening_id !== '' && opening_time !== '' ){
		$("#old_openid").val(opening_id);
		$("#update_open_time").val(opening_time);
		$('#update_opening_hours').modal('show');
	}
}

 
$(document).ready(function(){ 
	 
	$("#update_opening_time").submit(function(){
		 
	var baseurl =$("#baseurl").val(); 
	var old_open_id = $.trim($("#old_openid").val()); 
	var open_time = $.trim($("#update_open_time").val());  
	event.preventDefault();
    
	if(open_time == ''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
	}else{
		
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_opening_hours",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('data update successfully.');
						window.location.href = baseurl + "setting/site_setting";
					}  
											
				}
		}); 
	}
	remove_hs_message();
	});
});	 

 

function update_opening_status(schedule_id){
	
	var baseurl =$("#baseurl").val();
	var isChecked = $("#opentimestatus_"+schedule_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
	if(val !== '' && schedule_id !== ''){      
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_opening_schedule_status",
		data: {schedule_value: val, schedule_id: schedule_id},
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not update.');
					}else if(resp == 1){
					   $(".hs_message").addClass("open_alert hs_success");
					   $("#popup_message").text('data update successfully.');
					 
					}  
											
				}
		});  
	 }
	 remove_hs_message();
}

//********opening schedule setting section end ********//


 
//************* edit and update comment start ******************//
function edit_comment(co_id,co_name,co_email,co_content,co_date){

	if(co_id !== ''){
		$("#old_commentid").val(co_id);
		$("#up_cooment_name").val(co_name);
		$('#up_cooment_email').val(co_email);
		$('#up_comment_content').val(co_content);
		$('#update_comments').modal('show');
	}
}

 
$(document).ready(function(){ 
	 
	$("#update_comment_form").submit(function(){
		 
	var baseurl =$("#baseurl").val(); 
	var cooment_name = $.trim($("#up_cooment_name").val()); 
	var cooment_email = $.trim($("#up_cooment_email").val());
    var comment_content = $.trim($("#up_comment_content").val()); 	
	var pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$";	
	var error =0;
	event.preventDefault();
    
	if(cooment_name == ''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
		error++;
	}else if(cooment_email == ''){ 
	    $(".hs_message").addClass("open_alert hs_error");
        $("#popup_message").text('Empty Filed Not allowed');
		 error++;
	}else if(!cooment_email.match(pattern))                
    {	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Valid Email Address'); 
		error++;
	}else if(comment_content == ''){ 
	    $(".hs_message").addClass("open_alert hs_error");
        $("#popup_message").text('Empty Filed Not allowed');
	   error++;
	} 
	if(error == 0){
		
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_comments",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('Comment update successfully.');
					   window.location.href = baseurl + "admin/comments";
					}  
											
				}
		});  
	}
	remove_hs_message();
	});
});	 

//************* edit and update comment end******************//


//*********add booking tables *************//
 
$(document).ready(function(){ 
	$("#add_tableform").submit(function(){

	var baseurl =$("#baseurl").val();
	var table_name =$.trim($("#t_name").val());
	var table_number =$.trim($("#t_number").val());
	var table_capacity =$.trim($("#t_capacity").val());
	var table_image =$.trim($("#t_image").val());
	var extension = table_image.split('.').pop();
	var num_pattern = /[^0-9]/g;
	var error=0;
	event.preventDefault();
	if(table_name == ""){
		  
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Table Name'); 
		error++;
	}
	else if(table_number == "" || table_number == 0 ){
		  
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Table Number'); 
		error++;
	}else if(num_pattern.test(table_number) == true){
 
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter only numeric value'); 
	    error++;

	}else if(table_capacity == "" || table_capacity == 0 ){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Table Capacity'); 
		error++;
	}else if(num_pattern.test(table_capacity) == true){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter only numeric value'); 
		error++;
	}else if(table_image == "")                       
    {	$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Select Image');
	    error++;
	}else if((extension !== "jpg") && (extension !== "png") && (extension !== "gif") && (extension !== "jpeg") ) {
        $(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
		error++;
    }
	
	if(error == 0){
 
 
      jQuery.ajax({
            type: "POST",
            url: baseurl + "admin/addtable",
			data: new FormData(this),
            contentType: false,       
            cache: false,             
            processData:false,
			success: function(resp) {
				 
		                if(resp == 0){
		                    $(".hs_message").addClass("open_alert hs_error");
		                    $("#popup_message").text('data not valid.');
		                }else if(resp == 1){
						    $(".hs_message").addClass("open_alert hs_success");
		                    $("#popup_message").text('table add successfully.');
			                window.location.href = baseurl + "admin/tablelist";
		                }  
					 	 						
					}
	        }); 
	}
	remove_hs_message(); 
 });
});

//***********update booking tables *************//

$(document).ready(function(){ 
	$("#update_tableform").submit(function(){

	var baseurl =$("#baseurl").val();
	var table_name =$.trim($("#t_name").val());
	var table_number =$.trim($("#t_number").val());
	var table_capacity =$.trim($("#t_capacity").val());
	var table_image =$.trim($("#t_image").val());
	var extension = table_image.split('.').pop();
	var num_pattern = /[^0-9]/g;
	var error=0;
	event.preventDefault();
	if(table_name == ""){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Table Name'); 
		error++;
	}else if(table_number == "" || table_number == 0 ){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Table Number'); 
		error++;
	}else if(num_pattern.test(table_number) == true){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter only numeric value'); 
		error++;
	}else if(table_capacity == "" || table_capacity == 0 ){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter Table Capacity'); 
		error++;
	}else if(num_pattern.test(table_capacity) == true){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter only numeric value'); 
		error++;
	}else if(table_image !== ""){

		var  extension = table_image.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "bmp" || extension == "jpeg" || extension == "jpg") {
			error = 0;
		}else
		{
			$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
		}
	}
	if(error == 0){
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_table",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not valid.');
					}else if(resp == 1){
						$(".hs_message").addClass("open_alert hs_success");
						$("#popup_message").text('table update successfully.');
						window.location.href = baseurl + "admin/tablelist";
					}  
											
				}
		}); 
	}
	remove_hs_message(); 
	 });
	 
});


//*******status update section start******//
 function update_category_status(cate_id){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#catestatus_"+cate_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}  
			 
	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/update_cate_status",
	data: {val: val, cate_id: cate_id},
	success: function(resp) {
		 
				if(resp == 0){
				   $(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				}  
			}
	});  
	remove_hs_message();
 }
 
 function change_tablestatus(table_id){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#tabstauts_"+table_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
		 
	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/update_table_status",
	data: {val: val, table_id: table_id},
	success: function(resp) {
		 
				if(resp == 0){
				   $(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				 
				}  
										
			}
	});  
	remove_hs_message();
 }
 
 
 function change_cate_featured(cate_id){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#catefeatu_"+cate_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
	  
	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/update_cate_featured",
	data: {val: val, cate_id: cate_id},
	success: function(resp) {
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				}  
										
			}
	});  
	remove_hs_message();
 }
 
 function change_product_status(prod_id){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#prodstatus_"+prod_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
			 
	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/update_product_status",
	data: {val: val, prod_id: prod_id},
	success: function(resp) {
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				}  
										
			}
	});  

	remove_hs_message();
 }
 
function change_product_featured(prod_id){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#prodfetur_"+prod_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
			 
	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/update_product_featured",
	data: {val: val, prod_id: prod_id},
	success: function(resp) {
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				}  
										
			}
	});
	remove_hs_message();
 }
 
 function change_user_status(user_id){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#userstatus_"+user_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
	 
	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/update_user_status",
	data: {val: val, user_id: user_id},
	success: function(resp) {
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				}  
										
			}
	});  

	remove_hs_message();
 }
 
 function change_blogcate_status(blogcate_id){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#bcstatus_"+blogcate_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
	 
	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/update_blogcate_status",
	data: {val: val, blogcate_id: blogcate_id},
	success: function(resp) {
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				  $(".hs_message").addClass("open_alert hs_success");
				  $("#popup_message").text('data update successfully.');
				}  
			 }
	}); 

	remove_hs_message();
	 
 }

 
 function change_blog_status(blog_id){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#blogstatus_"+blog_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
	  
	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/update_blogs_status",
	data: {val: val, blog_id: blog_id},
	success: function(resp) {
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				  $(".hs_message").addClass("open_alert hs_success");
				  $("#popup_message").text('data update successfully.');
				}  
										
			}
	}); 

	remove_hs_message();
	 
 }
 
 function change_chefmember_status(chef_id){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#cheftatus_"+chef_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}

	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/update_chefmember_status",
	data: {val: val, chef_id: chef_id},
	success: function(resp) {
		 
				if(resp == 0){
				   $(".hs_message").addClass("open_alert hs_error");
				   $("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				}  
										
			}
	});
	remove_hs_message();			
	 
 } 
 
function change_testimonial_status(testi_id){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#testistatus_"+testi_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
		 
	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/update_testimonial_status",
	data: {val: val, testi_id: testi_id},
	success: function(resp) {
		 
				if(resp == 0){
				   $(".hs_message").addClass("open_alert hs_error");
				   $("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				}  
										
			}
	});  
	remove_hs_message();
	 
 }
 
function change_potfolio_status(portfolio_id){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#portstatus_"+portfolio_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
	 
	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/update_portfolio_status",
	data: {val: val, portfolio_id: portfolio_id},
	success: function(resp) {
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				}  
										
			}
	});  
	remove_hs_message();
}
 
 function change_partner_status(partner_id){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#partstatus_"+partner_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
	 
	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/update_partner_status",
	data: {val: val, partner_id: partner_id},
	success: function(resp) {
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				}  
										
			}
	});  
	remove_hs_message();
}
 
function change_comment_status(comment_id){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#comntstatus_"+comment_id).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
	 
	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/update_comment_status",
	data: {val: val, comment_id: comment_id},
	success: function(resp) {
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				}  
										
			}
	});  
	remove_hs_message();
}
 
function change_reservation_status(val,reservation_id){
	var baseurl =$("#baseurl").val();

	 
	jQuery.ajax({
	type: "POST",
	url: baseurl + "admin/update_reservation_status",
	data: {reserv_value: val, reserv_id: reservation_id},
	success: function(resp) {
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				}  
										
			}
	});  
	remove_hs_message();
	 
}
 
function smtp_mail_status(smtp_optid){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#smtpstatus_"+smtp_optid).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else{
		var val = 0;
	   
	}
	 
	jQuery.ajax({
	type: "POST",
	url: baseurl + "setting/smtp_option_status",
	data: {smtp_opt_value: val, smtp_opt_id: smtp_optid},
	success: function(resp) {
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				}  
			}
	});  
	remove_hs_message();
}
  
function payment_option_status(pay_optid){
	var baseurl =$("#baseurl").val();
	var isChecked = $("#paystatus_"+pay_optid).is(":checked");
	if (isChecked == true) {
	   
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
	 
	jQuery.ajax({
	type: "POST",
	url: baseurl + "setting/payment_option_status",
	data: {payopt_value: val, payopt_id: pay_optid},
	success: function(resp) {
		 
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('data not update.');
				}else if(resp == 1){
				   $(".hs_message").addClass("open_alert hs_success");
				   $("#popup_message").text('data update successfully.');
				}  
										
			}
	});  
	remove_hs_message();
}  
  
  
function change_order_status(val,order_id){
	var baseurl =$("#baseurl").val();
	var order_value = val; 
	var orderid = order_id; 
	if(order_value !=='' && orderid !==''){		
	        jQuery.ajax({
            type: "POST",
            url: baseurl + "setting/order_status",
            data: {odr_value: order_value, odr_id: orderid},
            success: function(resp) {
				 
		                if(resp == 0){
		                    $(".hs_message").addClass("open_alert hs_error");
		                    $("#popup_message").text('data not update.');
		                }else if(resp == 1){
			               $(".hs_message").addClass("open_alert hs_success");
		                   $("#popup_message").text('data update successfully.');
						}  
					 	 						
					}
		    });  
	remove_hs_message();
	} 
 }
 
 
 
//****************status update section end****************//
 
 //*************** user wallet credit start****************// 
function add_wallet_amount(wallet_user_id){

	if(wallet_user_id !== ''){
		$('#old_wallet_uid').val(wallet_user_id);
		$("#wallet_credit").modal('show');
	}
}

$(document).ready(function(){ 
	 
	$("#wallet_credit_form").submit(function(){
	var baseurl =$("#baseurl").val();
	var credit_wallet_amount =$.trim($("#cd_wallet_amount").val());
	var credit_wallet_note =$.trim($("#cd_wallet_note").val());
	var num_pattern = /[^0-9]/g;
	var error =0;
	event.preventDefault();
    
	if(credit_wallet_amount == ''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter Amount !'); 
		error++;
	}else if(num_pattern.test(credit_wallet_amount) == true){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter valid Amount !'); 
		error++;
	}else if(credit_wallet_amount == 0){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('please enter valid Amount !'); 
		error++;
	}
	
	if(error == 0){
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/wallet_credit",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp){
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('Something Went Wrough! Try Again');
					}else if(resp == 1){
					   $(".hs_message").addClass("open_alert hs_success");
					   $("#popup_message").text('Amount credit successfully');
						window.location.href =baseurl + "admin/userslist";
					}  
				}
		});
	}
	remove_hs_message();
	});
});

//*************** user wallet credit end****************// 

//************** Update Map Location start*******************//
$(document).ready(function(){ 
	$("#mapaddress_form").submit(function(){
	var baseurl =$("#baseurl").val();
	var map_address =$.trim($("#map_address").val());
	var map_api = $.trim($("#map_apikey").val());
	event.preventDefault();
   if(map_api == ''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Please Enter API Key!');
	   
   }else{
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/update_map_locatiion",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp){
				if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('Data Not Updated !'); 
				}else if(resp == 1){
					$(".hs_message").addClass("open_alert hs_success");
					$("#popup_message").text('Data Updated successfully.');
				}
			}
		});   
	} 
	remove_hs_message();
	});
});
//************** Update Map Location end*******************//

//************** read more comment content popup start*******//
function read_more_comment(comment_content=''){
	if(comment_content !== ''){
		$("#rm_content").val(comment_content);
		$("#readmore_comment").modal('show');
	}
}
//************** read more comment content popup end*******//

//************** update t&c and privacy policy page********//
$(document).ready(function(){ 
	$("#term_condition_form").submit(function(){
	var baseurl =$("#baseurl").val();

	var  terms_condition = CKEDITOR.instances.term_condition.getData();
	var error=0;
	for (instance in CKEDITOR.instances) 
	{
	CKEDITOR.instances[instance].updateElement();
	} 
	event.preventDefault();
	jQuery.ajax({
	type: "POST",
	url: baseurl + "setting/update_term_condition",
	data: new FormData(this),
	contentType: false,       
	cache: false,             
	processData:false,
	success: function(resp){
			if(resp == 1){
				$(".hs_message").addClass("open_alert hs_success");
				$("#popup_message").text('Data Updated successfully.');
			}else if(resp == 0){
				$(".hs_message").addClass("open_alert hs_error");
				$("#popup_message").text('Data Not Updated !'); 	
			}
		}
	});
	 
	remove_hs_message();

	});
	
});

$(document).ready(function(){ 
	$("#privacy_policy_form").submit(function(){
	var baseurl =$("#baseurl").val();

	var  pp_content = CKEDITOR.instances.pp_content.getData();
	var error=0;
	for (instance in CKEDITOR.instances) 
	{
	CKEDITOR.instances[instance].updateElement();
	} 
	event.preventDefault();
	jQuery.ajax({
	type: "POST",
	url: baseurl + "setting/update_privacy_policy",
	data: new FormData(this),
	contentType: false,       
	cache: false,             
	processData:false,
	success: function(resp){
			if(resp == 1){
				$(".hs_message").addClass("open_alert hs_success");
				$("#popup_message").text('Data Updated successfully.');
			}else if(resp == 0){
				$(".hs_message").addClass("open_alert hs_error");
				$("#popup_message").text('Data Not Updated !'); 	
			}
		}
	});
	remove_hs_message();

	});
});
//************** update t&c and privacy policy page********//

//************** update GDPR cookie setting start ***************//
$(document).ready(function(){ 
	$("#gdpr_cookie_form").submit(function(){
	var baseurl = $("#baseurl").val();
	var gdpr_title = $.trim($("#gdpr_title").val());
	var gdpr_msg = $.trim($("#gdpr_msg").val());
	var gdpr_link_title = $.trim($("#gdprlink_title").val());
	var gdpr_link = $.trim($("#gdpr_link").val());
	var gdprbtn_title = $.trim($("#gdprbutton_title").val());
	var gdpr_image = $.trim($("#gdpr_image").val());
	var error =0;

	event.preventDefault();
		
	if(gdpr_title == ''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
		error++;
	}else if(gdpr_msg == ''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
		error++;
	}else if(gdpr_msg !== ''){
	if(gdpr_msg.length >60){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Message Should Be 60 characters only');
		error++;
	}
	}else if(gdpr_link_title == ''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
		error++;
	}else if(gdpr_link == ''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
		error++;
	}else if(gdprbtn_title == ''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
		error++;
	}else if(gdpr_image !== ''){
	var extension = gdpr_image.split('.').pop();
		if (extension  == "gif" || extension == "png" || extension == "jpeg" || extension == "jpg") {
			error = 0;
		}else
		{
			$(".hs_message").addClass("open_alert hs_error");
			$("#popup_message").text('Photo only allows file types of GIF, PNG, JPG, JPEG');
			error++;
		}
	} 

	if(error == 0){

	event.preventDefault();
	  
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/gdpr_cookie_update",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp){
				 if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('Data Not Updated !'); 
				}else if(resp == 1){
					$(".hs_message").addClass("open_alert hs_success");
					$("#popup_message").text('Data Updated successfully.');
				} 
			}
		});   
	}  
	remove_hs_message();
	});
});
//************** update GDPR cookie setting end ***************//

//************** update paypal setting start ***************//
$(document).ready(function(){ 
	$("#payapl_form").submit(function(){
	var baseurl = $("#baseurl").val();
	var paypal_email = $.trim($("#paypal_email").val());
	event.preventDefault();
	if(paypal_email ==''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
		
	}else{
		
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/paypal_setting_update",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp){
				 if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('Data Not Updated !'); 
				}else if(resp == 1){
					$(".hs_message").addClass("open_alert hs_success");
					$("#popup_message").text('Data Updated successfully.');
				} 
			}
		});
	}
	remove_hs_message();
	
	});

});

//************** update payumoney setting start ***************//
$(document).ready(function(){ 
	$("#payumoney_form").submit(function(){
	var baseurl = $("#baseurl").val();
	var payumoney_key = $.trim($("#payumoney_key").val());
	var payumoney_salt = $.trim($("#payumoney_salt").val());
	event.preventDefault();
	if(payumoney_key ==''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
		
	}else if(payumoney_salt ==''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
		
	}else{
		
		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/payumoney_setting_update",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp){
				 if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('Data Not Updated !'); 
				}else if(resp == 1){
					$(".hs_message").addClass("open_alert hs_success");
					$("#popup_message").text('Data Updated successfully.');
				} 
			}
		});
	}
	remove_hs_message();
	});
});

//************** update currency setting start ***************//
$(document).ready(function(){ 
	$("#currency_form").submit(function(){
	var baseurl = $("#baseurl").val();
	var currency_api = $.trim($("#currency_convert_api").val());
	var currency_code = $.trim($("#currency_code").val());
	var currency_symbol = $.trim($("#currency_symbol").val());
	event.preventDefault();
	if(currency_api ==''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
		
	}else if(currency_code ==''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
		
	}else if(currency_symbol ==''){
		$(".hs_message").addClass("open_alert hs_error");
		$("#popup_message").text('Empty Filed Not allowed');
		
	}else{

		jQuery.ajax({
		type: "POST",
		url: baseurl + "setting/currency_setting_update",
		data: new FormData(this),
		contentType: false,       
		cache: false,             
		processData:false,
		success: function(resp){
				 if(resp == 0){
					$(".hs_message").addClass("open_alert hs_error");
					$("#popup_message").text('Data Not Updated !'); 
				}else if(resp == 1){
					$(".hs_message").addClass("open_alert hs_success");
					$("#popup_message").text('Data Updated successfully.');
				} 
			}
		});
	}
	remove_hs_message();
	});
});

//********Update product review status start*******//
function update_review_status(review_id){
	
	var baseurl =$("#baseurl").val();
	var isChecked = $("#reviewstatus_"+review_id).is(":checked");
	if (isChecked == true) {
		
		var val = 1;
	 
	} else {
		var val = 0;
	   
	}
	 
	if(val !== '' && review_id !== ''){      
		jQuery.ajax({
		type: "POST",
		url: baseurl + "admin/update_review_status",
		data: {review_value: val, review_id: review_id},
		success: function(resp) {
			 
					if(resp == 0){
						$(".hs_message").addClass("open_alert hs_error");
						$("#popup_message").text('data not update.');
					}else if(resp == 1){
					   $(".hs_message").addClass("open_alert hs_success");
					   $("#popup_message").text('data update successfully.');
					}  
				}
		});  
	}
	remove_hs_message();
}
//********Update product review status start*******//

