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


<?php $__env->startSection('page_sub_title'); ?>
   Missing Scores
<?php $__env->stopSection(); ?>


<?php $__env->startSection('header_button_left'); ?>
    <a href="#" class="jqm-navmenu-link ui-nodisc-icon ui-alt-icon ui-btn-left ui-btn ui-icon-arrow-l ui-btn-icon-notext ui-corner-all" onClick="window.history.back(); return false;">Back</a>

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


<?php $__env->startSection('head'); ?>
    
    <link rel="stylesheet" href="<?php echo asset('css/fontello.css'); ?>">

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


<?php $__env->startSection('jquery_init'); ?>
    
    $('.tooltip').tooltip();    

    $('.button').button();
    $('.button.go').button({ icons : { primary : 'ui-icon-circle-arrow-e' }});   

    function colorRows ()
    {
        $('table tbody tr:odd').css('background-color', '#f2f2f2');
    }   

    colorRows();
    

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


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

    <h2>Hello, <?php echo Auth::user()->getDisplayFullName(); ?></h2>   

    <?php if (count ($information['contests']) < 1): ?>
        <p>
            You do not have any contests that are missing scores.
        </p>
    <?php else: ?>
        <p>
            According to our records, you are missing scores for the following contests:
        </p> 

        <ul data-role="listview" style="margin-top: 2em;">
            <?php foreach ($information['contests'] as $contest): ?>
            
                <?php
                
                    $now = new DateTime();
                    $startdate = new DateTime($contest->info->start_at);
                    
                    $firstCheckpoint = clone $startdate;
                    $firstCheckpoint->setTime(22,0,0);
                    
                    $secondCheckpoint = clone $firstCheckpoint;
                    $secondCheckpoint = $secondCheckpoint->modify("+1 day");
                    
                    if($now < $firstCheckpoint)
                    {
                        $warningClass = "warning-green";
                    }
                    else if($now < $secondCheckpoint)
                    {
                        $warningClass = "warning-yellow";
                    }
                    else
                    {
                        $warningClass = "warning-red";
                    }
                    
                ?>
            
                <li><a href="<?php echo url('/mobile/contests/' . $contest->id . '/submit-scores'); ?>" class="ui-btn-up-a <?php echo $warningClass; ?>" data-role="button" title="Submit scores for this contest.">
                    
                    <h2>
                        <?php echo $contest->activity; ?>
                        <?php
                            // if($contest->away == 'BOTH')
                            // {
                                $away = $contest->away_team_name;
                                if (!is_null($contest->away_team))
                                {
                                    $team = team::find($contest->away_team);

                                    if (!is_null($team))
                                    {
                                        $level = null;

                                        if (!Helpers::strEqual($team->level, 'V'))
                                        {
                                            $level = ' [' . $team->level . ']';
                                        }


                                        // $away = '<a href="' . url('/mobile/teams/' . $team->activity_program . '#tabs-V">') . $contest->away_team_name . $level . '</a>';
                                        $away = $contest->away_team_name . $level;
                                    }
                                }

                                $home = $contest->home_team_name;
                                if (!is_null($contest->home_team))
                                {
                                    $team = team::find($contest->home_team);

                                    if (!is_null($team))
                                    {
                                        $level = null;

                                        if (!Helpers::strEqual($team->level, 'V'))
                                        {
                                            $level = ' [' . $team->level . ']';
                                        }


                                        // $home = '<a href="' . url('/mobile/teams/' . $team->activity_program . '#tabs-V">') . $contest->away_team_name . $level . '</a>';
                                        $home = $contest->home_team_name . $level;
                                    }
                                }
                                echo  $away . " @ " . $home;
                            // }
                            /*else if($contest->away == false)
                            {
                                $away = $contest->away_team_name;
                                if (!is_null($contest->away_team))
                                {
                                    $team = team::find($contest->away_team);

                                    if (!is_null($team))
                                    {
                                        $level = null;

                                        if (!Helpers::strEqual($team->level, 'V'))
                                        {
                                            $level = ' [' . $team->level . ']';
                                        }


                                        // $away = '<a href="' . url('/mobile/teams/' . $team->activity_program . '#tabs-V">') . $contest->away_team_name . $level . '</a>';
                                        $away = $contest->away_team_name . $level;
                                    }
                                }
                                echo "vs. " . $away;
                            }
                            else
                            {
                                $home = $contest->home_team_name;
                                if (!is_null($contest->home_team))
                                {
                                    $team = team::find($contest->home_team);

                                    if (!is_null($team))
                                    {
                                        $level = null;

                                        if (!Helpers::strEqual($team->level, 'V'))
                                        {
                                            $level = ' [' . $team->level . ']';
                                        }

                                        $home = $contest->home_team_name . $level;
                                    }
                                }
                                echo "@ " . $home;
                            }*/
                        ?>
                        
                    </h2>
                    
                    <?php if($warningClass == "warning-red") { ?>
                        <p class="ui-warning-message"> <strong>
                          This event is late - please submit as soon as possible to avoid fines!  
                        </strong> </p>
                    <?php } ?>
                    
                    <p>
                        <?php echo Helpers::formatDateTime('%TEAM_SCHEDULE_TIME%', strtotime($contest->info->start_at)); ?> <?php echo Helpers::formatDateTime('%TEAM_SCHEDULE_DATE%', strtotime($contest->info->start_at)); ?> <?php /*  date('n/j/Y', strtotime($contest->info->start_at))  */ ?> <?php /*  date('g:i a', strtotime($contest->info->start_at))  */ ?>
                    </p>
                    
                    <?php if($warningClass == "warning-red") { ?>
                        <p class="ui-li-aside" style="text-align: center;">
                            <img src="/images/icons/danger_icon_72px.png" style="width: 40px; height: auto;">
                            <br>
                            <b>Late!</b>
                        </p>
                    <?php } else if($warningClass == "warning-yellow") { ?>
                        <p class="ui-li-aside">
                            <img src="/images/icons/yield_icon_72px.png" style="width: 40px; height: auto;">
                        </p>
                    <?php } ?>
                </a></li>
            <?php endforeach; ?> 
        </ul>
    <?php endif; ?>


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

