Skip to content

Commit

Permalink
# This is a combination of 13 commits.
Browse files Browse the repository at this point in the history
# This is the 1st commit message:

WIP

# This is the commit message dvsa/olcs-internal#2:

WIP

# This is the commit message dvsa/olcs-internal#3:

WIP

# This is the commit message dvsa/olcs-internal#4:

WIP

# This is the commit message dvsa/olcs-internal#5:

WIP

# This is the commit message dvsa/olcs-internal#6:

WIP

# This is the commit message dvsa/olcs-internal#7:

WIP

# This is the commit message dvsa/olcs-internal#8:

WIP

# This is the commit message dvsa/olcs-internal#9:

WIP

# This is the commit message dvsa/olcs-internal#10:

WIP

# This is the commit message dvsa/olcs-internal#11:

WIP

# This is the commit message dvsa/olcs-internal#12:

WIP

# This is the commit message dvsa/olcs-internal#13:

WIP

WIP

WIP

WIP

WIP

VOL-3915: refactor ApplicationProcessingInspectionRequestController and a new factory

VOL-3915: add factories in OLCS/src/Controller/Application

    VOL-3915: fix ApplicationProcessingOverviewControllerTest tests

    VOL-3915: remove all getServiceLocators in ApplicationController and corresponding factory and test

    VOL-3915: remove getServiceLocators in Controller\Bus and corresponding factories

    VOL-3915: tidy tests and controllers (BusDetails/BusProcessing/BusService)

    VOL-3915: AbstractHistory controller and factory

    VOL-3915: fix ConfirmTest unit tests

    VOL-3915: fix construct for ConditionUndertakingController and factory

    VOL-3915: remove all getServiceLocators in Application/Overview and Penalty Controllers and corresponding factories

    VOL-3915: CasesController and corresponding factory

    VOL-3915: remove all getServiceLocators in ApplicationProcessingController and corresponding factory

    VOL-3915: remove all getServiceLocators in IrhpApplicationController and corresponding factory

    VOL-3915: remove all getServiceLocators in ApplicationProcessingController, LicenceController and SurrenderControllers

    VOL-3915: remove all getServiceLocators in OperatorController and LicenceController

    VOL-3915: remove all getServiceLocators in Application/ProcessingController and TransportManagerController

    VOL-3915: replaced routes declared in invokable with abstractInternalController and corresponding files

    VOL-3915: tidy up of modules and factories

    VOL-3915: replaced invokable and strings that extended abstractHistoryController

    VOL-3915: add factories for Applications/ Cases/ IrhpPermits/ Operator

    VOL-3915: tidy up - add factories for Bus/ Cases/ TransportManager

    VOL-3915: fix unit test (ConfirmTest)

    VOL-3915: add factories for Applications/ Cases/ IrhpPermits/ Operator

    VOL-3915: add correct path to navigation

VOL-3915: add factories for Sla directory

    VOL-3915: /Admin  add factories for DataRetention and controller

Remove gSL and add factories for History & Disqualify controllers

Fix disqualify & others

Revert "Fix disqualify & others"

This reverts commit e0fb5f90c384d54681e63fa1d133b3065e1bdd08.

    VOL-3915: add factories for rest of Admin directory

    VOL-3915: white screen corrections

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP

WIP
  • Loading branch information
fibble committed Aug 8, 2023
1 parent dca8369 commit 531179a
Show file tree
Hide file tree
Showing 576 changed files with 23,103 additions and 4,122 deletions.
187 changes: 86 additions & 101 deletions app/internal/module/Admin/config/module.config.php

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions app/internal/module/Admin/src/Controller/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace Admin\Controller;

use Olcs\Controller\Interfaces\LeftViewProvider;
use Laminas\Mvc\Controller\AbstractActionController as LaminasAbstractActionController;
use Common\Controller\Traits\GenericRenderView;
use Laminas\Mvc\Controller\AbstractActionController as LaminasAbstractActionController;
use Laminas\View\Helper\Placeholder;
use Laminas\View\Model\ViewModel;
use Olcs\Controller\Interfaces\LeftViewProvider;

/**
* Abstract Controller
Expand All @@ -20,6 +21,14 @@ abstract class AbstractController extends LaminasAbstractActionController implem
{
use GenericRenderView;

protected Placeholder $placeholder;

public function __construct(
Placeholder $placeholder
) {
$this->placeholder = $placeholder;
}

/**
* Get Left View
*
Expand All @@ -42,7 +51,6 @@ public function getLeftView()
*/
protected function setNavigationId($id)
{
$this->getServiceLocator()->get('viewHelperManager')->get('placeholder')
->getContainer('navigationId')->set($id);
$this->placeholder->getContainer('navigationId')->set($id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Admin\Controller;

use Olcs\Controller\AbstractInternalController;
use Admin\Controller\Interfaces\IrhpPermitStockControllerInterface;
use Olcs\Controller\AbstractInternalController;

/**
* Abstract Class for Admin Irhp Permits to implement interface that handles setting Title and Subtitle.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Admin\Controller;

use Common\Service\Helper\FlashMessengerHelperService;
use Common\Service\Helper\FormHelperService;
use Common\Service\Helper\TranslationHelperService;
use Interop\Container\ContainerInterface;
use Laminas\Navigation\Navigation;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;

class BusNoticePeriodControllerFactory implements FactoryInterface
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null): BusNoticePeriodController
{
$translationHelper = $container->get(TranslationHelperService::class);
assert($translationHelper instanceof TranslationHelperService);

$formHelperService = $container->get(FormHelperService::class);
assert($formHelperService instanceof FormHelperService);

$flashMessenger = $container->get(FlashMessengerHelperService::class);
assert($flashMessenger instanceof FlashMessengerHelperService);

$navigation = $container->get('navigation');
assert($navigation instanceof Navigation);

return new BusNoticePeriodController(
$translationHelper,
$formHelperService,
$flashMessenger,
$navigation
);
}
public function createService(ServiceLocatorInterface $serviceLocator): BusNoticePeriodController
{
$container = method_exists($serviceLocator, 'getServiceLocator') ? $serviceLocator->getServiceLocator() : $serviceLocator;

return $this->__invoke(
$container,
BusNoticePeriodController::class
);
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<?php

/**
* Companies House Alert Controller
*/
namespace Admin\Controller;

use Admin\Controller\Traits\ReportLeftViewTrait;
use Common\Service\Helper\FlashMessengerHelperService;
use Common\Service\Helper\FormHelperService;
use Common\Service\Helper\TranslationHelperService;
use Dvsa\Olcs\Transfer\Command\CompaniesHouse\CloseAlerts as CloseDto;
use Dvsa\Olcs\Transfer\Query\CompaniesHouse\AlertList as ListDto;
use Laminas\Navigation\Navigation;
use Laminas\View\HelperPluginManager;
use Laminas\View\Model\ViewModel;
use Olcs\Controller\AbstractInternalController;
use Olcs\Controller\Interfaces\LeftViewProvider;
use Olcs\Form\Model\Form\CompaniesHouseAlertFilters as FilterForm;
use Olcs\Logging\Log\Logger;
use Laminas\View\Model\ViewModel;

/**
* Companies House Alert Controller
*/
class CompaniesHouseAlertController extends AbstractInternalController implements LeftViewProvider
{
use ReportLeftViewTrait;
Expand Down Expand Up @@ -59,6 +58,16 @@ class CompaniesHouseAlertController extends AbstractInternalController implement
]
];

public function __construct(
TranslationHelperService $translationHelperService,
FormHelperService $formHelper,
FlashMessengerHelperService $flashMessengerHelperService,
Navigation $navigation,
HelperPluginManager $viewHelperPluginManager
) {
$this->viewHelperPluginManager = $viewHelperPluginManager;
parent::__construct($translationHelperService, $formHelper, $flashMessengerHelperService, $navigation);
}
/**
* Companies house alert list view
*
Expand All @@ -72,8 +81,7 @@ public function indexAction()

// populate the filter dropdown from the data retrieved by the main ListDto
$valueOptions = $this->listData['extra']['valueOptions']['companiesHouseAlertReason'];
$this->getServiceLocator()
->get('viewHelperManager')
$this->viewHelperPluginManager
->get('placeholder')
->getContainer('tableFilters')
->getValue()
Expand All @@ -94,7 +102,7 @@ public function closeAction()
Logger::debug(__FILE__);
Logger::debug(__METHOD__);

$confirmMessage = $this->getServiceLocator()->get('Helper\Translation')
$confirmMessage = $this->translationHelperService
->translate('companies-house-alert.close.confirm');
$confirm = $this->confirm($confirmMessage);

Expand All @@ -107,11 +115,11 @@ public function closeAction()
$response = $this->handleCommand(CloseDto::create($dtoData));

if ($response->isServerError() || $response->isClientError()) {
$this->getServiceLocator()->get('Helper\FlashMessenger')->addErrorMessage('unknown-error');
$this->flashMessengerHelperService->addErrorMessage('unknown-error');
}

if ($response->isOk()) {
$this->getServiceLocator()->get('Helper\FlashMessenger')
$this->flashMessengerHelperService
->addSuccessMessage('companies-house-alert.close.success');
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace Admin\Controller;

use Common\Service\Helper\FlashMessengerHelperService;
use Common\Service\Helper\FormHelperService;
use Common\Service\Helper\TranslationHelperService;
use Interop\Container\ContainerInterface;
use Laminas\Navigation\Navigation;
use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Laminas\View\HelperPluginManager;

class CompaniesHouseAlertControllerFactory implements FactoryInterface
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null): CompaniesHouseAlertController
{
$translationHelperService = $container->get(TranslationHelperService::class);
assert($translationHelperService instanceof TranslationHelperService);

$formHelperService = $container->get(FormHelperService::class);
assert($formHelperService instanceof FormHelperService);

$flashMessengerHelperService = $container->get(FlashMessengerHelperService::class);
assert($flashMessengerHelperService instanceof FlashMessengerHelperService);

$navigation = $container->get('navigation');
assert($navigation instanceof Navigation);

$viewHelperManager = $container->get('ViewHelperManager');
assert($viewHelperManager instanceof HelperPluginManager);

return new CompaniesHouseAlertController(
$translationHelperService,
$formHelperService,
$flashMessengerHelperService,
$navigation,
$viewHelperManager
);
}
public function createService(ServiceLocatorInterface $serviceLocator): CompaniesHouseAlertController
{
$container = method_exists($serviceLocator, 'getServiceLocator') ? $serviceLocator->getServiceLocator() : $serviceLocator;

return $this->__invoke(
$container,
CompaniesHouseAlertController::class
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,49 @@

namespace Admin\Controller;

use Laminas\View\Model\ViewModel;
use Common\Controller\Lva\Traits\CrudActionTrait;
use Dvsa\Olcs\Transfer\Query\ContinuationDetail\ChecklistReminders as ChecklistRemindersQry;
use Common\Service\Helper\DateHelperService;
use Common\Service\Helper\FlashMessengerHelperService;
use Common\Service\Helper\FormHelperService;
use Common\Service\Helper\ResponseHelperService;
use Common\Service\Script\ScriptFactory;
use Common\Service\Table\TableFactory;
use Dvsa\Olcs\Transfer\Command\ContinuationDetail\Queue as QueueCmd;
use Dvsa\Olcs\Transfer\Query\ContinuationDetail\ChecklistReminders as ChecklistRemindersQry;
use Laminas\View\Helper\Placeholder;
use Laminas\View\Model\ViewModel;

/**
* ContinuationChecklistReminderController
*
* @author Mat Evans <[email protected]>
* @author Alex Peshkov <[email protected]>
*/
class ContinuationChecklistReminderController extends AbstractController
{
const TYPE_CONT_CHECKLIST_REMINDER_GENERATE_LETTER = 'que_typ_cont_check_rem_gen_let';
public const TYPE_CONT_CHECKLIST_REMINDER_GENERATE_LETTER = 'que_typ_cont_check_rem_gen_let';

use CrudActionTrait;

protected DateHelperService $dateHelper;
protected FlashMessengerHelperService $flashMessengerHelper;
protected ScriptFactory $scriptFactory;
protected FormHelperService $formHelper;
protected ResponseHelperService $responseHelper;
protected TableFactory $tableFactory;

public function __construct(
Placeholder $placeholder,
DateHelperService $dateHelper,
FlashMessengerHelperService $flashMessengerHelper,
ScriptFactory $scriptFactory,
FormHelperService $formHelper,
ResponseHelperService $responseHelper,
TableFactory $tableFactory
) {
parent::__construct($placeholder);
$this->dateHelper = $dateHelper;
$this->flashMessengerHelper = $flashMessengerHelper;
$this->scriptFactory = $scriptFactory;
$this->formHelper = $formHelper;
$this->responseHelper = $responseHelper;
$this->tableFactory = $tableFactory;
}

/**
* Display a list of Continuation checklist reminders
*
Expand All @@ -37,7 +63,7 @@ public function indexAction()
}
}

$nowDate = $this->getServiceLocator()->get('Helper\Date')->getDate('Y-m');
$nowDate = $this->dateHelper->getDate('Y-m');
list($year, $month) = explode('-', $nowDate);

$filterForm = $this->getChecklistReminderFilterForm($month, $year);
Expand All @@ -54,7 +80,7 @@ public function indexAction()
)
);
if ($response->isServerError() || $response->isClientError()) {
$this->getServiceLocator()->get('Helper\FlashMessenger')->addErrorMessage('unknown-error');
$this->flashMessengerHelper->addErrorMessage('unknown-error');
}
$results = [];
$total = 0;
Expand All @@ -67,13 +93,12 @@ public function indexAction()
$subTitle = date('M Y', strtotime($year . '-' . $month . '-01'));
$table->setVariable('title', $subTitle .': '. $total . ' licence(s)');

$this->getServiceLocator()->get('Script')->loadFiles(['forms/filter', 'forms/crud-table-handler']);
$this->scriptFactory->loadFiles(['forms/filter', 'forms/crud-table-handler']);

$view = new ViewModel(['table' => $table, 'filterForm' => $filterForm]);
$view->setTemplate('pages/table');

$this->getServiceLocator()->get('viewHelperManager')->get('placeholder')
->getContainer('tableFilters')->set($filterForm);
$this->placeholder->getContainer('tableFilters')->set($filterForm);
$this->setNavigationId('admin-dashboard/continuations');

return $this->renderView($view, 'admin-generate-continuation-details-title');
Expand All @@ -99,7 +124,7 @@ protected function getChecklistReminderFilterForm($defaultMonth, $defaultYear)

$filters = array_merge($defaults, $queryData);

$formHelper = $this->getServiceLocator()->get('Helper\Form');
$formHelper = $this->formHelper;
$form = $formHelper->createForm('ChecklistReminderFilter', false)
->setData(['filters' => $filters]);

Expand Down Expand Up @@ -129,7 +154,7 @@ public function generateLettersAction()
]
)
);
$flashMessenger = $this->getServiceLocator()->get('Helper\FlashMessenger');
$flashMessenger = $this->flashMessengerHelper;
if ($response->isClientError() || $response->isServerError()) {
$flashMessenger->addErrorMessage('The checklist reminder letters could not be generated, please try again');
}
Expand All @@ -154,7 +179,7 @@ public function exportAction()
ChecklistRemindersQry::create(['ids' => $continuationDetailIds])
);
if ($response->isServerError() || $response->isClientError()) {
$this->getServiceLocator()->get('Helper\FlashMessenger')->addErrorMessage('unknown-error');
$this->flashMessengerHelper->addErrorMessage('unknown-error');
return $this->redirect()->toRouteAjax(null, ['action' => null, 'child_id' => null], [], true);
}
$results = [];
Expand All @@ -164,7 +189,7 @@ public function exportAction()

$table = $this->getTable($results);

$helper = $this->getServiceLocator()->get('Helper\Response');
$helper = $this->responseHelper;
return $helper->tableToCsv($this->getResponse(), $table, 'Checklist reminder list');
}

Expand All @@ -177,8 +202,7 @@ public function exportAction()
*/
protected function getTable($results)
{
$table = $this->getServiceLocator()->get('Table')
->prepareTable('admin-continuations-checklist', $results);
$table = $this->tableFactory->prepareTable('admin-continuations-checklist', $results);

return $table;
}
Expand Down
Loading

0 comments on commit 531179a

Please sign in to comment.