Przeglądaj źródła

Création User merchant

feature/ticket
Fab 3 lat temu
rodzic
commit
a82f0219db
8 zmienionych plików z 209 dodań i 169 usunięć
  1. +3
    -1
      Controller/AbstractAdminController.php
  2. +2
    -2
      Controller/User/AccountAdminController.php
  3. +23
    -0
      Factory/User/UserFactory.php
  4. +4
    -0
      Resources/translations/admin.fr.yaml
  5. +6
    -0
      Resources/views/adminlte/crud/_form.html.twig
  6. +157
    -156
      Resources/views/adminlte/crud/index.html.twig
  7. +9
    -6
      Resources/views/adminlte/layout.html.twig
  8. +5
    -4
      Resources/views/adminlte/macro/callout.html.twig

+ 3
- 1
Controller/AbstractAdminController.php Wyświetl plik

@@ -58,7 +58,7 @@ abstract class AbstractAdminController extends EaAbstractCrudController
public function __construct(
SessionInterface $session,
RequestStack $request,
EntityManager $em,
EntityManagerInterface $em,
TranslatorAdmin $translatorAdmin
)
{
@@ -454,6 +454,8 @@ abstract class AbstractAdminController extends EaAbstractCrudController

public function persistEntity(EntityManagerInterface $entityManager, $entityInstance): void
{
dump($entityInstance);
die();
$entityManager->create($entityInstance);
$entityManager->flush();
}

+ 2
- 2
Controller/User/AccountAdminController.php Wyświetl plik

@@ -6,7 +6,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider;
use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Form\User\ChangePasswordFormType;
use Lc\SovBundle\Form\User\ProfileFormType;
use Lc\SovBundle\Form\User\UserMerchantFormType;
use Lc\SovBundle\Model\User\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
@@ -26,7 +26,7 @@ class AccountAdminController extends AbstractController
public function profile(Request $request): Response
{
$user = $this->getUser();
$form = $this->createForm(ProfileFormType::class, $user);
$form = $this->createForm(UserMerchantFormType::class, $user);

$form->handleRequest($request);


+ 23
- 0
Factory/User/UserFactory.php Wyświetl plik

@@ -0,0 +1,23 @@
<?php

namespace Lc\SovBundle\Factory\User;

use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\User\UserInterface;

class UserFactory extends AbstractFactory
{
protected $merchantResolver;

public function __construct(EntityManagerInterface $em)
{
parent::__construct($em);
}

public function getEntityClass()
{
return UserInterface::class;
}
}

+ 4
- 0
Resources/translations/admin.fr.yaml Wyświetl plik

@@ -50,6 +50,9 @@ entity:
label_plurial: Pages
default:
fields:
firstname: Prénom
lastname: Nom
roles: Roles
title: Titre
position: Position
description: Description
@@ -65,6 +68,7 @@ entity:
devAlias: Alias
gallery: Galerie
color: Couleur
active: Activer

panels:
general: Général

+ 6
- 0
Resources/views/adminlte/crud/_form.html.twig Wyświetl plik

@@ -47,6 +47,12 @@
{% endblock form %}
</div>

<div class="col-4">
{% block aside %}
{% endblock aside %}
</div>


{% block form_footer %}
{% embed '@LcSov/adminlte/embed/form_footer.html.twig' %}
{% block width %}8{% endblock %}

+ 157
- 156
Resources/views/adminlte/crud/index.html.twig Wyświetl plik

@@ -22,183 +22,184 @@
{% endblock page_actions %}

{% block main %}
{# 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 css %}card-table card-outline card-primary{% endblock %}
{% block header %}
<span data-toggle="tooltip" class="badge badge-light" data-original-title="Total" title="Total">
<div class="col-12">
{# 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 css %}card-table card-outline card-primary{% endblock %}
{% block 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 %}
<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 %}
</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.label ? field.label|raw : field.getProperty|raw }} <i
class="fa fa-fw {{ column_icon }}"></i>
</a>
{% else %}
<span>{{ field.getProperty|lc_trans_admin_field(ea.getEntity().getFqcn()) }}</span>
{% endif %}
{% 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>
{% 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 %}
{% 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 %}
</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 %}
{% 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 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">
{% 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) }}
{% endif %}
{% endfor %}
{% 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' %}

<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">
<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.label ? field.label|raw : field.getProperty|raw }} <i
class="fa fa-fw {{ column_icon }}"></i>
</a>
{% else %}
<span>{{ field.getProperty|lc_trans_admin_field(ea.getEntity().getFqcn()) }}</span>
{% endif %}
</th>
{% endif %}
{% endfor %}

<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 %}
<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 %}
</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 %}

{% 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">
{% 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) }}
{% endif %}
{% endfor %}

<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>

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

{% else %}
{% else %}

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

{% 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>
</div>
{% endblock %}
{% block footer %}
<div class="row">
{% block paginator %}
{{ include(ea.templatePath('crud/paginator')) }}
{% endblock paginator %}
</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 %}

{% if has_batch_actions %}
{{ include('@EasyAdmin/crud/includes/_batch_action_modal.html.twig', {}, with_context = false) }}
{% endif %}
</td>
</tr>
{% endif %}
{% endblock table_body %}
</tbody>
</table>
</div>
{% endblock %}
{% block footer %}
<div class="row">
{% block paginator %}
{{ include(ea.templatePath('crud/paginator')) }}
{% endblock paginator %}
</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 %}

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

{% block body_javascript %}

+ 9
- 6
Resources/views/adminlte/layout.html.twig Wyświetl plik

@@ -55,7 +55,8 @@
</head>

{% block body %}
<body id="{% block body_id %}{% endblock %}" class="admin sidebar-mini layout-fixed {% block body_class %}{% endblock %}">
<body id="{% block body_id %}{% endblock %}"
class="admin sidebar-mini layout-fixed {% block body_class %}{% endblock %}">

{% block javascript_page_layout %}
<script>
@@ -135,7 +136,9 @@

<section class="content">
<div class="container-fluid">
{% block main %}{% endblock %}
<div class="row">
{% block main %}{% endblock %}
</div>
</div>
</section>

@@ -185,12 +188,12 @@
{% set flash_messages = app.session.flashbag.all %}
{% if flash_messages|length > 0 %}
<script type="text/javascript">
$(document).ready(function() {
{% for label, messages in flash_messages %}
$(document).ready(function () {
{% for label, messages in flash_messages %}
{% for message in messages %}
Notification.add("{{ label }}", "{{ message|trans|raw|replace({'"': '\"'}) }}");
Notification.add("{{ label }}", "{{ message|trans|raw|replace({'"': '\"'}) }}");
{% endfor %}
{% endfor %}
{% endfor %}
});
</script>
{% endif %}

+ 5
- 4
Resources/views/adminlte/macro/callout.html.twig Wyświetl plik

@@ -1,10 +1,11 @@

{% macro callout_warning(message) %}
{{ _self.callout('warning', message) }}
{% macro callout_warning(message, title = '') %}
{{ _self.callout('warning', message, title) }}
{% endmacro %}

{% macro callout(type, message) %}
{% macro callout(type, message, title = '') %}
<div class="callout callout-{{ type }}">
{{ message }}
<h5>{{ title }}</h5>
<p>{{ message }}</p>
</div>
{% endmacro %}

Ładowanie…
Anuluj
Zapisz