Need to hide the edit button from subpanel depending upon the datetime column and status column

Hi,
I have one Appointment subpanel in the suitecrm detail view. So subpanel provides the edit button for each row by default.so I need to show that edit button depending upon some filter criteria. In that panel, there is AppointmentDateTime column and the status is there so I need to show that edit button only when the column value of AppointmentDateTime is greater than the current DateTime of the system and the status column value should not be ‘cancelled’ then it will display otherwise it will not display.
Please help me with the above problem.

I decided same task with jquery frontend, that was injected while module loads

Can you post the solution for help me to solve it by steps

Can you post the solution ASAP because i need on urgent basis to complete my work.
Thanks

Hi!

Just example

  1. Reasign base class in needed view ( for ex detail view

class Customcust_basetestViewDetail extends ViewDetail
{

public function __construct()
{
parent::__construct();
}

  1. Reasign display function with your modifications

public function display()
{

error_log( __FUNCTION__." calling custom");

$html= '<script type="text/javascript" src="modules/.../libs/injector.js"></script>' ;

parent::display();
echo $html;

}

In youur "injector.js " put neede jquery code or some else to modify dom elements

1 Like

If you create a custom widget then you can do this via back-end

Basic workflow:

  1. Create a custom subpanel file (instead of default.php) inside the Appointment module
  2. Create a custom widget for that edit button and add it to the file in step 1
  3. Point to that custom subpanel file in step 1 inside your Detail view module (you didn’t specify the module name)
  4. Inside the custom widget file add your logic
  5. Profit ?

Here’s an article with a video that explains how to add the custom subpanel file:
http://qc-digital.com/how-to-change-the-edit-button-inside-the-subpanel/

In the custom edit button widget (that displays the edit button) simply comment out the final ‘return’ field which returns the code for the edit button if your condition is not met. I just tested it and it worked for me.

Cheers