Selaa lähdekoodia

Correctif & duplication sur hub

master
Fab 4 vuotta sitten
vanhempi
commit
67b86dcf98
12 muutettua tiedostoa jossa 81 lisäystä ja 11 poistoa
  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 Näytä tiedosto



if ($this->filtersForm->isSubmitted() && $this->filtersForm->isValid()) { if ($this->filtersForm->isSubmitted() && $this->filtersForm->isValid()) {
foreach ($listFields as $field) { foreach ($listFields as $field) {
if ($this->filtersForm->has($field['property'])) {
if ($this->filtersForm->has($field['property'])) {
switch ($field['dataType']) { switch ($field['dataType']) {
case 'option': case 'option':
case 'integer': case 'integer':


return $this->redirectToRoute('easyadmin', ['entity' => $easyadmin['entity']['name'], 'action' => 'edit', 'id' =>$newEntity->getId(), 'referer' =>$refererUrl ]) ; 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 Näytä tiedosto

if($this->request->isXmlHttpRequest()) { if($this->request->isXmlHttpRequest()) {
$response['flashMessages'] = $this->utils->getFlashMessages(); $response['flashMessages'] = $this->utils->getFlashMessages();
return new Response(json_encode($response)); return new Response(json_encode($response));
}else{
return parent::redirectToReferrer();
} }
} }



+ 15
- 0
ShopBundle/Controller/Backend/TicketController.php Näytä tiedosto

use FOS\UserBundle\Model\UserManagerInterface; use FOS\UserBundle\Model\UserManagerInterface;
use Lc\ShopBundle\Form\Backend\Ticket\TicketMessageType; use Lc\ShopBundle\Form\Backend\Ticket\TicketMessageType;
use Lc\ShopBundle\Form\Backend\Ticket\TicketStatusType; use Lc\ShopBundle\Form\Backend\Ticket\TicketStatusType;
use Lc\ShopBundle\Model\Ticket;
use Lc\ShopBundle\Services\UtilsManager; use Lc\ShopBundle\Services\UtilsManager;
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
} }




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() public function showAction()
{ {
$this->dispatch(EasyAdminEvents::PRE_SHOW); $this->dispatch(EasyAdminEvents::PRE_SHOW);

+ 1
- 1
ShopBundle/Model/User.php Näytä tiedosto



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


public function getSummary() public function getSummary()

+ 13
- 0
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js Näytä tiedosto

behaviorExpirationDate: null, behaviorExpirationDate: null,
propertyAllergens: null, propertyAllergens: null,
propertyOrganicLabelActive: false, propertyOrganicLabelActive: false,
propertyOrganicLabel: null,
propertyNoveltyExpirationDateActive: false, propertyNoveltyExpirationDateActive: false,
propertyNoveltyExpirationDate:null,
activeProducts: false, activeProducts: false,


formProducts: {}, formProducts: {},
title: function () { title: function () {
this.updateChild() 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 Näytä tiedosto


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

+ 4
- 2
ShopBundle/Resources/views/backend/default/list-fields/field_product_family_available_quantity.html.twig Näytä tiedosto

{% endif %} {% endif %}


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

+ 2
- 2
ShopBundle/Resources/views/backend/default/list-fields/field_toggle.html.twig Näytä tiedosto

{% trans_default_domain 'EasyAdminBundle' %} {% 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' }}> <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> </div>
{# {#



+ 3
- 0
ShopBundle/Resources/views/backend/default/list-fields/list_association_users.html.twig Näytä tiedosto

{% for val in value %}
<span class="badge badge-secondary">{{ val.getSummary }}</span>
{% endfor %}

+ 4
- 0
ShopBundle/Resources/views/backend/productfamily/form.html.twig Näytä tiedosto

{% if formValues.availableQuantity %}availableQuantity: "{{ formValues.availableQuantity }}",{% endif %} {% if formValues.availableQuantity %}availableQuantity: "{{ formValues.availableQuantity }}",{% endif %}
{% if formValues.availableQuantityDefault %}availableQuantityDefault: "{{ formValues.availableQuantityDefault }}",{% endif %} {% if formValues.availableQuantityDefault %}availableQuantityDefault: "{{ formValues.availableQuantityDefault }}",{% endif %}
{% if formValues.propertyOrganicLabel %}propertyOrganicLabelActive: true,{% endif %} {% if formValues.propertyOrganicLabel %}propertyOrganicLabelActive: true,{% endif %}
{% if formValues.propertyOrganicLabel %}propertyOrganicLabel: "{{ formValues.propertyOrganicLabel }}",{% endif %}

{% if formValues.propertyNoveltyExpirationDate %}propertyNoveltyExpirationDateActive: true,{% 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.typeExpirationDate %}typeExpirationDate: "{{ formValues.typeExpirationDate }}",{% endif %}
{% if formValues.behaviorExpirationDate %}behaviorExpirationDate: "{{ formValues.behaviorExpirationDate }}",{% endif %} {% if formValues.behaviorExpirationDate %}behaviorExpirationDate: "{{ formValues.behaviorExpirationDate }}",{% endif %}
{% if formValues.propertyExpirationDate %}propertyExpirationDate: "{{ formValues.propertyExpirationDate }}",{% endif %} {% if formValues.propertyExpirationDate %}propertyExpirationDate: "{{ formValues.propertyExpirationDate }}",{% endif %}

+ 2
- 2
ShopBundle/Resources/views/backend/productfamily/panel_property.html.twig Näytä tiedosto

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

+ 1
- 0
ShopBundle/Services/MerchantUtils.php Näytä tiedosto



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



Loading…
Peruuta
Tallenna