Quellcode durchsuchen

Merge branch 'develop' of https://gitea.laclic.fr/Laclic/LcShopBundle into develop

feature/export_comptable
Guillaume vor 4 Jahren
Ursprung
Commit
3eb816361d
23 geänderte Dateien mit 427 neuen und 164 gelöschten Zeilen
  1. +1
    -1
      ShopBundle/Controller/Backend/AdminController.php
  2. +1
    -1
      ShopBundle/Controller/Backend/MerchantController.php
  3. +1
    -1
      ShopBundle/Controller/Backend/NewsController.php
  4. +50
    -40
      ShopBundle/Controller/Backend/OrderController.php
  5. +1
    -1
      ShopBundle/Controller/Backend/ProductFamilyController.php
  6. +1
    -1
      ShopBundle/Controller/Backend/UserController.php
  7. +53
    -0
      ShopBundle/Form/Order/OrderDeliveryAddressType.php
  8. +57
    -0
      ShopBundle/Form/Order/OrderInvoiceAddressType.php
  9. +33
    -1
      ShopBundle/Model/Address.php
  10. +6
    -0
      ShopBundle/Model/User.php
  11. +1
    -1
      ShopBundle/Resources/config/shop_routes.yaml
  12. +2
    -0
      ShopBundle/Resources/public/css/backend/custom.css
  13. +1
    -0
      ShopBundle/Resources/public/js/backend/script/default/init-common.js
  14. +61
    -61
      ShopBundle/Resources/public/js/backend/script/order/vuejs-order.js
  15. +7
    -0
      ShopBundle/Resources/translations/lcshop.fr.yaml
  16. +58
    -1
      ShopBundle/Resources/views/backend/order/card_orderproducts.html.twig
  17. +4
    -0
      ShopBundle/Resources/views/backend/order/edit.html.twig
  18. +28
    -0
      ShopBundle/Resources/views/backend/order/modal_deliveryaddress.html.twig
  19. +33
    -0
      ShopBundle/Resources/views/backend/order/modal_deliveryavailability.html.twig
  20. +25
    -0
      ShopBundle/Resources/views/backend/order/modal_invoiceaddress.html.twig
  21. +0
    -13
      ShopBundle/Resources/views/backend/order/panel_addresses.html.twig
  22. +0
    -41
      ShopBundle/Services/AddressUtils.php
  23. +3
    -1
      ShopBundle/Services/OrderUtils.php

ShopBundle/Controller/Admin/AdminController.php → ShopBundle/Controller/Backend/AdminController.php Datei anzeigen

@@ -1,6 +1,6 @@
<?php

namespace Lc\ShopBundle\Controller\Admin;
namespace Lc\ShopBundle\Controller\Backend;

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;

ShopBundle/Controller/Admin/MerchantController.php → ShopBundle/Controller/Backend/MerchantController.php Datei anzeigen

@@ -1,6 +1,6 @@
<?php

namespace Lc\ShopBundle\Controller\Admin;
namespace Lc\ShopBundle\Controller\Backend;

use Lc\ShopBundle\Context\MerchantConfigInterface;
use Lc\ShopBundle\Context\MerchantInterface;

ShopBundle/Controller/Admin/NewsController.php → ShopBundle/Controller/Backend/NewsController.php Datei anzeigen

@@ -1,6 +1,6 @@
<?php

namespace Lc\ShopBundle\Controller\Admin;
namespace Lc\ShopBundle\Controller\Backend;

use App\Repository\UserRepository;
use Lc\ShopBundle\Context\NewsInterface;

ShopBundle/Controller/Admin/OrderController.php → ShopBundle/Controller/Backend/OrderController.php Datei anzeigen

@@ -1,26 +1,21 @@
<?php

namespace Lc\ShopBundle\Controller\Admin;
namespace Lc\ShopBundle\Controller\Backend;

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
use FOS\UserBundle\Model\UserManagerInterface;
use Lc\ShopBundle\Context\AddressInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\OrderProductInterface;
use Lc\ShopBundle\Context\OrderUtilsInterface;
use Lc\ShopBundle\Context\UserInterface;
use Lc\ShopBundle\Form\Order\AddPoductToOrderType;
use Lc\ShopBundle\Form\Order\OrderAddressType;
use Lc\ShopBundle\Form\Order\OrderDeliveryAddressType;
use Lc\ShopBundle\Form\Order\OrderInvoiceAddressType;
use Lc\ShopBundle\Form\Order\OrderProductsType;
use Lc\ShopBundle\Form\OrderProductType;
use Lc\ShopBundle\Services\Utils;
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Security;


class OrderController extends AdminController
@@ -78,34 +73,6 @@ class OrderController extends AdminController
parent::persistEntity($entity);
}

public function createEntityFormBuilder($entity, $view, $override = true)
{
$formBuilder = parent::createEntityFormBuilder($entity, $view, false);

$userClass = $this->em->getClassMetadata(UserInterface::class);
$addressClass = $this->em->getClassMetadata(AddressInterface::class);


$formBuilder->add('user', EntityType::class, array(
'class' => $userClass->name
));


$formBuilder->add('invoiceAddress', EntityType::class, array(
'class' => $addressClass->name,
'placeholder' => '',
'query_builder' => function (EntityRepository $er) use ($entity) {
return $er->createQueryBuilder('a')
->where('a.user = :user')
->setParameter('user', $entity->getUser());
},
));

$formBuilder = $this->overrideFormBuilder($formBuilder, $entity, $view);


return $formBuilder;
}


public function getUserViaFirstStepForm($entity)
@@ -171,6 +138,31 @@ class OrderController extends AdminController
}


public function orderInvoiceAddressAction()
{

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

$formOrderInvoiceAddress = $this->createForm(OrderInvoiceAddressType::class, $orderShop);

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

if ($formOrderInvoiceAddress->isSubmitted() && $formOrderInvoiceAddress->isValid()) {
$this->em->persist($orderShop);
$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 orderProductsAction()
{

@@ -192,11 +184,9 @@ class OrderController extends AdminController
$response['niche'] = $orderProduct->getQuantityOrder();
$this->em->remove($orderProduct);
} else {
//dump($orderProduct);
$this->em->persist($orderProduct);
}
}
//$this->em->persist($orderShop);
$this->em->flush();
$response['status'] = 'success';
$response['message'] = 'La commande a bien été modifié';
@@ -205,7 +195,6 @@ class OrderController extends AdminController
$response['message'] = 'Une erreur est survenue';
}
$response['data'] = $this->orderUtils->getOrderAsJsonObject($orderShop);;
//die('nicicici');
return new Response(json_encode($response));
}

@@ -227,8 +216,29 @@ class OrderController extends AdminController
'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()
])
));
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_add_product_to_order'] = $formAddProductToOrder->createView();
$parameters['form_order_products'] = $formOrderProducts->createView();
$parameters['form_order_invoice_address'] = $formOrderInvoiceAddress->createView();
}
return parent::renderTemplate($actionName, $templatePath, $parameters);
}

ShopBundle/Controller/Admin/ProductFamilyController.php → ShopBundle/Controller/Backend/ProductFamilyController.php Datei anzeigen

@@ -1,6 +1,6 @@
<?php

namespace Lc\ShopBundle\Controller\Admin;
namespace Lc\ShopBundle\Controller\Backend;

use App\Entity\Product;
use App\Entity\ReductionCatalog;

ShopBundle/Controller/Admin/UserController.php → ShopBundle/Controller/Backend/UserController.php Datei anzeigen

@@ -1,6 +1,6 @@
<?php

namespace Lc\ShopBundle\Controller\Admin;
namespace Lc\ShopBundle\Controller\Backend;

use FOS\UserBundle\Doctrine\UserManager;
use FOS\UserBundle\Model\UserManagerInterface ;

+ 53
- 0
ShopBundle/Form/Order/OrderDeliveryAddressType.php Datei anzeigen

@@ -0,0 +1,53 @@
<?php

namespace Lc\ShopBundle\Form\Order;

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Lc\ShopBundle\Context\AddressInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\OrderShopInterface;
use Lc\ShopBundle\Context\UserInterface;
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\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class OrderDeliveryAddressType extends AbstractType
{
protected $em;
protected $merchantUtils;

public function __construct(EntityManagerInterface $em, MerchantUtilsInterface $merchantUtils)
{
$this->em = $em;
$this->merchantUtils = $merchantUtils;
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
$entity = $options['data'];
$builder->add('deliveryPointSale', ChoiceType::class, array(
'choices' => $this->merchantUtils->getMerchantUser()->getPointSales(),
'choice_label' => 'labelAdminChoice',
'required' => false,
'mapped' => false,

))

->add('saveDeliveryAddress', ButtonType::class, array(
'label' => 'field.OrderShop.saveInvoiceAddress'
));

}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => $this->em->getClassMetadata(OrderShopInterface::class)->getName(),
]);
}
}

+ 57
- 0
ShopBundle/Form/Order/OrderInvoiceAddressType.php Datei anzeigen

@@ -0,0 +1,57 @@
<?php

namespace Lc\ShopBundle\Form\Order;

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Lc\ShopBundle\Context\AddressInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\OrderShopInterface;
use Lc\ShopBundle\Context\UserInterface;
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\CollectionType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class OrderInvoiceAddressType extends AbstractType
{
protected $em;
protected $merchantUtils;

public function __construct(EntityManagerInterface $em, MerchantUtilsInterface $merchantUtils)
{
$this->em = $em;
$this->merchantUtils = $merchantUtils;
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
$entity = $options['data'];
$addressClass = $this->em->getClassMetadata(AddressInterface::class);

$builder->add('invoiceAddress', EntityType::class, array(
'class' => $addressClass->name,
'placeholder' => '',
'query_builder' => function (EntityRepository $er) use ($entity) {
return $er->createQueryBuilder('a')
->where('a.user = :user')
->setParameter('user', $entity->getUser());
},
))
->add('saveInvoiceAddress', ButtonType::class, array(
'label' => 'field.OrderShop.saveInvoiceAddress'
));

}

public
function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => $this->em->getClassMetadata(OrderShopInterface::class)->getName(),

]);
}
}

+ 33
- 1
ShopBundle/Model/Address.php Datei anzeigen

@@ -98,7 +98,39 @@ abstract class Address extends AbstractEntity

public function __toString()
{
return $this->getTitle().' - '.$this->getZip().' '.$this->getCity() ;
return $this->getTitle() . ' - ' . $this->getZip() . ' ' . $this->getCity();
}

public function getSummaryShort()
{
return $this->getAddress() . ' - ' . $this->getZip() . ' ' . $this->getCity();
}

public function getSummary()
{
$html = '';

if ($this->getTitle()) {
$html .= $this->getTitle() . '<br />';
}

if ($this->getLastname() || $this->getFirstname()) {
$html .= $this->getLastname() . ' ' . $this->getFirstname() . '<br />';
}

if ($this->getAddress()) {
$html .= $this->getAddress() . '<br />';
}

if ($this->getZip() || $this->getCity()) {
$html .= $this->getZip() . ' ' . $this->getCity() . '<br />';
}

if ($this->getPhone()) {
$html .= 'Tél. ' . $this->getPhone();
}

return $html;
}

public function getUser(): ?User

+ 6
- 0
ShopBundle/Model/User.php Datei anzeigen

@@ -100,6 +100,12 @@ abstract class User extends UserModelFOS
$this->userPointSales = new ArrayCollection();
}


public function getSummary()
{
return strtoupper($this->getLastname()).' '.$this->getFirstname(). ' ('.$this->getEmail().')';
}

public function setEmail($email)
{
$this->setUsername($email);

+ 1
- 1
ShopBundle/Resources/config/shop_routes.yaml Datei anzeigen

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

admin_switch_merchant:
path: /admin/switch-merchant
controller: Lc\ShopBundle\Controller\Admin\MerchantController::switchMerchantAction
controller: Lc\ShopBundle\Controller\Backend\MerchantController::switchMerchantAction

lc_api:
path: /api/{entity}/{id}

+ 2
- 0
ShopBundle/Resources/public/css/backend/custom.css Datei anzeigen

@@ -2,6 +2,8 @@
body{font-size: 0.9rem;}
[class*="sidebar-dark-"] .nav-sidebar > .nav-item.menu-open , [class*="sidebar-dark-"] .nav-sidebar > .nav-item:hover {background:rgba(255,255,255,.1); }

.hidden{display: none;}

.main-sidebar .logo-long{padding: 8px 0; text-align: center;}
.main-sidebar .logo-long img{height: 40px; display: inline-block;}
.sidebar-collapse .main-sidebar .logo-long span{display: none;}

+ 1
- 0
ShopBundle/Resources/public/js/backend/script/default/init-common.js Datei anzeigen

@@ -54,6 +54,7 @@ function initAdminLtePlugin() {

if ($('.select2, select.form-control').length) {
$('form .form-widget>select.form-control, .select2').each(function (i, elm) {
log($(elm))
if(!$(this).hasClass('disable-select2')) {
setSelect2($(elm)) ;
}

+ 61
- 61
ShopBundle/Resources/public/js/backend/script/order/vuejs-order.js Datei anzeigen

@@ -6,36 +6,36 @@ Vue.component('order-product', {
mixins: [mixinTemplate],
props: ['template', 'keyItem', 'orderProduct'],
computed: {},
/* data:function() {
return{
/* data:function() {
return{

product:null
};
/!* return Object.assign(
{
/!*title: null,
price: null,
priceWithTax: null,
priceWithTaxAndReduction: null,
totalWithoutTax: null,
totalWithTax: null,
buyingPrice: null,
quantity: 1,
unit: null,
product: null*!/
}, window.orderProducts[this.key])*!/
},*/
mounted:function () {
product:null
};
/!* return Object.assign(
{
/!*title: null,
price: null,
priceWithTax: null,
priceWithTaxAndReduction: null,
totalWithoutTax: null,
totalWithTax: null,
buyingPrice: null,
quantity: 1,
unit: null,
product: null*!/
}, window.orderProducts[this.key])*!/
},*/
mounted: function () {
log(this.keyItem);
this.setFields()
//this.$el.replace(/__name__/g, this.key);
},
methods:{
init:function(){
methods: {
init: function () {
//log(this.$els);
//log(this.$element);
},
setFields:function(){
setFields: function () {
var app = this;
fields = ['fieldQuantity', 'fieldProduct'];
fields.forEach(function (field) {
@@ -49,10 +49,10 @@ Vue.component('order-product', {
//log(app.$refs[field]);
});
},
updateOrderProducts:function () {
updateOrderProducts: function () {
this.$parent.updateOrderProducts();
},
deleteOrderProduct:function(){
deleteOrderProduct: function () {
$(this.$refs.fieldQuantity).val(0);
this.$parent.updateOrderProducts();
}
@@ -71,17 +71,22 @@ Vue.component('order-product', {
appOrder = new Vue({
el: '#lc-order-edit',
delimiters: ['${', '}'],
computed: {},
computed: {
deliveryAddressHtml: function () {
log(this.order.deliveryAddress);
return this.order.deliveryAddress;
}
},
data() {
return Object.assign(
{
templateTest: window.templateTest,
orderProducts:[],
order:[],
isLoading:true,
addProductId:null,
addProductQuantity:null,
orderProducts: [],
order: [],
deliveryType: null,
isLoading: true,
addProductId: null,
addProductQuantity: null,

sectionsArray: [
{
@@ -104,48 +109,43 @@ appOrder = new Vue({
log(window.templateTest);
this.updateOrder(window.orderObject);
//log($(this.$el).find('#orderProductsForm').replace(/__name__/g, 0));
},
},
methods: {
updateOrderProducts:function(){
addProductToOrder: function () {
this.postForm('#addProductToOrderForm', false);
},
updateOrderProducts: function () {
this.postForm('#orderProductsForm', false);
},
updateOrderInvoiceAddress: function () {
this.postForm('#orderInvoiceAddressForm', '#modal-order-invoice-address');
},
updateOrderDeliveryAddress: function () {
this.postForm('#orderDeliveryAddressForm', '#modal-order-invoice-address');
},
updateOrderDeliveryAvailability:function(){
this.postForm('#orderDeliveryAvailabilityForm', '#modal-order-delivery-availability');
},
postForm:function(formId, modalId){
var app = this;
this.isLoading=true;
//$('#orderProductsForm').submit();
this.isLoading = true;
if(modalId)$(modalId).modal('hide');
$.ajax({
url: $('#orderProductsForm').prop('action'),
url: $(formId).prop('action'),
method: "POST",
data: $('#orderProductsForm').serialize(),
dataType:"json",
data: $(formId).serialize(),
dataType: "json",
success: function (response) {
generateNotice(response.status, response.message);
if (response.status == 'success') {
app.updateOrder(response.data);
}
app.updateOrder(response.data);
}
});
},
updateOrder:function (orderObject){
updateOrder: function (orderObject) {
this.orderProducts = orderObject.orderProducts;
this.order = orderObject;
this.isLoading=false;
this.isLoading = false;
},
addProductToOrder:function(){
var app = this;
this.isLoading=true;
$.ajax({
url: $('#addProductToOrderForm').prop('action'),
method: "POST",
data: $('#addProductToOrderForm').serialize(),
dataType:"json",
success: function (response) {
generateNotice(response.status, response.message);
if (response.status == 'success') {
app.updateOrder(response.data);
}
}
});
},


},
watch: {
}

+ 7
- 0
ShopBundle/Resources/translations/lcshop.fr.yaml Datei anzeigen

@@ -48,6 +48,8 @@ form.label.delete: Supprimer l'image
field:
default:
placeholder: Choisissez une option
deliveryPointSale: Lieu de livraison
deliveryAvailabilty: Créneau de livraison
id: Id
status: En ligne
statusOptions:
@@ -135,6 +137,8 @@ field:
isSent: Envoyée
behaviorTaxRate: Avec ou sans TVA
behaviorTaxRateHelp: Appliquer la réduction sur le prix HT ou le prix TTC
deliveryAddress: Addresse de livraison
invoiceAddress: Addresse de facturation
PointSale:
code: Code
codeHelp: Code utilisé pour retrouver l'ambassade dans le tunnel de commande (Non sensible à la casse)
@@ -210,7 +214,10 @@ field:
Address:
city: Commune
OrderShop:
mainInfo: Information principal
product: Produit
user: Client
orderNumber: Numéro de commande
quantity: Quantité
addOrderToProduct: Ajouter le produit


+ 58
- 1
ShopBundle/Resources/views/backend/order/card_orderproducts.html.twig Datei anzeigen

@@ -1,7 +1,62 @@
{% 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">
<h6><strong>{{ "field.OrderShop.mainInfo"|trans({}, 'lcshop') }} : </strong></h6>
<p>
<strong>{{ "field.OrderShop.user"|trans }} </strong><br />
<span>${order.user}</span>
</p>
<p>
<strong>{{ "field.OrderShop.orderNumber"|trans }} </strong><br />
<span>${order.id}</span>
</p>
</div>
<div class="col-4" >

<div v-if="order.deliveryType == 'at-home'">
<h6><strong>{{ "field.default.deliveryAddress"|trans({}, 'lcshop') }} : </strong></h6>
<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 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">
<h6><strong>{{ "field.default.deliveryAvailabilty"|trans({}, 'lcshop') }} : </strong></h6>
<div v-if="order.deliveryType == 'at-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 class="col-12">

{{ form_start(form_order_products, {'attr': {'id' : 'orderProductsForm'}}) }}
@@ -20,5 +75,7 @@
window.orderObject = {{ order|json_encode|raw }};
</script>
</div>


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

+ 4
- 0
ShopBundle/Resources/views/backend/order/edit.html.twig Datei anzeigen

@@ -13,6 +13,10 @@

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

{{ macros.endCard }}
</div>
</div>

+ 28
- 0
ShopBundle/Resources/views/backend/order/modal_deliveryaddress.html.twig Datei anzeigen

@@ -0,0 +1,28 @@

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

<div class="modal-content">
<div class="modal-header">
<h4>{{ "form.group.OrderShop.deliveryAddress"|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_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>
{{ form_row(form_order_delivery_address.saveDeliveryAddress, {"attr": {'class' : 'btn btn-primary', '@click' : 'updateOrderDeliveryAddress'}}) }}
</div>
</div>
<!-- /.modal-content -->
</div>
{{ form_end(form_order_delivery_address) }}
</div>

+ 33
- 0
ShopBundle/Resources/views/backend/order/modal_deliveryavailability.html.twig Datei anzeigen

@@ -0,0 +1,33 @@

<div class="modal fade show" id="modal-order-delivery-availability">
{{ form_start(form_order_delivery_availability, {'attr': { 'id' : 'orderDeliveryAvailabilityForm'}}) }}) }}
{% form_theme form_order_delivery_availability '@LcShop/backend/form/custom_bootstrap_4.html.twig' %}
<div class="modal-dialog">

<div class="modal-content">
<div class="modal-header">
<h4>{{ "form.group.OrderShop.deliveryAvailabilty"|trans }}</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
${order.deliveryType}
<div class="col" v-if="order.deliveryType=='point-sale'">
{{ form_row(form_order_delivery_availability.deliveryAvailabilityPointSale) }}
</div>

<div class="col" v-else-if="order.deliveryType=='at-home'">
{{ form_row(form_order_delivery_availability.deliveryAvailabilityZone) }}
</div>

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

+ 25
- 0
ShopBundle/Resources/views/backend/order/modal_invoiceaddress.html.twig Datei anzeigen

@@ -0,0 +1,25 @@

<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' %}
<div class="modal-dialog">

<div class="modal-content">
<div class="modal-header">
<h4>{{ "form.group.OrderShop.invoiceAddress"|trans }}</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
{{ form_row(form_order_invoice_address.invoiceAddress) }}
</div>
<div class="modal-footer justify-content-between">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
{{ form_row(form_order_invoice_address.saveInvoiceAddress, {"attr": {'class' : 'btn btn-primary', '@click' : 'updateOrderInvoiceAddress'}}) }}
</div>
</div>
<!-- /.modal-content -->
</div>
{{ form_end(form_order_invoice_address) }}
</div>

+ 0
- 13
ShopBundle/Resources/views/backend/order/panel_addresses.html.twig Datei anzeigen

@@ -6,19 +6,6 @@
</div>
<div class="row">

<div class="col">
{{ form_label(form.deliveryType) }}
{% for field in form.deliveryType %}
{{ form_widget(field, {"attr" : {"v-model" : 'deliveryType'}}) }}
{% endfor %}

</div>
<div class="col" v-if="deliveryType == 'at-home'">
{{ form_row(form.deliveryAddress, {"attr": {'v-model' : 'deliveryAddress'}}) }}
</div>
<div class="col" v-else-if="deliveryType == 'point-sale'">
{{ form_row(form.deliveryPointSale, {"attr": {'v-model' : 'deliveryPointSale'}}) }}
</div>

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

+ 0
- 41
ShopBundle/Services/AddressUtils.php Datei anzeigen

@@ -1,41 +0,0 @@
<?php

namespace Lc\ShopBundle\Services ;

use Lc\ShopBundle\Context\AddressInterface;

class AddressUtils
{
public function getSummaryShort(AddressInterface $address)
{
return $address->getAddress().' - '.$address->getZip().' '.$address->getCity() ;
}

public function getSummary(AddressInterface $address)
{
$html = '' ;

if($address->getTitle()) {
$html .= $address->getTitle().'<br />' ;
}

if($address->getLastname() || $address->getFirstname()) {
$html .= $address->getLastname().' '.$address->getFirstname().'<br />' ;
}

if($address->getAddress()) {
$html .= $address->getAddress().'<br />' ;
}

if($address->getZip() || $address->getCity()) {
$html .= $address->getZip().' '.$address->getCity().'<br />' ;
}

if($address->getPhone()) {
$html .= 'Tél. '.$address->getPhone() ;
}

return $html ;
}

}

+ 3
- 1
ShopBundle/Services/OrderUtils.php Datei anzeigen

@@ -212,10 +212,12 @@ class OrderUtils
public function getOrderAsJsonObject(OrderShopInterface $order)
{
$data['id'] = $order->getId();
$data['user'] = $order->getUser()->getSummary();
$data['deliveryAddress'] = $order->getDeliveryAddress()->getSummary();
$data['invoiceAddress'] = $order->getInvoiceAddress()->getSummary();
$data['total'] = $this->priceUtils->getTotal($order);
$data['totalWithTax'] = $this->priceUtils->getTotalWithTax($order);
$data['totalWithTaxAndReduction'] = $this->priceUtils->getTotalWithTax($order);
$data['deliveryAddress'] = $order->getDeliveryAddress($order);
$i=0;
foreach ($this->getOrderProductsByParentCategory($order) as $labelCategory => $orderProducts) {


Laden…
Abbrechen
Speichern