<?php

$pageTitle = 'Products';

$pageTitle_Forpage = ucfirst($action).' '.$pageTitle; 

$actUrl = 'admin/'.$categoryFor.'/manager';
if(!empty($p_id)){
	$actUrl = 'admin/'.$categoryFor.'/manager/'.$action.'/'.$p_id;
}

$editor_ckediter_file_upload_path_base = base_url().'assets/editor_ckediter/upload.php';

// $arrSubMenuItemList = $this->reading_plans->getParentCategoryList(false,$resourceFor);

?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title><?php echo $pageTitle; ?> - ACP - <?php echo site_name(); ?></title>

<?php $this->load->view('admin/ap_top'); ?>

<link rel="stylesheet" href="<?php echo base_url(); ?>assets/ap_assets/multi-select/css/multi-select.css" type="text/css"/>
<script src="<?php echo base_url(); ?>assets/ap_assets/multi-select/js/jquery.multi-select.js"></script>
<script src="<?php echo base_url(); ?>assets/ap_assets/multi-select/jquery.quicksearch.js"></script>

<script type="text/javascript">
 function doActionFn(action,id){
	 if(action == 'edit' || action == 'view'){
			window.location= '<?php echo base_url('admin/'.$categoryFor.'/manager/'); ?>/'+action+'/'+id;
	}else{
		 $('#doAction').val(action);	
		 if(action == 'delete'){
			if (confirm("Are you sure you want to delete?")) {
				$('#listFrm').submit();
			}	
		} else{
			$('#listFrm').submit();
		}
	}
 }
 
function validateAccountForm(){
	clrErr();
	$errStaus = false; 
	var action = '<?php echo $action ?>';
	
   	if(validateFormFields('title','Please enter the Title.',''))$errStaus=true;
   	if(validateFormFields('red_link','Please enter the redirection link .',''))$errStaus=true;
   	if(validateFormFields('congrats_text','Please enter the congrats text.',''))$errStaus=true;
   	if(validateFormFields('theme_color','Please enter the theme color.',''))$errStaus=true;

    if(validateFormFields('logo_imgUploadType','Please enter upload type.',''))$errStaus=true;
 	if($('#logo_imgUploadType').val() == 2){
		if(validateFormFields('logo_img_url1','Please enter  URL.',''))$errStaus=true;
	}
	if($('#logo_imgUploadType').val() == 1){
			if(action != 'edit'){
				if(validateFormFields('logo_img_url','Please select file.',''))$errStaus=true;
			}
			if($('#logo_img_url').val() != '') {
				var ext = $('#logo_img_url').val().split('.').pop().toLowerCase();
				<?php //if($galleryType == 1){?>
				// var allow = new Array('mp4');
				<?php //}else{?>
				var allow = new Array('gif','png','jpg','jpeg','webp');
				<?php //}?>
				
				if(jQuery.inArray(ext, allow) == -1 ){
					 setMsg('logo_img_url','Please select valid file!'); $errStaus=true;
				}
			}
		}
	
	if(validateFormFields('banner_img_up_t','Please enter upload type.',''))$errStaus=true;
 	if($('#banner_img_up_t').val() == 2){
		if(validateFormFields('banner_img_url1','Please enter  URL.',''))$errStaus=true;
	}
	if($('#banner_img_up_t').val() == 1){
			if(action != 'edit'){
				if(validateFormFields('banner_img_url','Please select file.',''))$errStaus=true;
			}
			if($('#banner_img_url').val() != '') {
				var ext = $('#banner_img_url').val().split('.').pop().toLowerCase();
				<?php //if($galleryType == 1){?>
				// var allow = new Array('mp4');
				<?php //}else{?>
				var allow = new Array('gif','png','jpg','jpeg','webp');
				<?php //}?>
				
				if(jQuery.inArray(ext, allow) == -1 ){
					 setMsg('banner_img_url','Please select valid file!'); $errStaus=true;
				}
			}
		}

    
	
	
  	if($errStaus){
	    return false;
    }else{
	    return true;
	}

}

    function showPImgBox(value){
    	$('#div_logo_img_url').hide(); $('#div_logo_img_url1').hide();
    	if(value == 2){
    		$('#div_logo_img_url1').show();$('#div_logo_img_url').hide();
    	}else if(value == 1){
    		$('#div_logo_img_url1').hide();$('#div_logo_img_url').show();
    	}
    }
    
    function showPImgBox_2(value){
    	$('#div_banner_img_url').hide(); $('#div_banner_img_url1').hide();
    	if(value == 2){
    		$('#div_banner_img_url1').show();$('#div_banner_img_url').hide();
    	}else if(value == 1){
    		$('#div_banner_img_url1').hide();$('#div_banner_img_url').show();
    	}
    }
    function showPImgBox_3(value){
    	$('#div_gift_b_img_url_t').hide(); $('#div_gift_b_img_url_t1').hide();
    	if(value == 2){
    		$('#div_gift_b_img_url_t1').show();$('#div_gift_b_img_url_t').hide();
    	}else if(value == 1){
    		$('#div_gift_b_img_url_t1').hide();$('#div_gift_b_img_url_t').show();
    	}
    }
    function showPImgBox_4(value){
    	$('#div_gift_b_img_url_m').hide(); $('#div_gift_b_img_url_m1').hide();
    	if(value == 2){
    		$('#div_gift_b_img_url_m1').show();$('#div_gift_b_img_url_m').hide();
    	}else if(value == 1){
    		$('#div_gift_b_img_url_m1').hide();$('#div_gift_b_img_url_m').show();
    	}
    }
    function showPImgBox_5(value){
    	$('#div_gift_b_img_url_b').hide(); $('#div_gift_b_img_url_b1').hide();
    	if(value == 2){
    		$('#div_gift_b_img_url_b1').show();$('#div_gift_b_img_url_b').hide();
    	}else if(value == 1){
    		$('#div_gift_b_img_url_b1').hide();$('#div_gift_b_img_url_b').show();
    	}
    }
    function showPImgBox_6(value){
    	$('#div_gift_b_img_url').hide(); $('#div_gift_b_img_url1').hide();
    	if(value == 2){
    		$('#div_gift_b_img_url1').show();$('#div_gift_b_img_url').hide();
    	}else if(value == 1){
    		$('#div_gift_b_img_url1').hide();$('#div_gift_b_img_url').show();
    	}
    }
    function showPImgBox_7(value){
    	$('#div_b_g_img_m').hide(); $('#div_b_g_img_m1').hide();
    	if(value == 2){
    		$('#div_b_g_img_m1').show();$('#div_b_g_img_m').hide();
    	}else if(value == 1){
    		$('#div_b_g_img_m1').hide();$('#div_b_g_img_m').show();
    	}
    }
    function showPImgBox_8(value){
    	$('#div_b_ins_g_img_m').hide(); $('#div_b_ins_g_img_m1').hide();
    	if(value == 2){
    		$('#div_b_ins_g_img_m1').show();$('#div_b_ins_g_img_m').hide();
    	}else if(value == 1){
    		$('#div_b_ins_g_img_m1').hide();$('#div_b_ins_g_img_m').show();
    	}
    }
    

</script>

</head>

<body>
    
    <div class="wrapper" >
        <?php $this->load->view('admin/navbar'); ?>
            
		<div class="main-panel main-panel-custom">
		    <div class="content">
				<div class="page-inner">
					<div class="page-header">
						<h4 class="page-title"><?php echo $categoryForPage ; ?></h4>
						<ul class="breadcrumbs">
							<li class="nav-home">
								<a href="<?php echo base_url('admin/dashboard');?>">
									<i class="flaticon-home"></i>
								</a>
							</li>
							<li class="separator">
								<i class="flaticon-right-arrow"></i>
							</li>
							<li class="nav-item">
								<a href="<?php echo base_url('admin/'.$categoryFor.'');?>"><?php echo $pageTitle; ?> List</a>
							</li>
							<li class="separator">
								<i class="flaticon-right-arrow"></i>
							</li>
							<li class="nav-item">
								<a href="#"><?php echo $pageTitle_Forpage; ?></a>
							</li>
						</ul>
					</div>
					
					 <?php
                    	if($action == 'edit' || $action == 'add'){
                    	    //add, edit card
                	    ?>
                    	    <div class="row">
						        <div class="col-md-12">
    							<div class="card">
    							    
    								<div class="card-header">
    									<h4 class="card-title"><?php echo $pageTitle_Forpage; ?></h4>
    								</div>
    								
    								<!--notifiactions-->
        							<div class="container" id="">
                                        <?php 
                                 		$errMsg = validation_errors('* ');
                                		if(empty($errMsg)){ $errMsg = $this->session->flashdata('errMsg');  }
                                		$warningMsg = $this->session->flashdata('warningMsg');
                                		$successMsg = $this->session->flashdata('successMsg');
                                		if(isset($errMsg) && !empty($errMsg)){ echo showMessage($errMsg,'error'); }  
                                		if(isset($warningMsg) && !empty($warningMsg)){ echo showMessage($warningMsg,'warning'); }
                                		if(isset($successMsg) && !empty($successMsg)){ echo showMessage($successMsg,'success'); }
                                	?>
                                    </div>
    								
    									<div class="card-body">
    								    
    							        <?php echo form_open_multipart( $actUrl,array('name' => 'accAdminFrm', 'id' => 'accAdminFrm','onSubmit' => 'return validateAccountForm()'));?>
    										        
										        <input type="hidden" name="categoryFor" value="<?php echo $resourceFor?>" >
										        
    										    <div class="form-group form-inline" id="div_title">
    												<label for="categoryTitle" class="col-md-3 col-form-label">Title<span style="color:red;">&nbsp;*</span></label>
    												<div class="col-md-6 p-0" >
    												    <?php   
    												        $data = array( 'name' => 'title',
    												        'value' => set_value('title',isset($blogRow->title)?$blogRow->title:$this->input->post('title')), 
    												        'id' => 'title',  'placeholder'   => 'Title', 'class' => 'form-control input-full required', );
                                  						    echo form_input($data);
                                    					?>
    													<small class="form-text text-muted text-danger err_msg" id="err_title"></small>
    												</div>
    											</div>
    									        
    									   <!--      <div class="form-group form-inline" id="div_title_slug">-->
    												<!--<label for="title_slug" class="col-md-3 col-form-label">Title Slug<span style="color:red;">&nbsp;*</span></label>-->
    												<!--<div class="col-md-6 p-0" >-->
    												    <?php   
    												        // $data = array( 'name' => 'title_slug', 'type' => 'number','min' => '0',
    												        // 'value' => set_value('title_slug',isset($blogRow->title_slug)?$blogRow->title_slug:$this->input->post('title_slug')), 
    												        // 'id' => 'title_slug',  'placeholder'   => 'Title Slug', 'class' => 'form-control input-full required', );
                        //           						    echo form_input($data);
                                    					?>
    											<!--		<small class="form-text text-muted text-danger err_msg" id="err_title_slug"></small>-->
    											<!--	</div>-->
    											<!--</div>-->
    											
    									         <div class="form-group form-inline" id="div_congrats_text">
    												<label for="congrats_text" class="col-md-3 col-form-label">Congrats Text<span style="color:red;">&nbsp;*</span></label>
    												<div class="col-md-6 p-0" >
    												    <?php   
    												        $data = array( 'name' => 'congrats_text',
    												        'value' => set_value('congrats_text',isset($blogRow->congrats_text)?$blogRow->congrats_text:$this->input->post('congrats_text')), 
    												        'id' => 'congrats_text',  'placeholder'   => 'Congrats Text', 'class' => 'form-control input-full required', );
                                  						    echo form_input($data);
                                    					?>
    													<small class="form-text text-muted text-danger err_msg" id="err_congrats_text"></small>
    												</div>
    											</div>
    											
    											<div class="form-group form-inline" id="div_red_link">
    												<label for="red_link" class="col-md-3 col-form-label">Redirection Link<span style="color:red;">&nbsp;*</span></label>
    												<div class="col-md-6 p-0" >
    												    <?php   
    												        $data = array( 'name' => 'red_link',
    												        'value' => set_value('red_link',isset($blogRow->red_link)?$blogRow->red_link:$this->input->post('red_link')), 
    												        'id' => 'red_link',  'placeholder'   => 'Redirection Link', 'class' => 'form-control input-full required', );
                                  						    echo form_input($data);
                                    					?>
    													<small class="form-text text-muted text-danger err_msg" id="err_red_link"></small>
    												</div>
    											</div>
    											
    											 <div class="form-group form-inline" id="div_theme_color">
    												<label for="theme_color" class="col-md-3 col-form-label">Theme Color<span style="color:red;">&nbsp;*</span></label>
    												<div class="col-md-6 p-0" >
    												    <?php   
    												        $data = array( 'name' => 'theme_color',
    												        'value' => set_value('theme_color',isset($blogRow->theme_color)?$blogRow->theme_color:$this->input->post('theme_color')), 
    												        'id' => 'theme_color',  'placeholder'   => 'Theme Color', 'class' => 'form-control input-full required', );
                                  						    echo form_input($data);
                                    					?>
    													<small class="form-text text-muted text-danger err_msg" id="err_theme_color"></small>
    												</div>
    											</div>
    											<?php 
											 //   $d_ut_logo_img_url = (isset($blogRow->logo_imgUploadType) &&  ($blogRow->logo_imgUploadType == 2 || $blogRow->logo_imgUploadType == 3) )?'block':'none';
											 //   $d_ut_logo_img_url = (isset($action) &&  ($action == "edit"))? '':'display:none';
											    if((isset($action) &&  ($action == "edit"))){
											       $ut_selc_logo_img_url ='selected';
											       $d_ut_logo_img_url_1='';$d_ut_logo_img_url_2= 'display:none';
											    }else{
											         $d_ut_logo_img_url_1 = 'display:none';$d_ut_logo_img_url_2= 'display:none';
											         $ut_selc_logo_img_url = '';
											    }
											    ?>
										        <div class="form-group form-inline" id="div_logo_imgUploadType">
    												<label for="logo_imgUploadType" class="col-md-3 col-form-label">Logo Image<span style="color:red;">&nbsp;*</span></label>
    												<div class="col-md-2 p-0" >
    												    <select onchange="showPImgBox(this.value)" class="form-control input-full" name="logo_imgUploadType" id="logo_imgUploadType">
                                                            <option value="0">Select Upload Type</option>
                                                            <option value="1" <?php echo $ut_selc_logo_img_url; ?>> Upload</option>
                                                            <option value="2" <?php echo $ut_selc_logo_img_url; ?>> URL</option>
                                                        </select>
    													<small class="form-text text-muted text-danger err_msg" id="err_logo_imgUploadType"></small>
    												</div>
    												&nbsp;&nbsp;&nbsp;
    												<div class="col-md-6 p-0" id="div_logo_img_url1" style="<?php echo $d_ut_logo_img_url_1; ?>" >
    												     <?php   
    												        $data = array( 'name' => 'logo_img_url',
    												        'value' => set_value('logo_img_url',isset($blogRow->logo_img_url)?$blogRow->logo_img_url:$this->input->post('logo_img_url')),
                                                            'id' => 'logo_img_url1',  'placeholder'   => 'URL', 'class' => 'form-control input-full ', );
                                  						    echo form_input($data);
                                    					?>
    													<small class="form-text text-muted text-danger err_msg" id="err_logo_img_url1"></small>
    												</div>
                                                  
                                                    <div class="col-md-6 p-0" id="div_logo_img_url" style="<?php echo $d_ut_logo_img_url_2; ?>" >
                                                      <?php
                                        			    $data = array( 'name' => 'logo_img_url',  'class' => 'form-control input-full ', 'id' => 'logo_img_url',  'placeholder'   => '', 'type' => 'file');
                             						    echo form_input($data);
                             						    if(isset($blogRow->logo_img_url) &&  $blogRow->logo_img_url ) {
                                        				  echo '<a href="'.$blogRow->logo_img_url .'">'.$blogRow->logo_img_url.'</a>';
                                         			    }
                                    					?>
                                                    <small class="form-text text-muted text-danger err_msg" id="err_logo_img_url"></small>
                                                  </div>
											    </div>
											    
											    
											   
											    
											    <?php
											    if((isset($action) &&  ($action == "edit"))){
											       $ut_selc_banner_img_url ='selected';
											       $d_ut_banner_img_url_1='';$d_ut_banner_img_url_2 = 'display:none';
											    }else{
											         $d_ut_banner_img_url_1 = 'display:none';$d_ut_banner_img_url_2 = 'display:none';
											         $ut_selc_banner_img_url = '';
											    }
											    ?>
											    <div class="form-group form-inline" id="div_banner_img_up_t">
    												<label for="banner_img_up_t" class="col-md-3 col-form-label">Banner Image<span style="color:red;">&nbsp;*</span></label>
    												<div class="col-md-2 p-0" >
    												    <select onchange="showPImgBox_2(this.value)" class="form-control input-full" name="banner_img_up_t" id="banner_img_up_t">
                                                            <option value="0">Select Upload Type</option>
                                                            <option value="1" <?php echo $ut_selc_banner_img_url; ?>> Upload</option>
                                                            <option value="2" <?php echo $ut_selc_banner_img_url; ?>> URL</option>
                                                        </select>
    													<small class="form-text text-muted text-danger err_msg" id="err_banner_img_up_t"></small>
    												</div>
    												&nbsp;&nbsp;&nbsp;
													<div class="col-md-6 p-0" id="div_banner_img_url1" style="<?php echo $d_ut_banner_img_url_1; ?>" >
    												     <?php   
    												        $data = array( 'name' => 'banner_img_url',
    												        'value' => set_value('banner_img_url',isset($blogRow->banner_img_url)?$blogRow->banner_img_url:$this->input->post('banner_img_url')),
                                                            'id' => 'banner_img_url1',  'placeholder'   => 'URL', 'class' => 'form-control input-full ', );
                                  						    echo form_input($data);
                                    					?>
    													<small class="form-text text-muted text-danger err_msg" id="err_banner_img_url1"></small>
    												</div>
    												<div class="col-md-6 p-0" id="div_banner_img_url" style="<?php echo $d_ut_banner_img_url_2; ?>"   >
                                                        <?php
                                             			    if(isset($blogRow->banner_img_url) &&  $blogRow->banner_img_url ) {
                                            				  echo '<a href="'.$blogRow->banner_img_url .'">'.$blogRow->banner_img_url.'</a>';
                                             			    }
                                            			    $data = array( 'name' => 'banner_img_url',  'class' => 'form-control input-full ', 'id' => 'banner_img_url',  'placeholder'   => '', 'type' => 'file');
                                 						    echo form_input($data);
                                					    ?>
                                                    <small class="form-text text-muted text-danger err_msg" id="err_banner_img_url"></small>
                                                    </div>
    												
											    </div>
											    
											    
											    <!--gift img urls ###############################-->
											    
											    <!--gift box image top starts ###############################-->
										        <?php
											    if((isset($action) &&  ($action == "edit"))){
											       $ut_selc_gift_b_img_url_t ='selected';
											       $d_ut_gift_b_img_url_t_1='';$d_ut_gift_b_img_url_t_2 = 'display:none';
											    }else{
											         $d_ut_gift_b_img_url_t_1 = 'display:none';$d_ut_gift_b_img_url_t_2 = 'display:none';
											         $ut_selc_gift_b_img_url_t = '';
											    }
											    ?>
											    <div class="form-group form-inline" id="div_gift_b_img_url_t_up_t">
    												<label for="gift_b_img_url_t_up_t" class="col-md-3 col-form-label">Gift-box Top Image</label>
    												<div class="col-md-2 p-0" >
    												    <select onchange="showPImgBox_3(this.value)" class="form-control input-full" name="gift_b_img_url_t_up_t" id="gift_b_img_url_t_up_t">
                                                            <option value="0">Select Upload Type</option>
                                                            <option value="1" <?php echo $ut_selc_gift_b_img_url_t; ?>> Upload</option>
                                                            <option value="2" <?php echo $ut_selc_gift_b_img_url_t; ?>> URL</option>
                                                        </select>
    													<small class="form-text text-muted text-danger err_msg" id="err_gift_b_img_url_t_up_t"></small>
    												</div>
    												&nbsp;&nbsp;&nbsp;
													<div class="col-md-6 p-0" id="div_gift_b_img_url_t1" style="<?php echo $d_ut_gift_b_img_url_t_1; ?>" >
    												     <?php   
    												        $data = array( 'name' => 'gift_b_img_url_t',
    												        'value' => set_value('gift_b_img_url_t',isset($blogRow->gift_b_img_url_t)?$blogRow->gift_b_img_url_t:$this->input->post('gift_b_img_url_t')),
                                                            'id' => 'gift_b_img_url_t1',  'placeholder'   => 'URL', 'class' => 'form-control input-full ', );
                                  						    echo form_input($data);
                                    					?>
    													<small class="form-text text-muted text-danger err_msg" id="err_gift_b_img_url_t1"></small>
    												</div>
    												<div class="col-md-6 p-0" id="div_gift_b_img_url_t" style="<?php echo $d_ut_gift_b_img_url_t_2; ?>"   >
                                                        <?php
                                             			    if(isset($blogRow->gift_b_img_url_t) &&  $blogRow->gift_b_img_url_t ) {
                                            				  echo '<a href="'.$blogRow->gift_b_img_url_t .'">'.$blogRow->gift_b_img_url_t.'</a>';
                                             			    }
                                            			    $data = array( 'name' => 'gift_b_img_url_t',  'class' => 'form-control input-full ', 'id' => 'gift_b_img_url_t',  'placeholder'   => '', 'type' => 'file');
                                 						    echo form_input($data);
                                					    ?>
                                                    <small class="form-text text-muted text-danger err_msg" id="err_gift_b_img_url_t"></small>
                                                    </div>
    												
											    </div>
											    <!--gift box image top ends ###############################-->
											    
											     <!--gift box image middle starts ###############################-->
											    <?php
											    if((isset($action) &&  ($action == "edit"))){
											       $ut_selc_gift_b_img_url_m ='selected';
											       $d_ut_gift_b_img_url_m_1='';$d_ut_gift_b_img_url_m_2 = 'display:none';
											    }else{
											         $d_ut_gift_b_img_url_m_1 = 'display:none';$d_ut_gift_b_img_url_m_2 = 'display:none';
											         $ut_selc_gift_b_img_url_m = '';
											    }
											    ?>
											    <div class="form-group form-inline" id="div_gift_b_img_url_m_up_t">
    												<label for="gift_b_img_url_m_up_t" class="col-md-3 col-form-label">Gift-box Middle Image</label>
    												<div class="col-md-2 p-0" >
    												    <select onchange="showPImgBox_4(this.value)" class="form-control input-full" name="gift_b_img_url_m_up_t" id="gift_b_img_url_m_up_t">
                                                            <option value="0">Select Upload Type</option>
                                                            <option value="1" <?php echo $ut_selc_gift_b_img_url_m; ?>> Upload</option>
                                                            <option value="2" <?php echo $ut_selc_gift_b_img_url_m; ?>> URL</option>
                                                        </select>
    													<small class="form-text text-muted text-danger err_msg" id="err_gift_b_img_url_m_up_t"></small>
    												</div>
    												&nbsp;&nbsp;&nbsp;
													<div class="col-md-6 p-0" id="div_gift_b_img_url_m1" style="<?php echo $d_ut_gift_b_img_url_m_1; ?>" >
    												     <?php   
    												        $data = array( 'name' => 'gift_b_img_url_m',
    												        'value' => set_value('gift_b_img_url_m',isset($blogRow->gift_b_img_url_m)?$blogRow->gift_b_img_url_m:$this->input->post('gift_b_img_url_m')),
                                                            'id' => 'gift_b_img_url_m1',  'placeholder'   => 'URL', 'class' => 'form-control input-full ', );
                                  						    echo form_input($data);
                                    					?>
    													<small class="form-text text-muted text-danger err_msg" id="err_gift_b_img_url_m1"></small>
    												</div>
    												<div class="col-md-6 p-0" id="div_gift_b_img_url_m" style="<?php echo $d_ut_gift_b_img_url_m_2; ?>"   >
                                                        <?php
                                             			    if(isset($blogRow->gift_b_img_url_m) &&  $blogRow->gift_b_img_url_m ) {
                                            				  echo '<a href="'.$blogRow->gift_b_img_url_m .'">'.$blogRow->gift_b_img_url_m.'</a>';
                                             			    }
                                            			    $data = array( 'name' => 'gift_b_img_url_m',  'class' => 'form-control input-full ', 'id' => 'gift_b_img_url_m',  'placeholder'   => '', 'type' => 'file');
                                 						    echo form_input($data);
                                					    ?>
                                                    <small class="form-text text-muted text-danger err_msg" id="err_gift_b_img_url_m"></small>
                                                    </div>
											    </div>
											    <!--gift box image middle ends ###############################-->
											    
											    <!--gift box image bottom starts ###############################-->
											    <?php
											    if((isset($action) &&  ($action == "edit"))){
											       $ut_selc_gift_b_img_url_b ='selected';
											       $d_ut_gift_b_img_url_b_1='';$d_ut_gift_b_img_url_b_2 = 'display:none';
											    }else{
											         $d_ut_gift_b_img_url_b_1 = 'display:none';$d_ut_gift_b_img_url_b_2 = 'display:none';
											         $ut_selc_gift_b_img_url_b = '';
											    }
											    ?>
											    <div class="form-group form-inline" id="div_gift_b_img_url_b_up_t">
    												<label for="gift_b_img_url_b_up_t" class="col-md-3 col-form-label">Gift-box Bottom Image</label>
    												<div class="col-md-2 p-0" >
    												    <select onchange="showPImgBox_5(this.value)" class="form-control input-full" name="gift_b_img_url_b_up_t" id="gift_b_img_url_b_up_t">
                                                            <option value="0">Select Upload Type</option>
                                                            <option value="1" <?php echo $ut_selc_gift_b_img_url_b; ?>> Upload</option>
                                                            <option value="2" <?php echo $ut_selc_gift_b_img_url_b; ?>> URL</option>
                                                        </select>
    													<small class="form-text text-muted text-danger err_msg" id="err_gift_b_img_url_b_up_t"></small>
    												</div>
    												&nbsp;&nbsp;&nbsp;
													<div class="col-md-6 p-0" id="div_gift_b_img_url_b1" style="<?php echo $d_ut_gift_b_img_url_b_1; ?>" >
    												     <?php   
    												        $data = array( 'name' => 'gift_b_img_url_b',
    												        'value' => set_value('gift_b_img_url_b',isset($blogRow->gift_b_img_url_b)?$blogRow->gift_b_img_url_b:$this->input->post('gift_b_img_url_b')),
                                                            'id' => 'gift_b_img_url_b1',  'placeholder'   => 'URL', 'class' => 'form-control input-full ', );
                                  						    echo form_input($data);
                                    					?>
    													<small class="form-text text-muted text-danger err_msg" id="err_gift_b_img_url_b1"></small>
    												</div>
    												<div class="col-md-6 p-0" id="div_gift_b_img_url_b" style="<?php echo $d_ut_gift_b_img_url_b_2; ?>"   >
                                                        <?php
                                             			    if(isset($blogRow->gift_b_img_url_b) &&  $blogRow->gift_b_img_url_b ) {
                                            				  echo '<a href="'.$blogRow->gift_b_img_url_b .'">'.$blogRow->gift_b_img_url_b.'</a>';
                                             			    }
                                            			    $data = array( 'name' => 'gift_b_img_url_b',  'class' => 'form-control input-full ', 'id' => 'gift_b_img_url_b',  'placeholder'   => '', 'type' => 'file');
                                 						    echo form_input($data);
                                					    ?>
                                                    <small class="form-text text-muted text-danger err_msg" id="err_gift_b_img_url_b"></small>
                                                    </div>
    												
											    </div>
											    <!--gift box image bottom ends ###############################-->
											    
											    
											    <!--gift box full image starts ###############################-->
											    <?php
											    if((isset($action) &&  ($action == "edit"))){
											       $ut_selc_gift_b_img_url ='selected';
											       $d_ut_gift_b_img_url_1='';$d_ut_gift_b_img_url_2 = 'display:none';
											    }else{
											         $d_ut_gift_b_img_url_1 = 'display:none';$d_ut_gift_b_img_url_2 = 'display:none';
											         $ut_selc_gift_b_img_url = '';
											    }
											    ?>
											    <div class="form-group form-inline" id="div_gift_b_img_url_up_t">
    												<label for="gift_b_img_url_up_t" class="col-md-3 col-form-label">Gift-box Full Image </label>
    												<div class="col-md-2 p-0" >
    												    <select onchange="showPImgBox_6(this.value)" class="form-control input-full" name="gift_b_img_url_up_t" id="gift_b_img_url_up_t">
                                                            <option value="0">Select Upload Type</option>
                                                            <option value="1" <?php echo $ut_selc_gift_b_img_url; ?>> Upload</option>
                                                            <option value="2" <?php echo $ut_selc_gift_b_img_url; ?>> URL</option>
                                                        </select>
    													<small class="form-text text-muted text-danger err_msg" id="err_gift_b_img_url_up_t"></small>
    												</div>
    												&nbsp;&nbsp;&nbsp;
													<div class="col-md-6 p-0" id="div_gift_b_img_url1" style="<?php echo $d_ut_gift_b_img_url_1; ?>" >
    												     <?php   
    												        $data = array( 'name' => 'gift_b_img_url',
    												        'value' => set_value('gift_b_img_url',isset($blogRow->gift_b_img_url)?$blogRow->gift_b_img_url:$this->input->post('gift_b_img_url')),
                                                            'id' => 'gift_b_img_url1',  'placeholder'   => 'URL', 'class' => 'form-control input-full ', );
                                  						    echo form_input($data);
                                    					?>
    													<small class="form-text text-muted text-danger err_msg" id="err_gift_b_img_url1"></small>
    												</div>
    												<div class="col-md-6 p-0" id="div_gift_b_img_url" style="<?php echo $d_ut_gift_b_img_url_2; ?>"   >
                                                        <?php
                                             			    if(isset($blogRow->gift_b_img_url) &&  $blogRow->gift_b_img_url ) {
                                            				  echo '<a href="'.$blogRow->gift_b_img_url .'">'.$blogRow->gift_b_img_url.'</a>';
                                             			    }
                                            			    $data = array( 'name' => 'gift_b_img_url',  'class' => 'form-control input-full ', 'id' => 'gift_b_img_url',  'placeholder'   => '', 'type' => 'file');
                                 						    echo form_input($data);
                                					    ?>
                                                    <small class="form-text text-muted text-danger err_msg" id="err_gift_b_img_url"></small>
                                                    </div>
    												
											    </div>
										        <!--gift box full image ends ###############################-->
											    
											    
											    <!--gift money imag starts ###############################-->
											    <?php
											    if((isset($action) &&  ($action == "edit"))){
											       $ut_selc_b_g_img_m ='selected';
											       $d_ut_b_g_img_m_1='';$d_ut_b_g_img_m_2 = 'display:none';
											    }else{
											         $d_ut_b_g_img_m_1 = 'display:none';$d_ut_b_g_img_m_2 = 'display:none';
											         $ut_selc_b_g_img_m = '';
											    }
											    ?>
											    <div class="form-group form-inline" id="div_b_g_img_m_up_t">
    												<label for="b_g_img_m_up_t" class="col-md-3 col-form-label">Gift Image<br>(i.e.money)</label>
    												<div class="col-md-2 p-0" >
    												    <select onchange="showPImgBox_7(this.value)" class="form-control input-full" name="b_g_img_m_up_t" id="b_g_img_m_up_t">
                                                            <option value="0">Select Upload Type</option>
                                                            <option value="1" <?php echo $ut_selc_b_g_img_m; ?>> Upload</option>
                                                            <option value="2" <?php echo $ut_selc_b_g_img_m; ?>> URL</option>
                                                        </select>
    													<small class="form-text text-muted text-danger err_msg" id="err_b_g_img_m_up_t"></small>
    												</div>
    												&nbsp;&nbsp;&nbsp;
													<div class="col-md-6 p-0" id="div_b_g_img_m1" style="<?php echo $d_ut_b_g_img_m_1; ?>" >
    												     <?php   
    												        $data = array( 'name' => 'b_g_img_m',
    												        'value' => set_value('b_g_img_m',isset($blogRow->b_g_img_m)?$blogRow->b_g_img_m:$this->input->post('b_g_img_m')),
                                                            'id' => 'b_g_img_m1',  'placeholder'   => 'URL', 'class' => 'form-control input-full ', );
                                  						    echo form_input($data);
                                    					?>
    													<small class="form-text text-muted text-danger err_msg" id="err_b_g_img_m1"></small>
    												</div>
    												<div class="col-md-6 p-0" id="div_b_g_img_m" style="<?php echo $d_ut_b_g_img_m_2; ?>"   >
                                                        <?php
                                             			    if(isset($blogRow->b_g_img_m) &&  $blogRow->b_g_img_m ) {
                                            				  echo '<a href="'.$blogRow->b_g_img_m .'">'.$blogRow->b_g_img_m.'</a>';
                                             			    }
                                            			    $data = array( 'name' => 'b_g_img_m',  'class' => 'form-control input-full ', 'id' => 'b_g_img_m',  'placeholder'   => '', 'type' => 'file');
                                 						    echo form_input($data);
                                					    ?>
                                                    <small class="form-text text-muted text-danger err_msg" id="err_b_g_img_m"></small>
                                                    </div>
    												
											    </div>
											    <!--gift money imag ends ###############################-->
											    
											    
											    <!--gift money inside-box imag  starts ###############################-->
											    <?php
											    if((isset($action) &&  ($action == "edit"))){
											       $ut_selc_b_ins_g_img_m ='selected';
											       $d_ut_b_ins_g_img_m_1='';$d_ut_b_ins_g_img_m_2 = 'display:none';
											    }else{
											         $d_ut_b_ins_g_img_m_1 = 'display:none';$d_ut_b_ins_g_img_m_2 = 'display:none';
											         $ut_selc_b_ins_g_img_m = '';
											    }
											    ?>
											    <div class="form-group form-inline" id="div_b_ins_g_img_m_up_t">
    												<label for="b_ins_g_img_m_up_t" class="col-md-3 col-form-label">Gift Image<br>(Inside-of-box)</label>
    												<div class="col-md-2 p-0" >
    												    <select onchange="showPImgBox_8(this.value)" class="form-control input-full" name="b_ins_g_img_m_up_t" id="b_ins_g_img_m_up_t">
                                                            <option value="0">Select Upload Type</option>
                                                            <option value="1" <?php echo $ut_selc_b_ins_g_img_m; ?>> Upload</option>
                                                            <option value="2" <?php echo $ut_selc_b_ins_g_img_m; ?>> URL</option>
                                                        </select>
    													<small class="form-text text-muted text-danger err_msg" id="err_b_ins_g_img_m_up_t"></small>
    												</div>
    												&nbsp;&nbsp;&nbsp;
													<div class="col-md-6 p-0" id="div_b_ins_g_img_m1" style="<?php echo $d_ut_b_ins_g_img_m_1; ?>" >
    												     <?php   
    												        $data = array( 'name' => 'b_ins_g_img_m',
    												        'value' => set_value('b_ins_g_img_m',isset($blogRow->b_ins_g_img_m)?$blogRow->b_ins_g_img_m:$this->input->post('b_ins_g_img_m')),
                                                            'id' => 'b_ins_g_img_m1',  'placeholder'   => 'URL', 'class' => 'form-control input-full ', );
                                  						    echo form_input($data);
                                    					?>
    													<small class="form-text text-muted text-danger err_msg" id="err_b_ins_g_img_m1"></small>
    												</div>
    												<div class="col-md-6 p-0" id="div_b_ins_g_img_m" style="<?php echo $d_ut_b_ins_g_img_m_2; ?>"   >
                                                        <?php
                                             			    if(isset($blogRow->b_ins_g_img_m) &&  $blogRow->b_ins_g_img_m ) {
                                            				  echo '<a href="'.$blogRow->b_ins_g_img_m .'">'.$blogRow->b_ins_g_img_m.'</a>';
                                             			    }
                                            			    $data = array( 'name' => 'b_ins_g_img_m',  'class' => 'form-control input-full ', 'id' => 'b_ins_g_img_m',  'placeholder'   => '', 'type' => 'file');
                                 						    echo form_input($data);
                                					    ?>
                                                    <small class="form-text text-muted text-danger err_msg" id="err_b_ins_g_img_m"></small>
                                                    </div>
    												
											    </div>
											    <!--gift money  inside-box ends ###############################-->
											    
											    
											     <div class="form-group form-inline" id="div_ifr_ads_html_txt">
    												<label for="ifr_ads_html_txt" class="col-md-3 col-form-label">Ads Text</label>
    												<div class="col-md-8 p-0" >
    												    <?php   
    												        $v_ifr_ads_html_txt='';
    												        if(isset($blogRow->ifr_ads_html_txt)&&!empty($blogRow->ifr_ads_html_txt)){
    												            $v_ifr_ads_html_txt = $blogRow->ifr_ads_html_txt;
    												        }
    												        else if($this->input->post('ifr_ads_html_txt',TRUE)){
    												            $v_ifr_ads_html_txt = $this->input->post('ifr_ads_html_txt');
    												        }
    												        else{
    												            $v_ifr_ads_html_txt='';
    												        }
    												        $data = array( 'name' => 'ifr_ads_html_txt',
    												        // 'value' => set_value('ifr_ads_html_txt',$v_ifr_ads_html_txt), 
    												        'id' => 'ifr_ads_html_txt',  'placeholder'   => 'Congrats Text', 'class' => 'form-control input-full required', );
                                  						    // echo form_textarea($data);
                                    					?>
                                    					<textarea name="ifr_ads_html_txt" class="form-control input-full" rows="5" id="ifr_ads_html_txt" 
                                    					style="height:100px;"><?php echo $v_ifr_ads_html_txt ?></textarea>
                                          
    													<small class="form-text text-muted text-danger err_msg" id="err_ifr_ads_html_txt"></small>
    												</div>
    											</div>
    											
										<!--	      <div class="form-group form-inline" id="">-->
										<!--	<label for="" class="col-md-2 col-form-label">Option 2<span style="color:red;">&nbsp;*</span></label>-->
										<!--	<div class="col-md-8 p-0" >-->
										<!--	    <textarea name="quiz_option2_html" class="form-control input-full" rows="5" id="quiz_option2_html" style="height:100px;"><?php if(isset($blogRow->quiz_option2) && !empty($blogRow->quiz_option2)) {echo $blogRow->quiz_option2;}else{echo '';}?></textarea>		-->
										<!--		<small class="form-text text-muted text-danger err_msg" id="err_quiz_option2_html"></small>-->
										<!--	</div>-->
										<!--</div>-->
											    
                                                    
                                                <br>
    											
    											<div class="form-group form-inline">
        												<label for="inlineinput" class="col-md-3 col-form-label "></label>
        												<div class="col-md-6 p-0">
        												    <?php
        												        $data = array( 'name' => 'menuBtn','value' => 'true', 'id' => 'menuBtn',  'type' => 'submit','content' => 'Submit', 'class' => 'btn btn-success',   );
                                             				    echo form_button($data);
                                            				    $data = array( 'name' => 'resetBtn','value' => 'true', 'id' => 'resetBtn', 
                                            				    'type' => 'reset','content' => 'Cancel', 'class' => 'btn btn-warning' , 'onclick' => 'window.location.href=document.referrer'  );
                                            				    echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
                                             				    echo form_button($data) ;
                                                 			?>
        												</div>
        											</div>
    									    
    								        <?php echo form_close(); ?>
    								</div>
    							</div>
    						</div>
					        </div>
                    	    
                	    <?php
                    	}
                    	else
                    	{
                    	    //view card
                    	    ?>
                    	    <div class="row">
        						<div class="col-md-12">
        							<div class="card">
        								<div class="card-header">
        								    <div class="card-head-row">
        									    <h4 class="card-title">Plan Info</h4>
        									</div>
        								</div>
							            <div class="card-body">
        							        <div class="table-responsive">
        										<table id="" class="table table-bordered">
        									    	<tr>
        											    <th>Title</th><td><?php echo ( (!empty($blogRow->title)&&(isset($blogRow->title))) ? $blogRow->title:'-');  ?></td>
        										    </tr>
        										    <tr>
        											    <th>Title Slug</th><td><?php echo ( (!empty($blogRow->title_slug)&&(isset($blogRow->title_slug))) ? $blogRow->title_slug:'-');  ?></td>
        										    </tr>
        										      <tr>
        											    <th>Redirection Link</th><td><?php echo ( (!empty($blogRow->red_link)&&(isset($blogRow->red_link))) ? $blogRow->red_link:'-');  ?></td>
        										    </tr>
        										    <tr>
        											    <th>Congrats Text</th><td><?php echo ( (!empty($blogRow->congrats_text)&&(isset($blogRow->congrats_text))) ? $blogRow->congrats_text:'-');  ?></td>
        										    </tr>
        										    <tr>
        											    <th>Theme Color</th><td><?php echo ( (!empty($blogRow->theme_color)&&(isset($blogRow->theme_color))) ? $blogRow->theme_color:'-');  ?></td>
        										    </tr>
        										    <tr>
        											    <th>Logo Image URL</th>
        											    <td>
        											        <?php $logo_img_url =  ( (!empty($blogRow->logo_img_url)&&(isset($blogRow->logo_img_url))) ? $blogRow->logo_img_url:'-');  ?>
        											        <div class="col-md-4">
                    								            <div class="">
                    											    <img src="<?php echo $logo_img_url;  ?>" alt="logo_img_url" class="avatar-img ">
                    										    </div>
                        								    </div>
                        								    <p style="white-space:normal"><?php echo $logo_img_url?></p>
                        								</td>
        										    </tr>
        										    
        										    <tr>
        											    <th>Banner Image URL</th>
        											    <td>
        											        <?php $banner_img_url =  ( (!empty($blogRow->banner_img_url)&&(isset($blogRow->banner_img_url))) ? $blogRow->banner_img_url:'-');  ?>
        											        <div class="col-md-4">
                    								            <div class="">
                    											    <img src="<?php echo $banner_img_url;  ?>" alt="banner_img_url" class="avatar-img ">
                    										    </div>
                        								    </div>
                        								    <p style="white-space:normal"><?php echo $banner_img_url?></p>
                        								</td>
        										    </tr>
        										    
        										    <tr>
        											    <th>Giftbox Top Image </th>
        											    <td>
        											        <?php $gift_b_img_url_t =  ( (!empty($blogRow->gift_b_img_url_t)&&(isset($blogRow->gift_b_img_url_t))) ? $blogRow->gift_b_img_url_t:'-');  ?>
        											        <div class="col-md-4">
                    								            <div class="">
                    											    <img src="<?php echo $gift_b_img_url_t;  ?>" alt="gift_b_img_url_t" class="avatar-img ">
                    										    </div>
                        								    </div>
                        								    <p style="white-space:normal"><?php echo $gift_b_img_url_t?></p>
                        								</td>
        										    </tr>
        										    
        										    <tr>
        											    <th>Giftbox Middle Image </th>
        											    <td>
        											        <?php $gift_b_img_url_m =  ( (!empty($blogRow->gift_b_img_url_m)&&(isset($blogRow->gift_b_img_url_m))) ? $blogRow->gift_b_img_url_m:'-');  ?>
        											        <div class="col-md-4">
                    								            <div class="">
                    											    <img src="<?php echo $gift_b_img_url_m;  ?>" alt="gift_b_img_url_m" class="avatar-img ">
                    										    </div>
                        								    </div>
                        								    <p style="white-space:normal"><?php echo $gift_b_img_url_m?></p>
                        								</td>
        										    </tr>
        										    <tr>
        											    <th>Giftbox Bottom Image </th>
        											    <td>
        											        <?php $gift_b_img_url_b =  ( (!empty($blogRow->gift_b_img_url_b)&&(isset($blogRow->gift_b_img_url_b))) ? $blogRow->gift_b_img_url_b:'-');  ?>
        											        <div class="col-md-4">
                    								            <div class="">
                    											    <img src="<?php echo $gift_b_img_url_b;  ?>" alt="gift_b_img_url_b" class="avatar-img ">
                    										    </div>
                        								    </div>
                        								    <p style="white-space:normal"><?php echo $gift_b_img_url_b?></p>
                        								</td>
        										    </tr>
        										    
        										     <tr>
        											    <th>Giftbox Full Image </th>
        											    <td>
        											        <?php $gift_b_img_url =  ( (!empty($blogRow->gift_b_img_url)&&(isset($blogRow->gift_b_img_url))) ? $blogRow->gift_b_img_url:'-');  ?>
        											        <div class="col-md-4">
                    								            <div class="">
                    											    <img src="<?php echo $gift_b_img_url;  ?>" alt="gift_b_img_url" class="avatar-img ">
                    										    </div>
                        								    </div>
                        								    <p style="white-space:normal"><?php echo $gift_b_img_url?></p>
                        								</td>
        										    </tr>
        										    
        										     <tr>
        											    <th>Gift-Image(money) </th>
        											    <td>
        											        <?php $b_g_img_m =  ( (!empty($blogRow->b_g_img_m)&&(isset($blogRow->b_g_img_m))) ? $blogRow->b_g_img_m:'-');  ?>
        											        <div class="col-md-4">
                    								            <div class="">
                    											    <img src="<?php echo $b_g_img_m;  ?>" alt="b_g_img_m" class="avatar-img ">
                    										    </div>
                        								    </div>
                        								    <p style="white-space:normal"><?php echo $b_g_img_m?></p>
                        								</td>
        										    </tr>
        										    
        										     <tr>
        											    <th>Gift-box-inside Image </th>
        											    <td>
        											        <?php $b_ins_g_img_m =  ( (!empty($blogRow->b_ins_g_img_m)&&(isset($blogRow->b_ins_g_img_m))) ? $blogRow->b_ins_g_img_m:'-');  ?>
        											        <div class="col-md-4">
                    								            <div class="">
                    											    <img src="<?php echo $b_ins_g_img_m;  ?>" alt="b_ins_g_img_m" class="avatar-img ">
                    										    </div>
                        								    </div>
                        								    <p style="white-space:normal"><?php echo $b_ins_g_img_m?></p>
                        								</td>
        										    </tr>
        										    
        										    
                								</table>
        									</div>
        								</div>
        							</div>
        						</div>
        						
        					</div>
                    	    <?php
                    	}
                	?>
				</div>
			</div>
		    <!--<footer class="footer">-->
			    <?php //footer();?>
			<!--</footer>-->
		</div>
		
	</div>
	
    <script>
     var editor_ifr_ads_html_txt = CKEDITOR.replace( 'ifr_ads_html_txt', {
        extraPlugins: 'image2,uploadimage',
        filebrowserUploadUrl: '<?php echo $editor_ckediter_file_upload_path_base; ?>',
        filebrowserUploadMethod: 'form',
        height: 100,
        // on: {
        //     // Synchronize the preview on user action that changes the content.
        //     change: syncPreview,
        //     // Synchronize the preview when the new data is set.
        //     contentDom: syncPreview
        // }
    } );
    
    CKEDITOR.config.toolbarGroups = [
		{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
		{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
		{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
		{ name: 'forms', groups: [ 'forms' ] },
		{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
		{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'paragraph' ] },
		{ name: 'links', groups: [ 'links' ] },
		{ name: 'insert', groups: [ 'insert' ] },
		{ name: 'styles', groups: [ 'styles' ] },
		{ name: 'colors', groups: [ 'colors' ] },
		{ name: 'tools', groups: [ 'tools' ] },
		{ name: 'others', groups: [ 'others' ] },
		{ name: 'about', groups: [ 'about' ] }
	];

    CKEDITOR.config.removeButtons = 'Anchor,HorizontalRule,CopyFormatting,RemoveFormat,Cut,Copy,Paste,PasteText,PasteFromWord,Undo,Redo,Find,Replace,SelectAll,Scayt,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Templates,Save,NewPage,ExportPdf,Preview,Print,Strike,Language,Flash,Smiley,PageBreak,Iframe,TextColor,BGColor,Maximize,About,ShowBlocks,CreateDiv,Blockquote,Styles';
    
    // https://docs-old.ckeditor.com/ckeditor_api/symbols/CKEDITOR.editor.html#setData

    
    </script>
</body>

</html>