forked from PrestaShop/PrestaShop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request PrestaShop#29732 from margud/16592/customerService…
…-grid-migration Customer service controller migration (grid part)
- Loading branch information
Showing
40 changed files
with
1,937 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
admin-dev/themes/new-theme/js/pages/customer-thread/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/OSL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to https://devdocs.prestashop.com/ for more information. | ||
* | ||
* @author PrestaShop SA and Contributors <[email protected]> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) | ||
*/ | ||
|
||
import Grid from '@components/grid/grid'; | ||
import FiltersResetExtension from '@components/grid/extension/filters-reset-extension'; | ||
import ReloadListActionExtension from '@components/grid/extension/reload-list-extension'; | ||
import ExportToSqlManagerExtension from '@components/grid/extension/export-to-sql-manager-extension'; | ||
import SortingExtension from '@components/grid/extension/sorting-extension'; | ||
import LinkRowActionExtension from '@components/grid/extension/link-row-action-extension'; | ||
import SubmitGridExtension from '@components/grid/extension/submit-grid-action-extension'; | ||
import SubmitBulkExtension from '@components/grid/extension/submit-bulk-action-extension'; | ||
import SubmitRowActionExtension from '@components/grid/extension/action/row/submit-row-action-extension'; | ||
import BulkActionCheckboxExtension from '@components/grid/extension/bulk-action-checkbox-extension'; | ||
import FiltersSubmitButtonEnablerExtension from '@components/grid/extension/filters-submit-button-enabler-extension'; | ||
import ChoiceExtension from '@components/grid/extension/choice-extension'; | ||
import ColumnTogglingExtension from '@components/grid/extension/column-toggling-extension'; | ||
import PositionExtension from '@components/grid/extension/position-extension'; | ||
|
||
const {$} = window; | ||
|
||
$(() => { | ||
const grid = new Grid('customer_thread'); | ||
|
||
grid.addExtension(new FiltersResetExtension()); | ||
grid.addExtension(new ReloadListActionExtension()); | ||
grid.addExtension(new ExportToSqlManagerExtension()); | ||
grid.addExtension(new SortingExtension()); | ||
grid.addExtension(new LinkRowActionExtension()); | ||
grid.addExtension(new SubmitGridExtension()); | ||
grid.addExtension(new SubmitBulkExtension()); | ||
grid.addExtension(new BulkActionCheckboxExtension()); | ||
grid.addExtension(new FiltersSubmitButtonEnablerExtension()); | ||
grid.addExtension(new ColumnTogglingExtension()); | ||
grid.addExtension(new SubmitRowActionExtension()); | ||
grid.addExtension(new ChoiceExtension()); | ||
grid.addExtension(new PositionExtension(grid)); | ||
}); |
6 changes: 6 additions & 0 deletions
6
admin-dev/themes/new-theme/scss/pages/customer_thread/customer_thread.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#customer_thread_grid { | ||
// Do not break thread status change button | ||
.column-status .btn { | ||
white-space: nowrap; | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
src/Core/Domain/CustomerService/Command/BulkDeleteCustomerThreadCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/OSL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to https://devdocs.prestashop.com/ for more information. | ||
* | ||
* @author PrestaShop SA and Contributors <[email protected]> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PrestaShop\PrestaShop\Core\Domain\CustomerService\Command; | ||
|
||
use PrestaShop\PrestaShop\Core\Domain\CustomerService\Exception\CustomerServiceException; | ||
use PrestaShop\PrestaShop\Core\Domain\CustomerService\ValueObject\CustomerThreadId; | ||
|
||
class BulkDeleteCustomerThreadCommand | ||
{ | ||
/** | ||
* @var CustomerThreadId[] | ||
*/ | ||
private $customerThreadIds; | ||
|
||
/** | ||
* @param array<int, int> $customerThreadIds | ||
* | ||
* @throws CustomerServiceException | ||
*/ | ||
public function __construct(array $customerThreadIds) | ||
{ | ||
$this->setCustomerThreadIds($customerThreadIds); | ||
} | ||
|
||
/** | ||
* @return CustomerThreadId[] | ||
*/ | ||
public function getCustomerThreadIds(): array | ||
{ | ||
return $this->customerThreadIds; | ||
} | ||
|
||
/** | ||
* @param array<int, int> $customerThreadIds | ||
* | ||
* @throws CustomerServiceException | ||
*/ | ||
private function setCustomerThreadIds(array $customerThreadIds): void | ||
{ | ||
foreach ($customerThreadIds as $customerThreadId) { | ||
$this->customerThreadIds[] = new CustomerThreadId($customerThreadId); | ||
} | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/Core/Domain/CustomerService/Command/DeleteCustomerThreadCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/OSL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to https://devdocs.prestashop.com/ for more information. | ||
* | ||
* @author PrestaShop SA and Contributors <[email protected]> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PrestaShop\PrestaShop\Core\Domain\CustomerService\Command; | ||
|
||
use PrestaShop\PrestaShop\Core\Domain\CustomerService\ValueObject\CustomerThreadId; | ||
|
||
class DeleteCustomerThreadCommand | ||
{ | ||
/** | ||
* @var CustomerThreadId | ||
*/ | ||
private $customerThreadId; | ||
|
||
public function __construct(int $customerThreadId) | ||
{ | ||
$this->customerThreadId = new CustomerThreadId($customerThreadId); | ||
} | ||
|
||
/** | ||
* @return CustomerThreadId | ||
*/ | ||
public function getCustomerThreadId(): CustomerThreadId | ||
{ | ||
return $this->customerThreadId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/Core/Domain/CustomerService/CommandHandler/BulkDeleteCustomerThreadHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/OSL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to https://devdocs.prestashop.com/ for more information. | ||
* | ||
* @author PrestaShop SA and Contributors <[email protected]> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PrestaShop\PrestaShop\Core\Domain\CustomerService\CommandHandler; | ||
|
||
use PrestaShop\PrestaShop\Core\Domain\CustomerService\Command\BulkDeleteCustomerThreadCommand; | ||
use PrestaShop\PrestaShop\Core\Domain\CustomerService\Repository\CustomerThreadRepository; | ||
|
||
/** | ||
* Handles command for customer thread bulk deletion | ||
*/ | ||
class BulkDeleteCustomerThreadHandler implements BulkDeleteCustomerThreadHandlerInterface | ||
{ | ||
/** | ||
* @var CustomerThreadRepository | ||
*/ | ||
private $customerThreadRepository; | ||
|
||
public function __construct(CustomerThreadRepository $customerThreadRepository) | ||
{ | ||
$this->customerThreadRepository = $customerThreadRepository; | ||
} | ||
|
||
public function handle(BulkDeleteCustomerThreadCommand $command): void | ||
{ | ||
foreach ($command->getCustomerThreadIds() as $customerThreadId) { | ||
$this->customerThreadRepository->delete($customerThreadId); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/Core/Domain/CustomerService/CommandHandler/BulkDeleteCustomerThreadHandlerInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/OSL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to https://devdocs.prestashop.com/ for more information. | ||
* | ||
* @author PrestaShop SA and Contributors <[email protected]> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) | ||
*/ | ||
|
||
namespace PrestaShop\PrestaShop\Core\Domain\CustomerService\CommandHandler; | ||
|
||
use PrestaShop\PrestaShop\Core\Domain\CustomerService\Command\BulkDeleteCustomerThreadCommand; | ||
|
||
/** | ||
* Bulk delete customer thread | ||
*/ | ||
interface BulkDeleteCustomerThreadHandlerInterface | ||
{ | ||
public function handle(BulkDeleteCustomerThreadCommand $command): void; | ||
} |
58 changes: 58 additions & 0 deletions
58
src/Core/Domain/CustomerService/CommandHandler/DeleteCustomerThreadHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/OSL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to https://devdocs.prestashop.com/ for more information. | ||
* | ||
* @author PrestaShop SA and Contributors <[email protected]> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PrestaShop\PrestaShop\Core\Domain\CustomerService\CommandHandler; | ||
|
||
use PrestaShop\PrestaShop\Core\Domain\CustomerService\Command\DeleteCustomerThreadCommand; | ||
use PrestaShop\PrestaShop\Core\Domain\CustomerService\Repository\CustomerThreadRepository; | ||
|
||
/** | ||
* Handles command for customer thread deletion | ||
*/ | ||
class DeleteCustomerThreadHandler implements DeleteCustomerThreadHandlerInterface | ||
{ | ||
/** | ||
* @var CustomerThreadRepository | ||
*/ | ||
private $customerThreadRepository; | ||
|
||
public function __construct(CustomerThreadRepository $customerThreadRepository) | ||
{ | ||
$this->customerThreadRepository = $customerThreadRepository; | ||
} | ||
|
||
/** | ||
* @param DeleteCustomerThreadCommand $command | ||
* | ||
* @return void | ||
*/ | ||
public function handle(DeleteCustomerThreadCommand $command): void | ||
{ | ||
$this->customerThreadRepository->delete($command->getCustomerThreadId()); | ||
} | ||
} |
Oops, something went wrong.