@@ -74,13 +74,17 @@ trait AdminControllerTrait | |||
if ($this->isInstanceOf(FilterMerchantInterface::class) | |||
|| $this->isInstanceOf(FilterMultipleMerchantsInterface::class)) { | |||
$repositoryQuery->filterByMerchant($this->get(MerchantResolver::class)->getCurrent()); | |||
$repositoryQuery->filterByMerchant($this->getMerchantCurrent()); | |||
} | |||
if ($sectionCurrent && $this->isInstanceOf(FilterSectionInterface::class)) { | |||
$repositoryQuery->filterBySection($sectionCurrent); | |||
} | |||
if ($this->isOutOfSection() && $this->isInstanceOf(FilterSectionInterface::class)) { | |||
$repositoryQuery->filterByMerchantViaSection($this->getMerchantCurrent()); | |||
} | |||
return $repositoryQuery; | |||
} | |||
@@ -39,49 +39,7 @@ abstract class UserAdminController extends SovUserAdminController | |||
} | |||
} | |||
public function configureFields(string $pageName): iterable | |||
{ | |||
$fields = $this->get(UserContainer::class) | |||
->getFieldDefinition() | |||
->setMerchant($this->getMerchantCurrent()) | |||
->getAllFields(); | |||
if ($pageName == Crud::PAGE_INDEX) { | |||
return [ | |||
$fields['id'], | |||
$fields['gender'], | |||
$fields['lastname'], | |||
$fields['firstname'], | |||
$fields['email'], | |||
$fields['phone'], | |||
$fields['birthdate'], | |||
$fields['groupUsers'], | |||
$fields['isSaleAlwaysOpen'], | |||
$fields['newsletters'] | |||
]; | |||
} elseif ($pageName == Crud::PAGE_EDIT || $pageName == Crud::PAGE_NEW) { | |||
$fieldToReturn = [ | |||
$fields['id'], | |||
$fields['gender'], | |||
$fields['lastname'], | |||
$fields['firstname'], | |||
$fields['email'], | |||
$fields['phone'], | |||
$fields['birthdate'], | |||
$fields['groupUsers'], | |||
$fields['isSaleAlwaysOpen'], | |||
$fields['newsletters'], | |||
$fields['ticketTypesNotification'] | |||
]; | |||
if ($this->isGranted('ROLE_SUPER_ADMIN')) { | |||
$fieldToReturn[] = $fields['roles']; | |||
} | |||
return $fieldToReturn; | |||
} elseif ($pageName == Crud::PAGE_DETAIL) { | |||
return [$fields['id']]; | |||
} | |||
} | |||
} |
@@ -34,7 +34,10 @@ class ProductCategoryFieldDefinition extends AbstractFieldDefinition | |||
return array_merge($fieldArray, [ | |||
'id', | |||
'title', | |||
'status' | |||
'position', | |||
'createdAt', | |||
'status', | |||
'saleStatus' | |||
]); | |||
} | |||
@@ -39,14 +39,14 @@ final class AssociationField implements FieldInterface | |||
return (new self()) | |||
->setProperty($propertyName) | |||
->setLabel($label) | |||
->setTemplateName('crud/field/association') | |||
->setTemplatePath('@LcSov/adminlte/crud/field/association.html.twig') | |||
->setFormType(EntityType::class) | |||
->addCssClass('field-association') | |||
->setCustomOption(self::OPTION_AUTOCOMPLETE, false) | |||
->setCustomOption(self::OPTION_CRUD_CONTROLLER, null) | |||
->setCustomOption(self::OPTION_WIDGET, self::WIDGET_AUTOCOMPLETE) | |||
->setCustomOption(self::OPTION_QUERY_BUILDER_CALLABLE, null) | |||
->setCustomOption(self::OPTION_RELATED_URL, null) | |||
->setCustomOption(self::OPTION_RELATED_URL, 'fefefe') | |||
->setCustomOption(self::OPTION_DOCTRINE_ASSOCIATION_TYPE, null); | |||
} | |||
@@ -11,6 +11,7 @@ use Lc\SovBundle\Repository\AbstractRepositoryQuery; | |||
class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery | |||
{ | |||
protected bool $isJoinSections = false; | |||
protected bool $isJoinProductCategories = false; | |||
protected bool $isJoinProductFamilySectionProperties = false; | |||
protected bool $isJoinProducts = false; | |||
@@ -47,6 +48,19 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery | |||
return $this; | |||
} | |||
public function joinSections(bool $addSelect = true): self | |||
{ | |||
if (!$this->isJoinSections) { | |||
$this->isJoinSections = true; | |||
$this->leftJoin('pfsp.section', 'section'); | |||
if ($addSelect) { | |||
$this->addSelect('section'); | |||
} | |||
} | |||
return $this; | |||
} | |||
public function filterBySection(SectionInterface $section,bool $addSelectProductFamilySectionProperties = true) | |||
{ | |||
$this->joinProductFamilySectionProperties($addSelectProductFamilySectionProperties); | |||
@@ -54,6 +68,14 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery | |||
$this->andWhere('pfsp.status = 1'); | |||
} | |||
public function filterByMerchantViaSection(MerchantInterface $merchant) | |||
{ | |||
$this->joinProductFamilySectionProperties(false); | |||
$this->joinSections(false); | |||
$this->andWhereMerchant('section', $merchant); | |||
$this->andWhere('pfsp.status = 1'); | |||
} | |||
public function selectCount(): self | |||
{ |
@@ -12,6 +12,7 @@ class UserRepositoryQuery extends SovUserRepositoryQuery | |||
protected $isJoinUserMerchants = false; | |||
public function joinUserMerchants(): self | |||
{ | |||
if (!$this->isJoinUserMerchants) { |
@@ -19,4 +19,17 @@ class UserStore extends SovUserStore | |||
return $query; | |||
} | |||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||
{ | |||
return $query; | |||
} | |||
public function getJoinGroupUsers(){ | |||
$query = $this->createDefaultQuery(); | |||
$query->joinGroupUsers(true); | |||
return $query->find(); | |||
} | |||
} |
@@ -2,11 +2,17 @@ | |||
{% block content_title %} | |||
{{ 'index'|sov_trans_admin_title(ea.getEntity().getFqcn()) }} | |||
<br /> | |||
<br/> | |||
{{ user_merchant.user }} | |||
{% endblock %} | |||
{% block global_actions %} | |||
{{ parent() }} | |||
{% import 'admin/user/macro/user.html.twig' as user_macros %} | |||
{{ user_macros.write_to_user_button(user_merchant.user) }} | |||
{% endblock %} | |||
{% block page_actions %} | |||
{{ parent() }} | |||
<h4>Créduit actuel : {{ user_merchant.credit|format_price|raw }}</h4> |
@@ -1,14 +1,15 @@ | |||
{% extends '@LcCaracole/admin/product/macro/product_family_macro.html.twig' %} | |||
{% macro product_family_sales_statistic(productsSalesStatistic, productFamily) %} | |||
{% if productsSalesStatistic %} | |||
{% if productsSalesStatistic and productsSalesStatistic|length %} | |||
<button type="button" data-product-family="{{ productFamily.id }}" | |||
class="lc-show-products-sales-statistic btn btn-sm" | |||
data-toggle="tooltip" title="{{ 'showHistorySales'|sov_trans_admin_action }}" | |||
data-url="{{ ea_url({crudAction : 'showSalesStatistic', entityId: productFamily.id }) }}"> | |||
{% for key, weekNumberQuantity in productsSalesStatistic['data']['total_sales']['data'] %} | |||
<span class="text-success"><i | |||
class="fa fa-calendar"></i> {{ productsSalesStatistic['label'][key] }}</span> | |||
<span class="text-success"> | |||
<i class="fa fa-calendar"></i> | |||
{{ productsSalesStatistic['label'][key] }}</span> | |||
<span class="text-info"><i class="fa fa-shopping-basket"></i> | |||
<strong> | |||
{{ weekNumberQuantity is null ? 0 : weekNumberQuantity }} | |||
@@ -32,4 +33,4 @@ | |||
</div> | |||
</td> | |||
</tr> | |||
{% endmacro autoresize_field %} | |||
{% endmacro autoresize_field %} |
@@ -4,4 +4,4 @@ | |||
{{ macros_section.section_badge(item.section) }} | |||
{% else %} | |||
<span class="badge badge-secondary">Aucune</span> | |||
{% endif %} | |||
{% endif %} |
@@ -7,7 +7,7 @@ use Lc\SovBundle\Solver\Ticket\TicketSolver as SovTicketSolver; | |||
class TicketSolver extends SovTicketSolver | |||
{ | |||
public function getTypeChoices(): array | |||
public static function getTypeChoices(): array | |||
{ | |||
$choices = parent::getTypeChoices(); | |||
$choicesProduct = [ |
@@ -54,7 +54,7 @@ class ProductsSalesStatistic extends Statistic | |||
} | |||
// Initialise les valeurs des données pour chaque Interval de date | |||
public function init(SectionInterface $section, DistributionBuilder $distributionBuilder, OpeningResolver $openingResolver) | |||
public function init(SectionInterface $section, DistributionBuilder $distributionBuilder) | |||
{ | |||
$this->distributionList = $distributionBuilder->getDistributionListFromCurrentOrder($section, $this->nbCycle); | |||