@@ -14,6 +14,7 @@ use Lc\ShopBundle\Context\OrderShopInterface; | |||
use Lc\ShopBundle\Context\OrderUtilsInterface; | |||
use Lc\ShopBundle\Context\UserInterface; | |||
use Lc\ShopBundle\Form\Backend\Order\AddPoductToOrderType; | |||
use Lc\ShopBundle\Form\Backend\Order\DeleteOrderPaymentType; | |||
use Lc\ShopBundle\Form\Backend\Order\DeleteOrderReductionCartType; | |||
use Lc\ShopBundle\Form\Backend\Order\DeleteOrderReductionCreditType; | |||
use Lc\ShopBundle\Form\Backend\Order\OrderDeliveryAddressType; | |||
@@ -38,6 +39,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; | |||
class OrderController extends AdminController | |||
{ | |||
protected $creditUtils; | |||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, Utils $utils, MerchantUtilsInterface $merchantUtils, MailjetTransport $mailjetTransport, OrderUtilsInterface $orderUtils, TranslatorInterface $translator, CreditUtils $creditUtils) | |||
{ | |||
parent::__construct($security, $userManager, $em, $utils, $merchantUtils, $mailjetTransport, $orderUtils, $translator); | |||
@@ -233,7 +235,7 @@ class OrderController extends AdminController | |||
$oldStatus = $orderShop->getOrderStatus(); | |||
$orderShop = $this->orderUtils->changeOrderStatus($formOrderStatus->get('orderStatus')->getData(), $orderShop); | |||
if($oldStatus !== $orderShop->getOrderStatus()){ | |||
if ($oldStatus !== $orderShop->getOrderStatus()) { | |||
$this->utils->addFlash('success', 'success.order.changeStatus'); | |||
} | |||
} else { | |||
@@ -256,9 +258,9 @@ class OrderController extends AdminController | |||
//TODO si édition despayment existant on vérifie qu'il est lié à nla commabde courante | |||
$orderPaymentPost = $this->request->request->get('order_payment'); | |||
if($orderPaymentPost['id']){ | |||
if ($orderPaymentPost['id']) { | |||
$orderPayment = $this->em->getRepository(OrderPaymentInterface::class)->find($orderPaymentPost['id']); | |||
}else{ | |||
} else { | |||
$orderPaymentClass = $this->em->getClassMetadata(OrderPaymentInterface::class); | |||
$orderPayment = new $orderPaymentClass->name; | |||
} | |||
@@ -272,22 +274,22 @@ class OrderController extends AdminController | |||
if ($formOrderPayment->isSubmitted() && $formOrderPayment->isValid()) { | |||
$orderPayment->setOrderShop($orderShop); | |||
if($orderPayment->getMeanPayment() === Utils::MEAN_PAYMENT_CREDIT){ | |||
if ($orderPayment->getMeanPayment() === Utils::MEAN_PAYMENT_CREDIT) { | |||
$orderPayment->setEditable(false); | |||
$params['orderPayment'] = $orderPayment; | |||
$creditHistory = $this->creditUtils->initCreditHistory(CreditHistory::TYPE_DEBIT, $orderShop->getUser(), $params); | |||
if ($this->creditUtils->isCreditSufficientToPay($creditHistory->getUserMerchant(), $creditHistory->getAmountInherited())) { | |||
if($this->creditUtils->saveCreditHistory($creditHistory)) { | |||
if ($this->creditUtils->saveCreditHistory($creditHistory)) { | |||
$this->em->persist($orderPayment); | |||
$this->em->flush(); | |||
$this->utils->addFlash('success', 'success.credit.debited'); | |||
$this->utils->addFlash('success', 'success.order.addPayment'); | |||
} | |||
}else{ | |||
} else { | |||
$this->utils->addFlash('error', 'error.credit.notEnoughCredit'); | |||
} | |||
}else{ | |||
} else { | |||
$orderPayment->setEditable(true); | |||
$this->em->persist($orderPayment); | |||
$this->em->flush(); | |||
@@ -295,13 +297,34 @@ class OrderController extends AdminController | |||
} | |||
} else { | |||
$this->utils->addFlash('error', $formOrderPayment->getErrors()); | |||
} | |||
return $this->createOrderAjaxReponse($orderShop); | |||
} | |||
public function deleteOrderPaymentAction() | |||
{ | |||
$orderShop = $this->getOrderShopEntity(); | |||
$formDeleteOrderPayment = $this->createForm(DeleteOrderPaymentType::class); | |||
$formDeleteOrderPayment->handleRequest($this->request); | |||
if ($formDeleteOrderPayment->isSubmitted() && $formDeleteOrderPayment->isValid()) { | |||
$orderPayment = $this->em->getRepository(OrderPaymentInterface::class)->find($formDeleteOrderPayment->get('id')->getData()); | |||
if ($orderPayment && $orderShop->getOrderPayments()->contains($orderPayment) && $orderPayment->getEditable()) { | |||
$orderShop->removeOrderPayment($orderPayment); | |||
$this->em->remove($orderPayment); | |||
$this->em->flush(); | |||
$this->utils->addFlash('success', 'success.order.removeOrderPayement'); | |||
} | |||
} else { | |||
$this->utils->addFlash('error', $formDeleteOrderPayment->getErrors()); | |||
} | |||
return $this->createOrderAjaxReponse($orderShop); | |||
} | |||
public function addOrderReductionCartAction() | |||
{ | |||
$orderShop = $this->getOrderShopEntity(); | |||
@@ -357,7 +380,8 @@ class OrderController extends AdminController | |||
if ($formDeleteOrderReductionCart->isSubmitted() && $formDeleteOrderReductionCart->isValid()) { | |||
$orderReductionCart = $this->em->getRepository(OrderReductionCartInterface::class)->find($formDeleteOrderReductionCart->get('id')->getData()); | |||
if($orderReductionCart && $orderShop->getOrderReductionCarts()->contains($orderReductionCart)){ | |||
if ($orderReductionCart && $orderShop->getOrderReductionCarts()->contains($orderReductionCart)) { | |||
$orderShop->removeOrderReductionCart($orderReductionCart); | |||
$this->em->remove($orderReductionCart); | |||
$this->em->flush(); | |||
@@ -379,7 +403,7 @@ class OrderController extends AdminController | |||
if ($formDeleteOrderReductionCredit->isSubmitted() && $formDeleteOrderReductionCredit->isValid()) { | |||
$orderReductionCredit = $this->em->getRepository(OrderReductionCreditInterface::class)->find($formDeleteOrderReductionCredit->get('id')->getData()); | |||
if($formDeleteOrderReductionCredit && $orderShop->getOrderReductionCredits()->contains($orderReductionCredit)){ | |||
if ($formDeleteOrderReductionCredit && $orderShop->getOrderReductionCredits()->contains($orderReductionCredit)) { | |||
$orderShop->removeOrderReductionCredit($orderReductionCredit); | |||
$this->em->remove($orderReductionCredit); | |||
$this->em->flush(); | |||
@@ -401,7 +425,6 @@ class OrderController extends AdminController | |||
} | |||
public function renderOrderShopTemplate($actionName, $templatePath, array $parameters = []) | |||
{ | |||
@@ -409,7 +432,7 @@ class OrderController extends AdminController | |||
$orderShop = $this->getOrderShopEntity(); | |||
switch ($orderShop->getOrderStatus()->getAlias()){ | |||
switch ($orderShop->getOrderStatus()->getAlias()) { | |||
case OrderStatus::ALIAS_CART : | |||
if (!isset($parameters['form_order_delivery_address'])) { | |||
@@ -421,13 +444,13 @@ class OrderController extends AdminController | |||
$parameters['form_delete_order_reduction_credit'] = $this->createCustomForm(DeleteOrderReductionCreditType::class, 'deleteOrderReductionCredit', $parameters)->createView(); | |||
$parameters['form_add_product_to_order'] = $this->createCustomForm(AddPoductToOrderType::class, 'addProductToOrder', $parameters)->createView(); | |||
$parameters['form_order_products'] = $this->createCustomForm(OrderProductsType::class, 'orderProducts', $parameters)->createView(); | |||
$parameters['form_order_payment'] = $this->createCustomForm(OrderPaymentType::class, 'orderPayment', $parameters, false)->createView(); | |||
$parameters['form_order_status'] = $this->createCustomForm(OrderStatusType::class, 'orderStatus', $parameters)->createView(); | |||
$parameters['form_order_invoice_address'] = $this->createCustomForm(OrderInvoiceAddressType::class, 'orderInvoiceAddress', $parameters)->createView(); | |||
break; | |||
case OrderStatus::ALIAS_WAITING_PAYMENT_CREDIT : | |||
case OrderStatus::ALIAS_WAITING_PAYMENT_ONLINE : | |||
$parameters['form_order_payment'] = $this->createCustomForm(OrderPaymentType::class, 'orderPayment', $parameters, false)->createView(); | |||
$parameters['form_delete_order_payment'] = $this->createCustomForm(DeleteOrderPaymentType::class, 'deleteOrderPayment', $parameters)->createView(); | |||
$parameters['form_order_status'] = $this->createCustomForm(OrderStatusType::class, 'orderStatus', $parameters)->createView(); | |||
$parameters['form_order_invoice_address'] = $this->createCustomForm(OrderInvoiceAddressType::class, 'orderInvoiceAddress', $parameters)->createView(); | |||
break; | |||
@@ -465,17 +488,28 @@ class OrderController extends AdminController | |||
if (!$user instanceof UserInterface) return $user; | |||
else { | |||
$orderShop = $this->orderUtils->createOrderShop(array( | |||
'user' => $user, | |||
'merchant' => $this->merchantUtils->getMerchantUser() | |||
)); | |||
return $this->redirectToRoute('easyadmin', [ | |||
'action' => 'edit', | |||
'entity' => $this->entity['name'], | |||
'id' => $orderShop->getId() | |||
]); | |||
$orderShopUser = $this->em->getRepository(OrderShopInterface::class)->findCartCurrent(['user'=>$user]); | |||
if($orderShopUser){ | |||
$this->utils->addFlash('info', 'error.order.otherOrderAlreadyExist'); | |||
return $this->redirectToRoute('easyadmin', [ | |||
'action' => 'edit', | |||
'entity' => $this->entity['name'], | |||
'id' => $orderShopUser->getId() | |||
]); | |||
}else { | |||
$orderShop = $this->orderUtils->createOrderShop(array( | |||
'user' => $user, | |||
'merchant' => $this->merchantUtils->getMerchantUser() | |||
)); | |||
return $this->redirectToRoute('easyadmin', [ | |||
'action' => 'edit', | |||
'entity' => $this->entity['name'], | |||
'id' => $orderShop->getId() | |||
]); | |||
} | |||
} | |||
} | |||
@@ -0,0 +1,58 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Form\Backend\Order; | |||
use App\Entity\Product; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use Lc\ShopBundle\Context\OrderProductInterface; | |||
use Lc\ShopBundle\Context\OrderReductionCartInterface; | |||
use Lc\ShopBundle\Context\OrderShopInterface; | |||
use Lc\ShopBundle\Context\OrderUtilsInterface; | |||
use Lc\ShopBundle\Context\ProductInterface; | |||
use Lc\ShopBundle\Context\ReductionCartInterface; | |||
use Lc\ShopBundle\Context\ReductionCreditInterface; | |||
use Lc\ShopBundle\Form\DataTransformer\ProductToIdTransformer; | |||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||
use Symfony\Component\Form\AbstractType; | |||
use Symfony\Component\Form\Extension\Core\Type\ButtonType; | |||
use Symfony\Component\Form\Extension\Core\Type\HiddenType; | |||
use Symfony\Component\Form\Extension\Core\Type\NumberType; | |||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||
use Symfony\Component\Form\Extension\Core\Type\TextType; | |||
use Symfony\Component\Form\FormBuilderInterface; | |||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||
class AddRedeliveryOrderProductType extends AbstractType | |||
{ | |||
protected $em; | |||
protected $orderUtils; | |||
public function __construct(EntityManagerInterface $em, OrderUtilsInterface $orderUtils) | |||
{ | |||
$this->em = $em; | |||
$this->orderUtils = $orderUtils; | |||
} | |||
public function buildForm(FormBuilderInterface $builder, array $options) | |||
{ | |||
// TODO ce form n'a pas été testé !!!!! voir exemple sur PDL | |||
$builder->add('title', TextType::class); | |||
$builder->add('unit'); | |||
$builder->add('quantityProduct', NumberType::class); | |||
$builder->add('quantityOrder', NumberType::class); | |||
$builder->add('add', ButtonType::class, array( | |||
'label' => 'action.add' | |||
)); | |||
} | |||
public function configureOptions(OptionsResolver $resolver) | |||
{ | |||
$resolver->setDefaults([ | |||
'data_class' => $this->em->getClassMetadata(OrderProductInterface::class)->getName(), | |||
]); | |||
} | |||
} |
@@ -0,0 +1,56 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Form\Backend\Order; | |||
use App\Entity\Product; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use Lc\ShopBundle\Context\OrderProductInterface; | |||
use Lc\ShopBundle\Context\OrderReductionCartInterface; | |||
use Lc\ShopBundle\Context\OrderShopInterface; | |||
use Lc\ShopBundle\Context\OrderUtilsInterface; | |||
use Lc\ShopBundle\Context\ProductInterface; | |||
use Lc\ShopBundle\Context\ReductionCartInterface; | |||
use Lc\ShopBundle\Context\ReductionCreditInterface; | |||
use Lc\ShopBundle\Form\DataTransformer\ProductToIdTransformer; | |||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||
use Symfony\Component\Form\AbstractType; | |||
use Symfony\Component\Form\Extension\Core\Type\ButtonType; | |||
use Symfony\Component\Form\Extension\Core\Type\HiddenType; | |||
use Symfony\Component\Form\Extension\Core\Type\NumberType; | |||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||
use Symfony\Component\Form\FormBuilderInterface; | |||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||
class AddReductionCreditType extends AbstractType | |||
{ | |||
protected $em; | |||
protected $orderUtils; | |||
public function __construct(EntityManagerInterface $em, OrderUtilsInterface $orderUtils) | |||
{ | |||
$this->em = $em; | |||
$this->orderUtils = $orderUtils; | |||
} | |||
public function buildForm(FormBuilderInterface $builder, array $options) | |||
{ | |||
$entity = $options['data']; | |||
$reductionCreditClass = $this->em->getClassMetadata(ReductionCreditInterface::class); | |||
$reductionCreditRepo = $this->em->getRepository(ReductionCreditInterface::class);; | |||
$builder->add('add', ButtonType::class, array( | |||
'label' => 'action.add' | |||
)); | |||
} | |||
public function configureOptions(OptionsResolver $resolver) | |||
{ | |||
$resolver->setDefaults([ | |||
'data_class' => $this->em->getClassMetadata(ReductionCreditInterface::class)->getName(), | |||
]); | |||
} | |||
} |
@@ -0,0 +1,43 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Form\Backend\Order; | |||
use App\Entity\Product; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use Lc\ShopBundle\Context\OrderProductInterface; | |||
use Lc\ShopBundle\Context\OrderReductionCartInterface; | |||
use Lc\ShopBundle\Context\ProductInterface; | |||
use Lc\ShopBundle\Form\DataTransformer\ProductToIdTransformer; | |||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||
use Symfony\Component\Form\AbstractType; | |||
use Symfony\Component\Form\Extension\Core\Type\ButtonType; | |||
use Symfony\Component\Form\Extension\Core\Type\HiddenType; | |||
use Symfony\Component\Form\Extension\Core\Type\NumberType; | |||
use Symfony\Component\Form\FormBuilderInterface; | |||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||
class DeleteOrderPaymentType extends AbstractType | |||
{ | |||
protected $em ; | |||
public function __construct(EntityManagerInterface $em) | |||
{ | |||
$this->em = $em ; | |||
} | |||
public function buildForm(FormBuilderInterface $builder, array $options) | |||
{ | |||
$builder | |||
->add('id', HiddenType::class) | |||
->add('delete', ButtonType::class); | |||
/* ->add('id', HiddenType::class);*/ | |||
} | |||
public function configureOptions(OptionsResolver $resolver) | |||
{ | |||
/*$resolver->setDefaults([ | |||
'data_class' => $this->em->getClassMetadata(OrderReductionCartInterface::class)->getName(), | |||
]);*/ | |||
} | |||
} |
@@ -94,15 +94,6 @@ table th .select2-container--default .select2-selection--single{padding:0.3rem 0 | |||
.lc-offline-field label::after{content:' [hors ligne]'} | |||
input[type=number]::-webkit-inner-spin-button, | |||
input[type=number]::-webkit-outer-spin-button { | |||
-webkit-appearance: none; | |||
} | |||
input[type=number] { | |||
-moz-appearance: textfield; | |||
} | |||
/* Général */ | |||
.btn.btn-primary.action-save{float: right;} | |||
.button-action .btn{margin-left: 10px;} |
@@ -58,6 +58,11 @@ Vue.component('order-product', { | |||
deleteOrderProduct: function () { | |||
$(this.$refs.fieldQuantity).val(0); | |||
this.$parent.updateOrderProducts(); | |||
}, | |||
modalAddRedeliveryOrderProduct:function () { | |||
log(this.orderProduct.id); | |||
$(this.$parent.$refs['addRedeliveryOrderProductFormOrderProduct']).val(this.orderProduct.id); | |||
$('#modal-add-redelivery-order-product').modal('show'); | |||
} | |||
/*log($('#order-products-list').data('prototype')); | |||
var prototype = $('#order-products-list').data('prototype'); | |||
@@ -86,6 +91,12 @@ appOrder = new Vue({ | |||
templateTest: window.templateTest, | |||
orderProducts: [], | |||
order: [], | |||
orderPaymentFormMeanPayment: null, | |||
orderPaymentFormAmount: null, | |||
orderPaymentFormPaidAt:null, | |||
orderPaymentFormReference:null, | |||
orderPaymentFormComment:null, | |||
orderPaymentFormId: null, | |||
deliveryType: null, | |||
isLoading: true, | |||
addProductId: null, | |||
@@ -140,7 +151,7 @@ appOrder = new Vue({ | |||
addOrderPayment: function () { | |||
if($('#order_payment_meanPayment').val() == 'credit'){ | |||
if(window.confirm("Vous allez débitez le compte prépayé, êtes vous sur ?")){ | |||
if(window.confirm("Vous allez débitez le compte prépayév, êtes vous sur ?")){ | |||
this.postForm('#orderPaymentForm', '#modal-order-payment'); | |||
} | |||
}else{ | |||
@@ -150,17 +161,32 @@ appOrder = new Vue({ | |||
}, | |||
editOrderPayment:function(id){ | |||
var orderPayment = this.order.orderPayments[id]; | |||
$('#modal-order-payment').find('#order_payment_id').val(id); | |||
$('#modal-order-payment').find('#order_payment_meanPayment').val(orderPayment['meanPayment']); | |||
$('#modal-order-payment').find('#order_payment_meanPayment').trigger('change'); | |||
$('#modal-order-payment').find('#order_payment_amount').val(orderPayment['amount']); | |||
$('#modal-order-payment').find('#order_payment_paidAt').val(orderPayment['paidAt']); | |||
$('#modal-order-payment').find('#order_payment_reference').val(orderPayment['reference']); | |||
$('#modal-order-payment').find('#order_payment_comment').val(orderPayment['comment']); | |||
this.setOrderPaymentFormValues(this.order.orderPayments[id]) | |||
$('#modal-order-payment').modal("show") | |||
}, | |||
setOrderPaymentFormValues(orderPayment = false) { | |||
if (orderPayment)this.orderPaymentFormId = orderPayment['id']; | |||
else this.orderPaymentFormId = null; | |||
if (orderPayment) $(this.$refs["meanPaymentSelect"]).val(orderPayment['meanPayment']).trigger('change'); | |||
else $(this.$refs["meanPaymentSelect"]).val(false).trigger('change'); | |||
if (orderPayment) this.orderPaymentFormAmount = orderPayment['amount']; | |||
else this.orderPaymentFormAmount = null; | |||
if (orderPayment) this.orderPaymentFormPaidAt = orderPayment['paidAt']; | |||
else this.orderPaymentFormPaidAt = false; | |||
if (orderPayment) this.orderPaymentFormReference = orderPayment['reference']; | |||
else this.orderPaymentFormReference = null; | |||
if (orderPayment) this.orderPaymentFormComment = orderPayment['comment']; | |||
this.orderPaymentFormComment = null; | |||
}, | |||
modalDeleteOrderPayment:function(id){ | |||
$(this.$refs['deleteOrderPaymentId']).val(id); | |||
$('#modal-delete-order-payment').modal("show") | |||
}, | |||
deleteOrderPayment: function () { | |||
this.postForm('#deleteOrderPaymentForm', '#modal-delete-order-payment'); | |||
}, | |||
updateOrderProducts: function () { | |||
this.postForm('#orderProductsForm', false); | |||
}, | |||
@@ -176,15 +202,16 @@ appOrder = new Vue({ | |||
addOrderReductionCart: function () { | |||
this.postForm('#addOrderReductionCartForm', '#modal-add-reduction-cart'); | |||
}, | |||
modalOrderReductionCart: function (id) { | |||
$('#modal-delete-reduction-cart').find('#delete_order_reduction_cart_id').val(id); | |||
modalDeleteOrderReductionCart: function (id) { | |||
log($(this.$refs['deleteOrderReductionCartId'])); | |||
$(this.$refs['deleteOrderReductionCartId']).val(id); | |||
$('#modal-delete-reduction-cart').modal("show") | |||
}, | |||
deleteOrderReductionCart: function () { | |||
this.postForm('#deleteOrderReductionCartForm', '#modal-delete-reduction-cart'); | |||
}, | |||
modalOrderReductionCredit: function (id) { | |||
$('#modal-delete-reduction-credit').find('#delete_order_reduction_credit_id').val(id); | |||
modalDeleteOrderReductionCredit: function (id) { | |||
$(this.$refs['deleteOrderReductionCreditId']).val(id); | |||
$('#modal-delete-reduction-credit').modal("show") | |||
}, | |||
deleteOrderReductionCredit: function () { | |||
@@ -193,7 +220,9 @@ appOrder = new Vue({ | |||
addOrderReductionCredit: function () { | |||
this.postForm('#addOrderReductionCreditForm', '#modal-add-reduction-credit'); | |||
}, | |||
addRedeliveryOrderProduct: function () { | |||
this.postForm('#addRedeliveryOrderProductForm', '#modal-add-redelivery-order-product'); | |||
}, | |||
postForm: function (formId, modalId) { | |||
var app = this; | |||
if(checkFormValidity(formId)) { |
@@ -43,6 +43,7 @@ group: | |||
resume: Résumé de commande | |||
addProduct: Ajout de produit à la commande | |||
orderPayment: Ajouter un règlement | |||
orderStatus: Changer de status | |||
None: Aucune valeur | |||
label.form.empty_value: Choisissez une option | |||
form.label.delete: Supprimer l'image | |||
@@ -68,6 +69,7 @@ error: | |||
productUnavailable: Certains produits ne sont plus disponibles | |||
nextStatusNotAllow: La commande ne peut passer à ce statut | |||
noPayment: Le montant de la commande n'a pas été règlé dans sa totalité | |||
otherOrderAlreadyExist: Une autre commande existe déjà pour cet utilisateur, vous avez été redirigé. | |||
reductionCart: | |||
conditionsError: Cette réduction ne peut pas être appliqué sur cette commande | |||
date: La réduction n'est plus active |
@@ -57,7 +57,13 @@ | |||
{% if form_order_payment is defined %} | |||
{% include '@LcShop/backend/order/form/modal_orderpayment.html.twig' %} | |||
{% endif %} | |||
{% if form_delete_order_payment is defined %} | |||
{% include '@LcShop/backend/order/form/modal_deleteorderpayment.html.twig' %} | |||
{% endif %} | |||
{% if form_add_redelivery_order_product is defined %} | |||
{% include '@LcShop/backend/order/form/modal_addredeliveryorderproduct.html.twig' %} | |||
{% endif %} | |||
{# {{ macros.startCard(3, 'OrderShop.addProduct', 'success') }} | |||
{% include '@LcShop/backend/order/form/addproducttoorder.html.twig' %} |
@@ -0,0 +1,32 @@ | |||
<div class="modal fade show" id="modal-add-redelivery-order-product"> | |||
{{ form_start(form_add_redelivery_order_product, {'attr': { 'id' : 'addRedeliveryOrderProductForm'}}) }} | |||
{% form_theme form_add_redelivery_order_product '@LcShop/backend/form/custom_bootstrap_4.html.twig' %} | |||
<div class="modal-dialog modal-lg"> | |||
<div class="modal-content"> | |||
<div class="modal-header"> | |||
<h4>{{ "group.OrderShop.addRedeliveryOrderProduct"|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_redelivery_order_product.orderProduct, {'attr' :{'ref' : 'addRedeliveryOrderProductFormOrderProduct'}}) }} | |||
{{ form_row(form_add_redelivery_order_product.title) }} | |||
{{ form_row(form_add_redelivery_order_product.unit) }} | |||
{{ form_row(form_add_redelivery_order_product.quantityProduct) }} | |||
{{ form_row(form_add_redelivery_order_product.quantityOrder) }} | |||
</div> | |||
</div> | |||
<div class="modal-footer justify-content-between"> | |||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | |||
{{ form_row(form_add_redelivery_order_product.add, {"attr": {'class' : 'btn btn-primary', '@click' : 'addRedeliveryOrderProduct'}}) }} | |||
</div> | |||
</div> | |||
<!-- /.modal-content --> | |||
</div> | |||
{{ form_end(form_order_delivery_address) }} | |||
</div> |
@@ -0,0 +1,30 @@ | |||
{% trans_default_domain 'lcshop' %} | |||
<div class="modal fade show" id="modal-delete-order-payment"> | |||
{{ form_start(form_delete_order_payment, {'attr': { 'id' : 'deleteOrderPaymentForm'}}) }} | |||
{% form_theme form_delete_order_payment '@LcShop/backend/form/custom_bootstrap_4.html.twig' %} | |||
<div class="modal-dialog"> | |||
<div class="modal-content"> | |||
<div class="modal-header"> | |||
<h4>{{ "action.order.deleteOrderPayment"|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"> | |||
Est-vous sur de vouloir surppimer cette réduction | |||
{{ form_row(form_delete_order_payment.id, {'attr' : {"ref" : 'deleteOrderPaymentId'}}) }} | |||
</div> | |||
</div> | |||
<div class="modal-footer justify-content-between"> | |||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | |||
{{ form_row(form_delete_order_payment.delete, {"attr": {'class' : 'btn btn-primary', '@click': 'deleteOrderPayment'}}) }} | |||
</div> | |||
</div> | |||
<!-- /.modal-content --> | |||
</div>#} | |||
{{ form_end(form_delete_order_payment) }} | |||
</div> |
@@ -15,7 +15,7 @@ | |||
<div class="modal-body"> | |||
<div class="col"> | |||
Est-vous sur de vouloir surppimer cette réduction | |||
{{ form_row(form_delete_order_reduction_cart.id) }} | |||
{{ form_row(form_delete_order_reduction_cart.id, {'attr' : {"ref" : 'deleteOrderReductionCartId'}}) }} | |||
</div> | |||
</div> |
@@ -15,7 +15,7 @@ | |||
<div class="modal-body"> | |||
<div class="col"> | |||
Est-vous sur de vouloir surppimer cette réduction | |||
{{ form_row(form_delete_order_reduction_credit.id) }} | |||
{{ form_row(form_delete_order_reduction_credit.id, {'attr' : {"ref" : 'deleteOrderReductionCreditId'}}) }} | |||
</div> | |||
</div> |
@@ -12,11 +12,12 @@ | |||
</button> | |||
</div> | |||
<div class="modal-body"> | |||
{{ form_row(form_order_payment.meanPayment) }} | |||
{{ form_row(form_order_payment.amount) }} | |||
{{ form_row(form_order_payment.paidAt) }} | |||
{{ form_row(form_order_payment.reference) }} | |||
{{ form_row(form_order_payment.comment) }} | |||
{{ form_row(form_order_payment.meanPayment, {'attr' : {'v-model' : 'orderPaymentFormMeanPayment', 'ref' : 'meanPaymentSelect'}}) }} | |||
{{ form_row(form_order_payment.amount, {'attr' : {'v-model' : 'orderPaymentFormAmount'}}) }} | |||
{{ form_row(form_order_payment.paidAt, {'attr' : {'v-model' : 'orderPaymentFormPaidAt'}}) }} | |||
{{ form_row(form_order_payment.reference, {'attr' : {'v-model' : 'orderPaymentFormReference'}}) }} | |||
{{ form_row(form_order_payment.comment, {'attr' : {'v-model' : 'orderPaymentFormComment'}}) }} | |||
{{ form_row(form_order_payment.id, {'attr' : {'v-model' : 'orderPaymentFormId'}}) }} | |||
</div> | |||
<div class="modal-footer justify-content-between"> | |||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
@@ -7,7 +7,7 @@ | |||
<div class="modal-content"> | |||
<div class="modal-header"> | |||
<h4>{{ "form.group.OrderShop.orderStatus"|trans }}</h4> | |||
<h4>{{ "group.OrderShop.orderStatus"|trans }}</h4> | |||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | |||
<span aria-hidden="true">×</span> | |||
</button> |
@@ -70,6 +70,9 @@ | |||
{% endif %} | |||
</td> | |||
<td> | |||
<button type="button" class="btn-remove-product btn btn-default" @click="modalAddRedeliveryOrderProduct"> | |||
NICHE | |||
</button> | |||
{% verbatim %}{{orderProduct.totalWithTaxAndReduction}}{% endverbatim %}€ | |||
</td> | |||
</tr> | |||
@@ -111,16 +114,32 @@ | |||
<td>${orderPayment.paidAtText}</td> | |||
<td>${orderPayment.amount}</td> | |||
<td> | |||
<button v-show="orderPayment.editable" class="btn-sm btn-info" type="button" @click="editOrderPayment(orderPayment.id)"> | |||
<button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')" class="btn-sm btn-info" type="button" @click="editOrderPayment(orderPayment.id)"> | |||
<i class="fa fa-pen"></i> | |||
</button> | |||
<button v-show="orderPayment.editable && editionMode && modalExist('#modal-delete-order-payment')" | |||
type="button" class="btn-sm btn-danger" | |||
@click="modalDeleteOrderPayment(orderPayment.id)"> | |||
<i class="fa fa-trash"></i> | |||
</button> | |||
</td> | |||
</tr> | |||
</template> | |||
</tbody> | |||
</table> | |||
{{ _self.order_modal_button('#modal-order-payment', 'btn-info', "action.order.addOrderPayment") }} | |||
<span class="float-right">Total : ${order.orderPaid}</span> | |||
</div> | |||
<div class="col-8"> | |||
<div v-show="order.isOrderPaid" class="alert alert-success alert-dismissible"> | |||
<h5><i class="icon fas fa-check"></i> Commande soldé</h5> | |||
</div> | |||
<div v-show="order.isOrderPaid==false" class="alert alert-danger alert-dismissible"> | |||
<h5><i class="icon fas fa-check"></i> Commande non soldé</h5> | |||
</div> | |||
</div> | |||
<div class="col-4"> | |||
<span class="float-right">Total : ${order.totalOrderPaid}</span> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -139,7 +158,7 @@ | |||
${orderReductionCart.title} | |||
<button v-show="editionMode && modalExist('#modal-delete-reduction-cart')" type="button" | |||
class="btn-sm btn-danger" | |||
@click="modalOrderReductionCart(orderReductionCart.id)"> | |||
@click="modalDeleteOrderReductionCart(orderReductionCart.id)"> | |||
<i class="fa fa-trash"></i> | |||
</button> | |||
</th> | |||
@@ -152,7 +171,7 @@ | |||
<button v-show="editionMode && modalExist('#modal-delete-reduction-credit')" | |||
type="button" class="btn-sm btn-danger" | |||
@click="modalOrderReductionCredit(orderReductionCredit.id)"> | |||
@click="modalDeleteOrderReductionCredit(orderReductionCredit.id)"> | |||
<i class="fa fa-trash"></i> | |||
</button> | |||
</th> |
@@ -112,6 +112,8 @@ class OrderUtils | |||
public function createOrderShop($params) | |||
{ | |||
//TODO vérifier que l'utilisateur n'a pas déjà une commande en cours | |||
$orderShop = new OrderShop(); | |||
$orderShopBelongTo = false; | |||
@@ -427,6 +429,8 @@ class OrderUtils | |||
public function deductAvailabilityProduct(\Lc\ShopBundle\Model\OrderShop $orderShop) | |||
{ | |||
//TODO ne pas déduire des stocks les orderProduct marqué en relivraison | |||
foreach ($orderShop->getOrderProducts() as $orderProduct) { | |||
switch ($orderProduct->getProduct()->getProductFamily()->getBehaviorCountStock()) { | |||
case ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE : |