<commit_before>{#
 # This file is part of the OpenMiamMiam project.
 # (c) Isics <<EMAIL>>
 #
 # This source file is subject to the AGPL v3 license that is bundled
 # with this source code in the file LICENSE.
 #}
{% extends 'IsicsOpenMiamMiamBundle:Admin:admin.html.twig' %}

{% block content %}
    <div class="row">
        <div class="col-md-6">
            <h1>{{ 'admin.producer.sales_orders.list.title'|transchoice(salesOrders|length, {'%nb%': salesOrders|length}) }}</h1>
        </div>
    </div>

    {% for branchOccurrenceSalesOrders in salesOrders.branchOccurrencesSalesOrders %}
        <h2>
            {{ branchOccurrenceSalesOrders.branchOccurrence.branch.name }}
            - {{ branchOccurrenceSalesOrders.branchOccurrence.begin|format_date }}
        </h2>

        {% if branchOccurrenceSalesOrders.salesOrders|length > 0 %}

            <p>
                <form class="form-inline" role="form" data-type="action-in-select">
                    <div class="form-group">
                        <select class="form-control input-md">
                            <option value="{{ path('open_miam_miam.admin.producer.sales_order.get_products_to_prepare_pdf_for_branch_occurrence', {'id': producer.id, 'branchOccurrenceId': branchOccurrenceSalesOrders.branchOccurrence.id}) }}">{{ 'admin.producer.sales_orders.list.export.products_to_prepare'|trans }}</option>
                            <option value="{{ path('open_miam_miam.admin.producer.sales_order.get_sales_orders_pdf_for_branch_occurrence', {'id': producer.id, 'branchOccurrenceId': branchOccurrenceSalesOrders.branchOccurrence.id}) }}">{{ 'admin.producer.sales_orders.list.export.sales_orders'|trans }}</option>
                        </select>
                    </div>
                    <button type="submit" class="btn btn-primary btn-md">
                        <span class="glyphicon glyphicon-open"></span>
                        {{ 'admin.producer.sales_orders.list.export'|trans }}
                    </button>
                </form>
            </p>

            <div class="table-responsive">
                <table class="table table-bordered table_condensed table-striped table-producer-sales-orders">
                    <thead>
                        <tr>
                            <th>{{ 'admin.producer.sales_orders.list.ref'|trans }}</th>
                            <th>{{ 'admin.producer.sales_orders.list.date'|trans }}</th>
                            <th>{{ 'admin.producer.sales_orders.list.consumer'|trans }}</th>
                            <th>{{ 'admin.producer.sales_orders.list.producer_total'|trans }}</th>
                            <th>&nbsp;</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for producerSalesOrder in branchOccurrenceSalesOrders.salesOrders %}
                            {% set canBeEdit = can_be_edit(producerSalesOrder.salesOrder) %}
                            <tr>
                                <td>
                                    {% if canBeEdit %}
                                        <a href="{{ path('open_miam_miam.admin.producer.sales_order.edit', {'id': producer.id, 'salesOrderId': producerSalesOrder.salesOrder.id}) }}">
                                    {% else %}
                                        <a href="{{ path('open_miam_miam.admin.producer.sales_order.view', {'id': producer.id, 'salesOrderId': producerSalesOrder.salesOrder.id}) }}">
                                    {% endif %}
                                        {{ producerSalesOrder.salesOrder.ref }}
                                        </a>
                                    </td>
                                <td>{{ producerSalesOrder.salesOrder.date|format_datetime(null, null, null, constant('IntlDateFormatter::SHORT')) }}</td>
                                <td>
                                    {% if producerSalesOrder.salesOrder.user %}
                                        {{ format_identity(producerSalesOrder.salesOrder.firstname, producerSalesOrder.salesOrder.lastname, '%firstname% %lastname%') }}({{ producerSalesOrder.salesOrder.user|format_consumer_ref }})
                                        {% if producerSalesOrder.salesOrder.user.phoneNumber is not null %}
                                            <br />
                                            {{ 'admin.producer.sales_orders.list.phone_number'|trans }}
                                            {{ producerSalesOrder.salesOrder.user.phoneNumber }}
                                        {% endif %}
                                    {% else %}
                                        {{ 'admin.association.sales_orders.anonymous'|trans }}
                                    {% endif %}
                                </td>
                                <td>{{ producerSalesOrder.total|number_format_currency(open_miam_miam.currency) }}</td>
                                <td>
                                    {% if canBeEdit %}
                                        <a href="{{ path('open_miam_miam.admin.producer.sales_order.edit', {'id': producer.id, 'salesOrderId': producerSalesOrder.salesOrder.id}) }}" class="btn btn-primary btn-xs" title="{{ 'admin.producer.sales_orders.list.edit'|trans }}"><span class="glyphicon glyphicon-pencil"></span></a>
                                    {% else %}
                                        <a href="{{ path('open_miam_miam.admin.producer.sales_order.view', {'id': producer.id, 'salesOrderId': producerSalesOrder.salesOrder.id}) }}" class="btn btn-primary btn-xs" title="{{ 'admin.producer.sales_orders.list.view'|trans }}"><span class="glyphicon glyphicon-pencil"></span></a>
                                    {% endif %}
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        {% else %}
            {% include 'IsicsOpenMiamMiamBundle:Admin:empty.html.twig' with {'message': 'admin.producer.sales_orders.list.no_order'|trans} %}
        {% endif %}
    {% endfor %}
{% endblock %}

{% block javascript %}
    {{ parent() }}
    <script type="text/javascript">
        $(function() {
            new OpenMiamMiam.ActionInSelectForm();
        });
    </script>
{% endblock %}
<commit_msg>Fix salesOrder show consumer lastname and first letter of firstname<commit_after>{#
 # This file is part of the OpenMiamMiam project.
 # (c) Isics <<EMAIL>>
 #
 # This source file is subject to the AGPL v3 license that is bundled
 # with this source code in the file LICENSE.
 #}
{% extends 'IsicsOpenMiamMiamBundle:Admin:admin.html.twig' %}

{% block content %}
    <div class="row">
        <div class="col-md-6">
            <h1>{{ 'admin.producer.sales_orders.list.title'|transchoice(salesOrders|length, {'%nb%': salesOrders|length}) }}</h1>
        </div>
    </div>

    {% for branchOccurrenceSalesOrders in salesOrders.branchOccurrencesSalesOrders %}
        <h2>
            {{ branchOccurrenceSalesOrders.branchOccurrence.branch.name }}
            - {{ branchOccurrenceSalesOrders.branchOccurrence.begin|format_date }}
        </h2>

        {% if branchOccurrenceSalesOrders.salesOrders|length > 0 %}

            <p>
                <form class="form-inline" role="form" data-type="action-in-select">
                    <div class="form-group">
                        <select class="form-control input-md">
                            <option value="{{ path('open_miam_miam.admin.producer.sales_order.get_products_to_prepare_pdf_for_branch_occurrence', {'id': producer.id, 'branchOccurrenceId': branchOccurrenceSalesOrders.branchOccurrence.id}) }}">{{ 'admin.producer.sales_orders.list.export.products_to_prepare'|trans }}</option>
                            <option value="{{ path('open_miam_miam.admin.producer.sales_order.get_sales_orders_pdf_for_branch_occurrence', {'id': producer.id, 'branchOccurrenceId': branchOccurrenceSalesOrders.branchOccurrence.id}) }}">{{ 'admin.producer.sales_orders.list.export.sales_orders'|trans }}</option>
                        </select>
                    </div>
                    <button type="submit" class="btn btn-primary btn-md">
                        <span class="glyphicon glyphicon-open"></span>
                        {{ 'admin.producer.sales_orders.list.export'|trans }}
                    </button>
                </form>
            </p>

            <div class="table-responsive">
                <table class="table table-bordered table_condensed table-striped table-producer-sales-orders">
                    <thead>
                        <tr>
                            <th>{{ 'admin.producer.sales_orders.list.ref'|trans }}</th>
                            <th>{{ 'admin.producer.sales_orders.list.date'|trans }}</th>
                            <th>{{ 'admin.producer.sales_orders.list.consumer'|trans }}</th>
                            <th>{{ 'admin.producer.sales_orders.list.producer_total'|trans }}</th>
                            <th>&nbsp;</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for producerSalesOrder in branchOccurrenceSalesOrders.salesOrders %}
                            {% set canBeEdit = can_be_edit(producerSalesOrder.salesOrder) %}
                            <tr>
                                <td>
                                    {% if canBeEdit %}
                                        <a href="{{ path('open_miam_miam.admin.producer.sales_order.edit', {'id': producer.id, 'salesOrderId': producerSalesOrder.salesOrder.id}) }}">
                                    {% else %}
                                        <a href="{{ path('open_miam_miam.admin.producer.sales_order.view', {'id': producer.id, 'salesOrderId': producerSalesOrder.salesOrder.id}) }}">
                                    {% endif %}
                                        {{ producerSalesOrder.salesOrder.ref }}
                                        </a>
                                    </td>
                                <td>{{ producerSalesOrder.salesOrder.date|format_datetime(null, null, null, constant('IntlDateFormatter::SHORT')) }}</td>
                                <td>
                                    {% if producerSalesOrder.salesOrder.user %}
                                        {{ format_identity(null, producerSalesOrder.salesOrder.lastname, '%firstname% %lastname%') }}{{ format_identity(producerSalesOrder.salesOrder.firstname, null, '%lastname% %firstname%')|first }}.({{ producerSalesOrder.salesOrder.user|format_consumer_ref }})
                                        {% if producerSalesOrder.salesOrder.user.phoneNumber is not null %}
                                            <br />
                                            {{ 'admin.producer.sales_orders.list.phone_number'|trans }}
                                            {{ producerSalesOrder.salesOrder.user.phoneNumber }}
                                        {% endif %}
                                    {% else %}
                                        {{ 'admin.association.sales_orders.anonymous'|trans }}
                                    {% endif %}
                                </td>
                                <td>{{ producerSalesOrder.total|number_format_currency(open_miam_miam.currency) }}</td>
                                <td>
                                    {% if canBeEdit %}
                                        <a href="{{ path('open_miam_miam.admin.producer.sales_order.edit', {'id': producer.id, 'salesOrderId': producerSalesOrder.salesOrder.id}) }}" class="btn btn-primary btn-xs" title="{{ 'admin.producer.sales_orders.list.edit'|trans }}"><span class="glyphicon glyphicon-pencil"></span></a>
                                    {% else %}
                                        <a href="{{ path('open_miam_miam.admin.producer.sales_order.view', {'id': producer.id, 'salesOrderId': producerSalesOrder.salesOrder.id}) }}" class="btn btn-primary btn-xs" title="{{ 'admin.producer.sales_orders.list.view'|trans }}"><span class="glyphicon glyphicon-pencil"></span></a>
                                    {% endif %}
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        {% else %}
            {% include 'IsicsOpenMiamMiamBundle:Admin:empty.html.twig' with {'message': 'admin.producer.sales_orders.list.no_order'|trans} %}
        {% endif %}
    {% endfor %}
{% endblock %}

{% block javascript %}
    {{ parent() }}
    <script type="text/javascript">
        $(function() {
            new OpenMiamMiam.ActionInSelectForm();
        });
    </script>
{% endblock %}

{'fraction_non_alphanumeric': 0.12966114807365, 'fraction_numerical': 0.0010830883490639022, 'mean_word_length': 1.5189010132501948, 'pattern_counts': {'":': 0, '<': 147, '<?xml version=': 0, '>': 149, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 72, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3145796', 'n_tokens_mistral': 3590, 'n_tokens_neox': 3214, 'n_words': 507}