Remove unreachable code
This commit is contained in:
parent
b355d0e3ae
commit
25394549a4
@ -1,394 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace RetailCrm\DeliveryModuleBundle\Controller;
|
||||
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use RetailCrm\DeliveryModuleBundle\Entity\Connection;
|
||||
use RetailCrm\DeliveryModuleBundle\Service;
|
||||
use RetailCrm\DeliveryModuleBundle\Service\BaseDelivery;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
|
||||
|
||||
abstract class AdminController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* Базовый роут
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function getRoute();
|
||||
|
||||
/**
|
||||
* Сервис для работы с апи службы доставки.
|
||||
*
|
||||
* @return BaseDelivery
|
||||
*/
|
||||
abstract protected function getDeliveryApi();
|
||||
|
||||
/**
|
||||
* @var ObjectManager
|
||||
*/
|
||||
protected $entityManager;
|
||||
|
||||
/**
|
||||
* @var PaginatorInterface
|
||||
*/
|
||||
protected $knpPaginator;
|
||||
|
||||
/**
|
||||
* @var Service\OpenSsl
|
||||
*/
|
||||
protected $openSsl;
|
||||
|
||||
/**
|
||||
* @var FlashBagInterface
|
||||
*/
|
||||
protected $flashBag;
|
||||
|
||||
/**
|
||||
* AdminController constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
ObjectManager $entityManager,
|
||||
PaginatorInterface $knpPaginator,
|
||||
Service\OpenSsl $openSsl,
|
||||
FlashBagInterface $flashBag
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->knpPaginator = $knpPaginator;
|
||||
$this->openSsl = $openSsl;
|
||||
$this->flashBag = $flashBag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function getShortBundle()
|
||||
{
|
||||
return strtr('Intaro\DeliveryModuleBundle', ['\\' => '']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function getNameService()
|
||||
{
|
||||
$bundle = explode('\\', 'Intaro\DeliveryModuleBundle');
|
||||
|
||||
return strtr(end($bundle), ['Bundle' => '']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*/
|
||||
public function listAction(Request $request)
|
||||
{
|
||||
$clientsQuery = $this->entityManager->createQuery('
|
||||
SELECT connection
|
||||
FROM ' . $this->getConnectionClass() . ' connection
|
||||
');
|
||||
|
||||
$pagination = $this->knpPaginator->paginate(
|
||||
$clientsQuery,
|
||||
$request->query->getInt('page', 1),
|
||||
20
|
||||
);
|
||||
|
||||
return $this->render(
|
||||
$this->getShortBundle() . ':Connection:list.html.twig',
|
||||
['pagination' => $pagination, 'route' => $this->getRoute()]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*/
|
||||
public function newAction(Request $request)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_DEVELOPER');
|
||||
|
||||
$connectionClass = $this->getConnectionClass();
|
||||
$connection = new $connectionClass();
|
||||
$connection->setEncoder($this->openSsl);
|
||||
$connectionTypeClass = 'Intaro\DeliveryModuleBundle\Form\ConnectionType';
|
||||
$form = $this->createForm($connectionTypeClass, $connection, [
|
||||
'container' => $this->container,
|
||||
'is_admin' => true,
|
||||
]);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$connection->generateClientId();
|
||||
$this->actualizeWebhooks($connection);
|
||||
$this->entityManager->persist($connection);
|
||||
$this->entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute($this->getRoute() . '_admin_edit', [
|
||||
'connectionId' => $connection->getId(),
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
$this->getShortBundle() . ':Connection:edit.html.twig',
|
||||
['route' => $this->getRoute(), 'form' => $form->createView()]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $connectionId
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function editAction(Request $request, $connectionId)
|
||||
{
|
||||
$connection = $this->entityManager
|
||||
->getRepository($this->getConnectionClass())
|
||||
->find($connectionId);
|
||||
if (null === $connection) {
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
|
||||
$connectionTypeClass = 'Intaro\DeliveryModuleBundle\Form\ConnectionType';
|
||||
$form = $this->createForm($connectionTypeClass, $connection, [
|
||||
'container' => $this->container,
|
||||
'is_admin' => true,
|
||||
]);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->actualizeWebhooks($connection);
|
||||
$this->entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute($this->getRoute() . '_admin_edit', [
|
||||
'connectionId' => $connection->getId(),
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
$this->getShortBundle() . ':Connection:edit.html.twig',
|
||||
[
|
||||
'route' => $this->getRoute(),
|
||||
'connection' => $connection,
|
||||
'form' => $form->createView(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $connectionId
|
||||
*
|
||||
* @return Response
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function updateConfigurationAction(Request $request, $connectionId)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_DEVELOPER');
|
||||
|
||||
$api = $this->getDeliveryApi();
|
||||
|
||||
$connection = $this->entityManager
|
||||
->getRepository($this->getConnectionClass())
|
||||
->find($connectionId);
|
||||
|
||||
$api->setConnection($connection);
|
||||
$result = $api->updateConfiguration();
|
||||
|
||||
if (isset($result['success']) && $result['success']) {
|
||||
$this->flashBag->add('notice', 'ChangesWereSaved');
|
||||
} else {
|
||||
$this->flashBag->add('error', 'ChangesWereNotSaved');
|
||||
}
|
||||
|
||||
return $this->redirectToRoute($this->getRoute() . '_admin_edit', [
|
||||
'connectionId' => $connection->getId(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*/
|
||||
public function parcelListAction(Request $request)
|
||||
{
|
||||
$parcelsQuery = $this->entityManager->createQuery('
|
||||
SELECT parcel
|
||||
FROM ' . $this->getParcelClass() . ' parcel
|
||||
');
|
||||
|
||||
$pagination = $this->knpPaginator->paginate(
|
||||
$parcelsQuery,
|
||||
$request->query->getInt('page', 1),
|
||||
20
|
||||
);
|
||||
|
||||
return $this->render(
|
||||
$this->getShortBundle() . ':Parcel:list.html.twig',
|
||||
['route' => $this->getRoute(), 'pagination' => $pagination]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*/
|
||||
public function parcelNewAction(Request $request)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_DEVELOPER');
|
||||
|
||||
$parcelClass = $this->getParcelClass();
|
||||
$parcel = new $parcelClass();
|
||||
$parcelTypeClass = 'Intaro\DeliveryModuleBundle\Form\ParcelType';
|
||||
$form = $this->createForm($parcelTypeClass, $parcel, [
|
||||
'connection_class' => $this->getConnectionClass(),
|
||||
]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->entityManager->persist($parcel);
|
||||
$this->entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute($this->getRoute() . '_admin_parcel_list');
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
$this->getShortBundle() . ':Parcel:edit.html.twig',
|
||||
['form' => $form->createView(), 'parcel' => $parcel]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $parcelId
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function parcelEditAction(Request $request, $parcelId)
|
||||
{
|
||||
$parcel = $this->entityManager
|
||||
->getRepository($this->getParcelClass())
|
||||
->find(['id' => $parcelId]);
|
||||
|
||||
$parcelTypeClass = 'Intaro\DeliveryModuleBundle\Form\ParcelType';
|
||||
$form = $this->createForm($parcelTypeClass, $parcel, [
|
||||
'connection_class' => $this->getConnectionClass(),
|
||||
]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute($this->getRoute() . '_admin_parcel_list');
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
$this->getShortBundle() . ':Parcel:edit.html.twig',
|
||||
['form' => $form->createView(), 'parcel' => $parcel]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function connectAction(Request $request)
|
||||
{
|
||||
$api = $this->getDeliveryApi();
|
||||
|
||||
$referer = $request->headers->get('referer');
|
||||
$account = $request->query->get('account');
|
||||
$accountUrl = null;
|
||||
if (!empty($account)) {
|
||||
$accountUrl = null === parse_url($account, PHP_URL_HOST)
|
||||
? null : 'https://' . parse_url($account, PHP_URL_HOST);
|
||||
}
|
||||
|
||||
if (
|
||||
!empty($request->request->get('clientId'))
|
||||
|| !empty($request->attributes->get('clientId'))
|
||||
) {
|
||||
if (!empty($request->request->get('clientId'))) {
|
||||
$clientId = $request->request->get('clientId');
|
||||
} else {
|
||||
$clientId = $request->attributes->get('clientId');
|
||||
}
|
||||
|
||||
$connection = $this->entityManager
|
||||
->getRepository($this->getConnectionClass())
|
||||
->findOneBy([
|
||||
'clientId' => $clientId,
|
||||
]);
|
||||
$accountUrl = $connection->getCrmUrl();
|
||||
} else {
|
||||
$class = $this->getConnectionClass();
|
||||
$connection = new $class();
|
||||
$connection
|
||||
->setLanguage($request->getLocale())
|
||||
->setEncoder($this->openSsl);
|
||||
}
|
||||
|
||||
$connectionTypeClass = 'Intaro\DeliveryModuleBundle\Form\ConnectionType';
|
||||
$form = $this->createForm($connectionTypeClass, $connection, [
|
||||
'container' => $this->container,
|
||||
'is_admin' => false,
|
||||
]);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$connectionIsCreated = true;
|
||||
if (empty($connection->getClientId())) {
|
||||
$connection->generateClientId();
|
||||
$connectionIsCreated = false;
|
||||
}
|
||||
|
||||
$api->setConnection($connection);
|
||||
$this->actualizeWebhooks($connection);
|
||||
$result = $api->updateConfiguration();
|
||||
if (isset($result['success']) && $result['success']) {
|
||||
if (!$connectionIsCreated) {
|
||||
$this->entityManager->persist($connection);
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
|
||||
return $this->redirect($connection->getCrmUrl() . '/admin/integration/list');
|
||||
} else {
|
||||
$srcLogo = $request->getUriForPath(
|
||||
'/bundles/delivery'
|
||||
. strtolower($this->getNameService())
|
||||
. '/images/'
|
||||
. strtolower($this->getNameService())
|
||||
. '.svg'
|
||||
);
|
||||
|
||||
return $this->render(
|
||||
'DeliveryCoreBundle:Connection:configure_error.html.twig',
|
||||
[
|
||||
'referer' => $referer,
|
||||
'errors' => $result,
|
||||
'title_delivery' => $this->getNameService(),
|
||||
'src_logo_delivery' => $srcLogo,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
$this->getShortBundle() . ':Connection:configure.html.twig',
|
||||
[
|
||||
'route' => $this->getRoute(),
|
||||
'form' => $form->createView(),
|
||||
'account' => $accountUrl,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Actualize webhooks.
|
||||
*/
|
||||
protected function actualizeWebhooks(Connection $connection)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace RetailCrm\DeliveryModuleBundle\EventListener;
|
||||
|
||||
use JMS\Serializer\EventDispatcher\Events;
|
||||
use JMS\Serializer\EventDispatcher\EventSubscriberInterface;
|
||||
use JMS\Serializer\EventDispatcher\PreSerializeEvent;
|
||||
use RetailCrm\DeliveryModuleBundle\Model\ResponseResult;
|
||||
|
||||
class SerializeListener implements EventSubscriberInterface
|
||||
{
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return [
|
||||
['event' => Events::PRE_SERIALIZE, 'method' => 'onPreSerialize', 'class' => ResponseResult::class],
|
||||
];
|
||||
}
|
||||
|
||||
public function onPreSerialize(PreSerializeEvent $event)
|
||||
{
|
||||
if (is_object($event->getObject())) {
|
||||
$event->setType(get_class($event->getObject()));
|
||||
} else {
|
||||
$event->setType('string');
|
||||
}
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace RetailCrm\DeliveryModuleBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ConfigureEditType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('connectionId', null, [
|
||||
'label' => 'label.connectionId',
|
||||
'required' => true,
|
||||
'attr' => [
|
||||
'placeholder' => 'label.connectionId',
|
||||
],
|
||||
])
|
||||
->add('crmKey', null, [
|
||||
'label' => 'label.crmKey',
|
||||
'required' => true,
|
||||
'attr' => [
|
||||
'placeholder' => 'label.crmKey',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace RetailCrm\DeliveryModuleBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class ConnectionType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('crmUrl', TextType::class, [
|
||||
'label' => 'label.crmUrl',
|
||||
'required' => true,
|
||||
'attr' => [
|
||||
'placeholder' => 'label.crmUrl',
|
||||
'pattern' => '^(https?:\/\/)?([\da-z0-9\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$',
|
||||
],
|
||||
'translation_domain' => 'messages',
|
||||
])
|
||||
->add('crmKey', TextType::class, [
|
||||
'label' => 'label.crmKey',
|
||||
'required' => true,
|
||||
'attr' => [
|
||||
'placeholder' => 'label.crmKey',
|
||||
],
|
||||
'translation_domain' => 'messages',
|
||||
])
|
||||
->add('isActive', CheckboxType::class, [
|
||||
'label' => 'label.isActive',
|
||||
'required' => false,
|
||||
'translation_domain' => 'messages',
|
||||
])
|
||||
->add('language', ChoiceType::class, [
|
||||
'label' => 'label.language',
|
||||
'choices' => [
|
||||
'RU' => 'ru',
|
||||
'EN' => 'en',
|
||||
'ES' => 'es',
|
||||
],
|
||||
'required' => true,
|
||||
'translation_domain' => 'messages',
|
||||
])
|
||||
->add('isFreeze', CheckboxType::class, [
|
||||
'label' => 'label.isFreeze',
|
||||
'required' => false,
|
||||
'translation_domain' => 'messages',
|
||||
]);
|
||||
|
||||
if ($options['is_admin']) {
|
||||
$builder
|
||||
->add('debug', CheckboxType::class, [
|
||||
'label' => 'label.debug',
|
||||
'required' => false,
|
||||
'translation_domain' => 'messages',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setRequired(['container', 'is_admin']);
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace RetailCrm\DeliveryModuleBundle\Form;
|
||||
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
abstract class ParcelType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add(
|
||||
'connection',
|
||||
EntityType::class,
|
||||
[
|
||||
'class' => $options['connection_class'],
|
||||
'label' => 'label.connection',
|
||||
'translation_domain' => 'messages',
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'orderId',
|
||||
TextType::class,
|
||||
[
|
||||
'label' => 'label.orderId',
|
||||
'translation_domain' => 'messages',
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'trackId',
|
||||
TextType::class,
|
||||
[
|
||||
'label' => 'label.trackId',
|
||||
'translation_domain' => 'messages',
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'isClosed',
|
||||
CheckboxType::class,
|
||||
[
|
||||
'required' => false,
|
||||
'label' => 'label.isClosed',
|
||||
'translation_domain' => 'messages',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setRequired(['connection_class']);
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
{% form_theme form 'DeliveryCoreBundle:Form:configure.html.twig' %}
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>
|
||||
{% block title %}{% endblock %}
|
||||
</title>
|
||||
<link rel="stylesheet" href="{{ asset('bundles/coreautomate/css/connect.css') }}" />
|
||||
<link rel="shortcut icon" href="{{ asset('favicon.ico') }}" type="image/x-icon">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="wrapper" style="width:100%;">
|
||||
<div class="top">
|
||||
<div class="header">
|
||||
<div>
|
||||
{% block logo %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="blue_line"></div>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="form-style-5">
|
||||
{% block form %}
|
||||
<div style="text-align: justify; margin-bottom: 10px;">
|
||||
{{ form_errors(form) }}
|
||||
</div>
|
||||
|
||||
<form name="connection" method="post" {{ form.vars.data.clientId is not empty ? ('action="' ~ path(route ~ '_configure_edit', {'clientId': form.vars.data.clientId}) ~ '"')|raw }} >
|
||||
{{ form_start(form) }}
|
||||
|
||||
{% block form_delivery %}
|
||||
{% endblock %}
|
||||
|
||||
<fieldset>
|
||||
<legend class="header_form_text">{{ 'header.configureConnection'|trans }}</legend>
|
||||
{{ form_widget(form.crmUrl, {'attr': {'value': account}}) }}
|
||||
{{ form_errors(form.crmUrl) }}
|
||||
|
||||
{{ form_widget(form.crmKey) }}
|
||||
{{ form_errors(form.crmKey) }}
|
||||
|
||||
{{ form_widget(form.language) }}
|
||||
{{ form_errors(form.language) }}
|
||||
</fieldset>
|
||||
|
||||
{% block form_delivery_after %}
|
||||
{% endblock %}
|
||||
|
||||
<div style="display: none">
|
||||
{{ form_rest(form) }}
|
||||
</div>
|
||||
<input type="submit" value="{{ (form.vars.data.clientId is not empty ? 'button.save' : 'button.activate')|trans }}" />
|
||||
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,13 +0,0 @@
|
||||
{% extends 'CoreAutomateBundle:Layout:connect.html.twig' %}
|
||||
|
||||
{% block title %}
|
||||
{{ 'header.serviceConnect'|trans({'%delivery%': title_delivery})|raw }}
|
||||
{% endblock %}
|
||||
|
||||
{% block logo %}
|
||||
<img style="height: 60px" src="{{ src_logo_delivery }}" alt="{{ title_delivery }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block form %}
|
||||
{{ 'error.connect.failed'|trans({'%delivery%': title_delivery, '%href%': referer})|raw }}
|
||||
{% endblock %}
|
@ -1,60 +0,0 @@
|
||||
{% extends 'CoreOmegaBundle:Layout:base.html.twig' %}
|
||||
{% form_theme form 'DeliveryCoreBundle:Form:admin.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="header-main">
|
||||
<h1 style="margin: 10px 0 10px 0;">
|
||||
{% if connection is defined %}
|
||||
{{ 'header.adminConnectionEdit'|trans({'%uid%': '<a target="_blank" href="'~connection.crmUrl~'">'~connection.crmUrl~'</a>'})|raw }}
|
||||
{% else %}
|
||||
{{ 'header.adminConnectionCreate'|trans()|raw }}
|
||||
{% endif %}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
<div class="m-box mn-or-info">
|
||||
{{ form_start(form) }}
|
||||
{{ form_errors(form) }}
|
||||
|
||||
<div class="field-for-group cleared">
|
||||
{{ form_row(form.crmUrl) }}
|
||||
{{ form_row(form.crmKey) }}
|
||||
|
||||
{{ form_row(form.isActive) }}
|
||||
|
||||
{% if form.language is defined %}
|
||||
{{ form_row(form.language) }}
|
||||
{% endif %}
|
||||
|
||||
{{ form_row(form.isFreeze) }}
|
||||
</div>
|
||||
|
||||
{% block form_appendix %}
|
||||
{% endblock %}
|
||||
|
||||
<div class="field-for-group cleared">
|
||||
{{ form_row(form.debug) }}
|
||||
</div>
|
||||
|
||||
<div class="field-for-group cleared">
|
||||
<div class="input-group cleared">
|
||||
<input type="submit" name="submit" value="{{ 'button.save'|trans()|raw }}" class="btn small btn-save"/>
|
||||
</div>
|
||||
{% if is_granted('ROLE_DEVELOPER') %}
|
||||
{% if connection is defined %}
|
||||
<div class="input-group cleared">
|
||||
<a href="{{ path(route ~ '_admin_update_configuration', {'connectionId': connection.id}) }}" class="btn small btn-save">
|
||||
{{ 'button.updateConfiguration'|trans()|raw }}
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{{ form_end(form) }}
|
||||
</div>
|
||||
|
||||
<div id="push"></div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,61 +0,0 @@
|
||||
{% extends 'CoreOmegaBundle:Layout:base.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="header-main">
|
||||
<h1 style="margin: 10px 0 10px 0;">{{ 'header.listConnection'|trans()|raw }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
<div style="margin: 5px 0 15px 0;">
|
||||
{% if is_granted('ROLE_DEVELOPER') %}
|
||||
<a href="{{ path(route ~ '_admin_new') }}" class="btn small btn-save">
|
||||
{{ 'button.add'|trans()|raw }}
|
||||
</a>
|
||||
{% endif %}
|
||||
<a href="{{ path(route ~ '_admin_parcel_list') }}" class="btn small btn-save">
|
||||
{{ 'button.listTracking'|trans()|raw }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<table class="modern-table">
|
||||
<tr>
|
||||
<th style="text-align: left">{{ 'label.id'|trans()|raw }}</th>
|
||||
<th>{{ 'label.crmUrl'|trans()|raw }}</th>
|
||||
<th style="text-align: center">{{ 'label.isActive'|trans()|raw }}</th>
|
||||
</tr>
|
||||
{% for client in pagination %}
|
||||
<tr>
|
||||
<td style="text-align: left">
|
||||
<a href="{{ path(route ~ '_admin_edit', {'connectionId': client.id}) }}">{{ client.clientId }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{% if client.crmUrl is not empty %}
|
||||
<a target="_blank" href="{{ client.crmUrl }}">
|
||||
{{ client.crmUrl }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
{% if client.isActive %}
|
||||
<img src="{{ asset('bundles/coreomega/images/mark-yes.svg') }}" style="width: 20px; height: 20px;"/>
|
||||
{% else %}
|
||||
<img src="{{ asset('bundles/coreomega/images/mark-no.svg') }}" style="width: 20px; height: 20px;" />
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<div class="list-bottom">
|
||||
<div class="list-total-stripe">
|
||||
<span id="list-total-count">
|
||||
{{ pagination.getTotalItemCount }} <span>{{ 'pagination.items.name'|trans()|raw }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="paginator">
|
||||
{{ knp_pagination_render(pagination) }}
|
||||
</div>
|
||||
</div>
|
||||
<div id="push"></div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,18 +0,0 @@
|
||||
{% extends "form_div_layout.html.twig" %}
|
||||
|
||||
{% block form_row %}
|
||||
{% spaceless %}
|
||||
<div class="input-group cleared">
|
||||
{{ form_label(form, null, {'label_attr' : {'class': 'label-common'}}) }}
|
||||
{{ form_errors(form) }}
|
||||
|
||||
{% if not attr or not attr.class|default(null) %}
|
||||
{% set attr = attr|default({})|merge({
|
||||
'class': 'input-field',
|
||||
'style': 'max-width: 320px;'
|
||||
}) %}
|
||||
{% endif %}
|
||||
{{ form_widget(form, { 'attr': attr }) }}
|
||||
</div>
|
||||
{% endspaceless %}
|
||||
{% endblock form_row %}
|
@ -1,13 +0,0 @@
|
||||
{% extends "form_div_layout.html.twig" %}
|
||||
|
||||
{% block form_errors %}
|
||||
{% spaceless %}
|
||||
{% if errors|length > 0 %}
|
||||
{% for error in errors %}
|
||||
<div class="form_error_message">
|
||||
<span style="color: #ff0000;">{{ error.message }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endspaceless %}
|
||||
{% endblock form_errors %}
|
@ -1,61 +0,0 @@
|
||||
{% extends 'CoreOmegaBundle:Layout:base.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="header-main">
|
||||
<h1 style="margin: 10px 0 10px 0;">
|
||||
{% if parcel.id is not empty %}
|
||||
{{ 'header.adminParcelEdit' |trans({'%trackId%': parcel.trackId})|raw }}
|
||||
{% else %}
|
||||
{{ 'header.adminParcelCreate' |trans()|raw }}
|
||||
{% endif %}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
<div class="m-box mn-or-info">
|
||||
{{ form_start(form) }}
|
||||
{{ form_errors(form) }}
|
||||
|
||||
<div class="field-for-group cleared">
|
||||
<div class="input-group cleared">
|
||||
{{ form_label(form.connection, null, {'label_attr' : {'class': 'label-common'}}) }}
|
||||
{{ form_errors(form.connection) }}
|
||||
{{ form_widget(form.connection, {'attr': {'class': 'input-field', 'style': 'width: 320px;'}}) }}
|
||||
</div>
|
||||
|
||||
<div class="input-group cleared">
|
||||
{{ form_label(form.orderId, null, {'label_attr' : {'class': 'label-common'}}) }}
|
||||
{{ form_errors(form.orderId) }}
|
||||
{{ form_widget(form.orderId, {'attr': {'class': 'input-field', 'style': 'width: 320px;'}}) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-for-group cleared">
|
||||
<div class="input-group cleared">
|
||||
{{ form_label(form.trackId, null, {'label_attr' : {'class': 'label-common'}}) }}
|
||||
{{ form_errors(form.trackId) }}
|
||||
{{ form_widget(form.trackId, {'attr': {'class': 'input-field', 'style': 'width: 320px;'}}) }}
|
||||
</div>
|
||||
|
||||
<div class="input-group cleared">
|
||||
{{ form_label(form.isClosed, null, {'label_attr' : {'class': 'label-common'}}) }}
|
||||
{{ form_errors(form.isClosed) }}
|
||||
{{ form_widget(form.isClosed) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% block form_appendix %}
|
||||
{% endblock %}
|
||||
|
||||
<div class="field-for-group cleared">
|
||||
<div class="input-group cleared">
|
||||
<input type="submit" name="submit" value="{{ 'button.save' |trans()|raw }}" class="btn small btn-save"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ form_end(form) }}
|
||||
</div>
|
||||
|
||||
<div id="push"></div>
|
||||
</div>
|
||||
{% endblock%}
|
@ -1,60 +0,0 @@
|
||||
{% extends 'CoreOmegaBundle:Layout:base.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="header-main">
|
||||
<h1 style="margin: 10px 0 10px 0;">{{ 'header.listConnection'|trans()|raw }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="main">
|
||||
<div style="margin: 5px 0 15px 0;">
|
||||
<a href="{{ path(route ~ '_admin_list') }}" class="btn small btn-save">
|
||||
{{ 'button.listConnection'|trans()|raw }}
|
||||
</a>
|
||||
{% if is_granted('ROLE_DEVELOPER') %}
|
||||
<a href="{{ path(route ~ '_admin_parcel_new') }}" class="btn small btn-save">
|
||||
{{ 'button.addTracking'|trans()|raw }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<table class="modern-table">
|
||||
<tr>
|
||||
<th style="text-align: left">{{ 'label.trackId'|trans()|raw }}</th>
|
||||
<th style="text-align: left">{{ 'label.orderId'|trans()|raw }}</th>
|
||||
<th style="text-align: left">{{ 'label.connection'|trans()|raw }}</th>
|
||||
<th style="text-align: center">{{ 'label.isClosed'|trans()|raw }}</th>
|
||||
</tr>
|
||||
{% for track in pagination %}
|
||||
<tr>
|
||||
<td style="text-align: left">
|
||||
<a href="{{ path(route ~ '_admin_parcel_edit', {'parcelId': track.id}) }}">{{ track.trackId}}</a>
|
||||
</td>
|
||||
<td style="text-align: left">
|
||||
{{ track.orderId}}
|
||||
</td>
|
||||
<td style="text-align: left">
|
||||
<a href="{{ path(route ~ '_admin_edit', {'connectionId': track.connection.id}) }}">{{ track.clientId}}</a>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
{% if track.isClosed %}
|
||||
<img src="{{ asset('bundles/coreomega/images/mark-yes.svg') }}" style="width: 20px; height: 20px;"/>
|
||||
{% else %}
|
||||
<img src="{{ asset('bundles/coreomega/images/mark-no.svg') }}" style="width: 20px; height: 20px;" />
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<div class="list-bottom">
|
||||
<div class="list-total-stripe">
|
||||
<span id="list-total-count">
|
||||
{{ pagination.getTotalItemCount }} <span>{{ 'pagination.items.name'|trans()|raw }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="paginator">
|
||||
{{ knp_pagination_render(pagination) }}
|
||||
</div>
|
||||
</div>
|
||||
<div id="push"></div>
|
||||
</div>
|
||||
{% endblock%}
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace RetailCrm\DeliveryModuleBundle\Service;
|
||||
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use JMS\Serializer\SerializationContext;
|
||||
use JMS\Serializer\SerializerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@ -47,11 +46,6 @@ abstract class ModuleManager implements ModuleManagerInterface
|
||||
*/
|
||||
protected $account;
|
||||
|
||||
/**
|
||||
* @var MockHandler
|
||||
*/
|
||||
protected $mockHandler;
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace RetailCrm\DeliveryModuleBundle\Service;
|
||||
|
||||
use App\Entity\Account;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RetailCrm\ApiClient;
|
||||
use RetailCrm\DeliveryModuleBundle\Model\Entity\Account;
|
||||
|
||||
class RetailCrmClientFactory implements RetailCrmClientFactoryInterface
|
||||
{
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace RetailCrm\DeliveryModuleBundle\Service;
|
||||
|
||||
use App\Entity\Account;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RetailCrm\ApiClient;
|
||||
use RetailCrm\DeliveryModuleBundle\Model\Entity\Account;
|
||||
|
||||
interface RetailCrmClientFactoryInterface
|
||||
{
|
||||
|
@ -1,28 +0,0 @@
|
||||
version: '2.1'
|
||||
services:
|
||||
automate_app:
|
||||
image: "gwinn/php:7.1"
|
||||
working_dir: /automate
|
||||
user: ${UID:-1000}:${GID:-1000}
|
||||
volumes:
|
||||
- ./:/automate
|
||||
links:
|
||||
- "automate_db:automate_db"
|
||||
- "automate_cache:automate_cache"
|
||||
- "automate_queue:automate_queue"
|
||||
automate_db:
|
||||
image: "postgres:9.5"
|
||||
ports:
|
||||
- ${POSTGRES_ADDRESS:-127.0.0.1:5432}:5432
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=automate
|
||||
- POSTGRES_USER=automate
|
||||
- POSTGRES_DB=automate
|
||||
automate_cache:
|
||||
image: "redis:alpine"
|
||||
ports:
|
||||
- "6379:6379"
|
||||
automate_queue:
|
||||
image: "schickling/beanstalkd:latest"
|
||||
ports:
|
||||
- "11300:11300"
|
@ -1,46 +0,0 @@
|
||||
version: '2.1'
|
||||
services:
|
||||
automate_app:
|
||||
image: "gwinn/php:7.1"
|
||||
ports:
|
||||
- "80:8080"
|
||||
working_dir: /automate
|
||||
user: ${UID:-1000}:${GID:-1000}
|
||||
volumes:
|
||||
- ./:/automate
|
||||
depends_on:
|
||||
- automate_db
|
||||
- automate_db_test
|
||||
- automate_cache
|
||||
- automate_queue
|
||||
links:
|
||||
- "automate_db:automate_db"
|
||||
- "automate_db_test:automate_db_test"
|
||||
- "automate_cache:automate_cache"
|
||||
- "automate_queue:automate_queue"
|
||||
command: make run
|
||||
automate_db:
|
||||
image: "postgres:9.5"
|
||||
ports:
|
||||
- ${POSTGRES_ADDRESS:-127.0.0.1:5432}:5432
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=automate
|
||||
- POSTGRES_USER=automate
|
||||
- POSTGRES_DB=automate
|
||||
automate_db_test:
|
||||
image: "postgres:9.5"
|
||||
ports:
|
||||
- ${POSTGRES_ADDRESS:-127.0.0.1:5434}:5434
|
||||
environment:
|
||||
- PGPORT=5434
|
||||
- POSTGRES_PASSWORD=automate
|
||||
- POSTGRES_USER=automate
|
||||
- POSTGRES_DB=automate
|
||||
automate_cache:
|
||||
image: "redis:alpine"
|
||||
ports:
|
||||
- "6379:6379"
|
||||
automate_queue:
|
||||
image: "schickling/beanstalkd:latest"
|
||||
ports:
|
||||
- "11300:11300"
|
Loading…
Reference in New Issue
Block a user