@@ -0,0 +1,7 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Context; | |||
interface PayoffInterface | |||
{ | |||
} |
@@ -51,6 +51,21 @@ class AdminController extends EasyAdminController | |||
$this->translator = $translator; | |||
} | |||
public function createCustomForm($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); | |||
} | |||
/** | |||
* Réécriture de show action pr rediriger vers l'édition | |||
*/ |
@@ -354,16 +354,16 @@ class OrderController extends AdminController | |||
if ($actionName == 'show') { | |||
if (!isset($parameters['form_order_delivery_address'])) { | |||
$parameters['form_order_delivery_address'] = $this->createOrderForm(OrderDeliveryAddressType::class, 'orderDeliveryAddress', $parameters)->createView(); | |||
$parameters['form_order_delivery_address'] = $this->createCustomForm(OrderDeliveryAddressType::class, 'orderDeliveryAddress', $parameters)->createView(); | |||
} | |||
$parameters['form_add_order_reduction_credit'] = $this->createOrderForm(AddOrderReductionCreditType::class, 'addOrderReductionCredit', $parameters)->createView(); | |||
$parameters['form_add_order_reduction_cart'] = $this->createOrderForm(AddOrderReductionCartType::class, 'addOrderReductionCart', $parameters)->createView(); | |||
$parameters['form_delete_order_reduction_cart'] = $this->createOrderForm(DeleteOrderReductionCartType::class, 'deleteOrderReductionCart', $parameters)->createView(); | |||
$parameters['form_delete_order_reduction_credit'] = $this->createOrderForm(DeleteOrderReductionCreditType::class, 'deleteOrderReductionCredit', $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_add_order_reduction_credit'] = $this->createCustomForm(AddOrderReductionCreditType::class, 'addOrderReductionCredit', $parameters)->createView(); | |||
$parameters['form_add_order_reduction_cart'] = $this->createCustomForm(AddOrderReductionCartType::class, 'addOrderReductionCart', $parameters)->createView(); | |||
$parameters['form_delete_order_reduction_cart'] = $this->createCustomForm(DeleteOrderReductionCartType::class, 'deleteOrderReductionCart', $parameters)->createView(); | |||
$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_invoice_address'] = $this->createCustomForm(OrderInvoiceAddressType::class, 'orderInvoiceAddress', $parameters)->createView(); | |||
$parameters['form_order_status'] = $this->createCustomForm(OrderStatusType::class, 'orderStatus', $parameters)->createView(); | |||
} | |||
return parent::renderTemplate($actionName, $templatePath, $parameters); | |||
} | |||
@@ -373,35 +373,22 @@ class OrderController extends AdminController | |||
if ($actionName == 'show') { | |||
if (!isset($parameters['form_order_delivery_address'])) { | |||
$parameters['form_order_delivery_address'] = $this->createOrderForm(OrderDeliveryAddressType::class, 'orderDeliveryAddress', $parameters)->createView(); | |||
$parameters['form_order_delivery_address'] = $this->createCustomForm(OrderDeliveryAddressType::class, 'orderDeliveryAddress', $parameters)->createView(); | |||
} | |||
$parameters['form_add_order_reduction_credit'] = $this->createOrderForm(AddOrderReductionCreditType::class, 'addOrderReductionCredit', $parameters)->createView(); | |||
$parameters['form_add_order_reduction_cart'] = $this->createOrderForm(AddOrderReductionCartType::class, 'addOrderReductionCart', $parameters)->createView(); | |||
$parameters['form_delete_order_reduction_cart'] = $this->createOrderForm(DeleteOrderReductionCartType::class, 'deleteOrderReductionCart', $parameters)->createView(); | |||
$parameters['form_delete_order_reduction_credit'] = $this->createOrderForm(DeleteOrderReductionCreditType::class, 'deleteOrderReductionCredit', $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(); | |||
$parameters['form_add_order_reduction_credit'] = $this->createCustomForm(AddOrderReductionCreditType::class, 'addOrderReductionCredit', $parameters)->createView(); | |||
$parameters['form_add_order_reduction_cart'] = $this->createCustomForm(AddOrderReductionCartType::class, 'addOrderReductionCart', $parameters)->createView(); | |||
$parameters['form_delete_order_reduction_cart'] = $this->createCustomForm(DeleteOrderReductionCartType::class, 'deleteOrderReductionCart', $parameters)->createView(); | |||
$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_invoice_address'] = $this->createCustomForm(OrderInvoiceAddressType::class, 'orderInvoiceAddress', $parameters)->createView(); | |||
$parameters['form_order_status'] = $this->createCustomForm(OrderStatusType::class, 'orderStatus', $parameters)->createView(); | |||
$parameters['form_order_payment'] = $this->createCustomForm(OrderPaymentType::class, 'orderPayment', $parameters, false)->createView(); | |||
} | |||
return parent::renderTemplate($actionName, $templatePath, $parameters); | |||
} | |||
public function createOrderForm($class, $action, $parameters, $data = true) | |||
{ | |||
$options = array(); | |||
if ($data) $options['data'] = $parameters['entity']; | |||
$options['action'] = $this->generateUrl('easyadmin', array( | |||
'action' => $action, | |||
'entity' => $this->entity['name'], | |||
'id' => $parameters['entity']->getId() | |||
)); | |||
return $this->createForm($class, null, $options); | |||
} | |||
protected function newAction() | |||
{ |
@@ -2,20 +2,19 @@ | |||
namespace Lc\ShopBundle\Controller\Backend; | |||
use App\Repository\UserRepository; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents; | |||
use FOS\UserBundle\Model\UserManagerInterface; | |||
use Lc\ShopBundle\Context\CreditHistoryInterface; | |||
use Lc\ShopBundle\Context\MerchantUtilsInterface; | |||
use Lc\ShopBundle\Context\NewsInterface; | |||
use Lc\ShopBundle\Context\OrderUtilsInterface; | |||
use Lc\ShopBundle\Context\UserInterface; | |||
use Lc\ShopBundle\Form\Backend\UserMerchant\CreditHistoryType; | |||
use Lc\ShopBundle\Services\CreditUtils; | |||
use Lc\ShopBundle\Services\Utils; | |||
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | |||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | |||
use Symfony\Component\Security\Core\Security; | |||
use Symfony\Contracts\Translation\TranslatorInterface; | |||
@@ -29,6 +28,32 @@ class UserMerchantController extends AdminController | |||
$this->creditUtils = $creditUtils; | |||
} | |||
public function addCreditHistoryAction(){ | |||
$easyadmin = $this->request->attributes->get('easyadmin'); | |||
$userMerchant = $easyadmin['item']; | |||
$creditHistoryClass = $this->em->getClassMetadata(CreditHistoryInterface::class); | |||
$creditHistory = new $creditHistoryClass->name; | |||
$addCreditHistoryForm = $this->createForm(CreditHistoryType::class, $creditHistory); | |||
$addCreditHistoryForm->handleRequest($this->request); | |||
if ($addCreditHistoryForm->isSubmitted() && $addCreditHistoryForm->isValid()) { | |||
if($this->creditUtils->saveCreditHistory()){ | |||
$this->utils->addFlash('warning', 'success.credit.added'); | |||
}else{ | |||
$this->utils->addFlash('warning', 'error.credit.notAdded'); | |||
} | |||
} else { | |||
$this->utils->addFlash('error', $addCreditHistoryForm->getErrors()); | |||
} | |||
return $this->redirectToRoute('easyadmin', [ | |||
'action' => 'show', | |||
'entity' => $this->request->query->get('entity'), | |||
'id' => $userMerchant->getId() | |||
]); | |||
} | |||
protected function newAction() | |||
{ | |||
$this->dispatch(EasyAdminEvents::PRE_NEW); | |||
@@ -103,23 +128,31 @@ class UserMerchantController extends AdminController | |||
$entity = $easyadmin['item']; | |||
$fields = $this->entity['show']['fields']; | |||
$deleteForm = $this->createDeleteForm($this->entity['name'], $id); | |||
$this->dispatch(EasyAdminEvents::POST_SHOW, [ | |||
'deleteForm' => $deleteForm, | |||
//'deleteForm' => $deleteForm, | |||
'fields' => $fields, | |||
'entity' => $entity, | |||
]); | |||
$parameters = [ | |||
'entity' => $entity, | |||
'fields' => $fields, | |||
'delete_form' => $deleteForm->createView() | |||
'fields' => $fields | |||
]; | |||
return $this->executeDynamicMethod('render<EntityName>Template', ['show', $this->entity['templates']['show'], $parameters]); | |||
} | |||
public function renderUserMerchantTemplate($actionName, $templatePath, array $parameters = []){ | |||
if ($actionName == 'show') { | |||
$parameters['add_credit_history_form'] = $this->createCustomForm(CreditHistoryType::class, 'addCreditHistory', $parameters, false)->createView(); | |||
} | |||
return parent::renderTemplate($actionName, $templatePath, $parameters); | |||
} | |||
/** | |||
* Réécriture de edit action pr rediriger vers le show */ | |||
public function editAction() |
@@ -0,0 +1,84 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Form\Backend\UserMerchant; | |||
use App\Entity\Product; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use Lc\ShopBundle\Context\CreditHistoryInterface; | |||
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 Lc\ShopBundle\Model\CreditHistory; | |||
use Lc\ShopBundle\Services\Utils; | |||
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\DateType; | |||
use Symfony\Component\Form\Extension\Core\Type\HiddenType; | |||
use Symfony\Component\Form\Extension\Core\Type\MoneyType; | |||
use Symfony\Component\Form\Extension\Core\Type\NumberType; | |||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | |||
use Symfony\Component\Form\Extension\Core\Type\TextType; | |||
use Symfony\Component\Form\FormBuilderInterface; | |||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||
class CreditHistoryType extends AbstractType | |||
{ | |||
protected $em; | |||
public function __construct(EntityManagerInterface $em) | |||
{ | |||
$this->em = $em; | |||
} | |||
public function buildForm(FormBuilderInterface $builder, array $options) | |||
{ | |||
$builder->add('type', ChoiceType::class, array( | |||
'choices' => array( | |||
'field.creditHistory.typeOptions.'.CreditHistory::TYPE_CREDIT => CreditHistory::TYPE_CREDIT, | |||
'field.creditHistory.typeOptions.'.CreditHistory::TYPE_DEBIT => CreditHistory::TYPE_DEBIT | |||
), | |||
'required' => true | |||
)) | |||
->add('amount', NumberType::class, array( | |||
)) | |||
->add('meanPayment', ChoiceType::class, array( | |||
'choices' => array( | |||
'field.default.meanPaymentOptions.'.Utils::MEAN_PAYMENT_CASH => Utils::MEAN_PAYMENT_CASH, | |||
'field.default.meanPaymentOptions.'.Utils::MEAN_PAYMENT_CHEQUE => Utils::MEAN_PAYMENT_CHEQUE, | |||
'field.default.meanPaymentOptions.'.Utils::MEAN_PAYMENT_CREDIT => Utils::MEAN_PAYMENT_CREDIT, | |||
'field.default.meanPaymentOptions.'.Utils::MEAN_PAYMENT_CREDIT_CARD => Utils::MEAN_PAYMENT_CREDIT_CARD, | |||
'field.default.meanPaymentOptions.'.Utils::MEAN_PAYMENT_TRANSFER => Utils::MEAN_PAYMENT_TRANSFER | |||
), | |||
'required' => true | |||
)) | |||
->add('paidAt', DateType::class, array( | |||
'widget' => 'single_text', | |||
'required' => true | |||
)) | |||
->add('reference', TextType::class) | |||
->add('comment', TextareaType::class) | |||
->add('add', SubmitType::class, array( | |||
'label' => 'action.add' | |||
)); | |||
} | |||
public function configureOptions(OptionsResolver $resolver) | |||
{ | |||
$resolver->setDefaults([ | |||
'data_class' => $this->em->getClassMetadata(CreditHistoryInterface::class)->getName(), | |||
]); | |||
} | |||
} |
@@ -8,27 +8,28 @@ use App\Entity\UserMerchant; | |||
use Doctrine\ORM\Mapping as ORM; | |||
use Lc\ShopBundle\Context\OrderPaymentInterface; | |||
use Lc\ShopBundle\Context\OrderRefundInterface; | |||
use Lc\ShopBundle\Context\PayoffInterface; | |||
use Lc\ShopBundle\Context\UserMerchantInterface; | |||
/** | |||
* @ORM\MappedSuperclass() | |||
*/ | |||
abstract class CreditHistory extends AbstractEntity | |||
abstract class CreditHistory extends AbstractEntity implements PayoffInterface | |||
{ | |||
use PayoffTrait; | |||
const TYPE_CREDIT = 'credit'; | |||
const TYPE_DEBIT = 'debit'; | |||
/** | |||
* @ORM\Column(type="float") | |||
* @ORM\Column(type="float", nullable=true) | |||
*/ | |||
protected $amount; | |||
/** | |||
* @ORM\Column(type="string", length=31) | |||
*/ | |||
protected $meanPayment; | |||
/** | |||
* @ORM\Column(type="text", nullable=true) | |||
*/ | |||
protected $comment; | |||
protected $type; | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserMerchantInterface", inversedBy="creditHistories") | |||
@@ -52,33 +53,43 @@ abstract class CreditHistory extends AbstractEntity | |||
return $this->amount; | |||
} | |||
public function setAmount(float $amount): self | |||
public function setAmount(?float $amount): self | |||
{ | |||
$this->amount = $amount; | |||
return $this; | |||
} | |||
public function getMeanPayment(): ?string | |||
public function getAmountInherited(): float | |||
{ | |||
return $this->meanPayment; | |||
if ($this->getOrderPayment() !== null) { | |||
return $this->getOrderPayment()->getAmount(); | |||
} else if ($this->getOrderRefund() !== null) { | |||
return $this->getOrderRefund()->getAmount(); | |||
} else { | |||
return $this->getAmount(); | |||
} | |||
} | |||
public function setMeanPayment(string $meanPayment): self | |||
public function getMeanPaymentInherited(): string | |||
{ | |||
$this->meanPayment = $meanPayment; | |||
return $this; | |||
if ($this->getOrderPayment() !== null) { | |||
return $this->getOrderPayment()->getMeanPayment(); | |||
} else if ($this->getOrderRefund() !== null) { | |||
return $this->getOrderRefund()->getMeanPayment(); | |||
} else { | |||
return $this->getMeanPayment(); | |||
} | |||
} | |||
public function getComment(): ?string | |||
public function getType(): ?string | |||
{ | |||
return $this->comment; | |||
return $this->type; | |||
} | |||
public function setComment(string $comment): self | |||
public function setType(string $meanPayment): self | |||
{ | |||
$this->comment = $comment; | |||
$this->meanPayment = $meanPayment; | |||
return $this; | |||
} |
@@ -12,47 +12,19 @@ use Lc\ShopBundle\Context\ReductionInterface; | |||
trait OrderPayoffTrait | |||
{ | |||
use PayoffTrait; | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="orderPayments") | |||
* @ORM\JoinColumn(nullable=false) | |||
*/ | |||
protected $orderShop; | |||
/** | |||
* @ORM\Column(type="string", length=255, nullable=true) | |||
*/ | |||
protected $meanPayment; | |||
/** | |||
* @ORM\Column(type="text", nullable=true) | |||
*/ | |||
protected $reference; | |||
/** | |||
* @ORM\Column(type="datetime", nullable=true) | |||
*/ | |||
protected $paidAt; | |||
/** | |||
* @ORM\Column(type="float") | |||
*/ | |||
protected $amount; | |||
/** | |||
* @ORM\Column(type="text", nullable=true) | |||
*/ | |||
protected $comment; | |||
/** | |||
* @ORM\Column(type="boolean") | |||
*/ | |||
protected $editable; | |||
public function __toString() | |||
{ | |||
return $this->amount. '€ par '.$this->type.' le '.$this->getPaidAt()->format('d-m-Y'); | |||
} | |||
public function getOrderShop(): ?OrderShop | |||
{ | |||
return $this->orderShop; | |||
@@ -65,69 +37,6 @@ trait OrderPayoffTrait | |||
return $this; | |||
} | |||
public function setMeanPayment(?string $meanPayment): self | |||
{ | |||
$this->meanPayment = $meanPayment; | |||
return $this; | |||
} | |||
public function getMeanPayment(?string $meanPayment): self | |||
{ | |||
$this->meanPayment = $meanPayment; | |||
return $this; | |||
} | |||
public function getReference(): ?string | |||
{ | |||
return $this->reference; | |||
} | |||
public function setReference(?string $reference): self | |||
{ | |||
$this->reference = $reference; | |||
return $this; | |||
} | |||
public function getPaidAt(): ?\DateTimeInterface | |||
{ | |||
return $this->paidAt; | |||
} | |||
public function setPaidAt(?\DateTimeInterface $paidAt): self | |||
{ | |||
$this->paidAt = $paidAt; | |||
return $this; | |||
} | |||
public function getAmount(): ?float | |||
{ | |||
return $this->amount; | |||
} | |||
public function setAmount(float $amount): self | |||
{ | |||
$this->amount = $amount; | |||
return $this; | |||
} | |||
public function getComment(): ?string | |||
{ | |||
return $this->comment; | |||
} | |||
public function setComment(?string $comment): self | |||
{ | |||
$this->comment = $comment; | |||
return $this; | |||
} | |||
public function setEditable(bool $editable): self | |||
{ | |||
$this->editable = $editable; |
@@ -0,0 +1,104 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Model; | |||
use Doctrine\ORM\Mapping as ORM; | |||
use Lc\ShopBundle\Context\OrderPaymentInterface; | |||
use Lc\ShopBundle\Context\ReductionInterface; | |||
/** | |||
* @ORM\MappedSuperclass() | |||
*/ | |||
trait PayoffTrait | |||
{ | |||
/** | |||
* @ORM\Column(type="string", length=255, nullable=true) | |||
*/ | |||
protected $meanPayment; | |||
/** | |||
* @ORM\Column(type="text", nullable=true) | |||
*/ | |||
protected $reference; | |||
/** | |||
* @ORM\Column(type="datetime", nullable=true) | |||
*/ | |||
protected $paidAt; | |||
/** | |||
* @ORM\Column(type="float") | |||
*/ | |||
protected $amount; | |||
/** | |||
* @ORM\Column(type="text", nullable=true) | |||
*/ | |||
protected $comment; | |||
public function setMeanPayment(?string $meanPayment): self | |||
{ | |||
$this->meanPayment = $meanPayment; | |||
return $this; | |||
} | |||
public function getMeanPayment() : ?string | |||
{ | |||
return $this->meanPayment ; | |||
} | |||
public function getReference(): ?string | |||
{ | |||
return $this->reference; | |||
} | |||
public function setReference(?string $reference): self | |||
{ | |||
$this->reference = $reference; | |||
return $this; | |||
} | |||
public function getPaidAt(): ?\DateTimeInterface | |||
{ | |||
return $this->paidAt; | |||
} | |||
public function setPaidAt(?\DateTimeInterface $paidAt): self | |||
{ | |||
$this->paidAt = $paidAt; | |||
return $this; | |||
} | |||
public function getAmount(): ?float | |||
{ | |||
return $this->amount; | |||
} | |||
public function setAmount(float $amount): self | |||
{ | |||
$this->amount = $amount; | |||
return $this; | |||
} | |||
public function getComment(): ?string | |||
{ | |||
return $this->comment; | |||
} | |||
public function setComment(?string $comment): self | |||
{ | |||
$this->comment = $comment; | |||
return $this; | |||
} | |||
} |
@@ -0,0 +1,43 @@ | |||
{% trans_default_domain 'lcshop' %} | |||
<div class="modal fade show" id="modal-add-credit-history"> | |||
{{ form_start(add_credit_history_form, {'attr': { 'id' : 'addCreditHistory'}}) }} | |||
{% form_theme add_credit_history_form '@LcShop/backend/form/custom_bootstrap_4.html.twig' %} | |||
<div class="modal-dialog"> | |||
<div class="modal-content"> | |||
<div class="modal-header"> | |||
<h4>{{ "action.addCreditHistory"|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(add_credit_history_form.type) }} | |||
</div> | |||
<div class="col"> | |||
{{ form_row(add_credit_history_form.amount) }} | |||
</div> | |||
<div class="col"> | |||
{{ form_row(add_credit_history_form.meanPayment) }} | |||
</div> | |||
<div class="col"> | |||
{{ form_row(add_credit_history_form.paidAt) }} | |||
</div> | |||
<div class="col"> | |||
{{ form_row(add_credit_history_form.reference) }} | |||
</div> | |||
<div class="col"> | |||
{{ form_row(add_credit_history_form.comment) }} | |||
</div> | |||
</div> | |||
<div class="modal-footer justify-content-between"> | |||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | |||
{{ form_row(add_credit_history_form.add, {"attr": {'class' : 'btn btn-primary'}}) }} | |||
</div> | |||
</div> | |||
<!-- /.modal-content --> | |||
</div> | |||
{{ form_end(add_credit_history_form) }} | |||
</div> |
@@ -0,0 +1,12 @@ | |||
{% extends '@LcShop/backend/default/new.html.twig' %} | |||
{% block entity_form %} | |||
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %} | |||
{{ macros.startCard(8, 'UserMerchant.selectUser') }} | |||
<div class="col-12"> | |||
{{ form(form) }} | |||
</div> | |||
{{ macros.endCard() }} | |||
{% endblock entity_form %} | |||
@@ -0,0 +1,18 @@ | |||
{% extends '@LcShop/backend/default/show.html.twig' %} | |||
{% block main %} | |||
{% for creditHistory in entity.creditHistories %} | |||
<li>{{ creditHistory.amount }}</li> | |||
{% else %} | |||
<li><i>Aucun mouvement pour ce compte prépayé</i></li> | |||
{% endfor %} | |||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-add-credit-history"> | |||
{{ "action.addCreditHistory"|trans }} | |||
</button> | |||
{% include 'LcShopBundle:backend/usermerchant:modal_addcredithistory.html.twig' %} | |||
{% endblock main %} | |||