abstract-analytics-ability.php
3 months ago
get-daily-chart-data.php
3 months ago
get-dashboard-stats.php
3 months ago
get-pending-bookings-count.php
3 months ago
get-top-services.php
3 months ago
get-pending-bookings-count.php
35 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | exit; |
| 4 | } |
| 5 | |
| 6 | class LatePointAbilityGetPendingBookingsCount extends LatePointAbstractAnalyticsAbility { |
| 7 | |
| 8 | protected function configure(): void { |
| 9 | $this->id = 'latepoint/get-pending-bookings-count'; |
| 10 | $this->label = __( 'Get pending bookings count', 'latepoint' ); |
| 11 | $this->description = __( 'Returns the total number of bookings currently in pending status.', 'latepoint' ); |
| 12 | $this->permission = 'booking__view'; |
| 13 | $this->read_only = true; |
| 14 | } |
| 15 | |
| 16 | public function get_input_schema(): array { |
| 17 | return [ |
| 18 | 'type' => 'object', |
| 19 | 'properties' => [], |
| 20 | ]; |
| 21 | } |
| 22 | |
| 23 | public function get_output_schema(): array { |
| 24 | return [ |
| 25 | 'type' => 'object', |
| 26 | 'properties' => [ 'count' => [ 'type' => 'integer' ] ], |
| 27 | ]; |
| 28 | } |
| 29 | |
| 30 | public function execute( array $args ) { |
| 31 | $count = (int) ( new OsBookingModel() )->where( [ 'status' => LATEPOINT_BOOKING_STATUS_PENDING ] )->count(); |
| 32 | return [ 'count' => $count ]; |
| 33 | } |
| 34 | } |
| 35 |