Autosave: 20260316-130637

This commit is contained in:
Flatlogic Bot 2026-03-16 13:06:37 +00:00
parent 4f4d8efa33
commit adc8aae5d0
3 changed files with 84 additions and 6 deletions

View File

@ -81,6 +81,19 @@ if ($method === 'GET') {
$holidays = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($holidays as $h) {
// Render a visible block event in the time grid
$events[] = [
'id' => 'hol_block_' . $h['start'],
'title' => __('holiday') . ': ' . $h['title'],
'start' => $h['start'] . 'T' . $global_start . ':00',
'end' => $h['start'] . 'T' . $global_end . ':00',
'allDay' => false,
'color' => '#dc3545',
'textColor' => '#fff',
'className' => 'public-holiday-event',
'extendedProps' => ['type' => 'public_holiday_block', 'blocks_selection' => true]
];
// Render daily blocks for time grid
$events[] = [
'id' => 'hol_bg_' . $h['start'],
@ -142,6 +155,24 @@ if ($method === 'GET') {
$isFilteredDoctor = ($doctor_id && $doctor_id == $dh['doctor_id']);
// Render a visible block event in the time grid so it's super obvious
$s = get_system_settings();
$global_start = $s['working_hours_start'] ?? '08:00';
$global_end = $s['working_hours_end'] ?? '17:00';
$events[] = [
'id' => 'doc_hol_block_' . $dh['id'] . '_' . $dateStr,
'title' => 'Holiday: ' . $dh['doctor_name'],
'start' => $dateStr . 'T' . $global_start . ':00',
'end' => $dateStr . 'T' . $global_end . ':00',
'allDay' => false,
'color' => '#ffc107',
'textColor' => '#000',
'className' => 'doctor-holiday-event',
'extendedProps' => ['type' => 'doctor_holiday_block', 'doctor_id' => $dh['doctor_id'], 'blocks_selection' => $isFilteredDoctor]
];
// Keep the background shading
$events[] = [
'id' => 'doc_hol_bg_' . $dh['id'] . '_' . $dateStr,
'start' => $dateStr . 'T00:00:00',
@ -150,7 +181,7 @@ if ($method === 'GET') {
'allDay' => false,
'backgroundColor' => $isFilteredDoctor ? 'rgba(255, 193, 7, 0.5)' : 'rgba(255, 193, 7, 0.15)',
'overlap' => !$isFilteredDoctor,
'extendedProps' => ['type' => 'doctor_holiday', 'doctor_id' => $dh['doctor_id'], 'blocks_selection' => $isFilteredDoctor]
'extendedProps' => ['type' => 'doctor_holiday', 'doctor_id' => $dh['doctor_id'], 'blocks_selection' => $isFilteredDoctor, 'blocks_selection' => $isFilteredDoctor]
];
$currentDate = strtotime('+1 day', $currentDate);
@ -165,7 +196,7 @@ if ($method === 'GET') {
'allDay' => true,
'color' => '#ffc107',
'textColor' => '#000',
'extendedProps' => ['type' => 'doctor_holiday', 'doctor_id' => $dh['doctor_id']]
'extendedProps' => ['type' => 'doctor_holiday', 'doctor_id' => $dh['doctor_id'], 'blocks_selection' => $isFilteredDoctor]
];
}

View File

@ -243,10 +243,7 @@ document.addEventListener('DOMContentLoaded', function() {
fetch('api/appointments.php?start=' + fetchInfo.startStr + '&end=' + fetchInfo.endStr + '&doctor_id=' + doctorFilter.value)
.then(response => response.json())
.then(data => {
if (data.businessHours) {
calendar.setOption('businessHours', data.businessHours);
}
console.log('Events fetched:', data.events); // Debug log
// We DO NOT setOption('businessHours') here to prevent FullCalendar from re-rendering and clearing events.
successCallback(data.events);
})
.catch(error => failureCallback(error));
@ -354,6 +351,33 @@ document.addEventListener('DOMContentLoaded', function() {
</script>
<style>
.public-holiday-event {
background: repeating-linear-gradient(
45deg,
#dc3545,
#dc3545 10px,
#e4606d 10px,
#e4606d 20px
) !important;
border: 1px solid #c82333 !important;
opacity: 0.8;
pointer-events: none;
}
.doctor-holiday-event {
background: repeating-linear-gradient(
45deg,
#ffc107,
#ffc107 10px,
#ffca2c 10px,
#ffca2c 20px
) !important;
border: 1px solid #e0a800 !important;
color: #856404 !important;
opacity: 0.8;
pointer-events: none; /* Make it unclickable so users can click behind it if needed */
}
/* Standard event styles now */
.doctor-holiday-bg {
border: 1px solid #e0a800 !important;

23
test_groups.php Normal file
View File

@ -0,0 +1,23 @@
<?php
$section = 'test_groups';
require_once __DIR__ . '/db/config.php';
require_once __DIR__ . '/helpers.php';
$db = db();
$lang = $_SESSION['lang'];
require_once __DIR__ . '/includes/actions.php';
require_once __DIR__ . '/includes/common_data.php';
$is_ajax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest');
if (!$is_ajax) {
require_once __DIR__ . '/includes/layout/header.php';
}
require_once __DIR__ . '/includes/pages/test_groups.php';
if (!$is_ajax) {
require_once __DIR__ . '/includes/layout/footer.php';
}
?>