Parcourir la source

Correctif & duplication sur hub

master
Fab il y a 4 ans
Parent
révision
67b86dcf98
12 fichiers modifiés avec 81 ajouts et 11 suppressions
  1. +32
    -1
      ShopBundle/Controller/Backend/AdminController.php
  2. +2
    -0
      ShopBundle/Controller/Backend/ReminderController.php
  3. +15
    -0
      ShopBundle/Controller/Backend/TicketController.php
  4. +1
    -1
      ShopBundle/Model/User.php
  5. +13
    -0
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js
  6. +2
    -3
      ShopBundle/Resources/views/backend/default/block/action.html.twig
  7. +4
    -2
      ShopBundle/Resources/views/backend/default/list-fields/field_product_family_available_quantity.html.twig
  8. +2
    -2
      ShopBundle/Resources/views/backend/default/list-fields/field_toggle.html.twig
  9. +3
    -0
      ShopBundle/Resources/views/backend/default/list-fields/list_association_users.html.twig
  10. +4
    -0
      ShopBundle/Resources/views/backend/productfamily/form.html.twig
  11. +2
    -2
      ShopBundle/Resources/views/backend/productfamily/panel_property.html.twig
  12. +1
    -0
      ShopBundle/Services/MerchantUtils.php

+ 32
- 1
ShopBundle/Controller/Backend/AdminController.php Voir le fichier

@@ -176,7 +176,7 @@ class AdminController extends EasyAdminController

if ($this->filtersForm->isSubmitted() && $this->filtersForm->isValid()) {
foreach ($listFields as $field) {
if ($this->filtersForm->has($field['property'])) {
if ($this->filtersForm->has($field['property'])) {
switch ($field['dataType']) {
case 'option':
case 'integer':
@@ -608,5 +608,36 @@ class AdminController extends EasyAdminController

return $this->redirectToRoute('easyadmin', ['entity' => $easyadmin['entity']['name'], 'action' => 'edit', 'id' =>$newEntity->getId(), 'referer' =>$refererUrl ]) ;
}

public function duplicateOtherHubAction(){

$id = $this->request->query->get('id');
$hubAlias = $this->request->query->get('hub');
$refererUrl = $this->request->query->get('referer', '');
$user = $this->security->getUser() ;

$easyadmin = $this->request->attributes->get('easyadmin');

$entity= $this->em->getRepository($easyadmin['entity']['class'])->find($id);
$hub= $this->em->getRepository(MerchantInterface::class)->findOneByDevAlias($hubAlias);

$newEntity = clone $entity ;

if($newEntity instanceof ImageInterface){
$newEntity->setImage(null);
}


if ($hub) {
$newEntity->setMerchant($hub);
$user->setMerchant($hub);
$this->em->persist($user);
}
$this->em->persist($newEntity) ;
$this->em->flush() ;

return $this->redirectToRoute('easyadmin', ['entity' => $easyadmin['entity']['name'], 'action' => 'edit', 'id' =>$newEntity->getId(), 'referer' =>$refererUrl ]) ;
}

}


+ 2
- 0
ShopBundle/Controller/Backend/ReminderController.php Voir le fichier

@@ -37,6 +37,8 @@ class ReminderController extends AdminController
if($this->request->isXmlHttpRequest()) {
$response['flashMessages'] = $this->utils->getFlashMessages();
return new Response(json_encode($response));
}else{
return parent::redirectToReferrer();
}
}


+ 15
- 0
ShopBundle/Controller/Backend/TicketController.php Voir le fichier

@@ -7,6 +7,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
use FOS\UserBundle\Model\UserManagerInterface;
use Lc\ShopBundle\Form\Backend\Ticket\TicketMessageType;
use Lc\ShopBundle\Form\Backend\Ticket\TicketStatusType;
use Lc\ShopBundle\Model\Ticket;
use Lc\ShopBundle\Services\UtilsManager;
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
use Symfony\Component\HttpFoundation\Response;
@@ -24,6 +25,20 @@ class TicketController extends AdminController
}


protected function createListQueryBuilder($entityClass, $sortDirection, $sortField = null, $dqlFilter = null)
{

$queryBuilder = parent::createListQueryBuilder($entityClass, $sortDirection, $sortField, $dqlFilter);

if ($this->filtersForm->get('status')->getData() === null) {
$queryBuilder->andWhere('entity.status LIKE :open OR entity.status LIKE :beingprocessed');
$queryBuilder->setParameter('open', Ticket::TICKET_STATUS_OPEN);
$queryBuilder->setParameter('beingprocessed', Ticket::TICKET_STATUS_BEING_PROCESSED);
}

return $queryBuilder;
}

public function showAction()
{
$this->dispatch(EasyAdminEvents::PRE_SHOW);

+ 1
- 1
ShopBundle/Model/User.php Voir le fichier

@@ -116,7 +116,7 @@ abstract class User extends UserModelFOS

public function __toString()
{
return $this->getName();
return $this->getSummary();
}

public function getSummary()

+ 13
- 0
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js Voir le fichier

@@ -419,7 +419,9 @@ $(window).on('load', function () {
behaviorExpirationDate: null,
propertyAllergens: null,
propertyOrganicLabelActive: false,
propertyOrganicLabel: null,
propertyNoveltyExpirationDateActive: false,
propertyNoveltyExpirationDate:null,
activeProducts: false,

formProducts: {},
@@ -578,6 +580,17 @@ $(window).on('load', function () {
title: function () {
this.updateChild()
},
propertyNoveltyExpirationDateActive: function () {
if(!this.propertyNoveltyExpirationDateActive){
this.propertyNoveltyExpirationDate = null;
}
},
propertyOrganicLabelActive: function () {
if(!this.propertyOrganicLabelActive){
this.propertyOrganicLabel = null;
$(this.$refs['propertyOrganicLabel']).val('').trigger('change');
}
}
}
});


+ 2
- 3
ShopBundle/Resources/views/backend/default/block/action.html.twig Voir le fichier

@@ -1,13 +1,12 @@

{% if is_dropdown %}
<a class="btn dropdown-item {{ action.css_class|default('btn-default') }}" href="{{ action_href }}" target="{{ action.target }}">
<a class="btn dropdown-item {{ action.css_class|default('btn-default') }}" href="{{ action_href }}{{ action.extra_param is defined ? action.extra_param : '' }}" target="{{ action.target }}">
{%- if action.icon %}<i class="fa fa-fw fa-{{ action.icon }}"></i> {% endif -%}
{{ action.label|trans(arguments = trans_parameters|merge({ '%entity_id%': item_id }), domain = translation_domain) }}
</a>
{% else %}
<a class="btn {{ is_dropdown|default(false) ? 'dropdown-item' }} {{ action.css_class|default('btn-default') }}" data-toggle="tooltip"
title="{{ action.label|trans(arguments = trans_parameters|merge({ '%entity_id%': item_id }), domain = translation_domain) }}"
href="{{ action_href }}" target="{{ action.target }}">
href="{{ action_href }}{{ action.extra_param is defined ? action.extra_param : '' }}" target="{{ action.target }}">
{%- if action.icon %}<i class="fa fa-fw fa-{{ action.icon }}"></i> {% endif -%}
</a>
{% endif %}

+ 4
- 2
ShopBundle/Resources/views/backend/default/list-fields/field_product_family_available_quantity.html.twig Voir le fichier

@@ -32,7 +32,7 @@
{% endif %}

{% macro no_stock(behaviorStockWeek) %}
<span class="badge badge-danger">
<span class="badge badge-warning">
{{ _self.badge_stock_renewable(behaviorStockWeek) }}
Pas de stock
</span>
@@ -51,8 +51,10 @@
{% macro badge_stock_start(value) %}
{% if value > 0 %}
{% set badge_class = 'badge-success' %}
{% elseif value == 0%}
{% set badge_class = 'badge-warning' %}
{% else %}
{% set badge_class = 'badge-danger' %}
{% set badge_class = 'badge-secondary' %}
{% endif %}
<span class="badge {{ badge_class }}">
{% endmacro %}

+ 2
- 2
ShopBundle/Resources/views/backend/default/list-fields/field_toggle.html.twig Voir le fichier

@@ -1,8 +1,8 @@
{% trans_default_domain 'EasyAdminBundle' %}

<div class="custom-control custom-switch" data-propertyname="{{ field_options.property }}">
<div class="custom-control custom-switch custom-switch-on-success custom-switch-off-danger" data-propertyname="{{ field_options.property }}">
<input type="checkbox" class="custom-control-input" id="customSwitch{{ item.id }}-{{ field_options.property }}" {{ value == true ? 'checked' }}>
<label class="custom-control-label" for="customSwitch{{ item.id }}-{{ field_options.property }}">{{ 'label.true'|trans }}</label>
<label class="custom-control-label" for="customSwitch{{ item.id }}-{{ field_options.property }}">{{ field_options.label }}</label>
</div>
{#


+ 3
- 0
ShopBundle/Resources/views/backend/default/list-fields/list_association_users.html.twig Voir le fichier

@@ -0,0 +1,3 @@
{% for val in value %}
<span class="badge badge-secondary">{{ val.getSummary }}</span>
{% endfor %}

+ 4
- 0
ShopBundle/Resources/views/backend/productfamily/form.html.twig Voir le fichier

@@ -39,7 +39,11 @@
{% if formValues.availableQuantity %}availableQuantity: "{{ formValues.availableQuantity }}",{% endif %}
{% if formValues.availableQuantityDefault %}availableQuantityDefault: "{{ formValues.availableQuantityDefault }}",{% endif %}
{% if formValues.propertyOrganicLabel %}propertyOrganicLabelActive: true,{% endif %}
{% if formValues.propertyOrganicLabel %}propertyOrganicLabel: "{{ formValues.propertyOrganicLabel }}",{% endif %}

{% if formValues.propertyNoveltyExpirationDate %}propertyNoveltyExpirationDateActive: true,{% endif %}
{% if formValues.propertyNoveltyExpirationDate %}propertyNoveltyExpirationDate: "{{ formValues.propertyNoveltyExpirationDate|date('Y-m-d') }}",{% endif %}

{% if formValues.typeExpirationDate %}typeExpirationDate: "{{ formValues.typeExpirationDate }}",{% endif %}
{% if formValues.behaviorExpirationDate %}behaviorExpirationDate: "{{ formValues.behaviorExpirationDate }}",{% endif %}
{% if formValues.propertyExpirationDate %}propertyExpirationDate: "{{ formValues.propertyExpirationDate }}",{% endif %}

+ 2
- 2
ShopBundle/Resources/views/backend/productfamily/panel_property.html.twig Voir le fichier

@@ -17,7 +17,7 @@
<td>{{ form_widget(form.propertyNoveltyExpirationDateActive, {"attr" : {'v-model' : 'propertyNoveltyExpirationDateActive'}}) }}</td>
<td>
<div v-show="propertyNoveltyExpirationDateActive == true">
{{ form_widget(form.propertyNoveltyExpirationDate) }}
{{ form_widget(form.propertyNoveltyExpirationDate, {"attr" : {'v-model' : 'propertyNoveltyExpirationDate'}}) }}
</div>
</td>
</tr>
@@ -25,7 +25,7 @@
<td>{{ form_widget(form.propertyOrganicLabelActive, {"attr" : {'v-model' : 'propertyOrganicLabelActive' } }) }}</td>
<td>
<div class="form-widget" v-show="propertyOrganicLabelActive == true">
{{ form_widget(form.propertyOrganicLabel) }}
{{ form_widget(form.propertyOrganicLabel, {"attr" : {'v-model' : 'propertyOrganicLabel', 'ref': 'propertyOrganicLabel'}}) }}
</div>
</td>
</tr>

+ 1
- 0
ShopBundle/Services/MerchantUtils.php Voir le fichier

@@ -4,6 +4,7 @@ namespace Lc\ShopBundle\Services ;

use App\Entity\UserMerchant;
use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\MerchantInterface;
use Lc\ShopBundle\Context\UserMerchantInterface;
use Symfony\Component\Security\Core\Security;


Chargement…
Annuler
Enregistrer