<!DOCTYPE html>
<html lang="en">

    <!-- HTML Head -->
    <head>

        <!-- Page Title -->
        <title>
            Cheer State Championships Check-In Form
        </title>      
        
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

        <!-- Style -->
        <style type="text/css" media="screen,print">
            
            /* Default Margins and Paddings */
            * {margin: 0; padding: 0;}


            /* No image borders by default */
            img {border: none;}

            /* Page Body */
            html, body {               

                /*width: 2550px;*/
                /*height: 3300px;*/

                font-family: Trebuchet MS, Helvetica, sans-serif;
                font-size: 12pt;                
                
                color: #000000;
                background: #ffffff;

                /*border:1px dashed #999999;*/
            }

            
            .page_break {page-break-after: always;}

            .full {width: 100%; float: left;}
            .half {width: 50%; float: left;}
            .quarter {width: 25%;}

            .clear {clear: both;}

            .text_left {text-align: left;}
            .text_right {text-align: right;}
            .text_center {text-align: center;}
            .text_justify {text-align: justify;}

            .float_left {float: left;}

            .italic {font-style: italic;}
            
            table {
                width: 100%;
                border-collapse: collapse;
            }

            .odd {
                background-color: #cccccc;
            }
            
            table.participants thead th {
                text-align: left;
                font-size: 10pt;
                font-style: italic;
            }

            table.coaches thead th {
                text-align: left;
                font-size: 10pt;
                font-style: italic;
            }

            table.coaches tbody td {
                vertical-align: top;
            }

            table.participants tbody tr {
                line-height: 1.75em;                
            }

            .label {
                display: inline-block;
                float: left;
                width: 130px;
                font-weight: bold;
            }
            
            h1.team_name {
                padding-bottom: 0.25em; 
                border-bottom: 4px solid black; 
                width: 85%; 
                font-size: 1.95em;
                margin-bottom: 0.75em;
            }

            .letter_reference {
                border: 2px solid black; 
                font-size: 18pt; 
                width: 2em; 
                height: 2em; 
                text-align: center; 
                line-height: 2em; 
                letter-spacing: 2px; 
                margin: 0 auto 0.5em auto;
            }

            .label_break {                
                height: 0.5em;
            }

            .time_box {
                width: 125px;
                height: 2em;
                border: 1px solid black;
                display: inline-block;
                position: absolute;
                margin: -1em 0 0 4em;
            }

            .exchange_box {
                width: 125px;
                height: 2em;
                border: 1px solid black;
                display: inline-block;
                position: absolute;
                margin: -0.5em 0 0 1em;
            }

        </style>


        <script type="text/javascript">
            $(document).ready(function ()
            {
                // Color table rows
                function colorRows ()
                {       
                    $('table').each(function ()
                    {
                        var i = 0;

                        $('tbody tr:visible', $(this)).each(function ()
                        {
                            if (i % 2 == 1)
                            {
                                $(this).addClass('odd');
                            }
                            else
                            {
                                $(this).removeClass('odd');
                            }
                            i = i + 1;
                        });     


                    });
                }

                colorRows();

                // Automatically print this report
                window.print(); 
            });                

        </script>        
                
    </head>

    <body>                         
        
        <?php foreach ($info['teams'] as $team): ?>

            <div style="text-align: center; position: absolute; right: 0;">
                <div class="letter_reference">
                    <?php echo strtoupper(substr($team->ap->name, 0, 2)); ?>
                </div>

                <div style="font-size: 9pt;">
                    Table <?php echo $team->check_in_table; ?>
                </div>
            </div>

            <h1 class="team_name">
                <?php echo $team->ap->name; ?>
            </h1>
            
            <div class="full">
                <div class="half">
                    <div class="label">Division</div>
                    <div class="value"><?php echo $team->assigned_division; ?></div>

                    <div class="label_break"></div>

                    <div class="label">Order</div>
                    <div class="value"><?php echo $team->performance_order; ?></div>

                    <div class="label_break"></div>                    

                    <div class="label"># Coaches</div>
                    <div class="value"><?php echo (1 + count($team->asst_coaches)); ?></div>

                    <div class="label_break"></div>

                    <div class="label"># Participants</div>
                    <div class="value"><?php echo count($team->participants); ?></div>

                    <div class="label_break"></div>

                    <div class="label">Total # Passes</div>
                    <div class="value"><?php echo ((1 + count($team->asst_coaches)) + count($team->participants)); ?></div>
                </div>

                <div class="half">
                    <div class="label">Photo</div>
                    <div class="value"><?php echo $team->times['photo']; ?></div>

                    <div class="label_break"></div>

                    <div class="label">Check-In</div>
                    <div class="value"><?php echo $team->times['check_in']; ?></div>

                    <div class="label_break"></div>

                    <div class="label">Practice</div>
                    <div class="value"><?php echo $team->times['practice']; ?></div>                    

                    <div class="label_break"></div>

                    <div class="label">Perform</div>
                    <div class="value"><?php echo $team->times['perform']; ?></div>                    

                    <div class="label_break"></div>

                    <b>Team Registration<br />Check-In Time</b> <div class="time_box"></div>
                    
                </div>                
            </div>            

            <br class="clear" /><br />

            <div class="full">

                <div class="half">

                    <b>Participants</b><br />
                    <table class="participants" style="width: 95%;">
                        <thead>
                            <tr>
                                <th style="padding-left: 5px;">#</th>
                                <th>Name</th>
                                <th>Gr.</th>
                                <th>Pass</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php foreach ($team->participants as $i => $participant): ?>
                                <tr>
                                    <td style="padding-left: 5px;">
                                        <?php echo ($i + 1); ?>.
                                    </td>
                                    <td>
                                        <?php echo $participant->name; ?>
                                        <?php if ($participant->is_alternate): ?>
                                            - Alt.
                                        <?php endif; ?>
                                    </td>
                                    <td>
                                        <?php if (!Helpers::strIsEmpty($participant->grade)): ?>
                                            <?php echo $participant->grade; ?>
                                        <?php endif; ?>
                                    </td>
                                    <td style="padding-left: 5px; text-align: center;">
                                        <div style="width: 1em; height: 1em; border: 1px solid black;"></div>
                                    </td>
                                </tr>
                            <?php endforeach; ?>
                        </tbody>
                    </table>
                    
                </div>

                <div class="half">
                    
                    <div class="label">Team Room</div>
                    <div class="value"><?php echo $team->assigned_room; ?></div>

                    <br />


                    <b>Coaches</b><br />
                    <table class="coaches" style="width: 95%;">

                        <thead>
                            <tr>
                                <th>Name &amp; Info.</th>
                                <th>Role</th>                                
                                <th>Pass</th>
                            </tr>
                        </thead>

                        <tbody>
                            <tr>
                                <td style="padding-left: 5px; padding-top: 2px;">
                                    <?php echo $team->head_coach->getDisplayName(); ?><br />
                                    <div style="font-size: 10pt; margin-left: 20px; margin-bottom: 1em;">
                                        <?php if (!Helpers::strIsEmpty($team->head_coach->work_phone)): ?>
                                            W: <?php echo Helpers::displayCombinedPhone($team->head_coach->work_phone); ?><br />
                                        <?php endif; ?>
                                        <?php if (!Helpers::strIsEmpty($team->head_coach->mobile_phone)): ?>
                                            M: <?php echo Helpers::displayCombinedPhone($team->head_coach->mobile_phone); ?>
                                        <?php endif; ?>                                        
                                    </div>
                                </td>
                                <td style="padding-top: 2px;">Head Coach</td>
                                <td style="padding-left: 5px; padding-top: 2px; text-align: center;">
                                    <div style="width: 1em; height: 1em; border: 1px solid black;"></div>
                                </td>
                            </tr>

                            <?php foreach ($team->asst_coaches as $asst_coach): ?>

                                <?php
                                    $asst_coach = $asst_coach->school_staff;
                                ?>

                                <?php if (Helpers::strIsEmpty($asst_coach->work_phone) and Helpers::strIsEmpty($asst_coach->mobile_phone)): ?>
                                    <tr style="line-height: 2em;">
                                <?php else: ?>
                                    <tr>
                                <?php endif; ?>
                                    <td style="padding-left: 5px;">
                                        <?php echo $asst_coach->getDisplayName(); ?>
                                        <?php if (!Helpers::strIsEmpty($asst_coach->work_phone) or !Helpers::strIsEmpty($asst_coach->mobile_phone)): ?>
                                            <br />
                                            <div style="font-size: 10pt; margin-left: 20px; margin-bottom: 1em;">
                                                <?php if (!Helpers::strIsEmpty($asst_coach->work_phone)): ?>
                                                    W: <?php echo Helpers::displayCombinedPhone($asst_coach->work_phone); ?><br />
                                                <?php endif; ?>
                                                <?php if (!Helpers::strIsEmpty($asst_coach->mobile_phone)): ?>
                                                    M: <?php echo Helpers::displayCombinedPhone($asst_coach->mobile_phone); ?>
                                                <?php endif; ?>                                        
                                            </div>
                                        <?php endif; ?>
                                    </td>
                                    <td>Asst. Coach</td>
                                    <?php if (Helpers::strIsEmpty($asst_coach->work_phone) and Helpers::strIsEmpty($asst_coach->mobile_phone)): ?>
                                        <td style="padding-left: 5px; text-align: center; vertical-align: middle;">
                                    <?php else: ?>
                                        <td style="padding-left: 5px; padding-top: 2px; text-align: center; vertical-align: top;">
                                    <?php endif; ?>

                                        <div style="width: 1em; height: 1em; border: 1px solid black;"></div>
                                    </td>
                                </tr>

                            <?php endforeach; ?>

                        </tbody>
                    </table>

                    <br class="clear" /><br /><br /><br />

                    <b>Ticket/Pass Exchanges</b> <div class="exchange_box"></div>
                    <br />
                    <div style="font-size: 10pt; margin-top: 1em;">
                        Ticket exchanges for passes are only allowed for extra participants not shown on this roster.  Parents or other adults are not allowed to exchange tickets for a pass.  Exchanges are to be handled only by designated OSAA staff and tallied in the box above.
                    </div>

                    <br class="clear" /><br /><br /><br />

                    <b>School Contact Information</b><br />

                    <?php echo $team->ad->getDisplayName(); ?>, Athletic Director<br />
                    <div style="font-size: 10pt; margin-left: 20px; margin-bottom: 1em;">
                        <?php if (Helpers::strIsEmpty($team->ad->work_phone) and Helpers::strIsEmpty($team->ad->mobile_phone)): ?>
                            No contact phone numbers on file.
                        <?php else: ?>
                            <?php if (!Helpers::strIsEmpty($team->ad->work_phone)): ?>
                                W: <?php echo Helpers::displayCombinedPhone($team->ad->work_phone); ?><br />
                            <?php endif; ?>
                            <?php if (!Helpers::strIsEmpty($team->ad->mobile_phone)): ?>
                                M: <?php echo Helpers::displayCombinedPhone($team->ad->mobile_phone); ?>
                            <?php endif; ?>                                        
                        <?php endif; ?>
                    </div>
                </div>

            </div>
            
            
            <div class="page_break clear"></div>


        <?php endforeach; ?>

    </body>    
</html>   
