File: /home/barbeatleanalyti/public_html/mbaris.beatleanalytics.com/assets/survey/assets/company_name.php
<script type="text/javascript">
jQuery(document).ready(function()
{
jQuery("#check_company").on('click', function()
{
var company_name = jQuery('#company_name').val();
if(company_name != ''){
jQuery.ajax({
type: "post",
url: "<?php echo admin_url('admin-ajax.php'); ?>",
data: ({'action':'my_ajax_function', 'company_name':company_name}),
dataType: "json",
success: function(response)
{
if(response.SUCCESS)
{
jQuery("#success_msg").text('Congratulations, the '+company_name+' is available!');
jQuery("#success_message").show();
jQuery("#fail_message").hide();
//jQuery("#company_name").prop('disabled', true);
jQuery("#cname").val(company_name);
jQuery("#company_name").val("");
jQuery("#check_company").text("Check Again");
}
else
{
jQuery("#fail_message").show();
jQuery("#success_message").hide();
}
}
});
}
});
jQuery('input[name="package_type"]').on('click', function(){
var package_val = jQuery('input[name="package_type"]:checked').val();
var package_amount = jQuery('input[name="package_type"]:checked').attr('amount')
if(package_val != '' && package_amount != ''){
jQuery('input[name="item_name"]').val(package_val);
jQuery('input[name="amount"]').val(package_amount);
}
});
});
function changeName(){
var company_name = jQuery('#cname').val();
var cid = jQuery('#cid').val();
jQuery.ajax({
type: "post",
url: "<?php echo admin_url('admin-ajax.php'); ?>",
data: ({'action':'cf_change_name', 'company_id': cid , 'company_name':company_name}),
dataType: "json",
success: function(response)
{
if(response.SUCCESS)
{
window.location = '?company_review=true&cid='+cid;
}
}
});
return false;
}
</script>
<link href="<?php echo plugins_url('company/css/company_package.css', dirname(__FILE__)); ?>" rel="stylesheet" />
<div class="col-sm-12 registerf">
<div class="col-sm-2 step"> <i class="glyphicon glyphicon-search active"></i> <span class="active">1. Name Check</span> </div>
<!--<div class="col-sm-2"> <i class="glyphicon glyphicon-registration-mark"></i> <span >2. Enter E-mail & SIC Code</span> </div> -->
<div class="col-sm-2 step"> <i class="glyphicon glyphicon-list-alt"></i> <span >2. Select Package</span> </div>
<!--<div class="col-sm-2"> <i class="glyphicon glyphicon-envelope"></i> <span>3. Address Services</span> </div> -->
<div id="bc-checkout" class="col-sm-2 step"> <i class="glyphicon glyphicon-shopping-cart"></i> <span>3. Checkout</span> </div>
<div class="col-sm-2 step"> <i class="glyphicon glyphicon-file"></i> <span>4.Enter Company Details</span> </div>
</div>
<form onSubmit="return false;" method="post" name="company_check" id="company_check">
<input type="hidden" name="cid" id="cid" value="<?php echo $_GET['cid']; ?>" />
<input type="hidden" name="cname" id="cname" value="" />
</h4> </h4>
<div class="form" style="float:left; width:100%; margin-bottom:30px; padding-left:16px;">
<div class="col-sm-2"></div><div class="col-sm-10">
<div class="part-input-left" >
<h3 class="ih-title no-link">Company Name</h3>
<input class="zan-dc-input" type="text" id="company_name" name="q" placeholder="Enter your new company name" style="color: #333333; height:35px;" >
</div>
<div class="part-input-right" >
<h3 class="ih-title no-link"> </h3>
<a href="javascript:void(0);" name="check_company" class="ih-price-btn btn check has-link hover-effect-crossing " id="check_company">Check</a>
</div>
<div>
<div id="success_message" style="display:none; color:green">
<div id="success_msg">Congratulations, Company name is available!</div>
<br><br>
<a href="#" onclick="return changeName();" class="btn btn-success" >Upadate Company Name </a>
</div>
<div id="fail_message" style="display:none; color:red">Company already registered. Please choose another name.</div>
</div>
</div>
</form>
</div>