Переглянути джерело

Merge branch 'develop'

master
Fab 3 роки тому
джерело
коміт
67693d6c08
14 змінених файлів з 131 додано та 14 видалено
  1. +4
    -0
      ShopBundle/Controller/Backend/NewsController.php
  2. +5
    -0
      ShopBundle/EventSubscriber/ListEventSubscriber.php
  3. +17
    -0
      ShopBundle/Model/ProductCategory.php
  4. +17
    -0
      ShopBundle/Model/ProductFamily.php
  5. +2
    -1
      ShopBundle/Resources/public/js/backend/script/merchant/vuejs-merchant.js
  6. +6
    -1
      ShopBundle/Resources/translations/lcshop.fr.yaml
  7. +2
    -2
      ShopBundle/Resources/views/backend/default/list.html.twig
  8. +0
    -1
      ShopBundle/Resources/views/backend/merchant/form.html.twig
  9. +6
    -0
      ShopBundle/Resources/views/backend/merchant/panel_delivery.html.twig
  10. +2
    -0
      ShopBundle/Resources/views/backend/merchant/panel_email.html.twig
  11. +37
    -8
      ShopBundle/Resources/views/backend/merchant/panel_order.html.twig
  12. +3
    -0
      ShopBundle/Resources/views/backend/productfamily/panel_general.html.twig
  13. +21
    -1
      ShopBundle/Services/Order/OrderUtilsStockTrait.php
  14. +9
    -0
      ShopBundle/Services/Utils.php

+ 4
- 0
ShopBundle/Controller/Backend/NewsController.php Переглянути файл

@@ -81,7 +81,10 @@ class NewsController extends AdminController
] ;

$i = 0 ;

foreach ($users as $user) {
$paramsTemplate['user'] =$user;

if(!isset($packageMessagesArray[$i])) {
$packageMessagesArray[$i] = [] ;
}
@@ -142,6 +145,7 @@ class NewsController extends AdminController
public function getNewsletter()
{
$newsletter = $this->merchantUtils->getMerchantCurrent()->getNewsletter() ;

if($newsletter) {
return $newsletter ;
}

+ 5
- 0
ShopBundle/EventSubscriber/ListEventSubscriber.php Переглянути файл

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

use Lc\ShopBundle\Context\FilterMerchantInterface;
use Lc\ShopBundle\Context\FilterMultipleMerchantsInterface;
use Lc\ShopBundle\Context\ProductFamilyInterface;
use Lc\ShopBundle\Context\StatusInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -49,6 +50,10 @@ class ListEventSubscriber implements EventSubscriberInterface

}else {*/

if ($entityObject instanceof ProductFamilyInterface) {
$paginator->nbResultsOnSale = $entityRepo->count(array('saleStatus' =>1, 'status'=> 1, 'merchant'=> $criteria['merchant']));
}

if ($entityObject instanceof StatusInterface) {

for ($status = -1; $status <= 1; $status++) {

+ 17
- 0
ShopBundle/Model/ProductCategory.php Переглянути файл

@@ -38,6 +38,11 @@ abstract class ProductCategory extends AbstractDocumentEntity implements TreeInt
*/
protected $productFamilies;

/**
* @ORM\Column(type="boolean")
*/
protected $saleStatus;

public function __construct()
{
$this->childrens = new ArrayCollection();
@@ -154,4 +159,16 @@ abstract class ProductCategory extends AbstractDocumentEntity implements TreeInt

return $this;
}

public function getSaleStatus(): ?bool
{
return $this->saleStatus;
}

public function setSaleStatus(bool $saleStatus): self
{
$this->saleStatus = $saleStatus;

return $this;
}
}

+ 17
- 0
ShopBundle/Model/ProductFamily.php Переглянути файл

@@ -223,6 +223,11 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
protected $behaviorPrice;


/**
* @ORM\Column(type="boolean")
*/
protected $saleStatus;

public function __construct()
{
$this->productCategories = new ArrayCollection();
@@ -840,4 +845,16 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr

return false ;
}

public function getSaleStatus(): ?bool
{
return $this->saleStatus;
}

public function setSaleStatus(bool $saleStatus): self
{
$this->saleStatus = $saleStatus;

return $this;
}
}

+ 2
- 1
ShopBundle/Resources/public/js/backend/script/merchant/vuejs-merchant.js Переглянути файл

@@ -9,6 +9,7 @@ appOrder = new Vue({
{
addressType: null,
currentSection:'general',
isOpenFullTime: false,
sectionsArray: [
{
name: 'general',
@@ -39,7 +40,7 @@ appOrder = new Vue({
nameDisplay: 'Maintenance'
}
]
}, window.addressValues);
}, window.addressValues, window.merchantPanelOrderValues);
},
mounted: function () {},
methods: {

+ 6
- 1
ShopBundle/Resources/translations/lcshop.fr.yaml Переглянути файл

@@ -6,7 +6,9 @@ list:
nbResultsFiltered: Total d'élements filtrés
nbResultsOnline: Total d'élements en ligne
nbResultsOffline: Total d'élements hors ligne
nbResultsDeleted: Total d'élements supprimé
nbResultsDeleted: Total d'élements supprimés
nbResultsOnSale: Total de produits en vente
nbProductFamilyOnline: Total de produits visibles
listChildren: Afficher les enfants
edit: Éditer
delete: Supprimer
@@ -158,11 +160,13 @@ error:
editStockNoQuantityDefault: "Le stock n'a pas été modifié pour le produit #%id% (Aucune quantité par défaut)"
field:
default:
unit: Unité
placeholder: Choisissez une option
deliveryPointSale: Lieu de livraison
deliveryAvailabilty: Créneau de livraison
id: Id
status: Statut
saleStatus: En vente sur le site
statusOptions:
offline: <span class="badge badge-danger">Hors ligne</span>
online: <span class="badge badge-success">En ligne</span>
@@ -230,6 +234,7 @@ field:
success: Succès (vert)
warningMessage: Contenu du message d'avertissement
newsletters: Newsletters
deliveryDepositoryOnly: Retrait au dépot uniquement
isPublic: Publique
isDepository: Dépôt
productCategories: Catégories

+ 2
- 2
ShopBundle/Resources/views/backend/default/list.html.twig Переглянути файл

@@ -110,11 +110,11 @@
<i class="fa fa-check"></i> </span>{% endif %}
{% if paginator.nbResultsOffline is defined %}<span data-toggle="tooltip"
title="{{ "list.nbResultsOffline"|trans }}"
class="badge badge-warning">{{ paginator.nbResultsOffline }}
class="badge badge-danger">{{ paginator.nbResultsOffline }}
<i class="fa fa-pen"></i></span>{% endif %}
{% if is_granted('ROLE_SUPER_ADMIN') and paginator.nbResultsDeleted is defined %}<span
data-toggle="tooltip" title="{{ "list.nbResultsDeleted"|trans }}"
class="badge badge-danger">{{ paginator.nbResultsDeleted }} <i
class="badge badge-secondary">{{ paginator.nbResultsDeleted }} <i
class="fa fa-trash"></i>
</span>{% endif %}
{% endblock %}

+ 0
- 1
ShopBundle/Resources/views/backend/merchant/form.html.twig Переглянути файл

@@ -15,7 +15,6 @@
<span class="glyphicon glyphicon-triangle-bottom"></span>
<i class="fa fa-exclamation-circle invalid-form"></i>
</button>

</li>
</ul>
</div>

+ 6
- 0
ShopBundle/Resources/views/backend/merchant/panel_delivery.html.twig Переглянути файл

@@ -5,6 +5,12 @@
<div class="row">
<div class="col-8">
{{ macros.card_start('Merchant.delivery','light') }}

{% if form.merchantConfigs['delivery-depository-only'] is defined %}
<div class="col-12">
{{ form_row(form.merchantConfigs['delivery-depository-only']) }}
</div>
{% endif %}
{% if form.merchantConfigs['image-zones'] is defined %}
<div class="col-12">
{{ form_row(form.merchantConfigs['image-zones']) }}

+ 2
- 0
ShopBundle/Resources/views/backend/merchant/panel_email.html.twig Переглянути файл

@@ -18,9 +18,11 @@
<div class="col-12">
{{ form_row(form.merchantConfigs['email-contact']) }}
</div>
{% if form.merchantConfigs['email-from-purchase-order'] is defined %}
<div class="col-12">
{{ form_row(form.merchantConfigs['email-from-purchase-order']) }}
</div>
{% endif %}
{% if form.merchantConfigs['purchase-order-email-content'] is defined %}
<div class="col-12">
{{ form_row(form.merchantConfigs['purchase-order-email-content']) }}

+ 37
- 8
ShopBundle/Resources/views/backend/merchant/panel_order.html.twig Переглянути файл

@@ -2,6 +2,14 @@

{% import '@LcShop/backend/default/block/macros.html.twig' as macros %}


<script>
window.merchantPanelOrderValues = {
{% if form.merchantConfigs['is-open-full-time'] is defined %}isOpenFullTime: {{ form.merchantConfigs['is-open-full-time'].vars.data.value }}{% endif %}
};
</script>


<div class="row">
<div class="col-8">
{{ macros.card_start('Merchant.order','light') }}
@@ -11,32 +19,53 @@
<div class="col-6">
{{ form_row(form.merchantConfigs['maximum-order-week']) }}
</div>
<div class="col-6">
{% if form.merchantConfigs['is-open-full-time'] is defined %}
<div class="col-12">
{% for field in form.merchantConfigs['is-open-full-time'] %}
{% if field.vars.name == 'value' %}
{{ form_row(field, {'attr': {"v-model" : 'isOpenFullTime'}}) }}
{% else %}
{{ form_row(field) }}
{% endif %}
{% endfor %}
</div>
{% endif %}
{% if form.merchantConfigs['message-site-opening-background'] is defined %}
<div v-show="isOpenFullTime == true" class="col-6">
{{ form_row(form.merchantConfigs['message-site-opening-background']) }}
</div>
{% endif %}
{% if form.merchantConfigs['message-site-opening'] is defined %}
<div v-show="isOpenFullTime == true" class="col-6">
{{ form_row(form.merchantConfigs['message-site-opening']) }}
</div>
{% endif %}
<div v-show="isOpenFullTime == false" class="col-6">
{{ form_row(form.merchantConfigs['order-open-day']) }}
</div>
<div class="col-6">
<div v-show="isOpenFullTime == false" class="col-6">
{{ form_row(form.merchantConfigs['order-open-time']) }}
</div>
{% if form.merchantConfigs['order-open-day-vip'] is defined %}
<div class="col-6">
<div v-show="isOpenFullTime == false" class="col-6">
{{ form_row(form.merchantConfigs['order-open-day-vip']) }}
</div>
{% endif %}
{% if form.merchantConfigs['order-open-time-vip'] is defined %}
<div class="col-6">
<div v-show="isOpenFullTime == false" class="col-6">
{{ form_row(form.merchantConfigs['order-open-time-vip']) }}
</div>
{% endif %}
<div class="col-6">
<div v-show="isOpenFullTime == false" class="col-6">
{{ form_row(form.merchantConfigs['order-close-day']) }}
</div>
<div class="col-6">
<div v-show="isOpenFullTime == false" class="col-6">
{{ form_row(form.merchantConfigs['order-close-time']) }}
</div>
<div class="col-6">
<div v-show="isOpenFullTime == false" class="col-6">
{{ form_row(form.dateBeginHoliday) }}
</div>
<div class="col-6">
<div v-show="isOpenFullTime == false" class="col-6">
{{ form_row(form.dateEndHoliday) }}
</div>
{{ macros.card_end() }}

+ 3
- 0
ShopBundle/Resources/views/backend/productfamily/panel_general.html.twig Переглянути файл

@@ -7,6 +7,9 @@
<div class="col-12">
{{ form_row(form.status) }}
</div>
<div class="col-12">
{{ form_row(form.saleStatus) }}
</div>
<div class="col-12">
{{ form_row(form.supplier) }}
</div>

+ 21
- 1
ShopBundle/Services/Order/OrderUtilsStockTrait.php Переглянути файл

@@ -58,10 +58,30 @@ trait OrderUtilsStockTrait
}
}

public function isProductSaleStatusOn(Product $product)
{
if($product->getProductFamily()->getSaleStatus()!=1) {
return false ;
}

$allCategoriesSalesOff = true;
foreach ($product->getProductFamily()->getProductCategories() as $category){
if($category->getParent()) {
if($category->getSaleStatus() && $category->getParent()->getSaleStatus())
$allCategoriesSalesOff = false;
}
else {
if($category->getSaleStatus()) $allCategoriesSalesOff = false;
}
}
if($allCategoriesSalesOff) return false;

return true ;
}

public function isProductAvailable(Product $product, $quantityOrder = 0, $checkCart = false, $orderShop = null)
{
if ($product->getStatus() != 1 || $product->getProductFamily()->getStatus() != 1) {
if ($product->getStatus() != 1 || $product->getProductFamily()->getStatus() != 1 || !$this->isProductSaleStatusOn($product)) {
return false;
}


+ 9
- 0
ShopBundle/Services/Utils.php Переглянути файл

@@ -559,4 +559,13 @@ class Utils
]);
}

public function urlEncryptData($datas){
$key = 'secretToken';
foreach ($datas as $data) {
$key .= $data;
}
return md5($key);
}


}

Завантаження…
Відмінити
Зберегти