Browse Source

Intégration app product édition avancé & correctif

develop
Fabien Normand 3 years ago
parent
commit
a1e0191f2d
4 changed files with 18 additions and 8 deletions
  1. +2
    -2
      Resources/assets/app/adminlte/field/collection/app.collection.js
  2. +7
    -2
      Resources/views/adminlte/crud/field/toggle.html.twig
  3. +5
    -2
      Resources/views/adminlte/crud/form_theme.html.twig
  4. +4
    -2
      Resources/views/adminlte/crud/index.html.twig

+ 2
- 2
Resources/assets/app/adminlte/field/collection/app.collection.js View File

$(item).find('input,textarea').each(function (y, field) { $(item).find('input,textarea').each(function (y, field) {
let $field = $(field); let $field = $(field);
//Chanegment ID //Chanegment ID
let posId = Tools.indexOfLastDigit($field.prop('id'));
let posId = SovTools.indexOfLastDigit($field.prop('id'));
let idPrefix = $field.prop('id').substr(0, posId); let idPrefix = $field.prop('id').substr(0, posId);
let idSuffix = $field.prop('id').substr(posId + 1); let idSuffix = $field.prop('id').substr(posId + 1);
$field.prop('id', idPrefix + i + idSuffix); $field.prop('id', idPrefix + i + idSuffix);


//Chanegment Name //Chanegment Name
let posName = Tools.indexOfLastDigit($field.prop('name'));
let posName = SovTools.indexOfLastDigit($field.prop('name'));
let namePrefix = $field.prop('name').substr(0, posName); let namePrefix = $field.prop('name').substr(0, posName);
let nameSuffix = $field.prop('name').substr(posName + 1); let nameSuffix = $field.prop('name').substr(posName + 1);
$field.prop('name', namePrefix + i + nameSuffix); $field.prop('name', namePrefix + i + nameSuffix);

+ 7
- 2
Resources/views/adminlte/crud/field/toggle.html.twig View File

{% set property_name = field.getProperty() %} {% set property_name = field.getProperty() %}
{% set id_toggle = 'toggle-'~item.id~'-'~property_name %} {% set id_toggle = 'toggle-'~item.id~'-'~property_name %}


{% block toggle %}
<div class="custom-control custom-switch custom-switch-on-success custom-switch-off-default" <div class="custom-control custom-switch custom-switch-on-success custom-switch-off-default"
data-url="{{ ea_url({crudAction: 'edit', entityId: item.id, fieldName: property_name }) }}"> data-url="{{ ea_url({crudAction: 'edit', entityId: item.id, fieldName: property_name }) }}">
<input type="checkbox" class="custom-control-input" id="{{ id_toggle }}" {{ field.value ? 'checked' }}> <input type="checkbox" class="custom-control-input" id="{{ id_toggle }}" {{ field.value ? 'checked' }}>
<label class="custom-control-label" for="{{ id_toggle }}"> <label class="custom-control-label" for="{{ id_toggle }}">
{{ field.getCustomOption('toggle_label') ? field.label : field.property|sov_trans_admin_field(entity.instance) }}</label>
</div>
{% block label %}
{{ field.getCustomOption('toggle_label') ? field.label : field.property|sov_trans_admin_field(entity.instance) }}
{% endblock label %}
</label>
</div>
{% endblock toggle %}

+ 5
- 2
Resources/views/adminlte/crud/form_theme.html.twig View File

{% if not entityNameOrObject and form.parent.vars.errors.form.config.dataClass is defined %} {% if not entityNameOrObject and form.parent.vars.errors.form.config.dataClass is defined %}
{% set entityNameOrObject = form.parent.vars.errors.form.config.dataClass %} {% set entityNameOrObject = form.parent.vars.errors.form.config.dataClass %}
{% endif %} {% endif %}

x
{% if translation_domain == null %}
{% set translation_domain = 'admin' %}
{% endif %}
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %} <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}
>{{ (label is not empty and '.' in label) ? label|trans({}, 'admin') : name|sov_trans_admin_field(entityNameOrObject) }}
>{{ (label is not empty and '.' in label) ? label|trans({}, translation_domain) : name|sov_trans_admin_field(entityNameOrObject) }}
</{{ element|default('label') }}> </{{ element|default('label') }}>


{%- endif -%} {%- endif -%}

+ 4
- 2
Resources/views/adminlte/crud/index.html.twig View File

{% endblock page_actions %} {% endblock page_actions %}


{% block main %} {% block main %}
<div class="col-12">
{% block main_prepend %}{% endblock %}
<div class="col-12" id="{% block index_id %}{% endblock index_id %}">
{# sort can be multiple; let's consider the sorting field the first one #} {# sort can be multiple; let's consider the sorting field the first one #}
{% set sort_field_name = app.request.get('sort')|keys|first %} {% set sort_field_name = app.request.get('sort')|keys|first %}
{% set sort_order = app.request.get('sort')|first %} {% set sort_order = app.request.get('sort')|first %}


{% set ea_sort_asc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::ASC') %} {% set ea_sort_asc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::ASC') %}
{% set ea_sort_desc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::DESC') %} {% set ea_sort_desc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::DESC') %}

{% for field in fields ?? [] %} {% for field in fields ?? [] %}
{% set field = field.getAsDto() %} {% set field = field.getAsDto() %}
{% if field.isDisplayedOn('index') %} {% if field.isDisplayedOn('index') %}
{{ include('@EasyAdmin/crud/includes/_batch_action_modal.html.twig', {}, with_context = false) }} {{ include('@EasyAdmin/crud/includes/_batch_action_modal.html.twig', {}, with_context = false) }}
{% endif %} {% endif %}
</div> </div>
{% block main_append %}{% endblock %}

{% endblock main %} {% endblock main %}


{% block body_javascript %} {% block body_javascript %}

Loading…
Cancel
Save