ソースを参照

listing

packProduct
Charly 3年前
コミット
f81de8c38b
3個のファイルの変更65行の追加63行の削除
  1. +6
    -6
      Controller/PointSale/PointSaleAdminController.php
  2. +8
    -11
      Controller/Product/ProductCategoryAdminController.php
  3. +51
    -46
      Controller/User/UserMerchantAdminController.php

+ 6
- 6
Controller/PointSale/PointSaleAdminController.php ファイルの表示

@@ -26,15 +26,15 @@ abstract class PointSaleAdminController extends AbstractAdminController
return array_merge(
[
FormField::addPanel('general'),
IntegerField::new('id')->onlyOnIndex(),
TextField::new('title'),
MoneyField::new('orderAmountMin')->setCurrency('EUR'),
IntegerField::new('id')->onlyOnIndex()->setSortable(true),
TextField::new('title')->setSortable(true),
MoneyField::new('orderAmountMin')->setCurrency('EUR')->setSortable(true),
NumberField::new('deliveryPrice')
->setCustomOption('appendHtml', '€')
->hideOnIndex(),
StatusField::new('status'),
ToggleField::new('isPublic'),
ToggleField::new('isDepository'),
StatusField::new('status')->setSortable(true),
ToggleField::new('isPublic')->setSortable(true),
ToggleField::new('isDepository')->setSortable(true),
FormField::addPanel('address'),
AddressField::new('address')
->setRequired(true)

+ 8
- 11
Controller/Product/ProductCategoryAdminController.php ファイルの表示

@@ -2,22 +2,17 @@

namespace Lc\CaracoleBundle\Controller\Product;

//use Lc\CaracoleBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
use Lc\CaracoleBundle\Container\Order\OrderShopContainer;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\CaracoleBundle\Field\Address\AddressField;
use Lc\CaracoleBundle\Repository\Reduction\ReductionCatalogStore;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Field\ToggleField;
use Lc\SovBundle\Translation\TranslatorAdmin;

abstract class ProductCategoryAdminController extends AbstractAdminController
{
@@ -28,13 +23,15 @@ abstract class ProductCategoryAdminController extends AbstractAdminController
return array_merge(
[
FormField::addPanel('general'),
TextField::new('title'),
NumberField::new('position')->hideOnForm(),
IntegerField::new('id')->onlyOnIndex()->setSortable(true),
TextField::new('title')->setSortable(true),
NumberField::new('position')->hideOnForm()->setSortable(true),
AssociationField::new('parent')->hideOnIndex(),
DateTimeField::new('createdAt')->setFormat('short'),
DateTimeField::new('createdAt')->setFormat('short')->setSortable(true),
CKEditorField::new('description')->hideOnIndex(),
ToggleField::new('saleStatus'),
StatusField::new('status'),
StatusField::new('status')->setSortable(true),
ToggleField::new('saleStatus')->setSortable(true),
ToggleField::new('isEligibleTicketRestaurant')->setSortable(true),

],
$this->getSeoPanel(),

+ 51
- 46
Controller/User/UserMerchantAdminController.php ファイルの表示

@@ -18,6 +18,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Exception\InsufficientEntityPermissionExcept
use EasyCorp\Bundle\EasyAdminBundle\Factory\EntityFactory;
use EasyCorp\Bundle\EasyAdminBundle\Field\ArrayField;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Filter\BooleanFilter;
use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider;
@@ -50,7 +51,7 @@ abstract class UserMerchantAdminController extends AbstractAdminController
$adminUrlGenerator = $this->get(AdminUrlGenerator::class);

$creditControllerFqcn = $context->getCrudControllers()->findCrudFqcnByEntityFqcn(
$this->get(EntityManagerInterface::class)->getEntityName(CreditHistoryInterface::class)
$this->get(EntityManagerInterface::class)->getEntityName(CreditHistoryInterface::class)
);

if ($entities) {
@@ -58,9 +59,9 @@ abstract class UserMerchantAdminController extends AbstractAdminController
foreach ($entity->getActions() as $action) {
if ($action->getName() == 'credit_history') {
$url = $adminUrlGenerator
->setController($creditControllerFqcn)
->set('userMerchantId', $entity->getInstance()->getId())
->generateUrl();
->setController($creditControllerFqcn)
->set('userMerchantId', $entity->getInstance()->getId())
->generateUrl();
$action->setLinkUrl($url);
}
}
@@ -73,14 +74,14 @@ abstract class UserMerchantAdminController extends AbstractAdminController
$actions = parent::configureActions($actions);

$creditAction = Action::new('credit_history', false, 'fa fa-cash-register')
->linkToCrudAction('credit_history')
->setHtmlAttributes(
array(
'data-toggle' => 'tooltip',
'title' => $this->get(TranslatorAdmin::class)->transAction('credit'),
)
->linkToCrudAction('credit_history')
->setHtmlAttributes(
array(
'data-toggle' => 'tooltip',
'title' => $this->get(TranslatorAdmin::class)->transAction('credit'),
)
->setCssClass('btn btn-sm btn-success');
)
->setCssClass('btn btn-sm btn-success');
$actions->add(Crud::PAGE_INDEX, $creditAction);

return $actions;
@@ -89,12 +90,13 @@ abstract class UserMerchantAdminController extends AbstractAdminController
public function configureFields(string $pageName): iterable
{
$fields = [
TextField::new('user.email'),
TextField::new('user.lastname'),
TextField::new('user.firstname'),
BooleanField::new('active'),
BooleanField::new('creditActive'),
AssociationField::new('user'),
IntegerField::new('id')->onlyOnIndex()->setSortable(true),
TextField::new('user.lastname')->setSortable(true),
TextField::new('user.firstname')->setSortable(true),
TextField::new('user.email')->setSortable(true),
BooleanField::new('active')->setSortable(true),
BooleanField::new('creditActive')->hideOnIndex(),
AssociationField::new('user'),
];

if ($this->isGranted('ROLE_SUPER_ADMIN')) {
@@ -107,7 +109,7 @@ abstract class UserMerchantAdminController extends AbstractAdminController
public function configureFilters(Filters $filters): Filters
{
return $filters
->add(BooleanFilter::new('active'));
->add(BooleanFilter::new('active'));
}

public function new(AdminContext $context): Response
@@ -116,8 +118,8 @@ abstract class UserMerchantAdminController extends AbstractAdminController
$merchantResolver = $this->get(MerchantResolver::class);

$userMerchant = $this->get(UserMerchantContainer::class)
->getFactory()
->create($merchantResolver->getCurrent());
->getFactory()
->create($merchantResolver->getCurrent());

$form = $this->createForm(UserMerchantFormType::class, $userMerchant);

@@ -159,16 +161,19 @@ abstract class UserMerchantAdminController extends AbstractAdminController

return $this->redirect($url);
} else {
$this->addFlash('error', $this->get(TranslatorAdmin::class)->trans('form.user_merchant.already_exist'));
$this->addFlash(
'error',
$this->get(TranslatorAdmin::class)->trans('form.user_merchant.already_exist')
);
}
}
}

return $this->render(
'@LcCaracole/admin/user/new_usermerchant.html.twig',
[
'form' => $form->createView(),
]
'@LcCaracole/admin/user/new_usermerchant.html.twig',
[
'form' => $form->createView(),
]
);
}

@@ -204,10 +209,10 @@ abstract class UserMerchantAdminController extends AbstractAdminController
}

return $this->render(
'@LcCaracole/admin/user/edit_usermerchant.html.twig',
[
'form' => $form->createView(),
]
'@LcCaracole/admin/user/edit_usermerchant.html.twig',
[
'form' => $form->createView(),
]
);
}

@@ -220,8 +225,8 @@ abstract class UserMerchantAdminController extends AbstractAdminController
}

if (!$this->isGranted(
Permission::EA_EXECUTE_ACTION,
['action' => Action::DETAIL, 'entity' => $context->getEntity()]
Permission::EA_EXECUTE_ACTION,
['action' => Action::DETAIL, 'entity' => $context->getEntity()]
)) {
throw new ForbiddenActionException($context);
}
@@ -230,25 +235,25 @@ abstract class UserMerchantAdminController extends AbstractAdminController
}

$options['action'] = $adminUrlGenerator
->setController($context->getCrud()->getControllerFqcn())
->setAction('add_credit')
->setEntityId($context->getEntity()->getInstance()->getId())
->set('userMerchant', 'niche')
->generateUrl();
->setController($context->getCrud()->getControllerFqcn())
->setAction('add_credit')
->setEntityId($context->getEntity()->getInstance()->getId())
->set('userMerchant', 'niche')
->generateUrl();
$addCreditHistoryForm = $this->createForm(CreditHistoryFormType::class, null, $options)->createView();


return $this->render(
'@LcCaracole/admin/credit/credit_detail.html.twig',
[
'pageName' => Crud::PAGE_DETAIL,
'entity' => $context->getEntity(),
'batch_actions' => array(),
'entities' => array(),
'filters' => array(),
'paginator' => array(),
'add_credit_history_form' => $addCreditHistoryForm,
]
'@LcCaracole/admin/credit/credit_detail.html.twig',
[
'pageName' => Crud::PAGE_DETAIL,
'entity' => $context->getEntity(),
'batch_actions' => array(),
'entities' => array(),
'filters' => array(),
'paginator' => array(),
'add_credit_history_form' => $addCreditHistoryForm,
]
);
}


読み込み中…
キャンセル
保存