ソースを参照

Intégration app product - renouvelement des stocks

develop
Fab 3年前
コミット
9c2a00c909
5個のファイルの変更230行の追加192行の削除
  1. +1
    -1
      Controller/Dashboard/DashboardAdminController.php
  2. +11
    -1
      Resources/assets/functions/tools.js
  3. +199
    -189
      Resources/views/adminlte/crud/index.html.twig
  4. +1
    -1
      Resources/views/adminlte/embed/modal.twig
  5. +18
    -0
      Resources/views/adminlte/macro/form.html.twig

+ 1
- 1
Controller/Dashboard/DashboardAdminController.php ファイルの表示

@@ -29,7 +29,7 @@ class DashboardAdminController extends AbstractDashboardController
// you can include HTML contents too (e.g. to link to an image)
->setTitle('<img src="assets/img/'.$this->get('parameter_bag')->get('app.admin.logo').'" width="100px">')
// the path defined in this method is passed to the Twig asset() function
->setFaviconPath('favicon.svg')
->setFaviconPath('assets/img/frontend/favicon-pdl.png')
// the domain used by default is 'messages'
->setTranslationDomain('admin');
}

+ 11
- 1
Resources/assets/functions/tools.js ファイルの表示

@@ -86,5 +86,15 @@ export class SovTools {
}
};


static readFlashMessages(flashMessages){
var currentFlash =new Array();
for (var type in flashMessages) {
for (var key in flashMessages[type]) {
if(!currentFlash.includes(flashMessages[type][key])) {
currentFlash.push(flashMessages[type][key]);
SovNotification.add(type, flashMessages[type][key]);
}
}
}
}
}

+ 199
- 189
Resources/views/adminlte/crud/index.html.twig ファイルの表示

@@ -23,238 +23,248 @@

{% block main %}
{% 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 #}
{% set sort_field_name = app.request.get('sort')|keys|first %}
{% set sort_order = app.request.get('sort')|first %}
{% set some_results_are_hidden = false %}
{% set has_footer = entities|length != 0 %}
{% set has_search = ea.crud.isSearchEnabled %}
{% set has_filters = filters|length > 0 %}
{% set has_datagrid_tools = has_search or has_filters %}

{% embed '@LcSov/adminlte/embed/card.html.twig' %}
{% block class %}card-table card-outline card-primary{% endblock %}
{% block header %}
<div class="col-12" id="{% block index_id %}{% endblock index_id %}">
{# 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_order = app.request.get('sort')|first %}
{% set some_results_are_hidden = false %}
{% set has_footer = entities|length != 0 %}
{% set has_search = ea.crud.isSearchEnabled %}
{% set has_filters = filters|length > 0 %}
{% set has_datagrid_tools = has_search or has_filters %}

{% block card_wrapper %}
<div class="card card-table card-outline card-primary">
{% block card_header_wrapper %}
<div class="card-header">
<span data-toggle="tooltip" class="badge badge-light" data-original-title="Total" title="Total">
{{ paginator.numResults }} résultats
</span>

<div class="btn-list float-sm-right">
{% block global_actions %}
<div class="global-actions">
{% for action in global_actions %}
{{ include(action.templatePath, { action: action }, with_context = false) }}
{% endfor %}
</div>
{% endblock global_actions %}
{% block batch_actions %}
{% if has_batch_actions %}
<div class="batch-actions" style="display: none">
{% for action in batch_actions %}
</span>


<div class="btn-list float-sm-right">
{% block global_actions %}
<div class="global-actions">
{% for action in global_actions %}
{{ include(action.templatePath, { action: action }, with_context = false) }}
{% endfor %}
</div>
{% endif %}
{% endblock %}
{% endblock global_actions %}
{% block batch_actions %}
{% if has_batch_actions %}
<div class="batch-actions" style="display: none">
{% for action in batch_actions %}
{{ include(action.templatePath, { action: action }, with_context = false) }}
{% endfor %}
</div>
{% endif %}
{% endblock %}
</div>
</div>
{% endblock %}
{% block body %}
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped">
<thead>
{% block table_head %}
<tr>
{% if has_batch_actions %}
<th class="">
<input type="hidden" id="batch_form_entityIds" value=""/>
<span><input type="checkbox"
class="form-check-input m-0 align-middle form-batch-checkbox-all"></span>
</th>
{% endif %}

{% set ea_sort_asc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::ASC') %}
{% set ea_sort_desc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::DESC') %}
{% for field in fields ?? [] %}
{% set field = field.getAsDto() %}
{% if field.isDisplayedOn('index') %}

{% set is_sorting_field = ea.search.isSortingField(field.property) %}
{% set next_sort_direction = is_sorting_field ? (ea.search.sortDirection(field.property) == ea_sort_desc ? ea_sort_asc : ea_sort_desc) : ea_sort_desc %}
{% set column_icon = is_sorting_field ? (next_sort_direction == ea_sort_desc ? 'fa-arrow-up' : 'fa-arrow-down') : 'fa-sort' %}

<th class="{{ is_sorting_field ? 'sorted' }} {{ field.isVirtual ? 'field-virtual' }} {% if field.textAlign %}text-{{ field.textAlign }}{% endif %}"
dir="{{ ea.i18n.textDirection }}">
{% if field.isSortable %}
<a href="{{ ea_url({ page: 1, sort: { (field.property): next_sort_direction } }).includeReferrer() }}">
{{ field.getProperty|sov_trans_admin_field(ea.getEntity().getFqcn()) }}
<i class="fa fa-fw {{ column_icon }}"></i>
</a>
{% else %}
<span>{{ field.getProperty|sov_trans_admin_field(ea.getEntity().getFqcn()) }}</span>
{% endif %}
{% block card_body_wrapper %}
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped">
<thead>
{% block table_head %}
<tr>
{% if has_batch_actions %}
<th class="">
<input type="hidden" id="batch_form_entityIds" value=""/>
<span><input type="checkbox"
class="form-check-input m-0 align-middle form-batch-checkbox-all"></span>
</th>
{% endif %}
{% endfor %}

<th class="w-1" {% if ea.crud.showEntityActionsAsDropdown %}width="10px"{% endif %}
dir="{{ ea.i18n.textDirection }}">
<span class="sr-only">{{ 'action.entity_actions'|trans(ea.i18n.translationParameters, 'EasyAdminBundle') }}</span>
</th>
</tr>
{% endblock table_head %}
{% set ea_sort_asc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::ASC') %}
{% set ea_sort_desc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::DESC') %}
{% for field in fields ?? [] %}
{% set field = field.getAsDto() %}
{% if field.isDisplayedOn('index') %}

{% block table_filters %}
{{ include('@LcSov/adminlte/block/table_filters.html.twig') }}
{% endblock table_filters %}
{% set is_sorting_field = ea.search.isSortingField(field.property) %}
{% set next_sort_direction = is_sorting_field ? (ea.search.sortDirection(field.property) == ea_sort_desc ? ea_sort_asc : ea_sort_desc) : ea_sort_desc %}
{% set column_icon = is_sorting_field ? (next_sort_direction == ea_sort_desc ? 'fa-arrow-up' : 'fa-arrow-down') : 'fa-sort' %}

</thead>

<tbody>
{% block table_body %}
{% for entity in entities %}
{% if not entity.isAccessible %}
{% set some_results_are_hidden = true %}
{% else %}
<tr data-id="{{ entity.primaryKeyValueAsString }}">
{% if has_batch_actions %}
<td><input type="checkbox" class="form-batch-checkbox"
value="{{ entity.primaryKeyValue }}"></td>
<th class="{{ is_sorting_field ? 'sorted' }} {{ field.isVirtual ? 'field-virtual' }} {% if field.textAlign %}text-{{ field.textAlign }}{% endif %}"
dir="{{ ea.i18n.textDirection }}">
{% if field.isSortable %}
<a href="{{ ea_url({ page: 1, sort: { (field.property): next_sort_direction } }).includeReferrer() }}">
{{ field.getProperty|sov_trans_admin_field(ea.getEntity().getFqcn()) }}
<i class="fa fa-fw {{ column_icon }}"></i>
</a>
{% else %}
<span>{{ field.getProperty|sov_trans_admin_field(ea.getEntity().getFqcn()) }}</span>
{% endif %}
</th>
{% endif %}
{% endfor %}

{% for field in entity.fields %}
<td class="{{ field.property == sort_field_name ? 'sorted' }} text-{{ field.textAlign }} {{ field.cssClass }}"
dir="{{ ea.i18n.textDirection }}">
{{ include(field.templatePath, { field: field, entity: entity }, with_context = false) }}
</td>
{% endfor %}

{% block entity_actions %}
<td class="actions text-right">
{% if entity.actions.count > 0 %}
{% set has_dropdown = false %}

{% set in_dropdown_class = 'in-dropdown' %}
{% for action in entity.actions %}
{% if not (in_dropdown_class in action.cssClass) %}
{{ include(action.templatePath, { action: action, entity: entity, isIncludedInDropdown: 0 }, with_context = false) }}
{% else %}
{% set has_dropdown = true %}
{% endif %}
<th class="w-1" {% if ea.crud.showEntityActionsAsDropdown %}width="10px"{% endif %}
dir="{{ ea.i18n.textDirection }}">
<span class="sr-only">{{ 'action.entity_actions'|trans(ea.i18n.translationParameters, 'EasyAdminBundle') }}</span>
</th>
</tr>
{% endblock table_head %}

{% block table_filters %}
{{ include('@LcSov/adminlte/block/table_filters.html.twig') }}
{% endblock table_filters %}

</thead>

<tbody>
{% block table_body %}
{% for entity in entities %}
{% if not entity.isAccessible %}
{% set some_results_are_hidden = true %}
{% else %}
<tr data-id="{{ entity.primaryKeyValueAsString }}">
{% if has_batch_actions %}
<td><input type="checkbox" class="form-batch-checkbox"
value="{{ entity.primaryKeyValue }}"></td>
{% endif %}

{% endfor %}
{% if has_dropdown %}
<div class="dropdown dropdown-actions">
<a class="dropdown-toggle btn btn-secondary btn-sm" href="#"
role="button" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
</a>

<div class="dropdown-menu dropdown-menu-right">
{% for action in entity.actions %}
{% if in_dropdown_class in action.cssClass %}
{{ include(action.templatePath, { action: action, isIncludedInDropdown: 1 }, with_context = false) }}
{% endif %}
{% endfor %}
{% for field in entity.fields %}
<td class="{{ field.property == sort_field_name ? 'sorted' }} text-{{ field.textAlign }} {{ field.cssClass }}"
dir="{{ ea.i18n.textDirection }}">
{{ include(field.templatePath, { field: field, entity: entity }, with_context = false) }}
</td>
{% endfor %}

{% block entity_actions %}
<td class="actions text-right">
{% if entity.actions.count > 0 %}
{% set has_dropdown = false %}

{% set in_dropdown_class = 'in-dropdown' %}
{% for action in entity.actions %}
{% if not (in_dropdown_class in action.cssClass) %}
{{ include(action.templatePath, { action: action, entity: entity, isIncludedInDropdown: 0 }, with_context = false) }}
{% else %}
{% set has_dropdown = true %}
{% endif %}

{% endfor %}
{% if has_dropdown %}
<div class="dropdown dropdown-actions">
<a class="dropdown-toggle btn btn-secondary btn-sm"
href="#"
role="button" data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
</a>

<div class="dropdown-menu dropdown-menu-right">
{% for action in entity.actions %}
{% if in_dropdown_class in action.cssClass %}
{{ include(action.templatePath, { action: action, isIncludedInDropdown: 1 }, with_context = false) }}
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% endif %}

{% endif %}

{% endif %}
{% if not ea.crud.showEntityActionsAsDropdown %}

{% if not ea.crud.showEntityActionsAsDropdown %}
{% else %}

{% else %}
{% endif %}
</td>
{% endblock entity_actions %}
</tr>

{% endif %}
</td>
{% endblock entity_actions %}
{% endif %}
{% else %}
<tr>
<td class="no-results" colspan="100">
{{ 'datagrid.no_results'|trans(ea.i18n.translationParameters, 'EasyAdminBundle') }}
</td>
</tr>
{% endfor %}

{% endif %}
{% else %}
<tr>
<td class="no-results" colspan="100">
{{ 'datagrid.no_results'|trans(ea.i18n.translationParameters, 'EasyAdminBundle') }}
</td>
</tr>
{% endfor %}

{% if some_results_are_hidden %}
<tr class="datagrid-row-empty">
<td class="text-center" colspan="{{ entities|first.fields|length + 1 }}">
{% if some_results_are_hidden %}
<tr class="datagrid-row-empty">
<td class="text-center" colspan="{{ entities|first.fields|length + 1 }}">
<span class="datagrid-row-empty-message"><i
class="fa fa-lock mr-1"></i> {{ 'datagrid.hidden_results'|trans({}, 'EasyAdminBundle') }}</span>
</td>
</tr>
{% endif %}
{% endblock table_body %}
</tbody>
</table>
</td>
</tr>
{% endif %}
{% endblock table_body %}
</tbody>
</table>

{% block filters_form %}
{% if filters_form is defined %}
{{ form_start(filters_form, {'attr' :{'id' : 'filters-form'}}) }}
{% block filters_form %}
{% if filters_form is defined %}
{{ form_start(filters_form, {'attr' :{'id' : 'filters-form'}}) }}

{# <input type="hidden" name="entity" value="{{ _entity_config.name }}">
{# <input type="hidden" name="entity" value="{{ _entity_config.name }}">
<input type="hidden" name="menuIndex" value="{{ app.request.get('menuIndex') }}">
<input type="hidden" name="submenuIndex" value="{{ app.request.get('submenuIndex') }}">
<input type="hidden" name="sortField" value="{{ app.request.get('sortField', '') }}">
<input type="hidden" name="sortDirection"
value="{{ app.request.get('sortDirection', 'DESC') }}">
<input type="hidden" name="action" value="{{ app.request.get('action') }}"> #}
{{ form_end(filters_form) }}
{% endif %}
{% endblock filters_form %}
{{ form_end(filters_form) }}
{% endif %}
{% endblock filters_form %}

</div>
</div>
{% endblock %}
{% block footer %}
<div class="row">
{% block paginator %}
{{ include(ea.templatePath('crud/paginator')) }}
{% endblock paginator %}
{% block card_footer_wrapper %}
<div class="card-footer">
<div class="row">
{% block paginator %}
{{ include(ea.templatePath('crud/paginator')) }}
{% endblock paginator %}
</div>
</div>
{% endblock %}
{% endembed %}

{% block delete_form %}
{{ include('@EasyAdmin/crud/includes/_delete_form.html.twig', with_context = false) }}
{% endblock delete_form %}

{% if has_filters %}
{{ include('@EasyAdmin/crud/includes/_filters_modal.html.twig') }}
{% endif %}
{% block delete_form %}
{{ include('@EasyAdmin/crud/includes/_delete_form.html.twig', with_context = false) }}
{% endblock delete_form %}

{% if has_filters %}
{{ include('@EasyAdmin/crud/includes/_filters_modal.html.twig') }}
{% endif %}

{% if has_batch_actions %}
{{ include('@EasyAdmin/crud/includes/_batch_action_modal.html.twig', {}, with_context = false) }}
{% endif %}
</div>
{% endblock card_wrapper %}

{% if has_batch_actions %}
{{ include('@EasyAdmin/crud/includes/_batch_action_modal.html.twig', {}, with_context = false) }}
{% endif %}
</div>
{% block main_append %}{% endblock %}

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

{% block body_javascript %}
{{ parent() }}
{% block body_javascript %}
{{ parent() }}

<script type="text/javascript">
<script type="text/javascript">

$(function () {
$(function () {

/* $('.action-delete').on('click', function (e) {
e.preventDefault();
const formAction = $(this).attr('formaction');
/* $('.action-delete').on('click', function (e) {
e.preventDefault();
const formAction = $(this).attr('formaction');

$('#modal-delete').modal({backdrop: true, keyboard: true})
.off('click', '#modal-delete-button')
.on('click', '#modal-delete-button', function () {
let deleteForm = $('#delete-form');
deleteForm.attr('action', formAction);
deleteForm.submit();
});
});*/
$('#modal-delete').modal({backdrop: true, keyboard: true})
.off('click', '#modal-delete-button')
.on('click', '#modal-delete-button', function () {
let deleteForm = $('#delete-form');
deleteForm.attr('action', formAction);
deleteForm.submit();
});
});*/

/* {% if filters|length > 0 %}
/* {% if filters|length > 0 %}
const filterModal = document.querySelector('#modal-filters');

const removeFilter = function (field) {
@@ -316,14 +326,14 @@
{% if has_batch_actions %}

{% endif %}*/
});
</script>
});
</script>

{% if app.request.get('query') is not empty %}
{% if app.request.get('query') is not empty %}
<script type="text/javascript">
const search_query = "{{ ea.search.query|default('')|e('js') }}";
// the original query is prepended to allow matching exact phrases in addition to single words
$('#main').find('table tbody td:not(.actions)').highlight($.merge([search_query], search_query.split(' ')));
</script>
{% endif %}
{% endblock %}
{% endif %}
{% endblock %}

+ 1
- 1
Resources/views/adminlte/embed/modal.twig ファイルの表示

@@ -16,7 +16,7 @@
<div class="modal-footer justify-content-between">
{% block footer %}
<button type="button" class="btn btn-default"
data-dismiss="modal">{{ 'action.cancel'|trans }}</button>
data-dismiss="modal">{{ 'cancel'|sov_trans_admin_action }}</button>
{% endblock %}
</div>
{% endblock %}

+ 18
- 0
Resources/views/adminlte/macro/form.html.twig ファイルの表示

@@ -0,0 +1,18 @@
{% macro form_row_append(field, append) %}
<div class="form-group">
{{ form_label(field) }}
{{ _self.form_widget_append(field, append) }}
</div>
{% endmacro form_row_append %}

{% macro form_widget_append(field, append, params={}) %}
<div class="form-widget">
<div class="input-group">
{{ form_widget(field, params) }}
<div class="input-group-append">
<span class="input-group-text">{{ append }}</span>
</div>
</div>
{{ form_help(field) }}
</div>
{% endmacro form_widget_append %}

読み込み中…
キャンセル
保存