Magento_Company
# Magento Modules:
- Magento_Company
- Magento_CompanyGraphQl
- Magento_CompanyPayment
- Magento_CompanyShipping
# Adobe Commerce Packages
- magento/module-company
- magento/module-company-graph-ql
- magento/module-company-payment
- magento/module-company-shipping
# Repository
> Note: this repo is only accessible with a Hyvä Enterprise license or as a contributor.
>
> For more details, see: https://www.hyva.io/hyva-enterprise.html.
https://gitlab.hyva.io/hyva-enterprise/b2b/magento2-ee-magento-company
## Features
> All points are rated according to priority as P1 (critical), P2 (important), P3 (minor).
- [x] basic - does not break layout/design
> Note: All below features assume output only if company accounts are enabled in Stores > Configuration: `btob/website_configuration/company_active`.
### Global
#### Customer Account Header Navigation Menu
<details>
<summary>Feature complete (click to expand items checklist)</summary>
- [x] [P1] Add 'Create New Company Account' when logged out
- [x] [P3] Add 'Company Structure' when logged in
- [x] [P3] Visible with relevant permissions only (view or manage users/teams)
</details>
#### Company Blocked Header Notice
- [x] [P2] Global header blocked notice
###### Visual QA
- [x] [P3] Blocked notice needs styling (center text and add red background to match Luma)
### Account Login (`/customer/account/login/`)
- [x] [P1] Add create company section alongside create account option
### Company Create (`/company/account/create`)
<details>
<summary>Feature complete (click to expand items checklist)</summary>
- [x] [P1] Show form fields and inputs
- [x] [P2] Validation works
- [x] [P2] Show region dropdown for supported countries
- [x] [P1] Successful Company Creation from frontend
- [x] [P3] Support for customer custom attributes - #24
- [x] [P3] Client-side validation for existing customer/company accounts (email check)
> Luma bug: file/image customer custom attributes are not saved
</details>
> Future enhancement: Postcode is always required regardless of country (doesn't respect 'postcode is optional' admin setting). This is a bug in Luma/default Magento.
### Customer Account Area (all pages)
<details>
<summary>Feature complete (click to expand items checklist)</summary>
- [x] [P1] Add menu items
- Company profile, company users, company structure, roles & permissions
- [x] [P2] Each item visible with relevant permissions only
###### Visual QA
- [x] [P3] Menu items ordering - Should match Luma
<img src="/uploads/cd540ff7fd8d7f2abf81c1ffe2618cf9/Company_Account_Nav_Luma.png" width="200" height="auto" />
<img src="/uploads/3dddde1a4738606a3cbbf3bcd224ebb1/Company_Account_Nav_Hyvä.png" width="200" height="auto" />
</details>
### Customer Account Dashboard (`/customer/account/`)
- [x] [P3] Output role
### Customer Account Edit (`/customer/account/edit/`)
<details>
<summary>Feature complete (click to expand items checklist)</summary>
- [x] [P3] Output role and title
<img src="/uploads/68fd8ddfddd9c0fa67655cb71d7d9579/Company_Account_Edit.png" width="400" height="auto" />
</details>
### Company Profile Detail Page (`/company/profile/`)
<details>
<summary>Feature complete (click to expand items checklist)</summary>
- [x] [P2] Accessible with relevant permissions only (view/edit profile)
- [x] [P2] Edit profile link
- [x] [P2] Only output if user has relevant permissions
- [x] [P2] View account information
- [x] [P3] Only output if user has relevant permissions
[x] [P2] View legal address
- [x] [P3] Only output if user has relevant permissions
- [x] [P2] View available payment methods
- [x] [P3] Only output if user has relevant permissions
- [x] [P2] View available shipping methods
- [x] [P3] Only output if user has relevant permissions
> Does not work in Luma - core bug - should be fixed at block level like payments (e.g. suppress `toHtml()`)
</details>
### Company Profile Edit Page (`/company/profile/edit/`)
<details>
<summary>Feature complete (click to expand items checklist)</summary>
- [x] [P2] Accessible with relevant permissions only (edit profile)
- [x] [P2] Form fields output
- Company information, legal address
- [x] [P2] Form fields populated with saved data
- [x] [P2] Form fields validation
- [x] [P2] Submit form (update profile)
> Future refactoring: review/combine region field implementation with create company page
</details>
### Company Roles and Permissions Listing (`/company/role/`)
<details>
<summary>Feature complete (click to expand items checklist)</summary>
- [x] [P1] Accessible with relevant permissions only (view/manage roles)
- [x] [P1] Roles listing table
- ID, Role, Users (count) and Actions columns
- [x] [P1] Edit role action
- [x] [P2] Visible with relevant permissions only (manage roles)
- [x] [P1] Delete role action (see modal features below)
- [x] [P2] Visible with relevant permissions only (manage roles)
- [x] [P2] Duplicate role action
- [x] [P2] Visible with relevant permissions only (manage roles)
- [x] [P2] Pagination works
- [x] [P2] Limiter works
- [x] [P1] Add new role button
- [x] [P2] Visible with relevant permissions only (manage roles)
#### Delete Role Modal
- [x] [P1] Modal with 'are you sure' message and ok/cancel buttons
- [x] [P1] Delete role
- [x] [P1] Error message if role cannot be deleted (i.e. has users associated to it)
> Implemented on page reload as global message, not in modal like Luma
</details>
### Company Roles and Permissions Add New (`/company/role/edit/`)
<details>
<summary>Feature complete (click to expand items checklist)</summary>
- [x] [P1] Accessible with relevant permissions only (manage roles)
- [x] [P2] Add role name
- [x] [P2] Role name required field validation
- [x] [P1] Role permissions tree output
- [x] [P1] Select/deselect permissions
- [x] [P2] Expand/collapse permissions - via each section in tree
- [x] [P2] Expand/collapse permissions - globally (links above)
- [x] [P1] Submit / create role
###### Visual QA
- [x] [P2] Title should be 'Add New Role' on main page
- [x] [P2] Lowest tree level nodes need indenting further (currently align with parent)
- [x] [P3] Tree chevrons/arrows are the wrong way round (should be ˄ when expanded and ˅ when collapsed)
<img src="/uploads/e3c86457865e85a9103a1f958334a5ae/image.png" width="400" height="auto" />
<img src="/uploads/91d52f43a52da99d9e99e128d5f3837c/image.png" width="400" height="auto" />
</details>
### Company Roles and Permissions Edit (`/company/role/edit/id/{id}/`)
<details>
<summary>Feature complete (click to expand items checklist)</summary>
- [x] [P1] Accessible with relevant permissions only (manage roles)
- [x] [P2] Update role name
- [x] [P2] Role name required field validation
- [x] [P1] Role permissions tree output
- [x] [P1] Select/deselect permissions
- [x] [P2] Expand/collapse permissions - via each section in tree
- [x] [P2] Expand/collapse permissions - globally (links above)
- [x] [P1] Submit / update role
###### Visual QA
- [x] [P2] Lowest tree level nodes need indenting further (currently align with parent)
- [x] [P3] Tree chevrons/arrows are the wrong way round (should be ˄ when expanded and ˅ when collapsed)
<img src="/uploads/e3c86457865e85a9103a1f958334a5ae/image.png" width="400" height="auto" />
<img src="/uploads/91d52f43a52da99d9e99e128d5f3837c/image.png" width="400" height="auto" />
</details>
### Company Users (`/company/users/`)
<details>
<summary>Feature complete (click to expand items checklist)</summary>
- [x] [P1] Accessible with relevant permissions only (view/manage users)
- [x] [P1] Users listing table
- ID, Name, Email, Role, Team, Status and Actions columns
- [x] [P1] Edit user action (see modal features below)
- [x] [P2] Visible with relevant permissions only (manage users)
- [x] [P1] Delete user action (see modal features below)
- [x] [P2] Visible with relevant permissions only (manage users)
- [x] [P2] Switch between all/active/inactive users
- [x] [P3] Show active users by default
- [x] [P2] Pagination works
- [x] [P2] Limiter works
- [x] [P3] No results message (when filtering inactive with no results)
- [x] [P1] Add new user button (see modal features below)
- [x] [P2] Visible with relevant permissions only (manage users)
#### Add User Modal
- [x] [P1] Modal with form fields
- Title, Role Selection, First/Last Name, Email, Phone, Status
- [x] [P2] Modal form field validation
- [x] [P3] Don't allow a duplicate email address to be set (see company structure below for detail)
- [x] [P1] Submit form / add user
- [x] [P2] Don't show / allow selection of 'Company Administrator' in 'User Role' select field for all other users
- Should only display for 'Company Administrator' user (but be disabled)
- [x] [P3] Support for customer custom attributes - #24
> Luma bug: file/image customer custom attributes are not saved
#### Edit User Modal
- [x] [P1] Modal with form fields pre-populated from existing data
- Title, Role Selection, First/Last Name, Email, Phone, Status
- [x] [P2] Modal form field validation
- [x] [P1] Submit form / update user
- [x] [P2] Don't allow updating of 'User Role' or 'Status' of company administrator account (should be disabled)
- [x] [P2] Don't show / allow selection of 'Company Administrator' in 'User Role' select field for all other users
- Should only display for 'Company Administrator' user (but be disabled)
- [x] [P3] Support for customer custom attributes - #24
> Luma bug: file/image customer custom attributes are not saved
#### Delete User Modal
- [x] [P1] Modal with message and delete/make inactive buttons
- [x] [P2] Only show inactive button if user is currently active
- [x] [P1] Update user to inactive status
- [x] [P1] Delete user
</details>
### Company Structure (`/company/`)
<details>
<summary>Completed features (click to expand items checklist)</summary>
#### Non-Company Account Users
- [x] [P2] Show 'create company account' message and button (link) for non company users only
#### View Only
- [x] [P1] Accessible with relevant permissions only (view users/teams only)
- [x] [P1] View company structure tree output
- [x] [P2] Expand/collapse tree sections
- [x] [P2] Expand/collapse all sections
- [x] [P2] View team tooltip
#### View & Manage
- [x] [P1] Accessible with relevant permissions only (manage users/teams)
- [x] [P1] Company structure tree output
- [x] [P2] Expand/collapse tree sections
- [x] [P2] Expand/collapse all sections
- [x] [P2] Team tooltip
- [x] [P1] Add user link (see modal features below)
- [x] [P1] Add team link (see modal features below)
- [x] [P1] Edit selected user/team link (see modal features below)
- [x] [P1] Delete selected user/team link (see modal features below)
- [x] [P1] Select/move users/teams
#### Add User Modal
- [x] [P1] Modal with form fields
- Title, Role Selection, First/Last Name, Email, Phone, Status
- [x] [P2] Modal form field validation
- [x] [P3] Don't allow a duplicate email address to be set
- [x] [P2] Don't show / allow selection of 'Company Administrator' in 'User Role' select field for all other users
<img src="/uploads/ccb8262069a511755e80e15b9e4046db/Company_Add_User_Hyvä.png" width="400" height="auto" />
<img src="/uploads/0dddb291a6d3112bae7fec06307f8ea5/Company_Add_User_Luma.png" width="300" height="auto" />
- [x] [P1] Submit form / add user
- [x] [P2] Don't show / allow selection of 'Company Administrator' in 'User Role' select field
- [x] [P3] Support for customer custom attributes - #24
> Luma bug: file/image customer custom attributes are not saved
#### Edit User Modal
- [x] [P2] Show error message if no user selected
- [x] [P2] Show error message if no items selected
- [x] [P1] Modal with form fields pre-populated from existing data
- Title, Role Selection, First/Last Name, Email, Phone, Status
- [x] [P2] Modal form field validation
- [x] [P1] Submit form / update user
- [x] [P2] Don't allow updating of 'User Role' or 'Status' of company administrator account (should be disabled)
- [x] [P2] Don't show / allow selection of 'Company Administrator' in 'User Role' select field for all other users
- Should only display for 'Company Administrator' user (but be disabled)
- [x] [P3] Support for customer custom attributes - #24
> Luma bug: file/image customer custom attributes are not saved
#### Add Team Modal
- [x] [P1] Modal with form fields
- Title, Description
- [x] [P2] Modal form field validation
- [x] [P1] Submit form / add team
#### Edit Team Modal
- [x] [P2] Show error message if no team selected
- [x] [P2] Show error message if no items selected
- [x] [P1] Modal with form fields pre-populated from existing data
- Title, Description
- [x] [P2] Modal form field validation
- [x] [P1] Submit form / update team
#### Delete User Modal
- [x] [P2] Show error message if no user selected
- [x] [P2] Show error message if no items selected
- [x] [P1] Modal with message and delete button
- [x] [P1] Delete user
#### Delete Team Modal
- [x] [P2] Show error message if no team selected
- [x] [P2] Show error message if no items selected
- [x] [P1] Modal with message and delete button
- [x] [P1] Delete team
</details>
<details>
<summary>Unsupported features (click to expand items checklist)</summary>
- [ ] [P3] Drag user/team to a new position in the same level
> Feature will not be added. While this can be done in Luma, on page refresh these positions are not saved (it is always alphabetical)
<img src="/uploads/7f25748d07378e08d0e1a0efe28292e6/Company_Structure_Move_User_Same_Lvel.png" width="300" height="auto" />
- [ ] [P3] Multiple select/move users/teams
- Cmd/ctrl select (or shift for a range), then drag as one
> Feature unlikely to be added (at least anytime soon).
<img src="/uploads/ee36369328e1bbb1be07e004e0dcff54/image.png" width="200" height="auto" />
</details>
### Access Denied Page (`/company/accessdenied/`)
> For when current user does not have relevant permissions to view a page (they get redirected to this page)
- [x] [P2] Access Denied Title and Message
## Contributors
@ddelgado
## Voting
Use :thumbsup: to cast your vote.
issue