Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [SF2][SF] Formularz w trybie multi edycji
Forum PHP.pl > Forum > PHP > Frameworki
swiezak
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:
  1. ...
  2. {{ form_row(form.priceNetto, { 'label' : 'Cena netto' }) }}
  3. {{ form_row(form.priceBrutto, { 'label' : 'Cena brutto' }) }}
  4. ...
  5. {{ form_rest(form) }}


Lista produktow w pliku index.html.twig wygenerowanym przez SF2 zas mniej wiecej tak:
  1. {% for entity in entities %}
  2. {% if entity.isActive == 0 %}
  3. <tr class="warning">
  4. {% else %}
  5. <tr>
  6. {% endif %}
  7. <td class="hidden-print"><input type="checkbox" name="entities[]" value="{{ entity.id }}"></td>
  8. <td><a href="{{ path('backend_products_show', { 'id': entity.id }) }}" data-toggle="tooltip" data-placement="top" title="pokaż">{{ entity.id }}</a></td>
  9. <td>
  10. {# {% if entity.images is not empty %} #}
  11. {% for image in entity.images %}
  12. {% if loop.first %}
  13. {% if image.filename and image.isActive %}<a class="fancybox" href="{{ asset(imgPath) }}{{ entity.slug }}/{{ image.filename }}">
  14. <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>
  15. {% 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 %}
  16. {% endif %}
  17. {% endfor %}
  18. {#
  19. {% elseif entity.images is empty %}
  20. <img class="img-responsive thumbnail center-block" src="{{ asset(imgPath) }}{{ noImg }}" width="50" height="50" title="{{ image.title }}" alt="{{ image.alt }}" />
  21. {% endif %}
  22. #}
  23. </td>
  24. <td>{{ entity.sku }}</td>
  25. <td><a href="{{ path('backend_products_edit', { 'id': entity.id }) }}" data-toggle="tooltip" data-placement="top" title="edytuj">{{ entity.name }}</a></td>
  26. <td>{{ entity.brands }}</td>
  27. <td>
  28. {% if entity.categories is not empty %}
  29. {% for category in entity.categories %}
  30. <p>{{ category }}</p>
  31. {% endfor %}
  32. {% elseif entity.categories is empty %}
  33. <p>Nie wybrano kategorii</p>
  34. {% endif %}
  35. </td>
  36. <td>{% if entity.priceNetto %}{{ entity.priceNetto|number_format(2, ',', '') }} {{ app_config.currency_pl }}{% endif %}</td>
  37. <td>{% if entity.priceBrutto %}{{ entity.priceBrutto|number_format(2, ',', '') }} {{ app_config.currency_pl }}{% endif %}</td>
  38. <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>
  39. <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>
  40. <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>
  41. <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>
  42. <td>{% if entity.created %}{{ entity.created|date('d-m-Y H:i:s') }}{% endif %}</td>
  43. <td>{% if entity.updated %}{{ entity.updated|date('d-m-Y H:i:s') }}{% endif %}</td>
  44. <td>{{ entity.getAvailability() }}</td>
  45. <td class="hidden-print">
  46. <div class="text-center">
  47. <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>
  48. <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>
  49. </div>
  50. </td>
  51. </tr>
  52. {% endfor %}


Prosze o jakas podpowiedz.

Byc moze nie nakreslilem jasno swoich oczekiwan, co do formularza.

Widzialbym go jako podobny do tego z ponizszego zdjecia:

ohm
Collection of forms?
http://symfony.com/doc/current/cookbook/fo...ollections.html
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.