<template name="profile">
  {{> sAlert}}
	<div class="noScroll">
		<div id="mainpage{{userProfile}}"><h2>Main Page</h2></div>
		<div id="logout2" onclick='document.getElementById("login-buttons-logout").click();'><h2>Logout</h2></div>
		<div id="profWrapper">
			<div id="profPage" style="background-color:{{divColor 'mainColor'}};min-width:{{screen}}{{textColor}}{{loadNew}}">
				<div id="profMainContainer">
					<div id="profTop">
						<img id="profBanner" src='{{banner}}' alt="Banner">
						<img id="profAvatar" src='{{avatar}}' alt="Avatar">
						<div id="motdBox">
							<span class="username">{{username}} - </span>
							<input id="description" class="clickModify restrict" style="color:#fff" value="{{description}}" maxLength="50">
        					<span class="resText">{{restrict 'description'}}</span>
						</div>
					</div>
					<div id="profCards">
						<div id="cardColLeft">
							<!-- Card 1 -->
							<div id="profInfo" class="card" style="background-color:{{divColor 'secondaryColor'}}">
								<h3 class="profHea">About</h3>
								<div id="about">
									<div class="prefWrapper">
										<p class="profTitle">School Name:</p>
										<div id="school" class="clickModify dropdown" tabindex="1">
						                    <span>{{school}}</span>
						                    <i class="fa fa-caret-down" aria-hidden="true"></i>
						                </div>
						                <div class="optionHolder smallText">
						                    {{#each selectOptions 'school'}}
						                        {{> option}}
						                    {{/each}}
						                </div>
					                </div>
									<br>
									<div class="prefWrapper">
										<p class="profTitle">Graduation Year:</p>
										<div id="grade" class="clickModify dropdown" tabindex="2">
						                    <span>{{grade}}</span>
						                    <i class="fa fa-caret-down" aria-hidden="true"></i>
						                </div>
						                <div class="optionHolder">
						                    {{#each selectOptions 'grade'}}
						                        {{> option}}
						                    {{/each}}
						                </div>
					                </div>
						        </div>
							</div>
							<!-- Card 2 -->
							<div id="profPreferences" class="card" style="background-color:{{divColor 'secondaryColor'}}">
								<h3 class="profHea">Preferences</h3>
								<div id="preferences">
						            <div class="prefWrapper">
					                    <p class="prefTitle">Theme:</p>
					                    <div id="theme" class="clickModify dropdown" tabindex="3">
					                        <span>{{pref 'theme'}}</span>
					                        <i class="fa fa-caret-down" aria-hidden="true"></i>
					                    </div>
					                    <div class="optionHolder">
					                        {{#each selectOptions 'theme'}}
					                            {{> option}}
					                        {{/each}}
					                    </div>
					                </div>
					                <div class="prefWrapper">
					                    <p class="prefTitle">Default Mode:</p>
					                    <div id="mode" class="clickModify dropdown" tabindex="4">
					                        <span>{{pref 'mode'}}</span>
					                        <i class="fa fa-caret-down" aria-hidden="true"></i>
					                    </div>
					                    <div class="optionHolder">
					                        {{#each selectOptions 'mode'}}
					                            {{> option}}
					                        {{/each}}
					                    </div>
					                </div>
					                <div class="prefWrapper">
					                    <p class="prefTitle">Hide Homework:</p>
					                    <div id="timeHide" class="clickModify dropdown" tabindex="5">
					                        <span>{{pref 'timeHide'}}</span>
					                        <i class="fa fa-caret-down" aria-hidden="true"></i>
					                    </div>
					                    <div class="optionHolder">
					                        {{#each selectOptions 'timeHide'}}
					                            {{> option}}
					                        {{/each}}
					                    </div>
					                </div>
					                <div class="prefWrapper">
					                    <p class="prefTitle">Hide Done:</p>
					                    <div id="done" class="clickModify dropdown" tabindex="6">
					                        <span>{{pref 'done'}}</span>
					                        <i class="fa fa-caret-down" aria-hidden="true"></i>
					                    </div>
					                    <div class="optionHolder">
					                        {{#each selectOptions 'done'}}
					                            {{> option}}
					                        {{/each}}
					                    </div>
					                </div>
					                <div class="prefWrapper">
					                    <p class="prefTitle">Hide Reported:</p>
					                    <div id="hideReport" class="clickModify dropdown" tabindex="7">
					                        <span>{{pref 'hideReport'}}</span>
					                        <i class="fa fa-caret-down" aria-hidden="true"></i>
					                    </div>
					                    <div class="optionHolder">
					                        {{#each selectOptions 'hideReport'}}
					                            {{> option}}
					                        {{/each}}
					                    </div>
					                </div>
					            </div>
							</div>
						</div>
						<div id="cardColRight">
							<!-- Card 3 -->
							<div id="profClasses" class="card" style="background-color:{{divColor 'secondaryColor'}};">
								<h3 class="profHea">Classes</h3>
								<div id="classes">
									<div id="profFunctions">
										<div class="profFunction manageClass">
								        	<i class="fa fa-tasks" aria-hidden="true"></i>
								        	<h4 style="color:{{profClassTabColor 'manClass'}}">Manage my Classes</h4>
								      	</div>
								      	<div class="profFunction addClass">
								        	<i class="fa fa-plus" aria-hidden="true"></i>
								        	<h4 style="color:{{profClassTabColor 'addClass'}}">Join a Class</h4>
								      	</div>
								      	<div class="profFunction createClass">
								        	<i class="fa fa-graduation-cap" aria-hidden="true"></i>
								        	<h4 style="color:{{profClassTabColor 'creClass'}}">Create a Class</h4>
								      	</div>
								    </div>
									<div id="profClassInfoHolder">
									{{#if profClassTab "manClass"}}
										<div id="label" class="classBox">
											<span class="name classText">Class Name</span>
											<span class="teacher classText">Teacher</span>
											<span class="hour classText">Hour</span>
											<span class="subscriptions classText">Members</span>
										</div>
										<div class="classHolder">
											{{#each myClasses}}
												{{> classDisplay}}

											{{/each}}
											{{#if noclass}}
												<h3>No results found...</h3>
											{{/if}}
										</div>
									{{/if}}

									{{#if profClassTab "addClass"}}
										<div id="joinTop">
											<i class="fa fa-search" aria-hidden="true"></i>
											{{> inputAutocomplete id="profClassSearch" settings=classSettings placeholder="Search..."}}
											<h4 id="private">Join Private Class</h4>
										</div>
										<div id="label" class="classBox">
											<span class="name classText">Class Name</span>
											<span class="teacher classText">Teacher</span>
											<span class="hour classText">Hour</span>
											<span class="subscriptions classText">Members</span>
										</div>
										<div class="classHolder">
										{{#if notsearching}}
											{{#each classes}}
												{{> classDisplay}}
											{{/each}}
											{{#if noclass}}
												<h3>No results found...</h3>
											{{/if}}
										{{else}} 
											{{#each autocompleteClasses}}
												{{> classDisplay}}
											{{/each}}
											{{#if notfound}}
												<h3>No results found...</h3>
											{{/if}}
										{{/if}}
										</div>
									{{/if}}

									{{#if profClassTab "creClass"}}
										<div id="creRules"><p>Submit a request for a class to be approved by an administrator.</p></div>
										<div id="formContainer">
											<div class="formDiv">
								            	<p class="profTitle">School:</p>
						              			{{> inputAutocomplete settings=schoolComplete class="form-control creInput" 		type="text" name="school" placeholder="Example: International Academy" }}
							              	</div>
							              	<div class="formDiv">
								            	<p class="profTitle">Hour:</p>
								              	<input class="creInput" type="text">
								            </div>
								            <div class="formDiv">
								            	<p class="profTitle">Teacher:</p>
								              	{{> inputAutocomplete settings=teacherComplete class="form-control creInput" type="text" name="teacher" placeholder="Example: Woods" }}
								            </div>
								            <div class="formDiv">
								            	<p class="profTitle">Class Name:</p>
								              	<input class="creInput" type="text">
								            </div>
								            <div class="formDiv">
									            <p class="profTitle">Privacy:</p>
								              	<input id="privacy" class="creInput clickModify dropdown" type="text" readonly>
								                <div class="optionHolder">
								                    {{#each selectOptions 'privacy'}}
								                        {{> option}}
								                    {{/each}}
								                </div>
							              	</div>
							              	<div class="formDiv">
									            <p class="profTitle">Category:</p>
								              	<input id="category" class="creInput clickModify dropdown" type="text" readonly>
								                <div class="optionHolder">
								                    {{#each selectOptions 'category'}}
								                        {{> option}}
								                    {{/each}}
								                </div>
									        </div>
								        </div>
								        <h3 id="creSubmit">Submit Request</h3>
									{{/if}}
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="overlay">
		    <div class="overlayCont" style="background-color:{{divColor 'mainColor'}}">
		     	<p>{{confirmText}}</p>
		     	<div id="faCont">
		     		<i class="fa fa-check-circle-o" aria-hidden="true"></i>
	      			<i class="fa fa-times-circle-o" aria-hidden="true"></i>
	      		</div>
		    </div>
	  	</div>

	  	<div id="createdClasses" style="background-color:{{divColor 'secondaryColor'}};right:{{ownedStatus}}" classid="{{selectedClass '_id'}}">
	  		<h3>{{selectedClass 'name'}}</h3>
	  		<h4 id="codetext">Code:</h4>
	  		<input id="code" value="{{selectedClass 'code'}}" type="text" readonly>
	  		{{#if code}}
				<h4 id="copy">Copy Code</h4>
			{{/if}}
	  		<div id="moderatorCont">
	  			<div class="userAdder">
	  			<h4>Moderators:</h4>
	  			<input class="userAddInput" type="text" placeholder="1234@abc.xyz">
	  			<i class="fa fa-plus" aria-hidden="true"></i>
				</div>
				<div class="userHolder">
		  			{{#each selectedClass 'moderators'}}
		  				{{> userDisplay}}
		  			{{/each}}
		  		</div>
	  		</div>
	  		<div id="bannedCont">
	  			<div class="userAdder">
		  			<h4>Banned:</h4>
		  			<input class="userAddInput" type="text" placeholder="1234@abc.xyz">
		  			<i class="fa fa-plus" aria-hidden="true"></i>
				</div>
				<div class="userHolder">	
		  			{{#each selectedClass 'banned'}}
		  				{{> userDisplay}}
		  			{{/each}}
	  			</div>
	  		</div>
	  		<div id="changeAdmin">
				<span>Change Owner</span>
			</div>
	  		<div id="deleteClass">Delete Class</div>
	  	</div>

	  	<div id="joinPrivClass" style="background-color:{{divColor 'secondaryColor'}};bottom:{{privStatus}}">
	  		<h3>Enter Code:</h3>
	  		<input id="privateCode" type="text" placeholder="Enter code here...">
	  		<h4 id="privSubmit">Submit</h4>
	  	</div>
		{{> loginButtons}}
	</div>
</template>

<template name="classDisplay">
	<div class="classBox{{box}}" classid="{{_id}}">
		<span class="name classText">{{name}}</span>
		<span class="teacher classText">{{teacher}}</span>
		<span class="hour classText">{{hour}}</span>
		<span class="subscribers classText">{{subscribers}}</span>
		{{#if mine}}
			<i class="fa fa-times" aria-hidden="true"></i>
		{{else}}
			<i class="fa fa-times" aria-hidden="true" style="visibility:hidden"></i>
		{{/if}}
	</div>
</template>

<template name="userDisplay">
	<div class="userBox" userid="{{_id}}">
		<span class="email" onclick="window.location='/user/{{email}}'">{{email}}</span>
		<span class="realname" onclick="window.location='/user/{{email}}'">{{name}}</span>
		<i class="fa fa-times" aria-hidden="true"></i>
	</div>
</template>

<template name="schoolList">
    {{name}}
</template>

<template name="teacherList">
    {{teacher}}
</template>

