- Updated SCSS for tickets main view and basket view, enhancing visual design and responsiveness. - Added new calendar functionality in the admin panel for managing ticket availability. - Implemented error handling for ticket availability in the basket view. - Introduced a new calendar availability table in the database for tracking ticket dates. - Added a new link to the calendar in the logged-in user navigation. - Improved ticket selection logic to disable unavailable tickets in the main view. - Created guidelines for code standards in AGENTS.md.
57 lines
1.7 KiB
PHP
57 lines
1.7 KiB
PHP
<?php
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', 1);
|
|
header('Content-Type: text/plain; charset=utf-8');
|
|
|
|
require_once 'config.php';
|
|
require_once 'libraries/medoo/medoo.php';
|
|
|
|
$mdb = new medoo([
|
|
'database_type' => 'mysql',
|
|
'database_name' => $database['name'],
|
|
'server' => $database['host'],
|
|
'username' => $database['user'],
|
|
'password' => $database['password'],
|
|
'charset' => 'utf8'
|
|
]);
|
|
|
|
$migrations = [
|
|
|
|
'ticket_prices' => "CREATE TABLE IF NOT EXISTS ticket_prices (
|
|
ticket_id VARCHAR(100) PRIMARY KEY,
|
|
price DECIMAL(10,2) DEFAULT NULL,
|
|
price_weekend DECIMAL(10,2) DEFAULT NULL,
|
|
dynamic_price_day0 DECIMAL(10,2) DEFAULT NULL,
|
|
dynamic_price_day1_2 DECIMAL(10,2) DEFAULT NULL,
|
|
dynamic_price_day3_7 DECIMAL(10,2) DEFAULT NULL,
|
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8",
|
|
|
|
'ticket_prices_add_price_weekend' => "ALTER TABLE ticket_prices ADD COLUMN IF NOT EXISTS price_weekend DECIMAL(10,2) DEFAULT NULL AFTER price",
|
|
|
|
'ticket_calendar_availability' => "CREATE TABLE IF NOT EXISTS ticket_calendar_availability (
|
|
ticket_group VARCHAR(64) NOT NULL,
|
|
available_date DATE NOT NULL,
|
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (ticket_group, available_date)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8",
|
|
|
|
];
|
|
|
|
$ok = 0;
|
|
$errors = 0;
|
|
|
|
foreach ($migrations as $name => $sql) {
|
|
$result = $mdb->query($sql);
|
|
if ($result !== false) {
|
|
echo "[OK] $name\n";
|
|
$ok++;
|
|
} else {
|
|
$err = $mdb->error();
|
|
echo "[BLAD] $name: " . (is_array($err) ? end($err) : $err) . "\n";
|
|
$errors++;
|
|
}
|
|
}
|
|
|
|
echo "\nGotowe: $ok OK, $errors bledow.\n";
|