Adding Menu Items to Admin Panel

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
jafo66
Posts: 25
Joined: 06 Mar 2024, 04:42

Adding Menu Items to Admin Panel

Post by jafo66 » 22 Mar 2024, 02:04

Code: Select all

Php version: 8.2.15

Versions: 
aimeos/ai-laravel                  2023.10.5  
aimeos/aimeos-laravel              2023.10.8  
inertiajs/inertia-laravel          v0.6.11    
laravel/framework                  v10.48.3   
laravel/jetstream                  v4.3.1     
laravel/serializable-closure       v1.3.3     
spatie/laravel-ignition            2.4.2      

OS version: MacOs 14.4
Overview: We are building a website for a company manages sports tournaments. Aimeos is a perfect fit for what we are trying to accomplish. We are trying to add the concept of seasons to the back end. I have been able to make a seasons table and create a link from products to seasons. In the postgres database, that all looks to be properly configured.

Right now, I'm working on adding new panels to the admin screens. I have a few questions below.

NOTE: I have made an extension which has been registered into the project. Per the documentation, I'm trying to perform my changes within the extension and not touch any of the aimeos code.

1a) How do I add one off translations to proper capitalize the menu items? I did try to create a en.php in the i18n directory but I don't think that works or I didn't configure it properly.

1b) How do I add the icon properly? That code below should pull back a basketball (free version), but it comes back with a different icon. Source: https://fontawesome.com/icons/basketbal ... ic&s=solid

Here is my admin.php:

Code: Select all

<?php

return [
     'jqadm' => [
     	'navbar' => [
     		15 => [
     			'_' => 'tournament',
     			10 => 'season',
     		],
     	],
     	'resource' => [
     		'tournament' => [
     			'groups' => ['editor', 'admin', 'super'],
     		],
     		'season' => [
     			'groups' => ['editor', 'admin', 'super'],
     		],
     	]
     ],
     'jsonadm' => [
     ],
];
Here is my custom.css:

Code: Select all

 .aimeos .main-sidebar .menuitem-tournament i.icon:before {
	content: "\F434"
}
2) I'm not following the documentation in how to add the panel. In the documentation, it is not clear which directory the panel code should go into. In the docs here: https://aimeos.org/docs/latest/admin/jq ... nt-panels/, it has the directory as ./admin/jqadm/src/...., but if I look at the most recent ai-admin-jqadm package (I'm assuming is typical extension), the source code is in src/Admin/JQAdm/... Can you confirm if I follow the ai-admin-jqadm structure, stuff should work or should I be following the docs?

3) How would I add a field to the product screen when the product type is "event"? I'm looking to add a season drop down to the event as it is being configured. I would prefer to put it on the main product screen and not on a subpanel if at all possible. I'm also thinking there are a few things I would like to hide.

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: Adding Menu Items to Admin Panel

Post by aimeos » 24 Mar 2024, 11:00

jafo66 wrote: 22 Mar 2024, 02:04 1a) How do I add one off translations to proper capitalize the menu items? I did try to create a en.php in the i18n directory but I don't think that works or I didn't configure it properly.
If you want to add translation to PO files instead of the ./config/shop.php, you have to compile the .po file to an MO file to be used: https://aimeos.org/docs/latest/developer/translations/
jafo66 wrote: 22 Mar 2024, 02:04 1b) How do I add the icon properly? That code below should pull back a basketball (free version), but it comes back with a different icon. Source: https://fontawesome.com/icons/basketbal ... ic&s=solid
We don't use FontAwesome due to their licensing any more for a long time but the .fa CSS classes are still there. Instead, we use the Bootstrap icons:
- https://github.com/aimeos/ai-admin-jqad ... on.css#L11
- https://icons.getbootstrap.com/

Unfortunately, there's not basket ball icon included there.
jafo66 wrote: 22 Mar 2024, 02:04 2) I'm not following the documentation in how to add the panel. In the documentation, it is not clear which directory the panel code should go into. In the docs here: https://aimeos.org/docs/latest/admin/jq ... nt-panels/, it has the directory as ./admin/jqadm/src/...., but if I look at the most recent ai-admin-jqadm package (I'm assuming is typical extension), the source code is in src/Admin/JQAdm/... Can you confirm if I follow the ai-admin-jqadm structure, stuff should work or should I be following the docs?
The documentation was outdated and we've fixed it now. The correct path is ./src/Admin/JQAdm/
jafo66 wrote: 22 Mar 2024, 02:04 3) How would I add a field to the product screen when the product type is "event"? I'm looking to add a season drop down to the event as it is being configured. I would prefer to put it on the main product screen and not on a subpanel if at all possible. I'm also thinking there are a few things I would like to hide.
Adapt the product/item.php template here:
https://github.com/aimeos/ai-admin-jqad ... t/item.php

Add the necessary CSS and JS in the themes/admin/jqadm/custom.{css,js} files.
Keep in mind, that you can only save product item properties in the basic tab automatically if you add them via a decorator for the product manager:
https://aimeos.org/docs/latest/models/e ... /#easy-way
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

jafo66
Posts: 25
Joined: 06 Mar 2024, 04:42

Re: Adding Menu Items to Admin Panel

Post by jafo66 » 24 Mar 2024, 19:07

jafo66 wrote: 22 Mar 2024, 02:04 1a) How do I add one off translations to proper capitalize the menu items? I did try to create a en.php in the i18n directory but I don't think that works or I didn't configure it properly.
aimeos wrote: 24 Mar 2024, 11:00 If you want to add translation to PO files instead of the ./config/shop.php, you have to compile the .po file to an MO file to be used: https://aimeos.org/docs/latest/developer/translations/
Sorry for the newbie question, can you have a shop.php file in the extension OR that has to be done in the normal project?
jafo66 wrote: 22 Mar 2024, 02:04 1b) How do I add the icon properly? That code below should pull back a basketball (free version), but it comes back with a different icon. Source: https://fontawesome.com/icons/basketbal ... ic&s=solid
aimeos wrote: 24 Mar 2024, 11:00 We don't use FontAwesome due to their licensing any more for a long time but the .fa CSS classes are still there. Instead, we use the Bootstrap icons:
- https://github.com/aimeos/ai-admin-jqad ... on.css#L11
- https://icons.getbootstrap.com/

Unfortunately, there's not basket ball icon included there.
Thanks for looking, I did actually find one (called "dribble") but I appreciate you checking.
jafo66 wrote: 22 Mar 2024, 02:04 2) I'm not following the documentation in how to add the panel. In the documentation, it is not clear which directory the panel code should go into. In the docs here: https://aimeos.org/docs/latest/admin/jq ... nt-panels/, it has the directory as ./admin/jqadm/src/...., but if I look at the most recent ai-admin-jqadm package (I'm assuming is typical extension), the source code is in src/Admin/JQAdm/... Can you confirm if I follow the ai-admin-jqadm structure, stuff should work or should I be following the docs?
aimeos wrote: 24 Mar 2024, 11:00 The documentation was outdated and we've fixed it now. The correct path is ./src/Admin/JQAdm/
Thank you!
jafo66 wrote: 22 Mar 2024, 02:04 3) How would I add a field to the product screen when the product type is "event"? I'm looking to add a season drop down to the event as it is being configured. I would prefer to put it on the main product screen and not on a subpanel if at all possible. I'm also thinking there are a few things I would like to hide.
aimeos wrote: 24 Mar 2024, 11:00 Adapt the product/item.php template here:
https://github.com/aimeos/ai-admin-jqad ... t/item.php

Add the necessary CSS and JS in the themes/admin/jqadm/custom.{css,js} files.
Keep in mind, that you can only save product item properties in the basic tab automatically if you add them via a decorator for the product manager:
https://aimeos.org/docs/latest/models/e ... /#easy-way
Thanks for information. One modifying the template, do you have good way to make sure I don't lose out on upgrades in the future?

jafo66
Posts: 25
Joined: 06 Mar 2024, 04:42

Re: Adding Menu Items to Admin Panel

Post by jafo66 » 25 Mar 2024, 00:14

You can ignore the shop.php question... I have it working in the project which is good for our solution.

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: Adding Menu Items to Admin Panel

Post by aimeos » 25 Mar 2024, 07:53

jafo66 wrote: 24 Mar 2024, 19:07 Thanks for information. One modifying the template, do you have good way to make sure I don't lose out on upgrades in the future?
See: https://aimeos.org/docs/latest/admin/jq ... templates/
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply