Quellcode durchsuchen

Reminder

packProduct
Guillaume vor 3 Jahren
Ursprung
Commit
8ee8969abc
4 geänderte Dateien mit 57 neuen und 2 gelöschten Zeilen
  1. +2
    -0
      Repository/Reminder/ReminderRepositoryQuery.php
  2. +27
    -0
      Repository/Reminder/ReminderStore.php
  3. +7
    -1
      Resources/views/adminlte/layout.html.twig
  4. +21
    -1
      Twig/StoreTwigExtension.php

+ 2
- 0
Repository/Reminder/ReminderRepositoryQuery.php Datei anzeigen

@@ -3,9 +3,11 @@
namespace Lc\CaracoleBundle\Repository\Reminder;

use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait;
use Lc\CaracoleBundle\Repository\SectionRepositoryQueryTrait;
use Lc\SovBundle\Repository\Reminder\ReminderRepositoryQuery as SovReminderRepositoryQuery;

class ReminderRepositoryQuery extends SovReminderRepositoryQuery
{
use MerchantRepositoryQueryTrait;
use SectionRepositoryQueryTrait;
}

+ 27
- 0
Repository/Reminder/ReminderStore.php Datei anzeigen

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

namespace Lc\CaracoleBundle\Repository\Reminder;

use Lc\SovBundle\Repository\Reminder\ReminderStore as SovReminderStore;

class ReminderStore extends SovReminderStore
{

public function get($params = [])
{
$query = $this->query->create();

$query->filterBase($params) ;

if(array_key_exists('merchant', $params)) {
$query->filterByMerchant($params['merchant']);
}

if(array_key_exists('section', $params)) {
$query->filterBySection($params['section']);
}

return $query->find();
}

}

+ 7
- 1
Resources/views/adminlte/layout.html.twig Datei anzeigen

@@ -34,6 +34,12 @@
</nav>
{% endblock %}

{% block reminders %}
{% set reminders = carac_reminders(params_reminders) %}
{% include '@LcSov/admin/reminder/block.html.twig' %}
{% endblock %}


{% block append_body %}
{# modal switch merchant #}
{% set user = app.user %}
@@ -58,7 +64,7 @@
comme marchand favoris ou simplement indiquer que vous visitez ce marchand pour aujourd'hui.</p>
{% endblock %}
{% block footer %}
{% set form_switch_merchant = carac_form_switch_merchant('admin', 'carac_favorite_merchant') %}
{% set form_switch_merchant = carac_form_switch_merchant('admin', 'carac_merchant_favorite') %}
{% form_theme form_switch_merchant '@LcSov/adminlte/crud/form_theme.html.twig' %}
{{ form_start(form_switch_merchant) }}
{{ form(form_switch_merchant) }}

+ 21
- 1
Twig/StoreTwigExtension.php Datei anzeigen

@@ -3,8 +3,11 @@
namespace Lc\CaracoleBundle\Twig;

use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery;
use Lc\CaracoleBundle\Repository\Reminder\ReminderStore;
use Lc\CaracoleBundle\Repository\Section\SectionRepository;
use Lc\CaracoleBundle\Repository\Section\SectionRepositoryInterface;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

@@ -12,13 +15,22 @@ class StoreTwigExtension extends AbstractExtension
{
protected $merchantRepository;
protected $sectionRepository;
protected ReminderStore $reminderStore;
protected MerchantResolver $merchantResolver;
protected SectionResolver $sectionResolver;

public function __construct(
MerchantResolver $merchantResolver,
SectionResolver $sectionResolver,
MerchantRepositoryQuery $merchantRepository,
SectionRepository $sectionRepository
SectionRepository $sectionRepository,
ReminderStore $reminderStore
) {
$this->merchantResolver = $merchantResolver;
$this->sectionResolver = $sectionResolver;
$this->merchantRepository = $merchantRepository;
$this->sectionRepository = $sectionRepository;
$this->reminderStore = $reminderStore;
}

public function getFunctions()
@@ -26,6 +38,7 @@ class StoreTwigExtension extends AbstractExtension
return array(
new TwigFunction('carac_sections', [$this, 'getSections']),
new TwigFunction('carac_merchants', [$this, 'getMerchants']),
new TwigFunction('carac_reminders', [$this, 'getReminders']),
);
}

@@ -39,4 +52,11 @@ class StoreTwigExtension extends AbstractExtension
return $this->merchantRepository->findAll();
}

public function getReminders($params = [])
{
$params['merchant'] = $this->merchantResolver->getCurrent();
$params['section'] = $this->sectionResolver->getCurrent();
return $this->reminderStore->get($params);
}

}

Laden…
Abbrechen
Speichern