{$ADMIN_HEADER}
<div id="content" class="setdiv">
<div id="full-contentdiv">
<div class="righttop">
<h2 align="center">
Add/Renew Subscription of {$username}
</h2>
</div>
<div class="whole-page clear">
<!-- Place your content here -->
{if $IsEdit eq 'yes'}
{assign var="action" value="update"}
{else}
{assign var="action" value="insert"}
{/if}
<div id="pgdiv" style="display:none;">
<center>
<table id='tblcustomloader' name='tblcustomloader' class='borderless' cellpadding='0' cellspacing='5' border='0' style=''>
<tr>
<td>
<img src='{$ADMIN_IMAGE_DIR}/DBRestoreloader.gif' alt='' title=''>
</td>
<td valign='middle'>
<label> Please wait while your request is being processed...</label>
</td>
</tr>
</table>
</center>
</div>
<form method="post" name="frmusersubscription" action="admin_user_subscription_m.php?action={$action}&from={$from}">
<input type="hidden" name="productid" id="productid" value="">
<input type="hidden" name="userid" id="userid" value="{$lsuserid}">
<input type="hidden" name="redirect" id="redirect" value="{$lsredirect}">
<div class="formformat">
<table border="0" width="90%" align="center" cellspacing="0" cellpadding="0" >
<tbody>
<tr>
<td class="right-side-text" style="width: 200px;">
<label>Membership Type </label>
<label class="star">*</label>
<div class="FieldLabelNote"/>
</td>
<td class="left-side-text">
<table border="0" align="left" class="borderless" cellspacing="0" cellpadding="0" id="table1">
{section name=product loop=$products}
<tr>
<td>
<input type="radio" value="{$products[$smarty.section.product.index].id}" id="{$products[$smarty.section.product.index].id}" style="vertical-align:middle;" name="products" {if $post.products eq $products[$smarty.section.product.index].id } checked
{/if} onclick="javascript:document.getElementById('productid').value={$products[$smarty.section.product.index].id};getdata_admin_user_subscription();">
</td>
<td style="padding-left:5px;">
<label for="{$products[$smarty.section.product.index].id}">{$products[$smarty.section.product.index].name} (${$products[$smarty.section.product.index].price|string_format:"%.2f"})</label>
</td>
</tr>
{/section}
</table>
<span style="text:align:center;border:0px;padding-bottom:10px;color:red;display:none;" id="errorspn">{if $msg neq ''}<br/>{$msg}<br/><br/>{/if}</span>
</td>
</tr>
<tr id="tr1" style="display:none;">
<td class="right-side-text" style="width: 200px;">
<div style="margin-bottom:5px"><label>From Date</label></div>
</td>
<td class="left-side-text">
<div style="margin-bottom:5px"><span id="spnformdate"> </span><span id="fromdate"><input type="hidden" name="hdnfromdate" id="hdnfromdate" value=""></span></div>
</td>
</tr>
<tr id="tr2" style="display:none;">
<td class="right-side-text" style="width: 200px;">
<div style="margin-bottom:5px"><label>Upto Date </label></div>
</td>
<td class="left-side-text">
<div style="margin-bottom:5px"><span id="spnuptodate"> </span><span id="uptodate"><input type="hidden" name="hdnuptodate" id="hdnuptodate" value=""></span></div>
</td>
</tr>
<tr id="tr5" style="display:none;">
<td class="right-side-text" style="width: 200px;">
<label>Is Life Time </label>
</td>
<td class="left-side-text">
<input type="checkbox" disabled="" checked=""><span id="Islifetime"><input type="hidden" name="hdnislifetime" id="hdnislifetime" value="0"></span>
</td>
</tr>
<tr id="tr3" style="display:none;">
<td class="right-side-text" style="width: 200px;">
<div style="margin-bottom:5px"><label>Price</label> </div>
</td>
<td class="left-side-text">
<div style="margin-bottom:5px"><span id="spnprice"> </span><input type="hidden" name="price" id="price" value=""></div>
</td>
</tr>
<tr id="tr4" style="display:none;">
<td class="right-side-text" style="width: 200px;">
<div style="margin-bottom:5px"><label>Payment Method</label></div>
</td>
<td class="left-side-text">
<div style="margin-bottom:5px"><label> <span id="spnprice">N/A</span> </span></div>
</td>
</tr>
<tr>
<td class="right-side-text"> </td>
<td class="left-side-text">
<div id="buttonid" style="float:left"><input class="btndisabled" type="submit" id="save" disabled name="save" {if $IsEdit eq 'yes'}value="Save"{else}value="Submit"{/if} onclick=""></div>
<div id="buttonid1" style="display:none;float:left;"><input class="btncss" type="submit" id="save" name="save" {if $IsEdit eq 'yes'}value="Save"{else}value="Submit"{/if} onclick=""></div>
<input class="btncss" type="button" name="btnBack" value="Cancel" onclick="javascript:Formsubmit();">
</td>
</tr>
</tbody>
</table>
</div>
</form>
</div>
</div>
{literal}
<script language="JavaScript" type="text/javascript">
var $j = jQuery.noConflict();
function getdata_admin_user_subscription()
{
var dataString = 'userid='+ $j('#userid').val() + '&productid=' + $j('#productid').val() ;
var web_url='{/literal}{$WEB_URL}{literal}';
$j.ajax({
type: "POST",
url: web_url+"/includes/getdata_admin_user_subscription.php",
datatype: 'html',
data: dataString,
success: function(msg){
msg=ltrim(rtrim(msg));
var mySplitResult = msg.split("[||]");
if(mySplitResult[0]=='no')
{
$j('#tr5').hide();
$j('#spnemailavailablelink').html(mySplitResult[2]);
$j('#spnformdate').html(mySplitResult[2]);
$j('#hdnfromdate').val(mySplitResult[3]);
$j('#tr1').show();
$j('#spnuptodate').html(mySplitResult[4]);
$j('#hdnuptodate').val(mySplitResult[5]);
$j('#tr2').show();
}
else if(mySplitResult[0]=='yes')
{
$j('#Islifetime').html(mySplitResult[2]);
$j('#tr1').hide();
$j('#tr2').hide();
$j('#tr5').show();
}
$j('#tr3').show();
$j('#tr4').show();
$j('#spnprice').html(mySplitResult[1]);
$j('#productid').val(0);
$j('#buttonid').hide();
$j('#buttonid1').show();
$j('#pgdiv').hide();
}
});
}
$j(document).ajaxStart($j.blockUI).ajaxStop($j.unblockUI);
var msg='{/literal}{$msg}{literal}';
if(msg!='')
{
document.getElementById('table1').style.display='none';
document.getElementById('errorspn').style.display='';
}
function Formsubmit()
{
document.frmusersubscription.action='admin_user_subscription_m.php?action=cancel';
//document.getElementById('hdn_UpdatefromPaygear').value="Update from Paygear";
document.frmusersubscription.submit();
}
if(msg=='')
{
var frmvalidator = new Validator("frmusersubscription");
frmvalidator.EnableMsgsTogether();
frmvalidator.addValidation("products","selone_radio","Please select product.");
}
</script>
{/literal}
</div>
{$ADMIN_FOOTER}