<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 Modules.
			</h1>
            From this page user can manage the application modules for SDK.
            <p>
        </div>        
    </form>
</div>

<div class="row"  style="display:block">
   
    <div class="panel panel-info" >
        <div class="panel-heading">
            <h4 class="panel-title p-heading">Modules</h4>
        </div>
        <div class="panel-body" >
            <table class="table table-striped" >
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Version</th>                            
                        <th>FileName</th>
                        <th>Archt.</th>
                        <th>Platform</th>
                        <th>Platform Version</th>
                        <th>Url</th>                        
                        <th></th>
                        
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="module in modules |limitTo:pageSize:startFrom">
                        <td>{{module.name}}</td>
                        <td>{{module.version}}</td>
                        <td>{{module.filename}}</td>
                        <td>{{module.arch}}</td>
                        <td>{{module.platform}}</td>
                        <td>{{module.pv}}</td>
                        <td>{{module.url}}</td>
                        <td>{{module.enabled}}</td>
                        <td style="text-align:right;">
                            <button type="button" class="btn btn-primary btn-sm editable-submit" ng-click="editModule(module)" href="#modal-dialog" data-toggle="modal">
                            <i class="fa fa-edit"></i>
                            </button>
                            <button type="button" class="btn btn-danger btn-sm editable-submit" ng-click="deleteModule(module._id)">
                            <i class="fa fa-minus"></i>
                            </button>
                        </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 >= modules.length/pageSize " ng-click="currentPage=currentPage+1;startFrom=startFrom+pageSize">
                                <i class="fa fa-2x fa-angle-double-right"></i>
                            </button>
                        </td>
                        <td colspan="8" style="text-align:right;">
                            <a type="button" class="btn btn-primary btn-sm editable-submit" href="#/mod/app/view">Manage App Modules</a>
                        
                        
                            <button type="button" class="btn btn-primary btn-sm editable-submit" href="#modal-dialog" data-toggle="modal">Add New</button>
                        </td>
                    </tr>                    
                </tbody>
            </table>
            
            
        </div>
    </div>
      
 </div>

<!-- Dialog  Start-->
<div class="modal fade" id="modal-dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">Add/Edit Module</h4>
            </div>
            <div class="modal-body">
                
                <form class="form-horizontal">
                    <div class="form-group">
                        <label class="col-md-3 control-label">Name</label>
                        <div class="col-md-9">
                            <input type="text" placeholder="Module name" class="form-control" ng-model="name">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-3 control-label">Filename</label>
                        <div class="col-md-9">
                            <input type="text" placeholder="File name" class="form-control" ng-model="filename">
                        </div>
                    </div>
                     <div class="form-group">
                        <label class="col-md-3 control-label">Version</label>
                        <div class="col-md-9">
                            <input type="text" placeholder="Version" class="form-control" ng-model="version">
                        </div>
                    </div>
                     <div class="form-group">
                        <label class="col-md-3 control-label">Arch</label>
                        <div class="col-md-9">
                            <input type="text" placeholder="Arch" class="form-control" ng-model="arch">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-3 control-label">Platform</label>
                        <div class="col-md-9">
                            <select class="form-control" ng-model="platform">
                                <option value="Android">Android</option>
                                <option value="iOS">iOS</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-3 control-label">Platform Version</label>
                        <div class="col-md-9">
                            <input type="text" placeholder="Platform Version" class="form-control" ng-model="pv">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-3 control-label">Url</label>
                        <div class="col-md-9">
                            <input type="text" placeholder="File Url" class="form-control" ng-model="url">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-3 control-label">Editable</label>
                        <div class="col-md-9">
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" value="" ng-model="editable">                                    
                                </label>
                            </div>
                            
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-3 control-label">Enable All</label>
                        <div class="col-md-9">
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" value="" ng-model="enableall">                                    
                                </label>
                            </div>
                            
                        </div>
                    </div>
                   
                </form>                                       
            
            </div>
            <div class="modal-footer">
                <button class="btn btn-sm btn-primary m-r-5" type="button" ng-click="saveModule()" ng-show="!editMode" data-dismiss="modal">Save</button>
                <button class="btn btn-sm btn-primary m-r-5" type="button" ng-click="updateModule()" ng-show="editMode" data-dismiss="modal">Update</button>
                <button class="btn btn-sm btn-primary m-r-5" type="button" ng-click="cancel()" data-dismiss="modal">Cancel</button>
               
            </div>
        </div>
    </div>
</div>
<!-- Dialog  End-->

