Lifecycle Hooks
mount
When start component
public function mount()
{
$this->times = [
'6:30am', '6:45am', '7:00am', '7:15am', '7:30am', '7:45am',
'8:00am', '8:15am', '8:30am', '8:45am', '9:00am', '9:15am',
'9:30am', '9:45am', '10:00am', '10:15am', '10:30am', '10:45am',
'11:00am', '11:15am', '11:30am', '11:45am', '12:00pm', '12:15pm',
'12:30pm', '12:45pm', '1:00pm', '1:15pm', '1:30pm', '1:45pm',
'2:00pm', '2:15pm', '2:30pm', '2:45pm', '3:00pm', '3:15pm',
'3:30pm', '3:45pm', '4:00pm', '4:15pm', '4:30pm', '4:45pm',
'5:00pm', '5:15pm', '5:30pm', '5:45pm', '6:00pm', '6:15pm',
'6:30pm', '6:45pm', '7:00pm', '7:15pm', '7:30pm', '7:45pm',
'8:00pm', '8:15pm'
];
$this->timesCurrentAppointment = $this->times;
$this->dt = $this->dt ?: date("Y-m-d");
$this->nm = $this->nm ?: "";
$this->refreshCalendar();
}
updated
Starts any time that update component.
public function updated($property, $value)
{
if ($property === 'dt' || $property === 'nm') {
$this->dispatch('toast-loading');
$this->refreshCalendar();
}
}
updatedNameOfProperty
Starts any time that update component.
// HOOK: Triggered when Count (time) changes
public function updatedAppointmentDataCount($value)
{
// If we have options mode active, we need to update the price
if (!empty($this->serviceVariants)) {
// Find the option with the selected time
foreach ($this->serviceVariants as $variant) {
if ($variant['time'] == $value) {
$this->calculatePrice($variant);
break;
}
}
}
}