Commit 797782ea by Damien Moulard

add products by family selection for presta

parent 93be6e6b
...@@ -352,10 +352,11 @@ form[name="formEncaissement"] label { ...@@ -352,10 +352,11 @@ form[name="formEncaissement"] label {
.presta-products-family-form-group { .presta-products-family-form-group {
display: flex; display: flex;
gap: 5px; gap: 5px;
align-content: center; align-items: center;
margin-bottom: 0.5rem !important; margin-bottom: 0.25rem !important;
} }
.presta-products-family-form-group label { .presta-products-family-form-group label {
width: 40%; width: 40%;
margin-bottom: 0;
} }
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"/build/app.2576ca3f.js" "/build/app.2576ca3f.js"
], ],
"css": [ "css": [
"/build/app.972ba10e.css" "/build/app.56026e04.css"
] ]
}, },
"admin": { "admin": {
......
{ {
"build/app.css": "/build/app.972ba10e.css", "build/app.css": "/build/app.56026e04.css",
"build/app.js": "/build/app.2576ca3f.js", "build/app.js": "/build/app.2576ca3f.js",
"build/admin.css": "/build/admin.5dc0eea7.css", "build/admin.css": "/build/admin.5dc0eea7.css",
"build/admin.js": "/build/admin.cee4d78d.js", "build/admin.js": "/build/admin.cee4d78d.js",
......
...@@ -353,7 +353,7 @@ class Prestataire extends AccountableObject implements AccountableInterface ...@@ -353,7 +353,7 @@ class Prestataire extends AccountableObject implements AccountableInterface
private $lastTransactionsExportDatetime; private $lastTransactionsExportDatetime;
/** /**
* @ORM\OneToMany(targetEntity=PrestataireProductFamily::class, mappedBy="prestataire", orphanRemoval=true) * @ORM\OneToMany(targetEntity=PrestataireProductFamily::class, mappedBy="prestataire", orphanRemoval=true, cascade={"persist"})
*/ */
private $prestataireProductFamilies; private $prestataireProductFamilies;
......
...@@ -108,7 +108,7 @@ class PrestataireInfosFormType extends AbstractType ...@@ -108,7 +108,7 @@ class PrestataireInfosFormType extends AbstractType
'required' => true, 'required' => true,
'allow_add' => true, 'allow_add' => true,
'by_reference' => false, 'by_reference' => false,
'label' => "Produits vendus par famille : ", 'label' => "Produits vendus par famille ",
]); ]);
} }
......
...@@ -19,11 +19,11 @@ class PrestataireProductFamilyFormType extends AbstractType ...@@ -19,11 +19,11 @@ class PrestataireProductFamilyFormType extends AbstractType
->add('productFamily', EntityType::class, array( ->add('productFamily', EntityType::class, array(
'class' => ProductFamily::class, 'class' => ProductFamily::class,
'choice_label' => 'name', 'choice_label' => 'name',
'label' => 'Famille de produits', 'label' => 'Famille de produits ',
'required' => true, 'required' => true,
)) ))
->add('products', TextType::class, [ ->add('products', TextType::class, [
'label' => 'Produits', 'label' => 'Produits ',
'required' => true, 'required' => true,
]) ])
; ;
......
...@@ -5,8 +5,26 @@ ...@@ -5,8 +5,26 @@
{% endblock blocktitle %} {% endblock blocktitle %}
{% block blocksubtitle %} {% block blocksubtitle %}
{% endblock blocksubtitle %} {% endblock blocksubtitle %}
{% block blockcontent %} {% block blockcontent %}
{% set form = getPrestataireInfosForm(app.user) %} {% set form = getPrestataireInfosForm(app.user) %}
{# Create "template" as a macro for a product family entry in the form collection #}
{% import _self as formMacros %}
{% macro printPrestataireProductFamilyForm(prestataireProductFamilyForm) %}
<div class="presta-products-family">
<div class="form-group presta-products-family-form-group">
{{ form_label(prestataireProductFamilyForm.productFamily) }}
{{ form_widget(prestataireProductFamilyForm.productFamily) }}
</div>
<div class="form-group presta-products-family-form-group">
{{ form_label(prestataireProductFamilyForm.products) }}
{{ form_widget(prestataireProductFamilyForm.products) }}
</div>
</div>
{% endmacro %}
{{form_start(form)}} {{form_start(form)}}
{{ form_row(form.raison) }} {{ form_row(form.raison) }}
{{ form_row(form.statut) }} {{ form_row(form.statut) }}
...@@ -29,28 +47,18 @@ ...@@ -29,28 +47,18 @@
{% endif %} {% endif %}
{% if form.prestataireProductFamilies is defined %} {% if form.prestataireProductFamilies is defined %}
<hr/> <hr/>
<h3>{{ form_label(form.prestataireProductFamilies) }}</h3> <h4>{{ form_label(form.prestataireProductFamilies) }}</h4>
{{ form_errors(form.prestataireProductFamilies) }} {{ form_errors(form.prestataireProductFamilies) }}
<div <div
class="presta-products-families-list" class="presta-products-families-list"
data-index="{{ form.prestataireProductFamilies|length > 0 ? form.prestataireProductFamilies|last.vars.name + 1 : 0 }}" data-index="{{ form.prestataireProductFamilies|length > 0 ? form.prestataireProductFamilies|last.vars.name + 1 : 0 }}"
data-prototype="{{ form_widget(form.prestataireProductFamilies.vars.prototype)|e('html_attr') }}" data-prototype="{{ formMacros.printPrestataireProductFamilyForm(form.prestataireProductFamilies.vars.prototype)|e('html_attr') }}"
> >
{% for prestataireProductFamilyForm in form.prestataireProductFamilies %} {% for prestataireProductFamilyForm in form.prestataireProductFamilies %}
<div class="presta-products-family"> {{ formMacros.printPrestataireProductFamilyForm(prestataireProductFamilyForm) }}
<div class="form-group presta-products-family-form-group">
{{ form_label(prestataireProductFamilyForm.productFamily) }}
{{ form_widget(prestataireProductFamilyForm.productFamily) }}
</div>
<div class="form-group presta-products-family-form-group">
{{ form_label(prestataireProductFamilyForm.products) }}
{{ form_widget(prestataireProductFamilyForm.products) }}
</div>
</div>
{% endfor %} {% endfor %}
{% do form.prestataireProductFamilies.setRendered() %}
{# TODO custom template for prototype #}
</div> </div>
<button <button
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment