diff --git a/vendor/magento/module-customer/Block/Adminhtml/Group/AddCustomerGroupButton.php b/vendor/magento/module-customer/Block/Adminhtml/Group/AddCustomerGroupButton.php new file mode 100644 index 000000000000..e233a5be8a81 --- /dev/null +++ b/vendor/magento/module-customer/Block/Adminhtml/Group/AddCustomerGroupButton.php @@ -0,0 +1,32 @@ + __('Add New Customer Group'), + 'class' => 'primary', + 'url' => $this->getUrl('*/*/new'), + 'sort_order' => 80, + ]; + } +} diff --git a/vendor/magento/module-customer/Ui/Component/Listing/Column/GroupActions.php b/vendor/magento/module-customer/Ui/Component/Listing/Column/GroupActions.php index 459ac3e29e99..954293f58dc2 100644 --- a/vendor/magento/module-customer/Ui/Component/Listing/Column/GroupActions.php +++ b/vendor/magento/module-customer/Ui/Component/Listing/Column/GroupActions.php @@ -28,8 +28,8 @@ class GroupActions extends Column /** * Url path */ - const URL_PATH_EDIT = 'customer/group/edit'; - const URL_PATH_DELETE = 'customer/group/delete'; + public const URL_PATH_EDIT = 'customer/group/edit'; + public const URL_PATH_DELETE = 'customer/group/delete'; /** * @var GroupManagementInterface @@ -99,7 +99,7 @@ public function prepareDataSource(array $dataSource) ], ]; - if (!$this->groupManagement->isReadonly($item['customer_group_id'])) { + if (!$this->canHideDeleteButton((int) $item['customer_group_id'])) { $item[$this->getData('name')]['delete'] = [ 'href' => $this->urlBuilder->getUrl( static::URL_PATH_DELETE, @@ -124,4 +124,17 @@ public function prepareDataSource(array $dataSource) return $dataSource; } + + /** + * Check if delete button can visible + * + * @param int $customer_group_id + * @return bool + * @throws LocalizedException + * @throws NoSuchEntityException + */ + public function canHideDeleteButton(int $customer_group_id): bool + { + return $this->groupManagement->isReadonly($customer_group_id); + } } diff --git a/vendor/magento/module-customer/view/adminhtml/ui_component/customer_group_listing.xml b/vendor/magento/module-customer/view/adminhtml/ui_component/customer_group_listing.xml index 0787e0713aa9..b9808747c6c7 100644 --- a/vendor/magento/module-customer/view/adminhtml/ui_component/customer_group_listing.xml +++ b/vendor/magento/module-customer/view/adminhtml/ui_component/customer_group_listing.xml @@ -13,11 +13,7 @@ - +