<? global $vis_language;?>
<section class="wapper-lg">
 <div class="padder">
  <div id="breadcrumb" class="row">
   <div class="col-sm-6">
      <h3 class="m-b-xs text-black" ><? echo $vis_language['TXTDRIVE'];?><!--<span id="total_cnt"> (<? echo  $total_cnt; ?>)</span>--></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>
                             	<? if(isset($operation['criteria']) && $operation['criteria'] !='') {echo '<li><a class="link" href="#/solutions/view_drive/'.$vis_language["TXTDRIVE"].'">'.$vis_language["TXTDRIVE"].'</a></li><li class="active">'.$operation['criteria'].'</li>'; }
			else
			{
				echo '<li class="active">'.$vis_language["TXTDRIVE"].'</li>';
			}
			?>
      </ul>
   </div>
   <div class="col-sm-6">
   <div class="m-t-md pull-right">
      <div class="form-inline">
         <div class="form-group aside-xxl">
            <div class="input-group">
               <input class="form-control rounded input-sm" type="text" placeholder="<?php echo $vis_language['TXTSEARCHDRIVE'];?>" value="<?php echo (isset($operation['criteria']))?$operation['criteria']:'';?>" id="search_drive">
             <span class="input-group-btn">
             <button class="btn btn-sm btn-rounded btn-default  btn-icon" type="button" onclick="display_drive();">
             <i class="vh vh-search"></i>
             </button>
             </span>            
            </div>
         </div>
           <div class="form-group">
                <? if(isset($operation['vis_tab'])) {?>
                  <input type="hidden" name="tab" id="tab" value="<?=$operation['vis_tab'];?>"/>
                  <? }else { ?>
              <input type="hidden" name="tab" id="tab" value="1"/><? }
              if((isset($operation['vis_check_id'])&&$operation['vis_check_id']==2)&& (isset($operation['vis_tab'])&&$operation['vis_tab']==3)){?>
            <script>$('#upload_btn').hide();</script>
           <? }elseif(isset($operation['criteria']) && (isset($operation['vis_tab'])&& ($operation['vis_tab']==3 || $operation['vis_tab']==2)))
           {  ?>
               <script>$('#upload_btn').hide();</script>
           <?} else {?><script>$('#upload_btn').show();</script><? } ?>
            <a id="upload_btn" class="btn btn-sm btn-primary btn-rounded" href="javascript:void(0)"  data-toggle="ajaxModal" data-modal-arguments="vis_module=selfhelp&vis_operation=upload_file&cache=true"><i class="vh vh-plus"></i><? echo " Upload"; ?></a>
           </div>         
        </div>
       </div>
   </div>
</div>
</div>
    <?if($drive_info!=''){ ?>
                <div class="row">
                    <div class="col-md-12">
                        <div class="wrapper">
							<div class="wrapper b-a b-light bg-white animated fadeInDown">
								<div class="pull-right">
									<a id="view" class="btn btn-icon" data-toggle="class:list-view" href="#drive-view">
										<i class="vh vh-grid-square text-active"></i>
										<i class="vh vh-bars text"></i>
									</a>
								</div>
								 
								<div class="btn-group m-b-xs">
									<a class="rtpcls btn btn-sm btn-rounded btn-default <? if(isset($operation['vis_tab'])){if(isset($operation['vis_tab']) && $operation['vis_tab']==1){?>btn-primary<? }?> <? }else{ if(!isset($operation['criteria']) && $operation['criteria']==''){?>btn-primary<? }}?> " onclick="$('#mydrive_overview_div').visExecution('load_operations', {'vis_module':'selfhelp', 'vis_operation':'view_drive', 'vis_action': 'no_load','vis_tab':'1' });set_tab(1);" ><? echo $vis_language['TXTALLFILE']; ?></a>  
								</div>
      
   <!--   <div class="btn-group m-b-xs">
			       <a class="rtpcls btn btn-sm btn-rounded btn-default <? if(isset($operation['vis_tab']) && $operation['vis_tab']==4){?>btn-primary<? }?>" onclick="$('#mydrive_overview_div').visExecution('load_operations', {'vis_module':'selfhelp', 'vis_operation':'view_drive', 'vis_action': 'no_load','vis_tab':'4'});set_tab(4);"   ><? echo $vis_language['TXTPUBLIC']; ?></a>  
			   </div>-->
			   
			   <div class="btn-group m-b-xs">
			       <a class="rtpcls btn btn-sm btn-rounded btn-default <? if(isset($operation['vis_tab']) && $operation['vis_tab']==5){?>btn-primary<? }?>" onclick="$('#mydrive_overview_div').visExecution('load_operations', {'vis_module':'selfhelp', 'vis_operation':'view_drive', 'vis_action': 'no_load','vis_tab':'5'});set_tab(5);" ><? echo $vis_language['TXTMYFILE']; ?></a>  
			   </div>
              <div class="btn-group m-b-xs">
			       <a class="rtpcls btn btn-sm btn-rounded btn-default <? if(isset($operation['vis_tab']) && $operation['vis_tab']==2 ){?>btn-primary<? }?>" onclick="$('#mydrive_overview_div').visExecution('load_operations', {'vis_module':'selfhelp', 'vis_operation':'view_ticket_attachments', 'vis_action': 'no_load','vis_tab':'2'});set_tab(2);" ><? echo $vis_language['TXTTICKETATTACHMENTS']; ?></a>  
			   </div>
						<?php if($gcal_details!='' && $gcal_details['is_enabled']!=0 && ($gcal_details['admin_user']!='' && $gcal_details['admin_user']!=0))
						{ ?>
				<div class="btn-group m-b-xs">
					<a class="rtpcls btn btn-sm btn-rounded btn-default 
							<? if(isset($operation['vis_tab'])){if(isset($operation['vis_tab']) && $operation['vis_tab']==3)
							{?> btn-primary<? }?> <? } else { ?> <?  }?> "  
								<? if($gcal_details!=-1 && $gcal_details['is_enabled']==1){ 
										if(isset($authUrl))	{
										$url=$authUrl; 
										?>href="<? echo $url."&state=2"; ?>" <? 
										}else{
												?> onclick="$('#mydrive_overview_div').visExecution('load_operations', {'vis_module':'selfhelp', 'vis_operation':'get_file_list', 'vis_action': 'no_load','vis_tab':'3' });set_tab(3);"
									<?	} }?>
												onclick="$('#mydrive_overview_div').visExecution('load_operations', {'vis_module':'selfhelp', 'vis_operation':'get_file_list', 'vis_action': 'no_load','vis_tab':'3' }); set_tab(3);" style="text-transform: capitalize"; ><? echo $vis_language['TXTGOOGLEDRIVE']; ?>
										</a>
			</div>
					<? }?>
          
					<?php if($dropbox_details!='' && $dropbox_details['is_enabled']!=0)
						{ ?>
							<div class="btn-group m-b-xs">
								<?if($_SESSION['code_dropbox']=='') {?>  
									<a class="rtpcls btn btn-sm btn-rounded btn-default <? if(isset($operation['vis_tab']) && $operation['vis_tab']==6){?>btn-primary<? }?>" href="https://www.dropbox.com/1/oauth2/authorize?client_id=<?php echo $dropbox_details['admin_user'];?>&response_type=code&redirect_uri=<?php echo $dropbox_details['billing_url']; ?>&state=6" style="text-transform: capitalize";><? echo "Dropbox"; ?></a>  
							<? }else{?>
								<a class="rtpcls btn btn-sm btn-rounded btn-default <? if(isset($operation['vis_tab']) && $operation['vis_tab']==6){?>btn-primary<? }?>" onclick="$('#mydrive_overview_div').visExecution('load_operations', {'vis_module':'selfhelp', 'vis_operation':'dropbox_details', 'vis_action': 'no_load','vis_tab':'6'});" ><? echo "Dropbox"; ?></a>  
							<? }?>
							</div>
					<?  }?>
			   <!-- <div class="btn-group m-b-xs">                                                                                                 
			<?if($_SESSION['code_box']=='') {?>  
			<a class="rtpcls btn btn-sm btn-rounded btn-default <? if(isset($operation['vis_tab']) && $operation['vis_tab']==7){?>btn-primary<? }?>" href="https://account.box.com/api/oauth2/authorize?client_id=<?php echo $box_details['admin_user'];?>&response_type=code&redirect_uri=<?php echo $box_details['billing_url']; ?>&state=7" ><? echo "Box"; ?></a>  
			<? }else{?>
				   <a class="rtpcls btn btn-sm btn-rounded btn-default <? if(isset($operation['vis_tab']) && $operation['vis_tab']==7){?>btn-primary<? }?>" onclick="$('#mydrive_overview_div').visExecution('load_operations', {'vis_module':'selfhelp', 'vis_operation':'box_details', 'vis_action': 'no_load','vis_tab':'7'});" ><? echo "Box"; ?></a>  
			<? }?>
			  </div>-->
 
		  </div>	 
		</div>
    </div>
</div>
				<div class="m-t-n-lg" id="mydrive_overview_div">
						<? if($operation['vis_tab']==2){
						include(VIS_PATH_TEMPLATE.'ticket_attachments_list.php');
						}else if($operation['vis_tab']==3){
						include(VIS_PATH_TEMPLATE.'gdrive_file_list.php');
						}else{
						include(VIS_PATH_TEMPLATE.'mydrive_list.php');
						}?>
				</div>
</section>
</div>
</div>
</section>
<? }else
   {
    include(VIS_PATH_TEMPLATE.'no_record_yet.php');
   }
?>
<script>
   $('.rtpcls').click(function() {
   $('.rtpcls').removeClass('btn-primary');
			$(this).addClass('btn-primary');
  });
		
   function set_tab(id)
   {   if(id==3 || id==6 ||id==2)
	   {
		   $('#upload_btn').hide(); 
	   }
	   else
	   {
		   $('#upload_btn').show();
	   }
	   document.getElementById("tab").value=id;
   }
</script>
