Ver código fonte

Pages commandes

feature/export_comptable
Fab 4 anos atrás
pai
commit
16fe2689b2
28 arquivos alterados com 464 adições e 439 exclusões
  1. +88
    -114
      ShopBundle/Controller/Backend/OrderController.php
  2. +4
    -0
      ShopBundle/Model/OrderStatusHistory.php
  3. +8
    -0
      ShopBundle/Model/Visitor.php
  4. +2
    -2
      ShopBundle/Repository/OrderShopRepository.php
  5. +1
    -3
      ShopBundle/Resources/public/js/backend/script/order/vuejs-order.js
  6. +10
    -0
      ShopBundle/Resources/translations/lcshop.fr.yaml
  7. +1
    -0
      ShopBundle/Resources/views/backend/default/block/macros.html.twig
  8. +1
    -1
      ShopBundle/Resources/views/backend/default/list-fields/field_total.html.twig
  9. +0
    -14
      ShopBundle/Resources/views/backend/order/card_addproducttoorder.html.twig
  10. +64
    -0
      ShopBundle/Resources/views/backend/order/edit-cart.html.twig
  11. +4
    -4
      ShopBundle/Resources/views/backend/order/edit-order.html.twig
  12. +0
    -12
      ShopBundle/Resources/views/backend/order/form.html.twig
  13. +19
    -16
      ShopBundle/Resources/views/backend/order/form/card_orderproducts.html.twig
  14. +32
    -0
      ShopBundle/Resources/views/backend/order/form/modal_addproducttoorder.html.twig
  15. +0
    -1
      ShopBundle/Resources/views/backend/order/form/modal_deliveryaddress.html.twig
  16. +0
    -0
      ShopBundle/Resources/views/backend/order/form/modal_deliveryavailability.html.twig
  17. +0
    -1
      ShopBundle/Resources/views/backend/order/form/modal_invoiceaddress.html.twig
  18. +0
    -0
      ShopBundle/Resources/views/backend/order/form/modal_orderpayment.html.twig
  19. +0
    -0
      ShopBundle/Resources/views/backend/order/form/modal_orderstatus.html.twig
  20. +1
    -1
      ShopBundle/Resources/views/backend/order/form/modal_reductioncart.html.twig
  21. +2
    -2
      ShopBundle/Resources/views/backend/order/form/modal_reductioncredit.html.twig
  22. +195
    -51
      ShopBundle/Resources/views/backend/order/macros.html.twig
  23. +0
    -16
      ShopBundle/Resources/views/backend/order/panel_addresses.html.twig
  24. +0
    -47
      ShopBundle/Resources/views/backend/order/panel_cart.html.twig
  25. +0
    -138
      ShopBundle/Resources/views/backend/order/panel_delivery.html.twig
  26. +2
    -2
      ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig
  27. +19
    -7
      ShopBundle/Services/Order/OrderUtils.php
  28. +11
    -7
      ShopBundle/Services/Price/OrderShopPriceUtils.php

+ 88
- 114
ShopBundle/Controller/Backend/OrderController.php Ver arquivo

@@ -33,7 +33,6 @@ class OrderController extends AdminController

$queryBuilder->leftJoin('entity.orderStatus', 'orderStatus');

dump($filterOrderStatus);
if ($filterOrderStatus) {
$queryBuilder->andWhere('orderStatus.alias IN (:status)');
$queryBuilder->setParameter('status', $filterOrderStatus);
@@ -135,7 +134,7 @@ class OrderController extends AdminController
} else if ($formAddProductToOrder->isSubmitted() && $formAddProductToOrder->isValid()) {
$orderProduct = new $orderProductClass->name;

if($this->orderUtils->isProductAvailable($formAddProductToOrder->get('product')->getData(), $formAddProductToOrder->get('quantity')->getData())){
if ($this->orderUtils->isProductAvailable($formAddProductToOrder->get('product')->getData(), $formAddProductToOrder->get('quantity')->getData())) {
$orderProduct->setQuantityOrder($formAddProductToOrder->get('quantity')->getData());
$orderProduct->setProduct($formAddProductToOrder->get('product')->getData());

@@ -143,7 +142,7 @@ class OrderController extends AdminController

$response['status'] = 'success';
$response['message'] = 'Le produit a bien été ajouté à la commande';
}else{
} else {
$response['status'] = 'error';
$response['message'] = 'Le produit n\'est pas disponible dans cette quantité';
}
@@ -156,6 +155,47 @@ class OrderController extends AdminController
return new Response(json_encode($response));
}

public function orderProductsAction()
{

$id = $this->request->query->get('id');
$easyadmin = $this->request->attributes->get('easyadmin');
$orderShop = $easyadmin['item'];

$formOrderProducts = $this->createForm(OrderProductsType::class, $orderShop);

$formOrderProducts->handleRequest($this->request);


if ($formOrderProducts->isSubmitted() && $formOrderProducts->isValid()) {
$error = false;
// dump($formOrderProducts->get('orderProducts')->getData());
foreach ($orderShop->getOrderProducts() as $orderProduct) {
if($this->orderUtils->isProductAvailable($orderProduct->getProduct(),$orderProduct->getQuantityOrder())) {
if ($orderProduct->getQuantityOrder() <= 0) {
$this->em->remove($orderProduct);
} else {
$this->em->persist($orderProduct);
}
}else{
$error = true;
$response['status'] = 'error';
$response['message'] = 'Le prduit n\'est pas disponible dans cette quantité';
}
}
if(!$error) {
$this->em->flush();
$response['status'] = 'success';
$response['message'] = 'La commande a bien été modifié';
}
} else {
$response['status'] = 'error';
$response['message'] = 'Une erreur est survenue';
}
$response['data'] = $this->orderUtils->getOrderAsJsonObject($orderShop);;
return new Response(json_encode($response));
}


public function orderInvoiceAddressAction()
{
@@ -211,40 +251,7 @@ class OrderController extends AdminController
}


public function orderProductsAction()
{

$id = $this->request->query->get('id');
$easyadmin = $this->request->attributes->get('easyadmin');
$orderShop = $easyadmin['item'];

$formOrderProducts = $this->createForm(OrderProductsType::class, $orderShop);

$formOrderProducts->handleRequest($this->request);


if ($formOrderProducts->isSubmitted() && $formOrderProducts->isValid()) {
// dump($formOrderProducts->get('orderProducts')->getData());
foreach ($orderShop->getOrderProducts() as $orderProduct) {


if ($orderProduct->getQuantityOrder() <= 0) {
$response['niche'] = $orderProduct->getQuantityOrder();
$this->em->remove($orderProduct);
} else {
$this->em->persist($orderProduct);
}
}
$this->em->flush();
$response['status'] = 'success';
$response['message'] = 'La commande a bien été modifié';
} else {
$response['status'] = 'error';
$response['message'] = 'Une erreur est survenue';
}
$response['data'] = $this->orderUtils->getOrderAsJsonObject($orderShop);;
return new Response(json_encode($response));
}

public function orderPaymentAction()
{
@@ -290,7 +297,7 @@ class OrderController extends AdminController
if ($formOrderReductionCart->isSubmitted() && $formOrderReductionCart->isValid()) {
$reductionCart = $formOrderReductionCart->get('reductionCart')->getData();
$orderShop->reductionError = array();
if ($this->orderUtils->isReductionCartAllowToBeAddToOrder($orderShop, $reductionCart)) {
if ($this->orderUtils->isReductionCartAllowAddToOrder($orderShop, $reductionCart)) {
$orderReductionCart = $this->orderUtils->createOrderReductionCart($orderShop, $reductionCart);
$this->em->persist($orderReductionCart);
$this->em->flush();
@@ -362,90 +369,57 @@ class OrderController extends AdminController
}


public function renderOrderShopTemplate($actionName, $templatePath, array $parameters = [])
public function renderOrderCartTemplate($actionName, $templatePath, array $parameters = [])
{
//dump($this->em->getRepository(OrderShop::class)->getValidOrder());
dump($actionName);
if ($actionName == 'show') {
$formAddProductToOrder = $this->createForm(AddPoductToOrderType::class, null, array(
'action' => $this->generateUrl('easyadmin', [
'action' => 'addProductToOrder',
'entity' => $this->entity['name'],
'id' => $parameters['entity']->getId()
])
));
$formOrderProducts = $this->createForm(OrderProductsType::class, null, array(
'action' => $this->generateUrl('easyadmin', [
'action' => 'orderProducts',
'entity' => $this->entity['name'],
'id' => $parameters['entity']->getId()
])
));

$formOrderInvoiceAddress = $this->createForm(OrderInvoiceAddressType::class, null, array(
'data' => $parameters['entity'],
'action' => $this->generateUrl('easyadmin', [
'action' => 'orderInvoiceAddress',
'entity' => $this->entity['name'],
'id' => $parameters['entity']->getId()
])
));

$formOrderStatus = $this->createForm(OrderStatusType::class, null, array(
'data' => $parameters['entity'],
'action' => $this->generateUrl('easyadmin', [
'action' => 'orderStatus',
'entity' => $this->entity['name'],
'id' => $parameters['entity']->getId()
])
));

$formOrderReductionCart = $this->createForm(OrderReductionCartType::class, null, array(
'data' => $parameters['entity'],
'action' => $this->generateUrl('easyadmin', [
'action' => 'orderReductionCart',
'entity' => $this->entity['name'],
'id' => $parameters['entity']->getId()
])
));
$formOrderReductionCredit = $this->createForm(OrderReductionCreditType::class, null, array(
'data' => $parameters['entity'],
'action' => $this->generateUrl('easyadmin', [
'action' => 'orderReductionCredit',
'entity' => $this->entity['name'],
'id' => $parameters['entity']->getId()
])
));
if (!isset($parameters['form_order_delivery_address'])) {
$parameters['form_order_delivery_address'] = $this->createOrderForm(OrderDeliveryAddressType::class, 'orderDeliveryAddress', $parameters)->createView();
}
$parameters['form_order_reduction_credit'] = $this->createOrderForm(OrderReductionCreditType::class, 'orderReductionCredit', $parameters)->createView();
$parameters['form_order_reduction_cart'] = $this->createOrderForm(OrderReductionCartType::class, 'orderReductionCart', $parameters)->createView();
$parameters['form_add_product_to_order'] = $this->createOrderForm(AddPoductToOrderType::class, 'addProductToOrder', $parameters)->createView();
$parameters['form_order_products'] = $this->createOrderForm(OrderProductsType::class, 'orderProducts', $parameters)->createView();
$parameters['form_order_invoice_address'] = $this->createOrderForm(OrderInvoiceAddressType::class, 'orderInvoiceAddress', $parameters)->createView();
$parameters['form_order_status'] = $this->createOrderForm(OrderStatusType::class, 'orderStatus', $parameters)->createView();
}
return parent::renderTemplate($actionName, $templatePath, $parameters);
}

$formOrderPayment = $this->createForm(OrderPaymentType::class, null, array(
'action' => $this->generateUrl('easyadmin', [
'action' => 'orderPayment',
'entity' => $this->entity['name'],
'id' => $parameters['entity']->getId()
])
));
public function renderOrderShopTemplate($actionName, $templatePath, array $parameters = [])
{

if ($actionName == 'show') {
if (!isset($parameters['form_order_delivery_address'])) {
$formOrderDeliveryAddress = $this->createForm(OrderDeliveryAddressType::class, null, array(
'data' => $parameters['entity'],
'action' => $this->generateUrl('easyadmin', [
'action' => 'orderDeliveryAddress',
'entity' => $this->entity['name'],
'id' => $parameters['entity']->getId()
])
));
$parameters['form_order_delivery_address'] = $formOrderDeliveryAddress->createView();

$parameters['form_order_delivery_address'] = $this->createOrderForm(OrderDeliveryAddressType::class, 'orderDeliveryAddress', $parameters)->createView();
}
$parameters['form_order_reduction_credit'] = $formOrderReductionCredit->createView();
$parameters['form_order_reduction_cart'] = $formOrderReductionCart->createView();
$parameters['form_add_product_to_order'] = $formAddProductToOrder->createView();
$parameters['form_order_products'] = $formOrderProducts->createView();
$parameters['form_order_invoice_address'] = $formOrderInvoiceAddress->createView();
$parameters['form_order_status'] = $formOrderStatus->createView();
$parameters['form_order_payment'] = $formOrderPayment->createView();
$parameters['form_order_reduction_credit'] = $this->createOrderForm(OrderReductionCreditType::class, 'orderReductionCredit', $parameters)->createView();
$parameters['form_order_reduction_cart'] = $this->createOrderForm(OrderReductionCartType::class, 'orderReductionCart', $parameters)->createView();
$parameters['form_add_product_to_order'] = $this->createOrderForm(AddPoductToOrderType::class, 'addProductToOrder', $parameters)->createView();
$parameters['form_order_products'] = $this->createOrderForm(OrderProductsType::class, 'orderProducts', $parameters)->createView();
$parameters['form_order_invoice_address'] = $this->createOrderForm(OrderInvoiceAddressType::class, 'orderInvoiceAddress', $parameters)->createView();
$parameters['form_order_status'] = $this->createOrderForm(OrderStatusType::class, 'orderStatus', $parameters)->createView();
$parameters['form_order_payment'] = $this->createOrderForm(OrderPaymentType::class, 'orderPayment', $parameters, false)->createView();

}
return parent::renderTemplate($actionName, $templatePath, $parameters);
}

public function createOrderForm($class, $action, $parameters, $data = true)
{

$options = array();
if ($data) $options['data'] = $parameters['entity'];
$options['action'] = $this->generateUrl('easyadmin', array(
'action' => $action,
'entity' => $this->entity['name'],
'id' => $parameters['entity']->getId()
));

return $this->createForm($class, null, $options);
}

protected function newAction()
{
$this->dispatch(EasyAdminEvents::PRE_NEW);
@@ -497,7 +471,7 @@ class OrderController extends AdminController
$id = $this->request->query->get('id');
$easyadmin = $this->request->attributes->get('easyadmin');
$entity = $easyadmin['item'];
$easyadmin['entity']['name'] = 'OrderShop';
$fields = $this->entity['show']['fields'];
$deleteForm = $this->createDeleteForm($this->entity['name'], $id);

@@ -514,8 +488,8 @@ class OrderController extends AdminController
'order' => $this->orderUtils->getOrderAsJsonObject($entity)

];
return $this->executeDynamicMethod('renderOrderShopTemplate', ['show', $this->entity['templates']['show'], $parameters]);
dump($this->entity['name']);
return $this->executeDynamicMethod('render<EntityName>Template', ['show', $this->entity['templates']['show'], $parameters]);
}

/**

+ 4
- 0
ShopBundle/Model/OrderStatusHistory.php Ver arquivo

@@ -41,6 +41,10 @@ abstract class OrderStatusHistory extends AbstractEntity
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;
public function __toString()
{
return $this->getOrderStatus()->getAlias(). ' le : '.$this->getCreatedAt()->format('d-m-Y H:i').'('.$this->getOrigin().')';
}

public function getOrderShop(): ?OrderShop
{

+ 8
- 0
ShopBundle/Model/Visitor.php Ver arquivo

@@ -42,6 +42,14 @@ abstract class Visitor
$this->orders = new ArrayCollection();
}

public function __toString()
{
return $this->getLastAccess()->format('d-m-y h:i') .'( visites :'.$this->totalVisit.')';
}
public function getSummary(){
return 'Visiteur non inscrit ( visites :'.$this->totalVisit.')';
}

public function getCookie(): ?string
{
return $this->cookie;

+ 2
- 2
ShopBundle/Repository/OrderShopRepository.php Ver arquivo

@@ -43,7 +43,7 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
$query->join('e.orderReductionCart', 'orc');
$query->join('e.orderReductionCarts', 'orc');
$query->andWhere('orc.reductionCart = :reductionCart');
$query->setParameter('reductionCart', $reductionCart);
return $query->getQuery()->getSingleScalarResult();
@@ -55,7 +55,7 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
$query->andWhere('e.user = :user');
$query->join('e.orderReductionCart', 'orc');
$query->join('e.orderReductionCarts', 'orc');
$query->andWhere('orc.reductionCart = :reductionCart');
$query->setParameter('reductionCart', $reductionCart);
$query->setParameter('user', $user);

+ 1
- 3
ShopBundle/Resources/public/js/backend/script/order/vuejs-order.js Ver arquivo

@@ -104,8 +104,6 @@ appOrder = new Vue({
})/*, window.appOrderProductFamilyValues)*/;
},
mounted: function () {
log('ncnnc');
log(window.templateTest);
this.updateOrder(window.orderObject);
//log($(this.$el).find('#orderProductsForm').replace(/__name__/g, 0));
},
@@ -123,7 +121,7 @@ appOrder = new Vue({
this.postForm('#orderInvoiceAddressForm', '#modal-order-invoice-address');
},
updateOrderDeliveryAddress: function () {
this.postForm('#orderDeliveryAddressForm', '#modal-order-invoice-address');
this.postForm('#orderDeliveryAddressForm', '#modal-order-delivery-address');
},
updateOrderDeliveryAvailability: function () {
this.postForm('#orderDeliveryAvailabilityForm', '#modal-order-delivery-availability');

+ 10
- 0
ShopBundle/Resources/translations/lcshop.fr.yaml Ver arquivo

@@ -95,6 +95,7 @@ field:
price: Prix
priceWithTax: Prix de vente TTC
username: Nom d'utilisateur
user: Utilisateur
email: E-mail
plainPassword: Mot de passe
roles: Rôle attribué
@@ -155,6 +156,9 @@ field:
behaviorTaxRateHelp: Appliquer la réduction sur le prix HT ou le prix TTC
deliveryAddress: Addresse de livraison
invoiceAddress: Addresse de facturation
deliveryTypeOptions:
point-sale: En ambassade
home: À domicile
PointSale:
code: Code
codeHelp: Code utilisé pour retrouver l'ambassade dans le tunnel de commande (Non sensible à la casse)
@@ -250,6 +254,8 @@ field:
orderNumber: Numéro de commande
quantity: Quantité
addOrderToProduct: Ajouter le produit
total: Total
status: Statut

action:
new: Créer %entity_label%
@@ -268,6 +274,10 @@ action:
user:
account: Mon compte
logout: Me déconnecter
order:
addOrderProduct: Ajouter un produit
addReductionCart: Ajouter une réduction
addReductionCredit: Ajouter un avoir

resetting:
check_email: |

+ 1
- 0
ShopBundle/Resources/views/backend/default/block/macros.html.twig Ver arquivo

@@ -26,6 +26,7 @@
{% endmacro endCard %}



{% macro productField(colspan, field, fieldName, fieldDisplay = false, displaySuffix="",attr="") %}

{% if fieldDisplay == false %}{% set fieldDisplay = fieldName %}{% endif %}

+ 1
- 1
ShopBundle/Resources/views/backend/default/list-fields/field_total.html.twig Ver arquivo

@@ -1 +1 @@
{{ priceUtils.getTotalWithTaxAndReductions(item) }}
{{ priceUtils.getTotalWithTax(item) }}

+ 0
- 14
ShopBundle/Resources/views/backend/order/card_addproducttoorder.html.twig Ver arquivo

@@ -1,14 +0,0 @@

{{ form_start(form_add_product_to_order, {'attr': {"class" : 'row', 'id' : 'addProductToOrderForm'}}) }}
{% form_theme form_add_product_to_order '@LcShop/backend/form/custom_bootstrap_4.html.twig' %}
<div class="col-12">
{{ form_row(form_add_product_to_order.product, {'attr': {"v-model" : 'addProductId'}}) }}
</div>
<div class="col-12">
{{ form_row(form_add_product_to_order.quantity, {'attr': {"v-model" : 'addProductQuantity'}}) }}
</div>
<div class="col-12">
{{ form_row(form_add_product_to_order.addProductToOrder, {'attr': {"class": "btn-success float-right", "@click" : 'addProductToOrder'}}) }}
</div>
{{ form_end(form_add_product_to_order) }}


+ 64
- 0
ShopBundle/Resources/views/backend/order/edit-cart.html.twig Ver arquivo

@@ -0,0 +1,64 @@
{% extends '@LcShop/backend/default/show.html.twig' %}

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

{% block main %}
{% form_theme form_order_reduction_cart '@LcShop/backend/form/custom_bootstrap_4.html.twig' %}
{% form_theme form_add_product_to_order '@LcShop/backend/form/custom_bootstrap_4.html.twig' %}
{% form_theme form_order_reduction_credit '@LcShop/backend/form/custom_bootstrap_4.html.twig' %}
<div class="lc-vue-js-container" id="lc-order-edit">


<div class="row">

{{ orderMacros.mainInfo() }}

<template v-if="order.user">
{{ orderMacros.addressInfo() }}
</template>
{{ macros.startCard(12, 'OrderShop.resume') }}



{% include '@LcShop/backend/order/form/card_orderproducts.html.twig' %}


{#
{{ macros.startCard(0, 'OrderShop.orderReductionCredit', 'success') }}
{{ form_start(form_order_reduction_credit, {'attr': { 'id' : 'orderReductionCredit'}}) }}
{{ form_end(form_order_reduction_credit) }}
{{ macros.endCard }}#}

{# {% include '@LcShop/backend/order/form/modal_reductioncart.html.twig' %}#}


{{ macros.cardOverlay('isLoading') }}
{{ macros.endCard() }}


{% include '@LcShop/backend/order/form/modal_invoiceaddress.html.twig' %}
{% include '@LcShop/backend/order/form/modal_deliveryaddress.html.twig' %}
{% include '@LcShop/backend/order/form/modal_deliveryavailability.html.twig' %}
{% include '@LcShop/backend/order/form/modal_orderstatus.html.twig' %}
{% include '@LcShop/backend/order/form/modal_reductioncredit.html.twig' %}
{% include '@LcShop/backend/order/form/modal_reductioncart.html.twig' %}
{% include '@LcShop/backend/order/form/modal_addproducttoorder.html.twig' %}

{# {{ macros.startCard(3, 'OrderShop.addProduct', 'success') }}
{% include '@LcShop/backend/order/form/addproducttoorder.html.twig' %}
{{ macros.endCard(3) }}

{{ macros.startCard(0, 'OrderShop.orderReductionCart', 'success') }}
{{ form_start(form_order_reduction_cart, {'attr': { 'id' : 'orderReductionCartForm'}}) }}
{{ form_end(form_order_reduction_credit) }}
{{ macros.endCard(3) }}#}
</div>
</div>
{% endblock %}

{% block script_javascript %}
{{ parent() }}
{% include '@LcShop/backend/default/block/script-vuejs.html.twig' %}
<script src="{{ asset('bundles/lcshop/js/backend/script/order/vuejs-order.js') }}"></script>
{% endblock %}

ShopBundle/Resources/views/backend/order/edit.html.twig → ShopBundle/Resources/views/backend/order/edit-order.html.twig Ver arquivo

@@ -9,18 +9,18 @@

<div class="row">

{% include '@LcShop/backend/order/form.html.twig' %}
{% include '@LcShop/backend/order/card_orderproducts.html.twig' %}

{{ macros.startCard(3, 'OrderShop.addProduct', 'success') }}
{% include '@LcShop/backend/order/card_addproducttoorder.html.twig' %}
{{ macros.endCard }}

{% include '@LcShop/backend/order/modal_invoiceaddress.html.twig' %}
{% include '@LcShop/backend/order/modal_deliveryaddress.html.twig' %}
{% include '@LcShop/backend/order/modal_deliveryavailability.html.twig' %}
{% include '@LcShop/backend/order/modal_orderstatus.html.twig' %}
{% include '@LcShop/backend/order/modal_reductioncart.html.twig' %}
{% include '@LcShop/backend/order/modal_reductioncredit.html.twig' %}
{% include '@LcShop/backend/order/modal_orderpayment.html.twig' %}
{{ macros.endCard }}

</div>
</div>
{% endblock %}

+ 0
- 12
ShopBundle/Resources/views/backend/order/form.html.twig Ver arquivo

@@ -1,12 +0,0 @@

{#{{ form_start(form, {"attr": {'class' : "col-9"}}) }}#}


{% include '@LcShop/backend/order/card_orderproducts.html.twig' %}
{#{% include '@LcShop/backend/order/card_adresses.html.twig' %}#}
{#
{{ form_end(form) }}
#}




ShopBundle/Resources/views/backend/order/card_orderproducts.html.twig → ShopBundle/Resources/views/backend/order/form/card_orderproducts.html.twig Ver arquivo

@@ -1,9 +1,9 @@
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %}
{% import '@LcShop/backend/order/macros.html.twig' as orderMacros %}
{% trans_default_domain 'lcshop' %}
{{ macros.startCard(9, 'OrderShop.resume') }}

<div class="col-4">

{#<div class="col-4">
<h6><strong>{{ "field.OrderShop.mainInfo"|trans({}, 'lcshop') }} : </strong></h6>
<p>
<strong>{{ "field.OrderShop.status"|trans }} </strong><br />
@@ -20,8 +20,8 @@
<strong>{{ "field.OrderShop.orderNumber"|trans }} </strong><br />
<span>${order.id}</span>
</p>
</div>
<div class="col-4" >
</div>#}
{#<div class="col-4" >

<div v-if="order.deliveryType == 'home'">
<h6><strong>{{ "field.default.deliveryAddress"|trans({}, 'lcshop') }} : </strong></h6>
@@ -41,16 +41,16 @@
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-delivery-address">
{{ "action.edit"|trans }}
</button>
</div>
<div class="col-4">
</div>#}
{#<div class="col-4">
<h6><strong>{{ "field.default.invoiceAddress"|trans({}, 'lcshop') }}</strong></h6>
<address v-html="order.invoiceAddress">
</address>
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-invoice-address">
{{ "action.edit"|trans }}
</button>
</div>
<div class="col-12">
</div>#}
{#<div class="col-12">
<h6><strong>{{ "field.default.deliveryAvailabilty"|trans({}, 'lcshop') }} : </strong></h6>
<div v-if="order.deliveryType == 'home'">
<div v-html="order.deliveryAvailabilityZone">
@@ -63,7 +63,7 @@
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-delivery-availability">
{{ "action.edit"|trans }}
</button>
</div>
</div>#}
<div class="col-12">

{{ form_start(form_order_products, {'attr': {'id' : 'orderProductsForm'}}) }}
@@ -72,17 +72,23 @@
window.templateTest = '{{ orderMacros.productsTemplate(form_order_products)|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';
</script>
{{ orderMacros.tableHead() }}


{{ orderMacros.products(form_order_products) }}



{{ orderMacros.tableTotal() }}

{% do form_order_products.orderProducts.setRendered %}
{{ form_end(form_order_products) }}

<div class="clearfix"></div>
<script>
window.orderObject = {{ order|json_encode|raw }};
</script>
<h6><strong>Réductions</strong></h6>
</div>
{# <h6><strong>Réductions</strong></h6>
${order.orderReductionCart}
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-reduction-cart">
{{ "action.addReductionCart"|trans }}
@@ -95,16 +101,13 @@

<br />
<h6><strong>Historiques des paiments</strong></h6>
{#TODO: afficher si la commande est règlé et afficher une alerte si le montant des paiments est supérieur au montant total de la commande#}
#}{#TODO: afficher si la commande est règlé et afficher une alerte si le montant des paiments est supérieur au montant total de la commande#}{#
${order.orderPaid}
<ul v-for="(orderPayment, i) in order.orderPayments">
<li>${orderPayment}</li>
</ul>
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-payment">
{{ "action.addOrderPayment"|trans }}
</button>
</div>
</button>#}


{{ macros.cardOverlay('isLoading') }}
{{ macros.endCard(9) }}

+ 32
- 0
ShopBundle/Resources/views/backend/order/form/modal_addproducttoorder.html.twig Ver arquivo

@@ -0,0 +1,32 @@
{% trans_default_domain 'lcshop' %}

<div class="modal fade show" id="modal-add-product-to-order">
{{ form_start(form_add_product_to_order, {'attr': {'id' : 'addProductToOrderForm'}}) }}
{% form_theme form_add_product_to_order '@LcShop/backend/form/custom_bootstrap_4.html.twig' %}
<div class="modal-dialog">

<div class="modal-content">
<div class="modal-header">
<h4>{{ "action.order.addOrderProduct"|trans }}</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="col">
{{ form_row(form_add_product_to_order.product, {'attr': {"v-model" : 'addProductId'}}) }}
</div>
<div class="col">
{{ form_row(form_add_product_to_order.quantity, {'attr': {"v-model" : 'addProductQuantity'}}) }}
</div>

</div>
<div class="modal-footer justify-content-between">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
{{ form_widget(form_add_product_to_order.addProductToOrder, {"attr": {'class' : 'btn btn-primary', '@click' : 'addProductToOrder'}}) }}
</div>
</div>
<!-- /.modal-content -->
</div>
{{ form_end(form_add_product_to_order) }}
</div>

ShopBundle/Resources/views/backend/order/modal_deliveryaddress.html.twig → ShopBundle/Resources/views/backend/order/form/modal_deliveryaddress.html.twig Ver arquivo

@@ -16,7 +16,6 @@
<div class="col">
{{ form_row(form_order_delivery_address.deliveryPointSale) }}
</div>

</div>
<div class="modal-footer justify-content-between">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

ShopBundle/Resources/views/backend/order/modal_deliveryavailability.html.twig → ShopBundle/Resources/views/backend/order/form/modal_deliveryavailability.html.twig Ver arquivo


ShopBundle/Resources/views/backend/order/modal_invoiceaddress.html.twig → ShopBundle/Resources/views/backend/order/form/modal_invoiceaddress.html.twig Ver arquivo

@@ -1,4 +1,3 @@

<div class="modal fade show" id="modal-order-invoice-address">
{{ form_start(form_order_invoice_address, {'attr': { 'id' : 'orderInvoiceAddressForm'}}) }}) }}
{% form_theme form_order_invoice_address '@LcShop/backend/form/custom_bootstrap_4.html.twig' %}

ShopBundle/Resources/views/backend/order/modal_orderpayment.html.twig → ShopBundle/Resources/views/backend/order/form/modal_orderpayment.html.twig Ver arquivo


ShopBundle/Resources/views/backend/order/modal_orderstatus.html.twig → ShopBundle/Resources/views/backend/order/form/modal_orderstatus.html.twig Ver arquivo


ShopBundle/Resources/views/backend/order/modal_reductioncart.html.twig → ShopBundle/Resources/views/backend/order/form/modal_reductioncart.html.twig Ver arquivo

@@ -7,7 +7,7 @@

<div class="modal-content">
<div class="modal-header">
<h4>{{ "form.group.OrderShop.orderReductionCart"|trans }}</h4>
<h4>{{ "action.order.addReductionCart"|trans }}</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>

ShopBundle/Resources/views/backend/order/modal_reductioncredit.html.twig → ShopBundle/Resources/views/backend/order/form/modal_reductioncredit.html.twig Ver arquivo

@@ -1,13 +1,13 @@
{% trans_default_domain 'lcshop' %}

<div class="modal fade show" id="modal-reduction-credit">
{{ form_start(form_order_reduction_credit, {'attr': { 'id' : 'orderReductionCreditForm'}}) }}) }}
{{ form_start(form_order_reduction_credit, {'attr': {'class': 'row', 'id' : 'orderReductionCreditForm'}}) }}) }}
{% form_theme form_order_reduction_credit '@LcShop/backend/form/custom_bootstrap_4.html.twig' %}
<div class="modal-dialog">

<div class="modal-content">
<div class="modal-header">
<h4>{{ "form.group.OrderShop.orderReductionCredit"|trans }}</h4>
<h4>{{ "action.order.addReductionCredit"|trans }}</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>

+ 195
- 51
ShopBundle/Resources/views/backend/order/macros.html.twig Ver arquivo

@@ -1,3 +1,4 @@
{% trans_default_domain 'lcshop' %}
{% macro tableHead() %}
<table id="order-products-list" class="table table-striped">
<thead>
@@ -22,65 +23,208 @@
</th>
</tr>
</thead>
{% endmacro %}
{% endmacro %}


{% macro products(form_order_products) %}
<tbody>
<template v-for="(orderProduct, key) in orderProducts">
<order-product ref="orderProductBLOP" :order-product="orderProduct" :template="templateTest" :key-item="key"></order-product>
</template>
</tbody>
{% endmacro %}
{% macro products(form_order_products) %}
<tbody>
<template v-for="(orderProduct, key) in orderProducts">
<order-product ref="orderProductBLOP" :order-product="orderProduct" :template="templateTest"
:key-item="key"></order-product>
</template>
</tbody>
{% endmacro %}


{% macro productsTemplate(form_order_products) %}
<tr class="order-product-item">
<td colspan="2">{% verbatim %}{{orderProduct.title}}{% endverbatim %}</td>
<td>
{% verbatim %}{{orderProduct.price}}{% endverbatim %}€
</td>
<td>
{% verbatim %}{{orderProduct.priceWithTax}}{% endverbatim %}€
</td>
<td></td>
<td>
{{ form_widget(form_order_products.orderProducts.vars.prototype.quantityOrder, {'attr' : {'ref': 'fieldQuantity', 'v-model' : 'orderProduct.quantityOrder', '@change' : 'updateOrderProducts'}}) }}
{{ form_widget(form_order_products.orderProducts.vars.prototype.product, {'attr' : {'ref' : 'fieldProduct', 'v-model' : 'orderProduct.product'}}) }}
{#{{ form_widget(form_order_products.orderProducts.vars.prototype.id, {'attr' : {'ref' : 'fieldId', 'v-model' : 'orderProduct.id'}}) }}#}
<button type="button" class="btn-remove-product btn btn-default" @click="deleteOrderProduct()">
<i class="fa fa-trash"></i>
</button>
</td>
<td>
{% verbatim %}{{orderProduct.totalWithTaxAndReduction}}{% endverbatim %}€
</td>
</tr>

{% endmacro %}

{% macro tableTotal() %}

{% macro productsTemplate(form_order_products) %}
<tr class="order-product-item">
<td colspan="2">{% verbatim %}{{orderProduct.title}}{% endverbatim %}</td>
<td>
{% verbatim %}{{orderProduct.price}}{% endverbatim %}€
</td>
<td>
{% verbatim %}{{orderProduct.priceWithTax}}{% endverbatim %}€
</td>
<td></td>
<td>
{{ form_widget(form_order_products.orderProducts.vars.prototype.quantityOrder, {'attr' : {'ref': 'fieldQuantity', 'v-model' : 'orderProduct.quantityOrder', '@change' : 'updateOrderProducts'}}) }}
{{ form_widget(form_order_products.orderProducts.vars.prototype.product, {'attr' : {'ref' : 'fieldProduct', 'v-model' : 'orderProduct.product'}}) }}
{#{{ form_widget(form_order_products.orderProducts.vars.prototype.id, {'attr' : {'ref' : 'fieldId', 'v-model' : 'orderProduct.id'}}) }}#}
<button type="button" class="btn-remove-product btn btn-default" @click="deleteOrderProduct()">
<i class="fa fa-trash"></i>
</table>

<div class="clearfix"></div>

<div class="row">
<div class="col-7">
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#modal-add-product-to-order">
<i class="fa fa-plus"></i> {{ "action.order.addOrderProduct"|trans }}
</button>
</td>
<td>
{% verbatim %}{{orderProduct.totalWithTaxAndReduction}}{% endverbatim %}€
</td>
</tr>
<button type="button" class="btn btn-warning" data-toggle="modal" data-target="#modal-reduction-cart">
<i class="fa fa-shopping-basket"></i> {{ "action.order.addReductionCart"|trans }}
</button>
<button type="button" class="btn btn-warning" data-toggle="modal" data-target="#modal-reduction-credit">
<i class="fa fa-backspace"></i> {{ "action.order.addReductionCredit"|trans }}
</button>
</div>
<div class="col-5">
<div class="table-responsive">
<table class="table">
<tbody>
<tr>
<th>Total without Tax</th>
<td>${order.total}€</td>
</tr>
<tr>
<th>Total</th>
<td>${order.totalWithTax}€</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
{% endmacro %}

{% macro tableTotal() %}
{% macro mainInfo() %}
{#${order.id}#}
<div class="col-3">
<div class="info-box">
<span class="info-box-icon bg-info">
<i class="far fa-user"></i></span>

</table>
<div class="info-box-content">
<span class="info-box-text">{{ "field.default.user"|trans({}, 'lcshop') }}</span>
<strong v-if="order.user" v-html="order.user"></strong>
<strong v-else v-html="order.visitor"></strong>
</div>
</div>
</div>
<div class="col-3">
<div class="info-box">
<span class="info-box-icon bg-success">
<i class="far fa-calendar"></i></span>
<div class="info-box-content">
<span class="info-box-text">{{ "field.default.date"|trans({}, 'lcshop') }}</span>
<span class="info-box-number" v-if="order.createdAt"> ${order.createdAt}</span>
<span class="info-box-number" v-else> ${order.createdAt}</span>
</div>
</div>
</div>

<div class="col-3">
<div class="info-box">
<span class="info-box-icon bg-warning">
<i class="fa fa-euro-sign"></i></span>

<div class="info-box-content">
<span class="info-box-text">{{ "field.OrderShop.total"|trans({}, 'lcshop') }}</span>
<strong> ${order.totalWithTaxAndReduction} €</strong>
<strong> ${order.countProducts}</strong>
</div>
</div>
</div>
<div class="col-3">
<div class="info-box">
<span class="info-box-icon bg-danger">
<i class="fa fa-info"></i></span>
<div class="info-box-content">
<span class="info-box-text">{{ "field.OrderShop.status"|trans({}, 'lcshop') }}</span>
<strong> ${order.orderStatus}</strong>
</div>
</div>
</div>

{#
<div class="col-3">
<strong>{{ "field.OrderShop.status"|trans }} </strong><br/>
<span>${order.orderStatus}</span>
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-status">
{{ "action.edit"|trans }}
</button>
</div>#}

{% endmacro mainInfo %}

{% macro addressInfo() %}
<div class="col-4">

<div class="info-box">
<span class="info-box-icon bg-info">
<i class="fa fa-address-card"></i></span>
<div class="info-box-content">
<strong>{{ "field.default.invoiceAddress"|trans({}, 'lcshop') }}</strong>
<address v-html="order.invoiceAddress">
</address>
<button type="button" class="btn btn-default" data-toggle="modal"
data-target="#modal-order-invoice-address">
{{ "action.edit"|trans }}
</button>
</div>
</div>
</div>

<div class="col-4">

<div class="info-box">
<span class="info-box-icon bg-success">
<i class="fa fa-map-marked-alt"></i></span>
<div class="info-box-content">

<div v-if="order.deliveryType == 'home'">
<strong>{{ "field.default.deliveryAddress"|trans({}, 'lcshop') }}</strong>
<address v-html="order.deliveryAddress">
</address>
</div>
<div v-else-if="order.deliveryType == 'point-sale'">
<h6><strong>{{ "field.default.deliveryPointSale"|trans({}, 'lcshop') }} : </strong></h6>
<address v-html="order.deliveryPointSale">
</address>
</div>
<div v-else>
Aucun lieu de livraison défini.
</div>
<button type="button" class="btn btn-default" data-toggle="modal"
data-target="#modal-order-delivery-address">
{{ "action.edit"|trans }}
</button>
</div>
</div>
</div>

<div class="col-4">

<div class="info-box">
<span class="info-box-icon bg-danger">
<i class="fa fa-clock"></i></span>
<div class="info-box-content">

<div class="clearfix"></div>

<div class="row">
<div class="col-7"></div>
<div class="col-5">
<div class="table-responsive">
<table class="table">
<tbody>
<tr>
<th>Total without Tax</th>
<td>${order.total}€</td>
</tr>
<tr>
<th>Total</th>
<td>${order.totalWithTax}€</td>
</tr>
</tbody>
</table>
<h6><strong>{{ "field.default.deliveryAvailabilty"|trans({}, 'lcshop') }} : </strong></h6>
<div v-if="order.deliveryType == 'home'">
<div v-html="order.deliveryAvailabilityZone">
</div>
</div>
<div v-else-if="order.deliveryType == 'point-sale'">
<div v-html="order.deliveryAvailabilityPointSale">
</div>
</div>
<button type="button" class="btn btn-default" data-toggle="modal"
data-target="#modal-order-delivery-availability">
{{ "action.edit"|trans }}
</button>
</div>
</div>
</div>
</div>
{% endmacro %}
{% endmacro addressInfo %}

+ 0
- 16
ShopBundle/Resources/views/backend/order/panel_addresses.html.twig Ver arquivo

@@ -1,16 +0,0 @@
<div class="row">
<div class="field-group col-12">
<div class="card card-primary">
<div class="card-header">
<h3>{{ "form.group.ProductFamily.addresses"|trans }}</h3>
</div>
<div class="row">


<div class="col">
{{ form_row(form.invoiceAddress, {"attr": {'v-model' : 'invoiceAddress', 'v-selecttwo' : 'invoiceAddress'}}) }}
</div>
</div>
</div>
</div>
</div>

+ 0
- 47
ShopBundle/Resources/views/backend/order/panel_cart.html.twig Ver arquivo

@@ -1,47 +0,0 @@
<div class="row">
<div class="field-group col-12">
<fieldset>
<legend>Stock</legend>
<div class="row">
<div class="col">
{{ form_label(form.behaviorCountStock) }}
{% for field in form.behaviorCountStock %}
{% if field.vars.value == "by-product" %}
<div v-if="activeProducts == true">
{{ form_widget(field, {"attr" : {"v-model" : 'behaviorCountStock'}}) }}
</div>
{% else %}
{{ form_widget(field, {"attr" : {"v-model" : 'behaviorCountStock'}}) }}
{% endif %}
{% endfor %}
</div>
<div class="col">
<div v-show="behaviorCountStock == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY') }}' || behaviorCountStock == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'"
class="form-group">
{{ form_label(form.availableQuantity) }}
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.availableQuantity) }}
<div v-show="behaviorCountStock == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'" class="input-group-append">
<span class="input-group-text">${ getUnitReference() }</span>
</div>
</div>
{{ form_help(form.availableQuantity) }}
</div>

{{ form_label(form.availableQuantityDefault) }}
<div class="form-widget">
<div class="input-group">
{{ form_widget(form.availableQuantityDefault) }}
<div v-show="behaviorCountStock == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'" class="input-group-append">
<span class="input-group-text">${ getUnitReference() }</span>
</div>
</div>
{{ form_help(form.availableQuantityDefault) }}
</div>
</div>
</div>
</div>
</fieldset>
</div>
</div>

+ 0
- 138
ShopBundle/Resources/views/backend/order/panel_delivery.html.twig Ver arquivo

@@ -1,138 +0,0 @@
{#
<div class="row">
<div class="field-group col-12">
<fieldset>
<legend>Livraisons</legend>
<div class="row">
<delivery-choice ref="delivery-choice"></delivery-choice>
#}
{#<div class="col">
{{ form_label(form.deliveryAvailabilityZoneShort) }}
<div class="delivery-availability-short">
{% for field in form.deliveryAvailabilityZoneShort %}
{{ form_widget(field, {"attr" : {"v-model" : 'deliveryAvailability'}}) }}
{% endfor %}
</div>
</div>
<div class="col">
{{ form_label(form.deliveryAvailabilityZoneLarge) }}
<div class="delivery-availability-large">
{% for field in form.deliveryAvailabilityZoneLarge %}
{{ form_widget(field, {"attr" : {"v-model" : 'deliveryAvailability'}}) }}
{% endfor %}
</div>
${deliveryAvailability}
</div>#}{#

</div>
</fieldset>
</div>
</div>
#}


{#
{% macro printDeliveryAvailabitlityRow(slot) %}
<div class="form-check">
<input type="radio" v-model="deliveryAvailability" id="{% verbatim %}{{ id }}{% endverbatim %}_20" name="{% verbatim %}{{ name }}{% endverbatim %}" class="form-check-input" value="{% verbatim %}{{ value }}{% endverbatim %}">
<label class="form-check-label" for="{% verbatim %}{{ id }}{% endverbatim %}_20"></label>
</div>
{% endmacro %}
{% import _self as formMacros %}

<div class="row">
<div class="field-group col-12">
<fieldset>
<legend>Livraisons</legend>
<div class="row">
<div class="col">
{{ form_label(form.deliveryAvailabilityZone) }}

<div id="delivery-availabilities-choice">

<template v-for="(deliveryAvailability, key) in formDeliveryAvailabilityArray">
<delivery-availability-choice ref="delivery-choice" :template="deliveryAvailability" :key="key" :name="{{ form.deliveryAvailabilityZone.vars.full_name }}" :id="{{ form.deliveryAvailabilityZone.vars.id }}" >

</delivery-availability-choice>
</template>
</div>
</div>
#}{# <div class="col">
{{ form_label(form.deliveryAvailabilityZoneLarge) }}
<div class="delivery-availability-large">
{% for field in form.deliveryAvailabilityZoneLarge %}
{{ form_widget(field, {"attr" : {"v-model" : 'deliveryAvailability'}}) }}
{% endfor %}
</div>
${deliveryAvailability}
</div>#}{#
</div>
</fieldset>
</div>

<div class="clearfix"></div>

#}{#{% for keyForm, deliveryAvailabilityField in form.deliveryAvailabilityZoneShort %}

<script>
jQuery(window).on('load', function () {
var deliveryAvailabilityForm = '{{ formMacros.printDeliveryAvailabitlityRow(deliveryAvailabilityField)|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';

appOrder.formDeliveryAvailabilityArray.push(deliveryAvailabilityForm);
appOrder.indexDeliveryAvailability++;
});
</script>

{% endfor %}#}{#

</div>#}


{% macro printDeliveryAvailabitlityChoice() %}
<div class="form-check">
<input type="radio" v-model="deliveryAvailability" id="__id__" name="__name__" class="form-check-input" value="__value__" @change="updateDeliveryAvailability">
<label class="form-check-label" for="__id__">__label__</label>

</div>
{% endmacro %}
{% import _self as formMacros %}

<div class="row">
<div class="field-group col-12">
<fieldset>
<legend>Livraisons</legend>
<div class="row">
<div class="col">
{{ form_label(form.deliveryAvailabilityZone) }}

<div id="delivery-availability-short" data-prototype='{{ formMacros.printDeliveryAvailabitlityChoice()|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}'>

<template v-for="(deliveryAvailability, key) in formDeliveryAvailabilityLargeArray">
<delivery-availability-choice ref="delivery-choice" :template="deliveryAvailability" :key="key" >

</delivery-availability-choice>
</template>
BLOP
<template v-for="(deliveryAvailability, key) in formDeliveryAvailabilityShortArray">
<delivery-availability-choice ref="delivery-choice" :template="deliveryAvailability" :key="key" >

</delivery-availability-choice>
</template>
</div>
</div>
{# <div class="col">
{{ form_label(form.deliveryAvailabilityZoneLarge) }}
<div class="delivery-availability-large">
{% for field in form.deliveryAvailabilityZoneLarge %}
{{ form_widget(field, {"attr" : {"v-model" : 'deliveryAvailability'}}) }}
{% endfor %}
</div>
${deliveryAvailability}
</div>#}
</div>
</fieldset>
</div>

<div class="clearfix"></div>
</div>
{##}

+ 2
- 2
ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig Ver arquivo

@@ -22,8 +22,8 @@
{{ macros.productField(2, product.price, 'price', false, '€', 'v-show="productFamily.behaviorPrice == \'by-piece\'"') }}
{{ macros.productField(2, product.priceWithTax, 'priceWithTax', false, '€', 'v-show="productFamily.behaviorPrice == \'by-piece\'"') }}

{{ macros.productField(1, product.availableQuantity, 'availableQuantity',false, '', 'v-show="productFamily.behaviorCountStock== \' '~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') ~' \'"') }}
{{ macros.productField(1, product.availableQuantityDefault, 'availableQuantityDefault',false, '', 'v-show="productFamily.behaviorCountStock== \'by-product\'"') }}
{{ macros.productField(1, product.availableQuantity, 'availableQuantity',false, '', 'v-show="productFamily.behaviorCountStock== \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') ~ '\'"') }}
{{ macros.productField(1, product.availableQuantityDefault, 'availableQuantityDefault',false, '', 'v-show="productFamily.behaviorCountStock== \'' ~ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') ~ '\'"') }}

{{ macros.productField(2, product.propertyExpirationDate, 'propertyExpirationDate','propertyExpirationDateValue', '', 'v-show="productFamily.behaviorExpirationDate== \'by-product\'"') }}


+ 19
- 7
ShopBundle/Services/Order/OrderUtils.php Ver arquivo

@@ -449,14 +449,26 @@ class OrderUtils
{
$quanityAsked = $quanityOrder;

if($product->getProductFamily()->getBehaviorCountStock() == ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE) {
$quanityAsked = ($product->getQuantityInherited() / $product->getUnitInherited()->getCoefficient()) * $quanityOrder;
}
switch ($product->getProductFamily()->getBehaviorCountStock()) {
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :
if ($product->getAvailableQuantityInherited() >= $quanityAsked) {
return true;
} else {
return false;
}
break;
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE :
$quanityAsked = ($product->getQuantityInherited() / $product->getUnitInherited()->getCoefficient()) * $quanityOrder;
if ($product->getAvailableQuantityInherited() >= $quanityAsked) {
return true;
} else {
return false;
}
break;
case ProductFamily::BEHAVIOR_COUNT_STOCK_UNLIMITED :
return true;

if ($product->getAvailableQuantityInherited() >= $quanityAsked || $product->getProductFamily()->getBehaviorCountStock() == ProductFamily::BEHAVIOR_COUNT_STOCK_UNLIMITED) {
return true;
} else {
return false;
}

}

+ 11
- 7
ShopBundle/Services/Price/OrderShopPriceUtils.php Ver arquivo

@@ -115,10 +115,10 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface

public function getOrderProductsReductionCartAmountWithoutTax(OrderShopInterface $order, $orderReductionCart)
{
$amount =0;
if($orderReductionCart->getAppliedTo() === ReductionCart::APPLIED_TO_ORDER_PRODUCTS) {
if ($orderReductionCart->getUnit() == 'percent') {
$price = $this->amountReductionByPercentValue(
$amount = $this->amountReductionByPercentValue(
$this->getTotalOrderProducts($order),
$orderReductionCart->getValue()
);
@@ -131,32 +131,36 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface

}
}
return $amount ;

}

public function getOrderProductsReductionCartAmountWithTax(OrderShopInterface $order, $orderReductionCart)
{

$amount =0;
if($orderReductionCart->getAppliedTo() === ReductionCart::APPLIED_TO_ORDER_PRODUCTS) {
if ($orderReductionCart->getUnit() == 'percent') {

$price = $this->amountReductionByPercentValue(
$amount = $this->amountReductionByPercentValue(
$this->getTotalOrderProductsWithTax($order),
$orderReductionCart->getValue()
);
} else if ($orderReductionCart->getUnit() == 'amount') {
if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') {
$price = $orderReductionCart->getValue() * $this->getTaxRateAverage();
$amount = $orderReductionCart->getValue() * $this->getTaxRateAverage();
} else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') {
$price = $orderReductionCart->getValue() ;
$amount = $orderReductionCart->getValue() ;
}

}
}
return $amount ;
}

public function getOrderProductsReductionCreditAmountWithoutTax(OrderShopInterface $order, OrderReductionCreditInterface $orderReductionCredit)
{
$amount =0;
if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') {
$amount = $orderReductionCredit->getValue();
} else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') {
@@ -168,7 +172,7 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface

public function getOrderProductsReductionCreditAmountWithTax(OrderShopInterface $order, OrderReductionCreditInterface $orderReductionCredit)
{
$amount =0;
if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') {
$amountWithTax = $orderReductionCredit->getValue() * $this->getTaxRateAverage();
} else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') {

Carregando…
Cancelar
Salvar