| Server IP : 146.59.209.152 / Your IP : 216.73.216.152 Web Server : Apache System : Linux webm009.cluster131.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : monpetu ( 144298) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/monpetu/www/ipprint/extensions/bookly-addon-pro/frontend/modules/customer_profile/ |
Upload File : |
<?php
namespace BooklyPro\Frontend\Modules\CustomerProfile;
use Bookly\Lib as BooklyLib;
use BooklyPro\Lib;
class Ajax extends BooklyLib\Base\Ajax
{
/** @var BooklyLib\Entities\Customer */
protected static $customer;
/**
* @inheritDoc
*/
protected static function permissions()
{
return array( '_default' => 'customer' );
}
/**
* Get past appointments.
*/
public static function getPastAppointments()
{
$past = self::$customer->getPastAppointments( self::parameter( 'page' ), 30 );
$appointments = Lib\Utils\Common::translateAppointments( $past['appointments'] );
$custom_fields = self::parameter( 'custom_fields' ) ? explode( ',', self::parameter( 'custom_fields' ) ) : array();
$columns = (array) self::parameter( 'columns' );
$with_cancel = in_array( 'cancel', $columns );
$customer = self::$customer;
$html = self::renderTemplate( '_rows', compact( 'appointments', 'columns', 'custom_fields', 'with_cancel', 'customer' ), false );
wp_send_json_success( array( 'html' => $html, 'more' => $past['more'] ) );
}
/**
* @inheritDoc
*/
protected static function hasAccess( $action )
{
if ( parent::hasAccess( $action ) ) {
self::$customer = BooklyLib\Entities\Customer::query()->where( 'wp_user_id', get_current_user_id() )->findOne();
return self::$customer->isLoaded();
}
return false;
}
}