<div class="row" >
	<form class="form-horizontal">
		<div class="form-group" style="float:left;padding-left:30px;margin-bottom:0px;">
			<h1 class="page-header">
				Manage App Modules.
			</h1>                        
        </div>        
    </form>
</div>

<div class="row"  style="display:block">
   
    <div class="panel panel-info" >
        <div class="panel-heading">
            <h4 class="panel-title p-heading">Apps</h4>
        </div>
        <div class="panel-body" >
            <table class="table" >
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Modules</th>                                           
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="app in apps |limitTo:pageSize:startFrom">
                        <td>{{app.name}}</td>
                        <td>
                        	<table class="table table-striped">
                        		<tr>
                        			<td>
			                        	<div class="form-group" ng-repeat="module in app.modules">
					                        <label class="col-md-3 control-label">{{module.name}}</label>
					                        <div class="col-md-9">
					                            <div class="checkbox">
					                                <label>
					                                    <input ng-disabled="!module.editable" type="checkbox" value="" ng-model="module.enabled">                                    
					                                </label>
					                            </div>
					                            
					                        </div>
					                    </div>
				                	</td>
				                	<td>
				                		<button class="btn btn-sm btn-primary m-r-5" type="button" ng-click="saveAppModules(app.modules,app._id)" >Save</button>
				                	</td>
			                	</tr>
	                    	</table>
                        </td>
                        
                    </tr>
                    <tr>
                        <td>
                            <button type="button" class="btn btn-primary btn-sm editable-submit" ng-disabled="currentPage == 1" ng-click="currentPage=currentPage-1;startFrom=startFrom-pageSize">
                               <i class="fa fa-2x fa-angle-double-left"></i>
                            </button>
                            <b>{{currentPage}}/{{numberOfPages()}}</b>
                             <button type="button" class="btn btn-primary btn-sm editable-submit" ng-disabled="currentPage >= apps.length/pageSize " ng-click="currentPage=currentPage+1;startFrom=startFrom+pageSize">
                                <i class="fa fa-2x fa-angle-double-right"></i>
                            </button>
                        </td>
                       
                    </tr>                    
                </tbody>
            </table>
            
            
        </div>
    </div>
      
 </div>

 <!-- Dialog  Start-->
