<?php $__env->startSection('page_title'); ?>
    OSAA - Register
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_sub_title'); ?>    
   OSAA Account Registration
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
    @parent


<?php $__env->stopSection(); ?>

<?php $__env->startSection('jquery_init'); ?>
	/* Once a role is selected, check to see if an activity can be selected or not */
    $('#role').change (function updateRole ()
    {
        var role_slug = $(this).find(":selected").val();

        var no_act = ['Prin.', 'Asst. Prin.', 'AD', 'Asst. AD', 'Act. Dir.', 'Asst. Act. Dir.', 'Ath. Sec.', 'Act. Sec.', 'AT', 'Doc.', 'Contact'];

        if ($.inArray(role_slug, no_act) < 0)
        {
            $("#activity").removeAttr('disabled');
        }
        else
        {
            $('#activity').attr('disabled', 'disabled');
        }       
    });

    $('#key').change(function ()
    {
    	if ($(this).val() == '')
    	{
    		$('#no_key').removeAttr('disabled');
    	}
    	else
    	{
    		$('#no_key').attr('disabled', 'disabled');
    	}
	});

<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_functions'); ?>
    
<?php $__env->stopSection(); ?>


<?php $__env->startSection('main_content'); ?>    
	<h1>Register</h1>
	
	<p>
		Please fill in the following fields in order to setup your account.
	</p>

	<div class="columns">
		<div class="half">
			
			<h2>Create Account</h2>	

			<?php echo Form::open(array('url' => url('/account/register'), 'class' => 'login')); ?>

			<?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::label('email', 'E-Mail Address', array('class' => 'input_label', 'style' => 'width:150px;')); ?>
			<?php echo Form::text('email', null, array('style' => 'width:200px;')); ?>

			<br /><br />

			<?php echo Form::label('password', 'Password', array('class' => 'input_label', 'style' => 'width:150px;')); ?>
			<?php echo Form::password('password'); ?>

			<br /><br />
			
			<?php echo Form::label('confirm', 'Confirm Password', array('class' => 'input_label', 'style' => 'width:150px;')); ?>
			<?php echo Form::password('confirm'); ?>
			
			<br /><br />

			<h2>Profile Information</h2>

			<?php echo Form::label('first_name', 'First Name', array('class' => 'input_label', 'style' => 'width:150px;')); ?>
			<?php echo Form::text('first_name', null, array()); ?>

			<br /><br />

			<?php echo Form::label('middle_name', 'Middle Name/Initials', array('class' => 'input_label', 'style' => 'width:150px;')); ?>
			<?php echo Form::text('middle_name', null, array()); ?>
			<span class="small gray note" style="margin-left:5px;">(optional)</a></span>
			
			<br /><br />

			<?php echo Form::label('last_name', 'Last Name', array('class' => 'input_label', 'style' => 'width:150px;')); ?>
			<?php echo Form::text('last_name', null, array()); ?>

			<br /><br />

			<?php echo Form::label('nick_name', 'Nick Name', array('class' => 'input_label', 'style' => 'width:150px;')); ?>
			<?php echo Form::text('nick_name', null, array()); ?>
			<span class="small gray note" style="margin-left:5px;">(optional)</a></span>

			<br /><br />

			<h2>Link to a School</h2>

			<?php echo Form::label('school', 'School', array('class' => 'input_label')); ?>
            <?php

                $sel_school_ids = DB::table('school_demographics')
                                            ->select(array('school'))
                                            ->where('is_associate_member', '=', 0)
                                            ->where('school_year', '=', Session::get('year'))
                                            ->where('is_retired', '=', 0)
                                            ->lists('school');

                $sel_schools = school::whereIn('id', $sel_school_ids)
                                     ->whereNotNull('key_code')
                                     ->orderBy('name')
                                     ->get();

                $select = array();

                foreach ($sel_schools as $school)
                {
                    $select[$school->id] = $school->name;
                }

                unset ($sel_schools);

            ?>
            <?php echo Form::select('school', $select, isset ($schools[0]) ? $schools[0]->id : null, array('style' => 'width:275px;')); ?>

            <br /><br />

            <?php echo Form::label('role', 'Role', array('class' => 'input_label')); ?>
            <?php

                $sel_roles = role::where('entity_type', '=', 'S')->orderBy('name')->get();

                $select = array();

                foreach ($sel_roles as $role)
                {
                    $select[$role->slug] = $role->name;                            
                }

                unset ($sel_roles);

            ?>
            <?php echo Form::select('role', $select, null, array('style' => 'width:275px;')); ?>


            <br /><br />

            <?php echo Form::label('activity', 'Activity', array('class' => 'input_label')); ?>
            <?php

                $sel_activities = activity::orderBy('id')->get();

                $select = array();

                foreach ($sel_activities as $activity)
                {
                    $select[$activity->slug] = $activity->name;
                }

                unset ($sel_activities);

            ?>
            <?php echo Form::select('activity', $select, null, array('disabled', 'style' => 'width:275px;')); ?>

            <br /><br />

			<?php echo Form::label('key', 'Key Code', array('class' => 'input_label')); ?>
			<?php echo Form::password('key', array('style' => 'width:125px;')); ?>

			<br /><br />

			<div style="float:left; height:2em; line-height:2em; margin-right:10px;">
			<?php echo Form::checkbox('no_key', 'true', false, array('class' => 'check_box', 'id' => 'no_key')); ?>
			</div>			
			<label for="no_key" style="width:375px; margin-left:0;">I do not have a key code right now.  Create my account and I'll enter the code later.</label>

			<br class="clear" />

			<?php echo Form::submit('Register', array('class' => 'submit', 'style' => 'margin-left:357px;')); ?>


			<?php echo Form::close(); ?>

			

		</div>

		<div class="half">
			<h2>Guidance</h2>

			<h3>E-Mail Address</h3>
			<p>
				It is highly recommended to use your school related e-mail address.  Users must have their own, unique e-mail address.
			</p>

			<h3>Password</h3>
			<p>
				Passwords must be 8-16 characters and can include letters, numbers, or special characters.
			</p>

			<h3>Linking Account</h3>
			<p>
				You will need a valid key code to link to a school.  Each school has a different administrator and coach key code.  Your school administrator can give you a key code in order to finalize linking your account.
			</p>
			<p>
				If you do not know your school's key code, you can still create an account and link your account to a school at a later time.  Contact your school administrator for your school's key code.
			</p>

			<h2>Why do I need an account?</h2>

			<p>
				Users must have an account and link to a school in order to gain access to administrative and management features.  Authorized users will be able to manage school information, edit team schedules, enter team rosters, and perform various other tasks.
			</p>			

			<h2>My school isn't listed</h2>

			<p>
				Only full Member Schools are listed in the school drop-down list.  If you're creating an account to access an <b>Associate Member</b> school, skip this school linking by checking the check-box that reads "<i>I do not have a key code right now...</i>"  You can attach your new account to an associate member school using your school ID and key code after your account is created.
			</p>

			
		</div>

		<br class="clear" />

		<p class="small gray note">
			<br /><br />
			Please refer to the <a href="<?php echo url ('/privacy'); ?>">privacy policy</a> for additional information regarding data collection and information security.
		</p>


	</div>


	


	
<?php $__env->stopSection(); ?>