<commit_before><?php

$display_shipping_date = true;

switch($booking->status) {
    case 'shipped':
        $intro_text = _i('Di seguito il riassunto dei prodotti che ti sono stati consegnati:');
        $display_shipping_date = false;
        $attribute = 'delivered';
        $function = 'deliveredValue';
        $total_function = 'delivered';
        break;

    case 'saved':
        $intro_text = _i('Di seguito il riassunto dei prodotti che ti saranno consegnati:');
        $attribute = 'delivered';
        $function = 'deliveredValue';
        $total_function = 'delivered';
        break;

    case 'pending':
        $intro_text = _i('Di seguito il riassunto dei prodotti che hai ordinato:');
        $attribute = 'quantity';
        $function = 'quantityValue';
        $total_function = 'value';
        break;
}

$global_total = 0;
$bookings_tot = 0;

?>

<p>
    {{ $intro_text }}
</p>

@foreach($booking->bookings as $b)
    <?php $variable = false ?>

    <h3>{{ $b->order->supplier->printableName() }}</h3>

    <table style="width:100%">
        <thead>
            <th style="width:50%; text-align: left">{{ _i('Prodotto') }}</th>
            <th style="width:25%; text-align: left">{{ _i('Quantità') }}</th>
            <th style="width:25%; text-align: left">{{ _i('Prezzo') }}</th>
        </thead>

        <tbody>
            @foreach($b->products as $product)
                @if($product->$attribute != 0)
                    <?php $variable = $variable || $product->product->variable ?>
                    <tr>
                        <td>{{ $product->product->printableName() }}</td>
                        <td>{{ $product->$attribute }} {{ $product->product->printableMeasure() }}</td>
                        <td>{{ printablePriceCurrency($product->$function()) }}</td>
                    </tr>
                @endif
            @endforeach

            <?php

            $bookings_tot++;
            $tot = $b->$total_function;
            $global_total += $tot;

            ?>

            <tr>
                <td><strong>{{ _i('Totale') }}</strong></td>
                <td>&nbsp;</td>
                <td>{{ printablePriceCurrency($tot) }}</td>
            </tr>
        </tbody>
    </table>

    @if($b->friends_bookings->isEmpty() == false)
        <h5>{{ _i('Gli ordini dei tuoi amici') }}</h5>

        @foreach($b->friends_bookings as $fb)
            <p>{{ $fb->user->printableName() }}</p>

            <table style="width:100%">
                <thead>
                    <th style="width:50%; text-align: left">{{ _i('Prodotto') }}</th>
                    <th style="width:25%; text-align: left">{{ _i('Quantità') }}</th>
                    <th style="width:25%; text-align: left">{{ _i('Prezzo') }}</th>
                </thead>

                <tbody>
                    @foreach($fb->products as $product)
                        @if($product->$attribute != 0)
                            <?php $variable = $variable || $product->product->variable ?>
                            <tr>
                                <td>{{ $product->product->printableName() }}</td>
                                <td>{{ $product->$attribute }} {{ $product->product->printableMeasure() }}</td>
                                <td>{{ printablePriceCurrency($product->$function()) }}</td>
                            </tr>
                        @endif
                    @endforeach

                    <?php

                    $bookings_tot++;
                    $tot = $fb->$total_function;
                    $global_total += $tot;

                    ?>

                    <tr>
                        <td><strong>{{ _i('Totale') }}</strong></td>
                        <td>&nbsp;</td>
                        <td>{{ printablePriceCurrency($tot) }}</td>
                    </tr>
                </tbody>
            </table>
        @endforeach
    @endif

    @if($display_shipping_date && $variable)
        <p>
            {{ _i("L'importo reale di questo ordine dipende dal peso effettivo dei prodotti consegnati; il totale qui riportato è solo indicativo.") }}
        </p>
    @endif
@endforeach

@if($bookings_tot > 1)
    <p>
        {{ _i('Totale da pagare: %s', [printablePriceCurrency($global_total)]) }}
    </p>
@endif

@if($display_shipping_date && $b && $b->order->shipping != null)
    <p>
        {{ _i('La consegna avverrà %s.', [$b->order->printableDate('shipping')]) }}
    </p><commit_msg>fix email riepilogo prenotazione<commit_after><?php

$display_shipping_date = true;

switch($booking->status) {
    case 'shipped':
        $intro_text = _i('Di seguito il riassunto dei prodotti che ti sono stati consegnati:');
        $display_shipping_date = false;
        $attribute = 'delivered';
        $function = 'deliveredValue';
        break;

    case 'saved':
        $intro_text = _i('Di seguito il riassunto dei prodotti che ti saranno consegnati:');
        $attribute = 'delivered';
        $function = 'deliveredValue';
        break;

    case 'pending':
        $intro_text = _i('Di seguito il riassunto dei prodotti che hai ordinato:');
        $attribute = 'quantity';
        $function = 'quantityValue';
        break;
}

$global_total = 0;
$bookings_tot = 0;

?>

<p>
    {{ $intro_text }}
</p>

@foreach($booking->bookings as $b)
    <?php $variable = false ?>

    <h3>{{ $b->order->supplier->printableName() }}</h3>

    <table style="width:100%">
        <thead>
            <th style="width:50%; text-align: left">{{ _i('Prodotto') }}</th>
            <th style="width:25%; text-align: left">{{ _i('Quantità') }}</th>
            <th style="width:25%; text-align: left">{{ _i('Prezzo') }}</th>
        </thead>

        <tbody>
            @foreach($b->products as $product)
                @if($product->$attribute != 0)
                    <?php $variable = $variable || $product->product->variable ?>
                    <tr>
                        <td>{{ $product->product->printableName() }}</td>
                        <td>{{ $product->$attribute }} {{ $product->product->printableMeasure() }}</td>
                        <td>{{ printablePriceCurrency($product->$function()) }}</td>
                    </tr>
                @endif
            @endforeach

            <?php

            $bookings_tot++;
            $tot = $b->getValue('effective', false);
            $global_total += $tot;

            ?>

            <tr>
                <td><strong>{{ _i('Trasporto') }}</strong></td>
                <td>&nbsp;</td>
                <td>{{ printablePriceCurrency($b->getValue('transport', false)) }}</td>
            </tr>
            <tr>
                <td><strong>{{ _i('Sconto') }}</strong></td>
                <td>&nbsp;</td>
                <td>{{ printablePriceCurrency($b->getValue('discount', false)) }}</td>
            </tr>
            <tr>
                <td><strong>{{ _i('Totale') }}</strong></td>
                <td>&nbsp;</td>
                <td>{{ printablePriceCurrency($tot) }}</td>
            </tr>
        </tbody>
    </table>

    @if($b->friends_bookings->isEmpty() == false)
        <h5>{{ _i('Gli ordini dei tuoi amici') }}</h5>

        @foreach($b->friends_bookings as $fb)
            <p>{{ $fb->user->printableName() }}</p>

            <table style="width:100%">
                <thead>
                    <th style="width:50%; text-align: left">{{ _i('Prodotto') }}</th>
                    <th style="width:25%; text-align: left">{{ _i('Quantità') }}</th>
                    <th style="width:25%; text-align: left">{{ _i('Prezzo') }}</th>
                </thead>

                <tbody>
                    @foreach($fb->products as $product)
                        @if($product->$attribute != 0)
                            <?php $variable = $variable || $product->product->variable ?>
                            <tr>
                                <td>{{ $product->product->printableName() }}</td>
                                <td>{{ $product->$attribute }} {{ $product->product->printableMeasure() }}</td>
                                <td>{{ printablePriceCurrency($product->$function()) }}</td>
                            </tr>
                        @endif
                    @endforeach

                    <?php

                    $bookings_tot++;
                    $tot = $fb->getValue('effective', false);
                    $global_total += $tot;

                    ?>

                    <tr>
                        <td><strong>{{ _i('Trasporto') }}</strong></td>
                        <td>&nbsp;</td>
                        <td>{{ printablePriceCurrency($fb->getValue('transport', false)) }}</td>
                    </tr>
                    <tr>
                        <td><strong>{{ _i('Sconto') }}</strong></td>
                        <td>&nbsp;</td>
                        <td>{{ printablePriceCurrency($fb->getValue('discount', false)) }}</td>
                    </tr>
                    <tr>
                        <td><strong>{{ _i('Totale') }}</strong></td>
                        <td>&nbsp;</td>
                        <td>{{ printablePriceCurrency($tot) }}</td>
                    </tr>
                </tbody>
            </table>
        @endforeach
    @endif

    @if($display_shipping_date && $variable)
        <p>
            {{ _i("L'importo reale di questo ordine dipende dal peso effettivo dei prodotti consegnati; il totale qui riportato è solo indicativo.") }}
        </p>
    @endif
@endforeach

@if($bookings_tot > 1)
    <p>
        {{ _i('Totale da pagare: %s', [printablePriceCurrency($global_total)]) }}
    </p>
@endif

@if($display_shipping_date && $b && $b->order->shipping != null)
    <p>
        {{ _i('La consegna avverrà %s.', [$b->order->printableDate('shipping')]) }}
    </p>
{'fraction_non_alphanumeric': 0.1762011400651466, 'fraction_numerical': 0.005496742671009772, 'mean_word_length': 1.5579276230148398, 'pattern_counts': {'":': 0, '<': 203, '<?xml version=': 0, '>': 281, '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': '5207702', 'n_tokens_mistral': 3014, 'n_tokens_neox': 2809, 'n_words': 580}