瀏覽代碼

Affichage filtre sections en fonction du contexte

packProduct
Guillaume 3 年之前
父節點
當前提交
b7fda82503
共有 5 個檔案被更改,包括 45 行新增22 行删除
  1. +14
    -0
      Controller/AdminControllerTrait.php
  2. +9
    -9
      Controller/Setting/SettingAdminController.php
  3. +1
    -0
      Controller/Ticket/TicketAdminController.php
  4. +5
    -1
      Resources/assets/app/adminlte/common/common.scss
  5. +16
    -12
      Resources/views/adminlte/layout.html.twig

+ 14
- 0
Controller/AdminControllerTrait.php 查看文件

@@ -5,6 +5,7 @@ namespace Lc\CaracoleBundle\Controller;
use Doctrine\ORM\QueryBuilder;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection;
use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMultipleMerchantsInterface;
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface;
@@ -28,6 +29,19 @@ trait AdminControllerTrait
'user_merchant_factory' => UserMerchantFactory::class,
]);
}

public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore
{
$responseParameters = parent::configureResponseParameters($responseParameters);

// affichage du filtre sur section
if($this->isInstanceOf(FilterSectionInterface::class)) {
$responseParameters->set('display_switch_section', true);
}

return $responseParameters;
}

public function createIndexQueryBuilder(
SearchDto $searchDto,
EntityDto $entityDto,

+ 9
- 9
Controller/Setting/SettingAdminController.php 查看文件

@@ -93,12 +93,13 @@ class SettingAdminController extends SovSettingController
}

return $this->render(
'@LcCaracole/admin/setting/edit_' . $type . '.html.twig',
[
'resolver' => $resolver,
'setting_definition' => $settingDefinition,
'form' => $form->createView()
]
'@LcCaracole/admin/setting/edit_' . $type . '.html.twig',
[
'display_switch_section' => ($type == 'section') ? true : false,
'resolver' => $resolver,
'setting_definition' => $settingDefinition,
'form' => $form->createView()
]
);
}
}
@@ -108,13 +109,12 @@ class SettingAdminController extends SovSettingController
*/
public function manageGlobal(Request $request)
{
$site = $this->siteRepository->findOneByDevAlias('default') ;
$site = $this->siteRepository->findOneByDevAlias('default');
$form = $this->createForm(SiteSettingsFormType::class, $site);

$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {

$this->em->update($site);
$this->em->flush();

@@ -122,7 +122,7 @@ class SettingAdminController extends SovSettingController
}

return $this->render(
'@LcCaracole/admin/setting/edit_site.html.twig' ,
'@LcCaracole/admin/setting/edit_site.html.twig',
[
'setting_definition' => $this->siteSettingDefinition,
'form' => $form->createView()

+ 1
- 0
Controller/Ticket/TicketAdminController.php 查看文件

@@ -2,6 +2,7 @@

namespace Lc\CaracoleBundle\Controller\Ticket;

use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\SovBundle\Controller\Ticket\TicketAdminController as SovTicketAdminController;


+ 5
- 1
Resources/assets/app/adminlte/common/common.scss 查看文件

@@ -4,9 +4,13 @@ nav.navbar.carac {
background-color: white;
padding-top: 0px;
padding-bottom: 0px;
border-width: 2px;
border-width: 1px;
z-index: 1;

&.display-section-switch {
border-width: 2px;
}

ul.left {
position: relative;
top: 16px;

+ 16
- 12
Resources/views/adminlte/layout.html.twig 查看文件

@@ -4,19 +4,23 @@
{{ parent() }}

{% set section_current = section_resolver.getCurrent() %}
{% set is_display_switch_section = display_switch_section is defined and display_switch_section %}

<nav class="carac navbar navbar-expand navbar-light main-header" style="border-color: {{ section_current.color }};">
<ul class="navbar-nav left">
{% for section in carac_sections() %}
<li class="nav-item d-none d-sm-inline-block">
{% set form_switch_section = carac_form_switch_section(section) %}
{% form_theme form_switch_section '@LcSov/adminlte/crud/form_theme.html.twig' %}
{{ form_start(form_switch_section) }}
{{ form(form_switch_section) }}
{{ form_end(form_switch_section) }}
</li>
{% endfor %}
</ul>
<nav class="carac navbar navbar-expand navbar-light main-header{% if is_display_switch_section %} display-section-switch{% endif %}" {% if is_display_switch_section %}style="border-color: {{ section_current.color }};"{% endif %}>

{% if is_display_switch_section %}
<ul class="navbar-nav left">
{% for section in carac_sections() %}
<li class="nav-item d-none d-sm-inline-block">
{% set form_switch_section = carac_form_switch_section(section) %}
{% form_theme form_switch_section '@LcSov/adminlte/crud/form_theme.html.twig' %}
{{ form_start(form_switch_section) }}
{{ form(form_switch_section) }}
{{ form_end(form_switch_section) }}
</li>
{% endfor %}
</ul>
{% endif %}
<ul class="navbar-nav ml-auto right">
<li class="nav-item nav-switch-merchant">
<i class="fa fa-store"></i>

Loading…
取消
儲存