瀏覽代碼

Merge branch 'develop' of https://gitea.laclic.fr/Laclic/LcShopBundle into develop

develop
Guillaume 3 年之前
父節點
當前提交
30b2edaf89
共有 11 個檔案被更改,包括 85 行新增37 行删除
  1. +9
    -0
      ShopBundle/Repository/VisitorRepository.php
  2. +3
    -0
      ShopBundle/Resources/translations/lcshop.fr.yaml
  3. +37
    -0
      ShopBundle/Resources/views/backend/default/block/macros.html.twig
  4. +0
    -23
      ShopBundle/Resources/views/backend/order/macros.html.twig
  5. +1
    -1
      ShopBundle/Resources/views/backend/order/show-cart.html.twig
  6. +1
    -1
      ShopBundle/Resources/views/backend/order/show-order.html.twig
  7. +1
    -1
      ShopBundle/Resources/views/backend/ticket/show.html.twig
  8. +13
    -6
      ShopBundle/Resources/views/backend/user/macros.html.twig
  9. +4
    -3
      ShopBundle/Resources/views/backend/user/show.html.twig
  10. +5
    -0
      ShopBundle/Services/TicketUtils.php
  11. +11
    -2
      ShopBundle/Services/UserUtils.php

+ 9
- 0
ShopBundle/Repository/VisitorRepository.php 查看文件

@@ -18,4 +18,13 @@ class VisitorRepository extends BaseRepository implements DefaultRepositoryInter
return VisitorInterface::class;
}


public function findOldVisitors($date){
$qb = $this->createQueryBuilder('v');
$qb->where('v.lastAccess < :date');
$qb->andWhere('v.totalVisit = 1');
$qb->setParameter('date', $date);
return $qb->getQuery()->getResult();

}
}

+ 3
- 0
ShopBundle/Resources/translations/lcshop.fr.yaml 查看文件

@@ -95,6 +95,9 @@ group:
lunch: Repas du midi
Address:
listLoopBesancon: Adresses de Besançon à spécifier (lat / long)
User:
item: Utilisateur



None: Aucune valeur

+ 37
- 0
ShopBundle/Resources/views/backend/default/block/macros.html.twig 查看文件

@@ -430,3 +430,40 @@
</table>
{% endmacro list_reduction_carts %}



{% macro box_user_info(user) %}
{% embed '@LcShop/backend/default/block/embed_box.twig' %}
{% trans_default_domain 'lcshop' %}
{% block class %}bg-info{% endblock %}
{% block icon %}user{% endblock %}
{% block label %}{{ "group.User.item"|trans({}, 'lcshop') }}{% endblock %}
{% block value %}
#{{ user.id }}&nbsp;
{{ user.gender == 1 ? 'Mme.' : 'M.' }} {{ user.name }} {{ user.age < 200 ? '('~user.age~' ans)' : ''}}<br />
{{ user.email }}<br />

<span style="margin-top: 5px; display: inline-block;">
<span data-toggle="tooltip" data-placement="bottom" title="Nombre de commandes" class="badge badge-info">
{{ orderUtils.countValidOrderShopByUser(user) }} <i class="fa fa-shopping-cart"></i>
</span>
<span data-toggle="tooltip" data-placement="bottom" title="Total dépensés" class="badge badge-success">
{{ orderUtils.getTotalSpentByUser(user) }} <i class="fa fa-euro-sign"></i>
</span>

<span data-toggle="tooltip" data-placement="bottom" title="Nombre de relivraisons" class="badge badge-warning">
{{ orderUtils.countRedeliveryByUser(user) }} <i class="fa fa-undo"></i>
</span>
<span data-toggle="tooltip" data-placement="bottom" title="Nombre d'avoirs" class="badge badge-danger">
{{ user.reductionCredits|length }} <i class="fa fa-backspace"></i>
</span>
</span>

{% endblock %}
{% block button %}
<a class="btn btn-sm btn-secondary" href="{{ path('easyadmin', {"action" : 'show', 'entity': 'User', 'id': user.id}) }}">
Voir la fiche
</a>
{% endblock %}
{% endembed %}
{% endmacro box_user_info %}

+ 0
- 23
ShopBundle/Resources/views/backend/order/macros.html.twig 查看文件

@@ -226,29 +226,6 @@
</div>
{% endmacro %}


{% macro box_user_info() %}
{% embed '@LcShop/backend/default/block/embed_box.twig' %}
{% import '@LcShop/backend/order/macros.html.twig' as order_macros %}
{% trans_default_domain 'lcshop' %}
{% block class %}bg-info{% endblock %}
{% block icon %}credit-card{% endblock %}
{% block label %}{{ "field.OrderShop.reference"|trans({}, 'lcshop') }}{% endblock %}
{% block value %}
<span v-if="order.user" v-html="order.user"></span>
<span v-else v-html="order.visitor"></span>
{% endblock %}
{% block button %}
<a class="btn btn-sm btn-secondary" target="_blank" :href="order.userLink">
Voir la fiche
</a>
{% endblock %}
{% endembed %}
{% endmacro box_user_info %}




{% macro box_reference() %}
{% embed '@LcShop/backend/default/block/embed_box.twig' %}
{% import '@LcShop/backend/order/macros.html.twig' as order_macros %}

+ 1
- 1
ShopBundle/Resources/views/backend/order/show-cart.html.twig 查看文件

@@ -19,7 +19,7 @@
<div class="lc-vue-js-container" id="lc-order-edit">
<div class="row">
<div class="col-3">
{{ order_macros.box_user_info() }}
{{ macros.box_user_info(entity.user) }}
</div>
<div class="col-3">
{{ order_macros.box_total_order() }}

+ 1
- 1
ShopBundle/Resources/views/backend/order/show-order.html.twig 查看文件

@@ -20,7 +20,7 @@
<div class="lc-vue-js-container" id="lc-order-edit">
<div class="row">
<div class="col-3">
{{ order_macros.box_user_info() }}
{{ macros.box_user_info(entity.user) }}
</div>
<div class="col-3">
{{ order_macros.box_total_order() }}

+ 1
- 1
ShopBundle/Resources/views/backend/ticket/show.html.twig 查看文件

@@ -23,7 +23,7 @@
{% endembed %}

{% if entity.user %}
{{ macros.box_info('bg-info', 'user', "field.default.user"|trans, entity.user.summary) }}
{{ macros.box_user_info(entity.user) }}
{% else %}
{{ macros.box_info('bg-info', 'user-secret', "field.default.visitor"|trans, entity.user ? entity.user.summary : entity.visitorInfos) }}
{% endif %}

+ 13
- 6
ShopBundle/Resources/views/backend/user/macros.html.twig 查看文件

@@ -1,17 +1,18 @@
{% trans_default_domain 'lcshop' %}

{% macro box_info(user) %}
{% macro card_info(user) %}
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
<div class="card card-primary card-outline">
<div class="card-body box-profile">
<h3 class="profile-username">
<i class="fa fa-user"></i> &nbsp; {{ user.gender == 1 ? 'Mme.' : 'M.' }} {{ user.name }} {{ user.age < 200 ? '('~user.age~' ans)' : ''}}
<i class="fa fa-user"></i> &nbsp; {{ user.gender == 1 ? 'Mme.' : 'M.' }} {{ user.name }}

</h3>
<ul class="list-group list-group-unbordered">
{% if user.age < 200 %}
{% if user.age < 200 and user.age > 2 %}
<li class="list-group-item">
<b> <i class="fa fa-birthday-cake"></i> Age </b>
<span class="float-right"> &nbsp; ans ({{ user.birthdate|date('d/m/Y') }})</span>
<span class="float-right"> {{ user.age }} &nbsp; ans ({{ user.birthdate|date('d/m/Y') }})</span>
</li>
{% endif %}

@@ -51,9 +52,15 @@
</li>
{% endif %}
</ul>
<br />
<div>
<a class="btn btn-sm btn-primary float-right" href="{{ path('easyadmin', {"action" : 'edit', 'entity': 'User', 'id': user.id}) }}">
<i class="fa fa-pen"></i> Éditer l'utilisateur
</a>
</div>
</div>
</div>
{% endmacro box_info %}
{% endmacro card_info %}


{% macro box_rank_sum_order(user) %}

+ 4
- 3
ShopBundle/Resources/views/backend/user/show.html.twig 查看文件

@@ -22,7 +22,7 @@
<div class="lc-vue-js-container" id="lc-user">
<div class="row">
<div class="col-3">
{{ user_macros.box_info(entity) }}
{{ user_macros.card_info(entity) }}
</div>
<div class="col-3">
{{ user_macros.box_rank_total_order(entity) }}
@@ -44,9 +44,10 @@
{{ macros.card_end() }}
{% endif %}

{% if entity.tickets|length %}
{% set tickets = ticketUtils.getTicketsByUser(entity) %}
{% if tickets|length %}
{{ macros.card_start('Ticket.listMessages', 'warning card-outline', false) }}
{{ macros.list_tickets(entity.tickets) }}
{{ macros.list_tickets(tickets) }}
{{ macros.card_end() }}
{% endif %}


+ 5
- 0
ShopBundle/Services/TicketUtils.php 查看文件

@@ -27,6 +27,11 @@ class TicketUtils
$this->authorizationChecker = $authorizationChecker ;
}

public function getTicketsByUser($user){
$ticketRepo = $this->em->getRepository(TicketInterface::class);
return $ticketRepo->findBy(array('user'=>$user));

}
public function createTicket($params): TicketInterface
{
$classTicket = $this->em->getClassMetadata(TicketInterface::class)->getName() ;

+ 11
- 2
ShopBundle/Services/UserUtils.php 查看文件

@@ -20,6 +20,7 @@ class UserUtils
protected $visitorRepository ;
protected $merchantUtils ;
protected $cookieChecker ;
protected $visitor ;

public function __construct(ParameterBagInterface $parameterBag, EntityManagerInterface $em, Utils $utils,
RequestStack $requestStack, MerchantUtilsInterface $merchantUtils, CookieChecker $cookieChecker,
@@ -52,12 +53,20 @@ class UserUtils

public function setCookieVisitor($response, $cookie)
{
$response->headers->setCookie(Cookie::create($this->getCookieNameVisitor(), $this->cryptCookie($cookie), 0, '/', $this->utils->getCookieDomain()));
$response->headers->setCookie(Cookie::create($this->getCookieNameVisitor(), $this->cryptCookie($cookie), new \DateTime('+2 months'), '/', $this->utils->getCookieDomain()));
}
public function updateVisitorCookie($response)
{
$response->headers->setCookie(Cookie::create($this->getCookieNameVisitor(), $this->cryptCookie($this->getVisitorCurrent()->getCookie()), new \DateTime('+2 months'), '/', $this->utils->getCookieDomain()));

}

public function getVisitor($cookie)
{
return $this->visitorRepository->findOneBy(['cookie' => $cookie]) ;
if(!isset($this->visitor[$cookie])){
$this->visitor[$cookie] = $this->visitorRepository->findOneBy(['cookie' => $cookie]) ;
}
return $this->visitor[$cookie];
}

public function getVisitorCurrent()

Loading…
取消
儲存