Commit 797782ea by Damien Moulard

add products by family selection for presta

parent 93be6e6b
......@@ -352,10 +352,11 @@ form[name="formEncaissement"] label {
.presta-products-family-form-group {
display: flex;
gap: 5px;
align-content: center;
margin-bottom: 0.5rem !important;
align-items: center;
margin-bottom: 0.25rem !important;
}
.presta-products-family-form-group label {
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 @@
"/build/app.2576ca3f.js"
],
"css": [
"/build/app.972ba10e.css"
"/build/app.56026e04.css"
]
},
"admin": {
......
{
"build/app.css": "/build/app.972ba10e.css",
"build/app.css": "/build/app.56026e04.css",
"build/app.js": "/build/app.2576ca3f.js",
"build/admin.css": "/build/admin.5dc0eea7.css",
"build/admin.js": "/build/admin.cee4d78d.js",
......
......@@ -353,7 +353,7 @@ class Prestataire extends AccountableObject implements AccountableInterface
private $lastTransactionsExportDatetime;
/**
* @ORM\OneToMany(targetEntity=PrestataireProductFamily::class, mappedBy="prestataire", orphanRemoval=true)
* @ORM\OneToMany(targetEntity=PrestataireProductFamily::class, mappedBy="prestataire", orphanRemoval=true, cascade={"persist"})
*/
private $prestataireProductFamilies;
......
......@@ -108,7 +108,7 @@ class PrestataireInfosFormType extends AbstractType
'required' => true,
'allow_add' => true,
'by_reference' => false,
'label' => "Produits vendus par famille : ",
'label' => "Produits vendus par famille ",
]);
}
......
......@@ -19,11 +19,11 @@ class PrestataireProductFamilyFormType extends AbstractType
->add('productFamily', EntityType::class, array(
'class' => ProductFamily::class,
'choice_label' => 'name',
'label' => 'Famille de produits',
'label' => 'Famille de produits ',
'required' => true,
))
->add('products', TextType::class, [
'label' => 'Produits',
'label' => 'Produits ',
'required' => true,
])
;
......
......@@ -5,8 +5,26 @@
{% endblock blocktitle %}
{% block blocksubtitle %}
{% endblock blocksubtitle %}
{% block blockcontent %}
{% 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_row(form.raison) }}
{{ form_row(form.statut) }}
......@@ -29,28 +47,18 @@
{% endif %}
{% if form.prestataireProductFamilies is defined %}
<hr/>
<h3>{{ form_label(form.prestataireProductFamilies) }}</h3>
<h4>{{ form_label(form.prestataireProductFamilies) }}</h4>
{{ form_errors(form.prestataireProductFamilies) }}
<div
class="presta-products-families-list"
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 %}
<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>
{{ formMacros.printPrestataireProductFamilyForm(prestataireProductFamilyForm) }}
{% endfor %}
{# TODO custom template for prototype #}
{% do form.prestataireProductFamilies.setRendered() %}
</div>
<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