<?  global $vis_language;
    $operations = array ( 0 => $vis_language['TXTADDEDARTICLE'], 1 => $vis_language['TXTCOMMENTSUB'] );	?>
            <section class="hbox stretch">
                <section>
                    <section class="vbox">
                        <section class="padder">
							<section class="row m-b-md">
							<div class="col-sm-6">
							  <h3 class="m-b-xs text-black"><? echo $vis_language['TXTDASHBOARD'];?></h3>
							  <small><? echo $vis_language['TXTWELCOME'].', '.$staffDetails[0]['initials']." ".$staffDetails[0]['first_name']." ".$staffDetails[0]['last_name'];?> </small>
							</div>
							<?php if(VIS_AGENT_AVALABILITY==1 && $roundrobin_details!=-1) { ?>
							<div class="col-sm-6 text-right text-left-xs m-t-xl">
							  <a href="#/home/change_available_agent_setting" onclick ="$('#vis_workpanel_div').visExecution('load_area', {'vis_module':'home', 'vis_operation':'change_available_agent_setting', 'vis_status_filter':1})" class="m-b-xs link"><? echo $vis_language['TXTAVILABLEAGENTS'];?>
							  <span id="agent_cnt" class="badge vh-success-bg"><? echo $agent_count;?></span></a>
							</div><? } ?>
						  </section>
						 <? if(VIS_ITIL==1 && (isset($module['itil']) && $module['itil']==1)){?>
						 <div class="wrapper clear">
							<div class="row">
							  <div class="col-md-12 bg-white">
								<section class="panel btn-inactive portlet-item m-b-n">
								  <div class="row m-t-xs m-b-xs">
								  <div class="col-md-3 b-r">
									<a href="#/problem/filter_problem/<?=$vis_language['TXTPROBLEMS'];?>/8" class="block padder-v hover">
										  <i class="vh-over-base vh vh-4x vh-problem-management vh-red pull-left m-r-sm"></i>
									  <span class="clear">
										<span class="h3 block m-t-xs" id="problems_cnt">0</span>
										<small class="text-muted text-u-c"><? echo $vis_language['TXTPROBLEMS']; ?></small>
									  </span>
									</a>
								  </div>
								  <div class="col-md-3 b-r">
									<a href="#/changes/filter_changes/<?=$vis_language['TXTCHANGES'];?>/12" class="block padder-v hover">
										  <i class="vh-over-base vh vh-4x vh-change-management vh-brown  pull-left m-r-sm"></i>
									  <span class="clear">
										<span class="h3 block m-t-xs" id="changes_cnt">0</span>
										<small class="text-muted text-u-c"><? echo $vis_language['TXTCHANGES']; ?></small>
									  </span>
									</a>
								  </div>
								  <div class="col-md-3 b-r">
									<a href="#/releases/filter_releases/<?=$vis_language['TXTRELEASES'];?>/16" class="block padder-v hover">
										  <i class="vh-over-base vh vh-4x vh-release-management vh-green pull-left m-r-sm"></i>
									  <span class="clear">
										<span class="h3 block m-t-xse" id="releases_cnt">0</span>
										<small class="text-muted text-u-c"><? echo $vis_language['TXTRELEASES']; ?></small>
									  </span>
									</a>
								  </div>
								  <div class="col-md-3">
									<a href="#/ticket/filter_ticket/<?=$vis_language['TXTTICKET'];?>/20" class="block padder-v hover">
										  <i class="vh-over-base vh vh-4x vh-service-category vh-yellow  pull-left m-r-sm"></i>
									  <span class="clear">
										<span class="h3 block m-t-xs" id="service_request_cnt">0</span>
										<small class="text-muted text-u-c"><? echo $vis_language['TXTITILSERVICEREQUEST']; ?></small>
									  </span>
									</a>
								  </div>
								</div>
								</section>
							  </div>
							</div>
						  </div>
						 <? } ?>
						<div class="clear m-b">
						<div class="col-md-6 bg-white" id="tickets">
							<section class="panel btn-inactive bg-empty portlet-item">
							  <div class="row m-t-xs m-b-n-xxs">
							  <div class="col-md-6 b-b b-r">
								<a class="block padder-v hover" href="#/ticket/filter_ticket/Tickets/2">
								   <span class="vh-over vh-over-2x pull-left m-r-sm">
									  <i class="vh-over-base vh vh-ticket"></i>
									  <i class="over vh-inverse vh vh-round md bottom"></i>
									  <i class="over new vh vh-round bottom"></i>
								  </span>
								  <span class="clear">
									<span class="h3 block m-t-xs" id="new_cnt">0</span>
									<small class="text-muted text-u-c"><? echo $vis_language['TXTNEW']; ?></small>
								  </span>
								</a>
							  </div>
							  <div class="col-md-6 b-b">
								<a class="block padder-v hover" href="#/ticket/filter_ticket/Tickets/3">
								 <span class="vh-over vh-over-2x pull-left m-r-sm">
									  <i class="vh-over-base vh vh-ticket"></i>
									  <i class="over vh-inverse vh vh-round md bottom"></i>
									  <i class="over overdue vh vh-round bottom"></i>
								  </span>
								  <span class="clear">
									<span class="h3 block m-t-xs" id="overdue_cnt">0</span>
									<small class="text-muted text-u-c"><? echo $vis_language['TXTOVERDUE']; ?></small>
								  </span>
								</a>
							  </div>
							  <div class="col-md-6 b-r">
								<a class="block padder-v hover" href="#/ticket/filter_ticket/Tickets/4">
								   <span class="vh-over vh-over-2x pull-left m-r-sm">
									  <i class="vh-over-base vh vh-ticket"></i>
									  <i class="over assigned vh vh-round md bottom"></i>
									  <i class="over vh-inverse vh vh-user bottom"></i>
								  </span>
								  <span class="clear">
									<span class="h3 block m-t-xs" id="assigned_cnt">0</span>
									<small class="text-muted text-u-c"><? echo $vis_language['TXTASSIGNED']; ?></small>
								  </span>
								</a>
							  </div>
							  <div class="col-md-6">
								<a class="block padder-v hover" href="#/ticket/filter_ticket/Tickets/7">
								 <span class="vh-over vh-over-2x pull-left m-r-sm">
									  <i class="vh-over-base vh vh-ticket"></i>
									  <i class="over draft vh vh-round md bottom"></i>
									  <i class="over vh-inverse vh vh-pencil bottom"></i>
								  </span>
								  <span class="clear">
									<span class="h3 block m-t-xs" id="draft_cnt">0</span>
									<small class="text-muted text-u-c"><? echo $vis_language['TXTDRAFT']; ?></small>
								  </span>
								</a>
							  </div>
							</div>
							</section>
						</div>
                      <div class="col-md-6 dk">
                          <section>
                            <header class="panel-heading m-b-n-xs">
                              <strong> <? echo $vis_language['TXTCLIENTS']; ?></strong>
                            </header>
                            <div class="panel-body">
                                <div class="list-group m-n no-radius no-border alt">
                                  <!--<a class="list-group-item bg-empty" href="#/client/approved_client/<? echo $vis_language['TXTAPPROVED']; ?>">
                                    <span class="badge vh-success-bg" id="registered_cnt">0</span>
                                   <? echo $vis_language['TXTAPPROVED']; ?>
                                  </a>-->
                                  <a class="list-group-item bg-empty" href="#/client/unapproved_client/<? echo $vis_language['TXTUNAPPROVED']; ?>">
                                    <span class="badge vh-info-bg" id="unregistered_cnt">0</span>
                                    <? echo $vis_language['TXTUNAPPROVED']; ?>
                                  </a>
                                  <a class="list-group-item bg-empty" href="#/client/banned_client/<? echo $vis_language['TXTBANNED']; ?>">
                                    <span class="badge vh-danger-bg" id="banned_cnt">0</span>
                                     <? echo $vis_language['TXTBANNED']; ?>
                                  </a>
                                  <a class="list-group-item bg-empty" href="#/client/spam_client/<? echo $vis_language['TXTSPAM']; ?>">
                                    <span class="badge vh-success-bg" id="spam_cnt">0</span>
                                   <? echo $vis_language['TXTSPAM']; ?>
                                  </a>
                                </div>
                            </div>
                          </section>
                        </div> 
                        <? $class=(VIS_MODULE_ACCESS_TASK==1)?"col-md-6 bg-light dker":"col-md-12 bg-light dker";?>
                           <div class='<?=$class;?>'>
	                      <section class="panel btn-inactive bg-empty portlet-item">
                            <header class="panel-heading">
                              <strong><? echo $vis_language['TXTNEXTOVERDUETICKETS']; ?></strong>
                            </header>
                            <div class="panel-body">
                             <!-- rnd -->
                             <div class="rnd">
                               <ul class="md text-center">
                                 <li id="overdue_count_within30"><a><h4>0</h4></a><p><? echo $vis_language['TXTTHIRTYMINUTES']; ?></p></li>
                                 <li id="overdue_count_within60"><a><h4>0</h4></a><p><? echo $vis_language['TXTSIXTYMINUTES']; ?></p></li>
                                 <li id="overdue_count_within_1day"><a><h4>0</h4></a><p><? echo $vis_language['TXTONEDAY']; ?></p></li>                                 
                               </ul>
                             </div>
                             <!-- / rnd -->
                            </div>
                      </section>
                      </div>
                      <?if(VIS_MODULE_ACCESS_TASK==1){?>
                      <div class="col-md-6 bg-white">
                          <section class="panel btn-inactive bg-empty portlet-item">
                            <header class="panel-heading">
                              <strong><? echo $vis_language['TXTTASKS']; ?></strong>
                            </header>
                            <div class="panel-body">
                                 <!-- rnd -->
                                 <div class="rnd">
                                   <ul class="md text-center">
                                       <li id="quick_view4"><a><h4>0</h4></a><p><? echo $vis_language['TXTINPROGRESS']; ?></p></li>
                                       <li id="quick_view3"><a><h4>0</h4></a><p><? echo $vis_language['TXTSELFASSIGNED']; ?></p></li>
                                       <li id="quick_view5"><a><h4>0</h4></a><p><? echo $vis_language['TXTOVERDUE']; ?></p></li>
                                   </ul>
                                 </div>
                                 <!-- / rnd -->
                            </div>
                          </section>
                        </div>
                  </div> <?}?> 
                            <section class="scrollable wrapper" id="vis_recent_activities">
                                <script>  $('#vis_recent_activities').visExecution('load_area', {'vis_module':"home", 'vis_operation':'load_home_counts'}); </script>
                            </section>
                        </section>
                    </section>
                </section>
               
            </section>
<? 
    function generateUniqueHexColors($quantity=10){
    if($quantity >= (254*254*254)){ 
    return false;
    }
    $colors = array();
    $quantity = (intval($quantity) == 0)? 1 : intval($quantity);
    for($i=0; $i<$quantity; $i++){
    	$color = sprintf("%02X%02X%02X", mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
    	while( in_array($color, $colors) ){
    		$color = sprintf("%02X%02X%02X", mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
    	}
    	$colors[] = "#".$color;
    }
    return $colors;
    }
    ?>
<script>
    function displayblab(staffId)
    {
    	$('.onlineuserCls').hide();
    	$('#online_'+staffId).show();
    }
    $('.onlineuserLI').mouseleave(function(){
    	$('.onlineuserCls').hide();
    });
    function displayDel(pinId)
    {
    	$('.pinItemCls').hide();
    	$('#pin_'+pinId).show();
    }
    $('.pinItemLI').mouseleave(function(){
    	$('.pinItemCls').hide();
    });
    function load_more_recent_activities(page){
	$.post("index.php?vis_module=home&vis_operation=load_more_recent_activities&vis_tmpst="+new Date().getTime(),{'vis_page': page}, function(data) {
		$("#load_more_activities").last().remove();
		$("#vis_recent_activities").last().append(data);
	});
}
</script>

