<? global $vis_language; ?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
    <div class="col-sm-6" id="vis_header">
        <h3 class="m-b-xs text-black"><? echo $client_details['first_name'];echo($client_details['email']!='')?' &lt;'.$client_details['email'].'&gt;':''; ?></h3>
        <ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
            <li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME']; ?></a></li>
            <li><a class="link" href="#/client/view_clients/<? echo $vis_language['TXTCLIENTS']; ?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTCLIENTS']; ?>',{'vis_module':'client','vis_operation':'view_clients'});"><? echo $vis_language['TXTCLIENTS']; ?></a></li>
            <li class="active"><? echo $client_details['first_name'];echo($client_details['email']!='')?' &lt; '.$client_details['email'].' &gt;':''; ?></li>
        </ul>
    </div>
    <div class="col-sm-6 text-right text-left-xs m-t-lg">
        <div class="btn-group">
			<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="vh vh-action text-muted"></i> <b class="caret"></b></button>
            <ul class="dropdown-menu dropdown-menu-right text-left">
                <li><a href="javascript:void(0)" onclick="$('#vis_global_msg_div').visExecution('load_operations', {'vis_module':'client', 'vis_operation':'add_pinup', 'vis_client_id':<? echo $client_details['client_id']; ?>});"><? echo $vis_language['TXTADDTOPIN']; ?></a></li>
                <? if($client_details['parent_id']==0){ ?>
                <li><a href="javascript:void(0)" data-toggle="ajaxModal" data-modal-arguments="vis_module=client&vis_operation=get_merge_clients&vis_static_area=vis_client_merge_area&vis_client_email=<? echo $client_details['email']; ?>&vis_client_id=<? echo $client_details['client_id']; ?>&vis_domain_id=<? echo $client_details['domain_id']; ?>"><? echo $vis_language['TKTMRGCLIENT']; ?></a></li>
                <li><a href="javascript:void(0)" data-toggle="ajaxModal" data-modal-arguments="vis_module=client&vis_operation=get_merge_contact&vis_static_area=vis_client_merge_area&vis_client_email=<? echo $client_details['email'];?>&vis_client_id=<? echo $client_details['client_id']; ?>&vis_domain_id=<? echo $client_details['domain_id']; ?>"><? echo $vis_language['TKTMRGCONTACT']; ?></a></li><? } ?>
                <li><a href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=client&vis_operation=new_note&vis_static_area=vis_ticket_note_form&vis_client_id=<? echo $client_details['client_id']; ?>&vis_domain_id=<? echo $client_details['domain_id']; ?>"><? echo $vis_language['TXTNOTEADD']; ?></a></li>
				<li><a href="javascript:void(0)" data-toggle="ajaxModal" data-modal-arguments="vis_module=client&vis_operation=open_custom_email&client_id=<? echo $client_details['client_id']; ?>&vis_client_id=<? echo $client_details['client_id']; ?>&domain_id=<? echo $client_details['domain_id']; ?>&vis_domain=<? echo $client_details['domain_id']; ?>&vis_email=<? echo $client_details['email']; ?>&vis_to_email=<? echo $client_details['email']; ?>&vis_salt=<? echo $client_details['salt']; ?>&is_verified=<? echo $client_details['is_verified']; ?>"><? echo $vis_language['TXTSENDEMAIL']; ?></a>			
				</li>  
				<?if($setting_details!=-1 && $setting_details[0]['content']==1) { ?><li><a href="javascript:void(0)" data-toggle="ajaxModal" data-modal-arguments="vis_module=client&vis_operation=get_additional_emails&vis_static_area=vis_client_merge_area&vis_client_id=<? echo $client_details['client_id']; ?>&vis_domain_id=<? echo $client_details['domain_id']; ?>"><? echo $vis_language['TXTADDITIONALEMAILS']; ?></a></li><? } ?>		
            </ul>
		</div>
	</div>

</section>
<section class="row m-b m-l-none m-r-none b-t b-light">
    <div class="col-md-2">
        <div class="wrapper text-center">
        <? if($client_details['image_path']=='' || $client_details['image_path']=='default.jpg'){?>
<div class="l-avatar m-t-lg m-b-sm">
<? if($client_details['first_name']!=''){
	$firstname=preg_split('//u', $client_details['first_name'], -1, PREG_SPLIT_NO_EMPTY);
$lastname=preg_split('//u', $client_details['last_name'], -1, PREG_SPLIT_NO_EMPTY);
	?>
<div class="lg"><? echo ucfirst($firstname[0]).ucfirst($lastname[0]);?></div>
    <? }else{ ?>
    <img class="lg bg-white img-responsive" src="<?= VIS_PATH_PROFILE.'default.jpg';?>">
    <? }?>

</div>
<? }else{ ?>
<div class="l-avatar m-t-lg m-b-sm">
<img src="<? echo $client_details['domain_url'].'awatar/'.VIS_PATH_PROFILE;  echo $client_details['image_path']; ?>" class="lg bg-white img-responsive">
</div>
<? }?>

            <? /* ?><div class="thumb-lg padder-v m-t-lg avatar m-b-sm">
                <img src="<? //echo $client_details['domain_url'].'awatar/'.VIS_PATH_PROFILE;  echo ($client_details['image_path']=='')?'default.jpg':$client_details['image_path']; ?>" class="bg-white img-responsive ">
            </div> <? */ ?>
             <div>
				 <? if( $client_details['is_banned']==1 ) ?>
				 <span id="ban_label" class="label vh-danger-bg inline"><? echo $vis_language['TXTBANNED']; ?></span>
				 <?if($client_details['is_banned']!=1 && $client_details['is_spam']!=1 )?>
				 <span id="approve_label" class="<?if($client_details['is_approved']==1){ echo "label vh-green-bg inline"; }else{ echo "label label-default inline";}?> "><?if($client_details['is_approved']==1){ echo $vis_language['TXTAPPROVED']; }else {echo $vis_language['TXTPENDING'];}?></span>
				 <? if($client_details['is_banned']!=1 && $client_details['is_spam']==1 ) ?>
				 <span id="spam_label" class="label vh-grey-bg inline"><? echo $vis_language['TXTSPAM']; ?></span>
			</div>
        </div>
        <div class="text-center">
			 <? 
				$last_character = substr( $client_details['domain_url'], -1 );
				if($last_character=='/') { 
					$domain_url = $client_details['domain_url'];
				} else{
					if($last_character=='\\'){
						$regex = "/\\+$/";
						$domain_url = preg_replace($regex, "/", $client_details['domain_url']);
					}else{
						$domain_url = $client_details['domain_url'].'/';
					}
				}
			 ?>
			 <a class="btn btn-link link" href="<? echo $domain_url;?>index.php?vis_email=<? echo str_replace('+','%2B',$client_details['email']); ?>&vis_salt=<? echo $client_details['salt']; ?>" target="_blank" ><? echo$vis_language['TXTLOGINASCLIENT']; ?></a>
		</div>
    </div>
    <div class="col-md-6" id="short_summary"><? include(VIS_PATH_TEMPLATE.'client_short_summary.php');?></div>
    <div class="col-md-4 m-t">
        <div class="row">
            <div class="col-xs-6 m-t-xl">
                <div class="form-group  m-t-xl" id="ban_status">
                    <label class="col-xs-10 col-md-6 m-l-n control-label"><? echo $vis_language['TXTBAN']; ?></label>
                    <div class="col-sm-2">
                        <label class="switch">
                        <input type="checkbox" onchange=<?if(VIS_CLIENT_BANNED_ACCESS==1){?> "$('#ban_status').visExecution('load_area', {'vis_module':'client', 'vis_operation':'ban_client', 'vis_client_id':<? echo $client_details['client_id']; ?>, 'vis_remove_ban':<? echo  $client_details['is_banned']==1?1:0; ?>, 'vis_static_area':'vis_client_delete_form'});" <?}else{?> "check_access();" <?} if($client_details['is_banned']==1) echo 'checked="checked"';?>>
                        <span></span>
                        </label>
                    </div>
                </div>
                <div class="clearfix"></div>
                <div class="form-group" id="spam_status">
                    <label class="col-xs-10 col-md-6 m-l-n control-label"><? echo $vis_language['TXTSPAM'];?></label>
                    <div class="col-sm-2">
                        <label class="switch">
                        <input type="checkbox" onchange=<?if(VIS_CLIENT_MANAGE_ACCESS==1){?> "$('#spam_status').visExecution('load_area', {'vis_module':'client', 'vis_operation':'toggle_spam', 'vis_client_id':<? echo $client_details['client_id']; ?>, 'vis_static_area':'vis_client_delete_form', 'vis_spam':<? echo ($client_details['is_spam']==0)?'1':'0'?>});"<?}else{?> "check_access();" <?} if($client_details['is_spam']) echo 'checked="checked"';?>>
                        <span></span>
                        </label>
                    </div>
                </div>
                <div class="clearfix"></div>
                <div class="form-group" id="approve_status">
                    <label class="col-xs-10 col-md-6 m-l-n control-label"><? echo $vis_language['TXTAPPROVE']; ?></label>
                    <div class="col-sm-2">
                        <label class="switch">
                        <input type="checkbox" onchange=<?if(VIS_CLIENT_MANAGE_ACCESS==1){?> "$('#approve_status').visExecution('load_area', {'vis_module':'client', 'vis_operation':'client_approval', 'vis_client_id':<? echo $client_details['client_id']; ?>, 'vis_approve':<? echo $client_details['is_approved']==1?0:1; ?>});" <?}else{?> "check_access();" <?} if($client_details['is_approved']) echo 'checked="checked"';?>>
                        <span></span>
                        </label>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="col-xs-6 m-t-md">
                <div class="pull-right">
					<input type="hidden" name="clientStatus" id="clientStatus">
				    <? if(VIS_MODULE_ACCESS_BILLING==1 && $client_details['parent_id']==0) { ?>
                    <p><a class="btn btn-default btn-sm btn-block vis_add_balance" href="javascript:void(0);" onclick="(document.getElementById('clientStatus').value==1)?check_client_status('vis_add_balance'):showError('vis_add_balance')"><? echo $vis_language['TXTADDBALANCE']; ?></a></p>
                    <? } ?>
                    <p><button type="button" class="btn btn-default btn-sm btn-block vis_add_ticket" onclick="(document.getElementById('clientStatus').value==1)?check_client_status('vis_add_ticket'):showError('vis_add_ticket')" ><? echo $vis_language['TXTADDTICKET']; ?></button></p>
                    <? if($client_details['parent_id']==0){
						   if(VIS_MODULE_ACCESS_BILLING==1 ) { ?>
                    <p><a class="btn btn-default btn-sm btn-block vis_add_invoice" href="javascript:void(0)"  onclick="(document.getElementById('clientStatus').value==1)?check_client_status('vis_add_invoice'):showError('vis_add_invoice')" ><? echo $vis_language['TXTADDINVOICE']; ?></a></p>
                      <? } ?>
                    <p><a class="btn btn-default btn-sm btn-block vis_add_contact" href="javascript:void(0)" onclick="(document.getElementById('clientStatus').value==1)?check_client_status('vis_add_contact'):showError('vis_add_contact')"><? echo $vis_language['TXTADDCONTACT']; ?></a></p>
                    <? } ?>
                    <p>
                        <? /* if($client_details['email']!=''){ ?><button type="button" class="btn vh-success-bg  btn-sm btn-block reset_password" onclick="(document.getElementById('clientStatus').value==1)?check_client_status('reset_password'):showError('reset_password')"><? echo $vis_language['TXTRESETPASSWORD']; ?></button><? }else{ ?><a class="btn vh-success-bg btn-sm btn-block reset_password_call_client" href="javascript:void(0)" onclick="(document.getElementById('clientStatus').value==1)?check_client_status('vis_add_reset_pass'):showError('vis_add_reset_pass')"><? echo $vis_language['TXTRESETPASSWORD']; ?></a><? }*/ ?>
                        <?php /*<a class="btn btn-default btn-sm btn-block" href="javascript:void(0)" data-toggle="ajaxModal" data-modal-arguments="vis_module=client&vis_operation=open_custom_email&client_id=<? echo $client_details['client_id']; ?>&vis_client_id=<? echo $client_details['client_id']; ?>&domain_id=<? echo $client_details['domain_id']; ?>&vis_domain=<? echo $client_details['domain_id']; ?>&vis_email=<? echo $client_details['email']; ?>&vis_to_email=<? echo $client_details['email']; ?>&vis_salt=<? echo $client_details['salt']; ?>&is_verified=<? echo $client_details['is_verified']; ?>"><? echo $vis_language['TXTSENDEMAIL']; ?></a> */ ?>
                        
                    </p>
					 <p>
                      
					   <a class="btn vh-success-bg btn-sm btn-block reset_password_call_client" href="javascript:void(0)" data-toggle="ajaxModal" data-modal-arguments="vis_module=client&vis_operation=open_custom_reset_pass&client_id=<? echo $client_details['client_id']; ?>&vis_client_id=<? echo $client_details['client_id']; ?>&domain_id=<? echo $client_details['domain_id']; ?>&vis_domain=<? echo $client_details['domain_id']; ?>&vis_email=<? echo $client_details['email']; ?>&vis_to_email=<? echo $client_details['email']; ?>&vis_salt=<? echo $client_details['salt']; ?>&is_verified=<? echo $client_details['is_verified']; ?>"><? echo $vis_language['TXTRESETPASSWORD']; ?></a>
                        
                        
                    </p>
                    <p><a class="btn vh-danger-bg  btn-sm btn-block vis_delete_client" href="javascript:void(0);" data-toggle="ajaxModal" data-modal-arguments="vis_module=client&vis_operation=get_client_delete&vis_static_area=vis_client_delete_form&vis_client_id=<? echo $client_details['client_id']; ?>"><? echo $vis_language['TXTDELETE']; ?></a></p>
                </div>
            </div>
        </div>
        <!-- /.wrapper -->
    </div>
</section>
<section class="padder">
    <section class="panel panel-default">
		    <form class="form-horizontal" role="form" id="vis_child_client_form" name="vis_child_client_form" method="post">
        <header class="panel-heading text-right bg-light clear">
            <ul class="nav nav-tabs pull-left"  id="tabs">
                <li  id="summary" class="active"><a data-toggle="tab" oncontextmenu="return false;" onclick="$('#vis_details_list').visExecution('load_operations',{'vis_module':'client', 'vis_operation':'get_summary', 'vis_action':'details', 'vis_client_id':<? echo $client_details['client_id']; ?>});set_active_tab('summary');" href="#vis_details_list" ><? echo $vis_language['TXTSUMMARY']; ?></a></li>
                <li id="profile"><a data-toggle="tab" oncontextmenu="return false;" href="#vis_details_list" onclick="$('#vis_details_list').visExecution('load_operations',{'vis_module':'client', 'vis_operation':'get_details', 'vis_action':'details', 'vis_client_id':<? echo $client_details['client_id']; ?>});set_active_tab('profile');"><? echo $vis_language['TXTPROFILE']; ?></a></li>
                <? if($client_details['parent_id']==0){ ?>
                <li id="dept_access"><a data-toggle="tab" oncontextmenu="return false;" href="#vis_details_list" onclick="$('#vis_details_list').visExecution('load_operations',{'vis_module':'client', 'vis_operation':'department_access', 'vis_action':'details', 'vis_client_id':<? echo $client_details['client_id']; ?>, 'vis_domain_id':<? echo $client_details['domain_id']; ?>});set_active_tab('dept_access');"><? echo $vis_language['TXTDEPARTMENTACCESS']; ?></a></li>
                <li id="contact"><a data-toggle="tab" oncontextmenu="return false;" href="#vis_details_list" onclick="$('#vis_details_list').visExecution('load_operations',{'vis_module':'client', 'vis_operation':'get_subaccounts', 'vis_client_id':<? echo $client_details['client_id']; ?>,'vis_contact':1});set_active_tab('contact');"><? echo$vis_language['TXTCONTACTS']; ?></a></li><? } ?>
                <li id="ticket"><a data-toggle="tab" oncontextmenu="return false;" href="#vis_details_list" onclick="$('#vis_details_list').visExecution('load_operations',{'vis_module':'ticket', 'vis_operation':'get_details', 'vis_action':'history', 'vis_client_id':<? echo $client_details['client_id']; ?>, 'vis_parent_id':<? echo $client_details['parent_id']; ?>,'vis_ticket':1});set_active_tab('ticket');"><? echo $vis_language['TXTTICKETS']; ?></a></li>
                 <? if(VIS_MODULE_ACCESS_BILLING==1 && $client_details['parent_id']==0) { ?>
<!--
                <li id="order"><a data-toggle="tab"   href="#vis_details_list" onclick="$('#vis_details_list').visExecution('load_operations',{'vis_module':'billing', 'vis_operation':'get_orders', 'vis_client_id':<? echo $client_details['client_id']; ?>,'vis_order':1});set_active_tab('order');"><? echo $vis_language['TXTORDERS']; ?></a></li>
-->
                <li id="product"><a data-toggle="tab" oncontextmenu="return false;" href="#vis_details_list" onclick="$('#vis_details_list').visExecution('load_operations',{'vis_module':'billing', 'vis_operation':'client_products_list', 'vis_client_id':<? echo $client_details['client_id']; ?>,'vis_product':1});set_active_tab('product');"><? echo $vis_language['TXTPRODUCTS']; ?></a></li>
                <li id="invoice"><a data-toggle="tab" oncontextmenu="return false;" href="#vis_details_list" onclick="$('#vis_details_list').visExecution('load_operations',{'vis_module':'billing', 'vis_operation':'get_invoices', 'vis_client_id':<? echo $client_details['client_id']; ?>,'vis_invoice':1});set_active_tab('invoice');"><? echo $vis_language['TXTINVOICES']; ?> <? if($unpaid_invoice_cnt['cnt']>0){ ?><span style="display: inline-block;" class="badge badge-sm up vh-danger-bg count" id="vis_unpaid_invoice_count"><?= $unpaid_invoice_cnt['cnt']; ?></span><? } ?></a></li>
                <li id="transaction"><a data-toggle="tab" oncontextmenu="return false;" href="#vis_details_list" onclick="$('#vis_details_list').visExecution('load_operations',{'vis_module':'billing', 'vis_operation':'get_transactions_list', 'vis_client_id':<? echo $client_details['client_id']; ?>, 'vis_headerd':true,'vis_transaction':1});set_active_tab('transaction');"><? echo $vis_language['TXTTRANSACTIONS']; ?></a></li>  <? } ?>
				<?php if(VIS_ITIL==1 && (isset($module['itil']) && $module['itil']==1)){?>
				<li id="itil_ci"><a data-toggle="tab" oncontextmenu="return false;" href="#vis_details_list" onclick="$('#vis_details_list').visExecution('load_operations',{'vis_module':'client', 'vis_operation':'get_ci_list', 'vis_client_id':<? echo $client_details['client_id']; ?>});set_active_tab('itil_ci');"><? echo $vis_language['TXTCI']; ?></a></li>
				<?php }?>
            </ul>
           <!-- <span class="hidden-sm dropdown">
                              <a data-toggle="dropdown" href="#action">--><i class="fa"></i> <!--<b class="caret"></b></a>-->
                              <!--<ul class="dropdown-menu dropdown-menu-right text-left">
                                <li><a href="javascript:void(0)" data-toggle="ajaxModal" data-modal-arguments="vis_module=client&vis_operation=get_merge_clients&vis_static_area=vis_client_merge_area&vis_client_id=<? echo $client_details['client_id']; ?>&vis_domain_id=<? echo $client_details['domain_id']; ?>"><? echo $vis_language['TKTMRGCLIENT']; ?></a></li>
                                <li><a href="javascript:void(0)" data-toggle="ajaxModal" data-modal-arguments="vis_module=client&vis_operation=get_merge_contact&vis_static_area=vis_client_merge_area&vis_client_id=<? echo $client_details['client_id']; ?>&vis_domain_id=<? echo $client_details['domain_id']; ?>"><? echo $vis_language['TKTMRGCONTACT']; ?></a></li>
                              </ul>-->
                          <!--  </span>-->
        </header>
        <div class="panel-body">
			<div class="tab-content">
				<div id="vis_details_list" class="tab-pane active">
                    <div id="summary" class="tab-pane active">
                        <div class="col-md-12">
                            <div class="row">
                                <div class="wrapper">
                                    <div class="bg-light b-a">
                                        <h4 class="b-b b-2x m-t-n-xxs padder padder-v"><?= $vis_language['TXTTICKETS'];?></h4>
                                        <div class="rnd">
                                            <ul class="lg">
                                                <li id="new_cnt"><h4>0</h4><p> <? echo $vis_language['TXTNEW']; ?></p></li>
                                                <li id="overdue_cnt"><h4>0</h4><p><? echo $vis_language['TXTOVERDUE']; ?></p></li>
                                                <li id="assigned_cnt"><h4>0</h4><p> <? echo $vis_language['TXTSELFASSIGNED']; ?></p></li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                             <? if($client_details['parent_id']==0 && VIS_MODULE_ACCESS_BILLING==1){?>
                            <div class="row">
                                <div class="wrapper">
                                    <div class="bg-light b-a">
                                        <h4 class="b-b b-2x m-t-n-xxs padder padder-v"><?= $vis_language['TXTBILLING'];?></h4>
                                        <div class="rnd">
                                            <ul class="lg">
                                                <li id="total_unpaid_cnt"><h4>0</h4><p><? echo $vis_language['TXTUNPAID']; ?></p></li>
                                                <li id="total_overdue_cnt"><h4>0</h4><p> <? echo $vis_language['TXTOVERDUE']; ?></p></li>
                                                <li id="total_new_cnt"><h4>0</h4><p><? echo $vis_language['TXTNEW']; ?></p></li>
                                                <li id="today_due_cnt"><h4>0</h4><p> <? echo stripslashes($vis_language['TXTTODAYSDUE']); ?></p></li>
                                                <li id="today_paid_cnt"><h4>0</h4><p> <? echo stripslashes($vis_language['TXTTODAYSPAID']); ?></p></li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div><? } ?>
                      </div>
                    </div>
					<script>$('#vis_details_list').visExecution('load_operations',{'vis_module':'client', 'vis_operation':'get_summary', 'vis_action':'details', 'vis_client_id':<? echo $client_details['client_id']; ?>});</script>
				</div>
			</div>
			</div>
		</form>
    </section>
</section>
<script>
	$( document ).ready(function() {
		<? if($subaccount_details['count']<=0){ ?>
		$("li#contact").css('display','none');
		<?} else {?>
			$("li#contact").css('display','block');
		<? } if($ticket_details['count']<=0){?>
		$("li#ticket").css('display','none');
		<?} else {?>
			$("li#ticket").css('display','block');
		<? }  if($orders['count']<=0){ ?>
		$("li#order").css('display','none');
		<?} else {?>
			$("li#order").css('display','block');
		<? } if($client_product['count']<=0){ ?>
			$("li#product").css('display','none');
		<?} else {?>
			$("li#product").css('display','block');
		<? }  if($invoices['count']<=0){?>
			$("li#invoice").css('display','none');
		<?} else {?>
			$("li#invoice").css('display','block');
		<? }  if($transactions['count']<=0){?>
		$("li#transaction").css('display','none');
		<?} else {?>
			$("li#transaction").css('display','block');
		<? } ?>
		get_client_status();

});
    $(".selectpicker").selectpicker();
    function active_invoice(email)
    {
		$("#transaction").removeClass("active");
		$("#invoice").addClass("active");
		$('#vis_details_list').visExecution('load_operations',{'vis_module':'billing', 'vis_operation':'get_invoices', 'vis_client_id':<? echo $client_details['client_id']; ?>,'vis_email_id':email,'vis_transaction':1});
	}
	function active_invoice_tab()
    {
		$("li#invoice").css('display','block');
		var active = $("#tabs .active").attr( "id");
		$("#"+active).removeClass("active");
		$("#invoice").addClass("active");
		$('#vis_details_list').visExecution('load_operations',{'vis_module':'billing', 'vis_operation':'get_invoices', 'vis_client_id':<? echo $client_details['client_id']; ?>});
	}
	function active_contact_tab()
    {
		$("li#contact").css('display','block');
		var active = $("#tabs .active").attr( "id");
		$("#"+active).removeClass("active");
		$("#contact").addClass("active");
		$('#vis_details_list').visExecution('load_operations',{'vis_module':'client', 'vis_operation':'get_subaccounts', 'vis_client_id':<? echo $client_details['client_id']; ?>});
	}
    function set_active_tab(tab_id){
        var active = $("#tabs .active").attr("id");
        $("#"+active).removeClass("active");
        $("#"+tab_id).addClass("active").show();
        var parent_div = $("#vis_details_list").parent().parent();
        if($("#vis_child_client_form #tabs #contact.active").length
        || $("#vis_child_client_form #tabs #ticket.active").length
        || $("#vis_child_client_form #tabs #dept_access.active").length
        || $("#vis_child_client_form #tabs #order.active").length || $("#vis_child_client_form #tabs #product.active").length || $("#vis_child_client_form #tabs #invoice.active").length || $("#vis_child_client_form #tabs #transaction.active").length)
            parent_div.addClass("p-l-none").addClass("p-r-none");
        else parent_div.removeClass("p-l-none").removeClass("p-r-none");
    }
    function check_access()
	{
		   $("#vis_global_msg_div").visInterface("load_global_message", "<?php echo  $vis_language['MSGACCSSDND'] ;?>");
		   return false;
	}
	function check_client_status(linkClassName)
	{
		
		if(linkClassName!='reset_password') { $('.'+linkClassName).attr('data-toggle','ajaxModal'); }
		switch(linkClassName) 
		{
			  case 'vis_add_ticket':
			  $('.vis_add_ticket').attr('data-modal-arguments','vis_module=ticket&vis_operation=new_ticket_step_one&vis_static_area=vis_open_new_dialog&vis_email_id=<?=$client_details['email'];?>&vis_client=1&vis_domain_id=<?=$client_details['domain_id'];?>&vis_current_operation=manage_client_add_ticket&vis_client_id=<?= $client_details['client_id'];?>');
			  break;
			 
			  case 'vis_add_invoice':
			  $('.vis_add_invoice').attr('data-modal-arguments','vis_module=billing&vis_operation=add_invoice&vis_static_area=vis_ticket_invoice_form&vis_client_id=<? echo $client_details['client_id']; ?>');
			  break;
			  
			  case 'vis_add_contact':
			  $('.vis_add_contact').attr('data-modal-arguments','vis_module=client&vis_operation=new_client&vis_static_area=vis_client_add_modal&vis_domain_id=<? echo $client_details['domain_id']; ?>&vis_client_id=<? echo $client_details['client_id']; ?>');
			  break;
			 
			 
			  case 'vis_add_balance':
			  $('.vis_add_balance').attr('data-modal-arguments','vis_module=billing&vis_operation=add_balance&vis_static_area=vis_add_balance_dialog&vis_client_id=<? echo $client_details['client_id']; ?>');
			  break;
			  
			  case 'reset_password':
			  $('#vis_global_msg_div').visExecution('load_operations', {'vis_module':'client', 'vis_operation':'reset_send_password', 'vis_client_id':<? echo $client_details['client_id']; ?>});
			  break;
			  
			  case 'vis_add_reset_pass':
			  $('.vis_add_reset_pass').attr('data-modal-arguments',"vis_module=client&vis_operation=reset_password_call_client&vis_static_area=vis_client_add_modal&vis_client_id=<? echo $client_details['client_id']; ?>");
			   break;
		} 
				
					
				
	}
   function get_client_status()
	{
		$.ajax({
			url: 'index.php',
			data: {'vis_module':"client", 'vis_operation':"client_status_details", 'vis_client_id':'<?=$client_details['client_id'];?>' },
			type: "POST",
			success: function(data) 
			{ 
			
				 $('#clientStatus').val(data);
				
			}
		})
	}
	function showError(linkClassName)
	{
		var data =  $('#clientStatus').val();
		if(linkClassName != '')
		{
			$('.'+linkClassName).removeAttr( "data-toggle" );
			$('.'+linkClassName).removeAttr( "data-modal-arguments" );
		}
		
		if(data == '2')
		{
			$("#vis_global_msg_div").visInterface("load_global_message","<? echo $vis_language['TXTERRORMSGCLIENTSTATUSISUNAPPROVE'];?>");
			return false;
		}
		else if(data == '3'){
			$("#vis_global_msg_div").visInterface("load_global_message","<? echo $vis_language['TXTERRORMSGCLIENTSTATUSISBAN'];?>");
			return false;
		}
		else if(data == '4')
		{
			$("#vis_global_msg_div").visInterface("load_global_message","<? echo $vis_language['TXTERRORMSGCLIENTSTATUSISSPAM'];?>");
			return false;
		}
		else  if(data == '5'){
			$("#vis_global_msg_div").visInterface("load_global_message","<? echo $vis_language['TXTERRORMSGCLIENTSTATUSISNOTVERIFY'];?>");
			return false;
		}
	}
</script>
