$passedOptions = $child->getConfig()->getOptions() ; | $passedOptions = $child->getConfig()->getOptions() ; | ||||
$classImplements = class_implements($passedOptions['class']) ; | $classImplements = class_implements($passedOptions['class']) ; | ||||
if(in_array('App\Context\FilterHubInterface', $classImplements) || | |||||
in_array('Lc\ShopBundle\Context\FilterMerchantInterface', $classImplements)) { | |||||
if(in_array('Lc\ShopBundle\Context\FilterMerchantInterface', $classImplements)) { | |||||
$propertyMerchant = 'merchant' ; | $propertyMerchant = 'merchant' ; | ||||
if(in_array('App\Context\FilterHubInterface', $classImplements)) { | |||||
$propertyMerchant = 'hub' ; | |||||
} | |||||
$form->add($child->getName(), EntityType::class, array( | $form->add($child->getName(), EntityType::class, array( | ||||
'class' => $this->em->getClassMetadata($passedOptions['class'])->getName(), | 'class' => $this->em->getClassMetadata($passedOptions['class'])->getName(), |
namespace Lc\ShopBundle\EventSubscriber; | namespace Lc\ShopBundle\EventSubscriber; | ||||
use Lc\ShopBundle\Context\FilterMerchantInterface; | use Lc\ShopBundle\Context\FilterMerchantInterface; | ||||
use Lc\ShopBundle\Context\StatusInterface; | |||||
use Symfony\Component\DependencyInjection\Container; | use Symfony\Component\DependencyInjection\Container; | ||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||||
use Symfony\Component\EventDispatcher\GenericEvent; | use Symfony\Component\EventDispatcher\GenericEvent; | ||||
$entityRepo = $em->getRepository($entity['class']); | $entityRepo = $em->getRepository($entity['class']); | ||||
$entityObject = new $entity['class']; | $entityObject = new $entity['class']; | ||||
$criteria = array(); | |||||
if ($entityObject instanceof FilterMerchantInterface) { | if ($entityObject instanceof FilterMerchantInterface) { | ||||
$currentMerchant = $this->security->getUser()->getMerchant(); | $currentMerchant = $this->security->getUser()->getMerchant(); | ||||
$paginator->nbResultsOnline = $entityRepo->count(array('status'=>1,'merchant'=>$currentMerchant)); | |||||
$paginator->nbResultsOffline = $entityRepo->count(array('status'=>0,'merchant'=>$currentMerchant)); | |||||
$paginator->nbResultsDeleted = $entityRepo->count(array('status'=>-1,'merchant'=>$currentMerchant)); | |||||
}else{ | |||||
$paginator->nbResultsOnline = $entityRepo->count(array('status'=>1)); | |||||
$paginator->nbResultsOffline = $entityRepo->count(array('status'=>0)); | |||||
$paginator->nbResultsDeleted = $entityRepo->count(array('status'=>-1)); | |||||
$criteria['merchant'] = $currentMerchant; | |||||
} | |||||
if($entityObject instanceof StatusInterface) { | |||||
for ($status = -1; $status <= 1; $status++) { | |||||
$criteria['status'] = $status; | |||||
if ($status == -1) { | |||||
$paginator->nbResultsDeleted = $entityRepo->count($criteria); | |||||
} elseif ($status == 0) { | |||||
$paginator->nbResultsOffline = $entityRepo->count($criteria); | |||||
} else if ($status == 1) { | |||||
$paginator->nbResultsOnline = $entityRepo->count($criteria); | |||||
} | |||||
} | |||||
} | } | ||||
} | } | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getMerchant(): ?Hub | |||||
public function getMerchant(): ?Merchant | |||||
{ | { | ||||
return $this->merchant; | return $this->merchant; | ||||
} | } | ||||
public function setMerchant(?Hub $merchant): self | |||||
public function setMerchant(?Merchant $merchant): self | |||||
{ | { | ||||
$this->merchant = $merchant; | $this->merchant = $merchant; | ||||
/** | /** | ||||
* @ORM\Column(type="string", length=255, nullable=true) | * @ORM\Column(type="string", length=255, nullable=true) | ||||
*/ | */ | ||||
protected $subTitle; | |||||
protected $subtitle; | |||||
/** | /** | ||||
* @ORM\Column(type="text", nullable=true) | * @ORM\Column(type="text", nullable=true) | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getSubTitle(): ?string | |||||
public function getSubtitle(): ?string | |||||
{ | { | ||||
return $this->subTitle; | |||||
return $this->subtitle; | |||||
} | } | ||||
public function setSubTitle(?string $subTitle): self | |||||
public function setSubtitle(?string $subtitle): self | |||||
{ | { | ||||
$this->subTitle = $subTitle; | |||||
$this->subtitle = $subtitle; | |||||
return $this; | return $this; | ||||
} | } |
templates: | templates: | ||||
list: '@LcShop/backend/default/list.html.twig' | list: '@LcShop/backend/default/list.html.twig' | ||||
layout: '@LcShop/backend/default/layout.html.twig' | layout: '@LcShop/backend/default/layout.html.twig' | ||||
menu: '@LcShop/backend/default/menu.html.twig' | |||||
edit: '@LcShop/backend/default/edit.html.twig' | |||||
new: '@LcShop/backend/default/new.html.twig' | |||||
brand_color: '#1ABC9C' | brand_color: '#1ABC9C' | ||||
assets: | assets: | ||||
favicon: '/assets/img/backend/favicon-pdl.png' | favicon: '/assets/img/backend/favicon-pdl.png' |
product: | product: | ||||
title: Titre | title: Titre | ||||
titleHelp: Un message d'aide | titleHelp: Un message d'aide | ||||
form: | |||||
group: | |||||
main: Général | |||||
address: Adresse | |||||
field: | |||||
default: | |||||
supplier: Producteur | |||||
title: Titre | |||||
subtitle: Sous-titre | |||||
kmsHub: Nombre de kilomètres depuis le dépôt | |||||
image: Image | |||||
description: Description | |||||
type: Type | |||||
civility: Civilité | |||||
lastname: Nom | |||||
firstname: Prénom | |||||
country: Pays | |||||
address: Adresse | |||||
zip: Code postal | |||||
city: Ville | |||||
phone: Téléphone | |||||
company: Société | |||||
siret: N° SIRET | |||||
tva: N° TVA | |||||
price: Prix de vente | |||||
ProductFamily: | |||||
productsType: Type de déclinaisons | |||||
buyingPrice: Prix d'achat | |||||
multiplyingFactor: Coefficiant multiplicateur | |||||
priceByRefUnit: Prix de vente / unité de référence | |||||
availableQuantity: Quantité disponible | |||||
availableQuantityDefault: Quantité disponible par défaut | |||||
quantity: Quantité disponible cette semaine | |||||
behaviorCountStock: Gestion du stock | |||||
taxRate: TVA | |||||
unit: Unité | |||||
action: | action: | ||||
new: Créer %entity_label% | new: Créer %entity_label% | ||||
switchMerchant: Votre hub | switchMerchant: Votre hub | ||||
show: Voir | show: Voir | ||||
choiceFile: Parcourir | |||||
edit: Éditer | edit: Éditer | ||||
search: Rechercher | search: Rechercher | ||||
delete: Supprimer | delete: Supprimer |
{% form_theme form with easyadmin_config('design.form_theme') only %} | |||||
{% set _entity_config = easyadmin_entity(app.request.query.get('entity')) %} | |||||
{% set _entity_id = attribute(entity, _entity_config.primary_key_field_name) %} | |||||
{% trans_default_domain _entity_config.translation_domain %} | |||||
{% set _trans_parameters = { '%entity_name%': _entity_config.name|trans, '%entity_label%': _entity_config.label|trans, '%entity_id%': _entity_id } %} | |||||
{% extends _entity_config.templates.layout %} | |||||
{% block body_id 'easyadmin-edit-' ~ _entity_config.name ~ '-' ~ _entity_id %} | |||||
{% block body_class 'edit edit-' ~ _entity_config.name|lower %} | |||||
{% block content_title %} | |||||
{% apply spaceless %} | |||||
{% set _default_title = 'edit.page_title'|trans(_trans_parameters, 'EasyAdminBundle') %} | |||||
{{ _entity_config.edit.title is defined ? _entity_config.edit.title|trans(_trans_parameters) : _default_title }} | |||||
{% endapply %} | |||||
{% endblock %} | |||||
{% block content_footer_wrapper '' %} | |||||
{% block main %} | |||||
{% block entity_form %} | |||||
{{ form(form) }} | |||||
{% endblock entity_form %} | |||||
{% block delete_form %} | |||||
{{ include('@EasyAdmin/default/includes/_delete_form.html.twig', { | |||||
view: 'edit', | |||||
referer: app.request.query.get('referer', ''), | |||||
delete_form: delete_form, | |||||
_translation_domain: _entity_config.translation_domain, | |||||
_trans_parameters: _trans_parameters, | |||||
_entity_config: _entity_config, | |||||
}, with_context = false) }} | |||||
{% endblock delete_form %} | |||||
{% endblock %} | |||||
{% block body_javascript %} | |||||
{{ parent() }} | |||||
<script type="text/javascript"> | |||||
$(function() { | |||||
$('.edit-form').areYouSure({ 'message': '{{ 'form.are_you_sure'|trans({}, 'EasyAdminBundle')|e('js') }}' }); | |||||
const entityForm = document.querySelector('form.edit-form'); | |||||
const formSubmitButton = entityForm.querySelector('button[type="submit"]'); | |||||
const inputFieldsSelector = 'input,select,textarea'; | |||||
// Adding visual feedback for invalid fields: any ".form-group" with invalid fields | |||||
// receives "has-error" class. The class is removed on click on the ".form-group" | |||||
// itself to support custom/complex fields. | |||||
formSubmitButton.addEventListener('click', function() { | |||||
entityForm.querySelectorAll(inputFieldsSelector).forEach(function (input) { | |||||
if (!input.validity.valid) { | |||||
const formGroup = input.closest('div.form-group'); | |||||
formGroup.classList.add('has-error'); | |||||
formGroup.addEventListener('click', function onFormGroupClick() { | |||||
formGroup.classList.remove('has-error'); | |||||
formGroup.removeEventListener('click', onFormGroupClick); | |||||
}); | |||||
} | |||||
}); | |||||
}); | |||||
// forms with tabs require some special treatment for errors. The problem | |||||
// is when the field with errors is included in a tab not currently visible. | |||||
// Browser shows this error "An invalid form control with name='...' is not focusable." | |||||
// So, the user clicks on Submit button, the form is not submitted and the error | |||||
// is not displayed. This JavaScript code ensures that each tab shows a badge with | |||||
// the number of errors in it. | |||||
formSubmitButton.addEventListener('click', function() { | |||||
const formTabPanes = entityForm.querySelectorAll('.tab-pane'); | |||||
if (0 === formTabPanes.length) { | |||||
return; | |||||
} | |||||
let firstNavTabItemWithError = null; | |||||
formTabPanes.forEach(function (tabPane) { | |||||
let tabPaneNumErrors = 0; | |||||
tabPane.querySelectorAll(inputFieldsSelector).forEach(function (input) { | |||||
if (!input.validity.valid) { | |||||
tabPaneNumErrors++; | |||||
} | |||||
}); | |||||
let navTabItem = entityForm.querySelector('.nav-item a[href="#' + tabPane.id + '"]'); | |||||
let existingErrorBadge = navTabItem.querySelector('span.badge.badge-danger'); | |||||
if (null !== existingErrorBadge) { | |||||
navTabItem.removeChild(existingErrorBadge); | |||||
} | |||||
if (tabPaneNumErrors > 0) { | |||||
let newErrorBadge = document.createElement('span'); | |||||
newErrorBadge.classList.add('badge', 'badge-danger'); | |||||
newErrorBadge.title = 'form.tab.error_badge_title'; | |||||
newErrorBadge.textContent = tabPaneNumErrors; | |||||
navTabItem.appendChild(newErrorBadge); | |||||
if (null === firstNavTabItemWithError) { | |||||
firstNavTabItemWithError = navTabItem; | |||||
} | |||||
} | |||||
}); | |||||
if (firstNavTabItemWithError) { | |||||
firstNavTabItemWithError.click(); | |||||
} | |||||
}); | |||||
$('a.action-delete').on('click', function(e) { | |||||
e.preventDefault(); | |||||
$('#modal-delete').modal({ backdrop: true, keyboard: true }) | |||||
.off('click', '#modal-delete-button') | |||||
.on('click', '#modal-delete-button', function () { | |||||
$('#delete-form').trigger('submit'); | |||||
}); | |||||
}); | |||||
}); | |||||
</script> | |||||
{{ include('@EasyAdmin/default/includes/_select2_widget.html.twig') }} | |||||
{% endblock %} |
{% block wrapper_wrapper %} | {% block wrapper_wrapper %} | ||||
<div class="wrapper"> | <div class="wrapper"> | ||||
{% block wrapper %} | {% block wrapper %} | ||||
<<<<<<< HEAD | |||||
<!-- Navbar --> | <!-- Navbar --> | ||||
<nav class="main-header navbar navbar-expand navbar-white navbar-light"> | <nav class="main-header navbar navbar-expand navbar-white navbar-light"> | ||||
{% block navbar %} | {% block navbar %} | ||||
{% endblock %} | {% endblock %} | ||||
</div> | </div> | ||||
{% endblock wrapper %} | {% endblock wrapper %} | ||||
<footer class="main-footer"> | |||||
<div class="float-right d-none d-sm-block"> | |||||
<b>Version</b> 1.0 | |||||
</div> | |||||
<strong>Copyright © {{'now'|date('Y') }} <a href="http://laclic.fr">La Clic</a>.</strong> All rights | |||||
reserved. | |||||
</footer> | |||||
</div> | </div> | ||||
{% endblock wrapper_wrapper %} | {% endblock wrapper_wrapper %} | ||||
{#Initilisation des varibles requis dans le JS #} | {#Initilisation des varibles requis dans le JS #} | ||||
<script> | <script> | ||||
const DOMAIN = "{{ app.request.getSchemeAndHttpHost() }}"; | const DOMAIN = "{{ app.request.getSchemeAndHttpHost() }}"; |
<h2 class="card-title text-lg "> | <h2 class="card-title text-lg "> | ||||
{{ "list.title"|trans({'%label%' : _entity_config['label']|lower }) }} | {{ "list.title"|trans({'%label%' : _entity_config['label']|lower }) }} | ||||
<span data-toggle="tooltip" title="{{ "list.nbResults"|trans }}" class="badge badge-primary">{{ paginator.nbResults }} <i class="fa fa-bars"></i> </span> | <span data-toggle="tooltip" title="{{ "list.nbResults"|trans }}" class="badge badge-primary">{{ paginator.nbResults }} <i class="fa fa-bars"></i> </span> | ||||
<span data-toggle="tooltip" title="{{ "list.nbResultsOnline"|trans }}" class="badge badge-success">{{ paginator.nbResultsOnline }} <i class="fa fa-check"></i> </span> | |||||
<span data-toggle="tooltip" title="{{ "list.nbResultsOffline"|trans }}" class="badge badge-warning">{{ paginator.nbResultsOffline }} <i class="fa fa-pen"></i></span> | |||||
{% if is_granted('ROLE_SUPER_ADMIN') %}<span data-toggle="tooltip" title="{{ "list.nbResultsDeleted"|trans }}" class="badge badge-danger">{{ paginator.nbResultsDeleted }} <i class="fa fa-trash"></i></span>{% endif %} | |||||
{% if paginator.nbResultsOnline is defined %}<span data-toggle="tooltip" title="{{ "list.nbResultsOnline"|trans }}" class="badge badge-success">{{ paginator.nbResultsOnline }} <i class="fa fa-check"></i> </span>{% endif %} | |||||
{% if paginator.nbResultsOffline is defined %}<span data-toggle="tooltip" title="{{ "list.nbResultsOffline"|trans }}" class="badge badge-warning">{{ paginator.nbResultsOffline }} <i class="fa fa-pen"></i></span>{% endif %} | |||||
{% if is_granted('ROLE_SUPER_ADMIN') and paginator.nbResultsDeleted is defined %}<span data-toggle="tooltip" title="{{ "list.nbResultsDeleted"|trans }}" class="badge badge-danger">{{ paginator.nbResultsDeleted }} <i class="fa fa-trash"></i></span>{% endif %} | |||||
</h2> | </h2> | ||||
{% if easyadmin_action_is_enabled_for_list_view('new', _entity_config.name) %} | {% if easyadmin_action_is_enabled_for_list_view('new', _entity_config.name) %} |
{% extends '@EasyAdmin/default/list.html.twig' %} | |||||
{% block content_title %} | |||||
{% if 'action' in app.request.uri and app.request.get('action') == "listChildren" %} | |||||
{% set param = _request_parameters|filter((v,k) => k != 'id') %} | |||||
{% set action_href = path('easyadmin',param|merge({ action: 'list' })) %} | |||||
<a href="{{ action_href }}">< Retour à la liste</a> | |||||
{% endif %} | |||||
{{ parent() }} | |||||
{% if 'action' in app.request.uri and app.request.get('action') == "listChildren" %} | |||||
<strong>: {{ entity.title }}</strong> | |||||
{% endif %} | |||||
{% endblock %} | |||||
{% block new_action %} | |||||
<div class="button-action"> | |||||
<a class="{{ _action.css_class|default('') }}" | |||||
href="{{ path('easyadmin', _request_parameters|merge({ action: _action.name })) }}" | |||||
target="{{ _action.target }}"> | |||||
{% if _action.icon %}<i class="fa fa-fw fa-{{ _action.icon }}"></i>{% endif %} | |||||
{{ _action.label is defined and not _action.label is empty ? _action.label|trans(_trans_parameters) }} | |||||
</a> | |||||
{% if _entity_config['list']['edit_position'] is defined %} | |||||
<a class="{{ _action.css_class|default('') }}" | |||||
href="{{ path('easyadmin', _request_parameters|merge({ action: 'sort' })) }}" | |||||
target="{{ _action.target }}"> | |||||
Modifier position | |||||
</a> | |||||
{% endif %} | |||||
</div> | |||||
{% endblock %} |
{% form_theme form with easyadmin_config('design.form_theme') only %} | |||||
{% set _entity_config = easyadmin_entity(app.request.query.get('entity')) %} | |||||
{% trans_default_domain _entity_config.translation_domain %} | |||||
{% set _trans_parameters = { '%entity_name%': _entity_config.name|trans, '%entity_label%': _entity_config.label|trans } %} | |||||
{% extends _entity_config.templates.layout %} | |||||
{% block body_id 'easyadmin-new-' ~ _entity_config.name %} | |||||
{% block body_class 'new new-' ~ _entity_config.name|lower %} | |||||
{% block content_title %} | |||||
{% apply spaceless %} | |||||
{% set _default_title = 'new.page_title'|trans(_trans_parameters, 'EasyAdminBundle') %} | |||||
{{ _entity_config.new.title is defined ? _entity_config.new.title|trans(_trans_parameters) : _default_title }} | |||||
{% endapply %} | |||||
{% endblock %} | |||||
{% block content_footer_wrapper '' %} | |||||
{% block main %} | |||||
{% block entity_form %} | |||||
{{ form(form) }} | |||||
{% endblock entity_form %} | |||||
{% endblock %} | |||||
{% block body_javascript %} | |||||
{{ parent() }} | |||||
<script type="text/javascript"> | |||||
$(function() { | |||||
$('.new-form').areYouSure({ 'message': '{{ 'form.are_you_sure'|trans({}, 'EasyAdminBundle')|e('js') }}' }); | |||||
const entityForm = document.querySelector('form.new-form'); | |||||
const formSubmitButton = entityForm.querySelector('button[type="submit"]'); | |||||
const inputFieldsSelector = 'input,select,textarea'; | |||||
// Adding visual feedback for invalid fields: any ".form-group" with invalid fields | |||||
// receives "has-error" class. The class is removed on click on the ".form-group" | |||||
// itself to support custom/complex fields. | |||||
formSubmitButton.addEventListener('click', function() { | |||||
entityForm.querySelectorAll(inputFieldsSelector).forEach(function (input) { | |||||
if (!input.validity.valid) { | |||||
const formGroup = input.closest('div.form-group'); | |||||
formGroup.classList.add('has-error'); | |||||
formGroup.addEventListener('click', function onFormGroupClick() { | |||||
formGroup.classList.remove('has-error'); | |||||
formGroup.removeEventListener('click', onFormGroupClick); | |||||
}); | |||||
} | |||||
}); | |||||
}); | |||||
// forms with tabs require some special treatment for errors. The problem | |||||
// is when the field with errors is included in a tab not currently visible. | |||||
// Browser shows this error "An invalid form control with name='...' is not focusable." | |||||
// So, the user clicks on Submit button, the form is not submitted and the error | |||||
// is not displayed. This JavaScript code ensures that each tab shows a badge with | |||||
// the number of errors in it. | |||||
formSubmitButton.addEventListener('click', function() { | |||||
const formTabPanes = entityForm.querySelectorAll('.tab-pane'); | |||||
if (0 === formTabPanes.length) { | |||||
return; | |||||
} | |||||
let firstNavTabItemWithError = null; | |||||
formTabPanes.forEach(function (tabPane) { | |||||
let tabPaneNumErrors = 0; | |||||
tabPane.querySelectorAll(inputFieldsSelector).forEach(function (input) { | |||||
if (!input.validity.valid) { | |||||
tabPaneNumErrors++; | |||||
} | |||||
}); | |||||
let navTabItem = entityForm.querySelector('.nav-item a[href="#' + tabPane.id + '"]'); | |||||
let existingErrorBadge = navTabItem.querySelector('span.badge.badge-danger'); | |||||
if (null !== existingErrorBadge) { | |||||
navTabItem.removeChild(existingErrorBadge); | |||||
} | |||||
if (tabPaneNumErrors > 0) { | |||||
let newErrorBadge = document.createElement('span'); | |||||
newErrorBadge.classList.add('badge', 'badge-danger'); | |||||
newErrorBadge.title = 'form.tab.error_badge_title'; | |||||
newErrorBadge.textContent = tabPaneNumErrors; | |||||
navTabItem.appendChild(newErrorBadge); | |||||
if (null === firstNavTabItemWithError) { | |||||
firstNavTabItemWithError = navTabItem; | |||||
} | |||||
} | |||||
}); | |||||
if (firstNavTabItemWithError) { | |||||
firstNavTabItemWithError.click(); | |||||
} | |||||
}); | |||||
// prevent multiple form submissions to avoid creating duplicated entities | |||||
entityForm.addEventListener('submit', function() { | |||||
// this timeout is needed to include the disabled button into the submitted form | |||||
setTimeout(function() { | |||||
const submitButtons = entityForm.querySelectorAll('[type="submit"]'); | |||||
submitButtons.forEach(function(button) { | |||||
button.setAttribute('disabled', 'disabled'); | |||||
}); | |||||
}, 1); | |||||
}, false); | |||||
}); | |||||
</script> | |||||
{{ include('@EasyAdmin/default/includes/_select2_widget.html.twig') }} | |||||
{% endblock %} |
<i class="fa fa-fw fa-image"></i> | <i class="fa fa-fw fa-image"></i> | ||||
</div> | </div> | ||||
<input class="lc-ckfinder-field" type="hidden" name="{{ full_name }}" value="{{ value }}" /> | <input class="lc-ckfinder-field" type="hidden" name="{{ full_name }}" value="{{ value }}" /> | ||||
<button type="button" id="{{ button_id }}" class="btn btn-secondary lc-ckfinder-button" {% for attrname, attrvalue in button_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ button_text }}</button> | |||||
<button type="button" id="{{ button_id }}" class="btn btn-primary lc-ckfinder-button" {% for attrname, attrvalue in button_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ 'action.choiceFile'|trans({}, 'lcshop') }}</button> | |||||
</div> | </div> | ||||
{% endblock %} | {% endblock %} |
</div> | </div> | ||||
</div> | </div> | ||||
{%- endblock form_row %} | {%- endblock form_row %} | ||||
{% block easyadmin_widget_groups %} | |||||
{% for group_name, group_config in easyadmin_form_groups|filter(group_config => not group_config.form_tab or group_config.form_tab == tab_name) %} | |||||
<div class="field-group col-{{ group_config.columns|default('12') }} {{ group_config.css_class|default('') }}"> | |||||
<div class="card card-primary"> | |||||
{% if group_config.label|default(false) or group_config.icon|default(false) or group_config.collapsible|default(false) %} | |||||
<div class="card-header {{ group_config.icon|default(false) ? 'with-icon' }}"> | |||||
<h3 class="card-title"> | |||||
{% if group_config.icon|default(false) %} | |||||
<i class="fa fa-fw fa-{{ group_config.icon }}"></i> | |||||
{% endif %} | |||||
{% set label = 'form.group.'~group_config.label %} | |||||
{{ label|trans(domain = _translation_domain)|raw }} | |||||
</h3> | |||||
</div> | |||||
{% if group_config.help|default(false) %} | |||||
<div class="legend-help">{{ group_config.help|trans(domain = _translation_domain)|raw }}</div> | |||||
{% endif %} | |||||
{% endif %} | |||||
<div class="card-body"> | |||||
{% for field in form|filter(field => 'hidden' not in field.vars.block_prefixes and field.vars.easyadmin.form_group == group_name) %} | |||||
{% if not field.vars.easyadmin.form_tab or field.vars.easyadmin.form_tab == tab_name %} | |||||
<div class="col-{{ field.vars.easyadmin.field.columns|default('12') }} {{ field.vars.easyadmin.field.css_class|default('') }}"> | |||||
{{ form_row(field) }} | |||||
</div> | |||||
{% endif %} | |||||
{% endfor %} | |||||
</div> | |||||
</div> | |||||
</div> | |||||
{% else %} | |||||
{% for field in form|filter(field => 'hidden' not in field.vars.block_prefixes and (not field.vars.easyadmin.form_tab or field.vars.easyadmin.form_tab == tab_name)) %} | |||||
<div class="col-{{ field.vars.easyadmin.field.columns|default('12') }} {{ field.vars.easyadmin.field.css_class|default('') }}"> | |||||
{{ form_row(field) }} | |||||
</div> | |||||
{% endfor %} | |||||
{% endfor %} | |||||
{% endblock easyadmin_widget_groups %} | |||||
{% block form_label -%} | |||||
{% if label is not same as(false) -%} | |||||
{%- if compound is defined and compound -%} | |||||
{%- set element = 'legend' -%} | |||||
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-label')|trim}) -%} | |||||
{%- else -%} | |||||
{%- set label_attr = label_attr|merge({for: id, class: (label_attr.class|default('') ~ ' form-control-label')|trim}) -%} | |||||
{%- endif -%} | |||||
{% if required -%} | |||||
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %} | |||||
{%- endif -%} | |||||
{%- if label_format is not empty -%} | |||||
{% set label = label_format|replace({ | |||||
'%name%': name, | |||||
'%id%': id, | |||||
}) %} | |||||
{%- else -%} | |||||
{% set label = 'form.field.'~easyadmin['entity']['name']~'.'~name %} | |||||
{% if label|trans({}, 'lcshop') == label %} | |||||
{% set label = 'form.field.default.'~name %} | |||||
{% endif %} | |||||
{%- endif -%} | |||||
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ label|trans({}, 'lcshop') }}</{{ element|default('label') }}> | |||||
{%- endif -%} | |||||
{%- endblock form_label %} | |||||
{% block easyadmin_rest %} | |||||
{{- form_rest(form) -}} | |||||
<div class="card"> | |||||
<div class="card-footer"> | |||||
{{- block('item_actions') -}} | |||||
</div> | |||||
</div> | |||||
{% endblock easyadmin_rest %} |
{% extends '@EasyAdmin/default/edit.html.twig' %} | |||||
{% extends '@LcShop/backend/default/edit.html.twig' %} | |||||
{% block entity_form %} | {% block entity_form %} | ||||
{% include '@LcShop/backend/order/form.html.twig' %} | {% include '@LcShop/backend/order/form.html.twig' %} |
{% extends '@EasyAdmin/default/new.html.twig' %} | |||||
{% extends '@LcShop/backend/default/new.html.twig' %} | |||||
{% block entity_form %} | {% block entity_form %} | ||||
{% extends '@EasyAdmin/default/edit.html.twig' %} | |||||
{% extends '@LcShop/backend/default/edit.html.twig' %} | |||||
{% block entity_form %} | {% block entity_form %} | ||||
{% include '@LcShop/backend/productfamily/form.html.twig' %} | {% include '@LcShop/backend/productfamily/form.html.twig' %} | ||||
{% endblock entity_form %} | {% endblock entity_form %} |
{% extends '@EasyAdmin/default/new.html.twig' %} | |||||
{% extends '@LcShop/backend/default/new.html.twig' %} | |||||
{% block entity_form %} | {% block entity_form %} | ||||
{% include '@LcShop/backend/productfamily/form.html.twig' %} | {% include '@LcShop/backend/productfamily/form.html.twig' %} |
{{ form_row(form.title, {"attr" : {"v-model" : "title"}}) }} | {{ form_row(form.title, {"attr" : {"v-model" : "title"}}) }} | ||||
</div> | </div> | ||||
<div class="col-12"> | <div class="col-12"> | ||||
{{ form_row(form.subTitle) }} | |||||
{{ form_row(form.subtitle) }} | |||||
</div> | </div> | ||||
<div class="col-12"> | <div class="col-12"> | ||||
{{ form_row(form.image) }} | {{ form_row(form.image) }} | ||||
</div> | </div> | ||||
</fieldset> | </fieldset> | ||||
</div> | </div> | ||||
</div> | |||||
</div> |