<?php

$permalink1 = get_site_url();
$permalink2 = get_home_url();
if ($permalink1 == $permalink2) {
    $permalink = $permalink1;
} else {
    $permalink = $permalink2;
}
$find = array('http://', 'https://');
$replace = 'https://';
$siteurl = str_replace($find, $replace, $permalink);

$allMemberPages_obj = DAP_MemberPages::loadByAction('cancellation');
$page_id_already_used = array();
if(count($allMemberPages_obj)){
	foreach($allMemberPages_obj as $allMemberPage_obj){
		$page_id_already_used[] = $allMemberPage_obj->getPageId();
	}
}

echo DapMemberShowLoader();
$id = $_GET['id'];


if($id != ''){
	
	$data = DAP_MemberPages::loadById($id);
	
	$show_all_transactions = DAP_MemberPagesValues::loadByActionIdAndName($id,'show_all_transactions');
	if($show_all_transactions != '' && $show_all_transactions != false){
		$show_all_transactions =  $show_all_transactions->getValue();	
	}
	
	$product_type = DAP_MemberPagesValues::loadByActionIdAndName($id,'product_type');
	if($product_type != '' && $product_type != false){
		$product_type =  $product_type->getValue();	
	}
	
	$notransfoundmsg = DAP_MemberPagesValues::loadByActionIdAndName($id,'notransfoundmsg');
	if($notransfoundmsg != '' && $notransfoundmsg != false){
		$notransfoundmsg =  $notransfoundmsg->getValue();	
	}
	
	$contact_us = DAP_MemberPagesValues::loadByActionIdAndName($id,'contact_us');
	if($contact_us != '' && $contact_us != false){
		$contact_us =  $contact_us->getValue();	
	}
	
	$contact_us_link = DAP_MemberPagesValues::loadByActionIdAndName($id,'contact_us_link');
	if($contact_us_link != '' && $contact_us_link != false){
		$contact_us_link =  $contact_us_link->getValue();	
	}
	
	$show_cancel = DAP_MemberPagesValues::loadByActionIdAndName($id,'show_cancel');
	if($show_cancel != '' && $show_cancel != false){
		$show_cancel =  $show_cancel->getValue();	
	}
	
	$cancelled_text = DAP_MemberPagesValues::loadByActionIdAndName($id,'cancelled_text');
	if($cancelled_text != '' && $cancelled_text != false){
		$cancelled_text =  $cancelled_text->getValue();	
	}
	
	$success_cancel_msg = DAP_MemberPagesValues::loadByActionIdAndName($id,'success_cancel_msg');
	if($success_cancel_msg != '' && $success_cancel_msg != false){
		$success_cancel_msg =  $success_cancel_msg->getValue();	
	}
	
	$failed_cancel_msg = DAP_MemberPagesValues::loadByActionIdAndName($id,'failed_cancel_msg');
	if($failed_cancel_msg != '' && $failed_cancel_msg != false){
		$failed_cancel_msg =  $failed_cancel_msg->getValue();	
	}
	
	$cancel_cancel_msg = DAP_MemberPagesValues::loadByActionIdAndName($id,'cancel_cancel_msg');
	if($cancel_cancel_msg != '' && $cancel_cancel_msg != false){
		$cancel_cancel_msg =  $cancel_cancel_msg->getValue();	
	}
	
	$cancelbuttonstyle = DAP_MemberPagesValues::loadByActionIdAndName($id,'cancelbuttonstyle');
	if($cancelbuttonstyle != '' && $cancelbuttonstyle != false){
		$cancelbuttonstyle =  $cancelbuttonstyle->getValue();	
		
	}
	
	
	$cancelbuttonstyleNew = DAP_MemberPagesValues::loadByActionIdAndName($id,'cancelbuttonstyleNew');
	if($cancelbuttonstyleNew != '' && $cancelbuttonstyleNew != false){
		$cancelbuttonstyleNew =  $cancelbuttonstyleNew->getValue();	
		
	
		$cancelbuttonstyleValues = explode(';' , $cancelbuttonstyleNew);
			
		$cancelHeight = $cancelbuttonstyleValues[0];
		$cancelBackground = $cancelbuttonstyleValues[1];
		$cancelBorderColor = $cancelbuttonstyleValues[2];
		$cancelColor = $cancelbuttonstyleValues[3];
		$cancelFontSize = $cancelbuttonstyleValues[4];
		$cancelBorderWidth = $cancelbuttonstyleValues[5];
		$cancelBorderStyle = $cancelbuttonstyleValues[6];
		$cancelBorderRadius = $cancelbuttonstyleValues[7];
		$cancelFontWeight = $cancelbuttonstyleValues[8];
		$cancelWidth = $cancelbuttonstyleValues[9];
	}

	$canceltext = DAP_MemberPagesValues::loadByActionIdAndName($id,'canceltext');
	if($canceltext != '' && $canceltext != false){
		$canceltext =  $canceltext->getValue();	
	}
	
	$canceltextcolor = DAP_MemberPagesValues::loadByActionIdAndName($id,'canceltextcolor');
	if($canceltextcolor != '' && $canceltextcolor != false){
		$canceltextcolor =  $canceltextcolor->getValue();	
	}
	
	$showpause = DAP_MemberPagesValues::loadByActionIdAndName($id,'showpause');
	if($showpause != '' && $showpause != false){
		$showpause =  $showpause->getValue();	
	}
	
	$pausesuccess = DAP_MemberPagesValues::loadByActionIdAndName($id,'pausesuccess');
	if($pausesuccess != '' && $pausesuccess != false){
		$pausesuccess =  $pausesuccess->getValue();	
	}
	
	$pausefail = DAP_MemberPagesValues::loadByActionIdAndName($id,'pausefail');
	if($pausefail != '' && $pausefail != false){
		$pausefail =  $pausefail->getValue();	
	}
	
	$pauseconfirm = DAP_MemberPagesValues::loadByActionIdAndName($id,'pauseconfirm');
	if($pauseconfirm != '' && $pauseconfirm != false){
		$pauseconfirm =  $pauseconfirm->getValue();	
	}
	
	$pausebuttonstyle = DAP_MemberPagesValues::loadByActionIdAndName($id,'pausebuttonstyle');
	if($pausebuttonstyle != '' && $pausebuttonstyle != false){
		$pausebuttonstyle =  $pausebuttonstyle->getValue();	
				
	}
	
	$pausebuttonstyleNew = DAP_MemberPagesValues::loadByActionIdAndName($id,'pausebuttonstyleNew');
	if($pausebuttonstyleNew != '' && $pausebuttonstyleNew != false){
		$pausebuttonstyleNew =  $pausebuttonstyleNew->getValue();	
		
		$pausebuttonstyleValues = explode(';' , $pausebuttonstyleNew);
		
		$pauseHeight = $pausebuttonstyleValues[0];
		$pauseBackground = $pausebuttonstyleValues[1];
		$pauseBorderColor = $pausebuttonstyleValues[2];
		$pausetextcolor = $pausebuttonstyleValues[3];
		$pauseFontSize = $pausebuttonstyleValues[4];
		$pauseBorderWidth = $pausebuttonstyleValues[5];
		$pauseBorderStyle = $pausebuttonstyleValues[6];
		$pauseBorderRadius = $pausebuttonstyleValues[7];
		$pauseFontWeight = $pausebuttonstyleValues[8];
		$pauseWidth = $pausebuttonstyleValues[9];
	}	
	
	$pausebuttontext = DAP_MemberPagesValues::loadByActionIdAndName($id,'pausebuttontext');
	if($pausebuttontext != '' && $pausebuttontext != false){
		$pausebuttontext =  $pausebuttontext->getValue();	
	}
	
	$resumesuccess = DAP_MemberPagesValues::loadByActionIdAndName($id,'resumesuccess');
	if($resumesuccess != '' && $resumesuccess != false){
		$resumesuccess =  $resumesuccess->getValue();	
	}
	
	$resumefail = DAP_MemberPagesValues::loadByActionIdAndName($id,'resumefail');
	if($resumefail != '' && $resumefail != false){
		$resumefail =  $resumefail->getValue();	
	}
	
	$resumeconfirm = DAP_MemberPagesValues::loadByActionIdAndName($id,'resumeconfirm');
	if($resumeconfirm != '' && $resumeconfirm != false){
		$resumeconfirm =  $resumeconfirm->getValue();	
	}
	
	$resumebuttonstyle = DAP_MemberPagesValues::loadByActionIdAndName($id,'resumebuttonstyle');
	if($resumebuttonstyle != '' && $resumebuttonstyle != false){
		$resumebuttonstyle =  $resumebuttonstyle->getValue();	
			
	}
	
	$resumebuttonstyleNew = DAP_MemberPagesValues::loadByActionIdAndName($id,'resumebuttonstyleNew');
	if($resumebuttonstyleNew != '' && $resumebuttonstyleNew != false){
		$resumebuttonstyleNew =  $resumebuttonstyleNew->getValue();	
		
		$resumebuttonstyleValues = explode(';' , $resumebuttonstyleNew);
		
		$resumeHeight = $resumebuttonstyleValues[0];
		$resumeBackground = $resumebuttonstyleValues[1];
		$resumeBorderColor = $resumebuttonstyleValues[2];
		$resumetextcolor = $resumebuttonstyleValues[3];
		$resumeFontSize = $resumebuttonstyleValues[4];
		$resumeBorderWidth = $resumebuttonstyleValues[5];
		$resumeBorderStyle = $resumebuttonstyleValues[6];
		$resumeBorderRadius = $resumebuttonstyleValues[7];
		$resumeFontWeight = $resumebuttonstyleValues[8];
		$resumeWidth = $resumebuttonstyleValues[9];
	}
	
	$resumebuttontext = DAP_MemberPagesValues::loadByActionIdAndName($id,'resumebuttontext');
	if($resumebuttontext != '' && $resumebuttontext != false){
		$resumebuttontext =  $resumebuttontext->getValue();	
	}
	
	$mp_obj = DAP_MemberPages::loadById($_GET['id']);
	if($mp_obj && ($mp_obj->getAction() == 'cancellation')){
			
	}
		
}

?>	


<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800&display=swap" rel="stylesheet">

<div id="dap_member_page_wrapper">
	<div class="dap_member_cancellation_outer common_outer">
		<div class="master_heading d-flex align-items-center justify-content-between border-bottom-0">
			<h4><i class="fa fa-users mr-2"></i> Member Subscription</h4>
			<a href="<?= admin_url('admin.php?page=dap_member_pages'); ?>"class="btn btn-success theme-btn">Return to Member Pages</a>
		</div>
		<div class="enter_name_outer">
			<input type="hidden" id="saved_id" value="<?= isset($_GET['id']) ? $_GET['id'] : '' ; ?>" >
			<input type="hidden" id="page_id" value="<?= isset($data) ? $data->getPageId() : '' ?>" >
			<h3 class="section_heading"> Page URL</h3>
			<div class="form-group row mt-4">  		
			   <div class="col-sm-4 align-items-center">
				  <label> Create a New Cancellation Page </label>
			   </div>
			   <div class="col-sm-5">
				  <div class="input-group">
					  <div class="input-group-prepend">
						<span class="input-group-text"><?php echo $siteurl; ?>/</span>
					  </div>
					<input type="text" name="create_cancellation_page" id="create_cancellation_page" class="form-control page_name" value="" placeholder="Enter Name" <?php if($data){ echo 'disabled=disbled';}?>/>
				  </div>
				</div>
				<div class="col-sm-3">
					<button type="button"  id="cancellation_page" data-id ="create_cancellation_page" class="btn theme-btn btn-blue notransform check_availability_page_btn create_page_btn" <?php if($data){ echo 'disabled=disbled';}?>>Check Availability</button>									 
				</div>
				<div class="error-msgs text-center messages-div col-sm-12 mt-4">
					<h5 class="alert alert-danger error_create_cancellation_page error_msg" style="display:none">Sorry, This Name is already taken. Please Try with another one. </h5>
					<h5 class="alert alert-success success_create_cancellation_page success_msg" style="display:none">Congrats! This Name is available!</h5>
				</div>
		   </div>
			
		<div class="form-group row" >  
			  <div class="col-sm-4"></div>
				<div class="col-sm-5">
					<div class="or">
					  <span>OR</span>
					</div>
				</div>
			</div>
		   <div class="form-group row form_group_inner">  
		  
			  <div class="col-sm-4 d-flex  align-items-center">
				<label> Select an Existing Page </label>
			  </div>
			  <div class="col-sm-5">
					<select class="form-control" id="cancellation_page_url" name="cancellation_page_url" <?php if($data){ echo 'disabled=disbled';}?>>
						<option value="">Select a URL</option>
						 <?php
							$page_ids = get_all_page_ids();
							foreach($page_ids as $page){
								$page_name = get_page( $page );
								$selected = '';
								if ($page_name->post_status == 'publish'){
									if(isset($data) && ($data->getPageId() == $page)){
										$selected = 'selected=selected';
									}else if(in_array($page,$page_id_already_used)){
										continue;
									}
									
									
								?>
									<option value='<?php echo $page; ?>' <?php echo $selected;?>>
									<?php echo get_permalink($page); ?>
									</option>
								<?php } 
					 
							}//close foreach loop ?>
				  </select>
			  </div>
		</div>
		</div>
		
		<div class="enter_name_outer">
			<h3 class="section_heading"> Template Settings</h3>
			<div class="form-group row mt-4">  
			  <div class="col-sm-4 d-flex align-items-center">
				<label> Do you want to Show All Transactions?
					<div class="tool-tip">
						<i class="fa fa-info-circle" aria-hidden="true"></i>
						<div class="toll-tip-desc"> If set to YES, it will show all products that the user has EVEN if the product is not a subscription product. </div>
					</div>
				</label>
			  </div>
			  <div class="col-sm-5">
				  <select class="form-control" id="show_all_transactions" name="show_all_transactions">
					  <option value="Y" <?= isset($show_all_transactions) && $show_all_transactions == 'Y' ? 'selected' :'' ?>>Yes</option>
					  <option value="N" <?= isset($show_all_transactions) && $show_all_transactions == 'N' ? 'selected' :'' ?>>No</option>	
				  </select>
			  </div>
			</div>
			
			<div class="form-group row">  
			  <div class="col-sm-4 d-flex align-items-center">
				<label> Select a Template</label>
			  </div>
			  <div class="col-sm-5">
				  <select class="form-control" id="select_template" name="select_template">
					  <option value="template1">Template 1</option>
				  </select>
			  </div>
			</div>
		</div>
		
		<div class="enter_name_outer">
			<h3 class="section_heading"> General Options</h3>
			<div class="form-group row mt-4">  
			  <div class="col-sm-5 d-flex align-items-center">
				<label> Enter Product Type 
					<div class="tool-tip">
						<i class="fa fa-info-circle" aria-hidden="true"></i>
						<div class="toll-tip-desc"> Only transactions related to these products will be listed. If you want all products, set it to ALL. If you want specific products, enter comma-separated list of ids.. for e.g. 1,2,4 </div>
					</div>
				</label>
			  </div>
			  <div class="col-sm-4">
				  <input type="text" class="form-control" id="product_type" value="<?= isset($product_type) ? $product_type : 'ALL'?>">
			  </div>
			</div>
			
			<div class="form-group row">  
			  <div class="col-sm-5 d-flex align-items-center">
				<label> Enter 'No Transaction' found message</label>
			  </div>
			  <div class="col-sm-4">
				  <input type="text" class="form-control" id="no_transaction_found" value="<?= isset($notransfoundmsg) ? $notransfoundmsg : 'Sorry, no active transactions found' ?>">
			  </div>
			</div>
			
			<div class="form-group row">  
			  <div class="col-sm-5">
				<label> Enter "CONTACT US" text for one-time purchases or for purchases that cannot be cancelled by the member.
					<div class="tool-tip">
						<i class="fa fa-info-circle" aria-hidden="true"></i>
						<div class="toll-tip-desc"> PLEASE NOTE:  For transactions that the members cannot cancel (For e.g. one-time purchases), you can set a 'contact us' text and a 'contact us' link in the textboxes below. This way your members can click the 'contact us' link to contact you.</div>
					</div>
				</label>
			  </div>
			  <div class="col-sm-4">
				  <input type="text" class="form-control" id="cancellation_contact_us_text" value="<?= isset($contact_us) ? $contact_us : '' ?>">
			  </div>
			</div>
			
			<div class="form-group row">  
			  <div class="col-sm-5 d-flex align-items-center">
				<label> Enter URL of the page to which the "Contact US" text will be linked.
					<div class="tool-tip">
						<i class="fa fa-info-circle" aria-hidden="true"></i>
						<div class="toll-tip-desc"> Only applicable if you have entered a 'CONTACT US' text above. </div>
					</div>
				</label>
			  </div>
			  <div class="col-sm-4">
				  <input type="text" class="form-control" id="cancellation_contact_us_link" value="<?= isset($contact_us_link) ? $contact_us_link : '' ?>">
			  </div>
			</div>
		</div> <!-- General Options End -->
		
		
		<div class="enter_name_outer">
			<h3 class="section_heading"> Cancellation Options</h3>
			<div class="form-group row mt-4">  
			  <div class="col-sm-4 d-flex align-items-center">
				<label> Show Cancel?
					<div class="tool-tip">
						<i class="fa fa-info-circle" aria-hidden="true"></i>
						<div class="toll-tip-desc"> Do you want to show a 'Cancel' button to allow users to self-cancel their subscription? </div>
					</div>
				</label>
			  </div>
			  <div class="col-sm-4">
				  <select class="form-control" id="show_cancel" name="show_cancel">
						<option value="Y" <?= isset($show_cancel) && $show_cancel == 'Y' ? 'selected' : '' ?> >Yes</option>
						<option value="N"  <?= isset($show_cancel) && $show_cancel == 'N' ? 'selected' : '' ?>>No</option>
				  </select>
			  </div>
			</div>
			
			<div class="form-group row mt-4">  
			  <div class="col-sm-12">
				<div class="sub_inner_section">
					<h4 class="sub_inner_section_heading">Cancel Messages</h4>
					<div class="form-group row">  
					  <div class="col-sm-4">
						<label> Enter CANCELLED text
							<div class="tool-tip">
								<i class="fa fa-info-circle" aria-hidden="true"></i>
								<div class="toll-tip-desc"> This text will be displayed instead of the cancel button for 'already cancelled' transactions. </div>
							</div>
						</label>
					  </div>
					  <div class="col-sm-4">
						 <textarea type="text" id="cancelled_text" class="form-control" rows="4"><?= isset($cancelled_text) ? $cancelled_text : 'CANCELLED' ?></textarea>
					  </div>
					</div>
					
					<div class="form-group row">  
					  <div class="col-sm-4">
						<label> Enter successful cancellation message</label>
					  </div>
					  <div class="col-sm-4">
						  <textarea type="text" id="success_cancel_msg" class="form-control" rows="4"><?= isset($success_cancel_msg) ? $success_cancel_msg : 'Subscription cancellation completed Successfully!' ?></textarea>
					  </div>
					</div>
					
					<div class="form-group row">  
					  <div class="col-sm-4">
						<label> Enter failed cancellation message</label>
					  </div>
					  <div class="col-sm-4">
						  <textarea type="text" id="failed_cancel_msg" class="form-control" rows="4"><?= isset($failed_cancel_msg) ? $failed_cancel_msg : 'Sorry, could not cancel the subscription.' ?></textarea>
					  </div>
					</div>
					
					<div class="form-group row">  
					  <div class="col-sm-4">
						<label> Enter cancellation confirmation message</label>
					  </div>
					  <div class="col-sm-4">
						  <textarea type="text" id="cancel_cancel_msg" class="form-control" rows="4"><?= isset($cancel_cancel_msg) ? $cancel_cancel_msg : 'Are you sure you want to cancel subscription?' ?></textarea>
					  </div>
					</div>
				</div>
				
				<div class="sub_inner_section mt-4">
					<h4 class="sub_inner_section_heading">Cancel Button Customizer</h4>
					<div class="form-group row">  
					  <div class="col-sm-4">
						<label> Select Button Type</label>
					  </div>
					  <div class="col-sm-4">
						  <select class="form-control" id="cancel_button_type" name="cancel_button_type">
							  <option value="button" selected>Customize a Button</option>
						  </select>
					  </div>
					</div>
					
					<div class="form-group row">  
					  <div class="col-sm-8 text-center">
						 <?php 
						if(isset($canceltext) && $canceltext != ''){ ?>
							 <button type="button" class="cancel_btn common_btn" style="<?= $cancelbuttonstyle.'text-color:'.$canceltextcolor; ?>"><?= isset($canceltext) && $canceltext ? $canceltext : 'Cancel' ?></button>
							 
							<?php  
						}else{ ?>
							<button type="button" class="cancel_btn common_btn">Cancel</button>	
						<?php  } ?>
						 
						  
					  </div>
					</div>
					
					<div class="form-group row">  
					  <div class="col-sm-12 text-center">
						  <div class="customized-optional dap_member_cancellation_customizer">
							 <div class="customizer_heading">Cancel Button Customizer</div>
								<ul class="templates-styles">
									<li>
										<label>Button Text</label>
										<div class="input-group ">
											 <input type="text" class="form-control" id="cancel_btn_text" value="<?= isset($cancel_btn_text) ? $cancel_btn_text : 'Cancel' ?>">
										</div>
									</li>
									<li>
										<label>Background Color</label>
										<div class="input-group ">
											 <div id="cancel_background_clr_div" class="input-group colorpicker-component">
											  <input type="text" value="<?= isset($cancelBackground) ? $cancelBackground : '#dc3545' ?>" name="cancel_background_clr" id="cancel_background_clr" class="form-control temp_style_fields" />		
											  <span class="input-group-addon">
												  <i></i>
											   </span>
										  </div>
										</div>
									</li>
									<li>
										<label>Border Style</label>
										<div class="input-group ">
											<select class="input-group form-control" id="cancel_bdr_style" name="cancel_bdr_style">
												<?php 
												$dm_bdr_style_array = array('none'=>'None','solid'=>'Solid','dashed'=>'Dashed','dotted'=>'Dotted');
												foreach($dm_bdr_style_array as $key=>$value){
													 $slected = ''	;
													if($key == $cancelBorderStyle ){
														
														$slected = 'selected=selected';
													}
													echo "<option value='".$key."' $slected >$value</option>";
												}
												?>
											</select>
										</div>
									</li>
									<li>
										<label>Border Width </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="cancel_border_width"  name="cancel_border_width" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="10" data-slider-step="1" data-slider-value="<?= isset($cancelBorderWidth) ? $cancelBorderWidth : 0 ?>" /> 
											</div>
										</div>
									</li>
									<li>
										<label>Border Color</label>
										<div class="input-group ">
											 <div id="cancel_border_clr_div" class="input-group colorpicker-component">
											  <input type="text" value="<?= isset($cancelBorderColor) ? $cancelBorderColor : '#333' ?>" name="cancel_border_clr" id="cancel_border_clr" class="form-control temp_style_fields" />	
											  <span class="input-group-addon">
												  <i></i>
											   </span>
										  </div>
										</div>
									</li>
									<li>
										<label>Border Radius </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="cancel_border_radius"  name="cancel_border_radius" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="<?= isset($cancelBorderRadius) ? $cancelBorderRadius : 0 ?>"  /> 
											</div>
										</div>
									</li>
									<li>
										<label>Font Size </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="cancel_font_size"  name="cancel_font_size" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="<?= isset($cancelFontSize) ? $cancelFontSize : '11' ?>" /> 
											</div>
										</div>
									</li>
									<li>
										<label>Font Weight</label>
										<div class="input-group ">
											<select class="input-group form-control" id="cancel_font_weight" name="cancel_font_weight">
												<?php 
												$cancel_font_weight_array = array('200'=>'200','400'=>'400','600'=>'600','700'=>'700','800'=>'800');
												
												if(!isset($cancelFontWeight)){
													$cancelFontWeight = 600;	
												}
												
												foreach($cancel_font_weight_array as $key=>$value){
													 $slected = '';
													if($key == $cancelFontWeight ){
														
														$slected = 'selected=selected';
													}
													
													
													echo "<option value='".$key."' $slected>$value</option>";
												}
												?>
											</select>
										</div>
									</li>
									<li>
										<label>Text Color</label>
										<div class="input-group ">
											 <div id="cancel_text_clr_div" class="input-group colorpicker-component">
											  <input type="text" value="<?= isset($canceltextcolor) ? $canceltextcolor : '#fff' ?>" name="cancel_text_clr" id="cancel_text_clr" class="form-control temp_style_fields" />
											  <span class="input-group-addon">
												  <i></i>
											   </span>
										  </div>
										</div>
									</li>
									<li>
										<label>Button Width </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="cancel_button_width"  name="cancel_button_width" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="50" data-slider-max="500" data-slider-step="1" data-slider-value="<?= isset($cancelWidth) ? $cancelWidth : '90' ?>" /> 
											</div>
										</div>
									</li>
									<li>
										<label>Button Height </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="cancel_button_height"  name="cancel_button_height" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="10" data-slider-max="250" data-slider-step="1" data-slider-value="<?= isset($cancelHeight) ? $cancelHeight : '6' ?>" /> 
											</div>
										</div>
									</li>
								</ul>
							</div>
					   </div>
					</div>
				</div> 
			  </div>
			</div>
		</div> <!-- Cancellation Options End -->
		
		
		<div class="enter_name_outer">
			<h3 class="section_heading"> Pause/Resume Options</h3>
			<div class="form-group row mt-4">  
			  <div class="col-sm-4 d-flex align-items-center">
				<label> Show Pause/Resume Button?</label>
			  </div>
			  <div class="col-sm-4">
				  <select class="form-control" id="pause_resume_select" name="pause_resume_select">
						<option value="N" <?= isset($showpause) && $showpause == 'N' ? 'selected' : '' ?>>No</option>
						<option value="Y" <?= isset($showpause) && $showpause == 'Y' ? 'selected' : '' ?>>Yes</option>
				  </select>
			  </div>
			</div>
			
			<div class="form-group row mt-4 pause_resume_outer" style="display:<?= isset($showpause) && $showpause == 'Y' ? 'block' : 'none' ?>">    
			  <div class="col-sm-12">
				<div class="sub_inner_section">
					<h4 class="sub_inner_section_heading">Pause Messages</h4>
					<div class="form-group row">  
					  <div class="col-sm-4">
						<label> Enter Successfully Paused message</label>
					  </div>
					  <div class="col-sm-4">
						  <textarea type="text" class="form-control" id="success_paused_msg" rows="4"><?= isset($pausesuccess) ? $pausesuccess : ''?></textarea>
					  </div>
					</div>
					
					<div class="form-group row">  
					  <div class="col-sm-4">
						<label> Enter Subscription Pause fail message</label>
					  </div>
					  <div class="col-sm-4">
						  <textarea type="text" class="form-control" id="failed_paused_msg" rows="4"><?= isset($pausefail) ? $pausefail : '' ?></textarea>
					  </div>
					</div>
					
					<div class="form-group row">  
					  <div class="col-sm-4">
						<label> Enter Subscription Pause confirm message</label>
					  </div>
					  <div class="col-sm-4">
						  <textarea type="text" id="confirm_paused_msg" class="form-control" rows="4"><?= isset($pauseconfirm) ? $pauseconfirm : '' ?></textarea>
					  </div>
					</div>
				</div>
				
				<div class="sub_inner_section mt-4">
					<h4 class="sub_inner_section_heading">Resume Messages</h4>
					<div class="form-group row">  
					  <div class="col-sm-4">
						<label> Enter Successfully Resumed message</label>
					  </div>
					  <div class="col-sm-4">
						  <textarea type="text" class="form-control" id="success_resume_msg" rows="4"><?= isset($resumesuccess) ? $resumesuccess : '' ?></textarea>
					  </div>
					</div>
					
					<div class="form-group row">  
					  <div class="col-sm-4">
						<label> Enter Subscription Resumed fail message</label>
					  </div>
					  <div class="col-sm-4">
						  <textarea type="text" class="form-control" id="failed_resume_msg" rows="4"><?= isset($resumefail) ? $resumefail : '' ?></textarea>
					  </div>
					</div>
					
					<div class="form-group row">  
					  <div class="col-sm-4">
						<label> Enter Subscription Resumed confirm message</label>
					  </div>
					  <div class="col-sm-4">
						  <textarea type="text" class="form-control" id="confirm_resume_msg" rows="4"><?= isset($resumeconfirm) ? $resumeconfirm : '' ?></textarea>
					  </div>
					</div>
				</div>
				
				<div class="sub_inner_section mt-4">
					<h4 class="sub_inner_section_heading">Pause Button Customizer</h4>
					<div class="form-group row">  
					  <div class="col-sm-4">
						<label> Select Button Type</label>
					  </div>
					  <div class="col-sm-4">
						  <select class="form-control" id="" name="">
							  <option value="button" selected>Customize a Button</option>
						  </select>
					  </div>
					</div>
					
					<div class="form-group row">  
					  <div class="col-sm-8 text-center">
						  
						   <?php 
						if(isset($pausebuttontext) && $pausebuttontext != ''){ ?>
							 <button type="button" class="pause_btn common_btn" style="<?= $pausebuttonstyle; ?>"><?= isset($pausebuttontext) && $pausebuttontext ? $pausebuttontext : 'Pause' ?></button>
							 
							<?php  
						}else{ ?>
							<button type="button" class="pause_btn common_btn">Pause</button>	
						<?php  } ?>
						
					  </div>
					</div>
					
					
					<div class="form-group row">  
					  <div class="col-sm-12 text-center">
						  <div class="customized-optional dap_member_cancellation_customizer">
							 <div class="customizer_heading">Pause Button Customizer</div>
								<ul class="templates-styles">
									<li>
										<label>Button Text</label>
										<div class="input-group ">
											 <input type="text" class="form-control" id="pause_btn_text" value="Pause">
										</div>
									</li>
									<li>
										<label>Background Color</label>
										<div class="input-group ">
											 <div id="pause_background_clr_div" class="input-group colorpicker-component">
											  <input type="text" value="<?= isset($pauseBackground) ? $pauseBackground : '#1e7e34' ?>" name="pause_background_clr" id="pause_background_clr" class="form-control temp_style_fields" />
											  <span class="input-group-addon">
												  <i></i>
											   </span>
										  </div>
										</div>
									</li>
									<li>
										<label>Border Style</label>
										<div class="input-group ">
											<select class="input-group form-control" id="pause_bdr_style" name="pause_bdr_style">
												<?php 
												$dm_bdr_style_array = array('none'=>'None','solid'=>'Solid','dashed'=>'Dashed','dotted'=>'Dotted');
												foreach($dm_bdr_style_array as $key=>$value){
													 $slected = '';
													if($key == $pauseBorderStyle ){
														
														$slected = 'selected=selected';
													}
													echo "<option value='".$key."' $slected >$value</option>";
												}
												?>
											</select>
										</div>
									</li>
									<li>
										<label>Border Width </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="pause_border_width"  name="pause_border_width" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="10" data-slider-step="1" data-slider-value="<?= isset($pauseBorderWidth) ? $pauseBorderWidth : '0' ?>" /> 
											</div>
										</div>
									</li>
									<li>
										<label>Border Color</label>
										<div class="input-group ">
											 <div id="pause_border_clr_div" class="input-group colorpicker-component">
											  <input type="text" value="<?= isset($pauseBorderColor) ? $pauseBorderColor : '#333' ?>" name="pause_border_clr" id="pause_border_clr" class="form-control temp_style_fields" />
											  <span class="input-group-addon">
												  <i></i>
											   </span>
										  </div>
										</div>
									</li>
									<li>
										<label>Border Radius </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="pause_border_radius"  name="pause_border_radius" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="<?= isset($pauseBorderRadius) ? $pauseBorderRadius : '0' ?>" /> 
											</div>
										</div>
									</li>
									<li>
										<label>Font Size </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="pause_font_size"  name="pause_font_size" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="<?= isset($pauseFontSize) ? $pauseFontSize : '11' ?>" /> 
											</div>
										</div>
									</li>
									<li>
										<label>Font Weight</label>
										<div class="input-group ">
											<select class="input-group form-control" id="pause_font_weight" name="pause_font_weight">
												<?php 
												$pause_font_weight_array = array('200'=>'200','400'=>'400','600'=>'600','700'=>'700','800'=>'800');
												if(!isset($pauseFontWeight)){
													$pauseFontWeight = 600;	
												}
												foreach($pause_font_weight_array as $key=>$value){
													 $slected = '';
													if($key == $pauseFontWeight ){
														
														$slected = 'selected=selected';
													}
													
													
													echo "<option value='".$key."' $slected>$value</option>";
												}
												?>
											</select>
										</div>
									</li>
									<li>
										<label>Text Color</label>
										<div class="input-group ">
											 <div id="pause_text_clr_div" class="input-group colorpicker-component">
											  <input type="text" value="<?= isset($pausetextcolor) ? $pausetextcolor : '#fff' ?>" name="pause_text_clr" id="pause_text_clr" class="form-control temp_style_fields" />
											  <span class="input-group-addon">
												  <i></i>
											   </span>
										  </div>
										</div>
									</li>
									<li>
										<label>Button Width </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="pause_button_width"  name="pause_button_width" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="50" data-slider-max="500" data-slider-step="1" data-slider-value="<?= isset($pauseWidth) ? $pauseWidth : '90' ?>" /> 
											</div>
										</div>
									</li>
									<li>
										<label>Button Height </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="pause_button_height"  name="pause_button_height" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="10" data-slider-max="250" data-slider-step="1" data-slider-value="<?= isset($pauseHeight) ? $pauseHeight : '6' ?>" /> 
											</div>
										</div>
									</li>
								</ul>
							</div>
					   </div>
					</div>
				</div> 
				
				
				
				
				<div class="sub_inner_section mt-4">
					<h4 class="sub_inner_section_heading">Resume Button Customizer</h4>
					<div class="form-group row">  
					  <div class="col-sm-4">
						<label> Select Button Type</label>
					  </div>
					  <div class="col-sm-4">
						  <select class="form-control" id="" name="">
							  <option value="button" selected>Customize a Button</option>
						  </select>
					  </div>
					</div>
					
					<div class="form-group row">  
					  <div class="col-sm-8 text-center">
						  
						   <?php 
						if(isset($pausebuttontext) && $pausebuttontext != ''){ ?>
							 <button type="button" class="resume_btn common_btn" style="<?= $resumebuttonstyle; ?>"><?= isset($resumebuttontext) && $resumebuttontext ? $resumebuttontext : 'Resume' ?></button>
							 
							<?php  
						}else{ ?>
							<button type="button" class="resume_btn common_btn">Resume</button>
						<?php  } ?>
						  
						  
					  </div>
					</div>
					<div class="form-group row">  
					  <div class="col-sm-12 text-center">
						  <div class="customized-optional dap_member_cancellation_customizer">
							 <div class="customizer_heading">Resume Button Customizer</div>
								<ul class="templates-styles">
									<li>
										<label>Button Text</label>
										<div class="input-group ">
											 <input type="text" class="form-control" id="resume_btn_text" value="Resume">
										</div>
									</li>
									<li>
										<label>Background Color</label>
										<div class="input-group ">
											 <div id="resume_background_clr_div" class="input-group colorpicker-component">
											  <input type="text" value="<?= isset($resumeBackground) ? $resumeBackground : '#17a2b8' ?>" name="resume_background_clr" id="resume_background_clr" class="form-control temp_style_fields" />
											  <span class="input-group-addon">
												  <i></i>
											   </span>
										  </div>
										</div>
									</li>
									<li>
										<label>Border Style</label>
										<div class="input-group ">
											<select class="input-group form-control" id="resume_bdr_style" name="resume_bdr_style">
												<?php 
												$dm_bdr_style_array = array('none'=>'None','solid'=>'Solid','dashed'=>'Dashed','dotted'=>'Dotted');
												foreach($dm_bdr_style_array as $key=>$value){
													 $slected = '';
													if($key == $resumeBorderStyle ){
														
														$slected = 'selected=selected';
													}
													echo "<option value='".$key."' $slected >$value</option>";
												}
												?>
											</select>
										</div>
									</li>
									<li>
										<label>Border Width </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="resume_border_width"  name="resume_border_width" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="10" data-slider-step="1" data-slider-value="<?= isset($resumeBorderWidth) ? $resumeBorderWidth : '0' ?>" /> 
											</div>
										</div>
									</li>
									<li>
										<label>Border Color</label>
										<div class="input-group ">
											 <div id="resume_border_clr_div" class="input-group colorpicker-component">
											  <input type="text" value="<?= isset($resumeBorderColor) ? $resumeBorderColor : '#333' ?>" name="resume_border_clr" id="resume_border_clr" class="form-control temp_style_fields" />
											  <span class="input-group-addon">
												  <i></i>
											   </span>
										  </div>
										</div>
									</li>
									<li>
										<label>Border Radius </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="resume_border_radius"  name="resume_border_radius" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="<?= isset($resumeBorderRadius) ? $resumeBorderRadius : '0' ?>" /> 
											</div>
										</div>
									</li>
									<li>
										<label>Font Size </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="resume_font_size"  name="resume_font_size" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="<?= isset($resumeFontSize) ? $resumeFontSize : '11' ?>"</textarea>
											</div>
										</div>
									</li>
									<li>
										<label>Font Weight</label>
										<div class="input-group ">
											<select class="input-group form-control" id="resume_font_weight" name="resume_font_weight">
												<?php 
												$resume_font_weight_array = array('200'=>'200','400'=>'400','600'=>'600','700'=>'700','800'=>'800');
												if(!isset($resumeFontWeight)){
													$resumeFontWeight = 600;	
												}
												foreach($resume_font_weight_array as $key=>$value){
													 $slected = '';
													if($key == $resumeFontWeight ){
														
														$slected = 'selected=selected';
													}
													
													
													echo "<option value='".$key."' $slected>$value</option>";
												}
												?>
											</select>
										</div>
									</li>
									<li>
										<label>Text Color</label>
										<div class="input-group ">
											 <div id="resume_text_clr_div" class="input-group colorpicker-component">
											  <input type="text" value="<?= isset($resumetextcolor) ? $resumetextcolor : '#fff' ?>" name="resume_text_clr" id="resume_text_clr" class="form-control temp_style_fields" />
											  <span class="input-group-addon">
												  <i></i>
											   </span>
										  </div>
										</div>
									</li>
									<li>
										<label>Button Width </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="resume_button_width"  name="resume_button_width" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="50" data-slider-max="500" data-slider-step="1" data-slider-value="<?= isset($resumeWidth) ? $resumeWidth : '90' ?>" /> 
											</div>
										</div>
									</li>
									<li>
										<label>Button Height </label>
										<div class="input-group ">
											<div class="input-group colorpicker-component m_top_bottom">
												<input id="resume_button_height"  name="resume_button_height" class="form-control" data-slider-id='ex1Slider' type="text" data-slider-min="10" data-slider-max="250" data-slider-step="1" data-slider-value="<?= isset($resumeHeight) ? $resumeHeight : '6' ?>" /> 
											</div>
										</div>
									</li>
								</ul>
							</div>
					   </div>
					</div>
					
					
				</div> 
			  </div>
			</div>
		</div> <!-- Pause/Resume Options End -->
		<div class="form-group row shortcode_div" style='display:<?= isset($_GET['id']) ? 'block' : 'none' ?>'>

			<div class="col-sm-12 d-flex align-items-center">
				<div class="get_shortcode">
					<h3 class="section_heading">Here is your Cancellation page URL: <span class="shortcode_page_link"><a href="<?= isset($data) ? get_permalink($data->getPageId()) : '' ?>" target="_blank"><?= isset($data) ? get_permalink($data->getPageId()) : '' ?></a></span></h3>
					<div class="cancellation_shortcode_outer ">
						<span class="check_heading">Here is your Cancellation page Shortcode: </span>
						<span id="dynamic_copyable_text" class="d-inline" name="shortcode_display"><?= dapMemberGetCancellationShortcodeNameById($_GET['id']) ?></span>
						<span data-id="dynamic_copyable_text" class="copy-btn theme-button" onclick="dap_member_copy_to_clipboard(this)"><i class="fa fa-files-o" aria-hidden="true"></i> Copy</span>
					</div>
				</div>
			</div>
		</div>
		<div class="form-group row" >
		   <div class="col-sm-12 tab_bottom_button">
			 <a href="<?= admin_url('admin.php?page=dap_member_pages'); ?>"class="btn btn-success theme-btn">Return to Member Pages</a>
			  <button type="button" class="btn btn-success theme-btn create_shortcode_btn">Save</button>
			</div>
		</div>
	</div>
</div>
