diff --git a/composer.lock b/composer.lock index 8256d12c6b..89fd72b89b 100644 --- a/composer.lock +++ b/composer.lock @@ -4190,16 +4190,16 @@ }, { "name": "olcs/olcs-common", - "version": "v6.2.2", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/dvsa/olcs-common.git", - "reference": "fa9e8e8566f3e088d11f7c6eb9042578dd17c79d" + "reference": "7ba01db181d09ec92dc05cdb22af3a50125464b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dvsa/olcs-common/zipball/fa9e8e8566f3e088d11f7c6eb9042578dd17c79d", - "reference": "fa9e8e8566f3e088d11f7c6eb9042578dd17c79d", + "url": "https://api.github.com/repos/dvsa/olcs-common/zipball/7ba01db181d09ec92dc05cdb22af3a50125464b2", + "reference": "7ba01db181d09ec92dc05cdb22af3a50125464b2", "shasum": "" }, "require": { @@ -4257,9 +4257,9 @@ "notification-url": "https://packagist.org/downloads/", "description": "Common library for the OLCS Project", "support": { - "source": "https://github.com/dvsa/olcs-common/tree/v6.2.2" + "source": "https://github.com/dvsa/olcs-common/tree/v6.3.0" }, - "time": "2024-03-05T13:03:07+00:00" + "time": "2024-03-06T11:07:03+00:00" }, { "name": "olcs/olcs-logging", @@ -4316,16 +4316,16 @@ }, { "name": "olcs/olcs-transfer", - "version": "v6.3.0", + "version": "v6.5.0", "source": { "type": "git", "url": "https://github.com/dvsa/olcs-transfer.git", - "reference": "077a3c1f63fe2f08b4264234ab34641d9d7dff89" + "reference": "1bcbf1228944bdc15eb59da03af6206f00983f25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dvsa/olcs-transfer/zipball/077a3c1f63fe2f08b4264234ab34641d9d7dff89", - "reference": "077a3c1f63fe2f08b4264234ab34641d9d7dff89", + "url": "https://api.github.com/repos/dvsa/olcs-transfer/zipball/1bcbf1228944bdc15eb59da03af6206f00983f25", + "reference": "1bcbf1228944bdc15eb59da03af6206f00983f25", "shasum": "" }, "require": { @@ -4366,9 +4366,9 @@ "notification-url": "https://packagist.org/downloads/", "description": "OLCS Transfer", "support": { - "source": "https://github.com/dvsa/olcs-transfer/tree/v6.3.0" + "source": "https://github.com/dvsa/olcs-transfer/tree/v6.5.0" }, - "time": "2024-03-01T15:58:32+00:00" + "time": "2024-03-05T16:35:41+00:00" }, { "name": "olcs/olcs-utils", diff --git a/module/Olcs/config/module.config.php b/module/Olcs/config/module.config.php index ade1fc773b..549b44f82a 100644 --- a/module/Olcs/config/module.config.php +++ b/module/Olcs/config/module.config.php @@ -53,6 +53,7 @@ use Olcs\Controller\Interfaces\CaseControllerInterface; use Olcs\Controller\Interfaces\IrhpApplicationControllerInterface; use Olcs\Controller\Interfaces\LicenceControllerInterface; +use Olcs\Controller\Interfaces\MessagingControllerInterface; use Olcs\Controller\Interfaces\OperatorControllerInterface; use Olcs\Controller\Interfaces\SubmissionControllerInterface; use Olcs\Controller\Interfaces\TransportManagerControllerInterface; @@ -70,14 +71,6 @@ use Olcs\Controller\Lva\Factory\Controller\Variation as LvaVariationControllerFactories; use Olcs\Controller\Lva\Licence as LvaLicenceControllers; use Olcs\Controller\Lva\Variation as LvaVariationControllers; -use Olcs\Controller\Messages\ApplicationConversationListController; -use Olcs\Controller\Messages\ApplicationCreateConversationController; -use Olcs\Controller\Messages\ApplicationConversationMessagesController; -use Olcs\Controller\Messages\ApplicationEnableDisableMessagingController; -use Olcs\Controller\Messages\LicenceConversationListController; -use Olcs\Controller\Messages\LicenceConversationMessagesController; -use Olcs\Controller\Messages\LicenceCreateConversationController; -use Olcs\Controller\Messages\LicenceEnableDisableMessagingController; use Olcs\Controller\Operator as OperatorControllers; use Olcs\Controller\Operator\HistoryController; use Olcs\Controller\Operator\OperatorBusinessDetailsController; @@ -307,17 +300,32 @@ LvaVariationControllers\VehiclesPsvController::class => LvaVariationControllerFactories\VehiclesPsvControllerFactory::class, LvaVariationControllers\WithdrawController::class => LvaVariationControllerFactories\WithdrawControllerFactory::class, Olcs\Controller\IndexController::class => Olcs\Controller\Factory\IndexControllerFactory::class, - Olcs\Controller\Messages\ApplicationConversationMessagesController::class => Olcs\Controller\Factory\Messages\ApplicationConversationMessagesControllerFactory::class, - Olcs\Controller\Messages\LicenceConversationMessagesController::class => Olcs\Controller\Factory\Messages\LicenceConversationMessagesControllerFactory::class, - Olcs\Controller\Messages\ApplicationConversationListController::class => Olcs\Controller\Factory\Messages\ApplicationConversationListControllerFactory::class, - Olcs\Controller\Messages\LicenceConversationListController::class => Olcs\Controller\Factory\Messages\LicenceConversationListControllerFactory::class, - Olcs\Controller\Messages\ApplicationEnableDisableMessagingController::class => Olcs\Controller\Factory\Messages\ApplicationEnableDisableMessagingControllerFactory::class, + Olcs\Controller\Messages\ApplicationConversationMessagesController::class => Olcs\Controller\Factory\Messages\ConversationMessagesControllerFactory::class, + Olcs\Controller\Messages\BusConversationMessagesController::class => Olcs\Controller\Factory\Messages\ConversationMessagesControllerFactory::class, + Olcs\Controller\Messages\CaseConversationMessagesController::class => Olcs\Controller\Factory\Messages\ConversationMessagesControllerFactory::class, + Olcs\Controller\Messages\IrhpApplicationConversationMessagesController::class => Olcs\Controller\Factory\Messages\ConversationMessagesControllerFactory::class, + Olcs\Controller\Messages\LicenceConversationMessagesController::class => Olcs\Controller\Factory\Messages\ConversationMessagesControllerFactory::class, + Olcs\Controller\Messages\ApplicationConversationListController::class => Olcs\Controller\Factory\Messages\ConversationListControllerFactory::class, + Olcs\Controller\Messages\BusConversationListController::class => Olcs\Controller\Factory\Messages\ConversationListControllerFactory::class, + Olcs\Controller\Messages\CaseConversationListController::class => Olcs\Controller\Factory\Messages\ConversationListControllerFactory::class, + Olcs\Controller\Messages\IrhpApplicationConversationListController::class => Olcs\Controller\Factory\Messages\ConversationListControllerFactory::class, + Olcs\Controller\Messages\LicenceConversationListController::class => Olcs\Controller\Factory\Messages\ConversationListControllerFactory::class, + Olcs\Controller\Messages\ApplicationEnableDisableMessagingController::class => Olcs\Controller\Factory\Messages\EnableDisableMessagingControllerFactory::class, + Olcs\Controller\Messages\BusEnableDisableMessagingController::class => Olcs\Controller\Factory\Messages\EnableDisableMessagingControllerFactory::class, + Olcs\Controller\Messages\CaseEnableDisableMessagingController::class => Olcs\Controller\Factory\Messages\EnableDisableMessagingControllerFactory::class, + Olcs\Controller\Messages\IrhpApplicationEnableDisableMessagingController::class => Olcs\Controller\Factory\Messages\EnableDisableMessagingControllerFactory::class, + Olcs\Controller\Messages\LicenceEnableDisableMessagingController::class => Olcs\Controller\Factory\Messages\EnableDisableMessagingControllerFactory::class, + Olcs\Controller\Messages\ApplicationCreateConversationController::class => Olcs\Controller\Factory\Messages\CreateConversationControllerFactory::class, + Olcs\Controller\Messages\BusCreateConversationController::class => Olcs\Controller\Factory\Messages\CreateConversationControllerFactory::class, + Olcs\Controller\Messages\CaseCreateConversationController::class => Olcs\Controller\Factory\Messages\CreateConversationControllerFactory::class, + Olcs\Controller\Messages\IrhpApplicationCreateConversationController::class => Olcs\Controller\Factory\Messages\CreateConversationControllerFactory::class, + Olcs\Controller\Messages\LicenceCreateConversationController::class => Olcs\Controller\Factory\Messages\CreateConversationControllerFactory::class, + Olcs\Controller\Messages\ApplicationCloseConversationController::class => Olcs\Controller\Factory\Messages\CloseConversationControllerFactory::class, + Olcs\Controller\Messages\BusCloseConversationController::class => Olcs\Controller\Factory\Messages\CloseConversationControllerFactory::class, + Olcs\Controller\Messages\CaseCloseConversationController::class => Olcs\Controller\Factory\Messages\CloseConversationControllerFactory::class, + Olcs\Controller\Messages\IrhpApplicationCloseConversationController::class => Olcs\Controller\Factory\Messages\CloseConversationControllerFactory::class, + Olcs\Controller\Messages\LicenceCloseConversationController::class => Olcs\Controller\Factory\Messages\CloseConversationControllerFactory::class, Olcs\Controller\Messages\EnableDisableFileUploadController::class => Olcs\Controller\Factory\Messages\EnableDisableFileUploadControllerFactory::class, - Olcs\Controller\Messages\LicenceEnableDisableMessagingController::class => Olcs\Controller\Factory\Messages\LicenceEnableDisableMessagingControllerFactory::class, - Olcs\Controller\Messages\ApplicationCreateConversationController::class => Olcs\Controller\Factory\Messages\ApplicationCreateConversationControllerFactory::class, - Olcs\Controller\Messages\LicenceCreateConversationController::class => Olcs\Controller\Factory\Messages\LicenceCreateConversationControllerFactory::class, - Olcs\Controller\Messages\ApplicationCloseConversationController::class => Olcs\Controller\Factory\Messages\ApplicationCloseConversationControllerFactory::class, - Olcs\Controller\Messages\LicenceCloseConversationController::class => Olcs\Controller\Factory\Messages\LicenceCloseConversationControllerFactory::class, OperatorControllers\OperatorFeesController::class => OperatorControllerFactories\OperatorFeesControllerFactory::class, OperatorControllers\OperatorProcessingTasksController::class => OperatorControllerFactories\OperatorProcessingTasksControllerFactory::class, OperatorControllers\UnlicensedBusinessDetailsController::class => OperatorControllerFactories\UnlicensedBusinessDetailsControllerFactory::class, @@ -340,6 +348,7 @@ DocumentControllers\DocumentGenerationController::class => DocumentControllerFactories\DocumentGenerationControllerFactory::class, DocumentControllers\DocumentRelinkController::class => DocumentControllerFactories\DocumentRelinkControllerFactory::class, DocumentControllers\DocumentUploadController::class => DocumentControllerFactories\DocumentUploadControllerFactory::class, + IrhpPermitsControllers\IrhpApplicationDocsController::class => IrhpPermitsControllerFactories\IrhpApplicationDocsControllerFactory::class, IrhpPermitsControllers\IrhpApplicationFeesController::class => IrhpPermitsControllerFactories\IrhpApplicationFeesControllerFactory::class, IrhpPermitsControllers\IrhpApplicationProcessingOverviewController::class => IrhpPermitsControllerFactories\IrhpApplicationProcessingOverviewControllerFactory::class, @@ -846,28 +855,7 @@ RouteParam\LicenceFurniture::class, RouteParam\Licence::class, ], - ApplicationEnableDisableMessagingController::class => [ - RouteParam\Conversation::class, - ], - LicenceEnableDisableMessagingController::class => [ - RouteParam\Conversation::class, - ], - ApplicationConversationListController::class => [ - RouteParam\Conversation::class, - ], - LicenceConversationListController::class => [ - RouteParam\Conversation::class, - ], - LicenceConversationMessagesController::class => [ - RouteParam\Conversation::class, - ], - ApplicationConversationMessagesController::class => [ - RouteParam\Conversation::class, - ], - LicenceCreateConversationController::class => [ - RouteParam\Conversation::class, - ], - ApplicationCreateConversationController::class => [ + MessagingControllerInterface::class => [ RouteParam\Conversation::class, ], ], diff --git a/module/Olcs/config/navigation.config.php b/module/Olcs/config/navigation.config.php index 0b5ef2f80f..c699a37bc3 100644 --- a/module/Olcs/config/navigation.config.php +++ b/module/Olcs/config/navigation.config.php @@ -395,7 +395,50 @@ 'use_route_match' => true, ], ] - ] + ], + [ + 'id' => 'case_conversations', + 'tag' => 'messaging-menu', + 'visible' => false, + 'label' => 'Messages', + 'route' => 'case_conversation', + 'class' => 'govuk-link--no-visited-state', + 'use_route_match' => true, + 'pages' => [ + [ + 'id' => 'case_conversations_list', + 'label' => 'Messages', + 'route' => 'case_conversation', + 'class' => 'govuk-link--no-visited-state', + 'use_route_match' => true, + + ], + [ + 'id' => 'case_new_conversation', + 'label' => 'New Conversation', + 'route' => 'case_conversation/new', + 'class' => 'govuk-link--no-visited-state', + 'use_route_match' => true, + + ], + [ + 'id' => 'case_conversation_list_disable_messaging', + 'label' => 'Disable Messaging', + 'route' => 'case_conversation/disable', + 'tag' => 'conversation_list_disable_messaging', + 'class' => 'govuk-link--no-visited-state', + 'use_route_match' => true, + ], + [ + 'id' => 'case_conversation_list_enable_messaging', + 'label' => 'Enable Messaging', + 'route' => 'case_conversation/enable', + 'tag' => 'conversation_list_enable_messaging', + 'class' => 'govuk-link--no-visited-state', + 'use_route_match' => true, + ] + ], + ], ], ], [ @@ -613,6 +656,49 @@ ], ] ], + [ + 'id' => 'bus_conversations', + 'tag' => 'messaging-menu', + 'visible' => false, + 'label' => 'Messages', + 'route' => 'licence/bus_conversation', + 'class' => 'govuk-link--no-visited-state', + 'use_route_match' => true, + 'pages' => [ + [ + 'id' => 'bus_conversations_list', + 'label' => 'Messages', + 'route' => 'licence/bus_conversation', + 'class' => 'govuk-link--no-visited-state', + 'use_route_match' => true, + + ], + [ + 'id' => 'bus_new_conversation', + 'label' => 'New Conversation', + 'route' => 'licence/bus_conversation/new', + 'class' => 'govuk-link--no-visited-state', + 'use_route_match' => true, + + ], + [ + 'id' => 'bus_conversation_list_disable_messaging', + 'label' => 'Disable Messaging', + 'route' => 'licence/bus_conversation/disable', + 'tag' => 'conversation_list_disable_messaging', + 'class' => 'govuk-link--no-visited-state', + 'use_route_match' => true, + ], + [ + 'id' => 'bus_conversation_list_enable_messaging', + 'label' => 'Enable Messaging', + 'route' => 'licence/bus_conversation/enable', + 'tag' => 'conversation_list_enable_messaging', + 'class' => 'govuk-link--no-visited-state', + 'use_route_match' => true, + ] + ], + ], ] ], [ @@ -781,6 +867,47 @@ 'id' => null ], ], + [ + 'id' => 'irhp_conversations', + 'tag' => 'messaging-menu', + 'visible' => false, + 'label' => 'Messages', + 'route' => 'licence/irhp-application-conversation', + 'class' => 'govuk-link--no-visited-state', + 'use_route_match' => true, + 'pages' => [ + [ + 'id' => 'irhp_conversations_list', + 'label' => 'Messages', + 'route' => 'licence/irhp-application-conversation', + 'class' => 'govuk-link--no-visited-state', + 'use_route_match' => true, + ], + [ + 'id' => 'irhp_new_conversation', + 'label' => 'New Conversation', + 'route' => 'licence/irhp-application-conversation/new', + 'class' => 'govuk-link--no-visited-state', + 'use_route_match' => true, + ], + [ + 'id' => 'irhp_conversation_list_disable_messaging', + 'label' => 'Disable Messaging', + 'route' => 'licence/irhp-application-conversation/disable', + 'class' => 'govuk-link--no-visited-state', + 'tag' => 'conversation_list_disable_messaging', + 'use_route_match' => true, + ], + [ + 'id' => 'irhp_conversation_list_enable_messaging', + 'label' => 'Enable Messaging', + 'route' => 'licence/irhp-application-conversation/enable', + 'class' => 'govuk-link--no-visited-state', + 'tag' => 'conversation_list_enable_messaging', + 'use_route_match' => true, + ] + ], + ], ], ], [ @@ -904,6 +1031,8 @@ ], [ 'id' => 'conversations', + 'tag' => 'messaging-menu', + 'visible' => false, 'label' => 'Messages', 'route' => 'licence/conversation', 'class' => 'govuk-link--no-visited-state', @@ -929,6 +1058,7 @@ 'id' => 'conversation_list_disable_messaging', 'label' => 'Disable Messaging', 'route' => 'licence/conversation/disable', + 'tag' => 'conversation_list_disable_messaging', 'class' => 'govuk-link--no-visited-state', 'use_route_match' => true, ], @@ -936,6 +1066,7 @@ 'id' => 'conversation_list_enable_messaging', 'label' => 'Enable Messaging', 'route' => 'licence/conversation/enable', + 'tag' => 'conversation_list_enable_messaging', 'class' => 'govuk-link--no-visited-state', 'use_route_match' => true, ] @@ -1390,6 +1521,8 @@ ], [ 'id' => 'application_conversations', + 'tag' => 'messaging-menu', + 'visible' => false, 'label' => 'Messages', 'route' => 'lva-application/conversation', 'class' => 'govuk-link--no-visited-state', @@ -1413,6 +1546,7 @@ 'id' => 'application_conversation_list_disable_messaging', 'label' => 'Disable Messaging', 'route' => 'lva-application/conversation/disable', + 'tag' => 'conversation_list_disable_messaging', 'class' => 'govuk-link--no-visited-state', 'use_route_match' => true, ], @@ -1420,6 +1554,7 @@ 'id' => 'application_conversation_list_enable_messaging', 'label' => 'Enable Messaging', 'route' => 'lva-application/conversation/enable', + 'tag' => 'conversation_list_enable_messaging', 'class' => 'govuk-link--no-visited-state', 'use_route_match' => true, ] diff --git a/module/Olcs/config/routes.config.php b/module/Olcs/config/routes.config.php index 555d573367..88d2edea63 100644 --- a/module/Olcs/config/routes.config.php +++ b/module/Olcs/config/routes.config.php @@ -558,6 +558,112 @@ ], 'may_terminate' => true ], + 'bus_conversation' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'bus/:busRegId/conversation[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\BusConversationListController::class, + 'action' => 'index', + 'type' => 'busReg', + ], + ], + 'may_terminate' => true, + 'child_routes' => [ + 'view' => [ + 'type' => 'segment', + 'options' => [ + 'route' => ':conversation[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\BusConversationMessagesController::class, + 'action' => 'index' + ], + ], + 'may_terminate' => true, + ], + 'new' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'new[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\BusCreateConversationController::class, + 'action' => 'add' + ], + ], + 'may_terminate' => true, + ], + 'close' => [ + 'type' => 'segment', + 'options' => [ + 'route' => ':conversation/close[/]', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\BusCloseConversationController::class, + 'action' => 'confirm' + ], + ], + 'may_terminate' => true, + ], + 'disable' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'disable[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\BusEnableDisableMessagingController::class, + 'action' => 'index', + 'type' => 'disable', + ] + ], + 'may_terminate' => true, + 'child_routes' => [ + 'popup' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'popup[/]', + 'verb' => 'POST', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\BusEnableDisableMessagingController::class, + 'action' => 'popup', + 'type' => 'disable', + ], + ], + 'may_terminate' => true, + ], + ], + ], + 'enable' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'enable[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\BusEnableDisableMessagingController::class, + 'action' => 'index', + 'type' => 'enable', + ] + ], + 'may_terminate' => true, + 'child_routes' => [ + 'popup' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'popup[/]', + 'verb' => 'POST', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\BusEnableDisableMessagingController::class, + 'action' => 'popup', + 'type' => 'enable', + ], + ], + 'may_terminate' => true, + ], + ], + ], + ], + ], 'bus-docs' => [ 'type' => 'segment', 'options' => [ @@ -746,7 +852,8 @@ 'verb' => 'GET', 'defaults' => [ 'controller' => Olcs\Controller\Messages\LicenceConversationListController::class, - 'action' => 'index' + 'action' => 'index', + 'type' => 'licence', ], ], 'may_terminate' => true, @@ -1137,6 +1244,112 @@ ], ], ], + 'irhp-application-conversation' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'irhp-application/:irhpAppId/conversation[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\IrhpApplicationConversationListController::class, + 'action' => 'index', + 'type' => 'irhp-application', + ], + ], + 'may_terminate' => true, + 'child_routes' => [ + 'view' => [ + 'type' => 'segment', + 'options' => [ + 'route' => ':conversation[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\IrhpApplicationConversationMessagesController::class, + 'action' => 'index' + ], + ], + 'may_terminate' => true, + ], + 'new' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'new[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\IrhpApplicationCreateConversationController::class, + 'action' => 'add' + ], + ], + 'may_terminate' => true, + ], + 'close' => [ + 'type' => 'segment', + 'options' => [ + 'route' => ':conversation/close[/]', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\IrhpApplicationCloseConversationController::class, + 'action' => 'confirm' + ], + ], + 'may_terminate' => true, + ], + 'disable' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'disable[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\IrhpApplicationEnableDisableMessagingController::class, + 'action' => 'index', + 'type' => 'disable', + ] + ], + 'may_terminate' => true, + 'child_routes' => [ + 'popup' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'popup[/]', + 'verb' => 'POST', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\IrhpApplicationEnableDisableMessagingController::class, + 'action' => 'popup', + 'type' => 'disable', + ], + ], + 'may_terminate' => true, + ], + ], + ], + 'enable' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'enable[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\IrhpApplicationEnableDisableMessagingController::class, + 'action' => 'index', + 'type' => 'enable', + ] + ], + 'may_terminate' => true, + 'child_routes' => [ + 'popup' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'popup[/]', + 'verb' => 'POST', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\CaseEnableDisableMessagingController::class, + 'action' => 'popup', + 'type' => 'enable', + ], + ], + 'may_terminate' => true, + ], + ], + ], + ], + ], 'irhp-application-docs' => [ 'type' => 'segment', 'options' => [ @@ -2684,7 +2897,8 @@ 'verb' => 'GET', 'defaults' => [ 'controller' => Olcs\Controller\Messages\ApplicationConversationListController::class, - 'action' => 'index' + 'action' => 'index', + 'type' => 'application', ], ], 'may_terminate' => true, diff --git a/module/Olcs/config/routes/licence/case.php b/module/Olcs/config/routes/licence/case.php index 7d093863af..72e8963c8a 100644 --- a/module/Olcs/config/routes/licence/case.php +++ b/module/Olcs/config/routes/licence/case.php @@ -37,6 +37,112 @@ ] ] ], + 'case_conversation' => [ + 'type' => 'segment', + 'options' => [ + 'route' => '/case/:case/conversation[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\CaseConversationListController::class, + 'action' => 'index', + 'type' => 'case', + ], + ], + 'may_terminate' => true, + 'child_routes' => [ + 'view' => [ + 'type' => 'segment', + 'options' => [ + 'route' => ':conversation[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\CaseConversationMessagesController::class, + 'action' => 'index' + ], + ], + 'may_terminate' => true, + ], + 'new' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'new[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\CaseCreateConversationController::class, + 'action' => 'add' + ], + ], + 'may_terminate' => true, + ], + 'close' => [ + 'type' => 'segment', + 'options' => [ + 'route' => ':conversation/close[/]', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\CaseCloseConversationController::class, + 'action' => 'confirm' + ], + ], + 'may_terminate' => true, + ], + 'disable' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'disable[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\CaseEnableDisableMessagingController::class, + 'action' => 'index', + 'type' => 'disable', + ] + ], + 'may_terminate' => true, + 'child_routes' => [ + 'popup' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'popup[/]', + 'verb' => 'POST', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\CaseEnableDisableMessagingController::class, + 'action' => 'popup', + 'type' => 'disable', + ], + ], + 'may_terminate' => true, + ], + ], + ], + 'enable' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'enable[/]', + 'verb' => 'GET', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\CaseEnableDisableMessagingController::class, + 'action' => 'index', + 'type' => 'enable', + ] + ], + 'may_terminate' => true, + 'child_routes' => [ + 'popup' => [ + 'type' => 'segment', + 'options' => [ + 'route' => 'popup[/]', + 'verb' => 'POST', + 'defaults' => [ + 'controller' => Olcs\Controller\Messages\CaseEnableDisableMessagingController::class, + 'action' => 'popup', + 'type' => 'enable', + ], + ], + 'may_terminate' => true, + ], + ], + ], + ], + ], 'case_opposition' => [ 'type' => 'segment', 'options' => [ diff --git a/module/Olcs/src/Controller/Factory/Messages/ApplicationCloseConversationControllerFactory.php b/module/Olcs/src/Controller/Factory/Messages/ApplicationCloseConversationControllerFactory.php deleted file mode 100644 index e069b8b3b8..0000000000 --- a/module/Olcs/src/Controller/Factory/Messages/ApplicationCloseConversationControllerFactory.php +++ /dev/null @@ -1,38 +0,0 @@ -get(ScriptFactory::class); - $formHelper = $container->get(FormHelperService::class); - $tableFactory = $container->get(TableFactory::class); - $viewHelperManager = $container->get(HelperPluginManager::class); - $flashMessengerHelperService = $container->get(FlashMessengerHelperService::class); - - return new ApplicationCloseConversationController( - $scriptFactory, - $formHelper, - $tableFactory, - $viewHelperManager, - $flashMessengerHelperService, - ); - } -} diff --git a/module/Olcs/src/Controller/Factory/Messages/ApplicationConversationListControllerFactory.php b/module/Olcs/src/Controller/Factory/Messages/ApplicationConversationListControllerFactory.php deleted file mode 100644 index 4c13bbaf1c..0000000000 --- a/module/Olcs/src/Controller/Factory/Messages/ApplicationConversationListControllerFactory.php +++ /dev/null @@ -1,37 +0,0 @@ -get(FormHelperService::class); - - $translationHelper = $container->get(TranslationHelperService::class); - - $flashMessenger = $container->get(FlashMessengerHelperService::class); - - $navigation = $container->get('navigation'); - - return new ApplicationConversationListController( - $translationHelper, - $formHelper, - $flashMessenger, - $navigation - ); - } -} diff --git a/module/Olcs/src/Controller/Factory/Messages/ApplicationEnableDisableMessagingControllerFactory.php b/module/Olcs/src/Controller/Factory/Messages/ApplicationEnableDisableMessagingControllerFactory.php deleted file mode 100644 index ed74237bea..0000000000 --- a/module/Olcs/src/Controller/Factory/Messages/ApplicationEnableDisableMessagingControllerFactory.php +++ /dev/null @@ -1,46 +0,0 @@ -get(ScriptFactory::class); - $formHelper = $container->get(FormHelperService::class); - $tableFactory = $container->get(TableFactory::class); - $viewHelperManager = $container->get(HelperPluginManager::class); - $dataServiceManager = $container->get(PluginManager::class); - $oppositionHelper = $container->get(OppositionHelperService::class); - $complaintsHelper = $container->get(ComplaintsHelperService::class); - $flashMessengerHelper = $container->get(FlashMessengerHelperService::class); - $urlHelper = $container->get(UrlHelperService::class); - - return new ApplicationEnableDisableMessagingController( - $scriptFactory, - $formHelper, - $tableFactory, - $viewHelperManager, - $dataServiceManager, - $oppositionHelper, - $complaintsHelper, - $flashMessengerHelper, - $urlHelper, - ); - } -} diff --git a/module/Olcs/src/Controller/Factory/Messages/LicenceCloseConversationControllerFactory.php b/module/Olcs/src/Controller/Factory/Messages/CloseConversationControllerFactory.php similarity index 70% rename from module/Olcs/src/Controller/Factory/Messages/LicenceCloseConversationControllerFactory.php rename to module/Olcs/src/Controller/Factory/Messages/CloseConversationControllerFactory.php index e07534ca68..558985f6bf 100644 --- a/module/Olcs/src/Controller/Factory/Messages/LicenceCloseConversationControllerFactory.php +++ b/module/Olcs/src/Controller/Factory/Messages/CloseConversationControllerFactory.php @@ -11,15 +11,10 @@ use Psr\Container\ContainerInterface; use Laminas\ServiceManager\Factory\FactoryInterface; use Laminas\View\HelperPluginManager; -use Olcs\Controller\Messages\LicenceCloseConversationController; -class LicenceCloseConversationControllerFactory implements FactoryInterface +class CloseConversationControllerFactory implements FactoryInterface { - public function __invoke( - ContainerInterface $container, - $requestedName, - ?array $options = null - ): LicenceCloseConversationController + public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null) { $scriptFactory = $container->get(ScriptFactory::class); $formHelper = $container->get(FormHelperService::class); @@ -27,7 +22,7 @@ public function __invoke( $viewHelperManager = $container->get(HelperPluginManager::class); $flashMessengerHelperService = $container->get(FlashMessengerHelperService::class); - return new LicenceCloseConversationController( + return new $requestedName( $scriptFactory, $formHelper, $tableFactory, diff --git a/module/Olcs/src/Controller/Factory/Messages/ApplicationCreateConversationControllerFactory.php b/module/Olcs/src/Controller/Factory/Messages/ConversationListControllerFactory.php similarity index 71% rename from module/Olcs/src/Controller/Factory/Messages/ApplicationCreateConversationControllerFactory.php rename to module/Olcs/src/Controller/Factory/Messages/ConversationListControllerFactory.php index 171ac620b4..9eee590328 100644 --- a/module/Olcs/src/Controller/Factory/Messages/ApplicationCreateConversationControllerFactory.php +++ b/module/Olcs/src/Controller/Factory/Messages/ConversationListControllerFactory.php @@ -7,24 +7,23 @@ use Common\Service\Helper\FlashMessengerHelperService; use Common\Service\Helper\FormHelperService; use Common\Service\Helper\TranslationHelperService; -use Psr\Container\ContainerInterface; use Laminas\ServiceManager\Factory\FactoryInterface; -use Olcs\Controller\Messages\ApplicationCreateConversationController; +use Psr\Container\ContainerInterface; -class ApplicationCreateConversationControllerFactory implements FactoryInterface +class ConversationListControllerFactory implements FactoryInterface { - public function __invoke(ContainerInterface $container, $requestedName, array $options = null): ApplicationCreateConversationController + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $formHelper = $container->get(FormHelperService::class); $translationHelper = $container->get(TranslationHelperService::class); $flashMessenger = $container->get(FlashMessengerHelperService::class); $navigation = $container->get('navigation'); - return new ApplicationCreateConversationController( + return new $requestedName( $translationHelper, $formHelper, $flashMessenger, - $navigation + $navigation, ); } } diff --git a/module/Olcs/src/Controller/Factory/Messages/ApplicationConversationMessagesControllerFactory.php b/module/Olcs/src/Controller/Factory/Messages/ConversationMessagesControllerFactory.php similarity index 76% rename from module/Olcs/src/Controller/Factory/Messages/ApplicationConversationMessagesControllerFactory.php rename to module/Olcs/src/Controller/Factory/Messages/ConversationMessagesControllerFactory.php index c80ccce6e0..f6dff36cf7 100644 --- a/module/Olcs/src/Controller/Factory/Messages/ApplicationConversationMessagesControllerFactory.php +++ b/module/Olcs/src/Controller/Factory/Messages/ConversationMessagesControllerFactory.php @@ -8,13 +8,13 @@ use Common\Service\Helper\FormHelperService; use Common\Service\Helper\TranslationHelperService; use Common\Service\Script\ScriptFactory; -use Psr\Container\ContainerInterface; use Laminas\ServiceManager\Factory\FactoryInterface; -use Olcs\Controller\Messages\ApplicationConversationMessagesController; +use Olcs\Controller\Messages\AbstractConversationMessagesController; +use Psr\Container\ContainerInterface; -class ApplicationConversationMessagesControllerFactory implements FactoryInterface +class ConversationMessagesControllerFactory implements FactoryInterface { - public function __invoke(ContainerInterface $container, $requestedName, array $options = null): ApplicationConversationMessagesController + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $formHelper = $container->get(FormHelperService::class); $translationHelper = $container->get(TranslationHelperService::class); @@ -23,7 +23,7 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o $navigation = $container->get('navigation'); - return new ApplicationConversationMessagesController( + return new $requestedName( $translationHelper, $formHelper, $flashMessenger, diff --git a/module/Olcs/src/Controller/Factory/Messages/LicenceCreateConversationControllerFactory.php b/module/Olcs/src/Controller/Factory/Messages/CreateConversationControllerFactory.php similarity index 74% rename from module/Olcs/src/Controller/Factory/Messages/LicenceCreateConversationControllerFactory.php rename to module/Olcs/src/Controller/Factory/Messages/CreateConversationControllerFactory.php index dd9953b567..22d187c1e4 100644 --- a/module/Olcs/src/Controller/Factory/Messages/LicenceCreateConversationControllerFactory.php +++ b/module/Olcs/src/Controller/Factory/Messages/CreateConversationControllerFactory.php @@ -9,18 +9,17 @@ use Common\Service\Helper\TranslationHelperService; use Psr\Container\ContainerInterface; use Laminas\ServiceManager\Factory\FactoryInterface; -use Olcs\Controller\Messages\LicenceCreateConversationController; -class LicenceCreateConversationControllerFactory implements FactoryInterface +class CreateConversationControllerFactory implements FactoryInterface { - public function __invoke(ContainerInterface $container, $requestedName, array $options = null): LicenceCreateConversationController + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $formHelper = $container->get(FormHelperService::class); $translationHelper = $container->get(TranslationHelperService::class); $flashMessenger = $container->get(FlashMessengerHelperService::class); $navigation = $container->get('navigation'); - return new LicenceCreateConversationController( + return new $requestedName( $translationHelper, $formHelper, $flashMessenger, diff --git a/module/Olcs/src/Controller/Factory/Messages/EnableDisableFileUploadControllerFactory.php b/module/Olcs/src/Controller/Factory/Messages/EnableDisableFileUploadControllerFactory.php index db08a796be..fc319bc982 100644 --- a/module/Olcs/src/Controller/Factory/Messages/EnableDisableFileUploadControllerFactory.php +++ b/module/Olcs/src/Controller/Factory/Messages/EnableDisableFileUploadControllerFactory.php @@ -19,7 +19,7 @@ class EnableDisableFileUploadControllerFactory implements FactoryInterface { - public function __invoke(ContainerInterface $container, $requestedName, array $options = null): EnableDisableFileUploadController + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $scriptFactory = $container->get(ScriptFactory::class); $formHelper = $container->get(FormHelperService::class); diff --git a/module/Olcs/src/Controller/Factory/Messages/LicenceEnableDisableMessagingControllerFactory.php b/module/Olcs/src/Controller/Factory/Messages/EnableDisableMessagingControllerFactory.php similarity index 84% rename from module/Olcs/src/Controller/Factory/Messages/LicenceEnableDisableMessagingControllerFactory.php rename to module/Olcs/src/Controller/Factory/Messages/EnableDisableMessagingControllerFactory.php index bf46a0791b..77f205e25c 100644 --- a/module/Olcs/src/Controller/Factory/Messages/LicenceEnableDisableMessagingControllerFactory.php +++ b/module/Olcs/src/Controller/Factory/Messages/EnableDisableMessagingControllerFactory.php @@ -15,11 +15,10 @@ use Psr\Container\ContainerInterface; use Laminas\ServiceManager\Factory\FactoryInterface; use Laminas\View\HelperPluginManager; -use Olcs\Controller\Messages\LicenceEnableDisableMessagingController; -class LicenceEnableDisableMessagingControllerFactory implements FactoryInterface +class EnableDisableMessagingControllerFactory implements FactoryInterface { - public function __invoke(ContainerInterface $container, $requestedName, array $options = null): LicenceEnableDisableMessagingController + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $scriptFactory = $container->get(ScriptFactory::class); $formHelper = $container->get(FormHelperService::class); @@ -31,7 +30,7 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o $flashMessengerHelper = $container->get(FlashMessengerHelperService::class); $urlHelper = $container->get(UrlHelperService::class); - return new LicenceEnableDisableMessagingController( + return new $requestedName( $scriptFactory, $formHelper, $tableFactory, diff --git a/module/Olcs/src/Controller/Factory/Messages/LicenceConversationListControllerFactory.php b/module/Olcs/src/Controller/Factory/Messages/LicenceConversationListControllerFactory.php deleted file mode 100644 index 97ca10260c..0000000000 --- a/module/Olcs/src/Controller/Factory/Messages/LicenceConversationListControllerFactory.php +++ /dev/null @@ -1,42 +0,0 @@ -get(FormHelperService::class); - assert($formHelper instanceof FormHelperService); - - $translationHelper = $container->get(TranslationHelperService::class); - assert($translationHelper instanceof TranslationHelperService); - - $flashMessenger = $container->get(FlashMessengerHelperService::class); - assert($flashMessenger instanceof FlashMessengerHelperService); - - $navigation = $container->get('navigation'); - assert($navigation instanceof Navigation); - - return new LicenceConversationListController( - $translationHelper, - $formHelper, - $flashMessenger, - $navigation - ); - } -} diff --git a/module/Olcs/src/Controller/Factory/Messages/LicenceConversationMessagesControllerFactory.php b/module/Olcs/src/Controller/Factory/Messages/LicenceConversationMessagesControllerFactory.php deleted file mode 100644 index a1ec70829b..0000000000 --- a/module/Olcs/src/Controller/Factory/Messages/LicenceConversationMessagesControllerFactory.php +++ /dev/null @@ -1,38 +0,0 @@ -get(FormHelperService::class); - $translationHelper = $container->get(TranslationHelperService::class); - $flashMessenger = $container->get(FlashMessengerHelperService::class); - $scriptsFactory = $container->get(ScriptFactory::class); - - $navigation = $container->get('navigation'); - - return new LicenceConversationMessagesController( - $translationHelper, - $formHelper, - $flashMessenger, - $navigation, - $scriptsFactory - ); - } -} diff --git a/module/Olcs/src/Controller/Interfaces/MessagingControllerInterface.php b/module/Olcs/src/Controller/Interfaces/MessagingControllerInterface.php new file mode 100644 index 0000000000..a5f0f7399e --- /dev/null +++ b/module/Olcs/src/Controller/Interfaces/MessagingControllerInterface.php @@ -0,0 +1,9 @@ + [FeatureToggle::MESSAGING], diff --git a/module/Olcs/src/Controller/Messages/AbstractConversationListController.php b/module/Olcs/src/Controller/Messages/AbstractConversationListController.php new file mode 100644 index 0000000000..b1f01e0f1c --- /dev/null +++ b/module/Olcs/src/Controller/Messages/AbstractConversationListController.php @@ -0,0 +1,43 @@ + [FeatureToggle::MESSAGING]]; + + /** + * Get left view + * + * @return ViewModel + */ + public function getLeftView() + { + $view = new ViewModel(['navigationId' => $this->navigationId]); + $view->setTemplate('sections/messages/partials/left'); + + return $view; + } + + /** + * Get right view + * + * @return ViewModel + */ + public function getRightView() + { + $view = new ViewModel(); + $view->setTemplate('sections/application/partials/right'); + + return $view; + } +} diff --git a/module/Olcs/src/Controller/Messages/AbstractConversationMessagesController.php b/module/Olcs/src/Controller/Messages/AbstractConversationMessagesController.php index 86ff22ec0f..0be70dfc60 100644 --- a/module/Olcs/src/Controller/Messages/AbstractConversationMessagesController.php +++ b/module/Olcs/src/Controller/Messages/AbstractConversationMessagesController.php @@ -16,18 +16,16 @@ use Dvsa\Olcs\Transfer\Query\Messaging\Messages\ByConversation; use Olcs\Controller\Interfaces\ApplicationControllerInterface; use Olcs\Controller\Interfaces\LeftViewProvider; -use Olcs\Controller\Interfaces\LicenceControllerInterface; use Common\Controller\Interfaces\ToggleAwareInterface; use Common\FeatureToggle; +use Olcs\Controller\Interfaces\MessagingControllerInterface; use Olcs\Controller\Interfaces\NavigationIdProvider; use Olcs\Form\Model\Form\LicenceMessageActions; use Olcs\Form\Model\Form\LicenceMessageReply; use Olcs\Mvc\Controller\ParameterProvider\GenericList; use Dvsa\Olcs\Transfer\Command\Messaging\Message\Create as CreateMessageCommand; -abstract class AbstractConversationMessagesController - extends AbstractInternalController - implements LeftViewProvider, ApplicationControllerInterface, ToggleAwareInterface, NavigationIdProvider +abstract class AbstractConversationMessagesController extends AbstractInternalController implements LeftViewProvider, ToggleAwareInterface, NavigationIdProvider, MessagingControllerInterface { protected $listDto = ByConversation::class; protected $topNavigationId = ''; @@ -54,6 +52,8 @@ public function __construct( $this->scriptFactory = $scriptFactory; } + abstract protected function getConversationViewRoute(): string; + /** * @inheritDoc */ @@ -124,8 +124,7 @@ protected function parseReply(Form $form) if ($response->isOk()) { $this->flashMessengerHelperService->addSuccessMessage('Reply submitted successfully'); - $route = $this->topNavigationId === 'application' ? 'lva-application' : 'licence'; - return $this->redirect()->toRoute($route . '/conversation/view', $this->params()->fromRoute()); + return $this->redirect()->toRoute($this->getConversationViewRoute(), $this->params()->fromRoute()); } $this->handleErrors($response->getResult()); diff --git a/module/Olcs/src/Controller/Messages/AbstractCreateConversationController.php b/module/Olcs/src/Controller/Messages/AbstractCreateConversationController.php index 4290b9f670..93062ad12e 100644 --- a/module/Olcs/src/Controller/Messages/AbstractCreateConversationController.php +++ b/module/Olcs/src/Controller/Messages/AbstractCreateConversationController.php @@ -8,18 +8,16 @@ use Dvsa\Olcs\Transfer\Command\Messaging\Conversation\Create; use Dvsa\Olcs\Transfer\Query\Messaging\ApplicationLicenceList\ByApplicationToOrganisation; use Dvsa\Olcs\Transfer\Query\Messaging\ApplicationLicenceList\ByLicenceToOrganisation; +use Dvsa\Olcs\Transfer\Query\Messaging\ApplicationLicenceList\ByCaseToOrganisation; use Laminas\Mvc\MvcEvent; use Laminas\View\Model\ViewModel; use Olcs\Controller\AbstractInternalController; -use Olcs\Controller\Interfaces\ApplicationControllerInterface; use Olcs\Controller\Interfaces\LeftViewProvider; -use Olcs\Controller\Interfaces\LicenceControllerInterface; +use Olcs\Controller\Interfaces\MessagingControllerInterface; use Olcs\Form\Model\Form\Conversation; use RuntimeException; -class AbstractCreateConversationController - extends AbstractInternalController - implements LeftViewProvider, ApplicationControllerInterface, ToggleAwareInterface +class AbstractCreateConversationController extends AbstractInternalController implements LeftViewProvider, ToggleAwareInterface, MessagingControllerInterface { protected $mapperClass = DefaultMapper::class; @@ -59,6 +57,11 @@ public function alterFormForAdd($form) $data = $this->handleQuery( ByApplicationToOrganisation::create(['application' => $applicationId]) ); + } elseif ($this->params()->fromRoute('case')) { + $caseId = $this->params()->fromRoute('case'); + $data = $this->handleQuery( + ByCaseToOrganisation::create(['case' => $caseId]) + ); } else { throw new RuntimeException('Error: licence or application required'); } diff --git a/module/Olcs/src/Controller/Messages/AbstractEnableDisableMessagingController.php b/module/Olcs/src/Controller/Messages/AbstractEnableDisableMessagingController.php index 0a7bfe1b7d..0329d4a903 100644 --- a/module/Olcs/src/Controller/Messages/AbstractEnableDisableMessagingController.php +++ b/module/Olcs/src/Controller/Messages/AbstractEnableDisableMessagingController.php @@ -5,15 +5,14 @@ namespace Olcs\Controller\Messages; use Common\Controller\Interfaces\ToggleAwareInterface; -use Common\Exception\ResourceNotFoundException; use Common\FeatureToggle; use Dvsa\Olcs\Transfer\Command\Messaging\Conversation\Disable as DisableCommand; use Dvsa\Olcs\Transfer\Command\Messaging\Conversation\Enable as EnableCommand; -use Dvsa\Olcs\Transfer\Query\Licence\Licence; use Laminas\Http\Response; use Laminas\View\Model\ViewModel; use Olcs\Controller\Application\ApplicationController; use Olcs\Controller\Interfaces\LeftViewProvider; +use Olcs\Controller\Interfaces\MessagingControllerInterface; use Olcs\Controller\Interfaces\NavigationIdProvider; use Olcs\Data\Mapper\Task; use Olcs\Form\Model\Form\DisableConversations; @@ -21,9 +20,7 @@ use Olcs\Form\Model\Form\EnableConversations; use Olcs\Form\Model\Form\EnableConversationsPopup; -abstract class AbstractEnableDisableMessagingController - extends ApplicationController - implements LeftViewProvider, ToggleAwareInterface, NavigationIdProvider +abstract class AbstractEnableDisableMessagingController extends ApplicationController implements LeftViewProvider, ToggleAwareInterface, NavigationIdProvider, MessagingControllerInterface { protected $navigationId = 'conversations'; protected $toggleConfig = [ @@ -41,7 +38,7 @@ public function indexAction() if ($this->getRequest()->isPost()) { return $this->redirect()->toRoute( - $this->getRoutePrefix() . '/conversation/' . $action . '/popup', + $this->getRoutePrefix() . '/' . $action . '/popup', $this->params()->fromRoute(), ); } @@ -91,7 +88,7 @@ public function popupAction() $this->flashMessengerHelper->addSuccessMessage($message); return $this->redirect()->toRouteAjax( - $this->getRoutePrefix() . '/conversation', + $this->getRoutePrefix(), $this->params()->fromRoute(), ); } elseif ($commandResponse->isClientError()) { diff --git a/module/Olcs/src/Controller/Messages/ApplicationConversationListController.php b/module/Olcs/src/Controller/Messages/ApplicationConversationListController.php index 9ad024703c..aeb6b7cabd 100644 --- a/module/Olcs/src/Controller/Messages/ApplicationConversationListController.php +++ b/module/Olcs/src/Controller/Messages/ApplicationConversationListController.php @@ -2,48 +2,12 @@ namespace Olcs\Controller\Messages; -use Common\Controller\Interfaces\ToggleAwareInterface; -use Common\FeatureToggle; use Dvsa\Olcs\Transfer\Query\Messaging\Conversations\ByApplicationToLicence as ConversationsByApplicationToLicenceQuery; -use Laminas\View\Model\ViewModel; -use Olcs\Controller\AbstractInternalController; use Olcs\Controller\Interfaces\ApplicationControllerInterface; -use Olcs\Controller\Interfaces\LeftViewProvider; -class ApplicationConversationListController - extends AbstractInternalController - implements LeftViewProvider, ApplicationControllerInterface, ToggleAwareInterface +class ApplicationConversationListController extends AbstractConversationListController implements ApplicationControllerInterface { protected $navigationId = 'application_conversations'; protected $listVars = ['application']; protected $listDto = ConversationsByApplicationToLicenceQuery::class; - protected $tableName = 'conversations-list'; - protected $tableViewTemplate = 'pages/table'; - protected $toggleConfig = ['default' => [FeatureToggle::MESSAGING]]; - - /** - * Get left view - * - * @return ViewModel - */ - public function getLeftView() - { - $view = new ViewModel(['navigationId' => $this->navigationId]); - $view->setTemplate('sections/messages/partials/left'); - - return $view; - } - - /** - * Get right view - * - * @return ViewModel - */ - public function getRightView() - { - $view = new ViewModel(); - $view->setTemplate('sections/application/partials/right'); - - return $view; - } } diff --git a/module/Olcs/src/Controller/Messages/ApplicationConversationMessagesController.php b/module/Olcs/src/Controller/Messages/ApplicationConversationMessagesController.php index 3b6d05eb66..43f384d0c1 100644 --- a/module/Olcs/src/Controller/Messages/ApplicationConversationMessagesController.php +++ b/module/Olcs/src/Controller/Messages/ApplicationConversationMessagesController.php @@ -7,13 +7,16 @@ use Olcs\Controller\Interfaces\ApplicationControllerInterface; use Olcs\Controller\Traits\ApplicationControllerTrait; -class ApplicationConversationMessagesController - extends AbstractConversationMessagesController - implements ApplicationControllerInterface +class ApplicationConversationMessagesController extends AbstractConversationMessagesController implements ApplicationControllerInterface { use ApplicationControllerTrait; protected $navigationId = 'application_conversations'; protected $topNavigationId = 'application'; protected $listVars = ['lva-application', 'conversation']; + + protected function getConversationViewRoute(): string + { + return 'lva-application/conversation/view'; + } } diff --git a/module/Olcs/src/Controller/Messages/ApplicationCreateConversationController.php b/module/Olcs/src/Controller/Messages/ApplicationCreateConversationController.php index 912b9f0ebc..dfe130aab5 100644 --- a/module/Olcs/src/Controller/Messages/ApplicationCreateConversationController.php +++ b/module/Olcs/src/Controller/Messages/ApplicationCreateConversationController.php @@ -6,9 +6,7 @@ use Olcs\Controller\Interfaces\ApplicationControllerInterface; -class ApplicationCreateConversationController - extends AbstractCreateConversationController - implements ApplicationControllerInterface +class ApplicationCreateConversationController extends AbstractCreateConversationController implements ApplicationControllerInterface { protected $navigationId = 'application_conversations'; diff --git a/module/Olcs/src/Controller/Messages/ApplicationEnableDisableMessagingController.php b/module/Olcs/src/Controller/Messages/ApplicationEnableDisableMessagingController.php index 8b05034c68..86fece8ed0 100644 --- a/module/Olcs/src/Controller/Messages/ApplicationEnableDisableMessagingController.php +++ b/module/Olcs/src/Controller/Messages/ApplicationEnableDisableMessagingController.php @@ -10,9 +10,7 @@ use Laminas\View\Model\ViewModel; use Olcs\Controller\Interfaces\ApplicationControllerInterface; -class ApplicationEnableDisableMessagingController - extends AbstractEnableDisableMessagingController - implements ApplicationControllerInterface +class ApplicationEnableDisableMessagingController extends AbstractEnableDisableMessagingController implements ApplicationControllerInterface { protected $navigationId = 'application'; @@ -30,7 +28,7 @@ public function getLeftView(): ?ViewModel protected function getRoutePrefix(): string { - return 'lva-application'; + return 'lva-application/conversation'; } protected function getOrganisationId(): int diff --git a/module/Olcs/src/Controller/Messages/BusCloseConversationController.php b/module/Olcs/src/Controller/Messages/BusCloseConversationController.php new file mode 100644 index 0000000000..0f12b0c22c --- /dev/null +++ b/module/Olcs/src/Controller/Messages/BusCloseConversationController.php @@ -0,0 +1,21 @@ + $this->params()->fromRoute('bus'), + 'licence' => $this->params()->fromRoute('licence'), + 'action' => 'close', + + ]; + return $this->redirect()->toRouteAjax('bus_conversation', $params); + } +} diff --git a/module/Olcs/src/Controller/Messages/BusConversationListController.php b/module/Olcs/src/Controller/Messages/BusConversationListController.php new file mode 100644 index 0000000000..372735d47a --- /dev/null +++ b/module/Olcs/src/Controller/Messages/BusConversationListController.php @@ -0,0 +1,15 @@ + [ + 'route' => 'licence/bus_conversation/view', + 'resultIdMap' => [ + 'bus' => 'bus', + 'conversation' => 'conversation', + 'licence' => 'licence' + ], + 'reUseParams' => true + ] + ]; +} diff --git a/module/Olcs/src/Controller/Messages/BusEnableDisableMessagingController.php b/module/Olcs/src/Controller/Messages/BusEnableDisableMessagingController.php new file mode 100644 index 0000000000..c4fa15144a --- /dev/null +++ b/module/Olcs/src/Controller/Messages/BusEnableDisableMessagingController.php @@ -0,0 +1,49 @@ +getRequest()->isXmlHttpRequest()) { + return null; + } + + $view = new ViewModel(['navigationId' => 'bus_conversations']); + $view->setTemplate('sections/messages/partials/left'); + + return $view; + } + + protected function getRoutePrefix(): string + { + return 'bus_conversation'; + } + + protected function getOrganisationId(): int + { + $queryResponse = $this->handleQuery(Licence::create(['id' => $this->params()->fromRoute('licence')])); + if (!$queryResponse->isOk()) { + throw new Exception( + sprintf( + 'Unexpected error when querying licence for organisation ID. Response: HTTP %s :: %s', + $queryResponse->getStatusCode(), + $queryResponse->getBody(), + ), + ); + } + $queryResult = $queryResponse->getResult(); + + return $queryResult['organisation']['id']; + } +} diff --git a/module/Olcs/src/Controller/Messages/CaseCloseConversationController.php b/module/Olcs/src/Controller/Messages/CaseCloseConversationController.php new file mode 100644 index 0000000000..161935f20f --- /dev/null +++ b/module/Olcs/src/Controller/Messages/CaseCloseConversationController.php @@ -0,0 +1,21 @@ + $this->params()->fromRoute('case'), + 'licence' => $this->params()->fromRoute('licence'), + 'action' => 'close', + + ]; + return $this->redirect()->toRouteAjax('case_conversation', $params); + } +} diff --git a/module/Olcs/src/Controller/Messages/CaseConversationListController.php b/module/Olcs/src/Controller/Messages/CaseConversationListController.php new file mode 100644 index 0000000000..a5c76784be --- /dev/null +++ b/module/Olcs/src/Controller/Messages/CaseConversationListController.php @@ -0,0 +1,15 @@ + [ + 'route' => 'case_conversation/view', + 'resultIdMap' => [ + 'case' => 'case', + 'conversation' => 'conversation', + 'licence' => 'licence' + ], + 'reUseParams' => true + ] + ]; +} diff --git a/module/Olcs/src/Controller/Messages/CaseEnableDisableMessagingController.php b/module/Olcs/src/Controller/Messages/CaseEnableDisableMessagingController.php new file mode 100644 index 0000000000..88fa38d283 --- /dev/null +++ b/module/Olcs/src/Controller/Messages/CaseEnableDisableMessagingController.php @@ -0,0 +1,49 @@ +getRequest()->isXmlHttpRequest()) { + return null; + } + + $view = new ViewModel(['navigationId' => 'case_conversations']); + $view->setTemplate('sections/messages/partials/left'); + + return $view; + } + + protected function getRoutePrefix(): string + { + return 'case_conversation'; + } + + protected function getOrganisationId(): int + { + $queryResponse = $this->handleQuery(Licence::create(['id' => $this->params()->fromRoute('licence')])); + if (!$queryResponse->isOk()) { + throw new Exception( + sprintf( + 'Unexpected error when querying licence for organisation ID. Response: HTTP %s :: %s', + $queryResponse->getStatusCode(), + $queryResponse->getBody(), + ), + ); + } + $queryResult = $queryResponse->getResult(); + + return $queryResult['organisation']['id']; + } +} diff --git a/module/Olcs/src/Controller/Messages/IrhpApplicationCloseConversationController.php b/module/Olcs/src/Controller/Messages/IrhpApplicationCloseConversationController.php new file mode 100644 index 0000000000..c648850c85 --- /dev/null +++ b/module/Olcs/src/Controller/Messages/IrhpApplicationCloseConversationController.php @@ -0,0 +1,20 @@ + $this->params()->fromRoute('licence'), + 'action' => 'close', + + ]; + return $this->redirect()->toRouteAjax('licence/irhp_conversations', $params); + } +} diff --git a/module/Olcs/src/Controller/Messages/IrhpApplicationConversationListController.php b/module/Olcs/src/Controller/Messages/IrhpApplicationConversationListController.php new file mode 100644 index 0000000000..34d1920fff --- /dev/null +++ b/module/Olcs/src/Controller/Messages/IrhpApplicationConversationListController.php @@ -0,0 +1,24 @@ + 'irhp_conversations']); + $view->setTemplate('sections/messages/partials/left'); + + return $view; + } +} diff --git a/module/Olcs/src/Controller/Messages/IrhpApplicationConversationMessagesController.php b/module/Olcs/src/Controller/Messages/IrhpApplicationConversationMessagesController.php new file mode 100644 index 0000000000..f7ee7f4801 --- /dev/null +++ b/module/Olcs/src/Controller/Messages/IrhpApplicationConversationMessagesController.php @@ -0,0 +1,20 @@ + [ + 'route' => 'licence/irhp-application-conversation/view', + 'resultIdMap' => [ + 'conversation' => 'conversation', + 'licence' => 'licence' + ], + 'reUseParams' => true + ] + ]; + + public function getLeftView(): ViewModel + { + $view = new ViewModel(['navigationId' => 'irhp_conversations']); + $view->setTemplate('sections/messages/partials/left'); + + return $view; + } +} diff --git a/module/Olcs/src/Controller/Messages/IrhpApplicationEnableDisableMessagingController.php b/module/Olcs/src/Controller/Messages/IrhpApplicationEnableDisableMessagingController.php new file mode 100644 index 0000000000..e7c1417a62 --- /dev/null +++ b/module/Olcs/src/Controller/Messages/IrhpApplicationEnableDisableMessagingController.php @@ -0,0 +1,49 @@ +getRequest()->isXmlHttpRequest()) { + return null; + } + + $view = new ViewModel(['navigationId' => 'irhp_conversations']); + $view->setTemplate('sections/messages/partials/left'); + + return $view; + } + + protected function getRoutePrefix(): string + { + return 'licence/irhp_conversations'; + } + + protected function getOrganisationId(): int + { + $queryResponse = $this->handleQuery(Licence::create(['id' => $this->params()->fromRoute('licence')])); + if (!$queryResponse->isOk()) { + throw new Exception( + sprintf( + 'Unexpected error when querying licence for organisation ID. Response: HTTP %s :: %s', + $queryResponse->getStatusCode(), + $queryResponse->getBody(), + ), + ); + } + $queryResult = $queryResponse->getResult(); + + return $queryResult['organisation']['id']; + } +} diff --git a/module/Olcs/src/Controller/Messages/LicenceConversationListController.php b/module/Olcs/src/Controller/Messages/LicenceConversationListController.php index bee3d1cb67..ccf7d47d71 100644 --- a/module/Olcs/src/Controller/Messages/LicenceConversationListController.php +++ b/module/Olcs/src/Controller/Messages/LicenceConversationListController.php @@ -9,41 +9,11 @@ use Olcs\Controller\AbstractInternalController; use Olcs\Controller\Interfaces\LeftViewProvider; use Olcs\Controller\Interfaces\LicenceControllerInterface; +use Olcs\Controller\Interfaces\MessagingControllerInterface; -class LicenceConversationListController - extends AbstractInternalController - implements LeftViewProvider, LicenceControllerInterface, ToggleAwareInterface +class LicenceConversationListController extends AbstractConversationListController implements LicenceControllerInterface { protected $navigationId = 'conversations'; protected $listVars = ['licence']; protected $listDto = ConversationsByLicenceQuery::class; - protected $tableName = 'conversations-list'; - protected $tableViewTemplate = 'pages/table'; - protected $toggleConfig = ['default' => [FeatureToggle::MESSAGING]]; - - /** - * Get left view - * - * @return ViewModel - */ - public function getLeftView() - { - $view = new ViewModel(['navigationId' => $this->navigationId]); - $view->setTemplate('sections/messages/partials/left'); - - return $view; - } - - /** - * Get right view - * - * @return ViewModel - */ - public function getRightView() - { - $view = new ViewModel(); - $view->setTemplate('sections/licence/partials/right'); - - return $view; - } } diff --git a/module/Olcs/src/Controller/Messages/LicenceConversationMessagesController.php b/module/Olcs/src/Controller/Messages/LicenceConversationMessagesController.php index b43e4be5b6..ce1d4a9aea 100644 --- a/module/Olcs/src/Controller/Messages/LicenceConversationMessagesController.php +++ b/module/Olcs/src/Controller/Messages/LicenceConversationMessagesController.php @@ -6,11 +6,14 @@ use Olcs\Controller\Interfaces\LicenceControllerInterface; -class LicenceConversationMessagesController - extends AbstractConversationMessagesController - implements LicenceControllerInterface +class LicenceConversationMessagesController extends AbstractConversationMessagesController implements LicenceControllerInterface { protected $navigationId = 'conversations'; protected $topNavigationId = 'licence'; protected $listVars = ['licence', 'conversation']; + + protected function getConversationViewRoute(): string + { + return 'licence/conversation/view'; + } } diff --git a/module/Olcs/src/Controller/Messages/LicenceCreateConversationController.php b/module/Olcs/src/Controller/Messages/LicenceCreateConversationController.php index f20a16a04b..cbb5be99e2 100644 --- a/module/Olcs/src/Controller/Messages/LicenceCreateConversationController.php +++ b/module/Olcs/src/Controller/Messages/LicenceCreateConversationController.php @@ -6,9 +6,7 @@ use Olcs\Controller\Interfaces\LicenceControllerInterface; -class LicenceCreateConversationController - extends AbstractCreateConversationController - implements LicenceControllerInterface +class LicenceCreateConversationController extends AbstractCreateConversationController implements LicenceControllerInterface { protected $navigationId = 'conversations'; diff --git a/module/Olcs/src/Controller/Messages/LicenceEnableDisableMessagingController.php b/module/Olcs/src/Controller/Messages/LicenceEnableDisableMessagingController.php index d461a02342..cd88085932 100644 --- a/module/Olcs/src/Controller/Messages/LicenceEnableDisableMessagingController.php +++ b/module/Olcs/src/Controller/Messages/LicenceEnableDisableMessagingController.php @@ -4,15 +4,12 @@ namespace Olcs\Controller\Messages; -use Common\Exception\ResourceNotFoundException; use Dvsa\Olcs\Transfer\Query\Licence\Licence; use Exception; use Laminas\View\Model\ViewModel; use Olcs\Controller\Interfaces\LicenceControllerInterface; -class LicenceEnableDisableMessagingController - extends AbstractEnableDisableMessagingController - implements LicenceControllerInterface +class LicenceEnableDisableMessagingController extends AbstractEnableDisableMessagingController implements LicenceControllerInterface { protected $navigationId = 'licence'; @@ -30,7 +27,7 @@ public function getLeftView(): ?ViewModel protected function getRoutePrefix(): string { - return 'licence'; + return 'licence/conversation'; } protected function getOrganisationId(): int diff --git a/module/Olcs/src/Form/Model/Fieldset/CloseConversationActions.php b/module/Olcs/src/Form/Model/Fieldset/CloseConversationActions.php index 815d2dcac4..decce6ef60 100644 --- a/module/Olcs/src/Form/Model/Fieldset/CloseConversationActions.php +++ b/module/Olcs/src/Form/Model/Fieldset/CloseConversationActions.php @@ -4,6 +4,7 @@ namespace Olcs\Form\Model\Fieldset; +use Common\Form\Elements\InputFilters\ActionButton; use Laminas\Form\Annotation as Form; /** @@ -23,7 +24,7 @@ class CloseConversationActions * @Form\Options({ * "label": "End and archive conversation" * }) - * @Form\Type(\Common\Form\Elements\InputFilters\ActionButton::class) + * @Form\Type(ActionButton::class) */ public ?ActionButton $close = null; @@ -37,7 +38,7 @@ class CloseConversationActions * @Form\Options({ * "label": "Cancel" * }) - * @Form\Type(\Common\Form\Elements\InputFilters\ActionButton::class) + * @Form\Type(ActionButton::class) */ public ?ActionButton $cancel = null; } diff --git a/module/Olcs/src/Form/Model/Fieldset/CloseConversationText.php b/module/Olcs/src/Form/Model/Fieldset/CloseConversationText.php index 318c23dd76..a065037c1a 100644 --- a/module/Olcs/src/Form/Model/Fieldset/CloseConversationText.php +++ b/module/Olcs/src/Form/Model/Fieldset/CloseConversationText.php @@ -4,6 +4,7 @@ namespace Olcs\Form\Model\Fieldset; +use Common\Form\Elements\Types\PlainText; use Laminas\Form\Annotation as Form; /** @@ -12,7 +13,7 @@ class CloseConversationText { /** - * @Form\Type(\Common\Form\Elements\Types\PlainText::class) + * @Form\Type(PlainText::class) * @Form\Attributes({ * "value": "The conversation will be removed from the Inbox and a transcript will be archived in docs and attachments tab." * }) diff --git a/module/Olcs/src/Form/Model/Fieldset/Conversation.php b/module/Olcs/src/Form/Model/Fieldset/Conversation.php index 51122355a6..7178212382 100644 --- a/module/Olcs/src/Form/Model/Fieldset/Conversation.php +++ b/module/Olcs/src/Form/Model/Fieldset/Conversation.php @@ -1,55 +1,63 @@ navigationPlugin->__invoke('navigation'); - if ($isMessagingDisabled) { - $navigationPlugin->findBy('id', 'conversation_list_disable_messaging')->setVisible(false); - $navigationPlugin->findBy('id', 'application_conversation_list_disable_messaging')->setVisible(false); - } else { - $navigationPlugin->findBy('id', 'conversation_list_enable_messaging')->setVisible(false); - $navigationPlugin->findBy('id', 'application_conversation_list_enable_messaging')->setVisible(false); + $tag = $isMessagingDisabled ? 'conversation_list_disable_messaging' : 'conversation_list_enable_messaging'; + array_map(fn($page) => $page->setVisible(false), $navigationPlugin->findBy('tag', $tag, true)); + + if (!$isMessagingDisabled) { $this->showFileUploadButtons($licence); } } diff --git a/module/Olcs/src/Listener/RouteParam/Licence.php b/module/Olcs/src/Listener/RouteParam/Licence.php index d62525a503..321a45a661 100644 --- a/module/Olcs/src/Listener/RouteParam/Licence.php +++ b/module/Olcs/src/Listener/RouteParam/Licence.php @@ -219,8 +219,10 @@ final public function fetchAndApplyUnreadConversationCountForLicenceToMessageTab ); } - $navigationService->findById('conversations')->set('unreadLicenceConversationCount', $count); - $navigationService->findById('application_conversations')->set('unreadLicenceConversationCount', $count); + array_map( + fn($page) => $page->set('unreadLicenceConversationCount', $count), + $navigationService->findBy('tag', 'messaging-menu', true) + ); } public function onLicence(EventInterface $e) @@ -629,12 +631,15 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o private function handleMessagingTabVisibility(int $licenceId, Navigation $navigationService): void { - if ($this->isMessagingFeatureToggleEnabled()) { - $this->fetchAndApplyUnreadConversationCountForLicenceToMessageTabs($licenceId, $navigationService); - } else { - $navigationService->findById('conversations')->setVisible(0); - $navigationService->findById('application_conversations')->setVisible(0); + if (!$this->isMessagingFeatureToggleEnabled()) { + return; } + + $this->fetchAndApplyUnreadConversationCountForLicenceToMessageTabs($licenceId, $navigationService); + array_map( + fn($page) => $page->setVisible(true), + $navigationService->findBy('tag', 'messaging-menu', true) + ); } private function isMessagingFeatureToggleEnabled(): bool diff --git a/test/Olcs/src/Listener/RouteParam/ConversationTest.php b/test/Olcs/src/Listener/RouteParam/ConversationTest.php index 23740960ce..d836d66221 100644 --- a/test/Olcs/src/Listener/RouteParam/ConversationTest.php +++ b/test/Olcs/src/Listener/RouteParam/ConversationTest.php @@ -89,7 +89,7 @@ function ($licence) { ->andReturnTrue(); $mockAbstractPage->shouldReceive('setVisible') - ->times(4) + ->twice() ->with(false); $mockNavigation->shouldReceive('__invoke') @@ -131,12 +131,8 @@ function ($licence) { ->andReturn($result); $mockNavigationPlugin->shouldReceive('findBy') ->once() - ->with('id', 'conversation_list_enable_messaging') - ->andReturn($mockAbstractPage); - $mockNavigationPlugin->shouldReceive('findBy') - ->once() - ->with('id', 'application_conversation_list_enable_messaging') - ->andReturn($mockAbstractPage); + ->with('tag', 'conversation_list_enable_messaging', true) + ->andReturn([$mockAbstractPage]); $sut->onConversation($e); $result = [ @@ -149,12 +145,8 @@ function ($licence) { ->andReturn($result); $mockNavigationPlugin->shouldReceive('findBy') ->once() - ->with('id', 'conversation_list_disable_messaging') - ->andReturn($mockAbstractPage); - $mockNavigationPlugin->shouldReceive('findBy') - ->once() - ->with('id', 'application_conversation_list_disable_messaging') - ->andReturn($mockAbstractPage); + ->with('tag', 'conversation_list_disable_messaging', true) + ->andReturn([$mockAbstractPage]); $sut->onConversation($e); } diff --git a/test/Olcs/src/Listener/RouteParam/LicenceTest.php b/test/Olcs/src/Listener/RouteParam/LicenceTest.php index 81ff52137e..4805a8700b 100644 --- a/test/Olcs/src/Listener/RouteParam/LicenceTest.php +++ b/test/Olcs/src/Listener/RouteParam/LicenceTest.php @@ -7,6 +7,7 @@ use Common\RefData; use Common\Service\Cqrs\Response; use Common\Service\Data\Surrender; +use Laminas\Navigation\Page\Mvc; use Psr\Container\ContainerInterface; use Dvsa\Olcs\Transfer\Query\FeatureToggle\IsEnabled; use Laminas\EventManager\Event; @@ -216,9 +217,6 @@ public function testOnLicenceWithValidGoodsLicence() $this->sut->setMainNavigationService($mainNav); - $this->mockHideButton($this->sut->getMainNavigationService(),'conversations'); - $this->mockHideButton($this->sut->getMainNavigationService(), 'application_conversations'); - $routeParam = new RouteParam(); $routeParam->setValue($licenceId); @@ -262,9 +260,6 @@ public function testOnLicenceWithValidPsvLicence() $this->sut->setNavigationService($mockSidebar); $this->mockMainNavigation($licence['goodsOrPsv']['id']); - $this->mockHideButton($this->sut->getMainNavigationService(),'conversations'); - $this->mockHideButton($this->sut->getMainNavigationService(), 'application_conversations'); - $routeParam = new RouteParam(); $routeParam->setValue($licenceId); @@ -314,9 +309,6 @@ public function testOnLicenceWithTerminatedPsvLicence() $this->sut->setNavigationService($mockSidebar); $this->mockMainNavigation($licence['goodsOrPsv']['id']); - $this->mockHideButton($this->sut->getMainNavigationService(),'conversations'); - $this->mockHideButton($this->sut->getMainNavigationService(), 'application_conversations'); - $routeParam = new RouteParam(); $routeParam->setValue($licenceId); @@ -365,11 +357,8 @@ public function testOnLicenceWithSurrenderedGoodsLicence() $this->mockHideButton($mockSidebar, 'licence-decisions-reset-to-valid'); $this->sut->setNavigationService($mockSidebar); - $this->mockMainNavigation($licence['goodsOrPsv']['id']); - $this->mockHideButton($this->sut->getMainNavigationService(),'conversations'); - $this->mockHideButton($this->sut->getMainNavigationService(), 'application_conversations'); $routeParam = new RouteParam(); $routeParam->setValue($licenceId); @@ -422,9 +411,6 @@ public function testOnLicenceWithNotSubmittedPsvSpecialRestricted() $this->mockMainNavigation($licence['goodsOrPsv']['id']); - $this->mockHideButton($this->sut->getMainNavigationService(),'conversations'); - $this->mockHideButton($this->sut->getMainNavigationService(), 'application_conversations'); - $routeParam = new RouteParam(); $routeParam->setValue($licenceId); @@ -480,9 +466,6 @@ public function testOnLicenceWithValidGoodsLicenceAndPendingChange() $this->mockMainNavigation($licence['goodsOrPsv']['id']); - $this->mockHideButton($this->sut->getMainNavigationService(),'conversations'); - $this->mockHideButton($this->sut->getMainNavigationService(), 'application_conversations'); - $routeParam = new RouteParam(); $routeParam->setValue($licenceId); @@ -537,9 +520,6 @@ public function testOnLicenceWithValidPsvLicenceAndPendingChange() $this->mockMainNavigation($licence['goodsOrPsv']['id']); - $this->mockHideButton($this->sut->getMainNavigationService(),'conversations'); - $this->mockHideButton($this->sut->getMainNavigationService(), 'application_conversations'); - $routeParam = new RouteParam(); $routeParam->setValue($licenceId); @@ -595,9 +575,6 @@ public function testOnLicenceWithRevokedLicence() $this->mockMainNavigation($licence['goodsOrPsv']['id']); - $this->mockHideButton($this->sut->getMainNavigationService(),'conversations'); - $this->mockHideButton($this->sut->getMainNavigationService(), 'application_conversations'); - $routeParam = new RouteParam(); $routeParam->setValue($licenceId); @@ -691,9 +668,6 @@ public function testOnLicenceSurrenderDigitallySigned() $this->signatureType = RefData::SIGNATURE_TYPE_DIGITAL_SIGNATURE; $this->mockMainNavigation($licence['goodsOrPsv']['id'], true); - $this->mockHideButton($this->sut->getMainNavigationService(),'conversations'); - $this->mockHideButton($this->sut->getMainNavigationService(), 'application_conversations'); - $mockSurrenderService = m::mock(Surrender::class); $mockSurrenderService->shouldReceive('fetchSurrenderData')->with(4)->times(1)->andReturn([ 'signatureType' => ['id' => $this->signatureType] @@ -758,9 +732,6 @@ public function testOnLicenceSurrenderedPhysicallySigned() $this->signatureType = RefData::SIGNATURE_TYPE_PHYSICAL_SIGNATURE; $this->mockMainNavigation($licence['goodsOrPsv']['id'], true); - $this->mockHideButton($this->sut->getMainNavigationService(),'conversations'); - $this->mockHideButton($this->sut->getMainNavigationService(), 'application_conversations'); - $mockSurrenderService = m::mock(Surrender::class); $mockSurrenderService->shouldReceive('fetchSurrenderData')->with(4)->times(1)->andReturn([ 'signatureType' => ['id' => $this->signatureType] @@ -895,9 +866,6 @@ public function testSurrenderServiceFails() $this->signatureType = RefData::SIGNATURE_TYPE_DIGITAL_SIGNATURE; $this->mockMainNavigation($licence['goodsOrPsv']['id'], true); - $this->mockHideButton($this->sut->getMainNavigationService(),'conversations'); - $this->mockHideButton($this->sut->getMainNavigationService(), 'application_conversations'); - $mockSurrenderService = m::mock(Surrender::class); $mockSurrenderService->shouldReceive('fetchSurrenderData')->with(4)->times(1)->andThrow( new DataServiceException('TEST') @@ -976,29 +944,19 @@ function ($dto) use ($licenceId) { $this->sut->setNavigationService($mockSidebar); $this->mockMainNavigation($licence['goodsOrPsv']['id']); - $this->sut->getMainNavigationService() - ->expects('findById') - ->with('conversations') - ->once() - ->andReturn( - m::namedMock('conversations') - ->shouldReceive('set') - ->with('unreadLicenceConversationCount', $count) - ->once() - ->getMock() - ); + $mockPage = m::mock(Mvc::class); + $mockPage->shouldReceive('setVisible') + ->once() + ->with(true); + $mockPage->shouldReceive('set') + ->once() + ->with('unreadLicenceConversationCount', 1); $this->sut->getMainNavigationService() - ->expects('findById') - ->with('application_conversations') - ->once() - ->andReturn( - m::namedMock('application_conversations') - ->shouldReceive('set') - ->with('unreadLicenceConversationCount', $count) - ->once() - ->getMock() - ); + ->shouldReceive('findBy') + ->twice() + ->with('tag', 'messaging-menu', true) + ->andReturn([$mockPage]); $routeParam = new RouteParam(); $routeParam->setValue($licenceId);