

<?php $__env->startSection('page_title'); ?>
    <?php echo e($information['activity_program']->display_name); ?> - OSAA
<?php $__env->stopSection(); ?>


<?php $__env->startSection('page_sub_title'); ?>
    <?php echo e($information['activity_program']->display_name); ?>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('head'); ?>
    <link rel="stylesheet" href="<?php echo asset('css/fontello.css'); ?>">

    <style type="text/css">
        .pitchCounts .ui-listview>li h2 {
            width: auto;
            margin: 0;
        }

        .pitchCounts .ui-collapsible-content {
            /*background-color: #1c43a6 !important;*/
            background-color: #005fa9 !important;
        }

        .pitchCounts .legend .ui-collapsible-heading-toggle {
            /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#b5bdc8+0,828c95+36,28343b+100;Grey+Black+3D */
            background: #b5bdc8; /* Old browsers */
            background: -moz-linear-gradient(top,  #b5bdc8 0%, #828c95 36%, #28343b 100%); /* FF3.6-15 */
            background: -webkit-linear-gradient(top,  #b5bdc8 0%,#828c95 36%,#28343b 100%); /* Chrome10-25,Safari5.1-6 */
            background: linear-gradient(to bottom,  #b5bdc8 0%,#828c95 36%,#28343b 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
            filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b5bdc8', endColorstr='#28343b',GradientType=0 ); /* IE6-9 */
        }
    </style>


<?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('jquery_init'); ?>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('left_nav_panel'); ?>
    @parent
    <li data-role="list-divider" role="heading" class="ui-li-divider ui-bar-a ui-first-child" data-priority="persist" style="text-align:center;">
        <?php echo e($information['activity_name']); ?> Menu
    </li>
    <li ><a href="/mobile/<?php echo e($information['activity_slug']); ?>/schedules" data-ajax="false" class="ui-btn">Schedules <?php echo ($information['sport_type'] == 'ts') ? "& Scores" : ""; ?></a></li>
    <li ><a href="/mobile/<?php echo e($information['activity_slug']); ?>/teams_leagues" data-ajax="false" class="ui-btn">Teams & Leagues</a></li>
    <?php if ($information['sport_type'] == 'ts'): ?>
        <li ><a href="/mobile/<?php echo e($information['activity_slug']); ?>/rankings" data-ajax="false" class="ui-btn">Rankings</a></li>
        <li ><a href="/mobile/<?php echo e($information['activity_slug']); ?>/brackets" data-ajax="false" class="ui-btn">Brackets</a></li>
    <?php endif; ?>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('main_content'); ?>


<div style="text-align: center;">
    <?php if (!is_null($information['team']->logo_url)): ?>
        <img lsrc="<?php echo $information['team']->logo_url; ?>" alt="<?php echo $information['team']->name; ?>" title="<?php echo $information['team']->name; ?>" style="width: 50%; max-width: 155px; height: 155px">
    <?php else: ?>
        <img lsrc="http://www.osaa.org/images/no_logo.png" alt="" title="No School Logo Available" style="width: 50%; max-width: 155px;">
    <?php endif; ?>
</div>

<h2 style="text-align:center"><?php echo $information['activity_program']->display_name; ?></h2>

<?php if (!is_null($information['team']->ranking)): ?>
    <div class="ui-grid-b">
        <div class="ui-block-a" style="padding: 0.5em;">
            <b>Overall Record</b>
            <br>
            <?php echo Helpers::displayRecord($information['team']->record['OAR']); ?>
        </div>
        <div class="ui-block-b" style="padding: 0.5em;">
            <b>RPI Record</b>
            <br>
            <?php echo Helpers::displayRecord($information['team']->record['RCR']); ?>
        </div>
        <div class="ui-block-c" style="padding: 0.5em;">
            <b>Colley Record</b>
            <br>
            <?php echo Helpers::displayRecord($information['team']->record['CRR']); ?>
        </div>
        <div class="ui-block-a" style="padding: 0.5em;">
            <b>League Record</b>
            <br>
            <?php echo Helpers::displayRecord($information['team']->record['LR']); ?>
        </div>
        <div class="ui-block-b" style="padding: 0.5em;">
            <b>RPI Rating</b>
            <br>
            <?php echo number_format($information['team']->ranking->rpi * 1000, 3, '.', ''); ?>
        </div>
        <div class="ui-block-c" style="padding: 0.5em;">
            <b>Colley Rating</b>
            <br>
            <?php echo number_format($information['team']->ranking->colley * 1000, 3, '.', ''); ?>
        </div>
        <div class="ui-block-a" style="padding: 0.5em;">
            <b>OSAA Rank</b>
            <br>
            #<?php echo $information['team']->ranking->rank; ?>
        </div>
        <div class="ui-block-b" style="padding: 0.5em;">
            <b>RPI Rank</b>
            <br>
            #<?php echo $information['team']->ranking->rpi_rank; ?>
        </div>
        <div class="ui-block-c" style="padding: 0.5em;">
            <b>Colley Rank</b>
            <br>
            #<?php echo $information['team']->ranking->colley_rank; ?>
        </div>
        <!-- <div class="ui-block-a" style="padding: 1em; margin-bottom: 0.5em;">
            <b>WWP:</b>
            <?php echo number_format($information['team']->ranking->wwp, 3, '.', ''); ?>
        </div>
        <div class="ui-block-a" style="padding: 1em; margin-bottom: 0.5em;">
            <b>OWP:</b>
            <?php echo number_format($information['team']->ranking->owp, 3, '.', ''); ?>
        </div> -->

    </div>

    <div class="ui-grid-a" style="margin-top: 1em;">
        <div class="ui-block-b" style="padding: 0.5em;">
            <?php echo $information['team']->ranking->calc_label; ?><br>
            <?php echo $information['team']->ranking->calc_date; ?>
        </div>
        <div class="ui-block-b" style="padding: 0.5em;">

        </div>
    </div>
<?php endif; ?>


<fieldset class="ui-grid-a" style="margin-left: -1em; margin-right: -1em; margin-bottom: 1em;">
    <?php
        $button_width = '50%';

        if (!is_null($information['pitch_count']))
        {
            $button_width = '33.33%';
        }
    ?>

    <div class="ui-block-a" style="width: <?php echo $button_width; ?>;"><button onClick="loadSchedule(); return false;" class="scheduleButton ui-link ui-btn ui-tabs-anchor ui-btn-active" style="margin: 0;">Schedule</button></div>
    <div class="ui-block-b" style="width: <?php echo $button_width; ?>;"><button onClick="loadRoster(); return false;" class="rosterButton ui-link ui-btn" style="margin: 0;">Roster</button></div>

    <?php if (!is_null($information['pitch_count'])): ?>
        <div class="ui-block-b" style="width: <?php echo $button_width; ?>;"><button onClick="loadPitchCount(); return false;" class="pitchCountButton ui-link ui-btn" style="margin: 0;">Pitch Counts</button></div>
    <?php endif; ?>

</fieldset>

<div class="schedule">
    <ul data-role="listview">
        <?php if (isset($information['team']->schedule) && count($information['team']->schedule)>0): ?>
            <?php foreach ($information['team']->schedule as $event): ?>
                <?php if (isset($event['contest'])): ?>
                    <li class="ui-bar-a" style="border-top: none;"><a href="<?php echo url('/mobile/contests/' . $event['contest']->id); ?>">
                        <h2>
                            <?php echo $event['sign']; ?>
                            <?php echo $event['opponent']; ?>
                            <small> <?php echo $event['note']; ?> </small>
                        </h2>
                        <p>
                            <?php echo $event['day']; ?>
                            <?php echo $event['date']; ?>
                            <?php echo $event['time']; ?>
                            <?php echo $event['type']; ?>
                        </p>

                        <p class="ui-li-aside"><b>
                            <?php if ($event['status'] == 'DONE'): ?>
                                <?php echo $event['result']; ?> <?php echo $event['score']; ?>
                            <?php endif; ?>
                        </b></p>

                    </a></li>
                <?php elseif (isset($event['meet'])): ?>
                    <li class="ui-bar-a" style="border-top: none;"><a href="<?php echo url('/mobile/meets/' . $event['meet']->id); ?>">
                        <h2>
                            <?php echo $event['title']; ?>
                        </h2>
                        <p>
                            <?php echo $event['day']; ?>
                            <?php echo $event['date']; ?>
                            <?php echo $event['time']; ?>
                            <?php echo $event['type']; ?>
                        </p>
                    </a></li>
                <?php endif; ?>

            <?php endforeach; ?>
        <?php else: ?>
            <li style="text-align:center"><b>
                No <?php echo ($information['sport_type'] == 'ts') ? "contests" : "meets"; ?> have been added to this team's schedule yet
            </b></li>
        <?php endif; ?>
    </ul>
</div>

<div class="roster" style="display:none; margin-left: -0.6em; margin-right: -0.6em;">
    <?php if (count($information['team']->roster) > 0): ?>
        <table data-role="table" data-mode="columntoggle" class="table-stroke" style="margin-top: -1em;">
            <thead>
                <tr>
                    <th>#</th>
                    <th>Name</th>
                    <th>Pos</th>
                    <th>Grade</th>
                    <th>Height</th>
                    <?php if (Helpers::strEqual ($information['activity_program']->activity, array('FBL', 'WRE'))): ?>
                        <th>
                            Weight
                        </th>
                    <?php endif; ?>
                </tr>
            </thead>
            <tbody>
            <?php foreach ($information['team']->roster as $player): ?>
                <tr>
                    <th><?php echo $player->number; ?></th>
                    <td>
                        <?php echo $player->name; ?>
                        <?php if ($player->is_captain): ?>
                            <small>(Captain)</small>
                        <?php endif; ?>
                    </td>
                    <td><?php echo $player->position; ?></td>
                    <td><?php echo $player->grade; ?></td>
                    <td><?php echo $player->height; ?></td>
                    <?php if (Helpers::strEqual ($information['activity_program']->activity, array('FBL', 'WRE'))): ?>
                        <td>
                            <?php echo $player->weight; ?>
                        </td>
                    <?php endif; ?>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    <?php else: ?>
        <table data-role="table" data-mode="columntoggle" class="table-stroke" style="margin-top: -1em;">
            <thead><tr><th style="text-align:center">
                No team roster information available
            </th></tr></thead>
        </table>
    <?php endif; ?>
</div>

<?php if (!is_null($information['pitch_count'])): ?>
    
    <div class="pitchCounts" style="display:none; margin-left: -0.6em; margin-right: -0.6em;">
        <ul data-role="listview" style="margin-left: -0.5em; margin-right: -0.5em;">
        
            <?php if (count($information['pitch_count']->data->schedules) < 1): ?>

                <li class="ranking-row" style="white-space: normal;">
                    There are no scheduled baseball games on record for this team.
                </li>

            <?php else: ?>

                <li data-role="collapsible" data-iconpos="right" data-inset="false" data-theme="b" style="padding: 0;">
                    <h2 class="legend">Help &amp; Icon Legend</h2>
                    <ul data-role="listview" data-theme="a">
                        <li style="white-space: normal; padding: .7em 1em;">
                            The following list shows scheduled contest dates and pitch counts for all levels.  Click to expand a listed date's recorded pitchers, pitch counts, and rest days.
                            
                            <br /><br />

                            Schools are required to track Varsity pitcher counts; the total number of pitches thrown at any level.

                            <br />

                            <table style="width: 80%; margin-left: 15px;">
                                <tr>
                                    <td>1-25 pitches</td>
                                    <td>0 rest days</td>
                                </tr>
                                <tr>
                                    <td>26-45 pitches</td>
                                    <td>1 rest day</td>
                                </tr>
                                <tr>
                                    <td>46-60 pitches</td>
                                    <td>2 rest days</td>
                                </tr>
                                <tr>
                                    <td>61-85 pitches</td>
                                    <td>3 rest days</td>
                                </tr>
                                <tr>
                                    <td>86+ pitches</td>
                                    <td>4 rest days</td>
                                </tr>
                            </table>

                            <br />

                            <b>Icons:</b><br />
                            <img src="<?php echo asset('/images/icons/pitch_count_return_icon_16px.png'); ?>" alt="" title="" class="ui-li-icon" style="vertical-align: middle;" /> indicates return date, the earliest day the pitcher can return with full eligibility.<br />
                            <img src="<?php echo asset('images/icons/over_pitch_green_16px.png'); ?>" alt="" title="" class="ui-li-icon" style="vertical-align: middle; " /> indicates pitcher was over the maximum pitch count, but allowed due to the at-bat exception.<br />
                            <img src="<?php echo asset('images/icons/over_pitch_red_16px.png'); ?>" alt="" title="" style="vertical-align: middle; width: 16px;" /> indicates pitcher exceeded the maximum pitch count imposed per day.
                        </li>
                    </ul>
                </li>


                <?php foreach ($information['pitch_count']->data->schedules as $index => $schedule): ?>

                    <li data-role="collapsible" data-iconpos="right" data-inset="false" data-theme="c" style="padding: 0;">
                        
                        <h2>
                            <?php echo date ('l n/j', strtotime($schedule->date)); ?>
                            <?php if (count($schedule->counts) > 0): ?>
                                <div style="float: right;">(<?php echo count($schedule->counts); ?>)</div>
                            <?php endif; ?>
                        </h2>                       

                        <ul data-role="listview" data-theme="a">

                            <?php foreach ($schedule->counts as $sub_index => $count): ?>

                                <li>
                                    <a href="#pitch_count_<?php echo $information['activity_program']->id; ?>_<?php echo $index; ?>_<?php echo $sub_index; ?>" style="font-weight: normal;" data-transition="fade" data-rel="popup">
                                        <table style="width: 100%;">
                                            <tbody>
                                                <tr>
                                                    <td style="width: 75%;"><?php echo $count->pitcher; ?></td>
                                                    <td style="width: 25%; white-space: nowrap;">
                                                        <?php echo $count->count; ?> pitches

                                                        <?php if ($count->count > 110): ?>
                                                            <?php if ($count->is_batter_exception): ?>
                                                                <img src="<?php echo asset('images/icons/over_pitch_green_16px.png'); ?>" title="" alt="" style="vertical-align: middle; width: 16px;" />
                                                            <?php else: ?>
                                                                <img src="<?php echo asset('images/icons/over_pitch_red_16px.png'); ?>" title="" alt="" style="vertical-align: middle; width: 16px;" />
                                                            <?php endif; ?>
                                                        <?php endif; ?>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="">
                                                        
                                                        <img src="<?php echo asset('/images/icons/pitch_count_rest_' . $information['pitch_count']->getRestFromLevel($count->level) . '_16px.png'); ?>" alt="<?php echo $information['pitch_count']->getRestFromLevel($count->level); ?>" title="" style="vertical-align: middle;" />

                                                        
                                                        <?php echo ($information['pitch_count']->getRestFromLevel($count->level) == 1) ? 'rest day' : 'rest days'; ?>
                                                    </td>
                                                    <td style="">
                                                        <img src="<?php echo asset('/images/icons/pitch_count_return_icon_16px.png'); ?>" alt="" title="" style="vertical-align: middle;" />
                                                        <?php echo date('D n/j', strtotime($schedule->date . ' +' . ($information['pitch_count']->getRestFromLevel($count->level) + 1) . ' days')); ?>
                                                    </td>                                                            
                                                </tr>
                                            </tbody>
                                        </table>
                                    </a>
                                    <div data-role="popup"
                                     data-overlay-theme="b"
                                     id="pitch_count_<?php echo $information['activity_program']->id; ?>_<?php echo $index; ?>_<?php echo $sub_index; ?>"
                                     class="ui-content pitch_count_popup">

                                        <a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-left">Close</a>

                                        <div style="text-align: center; font-weight: bold; color: #7d7b7d; margin-bottom: 0.5em;">
                                            <img src="<?php echo asset('/images/icons/baseball_16px.png'); ?>" alt="" title="" style="vertical-align: middle;" />
                                            Pitch Count Information
                                        </div>

                                        <table>
                                            <tbody>
                                                <tr>
                                                    <td><b>Game Date:</b></td>
                                                    <td><?php echo date ('D n/j', strtotime($schedule->date)); ?></td>
                                                </tr>
                                                <tr>
                                                    <td><b>Pitcher Name:</b></td>
                                                    <td><?php echo $count->pitcher; ?></td>
                                                </tr>
                                                <tr>
                                                    <td><b># of Pitches:</b></td>
                                                    <td><?php echo $count->count; ?></td>
                                                </tr>
                                                <tr>
                                                    <td><b>Required Rest:</b></td>
                                                    <td>
                                                        <?php if ($information['pitch_count']->getRestFromLevel($count->level) == 0): ?>
                                                            None
                                                        <?php elseif ($information['pitch_count']->getRestFromLevel($count->level) == 1): ?>
                                                            1 rest day
                                                        <?php else: ?>
                                                            <?php echo $information['pitch_count']->getRestFromLevel($count->level); ?> rest days
                                                        <?php endif; ?>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="padding-right: 8px;"><b>Full Return On:</b></td>
                                                    <td><?php echo date('D n/j', strtotime($schedule->date . ' +' . ($information['pitch_count']->getRestFromLevel($count->level) + 1) . ' days')); ?></td>
                                                </tr>
                                                <tr><td colspan="2">&nbsp;</td></tr>
                                                <tr>
                                                    <td><b>Entry Created:</b></td>
                                                    <td><?php echo date('n/j/Y g:ia', strtotime($count->updated_at)); ?></td>
                                                </tr>
                                                <tr>
                                                    <td><b>Entered By:</b></td>
                                                    <td><?php echo $count->updated_by; ?></td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </li>
                            <?php endforeach; ?>

                            <?php if (count($schedule->counts) < 1): ?>

                                <li>There are no pitch counts entered on this date.</li>

                            <?php endif; ?>
                        </ul>
                    </li>

                <?php endforeach; ?>        

            <?php endif; ?>

        </ul>
    </div>

<?php endif; ?>

<?php /* 
<h4 style="text-align: center; margin-top: 2em; margin-bottom: -0.5em;">Download or Print</h4>
<ul data-role="listview" data-inset="true" class="ui-listview ui-listview-inset ui-corner-all ui-shadow">
    <li><a href="/teams/<?php echo $information['team']->id; ?>/roster/2" target="_blank" class="ui-btn ui-btn-icon-right ui-icon-carat-r">V Program Roster <i class="icon-file-pdf"></i></a></li>
    <li><a href="/teams/<?php echo $information['team']->id; ?>/roster" target="_blank" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Media Roster <i class="icon-file-pdf"></i></a></li>
    <li><a href="/teams/<?php echo $information['team']->id; ?>/roster/3" target="_blank" class="ui-btn ui-btn-icon-right ui-icon-carat-r">Multi-team Roster <i class="icon-file-pdf"></i></a></li>
    <?php if (ImagesController::getImageURL($information['team']->id, 'PHOTO', 'ANY')): ?>
        <li><a href="<?php echo ImagesController::getImageURL($information['team']->id, 'PHOTO', 'ANY'); ?>" target="_blank" class="ui-btn ui-btn-icon-right ui-icon-carat-r" data-role="button">
            Team Photo
        </a></li>
    <?php else: ?>
        <li><a href="" class="ui-btn ui-state-disabled" data-role="button">
            No Team Photo
        </a></li>
    <?php endif; ?>
</ul>
 */ ?>

    <script>

        function loadSchedule() {
            $('.rosterButton').removeClass('ui-tabs-anchor').removeClass('ui-btn-active');
            $('.scheduleButton').addClass('ui-tabs-anchor').addClass('ui-btn-active');
            $('.pitchCountButton').removeClass('ui-tabs-anchor').removeClass('ui-btn-active');
            $('.schedule').show();
            $('.roster').hide();
            $('.pitchCounts').hide();
        }

        function loadRoster() {
            $('.scheduleButton').removeClass('ui-tabs-anchor').removeClass('ui-btn-active');
            $('.pitchCountButton').removeClass('ui-tabs-anchor').removeClass('ui-btn-active');
            $('.rosterButton').addClass('ui-tabs-anchor').addClass('ui-btn-active');
            $('.roster').show();
            $('.schedule').hide();
            $('.pitchCounts').hide();
        }

        function loadPitchCount() {
            $('.scheduleButton').removeClass('ui-tabs-anchor').removeClass('ui-btn-active');
            $('.rosterButton').removeClass('ui-tabs-anchor').removeClass('ui-btn-active');
            $('.pitchCountButton').addClass('ui-tabs-anchor').addClass('ui-btn-active');
            $('.pitchCounts').show();
            $('.roster').hide();
            $('.schedule').hide();
        }        

    </script>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.mobile', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>