<section id="vis_workpanel" class="vbox">
   <section class="scrollable" id="vis_workpanel_div" style="display: block;">
      <section class="row m-b m-l m-r" id="breadcrumb">
         <? include_once(VIS_PATH_TEMPLATE.'forum_header.php'); ?>
      </section>
      <section class="col-lg-12">
         <div style="display:none;" id="vis_filter_list" class="wrapper bg-white clr"></div>
      </section>
      <div class="col-lg-12">
		    <?  if($forumData!=-1){
            ?>
         <section class="panel panel-default">
            <div id="view_action" class="row wrapper clr">
               <header class="col-sm-12">
                  <div class="pull-right" id="pg_1">
                     <!--/ pagging -->
                  </div>
                  <div class="pull-right">
                     <ul class="m-n footer_link">
                     </ul>
                  </div>
                  <!--/ .pull-right -->
                  <div id="tkt_left_menu">
                  </div>
               </header>
            </div>
            <div id="vis_ticket_list" class="table-responsive scroll-x">
               <div role="grid" class="wrapper" id="wrapper">
                  <div class="row vertical-top">
                     <div class="col-md-12  text-default">
                        <div class="panel-group" id="accordion">
                         
                           <div class="panel panel-default">
                              <div class="panel-heading"><span class="text-sm font-bold sub_header"><?
                             echo $forumData[0]['category_name']; ?></span>
                             <button style="display: none;" id="vis_clear_bnt<?=$forumData[0]['forum_cat_id']; ?>" align="right" onclick="$('#vis_workpanel_div').visExecution('load_area', {'vis_module':'forums', 'vis_operation':'forum_list','vis_action':'#/forums/forum_list/<?=str_replace('/', ' ', $forumData[0]['category_name'])?>/<?=$forumData[0]['forum_cat_id']?>'})" class="btn btn-default btn-xs  m-r-lg align-right pull-right vis_update_bnt_class" type="button"><? echo $vis_language['TXTCANCEL']; ?></button>
                            
                              <button  style="display: none;" id="vis_update_bnt<?=$forumData[0]['forum_cat_id']; ?>" align="right" onclick="update_selected_fields(this,'<?=$forumData[0]['forum_cat_id']; ?>');" class="btn btn-primary btn-xs  m-r-sm align-right pull-right vis_update_bnt_class" type="button"><? echo $vis_language['TXTUPDATE']; ?></button></div>
                              <div class="panel-collapse collapse in vis_reorder " data-callback="update_link_show(<?=$forumData[0]['forum_cat_id']; ?>)" id="group<?=$forumData[0]['forum_cat_id']; ?>" style="height: auto;">
                              
                                 <? for($i=0; $i<count($forumData); $i++) { ?>
                                 <div class="panel-body forim_group-sm category_row sortitem" id="vis_forums<? echo $forumData[$i]['forum_id'] ?>" >
                                  <span  class="sorthandle pull-left m-t m-l-sm" ><i class="vh vh-sort"></i> </span>
                                    <div style="text-align: justify;" class="col-sm-10 pull-left">
										<? if(!empty($forumData[$i]['topic_count']) || $forumData[$i]['topic_count']!='') {?>
										<a class="link" href="#/forums/get_topic_list/<? echo str_replace('/', ' ', $forumData[$i]['domain_name']); ?> : <? echo str_replace('/', ' ', $forumData[$i]['category_name']); ?> : <? echo str_replace('/', ' ', $forumData[$i]['forum_title']); ?>/<? echo $forumData[$i]['forum_id']; ?>"><? echo $forumData[$i]['forum_title']; ?></a>
										<? } else { echo $forumData[$i]['forum_title']; }?>
                                    <br><? echo $forumData[$i]['description']; ?></div>
                                    <div id="action_linksvis_forums<? echo $forumData[$i]['forum_id']; ?>" style="display: none;" class="pull-right col-sm-1 m-t-sm">
                                
                                    <span><a title="Delete"   data-modal-arguments="vis_module=forums&vis_operation=get_delete_forum&vis_static_area=vis_forum_delete_confirm&vis_forum_id=<? echo $forumData[$i]['forum_id']; ?>&vis_forum_category=<? echo $forumData[$i]['forum_cat_id']; ?>&vis_domain=<? echo $forumData[$i]['domain_id']; ?>&vis_static_area=conform_delete_form&vis_form=vis_client_form" data-toggle="ajaxModal" href="javascript:void(0);" class="text-muted"><i class="vh vh-delete-round"></i></a> </span>
                                   
                                    <span>
										<a title="Add Topic" onclick="$('#vis_workpanel_div').visExecution('load_module','Add forum topic',{'vis_module':'forums','vis_operation':'add_forum_topic','vis_category':<? echo $forumData[$i]['forum_cat_id']; ?>,'vis_forum_id':<? echo $forumData[$i]['forum_id']; ?>,'vis_domain':<? echo $forumData[$i]['domain_id']; ?>})" href="javascript:void(0);" id="vis_topic"><i class="vh vh-article-add"></i></a>	
										</span><span><a title="Edit"  data-toggle="ajaxModal" data-modal-arguments="vis_module=forums&vis_operation=forum_details&vis_forum_id=<? echo $forumData[$i]['forum_id']; ?>&cache=true" href="javascript:void(0);" class="text-muted"><i class="vh vh-edit"> </i></a> </span>
                                        
                                   </div>
                                 </div>
                                 
                                 <?  } ?>
                                 <form  method="post" id="vis_forum_list_form_<?=$forumData[0]['forum_cat_id'];?>" name="vis_views_edit_form" method="post">
										<input type="hidden" name="vis_list_value" id="vis_list_value" value="0" />
			                            <input type="hidden" name="vis_category_id" id="vis_category_id" value="<?=$forumData[0]['forum_cat_id']; ?>" />
										</form>
                              </div>
                           </div>
                           
                        </div>
                     </div>
                  </div>
               </div>
               <script>
                  $(".selectpicker").selectpicker();
                     
               </script>
            </div>
            <!--  <footer class="wrapper panel-footer bg-white">
               <div class="pull-right" id="pg_1">
                  <!--/ pagging 
               </div>
               </footer> -->
         </section>
      </div>
      <section style="display:none;" id="vis_no_record_search" class="fullFrame m-n"></section>
        <?php }
         else
         {
			include(VIS_PATH_TEMPLATE.'no_record_yet.php');
         } ?>
      <script></script>
      <script src="../scripts/dropdown_dropup.js"></script>
   </section>
</section>
<script src="<?= VIS_PATH_SCRIPT; ?>jquery.vSort.min.js"></script>
<script type="text/javascript">
	function show_update(domain_id)
	{
		if($('#group'+domain_id).hasClass('collapse in') == false){
			$(".vis_update_bnt_class").css("display","none");
		 $("#vis_update_bnt"+domain_id).css("display","block");
	    }
	    else
	    { $(".vis_update_bnt_class").css("display","none");
		}
	}
	
   $(".category_row").hover(
     function () {
     var id=this.id;
     	$("#action_links"+id).css("display","block");
     	
     });
     $(".category_row").mouseleave(
     function () {
     var id=this.id;
     	$("#action_links"+id).css("display","none");
     
   });
    function update_selected_fields(e,categoryId) {
        var list_value='';
	     $("#group"+categoryId+" [id^='vis_forums']").each( function() {
			list_value+=$( this ).attr('id')+',';
		 });
		
        $('#vis_forum_list_form_'+categoryId+'').find('#vis_list_value').val(list_value);
        $(e).visExecution('submit_form',{'vis_module':'forums', 'vis_operation':'update_forum_order', 'vis_form':'vis_forum_list_form_'+categoryId+''});
        $("#vis_update_bnt"+categoryId).css("display","none");
		$("#vis_clear_bnt"+categoryId).css("display","none");
    }
    function update_link_show(categoryId)
    {
		$("#vis_update_bnt"+categoryId).css("display","block");
		$("#vis_clear_bnt"+categoryId).css("display","block");
	}
	
</script>

