<commit_before><?php

use Carbon\Carbon;

?>

<style>
    table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 2em;
    }

    table, th, td {
        border: 1px solid black;
    }

    thead tr {
        background-color: #434343;
        color: #fff;
    }

    th, td {
        padding: 0.5em 1em;
    }

    .icon {
        text-align: center;
        font-size: 2em;
        padding: 0;
    }
</style>

@foreach($departments as $department)
    <h1>{{ $department->name }}</h1>

    @foreach($department->schedule()->orderBy('duration', 'desc')->orderBy('start_date')->groupBy('shift_id')->get() as $schedule)
        <?php

        $schedule_ids = $department->schedule()->where('shift_id', $schedule->shift->id)->get()->pluck('id');

        ?>
        <table>
            <thead>
                <tr>
                    <th>{{ $schedule->shift->name }}</th>
                    <th>Date</th>
                    <th>Day</th>
                    <th>Start Time</th>
                    <th>End Time</th>
                    <th>Username</th>
                    <th>Real Name</th>
                    <th>Flake?</th>
                    <th>Awesome?</th>
                </tr>
            </thead>

            <tbody>
                @foreach($department->slots()->whereIn('schedule_id', $schedule_ids)->orderBy('start_date')->orderBy('start_time')->get() as $slot)
                    <?php

                    $date = new Carbon($slot->start_date);
                    $day = $date->formatLocalized('%A');
                    $start = strtotime($slot->start_time);
                    $end = strtotime($slot->end_time);

                    ?>
                    <tr>
                        <td>&nbsp;</td>
                        <td>{{ $slot->start_date }}</td>
                        <td>{{ $day }}</td>
                        <td>{{ $slot->start_time }} ({{ date("h:i a", $start) }})</td>
                        <td>{{ $slot->end_time }} ({{ date("h:i a", $end) }})</td>
                        <td>
                            @if(count($slot->user))
                                <b>{{ $slot->user->name }}</b>
                            @else
                                OPEN
                            @endif
                        </td>
                        <td><b>{{ $slot->user->data->full_name or '' }}</b></td>
                        <td class="icon">😕</td>
                        <td class="icon">😊</td>
                    </tr>
                @endforeach
            </tbody>
        </table>

        <p>
            <i>Instructions: Fill in the smiley faces to mark who flaked and who did an awesome job. Be sure to fill the circle in completely, so it looks like this: ⬤</i>
        </p>
        <hr><commit_msg>Added grey background toggle for each day in reports<commit_after><?php

use Carbon\Carbon;

?>

<style>
    table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 2em;
    }

    table, th, td {
        border: 1px solid black;
    }

    thead tr {
        background-color: #434343;
        color: #fff;
    }

    th, td {
        padding: 0.5em 1em;
    }

    .icon {
        text-align: center;
        font-size: 2em;
        padding: 0;
    }

    .grey {
        background-color: #ccc;
    }
</style>

@foreach($departments as $department)
    <h1>{{ $department->name }}</h1>

    @foreach($department->schedule()->orderBy('duration', 'desc')->orderBy('start_date')->groupBy('shift_id')->get() as $schedule)
        <?php

        $schedule_ids = $department->schedule()->where('shift_id', $schedule->shift->id)->get()->pluck('id');
        $previousDay = false;
        $background = 1;

        ?>
        <table>
            <thead>
                <tr>
                    <th>{{ $schedule->shift->name }}</th>
                    <th>Date</th>
                    <th>Day</th>
                    <th>Start Time</th>
                    <th>End Time</th>
                    <th>Username</th>
                    <th>Real Name</th>
                    <th>Flake?</th>
                    <th>Awesome?</th>
                </tr>
            </thead>

            <tbody>
                @foreach($department->slots()->whereIn('schedule_id', $schedule_ids)->orderBy('start_date')->orderBy('start_time')->get() as $slot)
                    <?php

                    $date = new Carbon($slot->start_date);
                    $day = $date->formatLocalized('%A');
                    $start = strtotime($slot->start_time);
                    $end = strtotime($slot->end_time);

                    if($day != $previousDay)
                    {
                        $background++;
                    }

                    $previousDay = $day;

                    ?>
                    <tr class="{{ $background % 2 ? 'grey' : ''}}">
                        <td>&nbsp;</td>
                        <td>{{ $slot->start_date }}</td>
                        <td>{{ $day }}</td>
                        <td>{{ $slot->start_time }} ({{ date("h:i a", $start) }})</td>
                        <td>{{ $slot->end_time }} ({{ date("h:i a", $end) }})</td>
                        <td>
                            @if(count($slot->user))
                                <b>{{ $slot->user->name }}</b>
                            @else
                                OPEN
                            @endif
                        </td>
                        <td><b>{{ $slot->user->data->full_name or '' }}</b></td>
                        <td class="icon">😕</td>
                        <td class="icon">😊</td>
                    </tr>
                @endforeach
            </tbody>
        </table>

        <p>
            <i>Instructions: Fill in the smiley faces to mark who flaked and who did an awesome job. Be sure to fill the circle in completely, so it looks like this: ⬤</i>
        </p>
        <hr>
{'fraction_non_alphanumeric': 0.16255247691015953, 'fraction_numerical': 0.006381192275398824, 'mean_word_length': 1.128663330950679, 'pattern_counts': {'":': 0, '<': 127, '<?xml version=': 0, '>': 191, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '377806', 'n_tokens_mistral': 1810, 'n_tokens_neox': 1642, 'n_words': 341}