<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(!empty($domainDetails)){?>
         <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" >
                           <?  
                              for($i=0; $i<count($domainDetails); $i++) { 
                              	?>
                           <div class="panel panel-default" >
                              <div class="panel-heading"><a class="accordion-toggle" data-parent="#accordion" data-toggle="collapse" href="#group<?=$domainDetails[$i]['domain']['domain_id']; ?>"  id="vis_toggle_category"><span class="text-sm font-bold sub_header"><? echo $domainDetails[$i]['domain']['domain_name']; ?></span></a>
                                 <button style="display: none;" id="vis_clear_bnt<?=$domainDetails[$i]['domain']['domain_id']; ?>" align="right" onclick="$('#vis_workpanel_div').visExecution('load_area', {'vis_module':'forums', 'vis_operation':'get_all_categories','vis_action':'#/forums/get_all_categories/All category'})" 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<?=$domainDetails[$i]['domain']['domain_id']; ?>" align="right" onclick="update_selected_fields(this,'<?=$domainDetails[$i]['domain']['domain_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 <?  echo ($i==0)?'in':''?> vis_reorder" data-callback="update_link_show(<?=$domainDetails[$i]['domain']['domain_id']; ?>)"id="group<?=$domainDetails[$i]['domain']['domain_id']; ?>" <?  echo ($i==0)?'style="height: auto;"':'style="height: 0px;"'?>>
                                 <? for($j=0; $j<count($domainDetails[$i]['category']); $j++) { ?>
                                 <div class="panel-body category_row sortitem form-group-sm" id="vis_category<? echo $domainDetails[$i]['category'][$j]['forum_cat_id']; ?>">
                                 
                                       <span  class=" sorthandle pull-left m-l-sm m-t-sm faded" ><i class="vh vh-sort"></i> </span>
                                  
                                    <div style="text-align: justify;" class="pull-left col-sm-10">
										<?php if($domainDetails[$i]['category'][$j]['access_type'] == 1) {?><span class="label vh-green-bg inline " id="approve_label" style="display: block">Private</span> <?php } ?>
											<? if(!empty($domainDetails[$i]['category'][$j]['forum']) || $domainDetails[$i]['category'][$j]['forum']!='') {?>
											<a class="link" href="#/forums/forum_list/<? echo str_replace('/', ' ', $domainDetails[$i]['category'][$j]['category_name']); ?>/<? echo $domainDetails[$i]['category'][$j]['forum_cat_id']; ?>"><? echo $domainDetails[$i]['category'][$j]['category_name']; ?></a><? } else {echo $domainDetails[$i]['category'][$j]['category_name'];} ?><br><? echo $domainDetails[$i]['category'][$j]['category_description']; ?>
                                    </div>
                                    <div id="action_linksvis_category<? echo $domainDetails[$i]['category'][$j]['forum_cat_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_category_delete&vis_category_id=<? echo $domainDetails[$i]['category'][$j]['forum_cat_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 forum" data-toggle="ajaxModal" data-modal-arguments="vis_module=forums&vis_operation=add_forum_form&vis_category_id=<? echo $domainDetails[$i]['category'][$j]['forum_cat_id']; ?>&vis_domain=<? echo $domainDetails[$i]['domain']['domain_id']; ?>&cache=true" href="javascript:void(0);" class="text-muted"><i class="vh vh-article-add"></i></a></span> 
                                       <span><a title="Edit"  data-toggle="ajaxModal" data-modal-arguments="vis_module=forums&vis_operation=category_details&vis_category_id=<? echo $domainDetails[$i]['category'][$j]['forum_cat_id']; ?>&cache=true" href="javascript:void(0);" class="text-muted"><i class="vh vh-edit"> </i></a></span>
                                       <form  method="post" id="vis_views_edit_form_<?=$domainDetails[$i]['domain']['domain_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_domain_id" id="vis_domain_id" value="<?=$domainDetails[$i]['domain']['domain_id']; ?>" />
                                       </form>
                                    </div>
                                 </div>
                                 <?  } ?>
                              </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,domainId) {
          var list_value='';
        $("#group"+domainId+" [id^='vis_category']").each( function() {
   		list_value+=$( this ).attr('id')+',';
   	 });
   	
          $('#vis_views_edit_form_'+domainId+'').find('#vis_list_value').val(list_value);
          $(e).visExecution('submit_form',{'vis_module':'forums', 'vis_operation':'update_category_order', 'vis_form':'vis_views_edit_form_'+domainId+''});
           $("#vis_update_bnt"+domainId).css("display","none");
            $("#vis_clear_bnt"+domainId).css("display","none");
      }
      
      function update_link_show(domain_id)
      {
   	$("#vis_update_bnt"+domain_id).css("display","block");
   	$("#vis_clear_bnt"+domain_id).css("display","block");
   }
</script>

