Fix icon hover colors, text alignment, and UI improvements
This commit is contained in:
+59
-1
@@ -268,6 +268,25 @@ function blockTime() {
|
||||
jsonResponse(['success' => false, 'message' => 'Date and time are required'], 400);
|
||||
}
|
||||
|
||||
// Validate date format
|
||||
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', (string)$data['date'])) {
|
||||
jsonResponse(['success' => false, 'message' => 'Invalid date format (use YYYY-MM-DD)'], 400);
|
||||
}
|
||||
|
||||
// Validate time format
|
||||
$time = (string)$data['time'];
|
||||
if (!preg_match('/^\d{2}:\d{2}$/', $time)) {
|
||||
jsonResponse(['success' => false, 'message' => 'Invalid time format (use HH:MM)'], 400);
|
||||
}
|
||||
|
||||
// Validate hour and minute
|
||||
list($hour, $minute) = explode(':', $time);
|
||||
$hour = (int)$hour;
|
||||
$minute = (int)$minute;
|
||||
if ($hour < 0 || $hour > 23 || $minute < 0 || $minute > 59) {
|
||||
jsonResponse(['success' => false, 'message' => 'Invalid time values'], 400);
|
||||
}
|
||||
|
||||
$blockData = [
|
||||
'date' => sanitize($data['date']),
|
||||
'time' => sanitize($data['time']),
|
||||
@@ -332,10 +351,35 @@ function createAvailabilitySlot() {
|
||||
jsonResponse(['success' => false, 'message' => 'Date and time are required'], 400);
|
||||
}
|
||||
|
||||
// Validate date format
|
||||
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', (string)$data['date'])) {
|
||||
jsonResponse(['success' => false, 'message' => 'Invalid date format (use YYYY-MM-DD)'], 400);
|
||||
}
|
||||
|
||||
// Validate time format
|
||||
$time = (string)$data['time'];
|
||||
if (!preg_match('/^\d{2}:\d{2}$/', $time)) {
|
||||
jsonResponse(['success' => false, 'message' => 'Invalid time format (use HH:MM)'], 400);
|
||||
}
|
||||
|
||||
// Validate hour and minute
|
||||
list($hour, $minute) = explode(':', $time);
|
||||
$hour = (int)$hour;
|
||||
$minute = (int)$minute;
|
||||
if ($hour < 0 || $hour > 23 || $minute < 0 || $minute > 59) {
|
||||
jsonResponse(['success' => false, 'message' => 'Invalid time values'], 400);
|
||||
}
|
||||
|
||||
// Validate capacity
|
||||
$capacity = (int)($data['capacity'] ?? 1);
|
||||
if ($capacity < 1 || $capacity > 100) {
|
||||
jsonResponse(['success' => false, 'message' => 'Capacity must be between 1 and 100'], 400);
|
||||
}
|
||||
|
||||
$slotData = [
|
||||
'date' => sanitize($data['date']),
|
||||
'time' => sanitize($data['time']),
|
||||
'capacity' => (int)($data['capacity'] ?? 1),
|
||||
'capacity' => $capacity,
|
||||
'is_available' => true,
|
||||
'notes' => sanitize($data['notes'] ?? '')
|
||||
];
|
||||
@@ -380,6 +424,20 @@ function createBooking($isPublicRequest = false) {
|
||||
jsonResponse(['success' => false, 'message' => 'Invalid email address'], 400);
|
||||
}
|
||||
|
||||
// Validate time format (HH:MM)
|
||||
$bookingTime = (string)$data['booking_time'];
|
||||
if (!preg_match('/^\d{2}:\d{2}$/', $bookingTime)) {
|
||||
jsonResponse(['success' => false, 'message' => 'Invalid time format (use HH:MM)'], 400);
|
||||
}
|
||||
|
||||
// Validate hour and minute values
|
||||
list($hour, $minute) = explode(':', $bookingTime);
|
||||
$hour = (int)$hour;
|
||||
$minute = (int)$minute;
|
||||
if ($hour < 0 || $hour > 23 || $minute < 0 || $minute > 59) {
|
||||
jsonResponse(['success' => false, 'message' => 'Invalid time values'], 400);
|
||||
}
|
||||
|
||||
$bookingDate = date('Y-m-d', strtotime($data['booking_date']));
|
||||
$today = date('Y-m-d');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user