<section class="overlay" ng-if="showCreateModal" ng-click="closeCreateModal()"></section>

<section data-ng-controller="ListFormsController as ctrl" data-ng-init="findAll()" class="container">
	<br>
	<div class="row">
		<div ng-click="openCreateModal()" class="col-xs-6 col-xs-offset-3 col-sm-4 col-sm-offset-1 col-md-3 col-md-offset-1 form-item create-new">
			<div class="title-row col-xs-12">
				<h4 class="fa fa-plus fa-6"></h4>
			</div>
			<div class="col-xs-12 details-row">
				
				<small class="list-group-item-text">
					Create a new form
				</small>

			</div>	
		</div>

		<form name="forms.createForm" class="col-xs-6 col-xs-offset-3 col-sm-4 col-sm-offset-1 col-md-3 col-md-offset-1 form-item create-new new-form" ng-if="showCreateModal">
			<div class="title-row row">
				    <div class="col-xs-5 field-title text-left"> Name </div>
				    <div class="col-xs-12 field-input">
						<input type="text" name="title" required ng-model="formTitle" ng-pattern="/^[a-zA-Z0-9 \-.]*$/" ng-minlength="4"/>
				    </div>
			</div>
			<div class="details-row row">			
			    <div class="col-xs-5 field-title text-left"> Language </div>
			    <div class="col-xs-12 field-input">
				    <div class="button custom-select">
						<select style="color:black;" name="language" required ng-model="formLanguage" ng-init="formLanguage = user.language">
							<option ng-repeat="language in languages" value="{{language}}">
								{{language}}
							</option>
				        </select>      
				    </div>
			    </div>
			</div>
			<div class="details-row submit row">			
			    <div class="col-xs-12 field-title text-center">
			    	<button class="btn btn-primary" ng-disabled="forms.createForm.$invalid" ng-click="createNewForm()">
			    		Create Form
			    	</button>
			    </div>
			</div>		
		</form>

		<div data-ng-repeat="form in myforms" class="col-xs-6 col-xs-offset-3 col-sm-4 col-sm-offset-1 col-md-3 col-md-offset-1 form-item container">

			<div class="row">
				<span class="pull-right"> 
					<i style="cursor:pointer;" class="fa fa-trash-o" ng-click="removeForm($index)"></i>
					<i style="cursor:pointer;" class="fa fa-files-o" ng-click="duplicateForm($index)"></i>
				</span>
			</div>

			<div class="row">
			<a data-ng-href="#!/forms/{{form._id}}/admin/create"  class="title-row col-xs-12">
				<h4 class="list-group-item-heading" data-ng-bind="form.title"></h4>
			</a>
			</div>

			<div class="row footer">
				<div class="col-xs-12 details-row">
					
					<small class="list-group-item-text">
						Created on
						<span data-ng-bind="form.created | date:'shortDate'"></span>
					</small>
						<!--by
						<span data-ng-bind="form.admin.username"></span>
					</small> -->

				</div>
			</div>
		</div>
	</div>
</section>