<?php /*  Add a Meet  */ ?>
<div class="section addMeet" style="padding-bottom: 10px;">
	
	<?php echo Form::open(array('url' => url('/meets/create'),
						'id' => 'meet_adder')); ?>

		<?php if (Session::has('errors')): ?>                
	        <div class="error ui-state-error"><span class="ui-icon ui-icon-alert box_icon"></span><?php foreach ($errors->all() as $error): ?><?php echo $error; ?> <?php endforeach; ?></div>
	    <?php endif; ?>

	  	<?php echo Form::hidden('team', $information['team']->id); ?>
	  	<?php echo Form::hidden('activity_program', $information['activity_program']->id); ?>	          		          	
		<?php echo Form::hidden('activity', $information['activity_program']->activity); ?>	          		          	

	    <?php echo Form::hidden('event_type', 'MEET'); ?>
	    <?php echo Form::hidden('event_status', 'SCHD'); ?>	           

	    
	    <!-- Step 1 Fields -->
	    <div class="fourth" style="padding-left: 1em;">	    	
    	
	    	<b>Meet Type</b>

	    	<div class="button_set">    						
				
				<div class="small gray note float_right" style="width: 100px; line-height: 1.4em; margin-top: 0.5em;">
					If only two schools are participating, select <b>Dual</b>.<br />
					Otherwise, if there are more than two schools, it's an <b>Invitational</b>.
				</div>

				<input type="radio"
	                   id="radio_1"
	                   name="meet_type"
	                   value="DUAL" />
	            <label for="radio_1" style="width: 105px; height: 3.5em;">
	            	Dual
	            	<br />
	            	<span style="font-weight: normal; font-size: smaller;">(2 Teams)</span>
	           	</label>

	           	<br /><br />

	           	<input type="radio"
	                   id="radio_2"
	                   name="meet_type"
	                   value="INV" />
	            <label for="radio_2" style="width: 105px; height: 3.5em;">	            	
	            	Invitational
	            	<br />
	            	<span style="font-weight: normal; font-size: smaller;">(3+ Teams)</span>
	           	</label>				

			</div>

			<br />

			<b>Team Hosting the Meet</b><br />	    			    		
			<?php echo Form::text('host_team', $information['home_team_name'], array('style' => 'width:215px;', 'class' => 'school_autocomplete')); ?>

			<br /><br />

			<?php echo Form::label('host_is_oos', 'Out-of-State Team'); ?>
			<?php echo Form::checkbox('host_is_oos', true, false, array('style' => 'position: relative; top: 2px; margin-right: 1em;')); ?>


            <select style="width:60px;" id="state" name="state" disabled="disabled">
            <?php

                $states = DB::select('SELECT slug, name FROM states');

                foreach ($states as $s)
                {
                    $name = $s->name;
                    $slug = $s->slug;	                  	

					
					echo '<option value="' . $slug . '"';

					if ($slug == Input::old('state')) echo ' selected="selected"';

					echo '>' . $slug . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $name . '</option>';	                  	
                }

                unset ($states);

                echo '<option value="Other">Other</option>';

            ?>
        	</select>		
		
		</div>
		<!-- End Step 1 Fields -->
		
	    <div class="float_left" style="border-left: 2px solid #d9e1e0; padding-left: 1em; height: 230px;">    	

	    	<!-- Directions -->
			<div name="directions" style="width: 695px; overflow: hidden; height: 230px;">
				<div class="float_left" style="max-width: 690px;">
		    		
		    		<div class="ui-icon ui-icon-info float_left"></div>
		    		<b>Instructions</b><br />
		    		Use this form to join an existing meet or create a new one.  Start by selecting the meet type and specifying the team that is hosting the meet.
		    		<br /><br />
		    		<b>Dual</b> meets involve only two teams.  If you do not see a desired dual meet on your schedule, you can create a new one.
		    		<br />
		    		<b>Invitationals</b> involve three or more teams. Double-duals are a special type of invitational meets.  If you type in a school other than your own, you will be able to browse a list of invitational meets that school is offering this season.
		    		<br /><br />
		    		Click <b>Next</b> to continue. <div class="button next" style="font-size: 8pt;" data-stage="1">Next</div>


		    	</div>
	    	</div>
	    	<!-- End Directions -->

			<!-- Invitational Finder -->
			<div name="inv_finder" style="display: none; width: 695px; overflow: hidden; height: 230px;">
				<div style="font-weight: bold; border-bottom: 1px solid #469bdd; width: 680px; margin-bottom: 1em; color: #469bdd;">
		    		<div class="ui-icon ui-icon-search float_left"></div>
		    		Find an invitational meet hosted by <span name="hosting_team_name"></span>
		    	</div>

		    	<div class="float_left" style="margin-right: 2em; position: relative;">

		    		<b>Available Meets</b> <span id="returned_result_count"></span><br />

		    		<?php echo Form::select('available_meets', array(), null, array('size' => '7', 'style' => 'width: 670px; position: relative;')); ?>
			    	
		    		<div style="width: 670px;">
		    			It may take a while to search for meets.  Select a meet from the list above then click <b>Join</b>.  If you can't find a specific meet, then the host may not have created it yet; you can create it by clicking <b>Create</b>.
		    		</div>

		    		<div style="margin-top: 0.5em;">
						<div class="button reset" style="font-size: 8pt;" data-from="INV_F">Back/Reset</div>
						<div class="button next_add" style="font-size: 8pt; margin-left: 2em;" data-from="INV_F">Create</div>
						<div class="button join" style="font-size: 8pt; margin-left: 2em;" data-from="INV_F">Join</div>
					</div>

		    	</div>
	    	</div>
	    	<!-- End Finder -->

	    	<!-- Dual Creator -->
	    	<div name="dual_creator" style="display: none; width: 695px; overflow: hidden; height: 230px;">
		    	
		    	<div style="font-weight: bold; border-bottom: 1px solid #469bdd; width: 680px; margin-bottom: 1em; color: #469bdd;">
		    		<div class="ui-icon ui-icon-plus float_left"></div>
		    		Create a new dual meet hosted by <span name="hosting_team_name"></span>
		    	</div>

		    	<div class="float_left" style="margin-right: 2em;">

		    		<b>Meet Starts At</b><br />
			    	<?php echo Form::label('event_date', 'Date:'); ?>
					<?php echo Form::text('event_date', null, array('style' => 'width:100px;')); ?>
					<br />
					<span class="small gray note">Use date picker (MM/DD/YYYY)</span>

					<br /><br />

					<?php echo Form::label('event_time', 'Time:'); ?>
					<?php echo Form::text('event_time', null, array('style' => 'width:80px;')); ?> Pacific	
					<br />
					<span class="small gray note">Leave blank or choose 12:00 AM for TBD</span>

			    	<br /><br />
			    	
			    	<?php echo Form::label('multi_day_event', 'Two Day Meet'); ?>
					<?php echo Form::checkbox('multi_day_event', true, false, array('style' => 'position: relative; top: 2px;')); ?><br />
					<span class="small gray note">Check if the meet extends to the next day</span>	

					<br /><br /><br />

		    	</div>

		    	<div class="float_left" style="margin-right: 2em;">
								
					<?php echo Form::label('other_team', 'Other Team'); ?><br />	           
		    		<?php echo Form::text('other_team', null, array('style' => 'width:215px;', 'class' => 'school_autocomplete')); ?>

					<?php echo Form::label('other_team_is_oos', 'OOS', array('style' => 'margin-left: 2em;')); ?>
					<?php echo Form::checkbox('other_team_is_oos', true, false, array('style' => 'position: relative; top: 2px; margin-right: 1em;')); ?>

		            <select style="width:60px;" id="state2" name="state" disabled="disabled">
		            <?php

		                $states = DB::select('SELECT slug, name FROM states');

		                foreach ($states as $s)
		                {
		                    $name = $s->name;
		                    $slug = $s->slug;	                  	

							
							echo '<option value="' . $slug . '"';

							if ($slug == Input::old('state')) echo ' selected="selected"';

							echo '>' . $slug . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $name . '</option>';	                  	
		                }

		                unset ($states);

		                echo '<option value="Other">Other</option>';

		            ?>
		        	</select>	
		    		<br />
		    		<span class="small gray note">Who is the other team?</span>

					
			
					<br /><br />

					<?php echo Form::label('location', 'Location'); ?><br />
		    		<?php echo Form::text('location', null, array('style' => 'width:400px;')); ?><br />
		    		<span class="small gray note">If the meet is not being held at the host school, enter in a location</span>			    	
				</div>	

				<div style="margin-top: 14em;">
					<div class="button reset" style="font-size: 8pt;" data-from="DUAL">Back/Reset</div>
					<div class="button create" style="font-size: 8pt; float: right;" data-from="DUAL">Create Meet</div>
				</div>
			</div>
			<!-- End Dual Creator -->	


			<!-- Invitational Creator -->
	    	<div name="inv_creator" style="display: none; width: 695px; overflow: hidden; height: 230px;">
		    	
		    	<div style="font-weight: bold; border-bottom: 1px solid #469bdd; width: 680px; margin-bottom: 1em; color: #469bdd;">
		    		<div class="ui-icon ui-icon-plus float_left"></div>
		    		Create a new invitational meet hosted by <span name="hosting_team_name"></span>
		    	</div>

		    	<div class="float_left" style="margin-right: 2em;">

		    		<b>Meet Starts At</b><br />
			    	<?php echo Form::label('event_date2', 'Date:'); ?>
					<?php echo Form::text('event_date2', null, array('style' => 'width:100px;')); ?>
					<br />
					<span class="small gray note">Use date picker (MM/DD/YYYY)</span>

					<br /><br />

					<?php echo Form::label('event_time2', 'Time:'); ?>
					<?php echo Form::text('event_time2', null, array('style' => 'width:80px;')); ?> Pacific	
					<br />
					<span class="small gray note">Leave blank or choose 12:00 AM for TBD</span>

			    	<br /><br />
			    	
			    	<?php echo Form::label('multi_day_event2', 'Two Day Meet'); ?>
					<?php echo Form::checkbox('multi_day_event2', true, false, array('style' => 'position: relative; top: 2px;')); ?><br />
					<span class="small gray note">Check if the meet extends to the next day</span>	

					<br /><br /><br />

		    	</div>

		    	<div class="float_left" style="margin-right: 2em;">
								
					<?php echo Form::label('meet_name', 'Name of the Meet'); ?><br />
				    <?php echo Form::text('meet_name', null, array('style' => 'width:400px;', 'maxlength' => '50')); ?><br />
				    <div class="small gray note" style="width: 400px; line-height: 1.25em;">
				    	Give this meet a name, like "Gibson Winter Invitational" or "Reynolds Double-Dual."  There is no need to include the invited teams in this name, because teams participating in this meet will be displayed on the schedule.
				    </div>								
			
					<br />

					<?php echo Form::label('location2', 'Location'); ?><br />
		    		<?php echo Form::text('location2', null, array('style' => 'width:400px;')); ?><br />
		    		<span class="small gray note">If the meet is not being held at the host school, enter in a location</span>			    	
				</div>	

				<div style="margin-top: 14em;">
					<div class="button reset" style="font-size: 8pt;" data-from="INV">Back/Reset</div>
					<div class="button add_teams" style="font-size: 8pt; float: right;" data-from="INV">Add Teams</div>
				</div>
			</div>
			<!-- End Invitational Creator -->	


			<!-- Invitational Creator 2 -->
	    	<div name="inv_creator2" style="display: none; width: 695px; overflow: hidden; height: 230px;">
		    	
		    	<div style="font-weight: bold; border-bottom: 1px solid #469bdd; width: 680px; margin-bottom: 1em; color: #469bdd;">
		    		<div class="ui-icon ui-icon-plus float_left"></div>
		    		Add teams to the <span name="new_inv_meet_name"></span> meet (<span name="new_inv_meet_date"></span>)
		    	</div>		    	

		    	<div class="float_left" style="margin-right: 2em;">
					
		    		<div style="width: 250px; height: 195px; overflow-x: hidden; overflow-y: auto;" data-holder="teams">
		    			<b>Participating Teams</b><br />
						<?php echo Form::text('add_team[0]', null, array('style' => 'width: 215px;', 'class' => 'school_autocomplete')); ?>

						<br /><br />

						<?php echo Form::text('add_team[1]', null, array('style' => 'width: 215px;', 'class' => 'school_autocomplete')); ?>

						<br /><br />

						<?php echo Form::text('add_team[2]', null, array('style' => 'width: 215px;', 'class' => 'school_autocomplete')); ?>

						<br /><br />

						<?php echo Form::text('add_team[3]', null, array('style' => 'width: 215px;', 'class' => 'school_autocomplete')); ?>

					</div>					

				</div>	

				<div class="float_left" style="margin-right: 2em; width: 390px;">
					
		    		Add teams by typing in their names.  Oregon team names will automatically fill as you begin typing.<br /><br />For out-of-state teams, type their team name followed by the state in parentheses.  For example: "Camas (WA)" or "Antelope Acad. (CA)", leave off the words "High School" and abbreviate "Academy" as "Acad." and/or "Charter" as "Char."
					
					

				</div>

				<div style="margin-top: 14em;">
					<div class="button reset" style="font-size: 8pt;" data-from="INV2">Back/Reset</div>
					<div class="button add_more_team_spots" style="font-size: 8pt; margin-left: 4.5em;" data-from="INV2">Add Spots</div>
					<div class="button create" style="font-size: 8pt; float: right;" data-from="INV">Create Meet</div>
				</div>
			</div>
			<!-- End Invitational Creator -->	

			<br class="clear" />

	    </div>



	    <br class="clear" />
	   
	<?php echo Form::close(); ?>				

</div>				

