<?php
namespace App\AtechNet\CoreBundle\Controller;
use App\AtechNet\CoreBundle\Entity\Claim;
use App\AtechNet\CoreBundle\Entity\Customer;
use App\AtechNet\CoreBundle\Entity\DocumentGroup;
use App\AtechNet\CoreBundle\Entity\Domain;
use App\AtechNet\CoreBundle\Entity\ErrorCode;
use App\AtechNet\CoreBundle\Entity\Language;
use App\AtechNet\CoreBundle\Entity\Order;
use App\AtechNet\CoreBundle\Entity\OrderPackage;
use App\AtechNet\CoreBundle\Entity\Product;
use App\AtechNet\CoreBundle\Entity\ProductCommission;
use App\AtechNet\CoreBundle\Entity\ProductCommissionAccessory;
use App\AtechNet\CoreBundle\Entity\SeoUrl;
use App\AtechNet\CoreBundle\Entity\Settings;
use App\AtechNet\CoreBundle\Entity\StockItem;
use App\AtechNet\CoreBundle\Entity\StockMovement;
use App\AtechNet\CoreBundle\Entity\User;
use App\AtechNet\CoreBundle\Helper\ActiveCampaignConnect;
use App\AtechNet\CoreBundle\Helper\AmazonSP;
use App\AtechNet\CoreBundle\Helper\BaseLinker;
use App\AtechNet\CoreBundle\Helper\Billingo;
use App\AtechNet\CoreBundle\Helper\Blancco;
use App\AtechNet\CoreBundle\Helper\ClearCache;
use App\AtechNet\CoreBundle\Helper\CloudflareImage;
use App\AtechNet\CoreBundle\Helper\Daktela;
use App\AtechNet\CoreBundle\Helper\DHL;
use App\AtechNet\CoreBundle\Helper\DHL_At;
use App\AtechNet\CoreBundle\Helper\DigitalOceanSpaces;
use App\AtechNet\CoreBundle\Helper\Erste\ErsteHelper;
use App\AtechNet\CoreBundle\Helper\FedEx;
use App\AtechNet\CoreBundle\Helper\Fingera;
use App\AtechNet\CoreBundle\Helper\Furbify\SeoUrlHelper;
use App\AtechNet\CoreBundle\Helper\GLS;
use App\AtechNet\CoreBundle\Helper\GLSDeprecated;
use App\AtechNet\CoreBundle\Helper\Instacash;
use App\AtechNet\CoreBundle\Helper\KlaviyoConnect;
use App\AtechNet\CoreBundle\Helper\LuigisBox;
use App\AtechNet\CoreBundle\Helper\Milpay;
use App\AtechNet\CoreBundle\Helper\OpenAi\ChatGptTranslator;
use App\AtechNet\CoreBundle\Helper\Packeta;
use App\AtechNet\CoreBundle\Helper\PastPay;
use App\AtechNet\CoreBundle\Helper\Paypal;
use App\AtechNet\CoreBundle\Helper\PBH;
use App\AtechNet\CoreBundle\Helper\SquarePay;
use App\AtechNet\CoreBundle\Helper\TatraBanka\TatraBankaHelper;
use App\AtechNet\CoreBundle\Helper\Unas;
use App\AtechNet\CoreBundle\Helper\VUB\VubHelper;
use App\AtechNet\CoreBundle\Service\HistoricalEuroRate;
use App\AtechNet\CoreBundle\Translation\DatabaseTranslator;
use Doctrine\ORM\EntityManager;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Persistence\ObjectManager;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Messenger\MessageBusInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\String\Slugger\SluggerInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use WhiteOctober\BreadcrumbsBundle\Model\Breadcrumbs;
class BaseController extends AbstractController
{
private $requiredRole = null;
public const int CACHE_LIFETIME_1_MINUTE = 60;
public const int CACHE_LIFETIME_2_MINUTES = 120;
public const int CACHE_LIFETIME_3_MINUTES = 180;
public const int CACHE_LIFETIME_15_MINUTES = 900;
public const int CACHE_LIFETIME_30_MINUTES = 1800;
public const int CACHE_LIFETIME_1_HOUR = 3600;
public const int CACHE_LIFETIME_2_HOUR = 7200;
public const int CACHE_LIFETIME_4_HOUR = 14400;
public const int CACHE_LIFTETIME_6_HOURS = 21600;
public const int CACHE_LIFETIME_12_HOURS = 43200;
public const int CACHE_LIFETIME_1_DAY = 86400;
public const int CACHE_LIFETIME_7_DAYS = 604800;
public const int CACHE_LIFETIME_1_MONTH = 2629800;
private string $apiToken = '423235h54gf42154132g541tf45rer4832r24364yrd231rf4tgtf432r3246h324rf36y4fde3r432';
protected ManagerRegistry $doctrine;
protected TranslatorInterface $translator;
protected UrlGeneratorInterface $router;
protected MailerInterface $mailer;
protected HistoricalEuroRate $historicalEuroRate;
protected KernelInterface $kernel;
public function __construct(
ManagerRegistry $doctrine,
TranslatorInterface $translator,
UrlGeneratorInterface $router,
MailerInterface $mailer,
RequestStack $requestStack,
Security $security,
HistoricalEuroRate $historicalEuroRate,
KernelInterface $kernel,
protected readonly CacheItemPoolInterface $cache,
protected readonly MessageBusInterface $messageBus,
private readonly SluggerInterface $sluggerInterface
)
{
$this->doctrine = $doctrine;
$this->translator = $translator;
$this->router = $router;
$this->mailer = $mailer;
$this->requestStack = $requestStack;
$this->security = $security;
$this->historicalEuroRate = $historicalEuroRate;
$this->kernel = $kernel;
}
/**
* @param null $requiredRole
*/
final protected function setRequiredRole($requiredRole = null)
{
$this->requiredRole = $requiredRole;
}
/**
* @return mixed
*/
protected function getSettings()
{
$settings = $this->doctrine->getRepository(Settings::class)->findBy(null, null, 1);
if (count($settings) != 1) {
throw new HttpException('Settings not found!');
}
return $settings[0];
}
/**
* @param $customRole
* @return bool
*/
protected function isAccessGranted($customRole = null): bool
{
if (is_null($customRole)) {
if (is_null($this->requiredRole)) {
return true;
} else {
if ($this->isGranted($this->requiredRole)) {
return true;
}
}
} else {
if ($this->isGranted($customRole)) {
return true;
}
}
throw new AccessDeniedHttpException();
}
/**
* @return void
*/
protected function adminRequired()
{
if (!$this->isAdmin()) {
throw $this->createAccessDeniedException('Only admin can delete this data');
}
}
/**
* @return bool
*/
protected function isAdmin(): bool
{
return $this->isGranted('ROLE_ADMIN');
}
/**
* @return bool
*/
protected function isEmployee(): bool
{
return $this->isGranted('ROLE_EMPLOYEE');
}
/**
* @param Breadcrumbs $breadcrumbs
* @return Breadcrumbs
*/
protected function getBreadcrumbs(Breadcrumbs $breadcrumbs): Breadcrumbs
{
return $breadcrumbs->addItem('Home');
}
/**
* @param int $resultCode
* @param null $content
* @param string $message
* @param array $extraFields
* @return Response
*/
protected function createAjaxResponse(int $resultCode = 0, $content = null, string $message = 'Success!', array $extraFields = []): Response
{
return new Response(json_encode([
'resultCode' => $resultCode,
'message' => $message,
'content' => $content,
] + $extraFields), 200, [
'Content-Type' => 'application/json',
]);
}
/**
* @param array $array
* @param string $method
* @param string $subMethod
* @param mixed $value
* @return bool
* @throws \Exception
*/
protected function checkArrayForEntityWithValue(array $array, string $method, string $subMethod, $value): bool
{
foreach ($array as $entity) {
if (!method_exists($entity, $method)) {
throw new \Exception($method);
};
if ($entity->{$method}() != null) {
if (!method_exists($entity->{$method}(), $subMethod)) {
throw new \Exception($method);
};
}
if ($entity->{$method}() != null) {
if ($entity->{$method}()->{$subMethod}() == $value) {
return true;
}
}
}
return false;
}
/**
* @param $requestArray
* @return string
*/
protected function getAllUrlParameters($requestArray): string
{
$urlParametersString = '';
if (count($requestArray) > 0) {
foreach ($requestArray as $name => $value) {
if ($urlParametersString == '') {
$urlParametersString = '?' . $name . '=' . $value;
} else {
$urlParametersString .= '&' . $name . '=' . $value;
}
}
}
return $urlParametersString;
}
/**
* @return Billingo
*/
protected function getBillingo(): Billingo
{
return new Billingo(
$this->getEntityManager()
);
}
/**
* @return string
*/
public function generateUniqueFileName(): string
{
return md5(uniqid());
}
/**
* @param UploadedFile $file
* @param string $uploadDirectory
* @param array $allowedFileTypes
* @param bool $generateUniqueName
* @return array|false
*/
public function uploadFile(UploadedFile $file, string $uploadDirectory, array $allowedFileTypes = [], bool $generateUniqueName = true)
{
if (count($allowedFileTypes) > 0 && array_search($file->getMimeType(), $allowedFileTypes) === false) {
return false;
}
if ($generateUniqueName) {
$response['filename'] = $this->generateUniqueFileName() . '.' . $file->guessExtension();
} else {
$response['filename'] = $file->getClientOriginalName();
}
$response['originalName'] = $file->getClientOriginalName();
$response['mimeType'] = $file->getMimeType();
$file->move(
'uploads/' . $uploadDirectory,
$response['filename']
);
return $response;
}
/**
* @param array $options
* @param string|null $attachment
* @return void
* @throws TransportExceptionInterface
*/
protected function sendEmail(array $options, ?string $attachment = null)
{
$mailer = $this->getMailer();
$email = (new TemplatedEmail())
->to($options['to'])
->subject($options['subject'])
->html($options['body']);
if (isset($options['bcc'])) {
$email->bcc($options['bcc']);
}
if (isset($options['replyTo'])) {
$email->replyTo($options['replyTo']);
}
if (!is_null($attachment)) {
$email->attachFromPath($options['attachment']);
}
$mailer->send($email);
}
public const string STATISTICS_MANAGER = 'statistics';
public const string CATALOG_MANAGER = 'catalog';
/**
* @param string $connection
*
* @return ObjectManager
*/
protected function getEntityManager(string $connection = 'default'): ObjectManager
{
return $this->doctrine->getManager($connection);
}
/**
* @return ActiveCampaignConnect
*/
protected function getActiveCampaign(): ActiveCampaignConnect
{
$accParameters = $this->getParameter('active_campaign');
return new ActiveCampaignConnect(
$this->getEntityManager(),
$accParameters['url'],
$accParameters['api_key']
);
}
/**
* DigitalOcean Space Connection
*
* @return DigitalOceanSpaces
*/
public function getDigitalOceanSpace(): DigitalOceanSpaces
{
$config = $this->getParameter('digital_ocean_space');
return (new DigitalOceanSpaces($config['access_key'], $config['secret_key']));
}
/**
* @return GLS
* @throws \Exception
* @var Order|Claim $entity
*/
public function getGls($entity): GLS
{
$glsCredentials = $this->getParameter('gls');
return new GLS(
$entity,
$glsCredentials,
$this->getEntityManager(),
$this->kernel->getEnvironment()
);
}
/**
* @param Order $order
* @return GLSDeprecated
* @throws \Exception
*/
public function getGlsDeprecated(Order $order): GLSDeprecated
{
$glsCredentials = $this->getParameter('gls');
return new GLSDeprecated($order, $glsCredentials['pass_ac_sk_deprecated'], $glsCredentials['pass_ac_hu_deprecated'], $glsCredentials['pass_bazos_deprecated']);
}
/**
* @param int $type
* @return DHL
*/
public function getDhl(int $type = OrderPackage::CARRIER_DHL_AIR): DHL
{
$dhlCredentials = $this->getParameter('dhl');
return new DHL(
$dhlCredentials['username'],
$dhlCredentials['pass'],
$dhlCredentials['account_number'][$type],
$this->getEntityManager(),
$this->kernel->getEnvironment()
);
}
/**
* @param int $type
* @return FedEx
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
*/
public function getFedEx(int $type = OrderPackage::CARRIER_FEDEX_AIR): FedEx
{
$fedExCredentials = $this->getParameter('fedex');
return new FedEx(
$fedExCredentials['client_id'],
$fedExCredentials['client_secret'],
$fedExCredentials['account_number'],
$this->getEntityManager(),
$this->kernel->getEnvironment()
);
}
protected function getDhlAt()
{
$credentials = $this->getParameter('dhl_at')[$this->kernel->getEnvironment()];
$trackingKey = $this->getParameter('dhl_tracking')['key'];
return new DHL_At($credentials, $trackingKey, $this->getEntityManager(), $this->kernel->getEnvironment());
}
/**
* @param Request $request
* @param string $pageTitle
* @param string $query
* @param int $languageId
* @param Domain|null $domain
* @param bool $flush
* @return SeoUrl
*/
public function createSeoUrl(Request $request, string $pageTitle, string $query, int $languageId, Domain $domain = null, bool $flush = true): ?SeoUrl
{
$entityManager = $this->getEntityManager();
$seoUrlHelper = new SeoUrlHelper($entityManager, $request);
$domainId = 1;
if ($domain) {
$domainId = $domain->getId();
}
$keyword = $seoUrlHelper->createUniqueSlug($pageTitle, $query, $languageId, $domainId);
$findOneByArray = [
'language' => $languageId,
'keyword' => $keyword,
];
if (strpos($query, 'product_id=') === false) {
$findOneByArray['domain'] = $domainId;
}
$duplicateLangKeywordUrl = $entityManager->getRepository(SeoUrl::class)->findOneBy($findOneByArray);
$seoUrl = null;
if (!$duplicateLangKeywordUrl) { // if lang + keyword pair exists, dont continue
$findOneByArray = [
'language' => $languageId,
'query' => $query,
];
if (strpos($query, 'product_id=') === false) {
$findOneByArray['domain'] = $domainId;
$findOneByArray['archived'] = 0;
} else {
$findOneByArray['archived'] = 0;
}
$duplicateLangQueryUrl = $entityManager->getRepository(SeoUrl::class)->findOneBy($findOneByArray);
if ($duplicateLangQueryUrl) { // if lang + query pair exists, remove it
$entityManager->remove($duplicateLangQueryUrl);
}
$language = $entityManager->getRepository(Language::class)->findOneById($languageId);
$seoUrl = new SeoUrl();
$seoUrl->setLanguage($language);
$seoUrl->setQuery($query);
$seoUrl->setKeyword($keyword);
if ($domain) {
$seoUrl->setDomain($domain);
}
$entityManager->persist($seoUrl);
if ($flush) {
$entityManager->flush();
}
} elseif (strpos($query, 'product_id=') !== false || strpos($query, 'category_id=') !== false || strpos($query, 'blog_id=') !== false || strpos($query, 'static_id=') !== false) {
if ($duplicateLangKeywordUrl->getQuery() == $query) {
$duplicateLangKeywordUrl->setArchived(false);
}
}
return $seoUrl;
}
/**
* @return array
*/
public function getAvailableDomainLanguageIdsForWeb(): array
{
// Domain ID => Language ID
return [
1 => 1,
3 => 2,
9 => 3,
7 => 4,
11 => 4,
];
}
/**
* @param string $stringDateTime
* @return \DateTime
*/
protected function stringToDateTime(string $stringDateTime): \DateTime
{
$stringDateTime = explode('-', $stringDateTime);
return (new \DateTime())->setDate($stringDateTime[0], $stringDateTime[1], $stringDateTime[2]);
}
/**
* @param Product $product
* @return bool
*/
protected function clearFurbifyProductCache(Product $product): bool
{
return ClearCache::furbifyProduct($product);
}
/**
* @param array $productIds
* @return void
*/
protected function clearFurbifyProductsCache(array $productIds): void
{
ClearCache::furbifyProducts($productIds);
}
/**
* @param string $cacheKey
* @return bool
* @throws \Psr\Cache\InvalidArgumentException
*/
protected function removeCacheByKey(string $cacheKey): bool
{
return $this->cache->deleteItem($cacheKey);
}
public function removeMenuCacheForUser(User $user): void
{
$this->cache->deleteItem($user->getMenuCacheKey());
}
/**
* @return mixed
*/
protected function getWebsiteDomains()
{
return $this->getCreateQuery("SELECT d FROM AtechNetCoreBundle:Domain d WHERE d.id IN (" . implode(',', Domain::DOMAINS_WITH_WEBSITE) . ")")->getResult();
}
/**
* @return array
*/
protected function getPriceChangeStepsByCurrency(): array
{
return [
'€' => 0.01,
'Ft' => 10,
'Kč' => 1,
];
}
/**
* @param $errorCodes
* @param string $lang
* @return array
*/
protected function errorCodesToErrorText($errorCodes, string $lang = 'HU'): array
{
$errorCodeRepo = $this->getEntityManager()->getRepository(ErrorCode::class);
$errorCodeTexts = [];
$errorCodes = explode(' ', $errorCodes);
foreach ($errorCodes as $errorCode) {
$errorCodeEntity = $errorCodeRepo->findOneByCode($errorCode);
if ($errorCodeEntity) {
$errorCodeTexts[] = $errorCodeEntity->getTextForLanguage($lang);
} else {
$errorCodeTexts[] = $errorCode;
}
}
return $errorCodeTexts;
}
/**
* @param Order $order
* @param Product $product
* @param StockItem|null $si
* @param StockMovement|null $sm
* @param ProductCommission|null $parenCommission
* @param bool $isContainer
* @return ProductCommission
*/
protected function createProductCommission(
Order $order,
Product $product,
StockItem $si = null,
StockMovement $sm = null,
ProductCommission $parenCommission = null,
bool $isContainer = false
): ProductCommission {
$productCommission = new ProductCommission();
$productCommission->setProduct($product);
$productCommission->setParent($parenCommission);
$productCommission->setCustomer($order->getCustomer());
$productCommission->setSerialNumber(!is_null($si) ? $si->getSerialNumber() : '');
$productCommission->setAikenCode(!is_null($si) ? $si->getAikenCode() : '');
$productCommission->setStatus(ProductCommission::Status_AtPartner);
$productCommission->setStockMovement($sm);
$productCommission->setCreatedBy($this->getUser());
$productCommission->setContainer($isContainer);
$this->getEntityManager()->persist($productCommission);
return $productCommission;
}
/**
* @param ProductCommission $productCommission
* @param Product $product
* @param StockMovement $stockMovement
*/
public function createProductCommissionAccessory(ProductCommission $productCommission, Product $product, StockMovement $stockMovement)
{
$productCommissionAccessory = new ProductCommissionAccessory();
$productCommissionAccessory->setProductCommission($productCommission);
$productCommissionAccessory->setProduct($product);
$productCommissionAccessory->setStockMovement($stockMovement);
$this->getEntityManager()->persist($productCommissionAccessory);
}
/**
* @return mixed
*/
protected function getCentralisUser()
{
return $this->getEntityManager()->getRepository(User::class)->findOneById(40);
}
/**
* @return mixed
*/
protected function getPaymentApproverUsers()
{
return $this->getEntityManager()
->createQuery("SELECT u
FROM AtechNetCoreBundle:User u
LEFT JOIN AtechNetCoreBundle:Customer c WITH c.paymentApprover = u
WHERE c.paymentApprover IS NOT NULL
GROUP BY u.id")
->getResult();
}
/**
* @return array
*/
protected function getPaymentApproverUserIDs(): array
{
$paymentApproverUserIDs = [];
foreach ($this->getPaymentApproverUsers() as $user) {
$paymentApproverUserIDs[] = $user->getId();
}
return $paymentApproverUserIDs;
}
/**
* To refresh menu cache manually, add "refresh-menu-cache" url parameter to the request
* @param Request $request
* @return Response
* @throws \Psr\Cache\InvalidArgumentException
*/
public function getMenuAction(Request $request): Response
{
$currentRoute = $request->get('_route');
$currentUser = $this->getUser();
if (!$currentUser instanceof User) {
throw new HttpException('Please log in!');
}
$userId = $currentUser->getId();
$navigation = [];
$cacheKey = $currentUser->getMenuCacheKey();
$cacheItem = $this->cache->getItem($cacheKey);
if ( $cacheItem->isHit() && !$request->query->has('refresh-menu-cache') ) {
return $this->render('AtechNetCoreBundle/Default/menu.html.twig', [
'current_route' => $currentRoute,
'navigation' => $cacheItem->get(),
]);
}
//Orders
if ($this->checkPermission(User::PERMISSION_LIST, User::MODULE_ORDER)) {
$navigation['order'] = [
'name' => 'Orders',
'route' => 'atech_net_core_order_list',
'icon' => 'glyphicon glyphicon-eur',
];
$navigation['order']['menu'][] = [
'name' => 'Orders',
'route' => 'atech_net_core_order_list',
'icon' => 'glyphicon glyphicon-eur',
'submenu' => [
[
'name' => 'Open',
'route' => 'atech_net_core_order_list',
'params' => [
'status' => Order::STATUS_OPEN,
],
],
[
'name' => 'Triage',
'route' => 'atech_net_core_order_list',
'params' => [
'status' => Order::STATUS_TRIAGE,
],
],
[
'name' => 'Waiting for partner',
'route' => 'atech_net_core_order_list',
'params' => [
'status' => Order::STATUS_WAITING_FOR_PARTNER,
],
],
[
'name' => 'Waiting for production',
'route' => 'atech_net_core_order_list',
'params' => [
'status' => Order::STATUS_WAITING_FOR_PRODUCTION,
],
],
[
'name' => 'Processable',
'route' => 'atech_net_core_order_list',
'params' => [
'status' => Order::STATUS_PROCESSABLE,
],
],
[
'name' => 'Waiting for answer',
'route' => 'atech_net_core_order_list',
'params' => [
'status' => Order::STATUS_WAITING_FOR_ANSWER,
],
],
[
'name' => 'Processing',
'route' => 'atech_net_core_order_list',
'params' => [
'status' => Order::STATUS_PROCESSING,
],
],
[
'name' => 'Ready to pack',
'route' => 'atech_net_core_order_list',
'params' => [
'status' => Order::STATUS_READY_TO_PACK,
],
],
[
'name' => 'Ready to ship',
'route' => 'atech_net_core_order_list',
'params' => [
'status' => Order::STATUS_READY_TO_SHIP,
],
],
[
'name' => 'Finished',
'route' => 'atech_net_core_order_list',
'params' => [
'status' => Order::STATUS_FINISHED,
],
],
[
'name' => 'Canceled',
'route' => 'atech_net_core_order_list',
'params' => [
'status' => Order::STATUS_CANCELED,
],
],
],
];
if ($this->checkPermission(User::PERMISSION_CREATE, User::MODULE_ORDER)) {
$navigation['order']['menu'][] = [
'name' => 'Add new order',
'route' => 'atech_net_core_order_new',
'icon' => 'glyphicon glyphicon-plus',
];
}
if ($this->checkPermission(User::PERMISSION_STATS, User::MODULE_ORDER)) {
$navigation['order']['menu'][] = [
'name' => 'Stats',
'route' => 'atech_net_core_order_stats',
'icon' => 'glyphicon glyphicon-signal',
];
}
if ($this->checkPermission(User::PERMISSION_BASKET, User::MODULE_ORDER)) {
$navigation['order']['menu'][] = [
'name' => 'Baskets',
'route' => 'atech_net_core_basket_list',
'icon' => 'glyphicon glyphicon-shopping-cart',
];
}
if ($this->checkPermission(User::PERMISSION_PACKAGE_HANDOVER, User::MODULE_ORDER)) {
$navigation['order']['menu'][] = [
'name' => 'Handover',
'route' => 'atech_net_core_order_package_handover',
'icon' => 'glyphicon glyphicon-check',
];
}
}
//Products
if ($this->checkPermission(User::PERMISSION_LIST, User::MODULE_PRODUCT)) {
$navigation['products'] = [
'name' => 'Products',
'route' => 'atech_net_core_product_search',
'icon' => 'glyphicon glyphicon-hdd',
];
$navigation['products']['menu'][] = [
'name' => 'All PCs in stock',
'route' => 'atech_net_core_product_all_list',
'params' => [
'product_type[]' => 60,
'in_stock' => 1,
],
];
$navigation['products']['menu'][] = [
'name' => 'All notebooks in stock',
'route' => 'atech_net_core_product_all_list',
'params' => [
'product_type[]' => 52,
'in_stock' => 1,
],
];
$navigation['products']['menu'][] = [
'name' => 'All monitors in stock',
'route' => 'atech_net_core_product_all_list',
'params' => [
'product_type[]' => 44,
'in_stock' => 1,
],
];
$navigation['products']['menu'][] = [
'name' => 'All smartphones',
'route' => 'atech_net_core_product_all_list',
'params' => [
'product_type[]' => 41,
'in_stock' => 1,
],
];
$navigation['products']['menu'][] = [
'name' => 'All AIO in stock',
'route' => 'atech_net_core_product_all_list',
'params' => [
'product_type[]' => 116,
'in_stock' => 1,
],
];
$navigation['products']['menu'][] = [
'name' => 'All SSD in stock',
'route' => 'atech_net_core_product_all_list',
'params' => [
'product_type[]' => 85,
'in_stock' => 1,
],
];
if ($this->checkPermission(User::PERMISSION_CREATE, User::MODULE_PRODUCT)) {
$navigation['products']['menu'][] = [
'name' => 'Add new product',
'route' => 'atech_net_core_product_new',
];
}
$navigation['products']['menu'][] = [
'name' => 'Search',
'route' => 'atech_net_core_product_search',
'icon' => 'glyphicon glyphicon-search',
];
if ($this->checkPermission(User::PERMISSION_PRODUCT_MODEL, User::MODULE_PRODUCT)) {
$navigation['products']['menu'][] = [
'name' => 'Product models',
'route' => 'product_model',
];
}
if ($this->checkPermission(User::PERMISSION_PRODUCT_VARIATION, User::MODULE_PRODUCT)) {
$navigation['products']['menu'][] = [
'name' => 'Product variations',
'route' => 'atech_net_core_product_variations',
];
}
$navigation['products']['menu'][] = [
'name' => 'Product types',
'route' => 'product_type',
];
if ($this->checkPermission(User::PERMISSION_OLD_ITEMS, User::MODULE_PRODUCT)) {
$navigation['products']['menu'][] = [
'name' => 'Old items on stock',
'route' => 'atech_net_core_product_stock_item_age',
];
}
if ($this->checkPermission(User::PERMISSION_VENDOR, User::MODULE_PRODUCT)) {
$navigation['products']['menu'][] = [
'name' => 'Vendor',
'route' => 'atech_net_core_vendor',
];
}
if ($this->checkPermission(User::PERMISSION_PRODUCT_PRICE_MONITOR, User::MODULE_PRODUCT)) {
$navigation['products']['menu'][] = [
'name' => 'Price monitor',
'route' => 'atech_net_core_price_monitor',
];
}
if ($this->checkPermission(User::PERMISSION_GENERATE_PRODUCT_OFFER_EMAIL, User::MODULE_PRODUCT)) {
$navigation['products']['menu'][] = [
'name' => 'Offer email create',
'route' => 'atech_net_core_product_create_offer_email',
];
}
if ($this->checkPermission(User::PERMISSION_PRODUCT_LAST_SALE, User::MODULE_PRODUCT)) {
$navigation['products']['menu'][] = [
'name' => 'Last sales',
'route' => 'list_products_recent_sales',
];
}
if ($this->checkPermission(User::PERMISSION_PRODUCT_SPARE_PARTS, User::MODULE_PRODUCT)) {
$navigation['products']['menu'][] = [
'name' => 'Spare part prices',
'route' => 'product_spare_parts',
];
}
$productExportSubMenu = [];
if ($this->checkPermission(User::PERMISSION_PRODUCT_EXPORT, User::MODULE_PRODUCT)) {
$productExportSubMenu[] = [
'name' => 'Products',
'route' => 'atech_net_core_product_export',
'params' => [
'type' => 'normal',
],
];
$productExportSubMenu[] = [
'name' => 'Stock items with new battery',
'route' => 'atech_net_core_stock_items_new_battery_export',
'params' => [
'type' => 'normal',
],
];
$productExportSubMenu[] = [
'name' => 'Connected products',
'route' => 'connected_products_csv_export',
'params' => [
'type' => 'normal',
],
];
$productExportSubMenu[] = [
'name' => 'Product model connected products' ,
'route' => 'export_product_model_connected_products',
'params' => [
'type' => 'normal',
],
];
$productExportSubMenu[] = [
'name' => 'Available main products',
'route' => 'atech_net_core_product_list_export',
'params' => [
'exportable' => 'all-main-products',
],
];
}
if ($this->checkPermission(User::PERMISSION_EXPORT_NOTEBOOK_PARTS_FROM_SHIPMENTS, User::MODULE_PRODUCT)) {
$productExportSubMenu[] = [
'name' => 'Notebook parts from shipments',
'route' => 'atech_net_core_product_and_parts_export',
'params' => [
'type' => 'normal',
],
];
}
if ($this->checkPermission( User::PERMISSION_EXPORT_SHIPMENTS, User::MODULE_STOCK_MOVEMENT)) {
$productExportSubMenu[] = [
'name' => 'Export shipments',
'route' => 'atech_net_core_shipment_export',
'params' => [
'type' => 'normal',
],
];
}
if ($this->checkPermission(User::PERMISSION_PRODUCT_EXPORT_PAYMENT_STATS, User::MODULE_PRODUCT)) {
$productExportSubMenu[] = [
'name' => 'Export payment type stats',
'route' => 'atech_net_core_product_export_payment_stats',
];
}
if ($this->checkPermission(User::PERMISSION_PRODUCT_EXPORT_VIEW, User::MODULE_PRODUCT)) {
$productExportSubMenu[] = [
'name' => 'by centralis codes',
'route' => 'atech_net_core_product_export_by_codes',
];
}
if ($this->checkPermission(User::PERMISSION_EXPORT_NOT_LISTED_PRODUCT, User::MODULE_PRODUCT)) {
$productExportSubMenu[] = [
'name' => 'Not listed products',
'route' => 'atech_net_core_export_not_listed_product',
];
}
if ($this->checkPermission(User::PERMISSION_EXPORT_QUARANTINE_SERIALS, User::MODULE_PRODUCT)) {
$productExportSubMenu[] = [
'name' => 'Quarantine serial numbers',
'route' => 'atech_net_core_product_export_quarantine_serial_numbers',
];
}
if (\count($productExportSubMenu) > 0) {
$navigation['products']['menu'][] = [
'name' => 'Export',
'link' => '#',
'icon' => 'glyphicon glyphicon-export',
'submenu' => $productExportSubMenu,
];
}
$productImportSubMenu = [];
if ($this->checkPermission(User::PERMISSION_PRICE_IMPORT, User::MODULE_PRODUCT)) {
$productImportSubMenu[] = [
'name' => 'Product price import',
'route' => 'import_product_prices',
];
}
if ($this->checkPermission(User::PERMISSION_PRODUCT_MODEL_CONNECTED_PRODUCT_IMPORT, User::MODULE_PRODUCT)) {
$productImportSubMenu[] = [
'name' => 'Product model connection import',
'route' => 'import_product_model_connected_products',
];
}
if ($this->checkPermission(User::PERMISSION_MARGIN_IMPORT, User::MODULE_PRODUCT)) {
$productImportSubMenu[] = [
'name' => 'Margin level import',
'route' => 'import_product_margin',
];
}
if (\count($productImportSubMenu) > 0) {
$navigation['products']['menu'][] = [
'name' => 'Import',
'link' => '#',
'icon' => 'glyphicon glyphicon-import',
'submenu' => $productImportSubMenu,
];
}
}
// Customers
if ($this->checkPermission(User::PERMISSION_LIST, User::MODULE_CUSTOMER)) {
$navigation['customers'] = [
'name' => 'Customers',
'route' => 'atech_net_core_customer',
'icon' => 'glyphicon glyphicon-sunglasses',
];
}
if ($this->checkPermission(User::PERMISSION_CUSTOMER_FEED_LIST, User::MODULE_CUSTOMER)) {
$navigation['customers']['menu'][] = [
'name' => 'Customer feed list',
'route' => 'atech_net_core_customer_feed_list',
];
}
if ($this->checkPermission(User::PERMISSION_ROUTE_PLANNER, User::MODULE_CUSTOMER)) {
$navigation['customers']['menu'][] = [
'name' => 'Route planner',
'route' => 'atech_net_core_customer_route_planner',
];
}
if ($this->checkPermission(User::PERMISSION_CUSTOMER_CALLBACK, User::MODULE_CUSTOMER)) {
$navigation['customers']['menu'][] = [
'name' => 'Callbacks',
'route' => 'atech_net_core_customer_callbacks',
];
}
//> Statistics
// Sales Manager's Statistics
if (
$this->checkPermission(User::PERMISSION_SALES_MANAGER_STATISTIC, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_INCOME_STATISTIC, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_STOCK_MOVEMENTS_STATISTIC, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_STOCK_STATUS_STATISTIC, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_COMMITMENTS_RECEIVABLES_STATISTIC, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_DAYS_IN_STOCK_STATISTIC, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_QUALITY_STATUS_STATISTIC, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_PRODUCTS_STATISTIC, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_PRODUCT_SALES_STATISTIC, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_CUSTOMERS_STATISTIC, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_ONLINE_STOCK_STATISTIC, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_GUESTS_STATISTIC, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_OLD_STOCK_ITEM_STATISTIC, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_STATISTIC_CREDIT_NOTE_VALUES, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_CLAIM_STATISTIC, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_PACKAGES, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_STATISTIC_STOCK_POSITION, User::MODULE_STATISTIC)
&& !$this->checkPermission(User::PERMISSION_STATISTIC_STOCK_REQUEST_TIMES, User::MODULE_STATISTIC)
) {
$navigation['statistics'] = [
'name' => 'Statistics',
'route' => 'stock_movement_statistics',
'icon' => 'glyphicon glyphicon-signal',
'params' => [
'tab' => 'salesManagers',
],
];
} else {
$statisticsSubmenu = [];
if ( $this->checkPermission(User::PERMISSION_INCOME_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Income',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'income',
],
];
}
if ( $this->checkPermission(User::PERMISSION_SALES_MANAGER_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Sales manager',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'salesManagers',
],
];
}
if ( $this->checkPermission(User::PERMISSION_SALES_MANAGER_PARTNER_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Sales manager partner',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'salesManagerPartners',
],
];
}
if ( $this->checkPermission(User::PERMISSION_STOCK_MOVEMENTS_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Stock movements',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'stockMovements',
],
];
$statisticsSubmenu[] = [
'name' => 'Single Position Statistics',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'positionStatistics',
],
];
}
if ( $this->checkPermission(User::PERMISSION_STOCK_STATUS_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Stock status',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'stockStatus',
],
];
}
if ( $this->checkPermission(User::PERMISSION_COMMITMENTS_RECEIVABLES_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Commitments',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'commitmentsReceivables',
],
];
}
if ( $this->checkPermission(User::PERMISSION_DAYS_IN_STOCK_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Days in stock',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'daysInStock',
],
];
$statisticsSubmenu[] = [
'name' => 'Stock position stats',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'positionStatistics',
],
];
}
if ( $this->checkPermission(User::PERMISSION_QUALITY_STATUS_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Quality status',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'qualityStatus',
],
];
}
if ( $this->checkPermission(User::PERMISSION_PRODUCTS_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Products',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'products',
],
];
}
if ( $this->checkPermission(User::PERMISSION_PRODUCT_SALES_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Product sales',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'productSales',
],
];
}
if ( $this->checkPermission(User::PERMISSION_CUSTOMERS_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Customers',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'customers',
],
];
}
if ( $this->checkPermission(User::PERMISSION_ONLINE_STOCK_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Online stock',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'onlineStock',
],
];
}
if ( $this->checkPermission(User::PERMISSION_GUESTS_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Guests',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'guests',
],
];
}
if ( $this->checkPermission(User::PERMISSION_OLD_STOCK_ITEM_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Old stock items',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'oldStockItems',
],
];
}
if ( $this->checkPermission(User::PERMISSION_CLAIM_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Claim basic',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'claimBasic',
],
];
}
if ( $this->checkPermission(User::PERMISSION_CLAIM_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Claim',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'claim',
],
];
}
if ( $this->checkPermission(User::PERMISSION_STATISTIC_CREDIT_NOTE_VALUES, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Credit note values',
'route' => 'statistics_credit_note_value',
];
}
if ( $this->checkPermission(User::PERMISSION_ORDER_STATUS_CHANGELOG_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Order status changelog',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'orderStatusChangelog',
],
];
}
if ( $this->checkPermission(User::PERMISSION_ORDER_PRODUCT_CHANGELOG_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Order product changelog',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'orderProductChangelog',
],
];
}
if ( $this->checkPermission(User::PERMISSION_ORDER_ERROR_COMMENT_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Order error comment list',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'orderErrorCommentList',
],
];
}
if ( $this->checkPermission(User::PERMISSION_PACKAGES, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Packages',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'packages',
],
];
}
if ( $this->checkPermission(User::PERMISSION_STATISTIC_STOCK_POSITION, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Stock Position',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'stockPosition',
],
];
}
if ( $this->checkPermission(User::PERMISSION_STATISTIC_STOCK_REQUEST_TIMES, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Stock request times',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'stockRequestTimes',
],
];
}
if ( $this->checkPermission(User::PERMISSION_RAKTAR_AND_KALODA_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Raktar & Kaloda positioning',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'raktarAndKaloda',
],
];
}
if ( $this->checkPermission(User::PERMISSION_MARKETPLACE_LISTINGS, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Marketplace listings',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'marketplaceListings',
],
];
}
if ( $this->checkPermission(User::PERMISSION_NOTEBOOK_BATTERY_SKIN_STATISTICS, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Notebook Battery Skin Statistics',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'notebookBatterySkinStats',
],
];
}
if ( $this->checkPermission(User::PERMISSION_PROCESSING_STATISTIC, User::MODULE_STATISTIC) ) {
$statisticsSubmenu[] = [
'name' => 'Avg time on position',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'avgTimeOnPosition',
],
];
$statisticsSubmenu[] = [
'name' => 'Product time on position',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'productTimeOnPosition',
],
];
$statisticsSubmenu[] = [
'name' => 'Avg time by user on position',
'route' => 'stock_movement_statistics',
'params' => [
'tab' => 'avgTimeByUsersOnPosition',
],
];
}
if ( $statisticsSubmenu ) {
$navigation['statistics'] = [
'name' => 'Statistics',
'link' => '#',
'icon' => 'glyphicon glyphicon-signal',
'menu' => $statisticsSubmenu,
];
}
}
//< Statistics
//Documents
if ($userId == User::HUN_ACCOUNTANT_ID) { // Wildcard check
$navigation['documents'] = [
'name' => 'Documents',
'route' => 'document',
'params' => [
'type' => DocumentGroup::TYPE_INVOICE_OUT,
],
'icon' => 'glyphicon glyphicon-duplicate',
];
$navigation['documents']['menu'][] = [
'name' => 'Billingo documents',
'route' => 'billingo_document_list',
];
}
else if ($this->checkPermission(User::PERMISSION_LIST, User::MODULE_DOCUMENT)) {
$navigation['documents'] = [
'name' => 'Documents',
'route' => 'document',
'params' => [
'type' => DocumentGroup::TYPE_INVOICE_OUT,
],
'icon' => 'glyphicon glyphicon-duplicate',
];
$navigation['documents']['menu'][] = [
'name' => 'Pre invoices',
'route' => 'document',
'params' => [
'type' => DocumentGroup::TYPE_INVOICE_PRE,
],
];
if ($this->checkPermission(User::PERMISSION_INVOICE_IN_TYPE, User::MODULE_DOCUMENT) || in_array($userId, $this->getPaymentApproverUserIDs())) {
$navigation['documents']['menu'][] = [
'name' => 'In invoices',
'route' => 'document',
'params' => [
'type' => DocumentGroup::TYPE_INVOICE_IN,
],
];
}
$navigation['documents']['menu'][] = [
'name' => 'Out invoices',
'route' => 'document',
'params' => [
'type' => DocumentGroup::TYPE_INVOICE_OUT,
],
];
$navigation['documents']['menu'][] = [
'name' => 'Credit notes',
'route' => 'document',
'params' => [
'type' => DocumentGroup::TYPE_INVOICE_CREDIT_NOTE,
],
];
$navigation['documents']['menu'][] = [
'name' => 'Bills of delivery',
'route' => 'document',
'params' => [
'type' => DocumentGroup::TYPE_BILL_OF_DELIVERY,
],
];
$navigation['documents']['menu'][] = [
'name' => 'Price offers',
'route' => 'document',
'params' => [
'type' => DocumentGroup::TYPE_PRICE_OFFER,
],
];
if ($this->checkPermission(User::PERMISSION_PAYMENTS, User::MODULE_DOCUMENT)) {
$navigation['documents']['menu'][] = [
'name' => 'Payments',
'route' => 'payment',
'icon' => 'glyphicon glyphicon-import',
];
}
$navigation['documents']['menu'][] = [
'name' => 'Document Groups',
'route' => 'document_groups',
];
if ($this->checkPermission(User::PERMISSION_BILLINGO_DOCUMENTS, User::MODULE_DOCUMENT)) {
$navigation['documents']['menu'][] = [
'name' => 'Billingo documents',
'route' => 'billingo_document_list',
];
}
if ($this->checkPermission(User::PERMISSION_SOLD_GOODS_FROM_SK_TO_HU, User::MODULE_DOCUMENT)) {
$navigation['documents']['menu'][] = [
'name' => 'Sold goods SK to HU',
'route' => 'document_filter_sold_goods_from_sk_to_hu',
];
}
if ($this->checkPermission(User::PERMISSION_EXCHANGE_RATES, User::MODULE_DOCUMENT)) {
$navigation['documents']['menu'][] = [
'name' => 'Exchange rates',
'route' => 'document_exchange_rates',
];
}
$documentExportSubMenu = [];
$documentExportSubMenu[] = [
'name' => 'Artisjus product export',
'route' => 'document_artisjus',
'icon' => 'glyphicon glyphicon-equalizer',
];
$documentExportSubMenu[] = [
'name' => 'EPR product export',
'route' => 'document_epr',
'icon' => 'glyphicon glyphicon-equalizer',
];
$documentExportSubMenu[] = [
'name' => 'KSH product export',
'route' => 'document_ksh',
'icon' => 'glyphicon glyphicon-equalizer',
];
$documentExportSubMenu[] = [
'name' => 'Adattörlő XML',
'route' => 'document_adattorlo_xml_export',
'icon' => 'glyphicon glyphicon-equalizer',
];
$documentExportSubMenu[] = [
'name' => 'Data erase code export',
'route' => 'document_data_erase_code_export',
'icon' => 'glyphicon glyphicon-equalizer',
];
if ($this->checkPermission(User::PERMISSION_DOCUMENT_EXPORT, User::MODULE_DOCUMENT)) {
$documentExportSubMenu[] = [
'name' => 'Document export',
'route' => 'document_export',
'icon' => 'glyphicon glyphicon-save-file',
];
}
if ($this->checkPermission(User::PERMISSION_POHODA_EXPORT, User::MODULE_DOCUMENT)) {
$documentExportSubMenu[] = [
'name' => 'Pohoda export',
'route' => 'document_export_xml_to_pohoda_admin',
];
}
if ($this->checkPermission(User::PERMISSION_DEBIT_CARD_EXPORT, User::MODULE_ORDER)) {
$documentExportSubMenu[] = [
'name' => 'Debit card orders',
'route' => 'atech_net_core_order_debit_card_export',
];
}
if ($this->checkPermission(User::PERMISSION_ARTISJUS_LABEL_EXPORT, User::MODULE_ORDER)) {
$documentExportSubMenu[] = [
'name' => 'Artisjus label export',
'route' => 'atech_net_core_artisjus_label_export',
];
}
if ($this->checkPermission(User::PERMISSION_FOREIGN_SALES_EXPORT, User::MODULE_DOCUMENT)) {
$documentExportSubMenu[] = [
'name' => 'Foreign sales export',
'route' => 'document_export_foreign_sales_admin',
];
}
if ($this->checkPermission(User::PERMISSION_POHODA_EXPORT, User::MODULE_DOCUMENT)) {
$documentExportSubMenu[] = [
'name' => 'Convert Raiffeisen to Pohoda',
'route' => 'document_convert_raiffeisen_to_pohoda_admin',
];
}
if (count($documentExportSubMenu) > 0) {
$navigation['documents']['menu'][] = [
'name' => 'Export',
'link' => '#',
'icon' => 'glyphicon glyphicon-export',
'submenu' => $documentExportSubMenu,
];
}
$documentImportSubMenu = [];
if ($this->checkPermission(User::PERMISSION_STATISTIC_CREDIT_NOTE_VALUES, User::MODULE_STATISTIC)) {
$documentImportSubMenu[] = [
'name' => 'Import Amazon CN',
'route' => 'statistics_credit_note_value_import',
'icon' => 'glyphicon glyphicon-import',
];
}
if (count($documentImportSubMenu) > 0) {
$navigation['documents']['menu'][] = [
'name' => 'Import',
'link' => '#',
'icon' => 'glyphicon glyphicon-import',
'submenu' => $documentImportSubMenu,
];
}
}
//Other
$otherMenu = [];
if ($this->checkPermission(User::PERMISSION_ACCESS_LOG, User::MODULE_OTHER)) {
$otherMenu[] = [
'name' => 'Access log',
'route' => 'atech_net_core_access_log',
'icon' => 'glyphicon glyphicon-lock',
];
}
if ($this->checkPermission(User::PERMISSION_ERROR_CODES, User::MODULE_OTHER)) {
$otherMenu[] = [
'name' => 'Aiken error codes',
'route' => 'error_codes_index',
];
}
if ($this->checkPermission(User::PERMISSION_ATTRIBUTES, User::MODULE_PRODUCT)) {
$otherMenu[] = [
'name' => 'Attribute Options',
'route' => 'atech_net_core_attribute_option_list',
];
}
if ($this->checkPermission(User::PERMISSION_AUTOMATIZATIONS, User::MODULE_OTHER)) {
$otherMenu[] = [
'name' => 'Automatizations',
'route' => 'atech_net_core_automatizations',
];
}
$otherMenu[] = [
'name' => 'Gallery',
'route' => 'atech_net_core_gallery',
];
if (
($this->checkPermission(User::PERMISSION_COMMISSION, User::MODULE_ORDER) ||
$this->checkPermission(User::PERMISSION_QUANTITY, User::MODULE_ORDER) ||
$this->checkPermission(User::PERMISSION_SHIPPING_METHOD, User::MODULE_ORDER) ||
$this->checkPermission(User::PERMISSION_PAYMENT_METHOD, User::MODULE_ORDER) ||
$this->checkPermission(User::PERMISSION_PICKUP_POINT, User::MODULE_ORDER) ||
$this->checkPermission(User::PERMISSION_MARKETPLACE_API, User::MODULE_ORDER) ||
$this->checkPermission(User::PERMISSION_ORDER_EXPORT, User::MODULE_ORDER)) &&
!array_key_exists('order', $navigation)
) {
$navigation['order'] = [
'name' => 'Orders',
'route' => 'atech_net_core_order_list',
'icon' => 'glyphicon glyphicon-eur',
];
}
if ($this->checkPermission(User::PERMISSION_COMMISSION, User::MODULE_ORDER)) {
$navigation['order']['menu'][] = [
'name' => 'Commissions',
'route' => 'atech_net_core_product_commission',
'icon' => 'glyphicon glyphicon-transfer',
];
}
if ($this->checkPermission(User::PERMISSION_QUANTITY, User::MODULE_ORDER)) {
$navigation['order']['menu'][] = [
'name' => 'Sold quantity',
'route' => 'atech_net_core_order_sold_quantity',
];
}
if ($this->checkPermission(User::PERMISSION_SHIPPING_METHOD, User::MODULE_ORDER)) {
$navigation['order']['menu'][] = [
'name' => 'Shipping methods',
'route' => 'module_shipping_methods',
'icon' => 'glyphicon glyphicon-road',
];
}
if ($this->checkPermission(User::PERMISSION_PAYMENT_METHOD, User::MODULE_ORDER)) {
$navigation['order']['menu'][] = [
'name' => 'Payment methods',
'route' => 'module_payment_methods',
'icon' => 'glyphicon glyphicon-credit-card',
];
}
if ($this->checkPermission(User::PERMISSION_PICKUP_POINT, User::MODULE_ORDER)) {
$navigation['order']['menu'][] = [
'name' => 'Pickup point',
'route' => 'atech_net_core_pickup_point',
'icon' => 'glyphicon glyphicon-map-marker',
];
}
if ($this->checkPermission(User::PERMISSION_PROCESSING_DASHBOARD, User::MODULE_ORDER)) {
$navigation['order']['menu'][] = [
'name' => 'Processing Dashboard',
'route' => 'atech_net_core_order_processing_dashboard',
];
}
if ($this->checkPermission(User::PERMISSION_PRODUCTION_STATION_EDITOR, User::MODULE_ORDER)) {
$navigation['order']['menu'][] = [
'name' => 'Production Station editor',
'route' => 'atech_net_core_production_stations',
];
}
if ( $this->checkPermission(User::PERMISSION_ORDER_MANAGE_ORDER_BY, User::MODULE_ORDER) ) {
$navigation['order']['menu'][] = [
'name' => 'Order list settings',
'route' => 'atech_net_core_order_manage_order_by',
'icon' => 'glyphicon glyphicon-sort-by-alphabet',
];
}
if ($this->checkPermission(User::PERMISSION_MARKETPLACE_API, User::MODULE_ORDER)) {
/*$listingListSubMenus = [
[
'name' => 'Refurbed',
'route' => 'atech_net_core_marketplace_listings',
'params' => ['marketplace' => Customer::REFURBED_ID]
],
[
'name' => 'Backmarket',
'route' => 'atech_net_core_marketplace_listings',
'params' => ['marketplace' => Customer::BACKMARKET_ID]
],
[
'name' => 'Amazon',
'route' => 'atech_net_core_marketplace_listings',
'params' => ['marketplace' => Customer::AMAZON_ID]
]
];*/
$subMenus = [
/*[
'name' => 'Listings',
'route' => 'atech_net_core_marketplace_listings',
'submenu' => $listingListSubMenus
],*/
[
'name' => 'Finalizing',
'route' => 'atech_net_core_order_marketplace_orders',
],
[
'name' => 'Import listing CSV',
'route' => 'import_listing_data',
],
[
'name' => 'Internal Jobs',
'route' => 'atech_net_core_internal_job_list',
],
[
'name' => 'Listings',
'route' => 'atech_net_core_marketplace_listings',
],
];
$navigation['order']['menu'][] = [
'name' => 'Marketplace',
'link' => '#',
'icon' => 'glyphicon glyphicon-th',
'submenu' => $subMenus,
];
}
if ($this->checkPermission(User::PERMISSION_ORDER_EXPORT, User::MODULE_ORDER)) {
$subMenus = [
[
'name' => 'Orders',
'route' => 'atech_net_core_order_export',
],
[
'name' => 'Order status',
'route' => 'atech_net_core_order_status_export',
],
[
'name' => 'Orders with out invoices',
'route' => 'atech_net_core_orders_with_out_invoices_export',
],
[
'name' => 'DHL labels',
'route' => 'atech_net_core_export_dhl_labels_by_date',
],
];
$navigation['order']['menu'][] = [
'name' => 'Export',
'link' => '#',
'icon' => 'glyphicon glyphicon-export',
'submenu' => $subMenus,
];
}
//Stock management
if (
$this->checkPermission(User::PERMISSION_LIST, User::MODULE_STOCK) ||
$this->checkPermission(User::PERMISSION_LIST, User::MODULE_STOCK_MOVEMENT) ||
$this->checkPermission(User::PERMISSION_LIST, User::MODULE_STOCK_ITEM) ||
in_array($currentUser->getId(), [132, 217])
) {
$navigation['stock_movements'] = [
'name' => 'Stock management',
'route' => 'stock_movement',
'icon' => 'glyphicon glyphicon-th-list',
];
if ($this->checkPermission(User::PERMISSION_CREATE, User::MODULE_STOCK_MOVEMENT)) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Add',
'link' => '#',
'submenu' => [
[
'name' => 'Ins',
'route' => 'stock_movement_new',
'params' => [
'type' => StockMovement::TYPE_IN,
],
'icon' => 'glyphicon glyphicon-plus',
], [
'name' => 'Outs',
'route' => 'stock_movement_new',
'params' => [
'type' => StockMovement::TYPE_OUT,
],
'icon' => 'glyphicon glyphicon-minus',
], [
'name' => 'Neutrals',
'route' => 'stock_movement_new',
'params' => [
'type' => StockMovement::TYPE_NEUTRAL,
],
'icon' => 'glyphicon glyphicon-asterisk',
], [
'name' => 'Config change',
'route' => 'stock_movement_new_config_change',
'icon' => 'glyphicon glyphicon-transfer',
], [
'name' => 'Config change (service)',
'route' => 'stock_movement_new_config_change',
'params' => [
'method' => 'servicing',
],
'permission' => $this->checkPermission(User::PERMISSION_STOCK_MOVEMENT_SERVICE_CONFIG_CHANGE, User::MODULE_STOCK_MOVEMENT),
'icon' => 'glyphicon glyphicon-transfer',
], [
'name' => 'Quarantine',
'route' => 'stock_movement_new',
'params' => [
'type' => StockMovement::TYPE_NEUTRAL,
'sub-type' => StockMovement::SUB_TYPE_NEUTRAL_QUARANTINE,
],
'icon' => 'glyphicon glyphicon-warning-sign',
], [
'name' => 'Consumption',
'route' => 'stock_movement_new',
'params' => [
'type' => StockMovement::TYPE_OUT,
'sub-type' => StockMovement::SUB_TYPE_OUT_CONSUMPTION,
],
'icon' => 'glyphicon glyphicon-refresh',
], [
'name' => 'Re aiken',
'route' => 'stock_movement_new',
'params' => [
'type' => StockMovement::TYPE_NEUTRAL,
'sub-type' => StockMovement::SUB_TYPE_NEUTRAL_RE_AIKEN,
],
'icon' => 'glyphicon glyphicon-leaf',
],
],
];
}
if ($this->checkPermission(User::PERMISSION_LIST, User::MODULE_STOCK_MOVEMENT)) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Ins',
'route' => 'stock_movement',
'params' => [
'type' => 1,
],
'icon' => 'glyphicon glyphicon-plus',
];
}
if ($this->checkPermission(User::PERMISSION_LIST, User::MODULE_STOCK_MOVEMENT)) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Outs',
'route' => 'stock_movement',
'params' => [
'type' => 2,
],
'icon' => 'glyphicon glyphicon-minus',
];
}
if ($this->checkPermission(User::PERMISSION_LIST, User::MODULE_STOCK_MOVEMENT)) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Neutrals',
'route' => 'stock_movement',
'params' => [
'type' => 3,
],
'icon' => 'glyphicon glyphicon-asterisk',
];
}
$navigation['stock_movements']['menu'][] = [
'name' => 'Stock items',
'route' => 'stock_item',
'icon' => 'glyphicon glyphicon-search',
];
$navigation['stock_movements']['menu'][] = [
'name' => 'Latest stock items',
'route' => 'stock_item_latest',
'icon' => 'glyphicon glyphicon-baby-formula',
];
$navigation['stock_movements']['menu'][] = [
'name' => 'Stock item quality results',
'route' => 'stock_item_quality_result',
'icon' => 'glyphicon glyphicon-check',
];
$navigation['stock_movements']['menu'][] = [
'name' => 'Stock request',
'route' => 'stock_request_list',
'icon' => 'glyphicon glyphicon-hand-down',
];
$navigation['stock_movements']['menu'][] = [
'name' => 'Blancco import',
'route' => 'blancco_import',
'icon' => 'glyphicon glyphicon-bold',
];
if ($this->checkPermission(User::PERMISSION_POSITIONING, User::MODULE_STOCK_ITEM)) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Group label print',
'route' => 'atech_net_core_stock_item_group_label_collect',
'icon' => 'glyphicon glyphicon-barcode',
];
}
if ($this->checkPermission(User::PERMISSION_STOCK_REVIEW, User::MODULE_STOCK_MOVEMENT)) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Stock review',
'route' => 'stock_review',
'params' => [
'type' => 1,
],
'icon' => 'glyphicon glyphicon-list',
];
}
$navigation['stock_movements']['menu'][] = [
'name' => 'Mobil scanning',
'route' => 'atech_net_core_order_mobil_scanning_page',
'icon' => 'glyphicon glyphicon-phone',
];
if ($this->checkPermission(User::PERMISSION_POSITIONING, User::MODULE_STOCK_ITEM)) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Positioning',
'route' => 'stock_item_positioning',
'icon' => 'glyphicon glyphicon-bookmark',
];
}
if ($this->checkPermission(User::PERMISSION_POSITIONING, User::MODULE_STOCK_ITEM)) {
$navigation['stock_movements']['menu'][] = [
'name' => 'By stock position',
'route' => 'stock_item_position_search',
'icon' => 'glyphicon glyphicon-search',
];
}
if ($this->checkPermission(User::PERMISSION_STOCK_MOVEMENT_SHIPMENTS, User::MODULE_STOCK_MOVEMENT)) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Shipments',
// 'route' => 'shipment',
'icon' => 'fa-solid fa-cubes',
'link' => '#',
'submenu' => [
[
'name' => 'Shipments - list',
'route' => 'shipment',
'icon' => 'fa-solid fa-cubes',
], [
'name' => 'Shipments - expected summary',
'route' => 'expected_item_index',
'icon' => 'fa-solid fa-cubes',
]
]
];
$navigation['stock_movements']['menu'][] = [
'name' => 'Shipment statistics',
'route' => 'shipment_statistics',
'params' => [],
];
}
if ($this->checkPermission(User::PERMISSION_WANTED_ITEMS_LIST, User::MODULE_STOCK_MOVEMENT)) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Wanted items',
'route' => 'wanted_items',
'icon' => 'glyphicon glyphicon-star-empty',
];
}
if ($this->isAdmin()) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Statistics milestones',
'route' => 'statistics_milestone',
];
}
if ($this->checkPermission(User::PERMISSION_LIST, User::MODULE_STOCK)) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Stocks',
'route' => 'stock',
];
}
if ($this->checkPermission(User::PERMISSION_STOCK_POSITION, User::MODULE_STOCK)) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Stock positions',
'route' => 'stock_position',
];
}
if ($this->checkPermission(User::PERMISSION_TEMPORARY_STOCK_POSITIONS, User::MODULE_STOCK_ITEM)) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Temporary stock positions of users',
'route' => 'user_temporary_stock_position',
];
}
if ($this->checkPermission(User::PERMISSION_STOCK_POSITION_LABEL_PRINT, User::MODULE_STOCK_MOVEMENT)) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Stock position label print',
'route' => 'stock_position_label_print',
'icon' => 'glyphicon glyphicon-barcode',
];
}
$stockMovementExportSubMenu = [];
if ($this->checkPermission(User::PERMISSION_IN_PRODUCTION_EXPORT, User::MODULE_STOCK_MOVEMENT)) {
$stockMovementExportSubMenu[] = [
'name' => 'In prod products',
'route' => 'stock_movement_in_production_export',
];
}
if ($this->checkPermission(User::PERMISSION_STOCK_MOVEMENT_EXPORT_ALL, User::MODULE_STOCK_MOVEMENT)) {
$stockMovementExportSubMenu[] = [
'name' => 'Export all & email',
'route' => 'stock_movement_export_all_movement_and_send_email_page',
];
}
if ( $this->checkPermission(User::PERMISSION_STOCK_MOVEMENT_EXPORT_SHIPMENT_ITEM, User::MODULE_STOCK_MOVEMENT) ) {
$stockMovementExportSubMenu[] = [
'name' => 'Export shipment items',
'route' => 'stock_movement_export_shipment_items_page',
];
}
$stockMovementExportSubMenu[] = [
'name' => 'Multiple times returned items',
'route' => 'atech_net_core_order_stock_item_export_multiple_times_returned_items',
];
if (\count($stockMovementExportSubMenu) > 0) {
$navigation['stock_movements']['menu'][] = [
'name' => 'Export',
'link' => '#',
'icon' => 'glyphicon glyphicon-export',
'submenu' => $stockMovementExportSubMenu,
];
}
}
//Tasks
if ($this->checkPermission(User::PERMISSION_LIST, User::MODULE_TASK)) {
$navigation['tasks'] = [
'name' => 'Tasks',
'route' => 'atech_net_core_task_index',
'icon' => 'glyphicon glyphicon-tasks',
];
}
//FAQ
if ( false && $this->checkPermission(User::PERMISSION_LIST, User::MODULE_FAQ) ) {
$navigation['knowledge_base'] = [
'name' => 'Knowledge Base',
'route' => 'atech_net_core_knowledge_base_index',
'icon' => 'glyphicon glyphicon-question-sign',
];
}
//Claims
if ($this->checkPermission(User::PERMISSION_LIST, User::MODULE_CLAIM)) {
$navigation['claims'] = [
'name' => 'Claim',
'route' => 'atech_net_core_claim',
'icon' => 'glyphicon glyphicon-wrench',
];
}
//Other
$otherMenu = [];
if ($this->checkPermission(User::PERMISSION_ACCESS_LOG, User::MODULE_OTHER)) {
$otherMenu[] = [
'name' => 'Access log',
'route' => 'atech_net_core_access_log',
'icon' => 'glyphicon glyphicon-lock',
];
}
if ($this->checkPermission(User::PERMISSION_ERROR_CODES, User::MODULE_OTHER)) {
$otherMenu[] = [
'name' => 'Aiken error codes',
'route' => 'error_codes_index',
];
}
if ($this->checkPermission(User::PERMISSION_ATTRIBUTES, User::MODULE_PRODUCT)) {
$otherMenu[] = [
'name' => 'Attribute Options',
'route' => 'atech_net_core_attribute_option_list',
];
}
if ($this->checkPermission(User::PERMISSION_AUTOMATIZATIONS, User::MODULE_OTHER)) {
$otherMenu[] = [
'name' => 'Automatizations',
'route' => 'atech_net_core_automatizations',
];
}
$otherMenu[] = [
'name' => 'Gallery',
'route' => 'atech_net_core_gallery',
];
if ($this->checkPermission(User::PERMISSION_INTERNAL_NEWS, User::MODULE_OTHER)) {
$otherMenu[] = [
'name' => 'Internal news',
'route' => 'atech_net_core_internal_news',
];
}
if ($this->checkPermission(User::PERMISSION_PERMISSION_GROUPS, User::MODULE_USER)) {
$otherMenu[] = [
'name' => 'Permission groups',
'route' => 'user_permission_group',
'icon' => 'glyphicon glyphicon-eye-open',
];
}
if ($this->checkPermission(User::PERMISSION_PERMISSION_LIST, User::MODULE_USER)) {
$otherMenu[] = [
'name' => 'Permission list',
'route' => 'atech_net_core_user_permission_list',
'icon' => 'glyphicon glyphicon-list',
];
}
if ($this->checkPermission(User::PERMISSION_PERMISSION_CHANGELOG, User::MODULE_USER)) {
$otherMenu[] = [
'name' => 'Permission changelog',
'route' => 'atech_net_core_user_permission_changelog',
];
}
if ($this->checkPermission(User::PERMISSION_ATTRIBUTES, User::MODULE_PRODUCT)) {
$otherMenu[] = [
'name' => 'Product Attributes',
'route' => 'atech_net_core_attribute_list',
];
}
if ($this->checkPermission(User::PERMISSION_TRANSLATIONS, User::MODULE_OTHER)) {
$otherMenu[] = [
'name' => 'Translations',
'route' => 'atech_net_core_translation_list',
];
}
if ($this->checkPermission(User::PERMISSION_UPLOAD_FILE, User::MODULE_OTHER)) {
$otherMenu[] = [
'name' => 'Upload file',
'link' => 'https://www.atechnet.sk/upload/',
'target' => '_blank',
];
}
if ($this->checkPermission(User::PERMISSION_LIST, User::MODULE_USER)) {
$otherMenu[] = [
'name' => 'Users',
'route' => 'atech_net_core_user_list',
'icon' => 'glyphicon glyphicon-user',
];
}
if ($this->checkPermission(User::PERMISSION_TRANSLATIONS, User::MODULE_OTHER)) {
$otherMenu[] = [
'name' => 'Web translations',
'route' => 'file_translations_index',
'params' => [
'token' => 'fasdgasghawrge547547654wrreg56936yh98gjfv4q2ghj9340yhg24',
],
];
}
if ($this->checkPermission(User::PERMISSION_SHORTCUT, User::MODULE_OTHER)) {
$otherMenu[] = [
'name' => 'Shortcuts',
'route' => 'shortcut_index',
'icon' => 'glyphicon glyphicon-new-window',
];
}
if ($this->checkPermission(User::PERMISSION_LIST, User::MODULE_PRODUCT)) {
$otherMenu[] = [
'name' => 'Search by hidden configuration',
'route' => 'atech_net_core_search_by_product_tags',
];
}
if ($otherMenu) {
$navigation['other'] = [
'name' => 'Other',
'route' => 'atech_net_core_attribute_list',
'icon' => 'glyphicon glyphicon-cog',
'menu' => $otherMenu,
];
}
//Marketing tools
$marketingToolsMenu = [];
if ($this->checkPermission(User::PERMISSION_EDITING_PAGES, User::MODULE_MARKETING_TOOLS)) {
$marketingToolsMenu[] = [
'name' => 'Static pages',
'route' => 'pages',
'params' => [
'type' => 'static',
],
'icon' => 'glyphicon glyphicon-file',
];
$marketingToolsMenu[] = [
'name' => 'Blog',
'route' => 'pages',
'params' => [
'type' => 'blog',
],
'icon' => 'glyphicon glyphicon-education',
];
$marketingToolsMenu[] = [
'name' => 'Categories',
'route' => 'pages',
'params' => [
'type' => 'category',
],
'icon' => 'glyphicon glyphicon-list-alt',
];
}
if ($this->checkPermission(User::PERMISSION_NAVIGATION, User::MODULE_MARKETING_TOOLS)) {
$marketingToolsMenu[] = [
'name' => 'Navigation',
'route' => 'atech_net_core_web_navigation_index',
'icon' => 'glyphicon glyphicon-menu-hamburger',
];
}
if ($this->checkPermission(User::PERMISSION_SEARCH_ENGINE, User::MODULE_MARKETING_TOOLS)) {
$marketingToolsMenu[] = [
'name' => 'Search engine',
'route' => 'search_engine_dashboard',
'icon' => 'glyphicon glyphicon-search',
];
}
if ($this->checkPermission(User::PERMISSION_BANNER, User::MODULE_MARKETING_TOOLS)) {
$marketingToolsMenu[] = [
'name' => 'Banner',
'route' => 'atech_net_core_banner',
'icon' => 'glyphicon glyphicon-blackboard',
];
}
if ($this->checkPermission(User::PERMISSION_NANOBAR, User::MODULE_MARKETING_TOOLS)) {
$marketingToolsMenu[] = [
'name' => 'Nanobar',
'route' => 'nanobar',
'icon' => 'glyphicon glyphicon-bullhorn',
];
}
if ($this->checkPermission(User::PERMISSION_PRODUCT_GROUPS, User::MODULE_MARKETING_TOOLS)) {
$marketingToolsMenu[] = [
'name' => 'Product groups',
'route' => 'product_groups',
'icon' => 'glyphicon glyphicon-compressed',
];
$marketingToolsMenu[] = [
'name' => 'Category groups',
'route' => 'category_groups',
'icon' => 'glyphicon glyphicon-compressed',
];
}
if ($this->checkPermission(User::PERMISSION_PRODUCT_TAGS, User::MODULE_MARKETING_TOOLS)) {
$marketingToolsMenu[] = [
'name' => 'Product tags',
'route' => 'product_tag',
'icon' => 'glyphicon glyphicon-tags',
];
}
if ($this->checkPermission(User::PERMISSION_EDITING_PAGES, User::MODULE_MARKETING_TOOLS)) {
$marketingToolsMenu[] = [
'name' => 'Media',
'route' => 'media_list',
'icon' => 'glyphicon glyphicon-folder-open',
];
}
if ($this->checkPermission(User::PERMISSION_JOBS, User::MODULE_MARKETING_TOOLS)) {
$marketingToolsMenu[] = [
'name' => 'Jobs',
'route' => 'jobs',
'icon' => 'glyphicon glyphicon-sunglasses',
];
}
if ($this->checkPermission(User::PERMISSION_REVIEWS, User::MODULE_MARKETING_TOOLS)) {
$marketingToolsMenu[] = [
'name' => 'Reviews',
'route' => 'reviews',
'icon' => 'glyphicon glyphicon-heart-empty',
];
}
if ($this->checkPermission(User::PERMISSION_SURVEYS, User::MODULE_MARKETING_TOOLS)) {
$marketingToolsMenu[] = [
'name' => 'Surveys',
'route' => 'survey_index',
'icon' => 'glyphicon glyphicon-list-alt',
];
$marketingToolsMenu[] = [
'name' => 'Survey media list',
'route' => 'survey_media_list',
'icon' => 'glyphicon glyphicon-picture',
];
}
if ($this->checkPermission(User::PERMISSION_COUPONS, User::MODULE_MARKETING_TOOLS)) {
$marketingToolsMenu[] = [
'name' => 'Coupons',
'route' => 'coupons',
'icon' => 'glyphicon glyphicon-gift',
];
}
if ($this->checkPermission(User::PERMISSION_UNAS_CHATGPT_TRANSLATION, User::MODULE_MARKETING_TOOLS)) {
$marketingToolsMenu[] = [
'name' => 'Unas translations',
'route' => 'atech_net_core_unas_translation',
'icon' => 'glyphicon glyphicon-folder-open',
];
}
if ($marketingToolsMenu) {
$navigation['static'] = [
'name' => '',
'route' => 'pages',
'params' => [
'type' => 'static',
],
'title' => 'Marketing tools',
'icon' => 'glyphicon glyphicon-screenshot',
'menu' => $marketingToolsMenu,
];
}
if ($userId != User::HUN_ACCOUNTANT_ID) {
//Wiki
$navigation['wiki'] = [
'name' => 'WIKI',
'link' => 'https://www.atechcomp.eu/furbify-wiki/public',
'target' => '_blank',
'title' => 'Furbify WIKI',
'icon' => 'glyphicon glyphicon-education',
];
//Meal
$navigation['meal'] = [
'name' => '',
'route' => 'atech_net_core_meal',
'title' => 'Meal',
'image' => 'bundles/atechnetcore/images/chicken.svg',
'warning_sign' => true,
];
}
$cacheItem->set($navigation);
$cacheItem->expiresAfter(self::CACHE_LIFETIME_7_DAYS);
$this->cache->save($cacheItem);
return $this->render('AtechNetCoreBundle/Default/menu.html.twig', [
'current_route' => $currentRoute,
'navigation' => $navigation,
]);
}
/**
* @param array $ids
* @return bool
*/
private function allowForUsersWithId(array $ids): bool
{
return in_array($this->getUser()->getId(), $ids);
}
/**
* @return string
*/
public function getApiToken(): string
{
return $this->apiToken;
}
/**
* @param string $moduleTitle
* @param int $userId
* @param int $cacheVersion
* @return string
*/
public function getCacheKey(string $moduleTitle, int $userId = 0, int $cacheVersion = 0): string
{
return 'cntrls.' . $moduleTitle . ($userId != 0 ? '.' . $userId : '') . ($cacheVersion != 0 ? '.' . $cacheVersion : '');
}
/**
* @param int $userId
* @return string
*/
public function getNotificationCacheKey(int $userId): string
{
return $this->getCacheKey('notification', $userId, 1);
}
/**
* @param string $permission
* @param string $module
*/
protected function hasPermission(string $permission, string $module)
{
if (!in_array($permission, $this->getUser()->getPermissionsByModule($module))) {
throw new AccessDeniedHttpException(
$this->translator->trans('You do not have permission to access this page!')
);
}
}
/**
* @param string $permission
* @param string $module
* @return bool
*/
protected function checkPermission(string $permission, string $module): bool
{
if (!in_array($permission, $this->getUser()->getPermissionsByModule($module))) {
return false;
}
return true;
}
/**
* @param string $permission
* @return array
*/
protected function getPermissionValues(string $permission): array
{
return (array)$this->getUser()->getPermissionsByModule($permission);
}
/**
* @return mixed
*/
protected function getLastAndAveragePricesFromCache()
{
return $this->getEntityManager()->getRepository(Product::class)->getLastAndAveragePricesFromCache();
}
/**
* @return LuigisBox
*/
protected function getLuigisBox(): LuigisBox
{
$entityManager = $this->getEntityManager();
$domain = $entityManager->getRepository(Domain::class)->findOneById(1);
return new LuigisBox($entityManager, $domain);
}
/**
* @param string $string
* @return false|string
*/
protected function replaceSpecialCharactersInString(string $string)
{
return transliterator_transliterate('Any-Latin; Latin-ASCII; [\u0080-\u7fff] remove', $string);
}
/**
* @return CloudflareImage
*/
protected function getCloudflareImage(): CloudflareImage
{
$config = $this->getParameter('cloudflare_image');
return new CloudflareImage((int)$config['active'], $config['token']);
}
/**
* @param Domain $domain
* @return mixed
*/
protected function getCurrentExchangeRateByDomain(Domain $domain)
{
switch ($domain->getLanguage()->getCode()) {
case 'sk':
case 'en':
$currency = 'EUR';
break;
case 'hu':
$currency = 'HUF';
break;
case 'cz':
$currency = 'CZK';
break;
default:
$currency = 'EUR';
}
if ($currency == 'EUR') {
return 1;
}
$date1DayBefore = (new \DateTime())->sub(new \DateInterval('P1D'))->format('Y-m-d');
return $this->getHistoricalEuroRate()->getRate($currency, $date1DayBefore);
}
/**
* @return Packeta
*/
protected function getPacketa(): Packeta
{
$config = $this->getParameter('packeta');
return new Packeta($config['api_key'], $config['api_password'], $this->getEntityManager());
}
/**
* @return SquarePay
*/
protected function getSquarePay(): SquarePay
{
$config = $this->getParameter('square_pay');
return new SquarePay($this->getParameter('kernel.project_dir'), $config['username'], $config['password']);
}
/**
* @return array
* @throws \Psr\Cache\InvalidArgumentException
*/
protected function getSalesManagerList(): array
{
$cacheKey = 'salesmanagersList.v1';
$cacheItem = $this->cache->getItem($cacheKey);
if ($cacheItem->isHit()) {
$salesManagers = $cacheItem->get();
} else {
$data = $this->getEntityManager()->createQuery('SELECT DISTINCT IDENTITY(c.salesManager) as salesManager
FROM AtechNetCoreBundle:Customer c
ORDER BY c.id')
->getScalarResult();
$salesManagers = [];
foreach ($data as $salesManager) {
if (empty($salesManager['salesManager'])) {
continue;
}
$salesManagers[$salesManager['salesManager']] = $salesManager['salesManager'];
}
$cacheItem->set($salesManagers);
$cacheItem->expiresAfter(self::CACHE_LIFETIME_1_HOUR);
$this->cache->save($cacheItem);
}
return $salesManagers;
}
/**
* @return TranslatorInterface
*/
protected function getTranslator(): TranslatorInterface
{
return $this->translator;
}
/**
* @return UrlGeneratorInterface
*/
protected function getRouter(): UrlGeneratorInterface
{
return $this->router;
}
/**
* @return MailerInterface
*/
protected function getMailer(): MailerInterface
{
return $this->mailer;
}
/**
* @return RequestStack
*/
protected function getRequestStack(): RequestStack
{
return $this->requestStack;
}
/**
* @return SessionInterface
*/
protected function getSession(): SessionInterface
{
return $this->requestStack->getSession();
}
/**
* @return Security
*/
protected function getSecurity(): Security
{
return $this->security;
}
/**
* @return object|UserInterface|null
*/
protected function getUser()
{
return $this->security->getUser();
}
/**
* @return HistoricalEuroRate
*/
protected function getHistoricalEuroRate(): HistoricalEuroRate
{
return $this->historicalEuroRate;
}
/**
* @return PBH
* @var string $moduleName
*
*/
protected function getPostaBezHranic(): PBH
{
$config = $this->getParameter('posta_bez_hranic');
return new PBH($config['user_id'], $config['api_key'], $this->getEntityManager());
}
/**
* @return ErsteHelper
*/
protected function getErsteHelper(string $bankName): ErsteHelper
{
$config = $this->getParameter('erste');
return new ErsteHelper(
$config['webApiKey'],
$config['clientId'],
$config['clientSecret'],
$config['walletId'],
$config['walletSecret'],
$config['accountId'][$bankName]
);
}
/**
* @return TatraBankaHelper
*/
protected function getTatraBankaApi(): TatraBankaHelper
{
$tatraParams = $this->getParameter('tatra_banka');
return new TatraBankaHelper(
$tatraParams['client_id'],
$tatraParams['client_secret'],
$tatraParams['code_challenge'],
$tatraParams['code_verifier'],
$this->kernel->getEnvironment()
);
}
/**
* @param string $languageCode
* @return Instacash
*/
protected function getInstacash(string $languageCode): Instacash
{
$config = $this->getParameter('instacash')[$languageCode];
return new Instacash($config['api_key'], $config['financier'], $this->getEntityManager(), $this->kernel->getEnvironment(), $this->cache, $languageCode);
}
/**
* @param string $languageCode
*
* @return Milpay
*/
protected function getMilpay(string $languageCode): Milpay
{
$config = $this->getParameter('milpay')[$languageCode][$this->kernel->getEnvironment()];;
return new Milpay($config['api_key'], $config['offerId'], $this->getEntityManager(), $this->kernel->getEnvironment(), $this->cache, $languageCode);
}
protected function getAmazonSPApi(): AmazonSP
{
$config = $this->getParameter('amazon');
return new AmazonSP($config['client_id'], $config['client_secret']);
}
/**
* @param string $webshopCountry
* @return PastPay
*/
protected function getPastPay(): PastPay
{
$serviceName = $this->kernel->getEnvironment() == 'prod' ? 'past_pay' : 'past_pay_demo';
$config = $this->getParameter($serviceName);
return new PastPay($config["api_key_sk"], $this->getEntityManager(), $this->kernel->getEnvironment());
}
protected function getFingera()
{
return new Fingera($this->getParameter('fingera'), $this->getEntityManager(), $this->cache);
}
protected function getKlaviyoConnect(): KlaviyoConnect
{
$env = $this->kernel->getEnvironment();
$config = $this->getParameter('klaviyo')[$env];
return new KlaviyoConnect($config, $this->getEntityManager(), $env, $this->getRouter(), null);
}
/**
* @throws \Exception
*/
protected function getUnas(): Unas
{
$config = $this->getParameter('unas');
/** @var EntityManager $entityManager */
$entityManager = $this->getEntityManager();
$env = $this->kernel->getEnvironment();
$translator = new DatabaseTranslator($entityManager, Domain::DOMAIN_ID_RT_EU);
return new Unas($config['key'], $entityManager, $translator, $this->getRouter(), $this->cache, $env, $this->sluggerInterface);
}
protected function getChatGptTranslator(): ChatGPTTranslator
{
$apiKey = $this->getParameter('chatgpt')['translator'];
$entityManager = $this->getEntityManager();
return new ChatGptTranslator($apiKey, $entityManager);
}
protected function getBlancco(): Blancco
{
$config = $this->getParameter('blancco');
return new Blancco($config['api_key'], $this->getEntityManager(), $this->getUser());
}
protected function getVubHelper(): VubHelper
{
$config = $this->getParameter('vub');
return new VubHelper(
$this->kernel->getEnvironment(),
$this->getEntityManager(),
$config['iban'],
$config['SN'],
$config['CA'],
$config['certPass']
);
}
protected function getDaktela(): Daktela
{
$accessToken = $this->getParameter('daktela')['access_token'];
return new Daktela($accessToken);
}
protected function getPaypal(): Paypal
{
$env = $this->kernel->getEnvironment();
$env = 'prod';
$credentials = $env == 'prod'
? $this->getParameter('paypal')['live']
: $this->getParameter('paypal')['sandbox'];
return new Paypal($env, $credentials);
}
}