abstract class CreditHistoryAdminController extends AbstractAdminController | abstract class CreditHistoryAdminController extends AbstractAdminController | ||||
{ | { | ||||
use AdminControllerTrait; | use AdminControllerTrait; | ||||
protected $em; | |||||
protected $translatorAdmin; | |||||
public function __construct(EntityManagerInterface $entityManager, TranslatorAdmin $translatorAdmin) | |||||
{ | |||||
$this->em = $entityManager; | |||||
$this->translatorAdmin = $translatorAdmin; | |||||
} | |||||
public function overrideGlobalActions(?ActionCollection $actions): void | public function overrideGlobalActions(?ActionCollection $actions): void | ||||
{ | { | ||||
parent::overrideGlobalActions($actions); | parent::overrideGlobalActions($actions); | ||||
public function configureFields(string $pageName): iterable | public function configureFields(string $pageName): iterable | ||||
{ | { | ||||
$translatorAdmin = $this->get('translator_admin'); | |||||
return [ | return [ | ||||
IdField::new('id')->hideOnForm(), | IdField::new('id')->hideOnForm(), | ||||
ChoiceField::new('type')->setChoices( | ChoiceField::new('type')->setChoices( | ||||
array( | array( | ||||
$this->translatorAdmin->transField( | |||||
$translatorAdmin->transField( | |||||
'typeOptions.'.CreditHistoryModel::TYPE_CREDIT, | 'typeOptions.'.CreditHistoryModel::TYPE_CREDIT, | ||||
'CreditHistory' | 'CreditHistory' | ||||
) => CreditHistoryModel::TYPE_CREDIT, | ) => CreditHistoryModel::TYPE_CREDIT, | ||||
$this->translatorAdmin->transField( | |||||
$translatorAdmin->transField( | |||||
'typeOptions.'.CreditHistoryModel::TYPE_DEBIT, | 'typeOptions.'.CreditHistoryModel::TYPE_DEBIT, | ||||
'CreditHistory' | 'CreditHistory' | ||||
) => CreditHistoryModel::TYPE_DEBIT, | ) => CreditHistoryModel::TYPE_DEBIT, | ||||
DateField::new('paidAt'), | DateField::new('paidAt'), | ||||
ChoiceField::new('meanPayment')->setChoices( | ChoiceField::new('meanPayment')->setChoices( | ||||
array( | array( | ||||
$this->translatorAdmin->transField( | |||||
$translatorAdmin->transField( | |||||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CASH, | 'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CASH, | ||||
'CreditHistory' | 'CreditHistory' | ||||
) => CreditHistoryModel::MEAN_PAYMENT_CASH, | ) => CreditHistoryModel::MEAN_PAYMENT_CASH, | ||||
$this->translatorAdmin->transField( | |||||
$translatorAdmin->transField( | |||||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CHEQUE, | 'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CHEQUE, | ||||
'CreditHistory' | 'CreditHistory' | ||||
) => CreditHistoryModel::MEAN_PAYMENT_CHEQUE, | ) => CreditHistoryModel::MEAN_PAYMENT_CHEQUE, | ||||
$this->translatorAdmin->transField( | |||||
$translatorAdmin->transField( | |||||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CREDIT, | 'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CREDIT, | ||||
'CreditHistory' | 'CreditHistory' | ||||
) => CreditHistoryModel::MEAN_PAYMENT_CREDIT, | ) => CreditHistoryModel::MEAN_PAYMENT_CREDIT, | ||||
$this->translatorAdmin->transField( | |||||
$translatorAdmin->transField( | |||||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CREDIT_CARD, | 'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CREDIT_CARD, | ||||
'CreditHistory' | 'CreditHistory' | ||||
) => CreditHistoryModel::MEAN_PAYMENT_CREDIT_CARD, | ) => CreditHistoryModel::MEAN_PAYMENT_CREDIT_CARD, | ||||
$this->translatorAdmin->transField( | |||||
$translatorAdmin->transField( | |||||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_TRANSFER, | 'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_TRANSFER, | ||||
'CreditHistory' | 'CreditHistory' | ||||
) => CreditHistoryModel::MEAN_PAYMENT_TRANSFER, | ) => CreditHistoryModel::MEAN_PAYMENT_TRANSFER, |
<?php | |||||
namespace Lc\CaracoleBundle\Controller\Product; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | |||||
use Lc\CaracoleBundle\Field\Address\AddressField; | |||||
use Lc\SovBundle\Controller\AbstractAdminController; | |||||
use Lc\SovBundle\Field\BooleanField; | |||||
use Lc\SovBundle\Field\CKEditorField; | |||||
use Lc\SovBundle\Field\StatusField; | |||||
abstract class ProductCategoryAdminController extends AbstractAdminController | |||||
{ | |||||
use AdminControllerTrait; | |||||
public function configureFields(string $pageName): iterable | |||||
{ | |||||
return array_merge( | |||||
[ | |||||
FormField::addPanel('general'), | |||||
TextField::new('title'), | |||||
AssociationField::new('parent'), | |||||
CKEditorField::new('description'), | |||||
BooleanField::new('saleStatus'), | |||||
StatusField::new('status'), | |||||
], | |||||
$this->getSeoPanel(), | |||||
$this->getConfPanel() | |||||
); | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Controller\Product; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | |||||
use Lc\CaracoleBundle\Field\Address\AddressField; | |||||
use Lc\SovBundle\Controller\AbstractAdminController; | |||||
use Lc\SovBundle\Field\BooleanField; | |||||
use Lc\SovBundle\Field\CKEditorField; | |||||
use Lc\SovBundle\Field\StatusField; | |||||
abstract class ProductFamilyAdminController extends AbstractAdminController | |||||
{ | |||||
use AdminControllerTrait; | |||||
} |
public function createEntity(string $entityFqcn) | public function createEntity(string $entityFqcn) | ||||
{ | { | ||||
$factory = new PageFactory(); | $factory = new PageFactory(); | ||||
$currentMerchant = $this->get('merchant_resolver')->getCurrent(); | |||||
$currentSection = $this->get('section_resolver')->getCurrent(); | $currentSection = $this->get('section_resolver')->getCurrent(); | ||||
$factory->setMerchant($currentMerchant); | |||||
$factory->setSection($currentSection); | $factory->setSection($currentSection); | ||||
return $factory->create(); | return $factory->create(); | ||||
} | } |
namespace Lc\CaracoleBundle\Controller\Ticket; | namespace Lc\CaracoleBundle\Controller\Ticket; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore; | |||||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | use Lc\CaracoleBundle\Controller\AdminControllerTrait; | ||||
use Lc\SovBundle\Controller\Ticket\TicketAdminController as SovTicketAdminController; | use Lc\SovBundle\Controller\Ticket\TicketAdminController as SovTicketAdminController; | ||||
use Lc\CaracoleBundle\Factory\Ticket\TicketFactory; | |||||
class TicketAdminController extends SovTicketAdminController | class TicketAdminController extends SovTicketAdminController | ||||
{ | { | ||||
use AdminControllerTrait; | use AdminControllerTrait; | ||||
public function createEntityFromFactory() | |||||
public function createEntity(string $entityFqcn) | |||||
{ | { | ||||
return $this->ticketFactory | |||||
->setMerchant($this->get('merchant_resolver')->getCurrent()) | |||||
->create(); | |||||
$merchantResolver = $this->get('merchant_resolver'); | |||||
$factory = new TicketFactory(); | |||||
$factory->setMerchant($merchantResolver->getCurrent()); | |||||
return $factory->create(); | |||||
} | } | ||||
} | } |
use Lc\CaracoleBundle\Form\User\UserMerchantFormType; | use Lc\CaracoleBundle\Form\User\UserMerchantFormType; | ||||
use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface; | use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface; | ||||
use Lc\SovBundle\Controller\AbstractAdminController; | use Lc\SovBundle\Controller\AbstractAdminController; | ||||
use Lc\SovBundle\Field\BooleanField; | |||||
use Lc\SovBundle\Field\ToggleField; | use Lc\SovBundle\Field\ToggleField; | ||||
use Lc\SovBundle\Model\User\UserInterface; | use Lc\SovBundle\Model\User\UserInterface; | ||||
use Lc\SovBundle\Translation\TranslatorAdmin; | use Lc\SovBundle\Translation\TranslatorAdmin; |
trait ReductionTrait | trait ReductionTrait | ||||
{ | { | ||||
/** | |||||
* @ORM\Column(type="float", nullable=true) | |||||
*/ | |||||
protected $value; | |||||
/** | |||||
* @ORM\Column(type="string", length=20, nullable=true) | |||||
*/ | |||||
protected $unit; | |||||
/** | |||||
* @ORM\Column(type="string", length=20, nullable=true) | |||||
*/ | |||||
protected $behaviorTaxRate; | |||||
/** | |||||
* @ORM\Column(type="float", nullable=true) | |||||
*/ | |||||
protected $value; | |||||
/** | |||||
* @ORM\Column(type="string", length=20, nullable=true) | |||||
*/ | |||||
protected $unit; | |||||
public function getValue(): ?float | |||||
{ | |||||
return $this->value; | |||||
} | |||||
/** | |||||
* @ORM\Column(type="string", length=20, nullable=true) | |||||
*/ | |||||
protected $behaviorTaxRate; | |||||
public function setValue(?float $value): self | |||||
{ | |||||
$this->value = $value; | |||||
return $this; | |||||
} | |||||
public function getValue(): ?float | |||||
{ | |||||
return $this->value; | |||||
} | |||||
public function getUnit(): ?string | |||||
{ | |||||
return $this->unit; | |||||
} | |||||
public function setValue(?float $value): self | |||||
{ | |||||
$this->value = $value; | |||||
public function setUnit(?string $unit): self | |||||
{ | |||||
$this->unit = $unit; | |||||
return $this; | |||||
} | |||||
return $this; | |||||
} | |||||
public function getUnit(): ?string | |||||
{ | |||||
return $this->unit; | |||||
} | |||||
public function getBehaviorTaxRate(): ?string | |||||
{ | |||||
return $this->behaviorTaxRate; | |||||
} | |||||
public function setUnit(?string $unit): self | |||||
{ | |||||
$this->unit = $unit; | |||||
public function setBehaviorTaxRate(?string $behaviorTaxRate): self | |||||
{ | |||||
$this->behaviorTaxRate = $behaviorTaxRate; | |||||
return $this; | |||||
} | |||||
return $this; | |||||
} | |||||
public function getBehaviorTaxRate(): ?string | |||||
{ | |||||
return $this->behaviorTaxRate; | |||||
} | |||||
public function setBehaviorTaxRate(?string $behaviorTaxRate): self | |||||
{ | |||||
$this->behaviorTaxRate = $behaviorTaxRate; | |||||
return $this; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Factory\Product; | namespace Lc\CaracoleBundle\Factory\Product; | ||||
use App\Entity\Product\ProductFamily; | use App\Entity\Product\ProductFamily; | ||||
use Lc\CaracoleBundle\Factory\SectionFactoryTrait; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
class ProductFamilyFactory extends AbstractFactory | class ProductFamilyFactory extends AbstractFactory | ||||
{ | { | ||||
public function create(MerchantInterface $merchant, SectionInterface $section): ProductFamilyInterface | |||||
use SectionFactoryTrait; | |||||
public function create(SectionInterface $section = null): ProductFamilyInterface | |||||
{ | { | ||||
$productFamily = new ProductFamily(); | $productFamily = new ProductFamily(); | ||||
$productFamily->setMerchant($merchant); | |||||
$productFamily->setSection($section); | |||||
if(is_null($section)) { | |||||
$productFamily->setSection($this->section); | |||||
}else{ | |||||
$productFamily->setSection($section); | |||||
} | |||||
return $productFamily; | return $productFamily; | ||||
} | } |
class PageFactory extends SovPageFactory | class PageFactory extends SovPageFactory | ||||
{ | { | ||||
use MerchantFactoryTrait; | |||||
use SectionFactoryTrait; | use SectionFactoryTrait; | ||||
public function create(): PageInterface | public function create(): PageInterface | ||||
{ | { | ||||
$page = parent::create(); | $page = parent::create(); | ||||
$page->setMerchant($this->merchant); | |||||
$page->setSection($this->section); | $page->setSection($this->section); | ||||
return $page; | return $page; |
abstract class TaxRateModel extends AbstractLightEntity | abstract class TaxRateModel extends AbstractLightEntity | ||||
{ | { | ||||
const BEHAVIOR_TAX_RATE_INCLUDED = 'tax-included'; | |||||
const BEHAVIOR_TAX_RATE_EXCLUDED = 'tax-excluded'; | |||||
public function getBehaviorTaxRateChoices(): array | |||||
{ | |||||
return [ | |||||
self::BEHAVIOR_TAX_RATE_EXCLUDED, | |||||
self::BEHAVIOR_TAX_RATE_INCLUDED, | |||||
]; | |||||
} | |||||
/** | /** | ||||
* @ORM\Column(type="string", length=255) | * @ORM\Column(type="string", length=255) | ||||
*/ | */ |
*/ | */ | ||||
abstract class UnitModel extends AbstractLightEntity | abstract class UnitModel extends AbstractLightEntity | ||||
{ | { | ||||
const UNIT_PERCENT = 'percent'; | |||||
const UNIT_AMOUNT = 'amount'; | |||||
public function getUnitAmountChoices(): array | |||||
{ | |||||
return [ | |||||
self::UNIT_PERCENT, | |||||
self::UNIT_AMOUNT, | |||||
]; | |||||
} | |||||
/** | /** | ||||
* @ORM\Column(type="string", length=32) | * @ORM\Column(type="string", length=32) | ||||
*/ | */ |
/** | /** | ||||
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() | ||||
*/ | */ | ||||
abstract class NewsletterModel extends SovNewsletterModel implements FilterMerchantInterface, FilterSectionInterface | |||||
abstract class NewsletterModel extends SovNewsletterModel implements FilterSectionInterface | |||||
{ | { | ||||
/** | |||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="newsletters") | |||||
*/ | |||||
protected $merchant; | |||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="newsletters") | * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="newsletters") | ||||
*/ | */ | ||||
protected $section; | protected $section; | ||||
public function getMerchant(): ?MerchantInterface | |||||
{ | |||||
return $this->merchant; | |||||
} | |||||
public function setMerchant(?MerchantInterface $merchant): self | |||||
{ | |||||
$this->merchant = $merchant; | |||||
return $this; | |||||
} | |||||
public function getSection(): ?SectionInterface | public function getSection(): ?SectionInterface | ||||
{ | { |
use Doctrine\Common\Collections\Collection; | use Doctrine\Common\Collections\Collection; | ||||
use Gedmo\Mapping\Annotation as Gedmo; | use Gedmo\Mapping\Annotation as Gedmo; | ||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | |||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | |||||
use Lc\CaracoleBundle\Model\Address\AddressInterface; | use Lc\CaracoleBundle\Model\Address\AddressInterface; | ||||
use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface; | use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface; | ||||
use Lc\CaracoleBundle\Model\File\DocumentInterface; | use Lc\CaracoleBundle\Model\File\DocumentInterface; | ||||
use Lc\CaracoleBundle\Model\File\DocumentModel; | use Lc\CaracoleBundle\Model\File\DocumentModel; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\SovBundle\Model\Ticket\TicketInterface; | use Lc\SovBundle\Model\Ticket\TicketInterface; | ||||
use Lc\CaracoleBundle\Model\User\VisitorInterface; | use Lc\CaracoleBundle\Model\User\VisitorInterface; | ||||
/** | /** | ||||
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() | ||||
*/ | */ | ||||
abstract class OrderShopModel extends AbstractLightEntity implements FilterMerchantInterface | |||||
abstract class OrderShopModel extends AbstractLightEntity implements FilterSectionInterface | |||||
{ | { | ||||
/** | |||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="productFamilies") | |||||
* @ORM\JoinColumn(nullable=false) | |||||
*/ | |||||
protected $merchant; | |||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="orders", fetch="EAGER") | * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="orders", fetch="EAGER") | ||||
*/ | */ | ||||
return null; | return null; | ||||
} | } | ||||
public function getMerchant(): ?MerchantInterface | |||||
{ | |||||
return $this->merchant; | |||||
} | |||||
public function setMerchant(?MerchantInterface $merchant): self | |||||
{ | |||||
$this->merchant = $merchant; | |||||
return $this; | |||||
} | |||||
public function getUser(): ?UserInterface | public function getUser(): ?UserInterface | ||||
{ | { | ||||
return $this->user; | return $this->user; |
use Doctrine\Common\Collections\ArrayCollection; | use Doctrine\Common\Collections\ArrayCollection; | ||||
use Doctrine\Common\Collections\Collection; | use Doctrine\Common\Collections\Collection; | ||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\SovBundle\Doctrine\Extension\TreeInterface; | use Lc\SovBundle\Doctrine\Extension\TreeInterface; | ||||
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity; | use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity; | ||||
/** | /** | ||||
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() | ||||
*/ | */ | ||||
abstract class ProductCategoryModel extends AbstractFullEntity implements TreeInterface, FilterMerchantInterface | |||||
abstract class ProductCategoryModel extends AbstractFullEntity implements TreeInterface, FilterSectionInterface | |||||
{ | { | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="productCategories") | |||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface") | |||||
* @ORM\JoinColumn(nullable=false) | * @ORM\JoinColumn(nullable=false) | ||||
*/ | */ | ||||
protected $merchant; | |||||
protected $section; | |||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Product\ProductCategoryInterface", inversedBy="childrens") | * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Product\ProductCategoryInterface", inversedBy="childrens") | ||||
protected $saleStatus; | protected $saleStatus; | ||||
/** | |||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="productCategories") | |||||
* @ORM\JoinColumn(nullable=false) | |||||
*/ | |||||
protected $section; | |||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->childrens = new ArrayCollection(); | $this->childrens = new ArrayCollection(); | ||||
return $title; | return $title; | ||||
} | } | ||||
public function getSection(): SectionInterface | |||||
{ | |||||
return $this->section; | |||||
} | |||||
public function setSection(SectionInterface $section): self | |||||
{ | |||||
$this->section = $section; | |||||
return $this; | |||||
} | |||||
public function getParent(): ?self | public function getParent(): ?self | ||||
{ | { | ||||
return $this->parent; | return $this->parent; | ||||
return $count; | return $count; | ||||
} | } | ||||
public function getMerchant(): ?MerchantInterface | |||||
{ | |||||
return $this->merchant; | |||||
} | |||||
public function setMerchant(?MerchantInterface $merchant): self | |||||
{ | |||||
$this->merchant = $merchant; | |||||
return $this; | |||||
} | |||||
public function getSaleStatus(): ?bool | public function getSaleStatus(): ?bool | ||||
{ | { | ||||
return $this->saleStatus; | return $this->saleStatus; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getSection(): ?SectionInterface | |||||
{ | |||||
return $this->section; | |||||
} | |||||
public function setSection(?SectionInterface $section): self | |||||
{ | |||||
$this->section = $section; | |||||
return $this; | |||||
} | |||||
} | } |
use Doctrine\Common\Collections\ArrayCollection; | use Doctrine\Common\Collections\ArrayCollection; | ||||
use Doctrine\Common\Collections\Collection; | use Doctrine\Common\Collections\Collection; | ||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | |||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | |||||
use Lc\CaracoleBundle\Doctrine\Extension\PriceInterface; | use Lc\CaracoleBundle\Doctrine\Extension\PriceInterface; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyTrait; | use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyTrait; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyInterface; | use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyInterface; | ||||
use Gedmo\Mapping\Annotation as Gedmo; | use Gedmo\Mapping\Annotation as Gedmo; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCatalogInterface; | use Lc\CaracoleBundle\Model\Reduction\ReductionCatalogInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity; | use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity; | ||||
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() | ||||
*/ | */ | ||||
abstract class ProductFamilyModel extends AbstractFullEntity implements ProductPropertyInterface, PriceInterface, | abstract class ProductFamilyModel extends AbstractFullEntity implements ProductPropertyInterface, PriceInterface, | ||||
FilterMerchantInterface | |||||
FilterSectionInterface | |||||
{ | { | ||||
use ProductPropertyTrait; | use ProductPropertyTrait; | ||||
const BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY = 'by-product-family'; | const BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY = 'by-product-family'; | ||||
const BEHAVIOR_COUNT_STOCK_BY_PRODUCT = 'by-product'; | const BEHAVIOR_COUNT_STOCK_BY_PRODUCT = 'by-product'; | ||||
public function getBehaviorCountStockChoices(): array | |||||
{ | |||||
return [ | |||||
self::BEHAVIOR_COUNT_STOCK_BY_MEASURE, | |||||
self::BEHAVIOR_COUNT_STOCK_BY_PRODUCT, | |||||
self::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY, | |||||
self::BEHAVIOR_COUNT_STOCK_UNLIMITED, | |||||
]; | |||||
} | |||||
const BEHAVIOR_DISPLAY_SALE_BY_MEASURE = 'by-measure'; | const BEHAVIOR_DISPLAY_SALE_BY_MEASURE = 'by-measure'; | ||||
const BEHAVIOR_DISPLAY_SALE_BY_QUANTITY = 'by-quantity'; | const BEHAVIOR_DISPLAY_SALE_BY_QUANTITY = 'by-quantity'; | ||||
public function getBehaviorDisplaySaleChoices(): array | |||||
{ | |||||
return [ | |||||
self::BEHAVIOR_DISPLAY_SALE_BY_MEASURE, | |||||
self::BEHAVIOR_DISPLAY_SALE_BY_QUANTITY, | |||||
]; | |||||
} | |||||
const BEHAVIOR_STOCK_WEEK_RENEWABLE = 'renewable'; | const BEHAVIOR_STOCK_WEEK_RENEWABLE = 'renewable'; | ||||
const BEHAVIOR_STOCK_WEEK_RENEWABLE_VALIDATION = 'renewable-with-validation'; | const BEHAVIOR_STOCK_WEEK_RENEWABLE_VALIDATION = 'renewable-with-validation'; | ||||
const BEHAVIOR_STOCK_WEEK_NON_RENEWABLE = 'non-renewable'; | const BEHAVIOR_STOCK_WEEK_NON_RENEWABLE = 'non-renewable'; | ||||
public function getBehaviorStockWeekChoices(): array | |||||
{ | |||||
return [ | |||||
self::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE, | |||||
self::BEHAVIOR_STOCK_WEEK_RENEWABLE, | |||||
self::BEHAVIOR_STOCK_WEEK_RENEWABLE_VALIDATION, | |||||
]; | |||||
} | |||||
const WARNING_MESSAGE_TYPE_SUCCESS = 'success'; | const WARNING_MESSAGE_TYPE_SUCCESS = 'success'; | ||||
const WARNING_MESSAGE_TYPE_ERROR = 'error'; | const WARNING_MESSAGE_TYPE_ERROR = 'error'; | ||||
const WARNING_MESSAGE_TYPE_WARNING = 'warning'; | const WARNING_MESSAGE_TYPE_WARNING = 'warning'; | ||||
const WARNING_MESSAGE_TYPE_INFO = 'info'; | const WARNING_MESSAGE_TYPE_INFO = 'info'; | ||||
public function getWaringMessageTypeChoices(): array | |||||
{ | |||||
return [ | |||||
self::WARNING_MESSAGE_TYPE_ERROR, | |||||
self::WARNING_MESSAGE_TYPE_INFO, | |||||
self::WARNING_MESSAGE_TYPE_SUCCESS, | |||||
self::WARNING_MESSAGE_TYPE_WARNING, | |||||
]; | |||||
} | |||||
const BEHAVIOR_ADD_TO_CART_SIMPLE = 'simple'; | const BEHAVIOR_ADD_TO_CART_SIMPLE = 'simple'; | ||||
const BEHAVIOR_ADD_TO_CART_MULTIPLE = 'multiple'; | const BEHAVIOR_ADD_TO_CART_MULTIPLE = 'multiple'; | ||||
public function getBehaviorAddToCartChoices(): array | |||||
{ | |||||
return [ | |||||
self::BEHAVIOR_ADD_TO_CART_MULTIPLE, | |||||
self::BEHAVIOR_ADD_TO_CART_SIMPLE, | |||||
]; | |||||
} | |||||
const BEHAVIOR_PRICE_BY_PIECE = 'by-piece'; | const BEHAVIOR_PRICE_BY_PIECE = 'by-piece'; | ||||
const BEHAVIOR_PRICE_BY_REFERENCE_UNIT = 'by-reference-unit'; | const BEHAVIOR_PRICE_BY_REFERENCE_UNIT = 'by-reference-unit'; | ||||
public function getBehaviorPriceChoices(): array | |||||
{ | |||||
return [ | |||||
self::BEHAVIOR_PRICE_BY_PIECE, | |||||
self::BEHAVIOR_PRICE_BY_REFERENCE_UNIT, | |||||
]; | |||||
} | |||||
const PROPERTY_ORGANIC_LABEL_AB = 'ab'; | const PROPERTY_ORGANIC_LABEL_AB = 'ab'; | ||||
const PROPERTY_ORGANIC_LABEL_NP = 'nature-progres'; | const PROPERTY_ORGANIC_LABEL_NP = 'nature-progres'; | ||||
const PROPERTY_ORGANIC_LABEL_HVE = 'hve'; | const PROPERTY_ORGANIC_LABEL_HVE = 'hve'; | ||||
const PROPERTY_ORGANIC_LABEL_TRVR = 'trvr'; | |||||
public function getPropertyOrganicLabelChoices(): array | |||||
{ | |||||
return [ | |||||
self::PROPERTY_ORGANIC_LABEL_AB, | |||||
self::PROPERTY_ORGANIC_LABEL_NP, | |||||
self::PROPERTY_ORGANIC_LABEL_HVE, | |||||
self::PROPERTY_ORGANIC_LABEL_TRVR, | |||||
]; | |||||
} | |||||
const TYPE_EXPIRATION_DATE_DLC = 'dlc'; | const TYPE_EXPIRATION_DATE_DLC = 'dlc'; | ||||
const TYPE_EXPIRATION_DATE_DDM = 'ddm'; | const TYPE_EXPIRATION_DATE_DDM = 'ddm'; | ||||
const TYPE_EXPIRATION_DATE_DLUO = 'dluo'; | const TYPE_EXPIRATION_DATE_DLUO = 'dluo'; | ||||
public function getTypeExpirationDateChoices(): array | |||||
{ | |||||
return [ | |||||
self::TYPE_EXPIRATION_DATE_DLC, | |||||
self::TYPE_EXPIRATION_DATE_DDM, | |||||
self::TYPE_EXPIRATION_DATE_DLUO, | |||||
]; | |||||
} | |||||
const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY = 'by-product-family'; | const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY = 'by-product-family'; | ||||
const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT = 'by-product'; | const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT = 'by-product'; | ||||
public function getBehaviorExpirationDateChoices():array{ | |||||
return [ | |||||
self::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY, | |||||
self::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT | |||||
]; | |||||
} | |||||
//Champ hydraté par ProductFamilyUtils | //Champ hydraté par ProductFamilyUtils | ||||
protected $reductionCatalog; | protected $reductionCatalog; | ||||
/** | /** | ||||
* @Gedmo\Blameable(on="create") | * @Gedmo\Blameable(on="create") | ||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | ||||
*/ | */ | ||||
protected $updatedBy; | protected $updatedBy; | ||||
/** | |||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="productFamilies") | |||||
* @ORM\JoinColumn(nullable=false) | |||||
*/ | |||||
protected $merchant; | |||||
/** | /** | ||||
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductCategoryInterface", inversedBy="productFamilies") | * @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Product\ProductCategoryInterface", inversedBy="productFamilies") | ||||
*/ | */ | ||||
*/ | */ | ||||
protected $saleStatus; | protected $saleStatus; | ||||
/** | /** | ||||
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="productFamilies") | |||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface") | |||||
* @ORM\JoinColumn(nullable=false) | |||||
*/ | */ | ||||
protected $sections; | |||||
protected $section; | |||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
return $this->getTitle(); | return $this->getTitle(); | ||||
} | } | ||||
public function getSection(): SectionInterface | |||||
{ | |||||
return $this->section; | |||||
} | |||||
public function setSection(SectionInterface $section): self | |||||
{ | |||||
$this->section = $section; | |||||
return $this; | |||||
} | |||||
public function getAvailableQuantityInherited() | public function getAvailableQuantityInherited() | ||||
{ | { | ||||
$availableQuantity = 0; | $availableQuantity = 0; | ||||
if ($this->getTaxRate()) { | if ($this->getTaxRate()) { | ||||
return $this->getTaxRate(); | return $this->getTaxRate(); | ||||
} else { | } else { | ||||
return $this->getMerchant()->getTaxRate(); | |||||
return $this->getSection()->getMerchant()->getTaxRate(); | |||||
} | } | ||||
} | } | ||||
public function getMerchant(): ?MerchantInterface | |||||
{ | |||||
return $this->merchant; | |||||
} | |||||
public function setMerchant(?MerchantInterface $merchant): self | |||||
{ | |||||
$this->merchant = $merchant; | |||||
return $this; | |||||
} | |||||
public function getActiveProducts(): ?bool | public function getActiveProducts(): ?bool | ||||
{ | { | ||||
return $this->activeProducts; | return $this->activeProducts; | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | |||||
* @return Collection|SectionInterface[] | |||||
*/ | |||||
public function getSections(): Collection | |||||
{ | |||||
return $this->sections; | |||||
} | |||||
public function addSection(SectionInterface $section): self | |||||
{ | |||||
if (!$this->sections->contains($section)) { | |||||
$this->sections[] = $section; | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeSection(SectionInterface $section): self | |||||
{ | |||||
if ($this->sections->contains($section)) { | |||||
$this->sections->removeElement($section); | |||||
} | |||||
return $this; | |||||
} | |||||
public function getFieldBuyingPrice() | public function getFieldBuyingPrice() | ||||
{ | { |
*/ | */ | ||||
protected $section; | protected $section; | ||||
public function getMerchant(): MerchantInterface | |||||
{ | |||||
return $this->merchant; | |||||
} | |||||
public function setMerchant(MerchantInterface $merchant): self | |||||
{ | |||||
$this->merchant = $merchant; | |||||
return $this; | |||||
} | |||||
public function getSection(): ?SectionInterface | public function getSection(): ?SectionInterface | ||||
{ | { | ||||
return $this->section; | return $this->section; |
namespace Lc\CaracoleBundle\Model\Site; | namespace Lc\CaracoleBundle\Model\Site; | ||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | |||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\SovBundle\Model\Site\PageModel as SovPageModel; | use Lc\SovBundle\Model\Site\PageModel as SovPageModel; | ||||
/** | /** | ||||
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() | ||||
*/ | */ | ||||
abstract class PageModel extends SovPageModel implements FilterMerchantInterface, FilterSectionInterface | |||||
abstract class PageModel extends SovPageModel implements FilterSectionInterface | |||||
{ | { | ||||
/** | |||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="pages") | |||||
* @ORM\JoinColumn(nullable=false) | |||||
*/ | |||||
protected $merchant; | |||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="pages") | * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="pages") | ||||
* @ORM\JoinColumn(nullable=false) | |||||
*/ | */ | ||||
protected $section; | protected $section; | ||||
public function getMerchant(): ?MerchantInterface | |||||
{ | |||||
return $this->merchant; | |||||
} | |||||
public function setMerchant(?MerchantInterface $merchant): self | |||||
{ | |||||
$this->merchant = $merchant; | |||||
return $this; | |||||
} | |||||
public function getSection(): ?SectionInterface | |||||
public function getSection(): SectionInterface | |||||
{ | { | ||||
return $this->section; | return $this->section; | ||||
} | } | ||||
public function setSection(?SectionInterface $section): self | |||||
public function setSection(SectionInterface $section): self | |||||
{ | { | ||||
$this->section = $section; | $this->section = $section; | ||||
namespace Lc\CaracoleBundle\Repository\Config; | namespace Lc\CaracoleBundle\Repository\Config; | ||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
class TaxRateStore extends AbstractStore | class TaxRateStore extends AbstractStore | ||||
{ | { | ||||
protected TaxRateRepositoryQuery $query; | protected TaxRateRepositoryQuery $query; | ||||
protected MerchantResolver $merchantResolver; | |||||
public function __construct(TaxRateRepositoryQuery $query) | |||||
public function __construct(TaxRateRepositoryQuery $query, MerchantResolver $merchantResolver) | |||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
$this->merchantResolver = $merchantResolver; | |||||
} | |||||
public function getAsArray() | |||||
{ | |||||
$query = $this->query->create(); | |||||
$taxRatesList = array(); | |||||
foreach ($query->find() as $taxRate) { | |||||
$taxRatesList[$taxRate->getId()]['title'] = $taxRate->getTitle(); | |||||
$taxRatesList[$taxRate->getId()]['value'] = $taxRate->getValue(); | |||||
} | |||||
$taxRatesList['default']['title'] = $this->merchantResolver->getCurrent()->getTaxRate()->getTitle(); | |||||
$taxRatesList['default']['value'] = $this->merchantResolver->getCurrent()->getTaxRate()->getValue(); | |||||
return $taxRatesList; | |||||
} | } | ||||
} | } |
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function getAsArray(){ | |||||
$query = $this->query->create(); | |||||
foreach ($query->find() as $unit) { | |||||
$unitsList[$unit->getId()]['unit'] = $unit->getUnit(); | |||||
$unitsList[$unit->getId()]['wordingUnit'] = $unit->getWordingUnit(); | |||||
$unitsList[$unit->getId()]['wording'] = $unit->getWording(); | |||||
$unitsList[$unit->getId()]['wordingShort'] = $unit->getWordingShort(); | |||||
$unitsList[$unit->getId()]['coefficient'] = $unit->getCoefficient(); | |||||
$unitsList[$unit->getId()]['unitReference'] = $unit->getUnitReference()->getId(); | |||||
} | |||||
return $unitsList; | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository; | namespace Lc\CaracoleBundle\Repository; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
trait MerchantRepositoryQueryTrait | trait MerchantRepositoryQueryTrait | ||||
{ | { | ||||
public function filterByMerchant(MerchantInterface $merchant) | public function filterByMerchant(MerchantInterface $merchant) | ||||
{ | { | ||||
return $this | |||||
->andWhere('.merchant = :merchant') | |||||
->setParameter(':merchant', $merchant); | |||||
return $this->andWhere('.merchant = :merchant')->setParameter(':merchant', $merchant); | |||||
} | } | ||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Repository; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
trait MerchantStoreTrait | |||||
{ | |||||
protected MerchantInterface $merchant; | |||||
public function setMerchant(MerchantInterface $merchant):self | |||||
{ | |||||
$this->merchant = $merchant; | |||||
return $this; | |||||
} | |||||
} |
class OrderShopRepositoryQuery extends AbstractRepositoryQuery | class OrderShopRepositoryQuery extends AbstractRepositoryQuery | ||||
{ | { | ||||
use MerchantRepositoryQueryTrait; | |||||
use SectionRepositoryQueryTrait; | use SectionRepositoryQueryTrait; | ||||
public function __construct(OrderShopRepository $repository, PaginatorInterface $paginator) | public function __construct(OrderShopRepository $repository, PaginatorInterface $paginator) |
class ProductCategoryRepositoryQuery extends AbstractRepositoryQuery | class ProductCategoryRepositoryQuery extends AbstractRepositoryQuery | ||||
{ | { | ||||
use MerchantRepositoryQueryTrait; | |||||
use SectionRepositoryQueryTrait; | use SectionRepositoryQueryTrait; | ||||
public function __construct(ProductCategoryRepository $repository, PaginatorInterface $paginator) | public function __construct(ProductCategoryRepository $repository, PaginatorInterface $paginator) | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | parent::__construct($repository, 'r', $paginator); | ||||
} | } | ||||
public function filterIsParent(){ | |||||
return $this->andWhere('.parent is NULL'); | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Product; | namespace Lc\CaracoleBundle\Repository\Product; | ||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | |||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
class ProductCategoryStore extends AbstractStore | class ProductCategoryStore extends AbstractStore | ||||
{ | { | ||||
use SectionStoreTrait; | |||||
protected ProductCategoryRepositoryQuery $query; | protected ProductCategoryRepositoryQuery $query; | ||||
public function __construct(ProductCategoryRepositoryQuery $query) | public function __construct(ProductCategoryRepositoryQuery $query) | ||||
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function getParents(){ | |||||
$query = $this->query->create(); | |||||
if($this->section) { | |||||
$query->filterBySection($this->section); | |||||
} | |||||
$query->filterIsParent(); | |||||
return $query->find(); | |||||
} | |||||
} | } |
class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery | class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery | ||||
{ | { | ||||
use MerchantRepositoryQueryTrait; | |||||
use SectionRepositoryQueryTrait; | use SectionRepositoryQueryTrait; | ||||
public function __construct(ProductFamilyRepository $repository, PaginatorInterface $paginator) | public function __construct(ProductFamilyRepository $repository, PaginatorInterface $paginator) |
namespace Lc\CaracoleBundle\Repository\Reduction; | namespace Lc\CaracoleBundle\Repository\Reduction; | ||||
use Knp\Component\Pager\PaginatorInterface; | use Knp\Component\Pager\PaginatorInterface; | ||||
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | |||||
use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait; | use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait; | ||||
use Lc\SovBundle\Repository\AbstractRepositoryQuery; | use Lc\SovBundle\Repository\AbstractRepositoryQuery; | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | parent::__construct($repository, 'r', $paginator); | ||||
} | } | ||||
public function filterProductFamily(ProductFamilyInterface $productFamily) | |||||
{ | |||||
return $this | |||||
->andWhere('.productFamily = :productFamily') | |||||
->setParameter(':productFamily', $productFamily); | |||||
} | |||||
public function filterStatus(bool $status) | |||||
{ | |||||
return $this | |||||
->andWhere('.status = :status') | |||||
->setParameter(':status', $status); | |||||
} | |||||
} | } |
{ | { | ||||
$this->query = $query; | $this->query = $query; | ||||
} | } | ||||
public function getByProductFamily($productFamily){ | |||||
$query = $this->query->create(); | |||||
$query->filterProductFamily($productFamily); | |||||
$query->filterStatus(true); | |||||
return $query->findOne(); | |||||
} | |||||
} | } |
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | |||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | |||||
use Lc\SovBundle\Repository\Reminder\ReminderStore as SovReminderStore; | use Lc\SovBundle\Repository\Reminder\ReminderStore as SovReminderStore; | ||||
class ReminderStore extends SovReminderStore | class ReminderStore extends SovReminderStore | ||||
{ | { | ||||
protected MerchantInterface $merchant; | |||||
protected SectionInterface $section; | |||||
public function setMerchant(MerchantInterface $merchant) | |||||
{ | |||||
$this->merchant = $merchant; | |||||
return $this; | |||||
} | |||||
public function setSection(SectionInterface $section) | |||||
{ | |||||
$this->section = $section; | |||||
return $this; | |||||
} | |||||
use SectionStoreTrait; | |||||
use MerchantStoreTrait; | |||||
public function get($params = [], $query = null) | public function get($params = [], $query = null) | ||||
{ | { |
{ | { | ||||
public function filterBySection(SectionInterface $section) | public function filterBySection(SectionInterface $section) | ||||
{ | { | ||||
return $this | |||||
->andWhere('.section = :section') | |||||
->setParameter(':section', $section); | |||||
$this->andWhere('.section = :section')->setParameter(':section', $section); | |||||
} | } | ||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Repository; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
trait SectionStoreTrait | |||||
{ | |||||
protected SectionInterface $section; | |||||
public function setSection(SectionInterface $section):self | |||||
{ | |||||
$this->section = $section; | |||||
return $this; | |||||
} | |||||
} |
class PageRepositoryQuery extends SovPageRepositoryQuery | class PageRepositoryQuery extends SovPageRepositoryQuery | ||||
{ | { | ||||
use MerchantRepositoryQueryTrait; | |||||
use SectionRepositoryQueryTrait; | use SectionRepositoryQueryTrait; | ||||
} | } |
.fa { | .fa { | ||||
position: relative; | position: relative; | ||||
top: -4px; | |||||
top: 3px; | |||||
right: 7px; | right: 7px; | ||||
} | } | ||||
menu: | menu: | ||||
pointsale: Points de vente | pointsale: Points de vente | ||||
product_category: Catégories | |||||
setting: Paramètres | setting: Paramètres | ||||
setting_merchant: Marchand | |||||
setting_section: Section | |||||
setting_merchant: Marchands | |||||
setting_section: Sections | |||||
section_openings: Ouvertures | section_openings: Ouvertures | ||||
admin: Administration | admin: Administration | ||||
admin_merchant: Marchands | admin_merchant: Marchands | ||||
panels: | panels: | ||||
address: Adresse | address: Adresse | ||||
fields: | fields: | ||||
parent: Parent | |||||
saleStatus: En vente | |||||
subtitle: Sous-titre | |||||
address: Adresse | address: Adresse | ||||
merchant: Marchand | merchant: Marchand | ||||
taxRate: Règle de taxe | taxRate: Règle de taxe | ||||
fields: | fields: | ||||
timeStart: Heure d'ouverture | timeStart: Heure d'ouverture | ||||
timeEnd: Heure de fermeture | timeEnd: Heure de fermeture | ||||
ProductCategory: | |||||
label: Catégorie | |||||
label_plurial: Catégories | |||||
form: | form: | ||||
user_merchant: | user_merchant: |
namespace Lc\CaracoleBundle\Twig; | namespace Lc\CaracoleBundle\Twig; | ||||
use Lc\CaracoleBundle\Repository\Config\TaxRateStore; | |||||
use Lc\CaracoleBundle\Repository\Config\UnitStore; | |||||
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery; | use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery; | ||||
use Lc\CaracoleBundle\Repository\Reminder\ReminderStore; | use Lc\CaracoleBundle\Repository\Reminder\ReminderStore; | ||||
use Lc\CaracoleBundle\Repository\Section\SectionRepository; | use Lc\CaracoleBundle\Repository\Section\SectionRepository; | ||||
use Lc\CaracoleBundle\Repository\Section\SectionRepositoryQuery; | use Lc\CaracoleBundle\Repository\Section\SectionRepositoryQuery; | ||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | use Lc\CaracoleBundle\Resolver\MerchantResolver; | ||||
use Lc\CaracoleBundle\Resolver\SectionResolver; | use Lc\CaracoleBundle\Resolver\SectionResolver; | ||||
use Lc\ShopBundle\Context\UnitInterface; | |||||
use Twig\Extension\AbstractExtension; | use Twig\Extension\AbstractExtension; | ||||
use Twig\TwigFunction; | use Twig\TwigFunction; | ||||
protected ReminderStore $reminderStore; | protected ReminderStore $reminderStore; | ||||
protected MerchantResolver $merchantResolver; | protected MerchantResolver $merchantResolver; | ||||
protected SectionResolver $sectionResolver; | protected SectionResolver $sectionResolver; | ||||
protected UnitStore $unitStore; | |||||
protected TaxRateStore $taxRateStore; | |||||
public function __construct( | public function __construct( | ||||
MerchantResolver $merchantResolver, | MerchantResolver $merchantResolver, | ||||
SectionResolver $sectionResolver, | SectionResolver $sectionResolver, | ||||
MerchantRepositoryQuery $merchantRepositoryQuery, | MerchantRepositoryQuery $merchantRepositoryQuery, | ||||
SectionRepositoryQuery $sectionRepositoryQuery, | SectionRepositoryQuery $sectionRepositoryQuery, | ||||
ReminderStore $reminderStore | |||||
ReminderStore $reminderStore, | |||||
UnitStore $unitStore, | |||||
TaxRateStore $taxRateStore | |||||
) { | ) { | ||||
$this->merchantResolver = $merchantResolver; | $this->merchantResolver = $merchantResolver; | ||||
$this->sectionResolver = $sectionResolver; | $this->sectionResolver = $sectionResolver; | ||||
$this->merchantRepositoryQuery = $merchantRepositoryQuery; | $this->merchantRepositoryQuery = $merchantRepositoryQuery; | ||||
$this->sectionRepositoryQuery = $sectionRepositoryQuery; | $this->sectionRepositoryQuery = $sectionRepositoryQuery; | ||||
$this->reminderStore = $reminderStore; | $this->reminderStore = $reminderStore; | ||||
$this->unitStore = $unitStore; | |||||
$this->taxRateStore = $taxRateStore; | |||||
} | } | ||||
public function getFunctions() | public function getFunctions() | ||||
new TwigFunction('carac_sections', [$this, 'getSections']), | new TwigFunction('carac_sections', [$this, 'getSections']), | ||||
new TwigFunction('carac_merchants', [$this, 'getMerchants']), | new TwigFunction('carac_merchants', [$this, 'getMerchants']), | ||||
new TwigFunction('carac_reminders', [$this, 'getReminders']), | new TwigFunction('carac_reminders', [$this, 'getReminders']), | ||||
new TwigFunction('carac_units', [$this, 'getUnits']), | |||||
new TwigFunction('carac_tax_rates', [$this, 'getTaxRates']), | |||||
); | ); | ||||
} | } | ||||
->get($params); | ->get($params); | ||||
} | } | ||||
public function getUnits(){ | |||||
return $this->unitStore->getAsArray(); | |||||
} | |||||
public function getTaxRates(){ | |||||
return $this->taxRateStore->getAsArray(); | |||||
} | |||||
} | } |