<?  global $vis_language;
	function vis_show_subcategories($confi_item_details,$call) {
		for($i=0;$i<count($confi_item_details);$i++) { 
				$ci_type .='<option value="'.$confi_item_details[$i]['item_id'].'">'.$confi_item_details[$i]['name'].'</option>';
				if(isset($confi_item_details[$i]['subcat']) && $confi_item_details[$i]['subcat']!=NULL) { 
					$ci_type .= vis_show_subcategories($confi_item_details[$i]['subcat'],'sub_cat'); 
				}
			}
		return $ci_type;
	}
?>
<!--<div class="modal-dialog">
	<form method="post" role="form" class="form-horizontal" name="vis_export_assets_form" id="vis_export_assets_form">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
            <h4 class="modal-title"><? echo $vis_language['TXTEXPORT'].' '.$vis_language['TXTASSETS']; ?></h4>
        </div>
        <div id="parent_list" class="modal-body">
            <div class="row">
                <div class="col-sm-12">
                <section id="test" class="scrollable wrapper">
                <div class="row m-b">
                <div class="col-md-12">
                <div class="form-group">
                   <div class="col-sm-6">
                   <select class="form-control selectpicker" data-size="auto" data-container="body" name="vis_ci_type" id="vis_ci_type" <? if(count($confi_item_details) > 10) echo 'data-live-search="true"' ?>>
						<option value="0"><?=$vis_language['TXTITILSELECTCITYPE']?></option>
						<?php 
							echo vis_show_subcategories($confi_item_details,'');
						?>
                      </select>
                   </div>
                   <div class="col-sm-3"></div>
                </div>
                <div class="form-group" id="vis_show_amt_balance">
                    <div class="col-sm-12">
                        <div id="configuration_item"></div>                        
                    </div>
                </div>
			  
              </div>
              </div>
              </section>
              
              </div>
            </div>
        </div>
        <div class="modal-footer">
			<a class="btn btn-default" data-dismiss="modal"><? echo $vis_language['TXTCANCEL']; ?></a>
            <a onclick="export_assets();" class="btn btn-primary" name="vis_submit"><? echo $vis_language['TXTEXPORT']; ?></a>
        </div>
        <input type="hidden" value="true" name="vis_export">
        <input type="hidden" name="vis_module" id="vis_module" value="cmdb" /> 
        <input type="hidden" name="vis_operation" id="vis_operation" value="export_assets" />         
    </div>
    </form>
</div>-->





<? global $vis_language;?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
    <div class="col-sm-6">
        <h3 class="m-b-xs text-black"><? echo $vis_language['TXTASSETS']; ?></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="#/setting/setting_menu/<? echo $vis_language['TXTSETTINGS'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module','<? echo $vis_language['TXTSETTINGS'];?>',{'vis_module':'setting','vis_operation':'setting_menu'});"><?echo $vis_language['TXTSETTINGS'];?></a></li>
        <li><a class="link" href="#/cmdb/assets/<? echo $vis_language['TXTCMDB']; ?>" onclick="$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTCMDB'];?>', {'vis_module':'cmdb', 'vis_operation':'assets'});"> <? echo $vis_language['TXTCMDB']; ?></a></li>
		 <li class="active"><? echo $vis_language['TXTEXPORT']; ?> </li>
      </ul>
    </div>
</section>
<section class="padder">
    <section class="panel panel-default">
        <header class="panel-heading sub_header"><?=$vis_language['TXTEXPORT']?></header>
        <div class="panel-body">
			<form method="post" role="form" class="form-horizontal" name="vis_export_assets_form" id="vis_export_assets_form">
		  <div class="form-group m">
			   <label class="col-sm-2 control-label p-d-sm"><? echo $vis_language['TXTCITYPE']; ?></label>
			   <div class="col-sm-10">
				  <select class="form-control selectpicker" data-size="auto" data-container="body" name="vis_ci_type" id="vis_ci_type" <? if(count($confi_item_details) > 10) echo 'data-live-search="true"' ?>>
						<option value="0"><?=$vis_language['TXTITILSELECTCITYPE']?></option>
						<?php 
							echo vis_show_subcategories($confi_item_details,'');
						?>
                  </select>
			   </div>
			</div>
        <input type="hidden" value="true" name="vis_export">
        <input type="hidden" name="vis_module" id="vis_module" value="cmdb" /> 
        <input type="hidden" name="vis_operation" id="vis_operation" value="export_assets" />
           <div class="b-2x b-t m-b-md"></div>
				<div class="col-sm col-sm-offset-2">
			    <a onclick="export_assets();" class="btn btn-primary" name="vis_submit"><? echo $vis_language['TXTEXPORT']; ?></a>
				</div>
				</form>
				</div>
    </section>
</section>
<script type="text/javascript">
$('.selectpicker').selectpicker();	
function export_assets(){
		var citype = $("#vis_ci_type").val();
		if(citype=='0'){
			$("#vis_global_msg_div").visInterface("load_global_message", "<?= $vis_language['TXTITILPLZSELECTCITYPE'];?>");
		}else{
			var data = {'vis_assets_id':citype};  
			$.ajax({
				url: 'index.php?vis_module=cmdb&vis_operation=get_assets&vis_assets_id='+citype+'',
				data: data,
				type: "POST",
				success: function(data) {
					if(data=='false')
					{
						$("#vis_global_msg_div").visInterface("load_global_message", "<?= $vis_language['TXTNORECORDFOUND'];?>");
					}else{
						//$(".modal").modal("toggle"); 
						$('#vis_export_assets_form').submit();
					}
				},
				error: function(xhr, ajaxOptions, thrownError) {$("#vis_global_msg_div").visInterface("load_global_message", "Error: "+xhr.status+" - "+thrownError);}
			});
			
		}
}	
</script>

