<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vertical Navbar - Mazer Admin Dashboard</title>

    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="assets/css/bootstrap.css">
	
	<link rel="stylesheet" href="assets/vendors/toastify/toastify.css">
	<link href="https://unpkg.com/filepond/dist/filepond.css" rel="stylesheet">
<link rel="stylesheet" href="assets/vendors/toastify/toastify.css">

    <link rel="stylesheet" href="assets/vendors/perfect-scrollbar/perfect-scrollbar.css">
    <link rel="stylesheet" href="assets/vendors/bootstrap-icons/bootstrap-icons.css">
    <link rel="stylesheet" href="assets/css/app.css">
    <link rel="shortcut icon" href="assets/images/favicon.svg" type="image/x-icon">
</head>

<!--summernote library------>
<link rel="stylesheet" href="assets/vendors/summernote/summernote-lite.min.css">
<script src="assets/vendors/jquery/jquery.min.js"></script>
 
 <script type="text/javascript">
 function getVal(chk, adto){
	var n = '';
  if (chk.checked) document.getElementById(adto).value = chk.value;
  if (chk.unchecked) document.getElementById(adto).value = n;
}
 function getVal(chkop, adto){
	var n = '';
  if (chkop.checked) document.getElementById(adto).value = chkop.value;
  if (chkop.unchecked) document.getElementById(adto).value = n;
}
</script>



<?php
include_once("hooks/_config_.php");
$conf = new config();
?>

<!--summer note library--->

<body>

        
		<?php include_once("assets/resources/side-includer.php"); ?>
		<?php include_once("assets/resources/top_navigator.php"); ?>


			<!-- body content -->
            <div id="main-content">

                <div class="page-heading">
                    <div class="page-title">
                        <div class="row">
                            <div class="col-12 col-md-6 order-md-1 order-last">
                                <h3> Coupon Page</h3>
                                <p class="text-subtitle text-muted">Navbar will appear in top of the page.</p>
                            </div>
                            <div class="col-12 col-md-6 order-md-2 order-first">
                                <nav aria-label="breadcrumb" class="breadcrumb-header float-start float-lg-end">
                                    <ol class="breadcrumb">
                                        <li class="breadcrumb-item"><a href="index.html">Dashboard</a></li>
                                        <li class="breadcrumb-item active" aria-current="page">Layout Vertical Navbar
                                        </li>
                                    </ol>
                                </nav>
                            </div>
                        </div>
                    </div>
								
					<section id="basic-horizontal-layouts">
                    <div class="row match-height">
                        <div class="col-md-12 col-12">
                            <div class="card">
                                <div class="card-header">
							
						    		   <?php
								if(isset($_GET['cpnuk']) && isset($_GET['cpfk'])) {
								$cpn_hmunk = $view->decrypt($_GET['cpnuk']);
								$cpn_hmfrnk = $view->decrypt($_GET['cpfk']);
								//echo $cpn_hmunk;
								?>
								
						  <h4 class="card-title">Edit/Update Coupon</h4>
								
				<?php
				if(isset($_POST['update_coupon']) && $_POST['update_coupon'] == "Update Coupon"){
				?>
				    <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" class="form form-horizontal">
                                            <div class="form-body">
                                                <div class="row">
                                                    <div class="col-md-4">
                                                        <label>Coupon Name</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="text"  class="form-control" name="Coupon_name" value="<?php echo $_POST['Coupon_name']; ?>"
                                                            placeholder="Coupon Name"/>
														<?php
												$cpnr_anme =  $isValid->iValid($_POST['Coupon_name'], 'Error. Invalide Text or Blank Field', 'str');
											?>
														  
                                                    </div>
													
													 <div class="col-md-4">
                                                        <label>Description</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="text"  class="form-control" name="copn_descp" value="<?php echo $_POST['copn_descp']; ?>"
                                                            placeholder="Description"/>
														<?php
														$cpnr_dsptn =  $isValid->iValid($_POST['copn_descp'], 'Error. Invalide Text or Blank', 'str');
													?>
                                                    </div>
													
											
													<div class="col-md-4">
                                                        <label>Coupon Code</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="text" name="Coupon_codes" class="" id="codes_option" style="width:100%" value="<?php echo $_POST['Coupon_codes']; ?>"/>
<div id="actv_cpn" class="mt-2">

<input type="checkbox" value="ACTIVATE COUPON" id="chk2" class="form-check-input" onClick="getVal(this, 'codes_option')">Activate Coupon

<input type="checkbox" name="chkop" class="form-check-input" id="chk2" <?php if(isset($_POST['chkop']) && $_POST['chkop'] == "on"){ ?> checked="checked" <?php } ?>/>Exclusive
</div>
<?php
	$cpnr_svcode =  $isValid->iValid($_POST['Coupon_codes'], 'Error. Invalide Text or Blank', 'str');
?>
<?php
if(isset($_POST['chkop']) && $_POST['chkop'] == "on"){
 $exclu_cpn = 1;
}else{
 $exclu_cpn = 0;
}
?>
														
                                                    </div>
													
													<div class="col-md-4">
                                                        <label>Destination Url</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="text"  class="form-control"  name="cp_dstinu_rl" value="<?php echo $_POST['cp_dstinu_rl']; ?>"
                                                          placeholder="Destination Url">
														<?php
												$cpnr_dsturls =  $isValid->iValid($_POST['cp_dstinu_rl'], 'Error. wrong URL Pattern or add http://', 'url');
											?>
											 
                                                    </div>
													
													<div class="col-md-4">
                                                        <label>Ending Date</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="date"  name="finish_date" value="<?php if($_POST['finish_date'] != ''){ echo $_POST['finish_date']; }else{ $_POST['finish_date'] = "NEVER EXPIRE"; echo $_POST['finish_date']; } ?>" id="finish_date" class="form-control" >
														 
													<?php
	$cpnr_nddte =  $isValid->iValid($_POST['finish_date'], 'Error. Invalid Pattern', 'str');
?>


                                                    </div>
													
													<div class="col-md-4 mt-3">
                                                        <label>Choose Category</label>
                                                    </div>
                                                    <div class="col-md-8 mt-3 form-group">
												
													<div id="txtHint">
													<?php echo $view->subcatelist(); ?>
													</div>
													
													<div id="valtxtHint">
													
													<?php
													
													if(isset($_POST['subctag']) && $_POST['subctag'] != '') {
														echo $view->subcatelistValidated($_POST['subctag']);
													
														$sub_arrayx = $_POST['subctag'];
														
														$view->deleteOldCate($sub_arrayx);
													 echo "<div id='success_alert'>".count($_POST['subctag'])." Sub Categories Selected</div>";
													}else{
													$sub_arrayx = '';
													$null_cat =  $_POST['cat_detalsky'];
													echo "<div id='err_alert'>Error: 0 Selected</div>";
													}
													?>
													</div>
                                              
                                                      
                                                    </div><!--8 end--->
													
													
													<div class="col-md-4 mt-3">
                                                        <label>Choose Store</label>
                                                    </div>
                                                    <div class="col-md-8 form-group mt-3">
								                     
<?php
if(isset($_POST['cpon_Stor']) && $_POST['cpon_Stor'] != ''){
list($st_name_call, $stor_key_frn) = explode("::", $_POST['cpon_Stor']);
$needle = array("_str_mgzs");
$tb = "copn_storbnk";
$heystack = array("_frgn_ky" => $stor_key_frn); 
$qui = $query->queryBuilder($needle, $tb, $heystack);
$sto_log_oname = mysqli_fetch_row($qui);
?>
<select name="cpon_Stor" class="form-control p-2" style="width: 100% ">
<option value="<?php echo $st_name_call."::".$stor_key_frn; ?>"><?php echo $st_name_call; ?></option>
</select>
<?php
$stor_cupon = $st_name_call;
$cpn_uplo = $sto_log_oname[0];

echo "<div id='success_alert'>Ok</div>";
}else{

?>
<select name="cpon_Stor" class="form-control p-2" style="width: 100% ">
<option value="">-- Select --</option>
<?php
$needle = array("_stor_nam", "_frgn_ky");
$tb = "copn_storbnk";
$heystack = ''; 
$qu = $query->queryBuilder($needle, $tb, $heystack);
while($store = mysqli_fetch_array($qu, MYSQLI_NUM)) {
?>

<option value="<?php echo $store[0]."::".$store[1]; ?>"><?php echo $store[0]; ?></option>
<?php
} // end whl
?>
</select>
<?php
}
?>
                                                    </div>
													
													<div class="col-md-4 mt-3">
                                                        <label>Saving Type</label>
                                                    </div>
                                                    <div class="col-md-8 form-group mt-3">
								                      
													  
													  <?php
if(isset($_POST['cpon_savng_type']) && $_POST['cpon_savng_type']!= ''){  
   
?>
<select name="cpon_savng_type" class="form-control p-2" style="width: 100% ">
<option value="<?php echo $_POST['cpon_savng_type']; ?>"><?php echo $_POST['cpon_savng_type']; ?></option>
</select>
<?php 
$cpsvng_typex = trim($_POST['cpon_savng_type']);
echo "<div id='success_alert'>Ok</div>";

}else{ 

$savng_type = array("5%", "10%", "15%", "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%", "80%", "85%", "90%", "95%", 
"$5", "$10", "$15", "$20", "$25", "$30", "$35", "$40", "$45", "$50", "$55", "$60", "$65",  "$65", "$70", "$75", "$80", "$85", "$90", "$95", "$100", "$150", "$200", "$250", "$300", "Free Shipping", "Flat Rate-Shipping", "Sign up", "Buy one-Get 1 Free", "Buy one-Get 50%", "Special Offer", "Free Sample", "Free Gift", "£5", "£10", "£15", "£20", "£25", "£30", "£35", "£40", "£45", "£50", "£55", "£60", "£65", "£70", "£75", "£80", "£85", "£90", "£95", "£100", "£200", "£300", "£400");    
?>
<select name="cpon_savng_type" class="form-control p-2" style="width: 100% ">
<option value="">-- Select --</option>
<?php 
foreach($savng_type as $savingstype){
?>
<option value="<?php echo $savingstype; ?>"><?php echo $savingstype;  ?></option>
<?php
} // end loop
?>
</select>
<?php 
$cpsvng_typex = 0;
echo "<div id='err_alert'>0 Selected, Select Any Value</div>";
} // end if 
?>

                                                    </div>
													
													<div class="col-md-4 mt-3">
                                                        <label>Placement</label>
                                                    </div>
                                                    <div class="col-md-8 mt-3 form-group">
												
													
													  		<div class=' m-2 form-check d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
															class='form-check-input' name="coupon_featurd" <?php if(isset($_POST['coupon_featurd']) && $_POST['coupon_featurd'] == "on"){ ?> checked="checked" <?php } ?>/>
												<?php
											if(isset($_POST['coupon_featurd']) && $_POST['coupon_featurd'] == "on"){
											 $fstr_cpn_status = 1;
											}else{
											 $fstr_cpn_status = 0;
											}
											?>						
			
                                                                <label for="checkbox1">Featured</label>
                                                            </div>
                                                        </div><!--sec checkbox--->
														
                                                        <div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" id="checkbox1"
                                                                    class='form-check-input' name="top_deal" <?php if(isset($_POST['top_deal']) && $_POST['top_deal'] == "on"){ ?> checked="checked" <?php } ?> />
									                     <?php
															if(isset($_POST['top_deal']) && $_POST['top_deal'] == "on"){
															 $tpcpn_status = 1;
															}else{
															 $tpcpn_status = 0;
															}
															?>							

                                                                <label for="checkbox1">Recommended Deals</label>
                                                            </div>
                                                        </div><!--first checkbox--->
														
														 <div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
                                                                    class='form-check-input' name="free_shiping" <?php if(isset($_POST['free_shiping']) && $_POST['free_shiping'] == "on"){ ?> checked="checked" <?php } ?>/>
																	<?php
															if(isset($_POST['free_shiping']) && $_POST['free_shiping'] == "on"){
															 $freshp_status = 1;
															}else{
															 $freshp_status = 0;
															}
															?>
																	
                                                                <label for="checkbox1">Free Shipping</label>
                                                            </div>
                                                        </div><!--sec checkbox--->
			
														
														<div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" class='form-check-input' name="coupon_cod" <?php if(isset($_POST['coupon_cod']) && $_POST['coupon_cod'] == "on"){ ?> checked="checked" <?php } ?>/ >
																<?php
															if(isset($_POST['coupon_cod']) && $_POST['coupon_cod'] == "on"){
															 $ccod_status = 1;
															}else{
															 $ccod_status = 0;
															}
															?>
                                                                <label for="checkbox1">Coupon Code</label>
                                                            </div>
                                                        </div><!--sec checkbox--->
															
														<div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
                                                                    class='form-check-input' name="coupon_deals" <?php if(isset($_POST['coupon_deals']) && $_POST['coupon_deals'] == "on"){ ?> checked="checked" <?php } ?> >
																	<?php
															if(isset($_POST['coupon_deals']) && $_POST['coupon_deals'] == "on"){
															 $cdel_status = 1;
															}else{
															 $cdel_status = 0;
															}
															
															?>
                                                                <label for="checkbox1">Deal</label>
                                                            </div>
                                                        </div><!--sec checkbox--->	
														
														<div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
                                                                    class='form-check-input' name="cristmas_deals" <?php if(isset($_POST['cristmas_deals']) && $_POST['cristmas_deals'] == "on"){ ?> checked="checked" <?php } ?>/ >
																	<?php
															if(isset($_POST['cristmas_deals']) && $_POST['cristmas_deals'] == "on"){
															 $crsmas_status = 1;
															}else{
															 $crsmas_status = 0;
															}
															
															?>
                                                                <label for="checkbox1">Valentine</label>
                                                            </div>
                                                        </div><!--sec checkbox--->	
                                              
                                                      
                                                    </div><!--8 end--->
													
	
												    <div class="col-sm-12 mt-3 d-flex justify-content-end">
                                                         <input type="submit" name="update_coupon" class="col-4 p-2 bg-primary text-white" style="border:1px solid #fff; border-radius: 15px;" value="Update Coupon" />
													    <!--<button type="submit"
                                                            class="btn btn-primary me-1 mb-1" name="update_coupon" >Update Coupon</button>--->
                                                      
                                                    </div>
                                                </div>
                                            </div>
                                        </form>
										
					
<?php


if(isset($fstr_cpn_status) && isset($tpcpn_status) 
	&& isset($freshp_status) && isset($ccod_status)
	&& isset($cdel_status) && isset($crsmas_status)
	&& isset($cpnr_anme) && $cpnr_anme != ''
	&& isset($cpnr_dsptn) && $cpnr_dsptn != ''
	//&& isset($cpn_uplo) && $cpn_uplo != ''
	&& isset($cpnr_svcode) && $cpnr_svcode != ''
	//&& isset($cpnr_tlsvng) && $cpnr_tlsvng != ''
	&& isset($cpnr_dsturls) && $cpnr_dsturls != ''
	//&& isset($cpnr_sttdt) && $cpnr_sttdt != ''
	&& isset($exclu_cpn)
	&& isset($cpnr_nddte) && $cpnr_nddte != ''
	//&& isset($cupno_ctgry) && $cupno_ctgry != ''
	&& isset($stor_cupon) && $stor_cupon != ''
	&& isset($cpn_hmunk) && $cpn_hmunk != ''
	&& isset($cpn_hmfrnk) && $cpn_hmfrnk != ''
	//&& isset($cpsvng_typex) && $cpsvng_typex != ''
	) {
	
	if($sub_arrayx != '') {
	
		foreach($sub_arrayx as $subeach)
		{
		list($categoryname, $mastcategoryid) = explode(':#:', $subeach);
	// cate inputer
	$subc_tb = "to_tlct_listdt";
	$subc_content = array("cate_nam" => $categoryname, "_top_ctg" => 1, "sort_ord" => 0, "cpn_unkkid" => md5($cpnr_anme.$stor_cupon), "_unk_ky" => $key->uid(), "_frgn_ky" => $mastcategoryid, "_ent_sndr" => $_SESSION['logner_bot']);
	
	$query->queryhandler($subc_tb, $subc_content);
		} 
	}else{
			$view->deleteOldCate($null_cat);
	}// end if

	$cp_tb = "copn_cpnbnks";
	$cp_content = array("_cpon_nam" => $cpnr_anme, "_tody_dls" => $tpcpn_status, "_featr_cpon" => $fstr_cpn_status, "_freshp_cpon" => $freshp_status,
	"_cpon_codchk" => $ccod_status, "_deal_cpon" => $cdel_status, "_cpon_dtls" => $cpnr_dsptn, "_cpon_igmz" => $cpn_uplo, "_cpon_cdo" => $cpnr_svcode,
	 "_cpon_discnt" => $crsmas_status, "_cpn_dstnurl" => $cpnr_dsturls, "_copn_stdat" => 0, "_copn_endat" => $cpnr_nddte, "_cpon_ntwok" => $exclu_cpn,
	  "_cpon_categ" => md5($cpnr_anme.$stor_cupon), "_cpon_stor" => $stor_cupon, "_ent_sndr" => $_SESSION['logner_bot'], "cpn_svtyp" => $cpsvng_typex); 
	 //set needle and heystack
	 $cp_needle = array("_cpon_nam");
	 $update_cp_heystk = array("_unk_ky" => $cpn_hmunk, "_frgn_ky" => $cpn_hmfrnk);
	 
	//if(mysql_num_rows($query->queryBuilder($cp_needle, $cp_tb, $cp_heystk)) == 0 ) {
		 if($query->queryUpdater($cp_tb, $cp_content, $update_cp_heystk)) { 
		 
		echo "<div class='alert alert-success alert-dismissible show fade'>
          Coupon ( ".strtoupper($cpnr_anme)." ) Has Updated Successfully
           <button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button></div>";  
		// echo "<div id='cpon_succ_alert'>Coupon ( ".strtoupper($cpnr_anme)." ) Has Updated Successfully</div>";
		 $err->logHandler(" Alert: Update Record By: '".$_SESSION['logner_bot']."' IP: '".$_SERVER['REMOTE_ADDR']."' on ".date("d-m-Y")." ".date("H:i:s",time())." {Page: Edit Coupons}  ) <--> ( ", "cerr.php"); 
		 }else{ 
		 echo "<div id='cpon_dup_alert'>Q-Error </div>"; 
		 }
	//}else{
			
			//$dup =  "<div id='cpon_dup_alert'>Error: Duplicate Entry</div>";
			//echo $dup;

			//} // dup if
	
	
}// end inner if stat

}else{

$needle = array("_cpon_nam", "_tody_dls", "_featr_cpon", "_freshp_cpon", "_cpon_codchk", "_deal_cpon", "_cpon_dtls", "_cpon_igmz", "_cpon_cdo", "_cpon_discnt", "_cpn_dstnurl", "_copn_stdat", "_copn_endat", "_cpon_ntwok",  "_cpon_categ", "_cpon_stor", "cpn_svtyp");
$tb = "copn_cpnbnks";
$heystack = array("_unk_ky" => $cpn_hmunk, "_frgn_ky" => $cpn_hmfrnk); 
$editquery = $query->queryBuilder($needle, $tb, $heystack);
while($copeditor = mysqli_fetch_array($editquery, MYSQLI_NUM)){
?>

<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" class="form form-horizontal">
                                            <div class="form-body">
                                                <div class="row">
                                                    <div class="col-md-4">
                                                        <label>Coupon Name</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="text"  class="form-control"  name="Coupon_name" value="<?php echo $copeditor[0]; ?>"
                                                            placeholder="Coupon Name"/>
															
                                                    </div>
													
													 <div class="col-md-4">
                                                        <label>Description</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="text"  class="form-control" name="copn_descp" value="<?php echo $copeditor[6]; ?>"
                                                            placeholder="Description"/>
														
                                                    </div>
													
											
													<div class="col-md-4">
                                                        <label>Coupon Code</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                     <input type="text" name="Coupon_codes" class="p-1" id="codes_option" style="width:100%;" value="<?php echo $copeditor[8]; ?>"/>
												<div id="actv_cpn" class="mt-2">
												
												<input type="checkbox" value="ACTIVATE COUPON" class="form-check-input" id="chk2" onClick="getVal(this, 'codes_option')">Activate Coupon
												
												<input type="checkbox" name="chkop" class="form-check-input" id="chk2" <?php if(isset($copeditor[15]) && $copeditor[15] == 1){ ?> checked="checked" <?php } ?>/>Exclusive
												</div>
														
                                                    </div>
													
													<div class="col-md-4">
                                                        <label>Destination Url</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="text"  class="form-control"  name="cp_dstinu_rl" value="<?php echo $copeditor[10]; ?>"
                                                          placeholder="Destination Url">
												
                                                    </div>
													
													<div class="col-md-4">
                                                        <label>Ending Date</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="date"  name="finish_date" value="<?php echo $copeditor[12]; ?>"  id="finish_date" class="form-control" >
														
                                                    </div>
													
													<div class="col-md-4 mt-3">
                                                        <label>Choose Category</label>
                                                    </div>
                                                    <div class="col-md-8 mt-3 form-group">
												
													<div id="txtHint">
											<?php 
												//echo $view->subcatelist(); 
												echo $view->editablecatelist($copeditor[14]);
											?>
											</div>
											<input type="hidden" name="cat_detalsky" value="<?php echo $copeditor[14];?>" />
											<div id="valtxtHint">
											<?php
												//echo $view->subcatelistValidated($copeditor[14]);
											?>
											</div>
                                              
                                                      
                                                    </div><!--8 end--->
													
													
													<div class="col-md-4 mt-3">
                                                        <label>Choose Store</label>
                                                    </div>
                                                    <div class="col-md-8 form-group mt-3">
								<select name="cpon_Stor" class="form-control p-2" style="width: 100%; ">
<option value="">-- Select --</option>
<?php
$needle = array("_stor_nam", "_frgn_ky");
$tb = "copn_storbnk";
$heystack = ''; 
$qu = $query->queryBuilder($needle, $tb, $heystack);
while($store = mysqli_fetch_array($qu, MYSQLI_NUM)) {
?>

<option value="<?php echo $store[0]."::".$store[1]; ?>"  <?php if($store[0] == $copeditor[15]) { ?> selected="selected" <?php }?>><?php echo $store[0]; ?></option>
<?php
} // end whl
?>
</select>
<div id='listview'>
<font color="#FF6600">Already Assigned Store:</font>
<ul>
<?php
echo $copeditor[15];
?>
</ul>
</div>
                                                    </div>
													
													<div class="col-md-4 mt-3">
                                                        <label>Saving Type</label>
                                                    </div>
                                                    <div class="col-md-8 form-group mt-3">
								                      
													  <?php
$savng_type = array("5%", "10%", "15%", "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%", "80%", "85%", "90%", "95%", 
"$5", "$10", "$15", "$20", "$25", "$30", "$35", "$40", "$45", "$50", "$55", "$60", "$65",  "$65", "$70", "$75", "$80", "$85", "$90", "$95", "$100", "$150", "$200", "$250", "$300", "Free Shipping", "Flat Rate-Shipping", "Sign up", "Buy one-Get 1 Free", "Buy one-Get 50%", "Special Offer", "Free Sample", "Free Gift", "£5", "£10", "£15", "£20", "£25", "£30", "£35", "£40", "£45", "£50", "£55", "£60", "£65", "£70", "£75", "£80", "£85", "£90", "£95", "£100", "£200", "£300", "£400");
?>
<select name="cpon_savng_type" class="form-control p-2" style="width: 100% ;">
<option value="">Choose Saving Type</option>
<?php 
foreach($savng_type as $savingstype){
?>
<option value="<?php echo $savingstype; ?>" <?php if($savingstype == $copeditor[16]) { ?> selected="selected" <?php }?> ><?php echo $savingstype; ?></option>
<?php
} // end loop
?>
</select>

<div id='listview'>
<font color="#FF6600">Already Assigned Offer Type:</font>
<ul>
<?php
echo $copeditor[16];
?>
</ul>
</div>  
														
														
                                                    </div>
													
													<div class="col-md-4 mt-3">
                                                        <label>Placement</label>
                                                    </div>
                                                    <div class="col-md-8 mt-3 form-group">
												
													
													  		<div class=' m-2 form-check d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
															class='form-check-input' name="coupon_featurd" <?php if(isset($copeditor[2]) && $copeditor[2] == 1){ ?> checked="checked" <?php } ?>/>
													  <label for="checkbox1">Featured</label>
                                                            </div>
                                                        </div><!--sec checkbox--->
														
                                                        <div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" id="checkbox1"
                                                                    class='form-check-input' name="top_deal" <?php if(isset($copeditor[1]) && $copeditor[1] == 1){ ?> checked="checked" <?php } ?>  />
                                                                <label for="checkbox1">Recommended Deals</label>
                                                            </div>
                                                        </div><!--first checkbox--->
														
														 <div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
                                                                    class='form-check-input' name="free_shiping" <?php if(isset($copeditor[3]) && $copeditor[3] == 1){ ?> checked="checked" <?php } ?>/>
																
                                                                <label for="checkbox1">Free Shipping</label>
                                                            </div>
                                                        </div><!--sec checkbox--->
			
														
														<div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" class='form-check-input' name="coupon_cod" <?php if(isset($copeditor[4]) && $copeditor[4] == 1){ ?> checked="checked" <?php } ?>/ >
																
                                                                <label for="checkbox1">Coupon Code</label>
                                                            </div>
                                                        </div><!--sec checkbox--->
															
														<div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
                                                                    class='form-check-input' name="coupon_deals" <?php if(isset($copeditor[5]) && $copeditor[5] == 1){ ?> checked="checked" <?php } ?>/ >
																	
                                                                <label for="checkbox1">Deal</label>
                                                            </div>
                                                        </div><!--sec checkbox--->	
														
														<div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
                                                                    class='form-check-input' name="cristmas_deals" <?php if(isset($copeditor[9]) && $copeditor[9] == 1){ ?> checked="checked" <?php } ?>/ >
																	
                                                                <label for="checkbox1">Valentine</label>
                                                            </div>
                                                        </div><!--sec checkbox--->	
                                              
                                                      
                                                    </div><!--8 end--->
													
	
												    <div class="col-sm-12 mt-3 d-flex justify-content-end">
                                                        <input type="submit" name="update_coupon" class="col-4 p-2 bg-primary text-white" style="border:1px solid #fff; border-radius: 15px;" value="Update Coupon" /> 
														
														<!--<button type="submit"
                                                            class="btn btn-primary me-1 mb-1" name="update_coupon"  >Update Coupon</button>-->
                                                        
                                                    </div>
                                                </div>
                                            </div>
                                        </form>	
										
							<?php
	} // end while
} // end post if stat
///////////////////////////// end edit section
}else{
?>
						
				
				
								
								   

								    <h4 class="card-title">Add New Coupon</h4>
									<p id="msg"></p>
									<?php
if(isset($_POST['admit_coupon']) && $_POST['admit_coupon'] == "Add New Coupon"){
?>

                                </div>
                                <div class="card-content">
                                    <div class="card-body">
                                        <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" class="form form-horizontal">
                                            <div class="form-body">
                                                <div class="row">
                                                    <div class="col-md-4">
                                                        <label>Coupon Name</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="text"  class="form-control"  name="Coupon_name" value="<?php echo $_POST['Coupon_name']; ?>"
                                                            placeholder="Coupon Name"/>
															<?php
															$cpnr_anme =  $isValid->iValid($_POST['Coupon_name'], 'Error. Invalide Text or Blank Field', 'str');
														?>
														  
                                                    </div>
													
													 <div class="col-md-4">
                                                        <label>Description</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="text"  class="form-control" name="copn_descp" value="<?php echo $_POST['copn_descp']; ?>"
                                                            placeholder="Description"/>
														<?php
														$cpnr_dsptn =  $isValid->iValid($_POST['copn_descp'], 'Error. Invalide Text or Blank', 'str');
													?> 
                                                    </div>
													
											
													<div class="col-md-4">
                                                        <label>Coupon Code</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                       <input type="text" name="Coupon_codes" value="Coupon Code" id="codes_option" style="width:100%;" value="<?php echo $_POST['Coupon_codes']; ?>"/>
<div id="actv_cpn" class="mt-3">

<input type="checkbox" name="chkop" class="form-check-input" value="ACTIVATE COUPON" id="chk2" onClick="getVal(this, 'codes_option')">Activate Coupon

<input type="checkbox" name="chkop" class="form-check-input" id="chk2" <?php if(isset($_POST['chkop']) && $_POST['chkop'] == "on"){ ?> checked="checked" <?php } ?>/>Exclusive
</div>
<?php
	$cpnr_svcode =  $isValid->iValid($_POST['Coupon_codes'], 'Error. Invalide Text or Blank', 'str');
?>
<?php
if(isset($_POST['chkop']) && $_POST['chkop'] == "on"){
 $exclu_cpn = 1;
}else{
 $exclu_cpn = 0;
}

?>

														
                                                    </div>
													
													<div class="col-md-4">
                                                        <label>Destination Url</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="text"  class="form-control"  name="cp_dstinu_rl" value="<?php echo $_POST['cp_dstinu_rl']; ?>"
                                                          placeholder="Destination Url">
														 <?php
													$cpnr_dsturls =  $isValid->iValid($_POST['cp_dstinu_rl'], 'Error. wrong URL Pattern or add http://', 'url');
												?>
 
                                                    </div>
													
													<div class="col-md-4">
                                                        <label>Ending Date</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="date"  name="finish_date" value="<?php if($_POST['finish_date'] != ''){ echo $_POST['finish_date']; }else{ $_POST['finish_date'] = "NEVER EXPIRE"; echo $_POST['finish_date']; } ?>" id="finish_date" class="form-control" >
														 
														 <?php
										$cpnr_nddte =  $isValid->iValid($_POST['finish_date'], 'Error. Invalid Pattern', 'str');
									?>
									 
                                                    </div>
													
													<div class="col-md-4 mt-3">
                                                        <label>Choose Category</label>
                                                    </div>
                                                    <div class="col-md-8 mt-3 form-group">
												
                                                    <div id="txtHint">
														<?php echo $view->subcatelist(); ?>
														</div>
														
														<div id="valtxtHint">
														<?php
														if(isset($_POST['subctag']) && $_POST['subctag'] != '') {
															echo $view->subcatelistValidated($_POST['subctag']);
														
														$sub_arrayx = $_POST['subctag'];
														 echo "<div id='success_alert'>".count($_POST['subctag'])." Categories Selected</div>";
														}else{
														echo "<div id='err_alert'>Error: 0 Selected</div>";
														}
														?>
														</div>
                                                      
                                                    </div><!--8 end--->
													
													
													<div class="col-md-4 mt-3">
                                                        <label>Choose Store</label>
                                                    </div>
                                                    <div class="col-md-8 form-group mt-3">
								                  <?php
if(isset($_POST['cpon_Stor']) && $_POST['cpon_Stor'] != ''){
list($st_name_call, $stor_key_frn) = explode("::", $_POST['cpon_Stor']);
$needle = array("_str_mgzs");
$tb = "copn_storbnk";
$heystack = array("_frgn_ky" => $stor_key_frn); 
$qui = $query->queryBuilder($needle, $tb, $heystack);
$sto_log_oname = mysqli_fetch_row($qui);
?>
<select name="cpon_Stor" class="form-group col-sm-12 p-2" style="width: 100%;">
<option value="<?php echo $st_name_call."::".$stor_key_frn; ?>"><?php echo $st_name_call; ?></option>
</select>
<?php
$stor_cupon = $st_name_call;
$cpn_uplo = $sto_log_oname[0];

echo "<div id='success_alert'>Ok</div>";
}else{

?>
<select name="cpon_Stor">
<option value="">-- Select --</option>
<?php
$needle = array("_stor_nam", "_frgn_ky");
$tb = "copn_storbnk";
$heystack = ''; 
$qu = $query->queryBuilder($needle, $tb, $heystack);
while($store = mysqli_fetch_array($qu, MYSQLI_NUM)) {
?>

<option value="<?php echo $store[0]."::".$store[1]; ?>"><?php echo $store[0]; ?></option>
<?php
} // end whl
?>
</select>
<?php
}
?>
                                                    </div>
													
													<div class="col-md-4 mt-3">
                                                        <label>Saving Type</label>
                                                    </div>
                                                    <div class="col-md-8 form-group mt-3">
								                    <?php
if(isset($_POST['cpon_savng_type']) && $_POST['cpon_savng_type']!= ''){  
   
?>
<select name="cpon_savng_type" class="form-group col-12 p-2">
<option value="<?php echo $_POST['cpon_savng_type']; ?>"><?php echo $_POST['cpon_savng_type']; ?></option>
</select>
<?php 
$cpsvng_typex = trim($_POST['cpon_savng_type']);
echo "<div id='success_alert'>Ok</div>";

}else{ 

$savng_type = array("5%", "10%", "15%", "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%", "80%", "85%", "90%", "95%", 
"$5", "$10", "$15", "$20", "$25", "$30", "$35", "$40", "$45", "$50", "$55", "$60", "$65",  "$65", "$70", "$75", "$80", "$85", "$90", "$95", "$100", "$150", "$200", "$250", "$300", "Free Shipping", "Flat Rate-Shipping", "Sign up", "Buy one-Get 1 Free", "Buy one-Get 50%", "Special Offer", "Free Sample", "Free Gift", "£5", "£10", "£15", "£20", "£25", "£30", "£35", "£40", "£45", "£50", "£55", "£60", "£65", "£70", "£75", "£80", "£85", "£90", "£95", "£100", "£200", "£300", "£400");
?>
<select name="cpon_savng_type">
<option value="">-- Select --</option>
<?php 
foreach($savng_type as $savingstype){
?>
<option value="<?php echo $savingstype; ?>"><?php echo $savingstype;  ?></option>
<?php
} // end loop
?>
</select>
<?php 
$cpsvng_typex = 0;
echo "<div id='err_alert'>0 Selected, Select If required, Otherwise Leave it Blank/div>";
} // end if 
?>
                                                    </div>
													
													<div class="col-md-4 mt-3">
                                                        <label>Placement</label>
                                                    </div>
                                                    <div class="col-md-8 mt-3 form-group">
												
													
													  		<div class=' m-2 form-check d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
															class='form-check-input' name="coupon_featurd" <?php if(isset($_POST['coupon_featurd']) && $_POST['coupon_featurd'] == "on"){ ?> checked="checked" <?php } ?> />
													<?php
												if(isset($_POST['coupon_featurd']) && $_POST['coupon_featurd'] == "on"){
												 $fstr_cpn_status = 1;
												}else{
												 $fstr_cpn_status = 0;
												}
												?>								
			
                                                                <label for="checkbox1">Featured</label>
                                                            </div>
                                                        </div><!--sec checkbox--->
														
                                                        <div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" id="checkbox1"
                                                                    class='form-check-input' name="top_deal" <?php if(isset($_POST['top_deal']) && $_POST['top_deal'] == "on"){ ?> checked="checked" <?php } ?> />
									                     <?php
															if(isset($_POST['top_deal']) && $_POST['top_deal'] == "on"){
															 $tpcpn_status = 1;
															}else{
															 $tpcpn_status = 0;
															}
															?>							

                                                                <label for="checkbox1">Recommended Deals</label>
                                                            </div>
                                                        </div><!--first checkbox--->
														
														 <div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
                                                                    class='form-check-input' name="free_shiping" <?php if(isset($_POST['free_shiping']) && $_POST['free_shiping'] == "on"){ ?> checked="checked" <?php } ?>/>
																	<?php
															if(isset($_POST['free_shiping']) && $_POST['free_shiping'] == "on"){
															 $freshp_status = 1;
															}else{
															 $freshp_status = 0;
															}
															?>
																	
                                                                <label for="checkbox1">Free Shipping</label>
                                                            </div>
                                                        </div><!--sec checkbox--->
			
														
														<div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" class='form-check-input' name="coupon_cod" <?php if(isset($_POST['coupon_cod']) && $_POST['coupon_cod'] == "on"){ ?> checked="checked" <?php } ?>/ >
																<?php
															if(isset($_POST['coupon_cod']) && $_POST['coupon_cod'] == "on"){
															 $ccod_status = 1;
															}else{
															 $ccod_status = 0;
															}
															?>
                                                                <label for="checkbox1">Coupon Code</label>
                                                            </div>
                                                        </div><!--sec checkbox--->
															
														<div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
                                                                    class='form-check-input' name="coupon_deals" <?php if(isset($_POST['coupon_deals']) && $_POST['coupon_deals'] == "on"){ ?> checked="checked" <?php } ?> >
																	<?php
															if(isset($_POST['coupon_deals']) && $_POST['coupon_deals'] == "on"){
															 $cdel_status = 1;
															}else{
															 $cdel_status = 0;
															}
															
															?>
                                                                <label for="checkbox1">Deal</label>
                                                            </div>
                                                        </div><!--sec checkbox--->	
														
														<div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
                                                                    class='form-check-input' name="cristmas_deals" <?php if(isset($_POST['cristmas_deals']) && $_POST['cristmas_deals'] == "on"){ ?> checked="checked" <?php } ?>/ >
																	<?php
															if(isset($_POST['cristmas_deals']) && $_POST['cristmas_deals'] == "on"){
															 $crsmas_status = 1;
															}else{
															 $crsmas_status = 0;
															}
															
															?>
                                                                <label for="checkbox1">Valentine</label>
                                                            </div>
                                                        </div><!--sec checkbox--->	
                                              
                                                      
                                                    </div><!--8 end--->
													<div id="pholder"></div>
	
												    <div class="col-sm-12 mt-3 d-flex justify-content-end">
                                                       <input type="submit" name="admit_coupon" class="col-4 p-2 bg-primary text-white" style="border:1px solid #fff; border-radius: 15px;" value="Add New Coupon" />
                                                        
                                                    </div>
                                                </div>
                                            </div>
                                        </form>
										
										<?php


if(isset($fstr_cpn_status) && isset($tpcpn_status) 
	&& isset($freshp_status) && isset($ccod_status)
	&& isset($cdel_status) && isset($crsmas_status)
	&& isset($cpnr_anme) && $cpnr_anme != ''
	&& isset($cpnr_dsptn) && $cpnr_dsptn != ''
	//&& isset($cpn_uplo) && $cpn_uplo != ''
	&& isset($cpnr_svcode) && $cpnr_svcode != ''
	//&& isset($cpnr_tlsvng) && $cpnr_tlsvng != ''
	&& isset($cpnr_dsturls) && $cpnr_dsturls != ''
	//&& isset($cpnr_sttdt) && $cpnr_sttdt != ''
	&& isset($exclu_cpn)
	&& isset($cpnr_nddte) && $cpnr_nddte != ''
	//&& isset($cupno_ctgry) && $cupno_ctgry != ''
	&& isset($stor_cupon) && $stor_cupon != ''
	//&& isset($cpsvng_typex) && $cpsvng_typex != ''
	) {
	
foreach($sub_arrayx as $subeach)
	{
	list($categoryname, $mastcategoryid) = explode(':#:', $subeach);
	// cate inputer
	$subc_tb = "to_tlct_listdt";
	$subc_content = array("cate_nam" => $categoryname, "_top_ctg" => 1, "sort_ord" => 0, "cpn_unkkid" => md5($cpnr_anme.$stor_cupon), "_unk_ky" => $key->uid(), "_frgn_ky" => $mastcategoryid, "_ent_sndr" => $_SESSION['logner_bot']);
	$query->queryhandler($subc_tb, $subc_content);
	} 

	$cp_tb = "copn_cpnbnks";
	$cp_content = array("_cpon_nam" => $cpnr_anme, "_tody_dls" => $tpcpn_status, "_featr_cpon" => $fstr_cpn_status, "_freshp_cpon" => $freshp_status,
	"_cpon_codchk" => $ccod_status, "_deal_cpon" => $cdel_status, "_cpon_dtls" => $cpnr_dsptn, "_cpon_igmz" => $cpn_uplo, "_cpon_cdo" => $cpnr_svcode,
	 "_cpon_discnt" => $crsmas_status, "_cpn_dstnurl" => $cpnr_dsturls, "_copn_stdat" => 0, "_copn_endat" => $cpnr_nddte, "_cpon_ntwok" => $exclu_cpn,
	  "_cpon_categ" => md5($cpnr_anme.$stor_cupon), "_cpon_stor" => $stor_cupon, "_unk_ky" => $key->uid(), "_frgn_ky" => $key->fid(), "_ent_sndr" => $_SESSION['logner_bot'], "cpn_svtyp" => $cpsvng_typex); 
	 
	 //set needle and heystack
	  
	 $cp_needle = array("_cpon_nam");
	 $cp_heystk = array("_cpon_nam" => $cpnr_anme, "_cpon_stor" => $stor_cupon);
	 
	if(mysqli_num_rows($query->queryBuilder($cp_needle, $cp_tb, $cp_heystk)) == 0 ) {
		 if($query->queryhandler($cp_tb, $cp_content)) { 
		 
		echo "<div class='alert alert-success alert-dismissible show fade'>
           Coupon Has Been Created Successfully
           <button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button></div>"; 
			     
		 }else{ echo "<div id='cpon_dup_alert'>Q-Error </div>"; }
	}else{
			
			$dup =  "<div id='cpon_dup_alert'>Error: Duplicate Entry</div>";
			echo $dup;
			$err->logHandler(" Error: Duplicate Entry By: '".$_SESSION['logner_bot']."' on ".date("d-m-Y")." ".date("H:i:s",time())." {Page: Add New Coupon}  ) <--> ( ", "cerr.php");
			} // dup if
	
	
}// end inner if stat


}else{
?>

      <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" class="form form-horizontal">
	                                      <p id="msg"></p>
	  
                                            <div class="form-body">
                                                <div class="row">
                                                    <div class="col-md-4">
                                                        <label>Coupon Name</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="text"  class="form-control"  name="Coupon_name"
                                                            placeholder="Coupon Name"/>
															
                                                    </div>
													
													 <div class="col-md-4">
                                                        <label>Description</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="text"  class="form-control" name="copn_descp" 
                                                            placeholder="Description"/>
														
                                                    </div>
													
											
													<div class="col-md-4">
                                                        <label>Coupon Code</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="text" class="p-1"value="Coupon Code"  name="Coupon_codes" id="codes_option" style="width:100%;"/>
													<div id="actv_cpn" class="mt-3">
													
													<input type="checkbox" name="chkop" class="form-check-input" value="ACTIVATE COUPON" id="chk2" onClick="getVal(this, 'codes_option')"> Activate Coupon
													
													<input type="checkbox" name="chkop" class="form-check-input" value="Exclusive Coupon" id="chk2"> Exclusive
													</div>
														
                                                    </div>
													
													<div class="col-md-4">
                                                        <label>Destination Url</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="text"  class="form-control"  name="cp_dstinu_rl"
                                                          placeholder="Destination Url">
												
                                                    </div>
													
													<div class="col-md-4">
                                                        <label>Ending Date</label>
                                                    </div>
                                                    <div class="col-md-8 form-group">
                                                        <input type="date"  name="finish_date"  id="finish_date" class="form-control" >
														
                                                    </div>
													
													<div class="col-md-4 mt-3">
                                                        <label>Choose Category</label>
                                                    </div>
                                                    <div class="col-md-8 mt-3 form-group">
												
													  <div id="txtHint">
														<?php echo $view->subcatelist(); ?>
														</div>
                                                      
                                                    </div><!--8 end--->
													
													
													<div class="col-md-4 mt-3">
                                                        <label>Choose Store</label>
                                                    </div>
                                                    <div class="col-md-8 form-group mt-3">
								                 <select name="cpon_Stor" class="form-group col-sm-12 p-2" style="width: 100%;">
											<option value="" class="form-group col-12" >Choose Store</option>
											<?php
											$needle = array("_stor_nam", "_frgn_ky");
											$tb = "copn_storbnk";
											$heystack = ''; 
											$qu = $query->queryBuilder($needle, $tb, $heystack);
											while($store = mysqli_fetch_array($qu, MYSQLI_NUM)) {
											?>
											
											<option value="<?php echo $store[0]."::".$store[1]; ?>"><?php echo $store[0]; ?></option>
											<?php
											} // end whl
											?>
											</select>
                                                    </div>
													
													<div class="col-md-4 mt-3">
                                                        <label>Saving Type</label>
                                                    </div>
                                                    <div class="col-md-8 form-group mt-3">
								                    <?php
$savng_type = array("5%", "10%", "15%", "20%", "25%", "30%", "35%", "40%", "45%", "50%", "55%", "60%", "65%", "70%", "75%", "80%", "85%", "90%", "95%", 
"$5", "$10", "$15", "$20", "$25", "$30", "$35", "$40", "$45", "$50", "$55", "$60", "$65",  "$65", "$70", "$75", "$80", "$85", "$90", "$95", "$100", "$150", "$200", "$250", "$300", "Free Shipping", "Flat Rate-Shipping", "Sign up", "Buy one-Get 1 Free", "Buy one-Get 50%", "Special Offer", "Free Sample", "Free Gift", "£5", "£10", "£15", "£20", "£25", "£30", "£35", "£40", "£45", "£50", "£55", "£60", "£65", "£70", "£75", "£80", "£85", "£90", "£95", "£100", "£200", "£300", "£400");
?>
<select name="cpon_savng_type" class="form-group col-12 p-2">
<option value="">Select Saving Type</option>
<?php 
foreach($savng_type as $savingstype){
?>
<option value="<?php echo $savingstype; ?>"><?php echo $savingstype; ?></option>
<?php
} // end loop
?>
</select>
                                                    </div>
													
													<div class="col-md-4 mt-3">
                                                        <label>Placement</label>
                                                    </div>
                                                    <div class="col-md-8 mt-3 form-group">
												
													
													  		<div class=' m-2 form-check d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
															class='form-check-input' name="coupon_featurd"/>
													  <label for="checkbox1">Featured</label>
                                                            </div>
                                                        </div><!--sec checkbox--->
														
                                                        <div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" id="checkbox1"
                                                                    class='form-check-input' name="top_deal" />
                                                                <label for="checkbox1">Recommended Deals</label>
                                                            </div>
                                                        </div><!--first checkbox--->
														
														 <div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
                                                                    class='form-check-input' name="free_shiping"/>
																
                                                                <label for="checkbox1">Free Shipping</label>
                                                            </div>
                                                        </div><!--sec checkbox--->
			
														
														<div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" class='form-check-input' name="coupon_cod"/ >
																
                                                                <label for="checkbox1">Coupon Code</label>
                                                            </div>
                                                        </div><!--sec checkbox--->
															
														<div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
                                                                    class='form-check-input' name="coupon_deals"/ >
																	
                                                                <label for="checkbox1">Deal</label>
                                                            </div>
                                                        </div><!--sec checkbox--->	
														
														<div class='form-check m-2 d-inline-block'>
                                                            <div class="checkbox d-inline-block">
                                                                <input type="checkbox" 
                                                                    class='form-check-input' name="cristmas_deals"/ >
																	
                                                                <label for="checkbox1">Valentine</label>
                                                            </div>
                                                        </div><!--sec checkbox--->	
                                              
                                                      
                                                    </div><!--8 end--->
													
	
												    <div class="col-sm-12 mt-3 d-flex justify-content-end">
                                                         <input type="submit" name="admit_coupon" class="col-4 p-2 bg-primary text-white" style="border:1px solid #fff; border-radius: 15px;" value="Add New Coupon" />
                                                        
                                                    </div>
                                                </div>
                                            </div>
                                        </form>
										
										<?php
} // end if stat

}//sec end
?>

							
										
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                    </div>
                </section>
					
                </div><!-- page-head -->

			
            </div><!-- main-content -->
			
			 <?php include_once("assets/resources/footer_includer.php"); ?>

    <script src="assets/vendors/perfect-scrollbar/perfect-scrollbar.min.js"></script>
    <script src="assets/js/bootstrap.bundle.min.js"></script>

    <script src="assets/js/main.js"></script>
	
	<!--summnernot-->
	    <script src="assets/vendors/summernote/summernote-lite.min.js"></script>
    <script>
        $('#summernote').summernote({
            tabsize: 2,
            height: 120,
        })
        $("#hint").summernote({
            height: 100,
            toolbar: false,
            placeholder: 'type with apple, orange, watermelon and lemon',
            hint: {
                words: ['apple', 'orange', 'watermelon', 'lemon'],
                match: /\b(\w{1,})$/,
                search: function (keyword, callback) {
                    callback($.grep(this.words, function (item) {
                        return item.indexOf(keyword) === 0;
                    }));
                }
            }
        });

    </script>
	
	<!--summmernote-->
</body>

</html>