$queryBuilder->leftJoin('entity.orderStatus', 'orderStatus'); | $queryBuilder->leftJoin('entity.orderStatus', 'orderStatus'); | ||||
dump($filterOrderStatus); | |||||
if ($filterOrderStatus) { | if ($filterOrderStatus) { | ||||
$queryBuilder->andWhere('orderStatus.alias IN (:status)'); | $queryBuilder->andWhere('orderStatus.alias IN (:status)'); | ||||
$queryBuilder->setParameter('status', $filterOrderStatus); | $queryBuilder->setParameter('status', $filterOrderStatus); | ||||
} else if ($formAddProductToOrder->isSubmitted() && $formAddProductToOrder->isValid()) { | } else if ($formAddProductToOrder->isSubmitted() && $formAddProductToOrder->isValid()) { | ||||
$orderProduct = new $orderProductClass->name; | $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->setQuantityOrder($formAddProductToOrder->get('quantity')->getData()); | ||||
$orderProduct->setProduct($formAddProductToOrder->get('product')->getData()); | $orderProduct->setProduct($formAddProductToOrder->get('product')->getData()); | ||||
$response['status'] = 'success'; | $response['status'] = 'success'; | ||||
$response['message'] = 'Le produit a bien été ajouté à la commande'; | $response['message'] = 'Le produit a bien été ajouté à la commande'; | ||||
}else{ | |||||
} else { | |||||
$response['status'] = 'error'; | $response['status'] = 'error'; | ||||
$response['message'] = 'Le produit n\'est pas disponible dans cette quantité'; | $response['message'] = 'Le produit n\'est pas disponible dans cette quantité'; | ||||
} | } | ||||
return new Response(json_encode($response)); | 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() | public function orderInvoiceAddressAction() | ||||
{ | { | ||||
} | } | ||||
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() | public function orderPaymentAction() | ||||
{ | { | ||||
if ($formOrderReductionCart->isSubmitted() && $formOrderReductionCart->isValid()) { | if ($formOrderReductionCart->isSubmitted() && $formOrderReductionCart->isValid()) { | ||||
$reductionCart = $formOrderReductionCart->get('reductionCart')->getData(); | $reductionCart = $formOrderReductionCart->get('reductionCart')->getData(); | ||||
$orderShop->reductionError = array(); | $orderShop->reductionError = array(); | ||||
if ($this->orderUtils->isReductionCartAllowToBeAddToOrder($orderShop, $reductionCart)) { | |||||
if ($this->orderUtils->isReductionCartAllowAddToOrder($orderShop, $reductionCart)) { | |||||
$orderReductionCart = $this->orderUtils->createOrderReductionCart($orderShop, $reductionCart); | $orderReductionCart = $this->orderUtils->createOrderReductionCart($orderShop, $reductionCart); | ||||
$this->em->persist($orderReductionCart); | $this->em->persist($orderReductionCart); | ||||
$this->em->flush(); | $this->em->flush(); | ||||
} | } | ||||
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') { | 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'])) { | 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); | 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() | protected function newAction() | ||||
{ | { | ||||
$this->dispatch(EasyAdminEvents::PRE_NEW); | $this->dispatch(EasyAdminEvents::PRE_NEW); | ||||
$id = $this->request->query->get('id'); | $id = $this->request->query->get('id'); | ||||
$easyadmin = $this->request->attributes->get('easyadmin'); | $easyadmin = $this->request->attributes->get('easyadmin'); | ||||
$entity = $easyadmin['item']; | $entity = $easyadmin['item']; | ||||
$easyadmin['entity']['name'] = 'OrderShop'; | |||||
$fields = $this->entity['show']['fields']; | $fields = $this->entity['show']['fields']; | ||||
$deleteForm = $this->createDeleteForm($this->entity['name'], $id); | $deleteForm = $this->createDeleteForm($this->entity['name'], $id); | ||||
'order' => $this->orderUtils->getOrderAsJsonObject($entity) | '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]); | |||||
} | } | ||||
/** | /** |
* @ORM\JoinColumn(nullable=true) | * @ORM\JoinColumn(nullable=true) | ||||
*/ | */ | ||||
protected $updatedBy; | protected $updatedBy; | ||||
public function __toString() | |||||
{ | |||||
return $this->getOrderStatus()->getAlias(). ' le : '.$this->getCreatedAt()->format('d-m-Y H:i').'('.$this->getOrigin().')'; | |||||
} | |||||
public function getOrderShop(): ?OrderShop | public function getOrderShop(): ?OrderShop | ||||
{ | { |
$this->orders = new ArrayCollection(); | $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 | public function getCookie(): ?string | ||||
{ | { | ||||
return $this->cookie; | return $this->cookie; |
$query = $this->findByMerchantQuery(); | $query = $this->findByMerchantQuery(); | ||||
$query = $this->filterOrderValid($query); | $query = $this->filterOrderValid($query); | ||||
$query->select('count(e.id)'); | $query->select('count(e.id)'); | ||||
$query->join('e.orderReductionCart', 'orc'); | |||||
$query->join('e.orderReductionCarts', 'orc'); | |||||
$query->andWhere('orc.reductionCart = :reductionCart'); | $query->andWhere('orc.reductionCart = :reductionCart'); | ||||
$query->setParameter('reductionCart', $reductionCart); | $query->setParameter('reductionCart', $reductionCart); | ||||
return $query->getQuery()->getSingleScalarResult(); | return $query->getQuery()->getSingleScalarResult(); | ||||
$query = $this->filterOrderValid($query); | $query = $this->filterOrderValid($query); | ||||
$query->select('count(e.id)'); | $query->select('count(e.id)'); | ||||
$query->andWhere('e.user = :user'); | $query->andWhere('e.user = :user'); | ||||
$query->join('e.orderReductionCart', 'orc'); | |||||
$query->join('e.orderReductionCarts', 'orc'); | |||||
$query->andWhere('orc.reductionCart = :reductionCart'); | $query->andWhere('orc.reductionCart = :reductionCart'); | ||||
$query->setParameter('reductionCart', $reductionCart); | $query->setParameter('reductionCart', $reductionCart); | ||||
$query->setParameter('user', $user); | $query->setParameter('user', $user); |
})/*, window.appOrderProductFamilyValues)*/; | })/*, window.appOrderProductFamilyValues)*/; | ||||
}, | }, | ||||
mounted: function () { | mounted: function () { | ||||
log('ncnnc'); | |||||
log(window.templateTest); | |||||
this.updateOrder(window.orderObject); | this.updateOrder(window.orderObject); | ||||
//log($(this.$el).find('#orderProductsForm').replace(/__name__/g, 0)); | //log($(this.$el).find('#orderProductsForm').replace(/__name__/g, 0)); | ||||
}, | }, | ||||
this.postForm('#orderInvoiceAddressForm', '#modal-order-invoice-address'); | this.postForm('#orderInvoiceAddressForm', '#modal-order-invoice-address'); | ||||
}, | }, | ||||
updateOrderDeliveryAddress: function () { | updateOrderDeliveryAddress: function () { | ||||
this.postForm('#orderDeliveryAddressForm', '#modal-order-invoice-address'); | |||||
this.postForm('#orderDeliveryAddressForm', '#modal-order-delivery-address'); | |||||
}, | }, | ||||
updateOrderDeliveryAvailability: function () { | updateOrderDeliveryAvailability: function () { | ||||
this.postForm('#orderDeliveryAvailabilityForm', '#modal-order-delivery-availability'); | this.postForm('#orderDeliveryAvailabilityForm', '#modal-order-delivery-availability'); |
price: Prix | price: Prix | ||||
priceWithTax: Prix de vente TTC | priceWithTax: Prix de vente TTC | ||||
username: Nom d'utilisateur | username: Nom d'utilisateur | ||||
user: Utilisateur | |||||
email: E-mail | email: E-mail | ||||
plainPassword: Mot de passe | plainPassword: Mot de passe | ||||
roles: Rôle attribué | roles: Rôle attribué | ||||
behaviorTaxRateHelp: Appliquer la réduction sur le prix HT ou le prix TTC | behaviorTaxRateHelp: Appliquer la réduction sur le prix HT ou le prix TTC | ||||
deliveryAddress: Addresse de livraison | deliveryAddress: Addresse de livraison | ||||
invoiceAddress: Addresse de facturation | invoiceAddress: Addresse de facturation | ||||
deliveryTypeOptions: | |||||
point-sale: En ambassade | |||||
home: À domicile | |||||
PointSale: | PointSale: | ||||
code: Code | code: Code | ||||
codeHelp: Code utilisé pour retrouver l'ambassade dans le tunnel de commande (Non sensible à la casse) | codeHelp: Code utilisé pour retrouver l'ambassade dans le tunnel de commande (Non sensible à la casse) | ||||
orderNumber: Numéro de commande | orderNumber: Numéro de commande | ||||
quantity: Quantité | quantity: Quantité | ||||
addOrderToProduct: Ajouter le produit | addOrderToProduct: Ajouter le produit | ||||
total: Total | |||||
status: Statut | |||||
action: | action: | ||||
new: Créer %entity_label% | new: Créer %entity_label% | ||||
user: | user: | ||||
account: Mon compte | account: Mon compte | ||||
logout: Me déconnecter | logout: Me déconnecter | ||||
order: | |||||
addOrderProduct: Ajouter un produit | |||||
addReductionCart: Ajouter une réduction | |||||
addReductionCredit: Ajouter un avoir | |||||
resetting: | resetting: | ||||
check_email: | | check_email: | |
{% endmacro endCard %} | {% endmacro endCard %} | ||||
{% macro productField(colspan, field, fieldName, fieldDisplay = false, displaySuffix="",attr="") %} | {% macro productField(colspan, field, fieldName, fieldDisplay = false, displaySuffix="",attr="") %} | ||||
{% if fieldDisplay == false %}{% set fieldDisplay = fieldName %}{% endif %} | {% if fieldDisplay == false %}{% set fieldDisplay = fieldName %}{% endif %} |
{{ priceUtils.getTotalWithTaxAndReductions(item) }} | |||||
{{ priceUtils.getTotalWithTax(item) }} |
{{ 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) }} | |||||
{% 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 %} |
<div class="row"> | <div class="row"> | ||||
{% include '@LcShop/backend/order/form.html.twig' %} | |||||
{% include '@LcShop/backend/order/card_orderproducts.html.twig' %} | |||||
{{ macros.startCard(3, 'OrderShop.addProduct', 'success') }} | {{ macros.startCard(3, 'OrderShop.addProduct', 'success') }} | ||||
{% include '@LcShop/backend/order/card_addproducttoorder.html.twig' %} | {% include '@LcShop/backend/order/card_addproducttoorder.html.twig' %} | ||||
{{ macros.endCard }} | |||||
{% include '@LcShop/backend/order/modal_invoiceaddress.html.twig' %} | {% include '@LcShop/backend/order/modal_invoiceaddress.html.twig' %} | ||||
{% include '@LcShop/backend/order/modal_deliveryaddress.html.twig' %} | {% include '@LcShop/backend/order/modal_deliveryaddress.html.twig' %} | ||||
{% include '@LcShop/backend/order/modal_deliveryavailability.html.twig' %} | {% include '@LcShop/backend/order/modal_deliveryavailability.html.twig' %} | ||||
{% include '@LcShop/backend/order/modal_orderstatus.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' %} | {% include '@LcShop/backend/order/modal_orderpayment.html.twig' %} | ||||
{{ macros.endCard }} | |||||
</div> | </div> | ||||
</div> | </div> | ||||
{% endblock %} | {% endblock %} |
{#{{ 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) }} | |||||
#} | |||||
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %} | {% import '@LcShop/backend/default/block/macros.html.twig' as macros %} | ||||
{% import '@LcShop/backend/order/macros.html.twig' as orderMacros %} | {% import '@LcShop/backend/order/macros.html.twig' as orderMacros %} | ||||
{% trans_default_domain 'lcshop' %} | {% 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> | <h6><strong>{{ "field.OrderShop.mainInfo"|trans({}, 'lcshop') }} : </strong></h6> | ||||
<p> | <p> | ||||
<strong>{{ "field.OrderShop.status"|trans }} </strong><br /> | <strong>{{ "field.OrderShop.status"|trans }} </strong><br /> | ||||
<strong>{{ "field.OrderShop.orderNumber"|trans }} </strong><br /> | <strong>{{ "field.OrderShop.orderNumber"|trans }} </strong><br /> | ||||
<span>${order.id}</span> | <span>${order.id}</span> | ||||
</p> | </p> | ||||
</div> | |||||
<div class="col-4" > | |||||
</div>#} | |||||
{#<div class="col-4" > | |||||
<div v-if="order.deliveryType == 'home'"> | <div v-if="order.deliveryType == 'home'"> | ||||
<h6><strong>{{ "field.default.deliveryAddress"|trans({}, 'lcshop') }} : </strong></h6> | <h6><strong>{{ "field.default.deliveryAddress"|trans({}, 'lcshop') }} : </strong></h6> | ||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-delivery-address"> | <button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-delivery-address"> | ||||
{{ "action.edit"|trans }} | {{ "action.edit"|trans }} | ||||
</button> | </button> | ||||
</div> | |||||
<div class="col-4"> | |||||
</div>#} | |||||
{#<div class="col-4"> | |||||
<h6><strong>{{ "field.default.invoiceAddress"|trans({}, 'lcshop') }}</strong></h6> | <h6><strong>{{ "field.default.invoiceAddress"|trans({}, 'lcshop') }}</strong></h6> | ||||
<address v-html="order.invoiceAddress"> | <address v-html="order.invoiceAddress"> | ||||
</address> | </address> | ||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-invoice-address"> | <button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-invoice-address"> | ||||
{{ "action.edit"|trans }} | {{ "action.edit"|trans }} | ||||
</button> | </button> | ||||
</div> | |||||
<div class="col-12"> | |||||
</div>#} | |||||
{#<div class="col-12"> | |||||
<h6><strong>{{ "field.default.deliveryAvailabilty"|trans({}, 'lcshop') }} : </strong></h6> | <h6><strong>{{ "field.default.deliveryAvailabilty"|trans({}, 'lcshop') }} : </strong></h6> | ||||
<div v-if="order.deliveryType == 'home'"> | <div v-if="order.deliveryType == 'home'"> | ||||
<div v-html="order.deliveryAvailabilityZone"> | <div v-html="order.deliveryAvailabilityZone"> | ||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-delivery-availability"> | <button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-delivery-availability"> | ||||
{{ "action.edit"|trans }} | {{ "action.edit"|trans }} | ||||
</button> | </button> | ||||
</div> | |||||
</div>#} | |||||
<div class="col-12"> | <div class="col-12"> | ||||
{{ form_start(form_order_products, {'attr': {'id' : 'orderProductsForm'}}) }} | {{ form_start(form_order_products, {'attr': {'id' : 'orderProductsForm'}}) }} | ||||
window.templateTest = '{{ orderMacros.productsTemplate(form_order_products)|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}'; | window.templateTest = '{{ orderMacros.productsTemplate(form_order_products)|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}'; | ||||
</script> | </script> | ||||
{{ orderMacros.tableHead() }} | {{ orderMacros.tableHead() }} | ||||
{{ orderMacros.products(form_order_products) }} | {{ orderMacros.products(form_order_products) }} | ||||
{{ orderMacros.tableTotal() }} | {{ orderMacros.tableTotal() }} | ||||
{% do form_order_products.orderProducts.setRendered %} | |||||
{{ form_end(form_order_products) }} | {{ form_end(form_order_products) }} | ||||
<div class="clearfix"></div> | <div class="clearfix"></div> | ||||
<script> | <script> | ||||
window.orderObject = {{ order|json_encode|raw }}; | window.orderObject = {{ order|json_encode|raw }}; | ||||
</script> | </script> | ||||
<h6><strong>Réductions</strong></h6> | |||||
</div> | |||||
{# <h6><strong>Réductions</strong></h6> | |||||
${order.orderReductionCart} | ${order.orderReductionCart} | ||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-reduction-cart"> | <button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-reduction-cart"> | ||||
{{ "action.addReductionCart"|trans }} | {{ "action.addReductionCart"|trans }} | ||||
<br /> | <br /> | ||||
<h6><strong>Historiques des paiments</strong></h6> | <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} | ${order.orderPaid} | ||||
<ul v-for="(orderPayment, i) in order.orderPayments"> | <ul v-for="(orderPayment, i) in order.orderPayments"> | ||||
<li>${orderPayment}</li> | <li>${orderPayment}</li> | ||||
</ul> | </ul> | ||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-payment"> | <button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-order-payment"> | ||||
{{ "action.addOrderPayment"|trans }} | {{ "action.addOrderPayment"|trans }} | ||||
</button> | |||||
</div> | |||||
</button>#} | |||||
{{ macros.cardOverlay('isLoading') }} | |||||
{{ macros.endCard(9) }} |
{% 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> |
<div class="col"> | <div class="col"> | ||||
{{ form_row(form_order_delivery_address.deliveryPointSale) }} | {{ form_row(form_order_delivery_address.deliveryPointSale) }} | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="modal-footer justify-content-between"> | <div class="modal-footer justify-content-between"> | ||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
<div class="modal fade show" id="modal-order-invoice-address"> | <div class="modal fade show" id="modal-order-invoice-address"> | ||||
{{ form_start(form_order_invoice_address, {'attr': { 'id' : 'orderInvoiceAddressForm'}}) }}) }} | {{ form_start(form_order_invoice_address, {'attr': { 'id' : 'orderInvoiceAddressForm'}}) }}) }} | ||||
{% form_theme form_order_invoice_address '@LcShop/backend/form/custom_bootstrap_4.html.twig' %} | {% form_theme form_order_invoice_address '@LcShop/backend/form/custom_bootstrap_4.html.twig' %} |
<div class="modal-content"> | <div class="modal-content"> | ||||
<div class="modal-header"> | <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"> | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||||
<span aria-hidden="true">×</span> | <span aria-hidden="true">×</span> | ||||
</button> | </button> |
{% trans_default_domain 'lcshop' %} | {% trans_default_domain 'lcshop' %} | ||||
<div class="modal fade show" id="modal-reduction-credit"> | <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' %} | {% form_theme form_order_reduction_credit '@LcShop/backend/form/custom_bootstrap_4.html.twig' %} | ||||
<div class="modal-dialog"> | <div class="modal-dialog"> | ||||
<div class="modal-content"> | <div class="modal-content"> | ||||
<div class="modal-header"> | <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"> | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||||
<span aria-hidden="true">×</span> | <span aria-hidden="true">×</span> | ||||
</button> | </button> |
{% trans_default_domain 'lcshop' %} | |||||
{% macro tableHead() %} | {% macro tableHead() %} | ||||
<table id="order-products-list" class="table table-striped"> | <table id="order-products-list" class="table table-striped"> | ||||
<thead> | <thead> | ||||
</th> | </th> | ||||
</tr> | </tr> | ||||
</thead> | </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> | </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 %} | {% 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> | </div> | ||||
</div> | |||||
{% endmacro %} | |||||
{% endmacro addressInfo %} |
<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> |
<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> |
{# | |||||
<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> | |||||
{##} |
{{ macros.productField(2, product.price, 'price', false, '€', 'v-show="productFamily.behaviorPrice == \'by-piece\'"') }} | {{ 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(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\'"') }} | {{ macros.productField(2, product.propertyExpirationDate, 'propertyExpirationDate','propertyExpirationDateValue', '', 'v-show="productFamily.behaviorExpirationDate== \'by-product\'"') }} | ||||
{ | { | ||||
$quanityAsked = $quanityOrder; | $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; | |||||
} | } | ||||
} | } |
public function getOrderProductsReductionCartAmountWithoutTax(OrderShopInterface $order, $orderReductionCart) | public function getOrderProductsReductionCartAmountWithoutTax(OrderShopInterface $order, $orderReductionCart) | ||||
{ | { | ||||
$amount =0; | |||||
if($orderReductionCart->getAppliedTo() === ReductionCart::APPLIED_TO_ORDER_PRODUCTS) { | if($orderReductionCart->getAppliedTo() === ReductionCart::APPLIED_TO_ORDER_PRODUCTS) { | ||||
if ($orderReductionCart->getUnit() == 'percent') { | if ($orderReductionCart->getUnit() == 'percent') { | ||||
$price = $this->amountReductionByPercentValue( | |||||
$amount = $this->amountReductionByPercentValue( | |||||
$this->getTotalOrderProducts($order), | $this->getTotalOrderProducts($order), | ||||
$orderReductionCart->getValue() | $orderReductionCart->getValue() | ||||
); | ); | ||||
} | } | ||||
} | } | ||||
return $amount ; | |||||
} | } | ||||
public function getOrderProductsReductionCartAmountWithTax(OrderShopInterface $order, $orderReductionCart) | public function getOrderProductsReductionCartAmountWithTax(OrderShopInterface $order, $orderReductionCart) | ||||
{ | { | ||||
$amount =0; | |||||
if($orderReductionCart->getAppliedTo() === ReductionCart::APPLIED_TO_ORDER_PRODUCTS) { | if($orderReductionCart->getAppliedTo() === ReductionCart::APPLIED_TO_ORDER_PRODUCTS) { | ||||
if ($orderReductionCart->getUnit() == 'percent') { | if ($orderReductionCart->getUnit() == 'percent') { | ||||
$price = $this->amountReductionByPercentValue( | |||||
$amount = $this->amountReductionByPercentValue( | |||||
$this->getTotalOrderProductsWithTax($order), | $this->getTotalOrderProductsWithTax($order), | ||||
$orderReductionCart->getValue() | $orderReductionCart->getValue() | ||||
); | ); | ||||
} else if ($orderReductionCart->getUnit() == 'amount') { | } else if ($orderReductionCart->getUnit() == 'amount') { | ||||
if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') { | if ($orderReductionCart->getBehaviorTaxRate() == 'tax-excluded') { | ||||
$price = $orderReductionCart->getValue() * $this->getTaxRateAverage(); | |||||
$amount = $orderReductionCart->getValue() * $this->getTaxRateAverage(); | |||||
} else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') { | } else if ($orderReductionCart->getBehaviorTaxRate() == 'tax-included') { | ||||
$price = $orderReductionCart->getValue() ; | |||||
$amount = $orderReductionCart->getValue() ; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
return $amount ; | |||||
} | } | ||||
public function getOrderProductsReductionCreditAmountWithoutTax(OrderShopInterface $order, OrderReductionCreditInterface $orderReductionCredit) | public function getOrderProductsReductionCreditAmountWithoutTax(OrderShopInterface $order, OrderReductionCreditInterface $orderReductionCredit) | ||||
{ | { | ||||
$amount =0; | |||||
if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') { | if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') { | ||||
$amount = $orderReductionCredit->getValue(); | $amount = $orderReductionCredit->getValue(); | ||||
} else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') { | } else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') { | ||||
public function getOrderProductsReductionCreditAmountWithTax(OrderShopInterface $order, OrderReductionCreditInterface $orderReductionCredit) | public function getOrderProductsReductionCreditAmountWithTax(OrderShopInterface $order, OrderReductionCreditInterface $orderReductionCredit) | ||||
{ | { | ||||
$amount =0; | |||||
if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') { | if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-excluded') { | ||||
$amountWithTax = $orderReductionCredit->getValue() * $this->getTaxRateAverage(); | $amountWithTax = $orderReductionCredit->getValue() * $this->getTaxRateAverage(); | ||||
} else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') { | } else if ($orderReductionCredit->getBehaviorTaxRate() == 'tax-included') { |