eighty9nine / filament-approvals

MIT License
70 stars 21 forks source link

How to display two buttons Approve an Reject on the view page of Ressource? #33

Closed Mussa1998 closed 2 months ago

Mussa1998 commented 2 months ago

I am currently step by step setup filament-approval on my project. I need to display the "Approve" and "Reject" buttons on my view page. To achieve this, I added the following actions to the getHeaderActions function :

ApproveAction::make(); RejectAction::make();

However, despite this configuration, the buttons are still not appearing on the page. I was expecting to see both buttons in the header, but nothing shows up.

Have I missed a step or a specific configuration ? Are there any prerequisites or additional dependencies required to make these actions visible?

Thank you in advance for your help.

tonypartridge commented 2 months ago

They will only show if at the user can approve or reject. Has the process been submitted? If the flow has started is it still at initiated state? If so then you need the submit button. If you want to auto-submit on creation you can use:

public bool $autoSubmit = true;

on the model as per:

https://github.com/ringlesoft/laravel-process-approval?tab=readme-ov-file#model-submitting

Mussa1998 commented 2 months ago

Thanks for your answer @tonypartridge

At the moment, I only have one user with the Admin role who can validate or reject the process (he can do all the actions). The process is in created state at the beginning and underneath it is marked in progress in small type.

So for the submission, I do it manually. I'd like to be able to display both the Approve and Reject buttons once I'm on my view page, since the current user has the Admin role, so he can see both buttons normally, but that's not the case at the moment.

I'm trying now to use auto-submit as you told me above and then display only the buttons Approve or Reject but still dosen't work.

tonypartridge commented 2 months ago

Dive into the vendor source code and dd on the button visibility parameters to see which are not being hit