Chcialbym uzyskac jeden zbiorczy formularz, ktory by umoziliwil multi edycje cen produktow.
Korzystam na co dzien z paneli CRUD. W jaki sposob to zrobic?
Moj custom form dla pojedynczego produktu wyglada mniej wiecej tak:
...
{{ form_row(form.priceNetto, { 'label' : 'Cena netto' }) }}
{{ form_row(form.priceBrutto, { 'label' : 'Cena brutto' }) }}
...
{{ form_rest(form) }}
Lista produktow w pliku index.html.twig wygenerowanym przez SF2 zas mniej wiecej tak:
{% for entity in entities %}
{% if entity.isActive == 0 %}
{% else %}
{% endif %}
<td class="hidden-print"><input type="checkbox" name="entities[]" value="{{ entity.id }}"></td> <td><a href="{{ path('backend_products_show', { 'id': entity.id }) }}" data-toggle="tooltip" data-placement="top" title="pokaż">{{ entity.id }}
</a></td> {# {% if entity.images is not empty %} #}
{% for image in entity.images %}
{% if loop.first %}
{% if image.filename and image.isActive %}
<a class="fancybox" href="{{ asset(imgPath) }}{{ entity.slug }}/{{ image.filename }}"> <img class="img-responsive thumbnail center-block" src="{{ asset(imgPath) }}{{ entity.slug }}/{{ image.filename }}" width="50" height="50" data-toggle="tooltip" data-placement="top" title="{{ image.title }}" alt="{{ image.alt }}" /></a> {% elseif image.filename is empty %}
<img class="img-responsive thumbnail center-block" src="{{ asset(imgPath) }}{{ noImg }}" width="50" height="50" title="{{ image.title }}" alt="{{ image.alt }}" />{% endif %}
{% endif %}
{% endfor %}
{#
{% elseif entity.images is empty %}
<img class="img-responsive thumbnail center-block" src="{{ asset(imgPath) }}{{ noImg }}" width="50" height="50" title="{{ image.title }}" alt="{{ image.alt }}" /> {% endif %}
#}
<td>{{ entity.sku }}
</td> <td><a href="{{ path('backend_products_edit', { 'id': entity.id }) }}" data-toggle="tooltip" data-placement="top" title="edytuj">{{ entity.name }}
</a></td> <td>{{ entity.brands }}
</td> {% if entity.categories is not empty %}
{% for category in entity.categories %}
{% endfor %}
{% elseif entity.categories is empty %}
<p>Nie wybrano kategorii
</p> {% endif %}
<td>{% if entity.priceNetto %}{{ entity.priceNetto|number_format(2, ',', '') }} {{ app_config.currency_pl }}{% endif %}
</td> <td>{% if entity.priceBrutto %}{{ entity.priceBrutto|number_format(2, ',', '') }} {{ app_config.currency_pl }}{% endif %}
</td> <td>{% if entity.isActive == 1 %}
<img src="{{ asset(iconsPath) }}/{{ iconTickYES }}" data-toggle="tooltip" data-placement="top" title="Opublikowano" alt="Opublikowano" />{% elseif entity.isActive == 0 %}
<img src="{{ asset(iconsPath) }}/{{ iconTickNO }}" data-toggle="tooltip" data-placement="top" title="Nie opublikowano" alt="Nie opublikowano" />{% endif %}
</td> <td>{% if entity.isNew == '1' %}
<img src="{{ asset(iconsPath) }}/{{ iconYES }}" data-toggle="tooltip" data-placement="top" title="Tak" alt="Tak" />{% elseif entity.isNew == '0' %}
<img src="{{ asset(iconsPath) }}/{{ iconNO }}" data-toggle="tooltip" data-placement="top" title="Nie" alt="Nie" />{% endif %}
</td> <td>{% if entity.isPromo == '1' %}
<img src="{{ asset(iconsPath) }}/{{ iconYES }}" data-toggle="tooltip" data-placement="top" title="Tak" alt="Tak" />{% elseif entity.isPromo == '0' %}
<img src="{{ asset(iconsPath) }}/{{ iconNO }}" data-toggle="tooltip" data-placement="top" title="Nie" alt="Nie" />{% endif %}
</td> <td>{% if entity.isPopular == '1' %}
<img src="{{ asset(iconsPath) }}/{{ iconYES }}" data-toggle="tooltip" data-placement="top" title="Tak" alt="Tak" />{% elseif entity.isPopular == '0' %}
<img src="{{ asset(iconsPath) }}/{{ iconNO }}" data-toggle="tooltip" data-placement="top" title="Nie" alt="Nie" />{% endif %}
</td> <td>{% if entity.created %}{{ entity.created|date('d-m-Y H:i:s') }}{% endif %}
</td> <td>{% if entity.updated %}{{ entity.updated|date('d-m-Y H:i:s') }}{% endif %}
</td> <td>{{ entity.getAvailability() }}
</td> <td class="hidden-print"> <div class="text-center"> <a class="btn btn-primary btn-xs" data-toggle="tooltip" data-placement="top" title="pokaż" href="{{ path('backend_products_show', { 'id': entity.id }) }}"><span class="glyphicon glyphicon-search"></span></a> <a class="btn btn-info btn-xs" data-toggle="tooltip" data-placement="top" title="edytuj" href="{{ path('backend_products_edit', { 'id': entity.id }) }}"><span class="glyphicon glyphicon-edit"></span></a> {% endfor %}
Prosze o jakas podpowiedz.
Byc moze nie nakreslilem jasno swoich oczekiwan, co do formularza.
Widzialbym go jako podobny do tego z ponizszego zdjecia: