TimeSlotService
in package
Builds time slots for the Appointment Form.
Tags
Table of Contents
- $employeeIds : array<string|int, int>
- $locationIds : array<string|int, int>
- $schedulers : array<string|int, mixed>
- $service : Service
- __construct() : mixed
- addEmployee() : mixed
- addEmployees() : mixed
- blockCartItems() : mixed
- blockPeriod() : mixed
- getAvailableTimeSlotsForDate() : array<string|int, TimePeriod>
- getAvailableTimeSlotsForPeriod() : array<string|int, mixed>
- getTimeSlotsForEntities() : array<string|int, mixed>
- getTimeSlotsForHours() : array<string|int, TimePeriod>
- isAvailableTimeSlot() : bool
- getUnblockedTimeSlotsBookingIds() : array<string|int, mixed>|array<string|int, int>
Properties
$employeeIds
public
array<string|int, int>
$employeeIds
= []
Tags
$locationIds
public
array<string|int, int>
$locationIds
= []
Tags
$schedulers
public
array<string|int, mixed>
$schedulers
= []
Tags
$service
public
Service
$service
= null
Tags
Methods
__construct()
public
__construct(Service $service[, array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $service : Service
- $args : array<string|int, mixed> = []
-
Optional. @param int|int[] $args['employees'] One or more allowed employee ID. Leave empty to allow all employees of the service. @param int|int[] $args['locations'] One or more allowed location ID. Leave empty to allow all locations.
Tags
Return values
mixed —addEmployee()
public
addEmployee(int $employeeId, int|array<string|int, int> $locationId) : mixed
Parameters
- $employeeId : int
- $locationId : int|array<string|int, int>
-
Optional. One or more allowed location ID. 0 by default (all allowed).
Tags
Return values
mixed —addEmployees()
public
addEmployees(array<string|int, int> $employees, int|array<string|int, int> $locations) : mixed
Parameters
- $employees : array<string|int, int>
- $locations : int|array<string|int, int>
-
Optional. One or more allowed location ID. 0 by default (all allowed).
Tags
Return values
mixed —blockCartItems()
public
blockCartItems(array<string|int, mixed> $cartItems) : mixed
Parameters
- $cartItems : array<string|int, mixed>
-
Array of [service_id, employee_id, location_id, date, time].
Tags
Return values
mixed —blockPeriod()
public
blockPeriod(DateTime|string $fromDate, DateTime|string $toDate) : mixed
Parameters
- $fromDate : DateTime|string
- $toDate : DateTime|string
Tags
Return values
mixed —getAvailableTimeSlotsForDate()
public
getAvailableTimeSlotsForDate(DateTime $date[, bool $sinceToday = true ]) : array<string|int, TimePeriod>
Parameters
- $date : DateTime
- $sinceToday : bool = true
-
Optional. Limit the min date to the current date & time + time before booking. True by default.
Tags
Return values
array<string|int, TimePeriod> —[Time period string => Time period]
getAvailableTimeSlotsForPeriod()
public
getAvailableTimeSlotsForPeriod(DateTime|string $fromDate, DateTime|string $toDate[, array<string|int, mixed> $args = [] ]) : array<string|int, mixed>
Parameters
- $fromDate : DateTime|string
- $toDate : DateTime|string
- $args : array<string|int, mixed> = []
-
Optional. @param bool $args['skip_empty'] Skip days without available slots. True by default. @param bool $args['since_today'] Limit the min date to the current date & time + time before booking. True by default.
Tags
Return values
array<string|int, mixed> —['Y-m-d' => [Time period string => Time period]]
getTimeSlotsForEntities()
public
getTimeSlotsForEntities(DateTime|string $fromDate, DateTime|string $toDate[, bool $sinceToday = true ]) : array<string|int, mixed>
Parameters
- $fromDate : DateTime|string
- $toDate : DateTime|string
- $sinceToday : bool = true
-
Optional. Limit the min date to the current date & time
- time before booking. True by default.
Tags
Return values
array<string|int, mixed> —['Y-m-d' => [Time period string => Array of [Employee ID, Location ID]]]
getTimeSlotsForHours()
public
getTimeSlotsForHours(TimePeriod|array<string|int, TimePeriod>|TimePeriods $workingHours[, array<string|int, mixed> $args = [] ]) : array<string|int, TimePeriod>
Parameters
- $workingHours : TimePeriod|array<string|int, TimePeriod>|TimePeriods
- $args : array<string|int, mixed> = []
-
Optional. @param bool $args['since_today'] Limit the min date to the current date & time + time before booking. True by default. @param int $args['employee_id'] ID for variations. 0 by default (no variation).
Tags
Return values
array<string|int, TimePeriod> —[Time period string => Time period]
isAvailableTimeSlot()
public
isAvailableTimeSlot(TimePeriod $timeSlot) : bool
Parameters
- $timeSlot : TimePeriod
Tags
Return values
bool —getUnblockedTimeSlotsBookingIds()
protected
getUnblockedTimeSlotsBookingIds() : array<string|int, mixed>|array<string|int, int>