Kotkakey
This commit is contained in:
parent
577ca93381
commit
7a219bcd94
0
.perm_test_apache
Normal file
0
.perm_test_apache
Normal file
0
.perm_test_exec
Normal file
0
.perm_test_exec
Normal file
311
ai/LocalAIApi.php
Normal file
311
ai/LocalAIApi.php
Normal file
@ -0,0 +1,311 @@
|
|||||||
|
<?php
|
||||||
|
// LocalAIApi — proxy client for the Responses API.
|
||||||
|
// Usage:
|
||||||
|
// require_once __DIR__ . '/ai/LocalAIApi.php';
|
||||||
|
// $response = LocalAIApi::createResponse([
|
||||||
|
// 'input' => [
|
||||||
|
// ['role' => 'system', 'content' => 'You are a helpful assistant.'],
|
||||||
|
// ['role' => 'user', 'content' => 'Tell me a bedtime story.'],
|
||||||
|
// ],
|
||||||
|
// ]);
|
||||||
|
// if (!empty($response['success'])) {
|
||||||
|
// $decoded = LocalAIApi::decodeJsonFromResponse($response);
|
||||||
|
// }
|
||||||
|
|
||||||
|
class LocalAIApi
|
||||||
|
{
|
||||||
|
/** @var array<string,mixed>|null */
|
||||||
|
private static ?array $configCache = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signature compatible with the OpenAI Responses API.
|
||||||
|
*
|
||||||
|
* @param array<string,mixed> $params Request body (model, input, text, reasoning, metadata, etc.).
|
||||||
|
* @param array<string,mixed> $options Extra options (timeout, verify_tls, headers, path, project_uuid).
|
||||||
|
* @return array{
|
||||||
|
* success:bool,
|
||||||
|
* status?:int,
|
||||||
|
* data?:mixed,
|
||||||
|
* error?:string,
|
||||||
|
* response?:mixed,
|
||||||
|
* message?:string
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
public static function createResponse(array $params, array $options = []): array
|
||||||
|
{
|
||||||
|
$cfg = self::config();
|
||||||
|
$payload = $params;
|
||||||
|
|
||||||
|
if (empty($payload['input']) || !is_array($payload['input'])) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'error' => 'input_missing',
|
||||||
|
'message' => 'Parameter "input" is required and must be an array.',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($payload['model']) || $payload['model'] === '') {
|
||||||
|
$payload['model'] = $cfg['default_model'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::request($options['path'] ?? null, $payload, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Snake_case alias for createResponse (matches the provided example).
|
||||||
|
*
|
||||||
|
* @param array<string,mixed> $params
|
||||||
|
* @param array<string,mixed> $options
|
||||||
|
* @return array<string,mixed>
|
||||||
|
*/
|
||||||
|
public static function create_response(array $params, array $options = []): array
|
||||||
|
{
|
||||||
|
return self::createResponse($params, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform a raw request to the AI proxy.
|
||||||
|
*
|
||||||
|
* @param string $path Endpoint (may be an absolute URL).
|
||||||
|
* @param array<string,mixed> $payload JSON payload.
|
||||||
|
* @param array<string,mixed> $options Additional request options.
|
||||||
|
* @return array<string,mixed>
|
||||||
|
*/
|
||||||
|
public static function request(?string $path = null, array $payload = [], array $options = []): array
|
||||||
|
{
|
||||||
|
if (!function_exists('curl_init')) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'error' => 'curl_missing',
|
||||||
|
'message' => 'PHP cURL extension is missing. Install or enable it on the VM.',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$cfg = self::config();
|
||||||
|
|
||||||
|
$projectUuid = $cfg['project_uuid'];
|
||||||
|
if (empty($projectUuid)) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'error' => 'project_uuid_missing',
|
||||||
|
'message' => 'PROJECT_UUID is not defined; aborting AI request.',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$defaultPath = $cfg['responses_path'] ?? null;
|
||||||
|
$resolvedPath = $path ?? ($options['path'] ?? $defaultPath);
|
||||||
|
if (empty($resolvedPath)) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'error' => 'project_id_missing',
|
||||||
|
'message' => 'PROJECT_ID is not defined; cannot resolve AI proxy endpoint.',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = self::buildUrl($resolvedPath, $cfg['base_url']);
|
||||||
|
$baseTimeout = isset($cfg['timeout']) ? (int) $cfg['timeout'] : 30;
|
||||||
|
$timeout = isset($options['timeout']) ? (int) $options['timeout'] : $baseTimeout;
|
||||||
|
if ($timeout <= 0) {
|
||||||
|
$timeout = 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
$baseVerifyTls = array_key_exists('verify_tls', $cfg) ? (bool) $cfg['verify_tls'] : true;
|
||||||
|
$verifyTls = array_key_exists('verify_tls', $options)
|
||||||
|
? (bool) $options['verify_tls']
|
||||||
|
: $baseVerifyTls;
|
||||||
|
|
||||||
|
$projectHeader = $cfg['project_header'];
|
||||||
|
|
||||||
|
$headers = [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Accept: application/json',
|
||||||
|
];
|
||||||
|
$headers[] = $projectHeader . ': ' . $projectUuid;
|
||||||
|
if (!empty($options['headers']) && is_array($options['headers'])) {
|
||||||
|
foreach ($options['headers'] as $header) {
|
||||||
|
if (is_string($header) && $header !== '') {
|
||||||
|
$headers[] = $header;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($projectUuid) && !array_key_exists('project_uuid', $payload)) {
|
||||||
|
$payload['project_uuid'] = $projectUuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
$body = json_encode($payload, JSON_UNESCAPED_UNICODE);
|
||||||
|
if ($body === false) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'error' => 'json_encode_failed',
|
||||||
|
'message' => 'Failed to encode request body to JSON.',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
||||||
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $verifyTls);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $verifyTls ? 2 : 0);
|
||||||
|
curl_setopt($ch, CURLOPT_FAILONERROR, false);
|
||||||
|
|
||||||
|
$responseBody = curl_exec($ch);
|
||||||
|
if ($responseBody === false) {
|
||||||
|
$error = curl_error($ch) ?: 'Unknown cURL error';
|
||||||
|
curl_close($ch);
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'error' => 'curl_error',
|
||||||
|
'message' => $error,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$status = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
$decoded = null;
|
||||||
|
if ($responseBody !== '' && $responseBody !== null) {
|
||||||
|
$decoded = json_decode($responseBody, true);
|
||||||
|
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||||
|
$decoded = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($status >= 200 && $status < 300) {
|
||||||
|
return [
|
||||||
|
'success' => true,
|
||||||
|
'status' => $status,
|
||||||
|
'data' => $decoded ?? $responseBody,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$errorMessage = 'AI proxy request failed';
|
||||||
|
if (is_array($decoded)) {
|
||||||
|
$errorMessage = $decoded['error'] ?? $decoded['message'] ?? $errorMessage;
|
||||||
|
} elseif (is_string($responseBody) && $responseBody !== '') {
|
||||||
|
$errorMessage = $responseBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'status' => $status,
|
||||||
|
'error' => $errorMessage,
|
||||||
|
'response' => $decoded ?? $responseBody,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract plain text from a Responses API payload.
|
||||||
|
*
|
||||||
|
* @param array<string,mixed> $response Result of LocalAIApi::createResponse|request.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function extractText(array $response): string
|
||||||
|
{
|
||||||
|
$payload = $response['data'] ?? $response;
|
||||||
|
if (!is_array($payload)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($payload['output']) && is_array($payload['output'])) {
|
||||||
|
$combined = '';
|
||||||
|
foreach ($payload['output'] as $item) {
|
||||||
|
if (!isset($item['content']) || !is_array($item['content'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ($item['content'] as $block) {
|
||||||
|
if (is_array($block) && ($block['type'] ?? '') === 'output_text' && !empty($block['text'])) {
|
||||||
|
$combined .= $block['text'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($combined !== '') {
|
||||||
|
return $combined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($payload['choices'][0]['message']['content'])) {
|
||||||
|
return (string) $payload['choices'][0]['message']['content'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempt to decode JSON emitted by the model (handles markdown fences).
|
||||||
|
*
|
||||||
|
* @param array<string,mixed> $response
|
||||||
|
* @return array<string,mixed>|null
|
||||||
|
*/
|
||||||
|
public static function decodeJsonFromResponse(array $response): ?array
|
||||||
|
{
|
||||||
|
$text = self::extractText($response);
|
||||||
|
if ($text === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$decoded = json_decode($text, true);
|
||||||
|
if (is_array($decoded)) {
|
||||||
|
return $decoded;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stripped = preg_replace('/^```json|```$/m', '', trim($text));
|
||||||
|
if ($stripped !== null && $stripped !== $text) {
|
||||||
|
$decoded = json_decode($stripped, true);
|
||||||
|
if (is_array($decoded)) {
|
||||||
|
return $decoded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load configuration from ai/config.php.
|
||||||
|
*
|
||||||
|
* @return array<string,mixed>
|
||||||
|
*/
|
||||||
|
private static function config(): array
|
||||||
|
{
|
||||||
|
if (self::$configCache === null) {
|
||||||
|
$configPath = __DIR__ . '/config.php';
|
||||||
|
if (!file_exists($configPath)) {
|
||||||
|
throw new RuntimeException('AI config file not found: ai/config.php');
|
||||||
|
}
|
||||||
|
$cfg = require $configPath;
|
||||||
|
if (!is_array($cfg)) {
|
||||||
|
throw new RuntimeException('Invalid AI config format: expected array');
|
||||||
|
}
|
||||||
|
self::$configCache = $cfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$configCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build an absolute URL from base_url and a path.
|
||||||
|
*/
|
||||||
|
private static function buildUrl(string $path, string $baseUrl): string
|
||||||
|
{
|
||||||
|
$trimmed = trim($path);
|
||||||
|
if ($trimmed === '') {
|
||||||
|
return $baseUrl;
|
||||||
|
}
|
||||||
|
if (str_starts_with($trimmed, 'http://') || str_starts_with($trimmed, 'https://')) {
|
||||||
|
return $trimmed;
|
||||||
|
}
|
||||||
|
if ($trimmed[0] === '/') {
|
||||||
|
return $baseUrl . $trimmed;
|
||||||
|
}
|
||||||
|
return $baseUrl . '/' . $trimmed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Legacy alias for backward compatibility with the previous class name.
|
||||||
|
if (!class_exists('OpenAIService')) {
|
||||||
|
class_alias(LocalAIApi::class, 'OpenAIService');
|
||||||
|
}
|
||||||
52
ai/config.php
Normal file
52
ai/config.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
// OpenAI proxy configuration (workspace scope).
|
||||||
|
// Reads values from environment variables or executor/.env.
|
||||||
|
|
||||||
|
$projectUuid = getenv('PROJECT_UUID');
|
||||||
|
$projectId = getenv('PROJECT_ID');
|
||||||
|
|
||||||
|
if (
|
||||||
|
($projectUuid === false || $projectUuid === null || $projectUuid === '') ||
|
||||||
|
($projectId === false || $projectId === null || $projectId === '')
|
||||||
|
) {
|
||||||
|
$envPath = realpath(__DIR__ . '/../../.env'); // executor/.env
|
||||||
|
if ($envPath && is_readable($envPath)) {
|
||||||
|
$lines = @file($envPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: [];
|
||||||
|
foreach ($lines as $line) {
|
||||||
|
$line = trim($line);
|
||||||
|
if ($line === '' || $line[0] === '#') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!str_contains($line, '=')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
[$key, $value] = array_map('trim', explode('=', $line, 2));
|
||||||
|
if ($key === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$value = trim($value, "\"' ");
|
||||||
|
if (getenv($key) === false || getenv($key) === '') {
|
||||||
|
putenv("{$key}={$value}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$projectUuid = getenv('PROJECT_UUID');
|
||||||
|
$projectId = getenv('PROJECT_ID');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$projectUuid = ($projectUuid === false) ? null : $projectUuid;
|
||||||
|
$projectId = ($projectId === false) ? null : $projectId;
|
||||||
|
|
||||||
|
$baseUrl = 'https://flatlogic.com';
|
||||||
|
$responsesPath = $projectId ? "/projects/{$projectId}/ai-request" : null;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'base_url' => $baseUrl,
|
||||||
|
'responses_path' => $responsesPath,
|
||||||
|
'project_id' => $projectId,
|
||||||
|
'project_uuid' => $projectUuid,
|
||||||
|
'project_header' => 'project-uuid',
|
||||||
|
'default_model' => 'gpt-5',
|
||||||
|
'timeout' => 30,
|
||||||
|
'verify_tls' => true,
|
||||||
|
];
|
||||||
36
assets/css/custom.css
Normal file
36
assets/css/custom.css
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
body {
|
||||||
|
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||||
|
background-color: #F8F9FA;
|
||||||
|
color: #212529;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero {
|
||||||
|
background: linear-gradient(45deg, rgba(0, 87, 255, 0.1), rgba(76, 201, 240, 0.1));
|
||||||
|
padding: 6rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background-color: #0057FF;
|
||||||
|
border-color: #0057FF;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
padding: 0.75rem 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
border-color: #0057FF;
|
||||||
|
color: #0057FF;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
padding: 0.75rem 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
padding: 4rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
border: none;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
2
assets/js/main.js
Normal file
2
assets/js/main.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
// Future JavaScript will go here.
|
||||||
BIN
assets/pasted-20251114-095035-cf5716ad.png
Normal file
BIN
assets/pasted-20251114-095035-cf5716ad.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 473 KiB |
106
contact.php
Normal file
106
contact.php
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
$success = false;
|
||||||
|
$error = false;
|
||||||
|
$name = '';
|
||||||
|
$email = '';
|
||||||
|
$message = '';
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
require_once __DIR__ . '/mail/MailService.php';
|
||||||
|
|
||||||
|
$name = trim($_POST['name'] ?? '');
|
||||||
|
$email = trim($_POST['email'] ?? '');
|
||||||
|
$message = trim($_POST['message'] ?? '');
|
||||||
|
|
||||||
|
if (empty($name) || empty($email) || empty($message)) {
|
||||||
|
$error = "All fields are required.";
|
||||||
|
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$error = "Invalid email format.";
|
||||||
|
} else {
|
||||||
|
$to = getenv('MAIL_TO') ?: 'info@kotkakey.com';
|
||||||
|
$res = MailService::sendContactMessage($name, $email, $message, $to, 'Contact Form Submission');
|
||||||
|
|
||||||
|
if (!empty($res['success'])) {
|
||||||
|
header("Location: thank-you.php");
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$error = "Sorry, there was an error sending your message. Please try again later.";
|
||||||
|
// Log the detailed error for debugging: error_log('MailService Error: ' . ($res['error'] ?? 'Unknown error'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Contact Us - Kotkakey</title>
|
||||||
|
<meta name="description" content="Get in touch with the Kotkakey team.">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<header class="bg-white shadow-sm">
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="index.php">
|
||||||
|
<img src="assets/pasted-20251114-095035-cf5716ad.png" alt="Kotkakey Logo" height="40">
|
||||||
|
</a>
|
||||||
|
<div class="ms-auto">
|
||||||
|
<span class="navbar-text me-3">EN / FI</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<section class="section">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<div class="card p-4 p-md-5">
|
||||||
|
<h1 class="text-center mb-4">Contact Us</h1>
|
||||||
|
<p class="text-center text-muted mb-4">Have a question or want to learn more? Fill out the form below and we'll get back to you shortly.</p>
|
||||||
|
|
||||||
|
<?php if ($error): ?>
|
||||||
|
<div class="alert alert-danger"><?php echo htmlspecialchars($error); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<form action="contact.php" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Full Name</label>
|
||||||
|
<input type="text" class="form-control" id="name" name="name" value="<?php echo htmlspecialchars($name); ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="email" class="form-label">Email Address</label>
|
||||||
|
<input type="email" class="form-control" id="email" name="email" value="<?php echo htmlspecialchars($email); ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="message" class="form-label">Message</label>
|
||||||
|
<textarea class="form-control" id="message" name="message" rows="5" required><?php echo htmlspecialchars($message); ?></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="d-grid">
|
||||||
|
<button type="submit" class="btn btn-primary btn-lg">Send Message</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="py-4 bg-dark text-white mt-auto">
|
||||||
|
<div class="container text-center">
|
||||||
|
<p>Email: <a href="mailto:info@kotkakey.com" class="text-white">info@kotkakey.com</a> | <a href="https://www.linkedin.com/company/kotkakey" class="text-white">LinkedIn</a></p>
|
||||||
|
<p><a href="#" class="text-white">Privacy Policy</a> | GDPR Compliant</p>
|
||||||
|
<small>© <?php echo date("Y"); ?> Kotkakey. All Rights Reserved.</small>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
197
create-pool.php
Normal file
197
create-pool.php
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header("Location: login.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userId = $_SESSION['user_id'];
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Fetch user data
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
// Handle form submission
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$medicineName = trim($_POST['medicine_name']);
|
||||||
|
$quantity = filter_input(INPUT_POST, 'quantity', FILTER_VALIDATE_INT);
|
||||||
|
$description = trim($_POST['description']);
|
||||||
|
|
||||||
|
if (!empty($medicineName) && $quantity > 0) {
|
||||||
|
$sql = "INSERT INTO pooled_requests (user_id, medicine_name, status, participants) VALUES (?, ?, 'Pending', 1)";
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
if ($stmt->execute([$userId, $medicineName])) {
|
||||||
|
header("Location: pooled-requests.php?success=1");
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$error = "Failed to create pool. Please try again.";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$error = "Medicine name and a valid quantity are required.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Create New Pool - Kotkakey</title>
|
||||||
|
<meta name="description" content="Create a new pooled request for a medicine.">
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #f7f9fc;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
}
|
||||||
|
.sidebar {
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 260px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-right: 1px solid #e9ecef;
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link {
|
||||||
|
color: #5a6474;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link.active, .sidebar .nav-link:hover {
|
||||||
|
color: #0057FF;
|
||||||
|
background-color: #f0f6ff;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link i {
|
||||||
|
margin-right: 0.75rem;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
.main-content {
|
||||||
|
margin-left: 260px;
|
||||||
|
padding: 2rem;
|
||||||
|
padding-top: 80px; /* Space for header */
|
||||||
|
}
|
||||||
|
.top-header {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 260px;
|
||||||
|
right: 0;
|
||||||
|
height: 64px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-bottom: 1px solid #e9ecef;
|
||||||
|
padding: 0 2rem;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.card-form {
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #e9ecef;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="sidebar">
|
||||||
|
<a class="navbar-brand mb-4" href="index.php">
|
||||||
|
<img src="assets/pasted-20251114-095035-cf5716ad.png" alt="Kotkakey Logo" height="40">
|
||||||
|
</a>
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="dashboard.php">
|
||||||
|
<i class="bi bi-grid-1x2-fill"></i> Dashboard
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="shortage-alerts.php">
|
||||||
|
<i class="bi bi-exclamation-triangle-fill"></i> Shortage Alerts
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="pooled-requests.php">
|
||||||
|
<i class="bi bi-box2-heart-fill"></i> Pooled Requests
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="predictions.php">
|
||||||
|
<i class="bi bi-graph-up-arrow"></i> Predictions
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item mt-auto">
|
||||||
|
<a class="nav-link" href="settings.php">
|
||||||
|
<i class="bi bi-gear-fill"></i> Settings
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<header class="top-header">
|
||||||
|
<div class="dropdown">
|
||||||
|
<a href="#" class="d-flex align-items-center link-dark text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="bi bi-person-circle fs-3 me-2"></i>
|
||||||
|
<span class="fw-semibold"><?php echo htmlspecialchars($user['name'] ?? 'User'); ?></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu text-small shadow">
|
||||||
|
<li><a class="dropdown-item" href="profile.php">Profile</a></li>
|
||||||
|
<li><a class="dropdown-item" href="settings.php">Settings</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main-content">
|
||||||
|
<nav aria-label="breadcrumb">
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li class="breadcrumb-item"><a href="pooled-requests.php">Pooled Requests</a></li>
|
||||||
|
<li class="breadcrumb-item active" aria-current="page">Create New Pool</li>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
<h1 class="h2 mb-4 fw-bold">Create New Pooled Request</h1>
|
||||||
|
|
||||||
|
<?php if (isset($error)): ?>
|
||||||
|
<div class="alert alert-danger"><?php echo $error; ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="card-form">
|
||||||
|
<form method="POST" action="create-pool.php">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="medicine_name" class="form-label">Medicine Name</label>
|
||||||
|
<input type="text" class="form-control" id="medicine_name" name="medicine_name" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="quantity" class="form-label">Required Quantity</label>
|
||||||
|
<input type="number" class="form-control" id="quantity" name="quantity" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="description" class="form-label">Description</label>
|
||||||
|
<textarea class="form-control" id="description" name="description" rows="3"></textarea>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Create Pool</button>
|
||||||
|
<a href="pooled-requests.php" class="btn btn-secondary">Cancel</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
337
dashboard.php
Normal file
337
dashboard.php
Normal file
@ -0,0 +1,337 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header("Location: login.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userId = $_SESSION['user_id'];
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Fetch user data
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
// Fetch pooled requests
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM pooled_requests WHERE user_id = ? ORDER BY created_at DESC");
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
$pooled_requests = $stmt->fetchAll();
|
||||||
|
|
||||||
|
// Fetch shortage predictions
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM shortage_predictions WHERE user_id = ? ORDER BY days_to_shortage ASC");
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
$predictions = $stmt->fetchAll();
|
||||||
|
|
||||||
|
// Prepare data for the chart
|
||||||
|
$prediction_labels = [];
|
||||||
|
$prediction_data = [];
|
||||||
|
foreach ($predictions as $prediction) {
|
||||||
|
$prediction_labels[] = $prediction['medicine_name'];
|
||||||
|
$prediction_data[] = $prediction['days_to_shortage'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate stats
|
||||||
|
$high_risk_alerts = 0;
|
||||||
|
foreach ($predictions as $prediction) {
|
||||||
|
if ($prediction['days_to_shortage'] < 20) {
|
||||||
|
$high_risk_alerts++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$active_pooled_requests = count($pooled_requests);
|
||||||
|
$medicines_monitored = count($predictions);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Pharmacy Dashboard - Kotkakey</title>
|
||||||
|
<meta name="description" content="Kotkakey Pharmacy Dashboard for managing medicine shortages, pooled requests, and predictions.">
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #f7f9fc;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
}
|
||||||
|
.sidebar {
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 260px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-right: 1px solid #e9ecef;
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link {
|
||||||
|
color: #5a6474;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link.active, .sidebar .nav-link:hover {
|
||||||
|
color: #0057FF;
|
||||||
|
background-color: #f0f6ff;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link i {
|
||||||
|
margin-right: 0.75rem;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
.main-content {
|
||||||
|
margin-left: 260px;
|
||||||
|
padding: 2rem;
|
||||||
|
padding-top: 80px; /* Space for header */
|
||||||
|
}
|
||||||
|
.top-header {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 260px;
|
||||||
|
right: 0;
|
||||||
|
height: 64px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-bottom: 1px solid #e9ecef;
|
||||||
|
padding: 0 2rem;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.stat-card {
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #e9ecef;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
padding: 1.5rem;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
.stat-card:hover {
|
||||||
|
transform: translateY(-3px);
|
||||||
|
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
|
||||||
|
}
|
||||||
|
.stat-card .icon {
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.table-wrapper {
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #e9ecef;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
.risk-high { color: #e74c3c; }
|
||||||
|
.risk-medium { color: #f39c12; }
|
||||||
|
.risk-low { color: #2ecc71; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="sidebar">
|
||||||
|
<a class="navbar-brand mb-4" href="index.php">
|
||||||
|
<img src="assets/pasted-20251114-095035-cf5716ad.png" alt="Kotkakey Logo" height="40">
|
||||||
|
</a>
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="#">
|
||||||
|
<i class="bi bi-grid-1x2-fill"></i> Dashboard
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="shortage-alerts.php">
|
||||||
|
<i class="bi bi-exclamation-triangle-fill"></i> Shortage Alerts
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="pooled-requests.php">
|
||||||
|
<i class="bi bi-box2-heart-fill"></i> Pooled Requests
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="predictions.php">
|
||||||
|
<i class="bi bi-graph-up-arrow"></i> Predictions
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item mt-auto">
|
||||||
|
<a class="nav-link" href="#">
|
||||||
|
<i class="bi bi-gear-fill"></i> Settings
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<header class="top-header">
|
||||||
|
<div class="dropdown">
|
||||||
|
<a href="#" class="d-flex align-items-center link-dark text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="bi bi-person-circle fs-3 me-2"></i>
|
||||||
|
<span class="fw-semibold"><?php echo htmlspecialchars($user['name'] ?? 'User'); ?></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu text-small shadow">
|
||||||
|
<li><a class="dropdown-item" href="profile.php">Profile</a></li>
|
||||||
|
<li><a class="dropdown-item" href="settings.php">Settings</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main-content">
|
||||||
|
<h1 class="h2 mb-4 fw-bold">Dashboard</h1>
|
||||||
|
|
||||||
|
<div class="row mb-4 g-4">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="stat-card">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="icon bg-danger me-3">
|
||||||
|
<i class="bi bi-exclamation-diamond-fill"></i>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h6 class="text-muted mb-1">High-Risk Alerts</h6>
|
||||||
|
<p class="card-text fs-2 fw-bold mb-0"><?php echo $high_risk_alerts; ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="stat-card">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="icon bg-warning me-3">
|
||||||
|
<i class="bi bi-check-circle-fill"></i>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h6 class="text-muted mb-1">Active Pooled Requests</h6>
|
||||||
|
<p class="card-text fs-2 fw-bold mb-0"><?php echo $active_pooled_requests; ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="stat-card">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="icon bg-primary me-3">
|
||||||
|
<i class="bi bi-clipboard2-pulse-fill"></i>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h6 class="text-muted mb-1">Medicines Monitored</h6>
|
||||||
|
<p class="card-text fs-2 fw-bold mb-0"><?php echo $medicines_monitored; ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-4">
|
||||||
|
<div class="col-lg-7">
|
||||||
|
<div class="table-wrapper h-100">
|
||||||
|
<h4 class="fw-semibold mb-3">
|
||||||
|
<i class="bi bi-box2-heart-fill me-2 text-primary"></i> My Pooled Requests
|
||||||
|
</h4>
|
||||||
|
<table class="table table-hover align-middle">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Medicine</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Participants</th>
|
||||||
|
<th>Created</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($pooled_requests as $request): ?>
|
||||||
|
<tr>
|
||||||
|
<td><strong><?php echo htmlspecialchars($request['medicine_name']); ?></strong></td>
|
||||||
|
<td><span class="badge bg-<?php echo strtolower($request['status']) == 'confirmed' ? 'success' : (strtolower($request['status']) == 'pending' ? 'warning' : 'primary'); ?>-subtle text-<?php echo strtolower($request['status']) == 'confirmed' ? 'success' : (strtolower($request['status']) == 'pending' ? 'warning' : 'primary'); ?>-emphasis rounded-pill"><?php echo htmlspecialchars($request['status']); ?></span></td>
|
||||||
|
<td><?php echo $request['participants']; ?> Pharmacies</td>
|
||||||
|
<td><?php echo date("Y-m-d", strtotime($request['created_at'])); ?></td>
|
||||||
|
<td><a href="join-pool.php?id=<?php echo $request['id']; ?>" class="btn btn-sm btn-outline-secondary">View</a></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-5">
|
||||||
|
<div class="table-wrapper h-100">
|
||||||
|
<h4 class="fw-semibold mb-3">
|
||||||
|
<i class="bi bi-graph-up-arrow me-2 text-primary"></i> Shortage Predictions
|
||||||
|
</h4>
|
||||||
|
<canvas id="predictionsChart"></canvas>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.2/dist/chart.umd.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
const ctx = document.getElementById('predictionsChart').getContext('2d');
|
||||||
|
new Chart(ctx, {
|
||||||
|
type: 'bar',
|
||||||
|
data: {
|
||||||
|
labels: <?php echo json_encode($prediction_labels); ?>,
|
||||||
|
datasets: [{
|
||||||
|
label: 'Predicted Days to Shortage',
|
||||||
|
data: <?php echo json_encode($prediction_data); ?>,
|
||||||
|
backgroundColor: [
|
||||||
|
'rgba(231, 76, 60, 0.7)',
|
||||||
|
'rgba(243, 156, 18, 0.7)',
|
||||||
|
'rgba(46, 204, 113, 0.7)',
|
||||||
|
'rgba(243, 156, 18, 0.7)'
|
||||||
|
],
|
||||||
|
borderColor: [
|
||||||
|
'#e74c3c',
|
||||||
|
'#f39c12',
|
||||||
|
'#2ecc71',
|
||||||
|
'#f39c12'
|
||||||
|
],
|
||||||
|
borderWidth: 1
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
indexAxis: 'y',
|
||||||
|
responsive: true,
|
||||||
|
plugins: {
|
||||||
|
legend: {
|
||||||
|
display: false
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
callbacks: {
|
||||||
|
label: function(context) {
|
||||||
|
return context.dataset.label + ': ' + context.raw + ' days';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scales: {
|
||||||
|
x: {
|
||||||
|
beginAtZero: true,
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: 'Days Until Predicted Shortage'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
316
index.php
316
index.php
@ -1,150 +1,176 @@
|
|||||||
<?php
|
<!DOCTYPE html>
|
||||||
declare(strict_types=1);
|
|
||||||
@ini_set('display_errors', '1');
|
|
||||||
@error_reporting(E_ALL);
|
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
|
||||||
$now = date('Y-m-d H:i:s');
|
|
||||||
?>
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>New Style</title>
|
<title>Kotkakey – Predicting and Preventing Medicine Shortages in Finland</title>
|
||||||
<?php
|
<meta name="description" content="Kotkakey uses AI and data analytics to predict medicine shortages, reduce waste, and improve availability for Finnish pharmacies and patients.">
|
||||||
// Read project preview data from environment
|
<meta name="keywords" content="medicine shortages, pharmacy, healthcare, AI, data analytics, Finland, supply chain, pharmaceutical, predictive analytics, Built with Flatlogic Generator">
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
<meta property="og:title" content="Kotkakey – Predicting and Preventing Medicine Shortages in Finland">
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
<meta property="og:description" content="Kotkakey uses AI and data analytics to predict medicine shortages, reduce waste, and improve availability for Finnish pharmacies and patients.">
|
||||||
?>
|
<meta property="og:image" content="">
|
||||||
<?php if ($projectDescription): ?>
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
<!-- Meta description -->
|
<meta name="twitter:image" content="">
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
|
||||||
<!-- Open Graph meta tags -->
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
<!-- Twitter meta tags -->
|
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($projectImageUrl): ?>
|
|
||||||
<!-- Open Graph image -->
|
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<!-- Twitter image -->
|
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color-start: #6a11cb;
|
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
|
||||||
<div class="card">
|
<header class="bg-white shadow-sm">
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<nav class="navbar navbar-expand-lg navbar-light">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<div class="container">
|
||||||
<span class="sr-only">Loading…</span>
|
<a class="navbar-brand" href="#">
|
||||||
</div>
|
<img src="assets/pasted-20251114-095035-cf5716ad.png" alt="Kotkakey Logo" height="40">
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
</a>
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
<div class="ms-auto d-flex align-items-center">
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
<span class="navbar-text me-3">EN / FI</span>
|
||||||
</div>
|
<a href="login.php" class="btn btn-outline-primary">Login</a>
|
||||||
</main>
|
</div>
|
||||||
<footer>
|
</div>
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
</nav>
|
||||||
</footer>
|
</header>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<section class="hero text-center">
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="display-4 fw-bold">Predict. Prevent. Supply.</h1>
|
||||||
|
<p class="lead col-lg-8 mx-auto">Kotkakey uses data and AI to predict medicine shortages, reduce waste, and keep essential medicines available across Finland.</p>
|
||||||
|
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center mt-4">
|
||||||
|
<a href="signup.php" class="btn btn-primary btn-lg px-4 gap-3">Join the Pilot</a>
|
||||||
|
<a href="contact.php" class="btn btn-secondary btn-lg px-4">Contact Us</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="problem" class="section">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<h2>The Problem</h2>
|
||||||
|
<p>In smaller countries like Finland, medicines often run out or expire because these markets are less profitable and get lower supply priority from pharma companies and wholesalers.</p>
|
||||||
|
<p>This creates shortages, waste, and financial losses for pharmacies.</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 text-center">
|
||||||
|
<img src="https://i.imgur.com/o8yL3f8.png" alt="Medicine Shortage Graphic" class="img-fluid" style="max-height: 250px;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="solution" class="section bg-light">
|
||||||
|
<div class="container">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h2>Our Solution</h2>
|
||||||
|
<p class="lead">Kotkakey uses AI and data analytics to create a smarter, more resilient supply chain.</p>
|
||||||
|
</div>
|
||||||
|
<div class="row text-center">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card p-4 h-100">
|
||||||
|
<h4>Predict</h4>
|
||||||
|
<p>Predict which medicines are likely to run out.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card p-4 h-100">
|
||||||
|
<h4>Pool</h4>
|
||||||
|
<p>Pool pharmacy orders to increase buying power and attract supplier attention.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card p-4 h-100">
|
||||||
|
<h4>Provide</h4>
|
||||||
|
<p>Identify expiring or surplus stock for redistribution.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="value-proposition" class="section">
|
||||||
|
<div class="container">
|
||||||
|
<h2 class="text-center mb-5">Value Proposition</h2>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-4 mb-4">
|
||||||
|
<div class="card p-4 text-center h-100">
|
||||||
|
<h5>For Pharmacies</h5>
|
||||||
|
<p>Early alerts, smarter purchasing, and reduced waste.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 mb-4">
|
||||||
|
<div class="card p-4 text-center h-100">
|
||||||
|
<h5>For Wholesalers</h5>
|
||||||
|
<p>Better forecasting and logistics efficiency.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 mb-4">
|
||||||
|
<div class="card p-4 text-center h-100">
|
||||||
|
<h5>For the Healthcare System</h5>
|
||||||
|
<p>More stable medicine availability for everyone.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="business-model" class="section bg-light">
|
||||||
|
<div class="container">
|
||||||
|
<h2 class="text-center mb-5">Business Model</h2>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card p-4 h-100">
|
||||||
|
<h6>Subscription Access</h6>
|
||||||
|
<p>Subscription-based access to the prediction dashboard.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card p-4 h-100">
|
||||||
|
<h6>Transaction Fees</h6>
|
||||||
|
<p>A small transaction fee for verified cross-border or redistribution trades.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card p-4 h-100">
|
||||||
|
<h6>Data Insights</h6>
|
||||||
|
<p>Data insights licensing for healthcare agencies and partners.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="about" class="section">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-md-8 mx-auto text-center">
|
||||||
|
<h2>About Us</h2>
|
||||||
|
<p class="lead">“Kotkakey was founded in Finland to solve a growing problem: when medicine runs short, patients and pharmacies pay the price. We combine science, data, and collaboration to make the system smarter — starting here in Finland.”</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="cta" class="section bg-primary text-white text-center">
|
||||||
|
<div class="container">
|
||||||
|
<h2>Interested in joining our pilot program or partnering with us?</h2>
|
||||||
|
<p class="lead">Let’s connect.</p>
|
||||||
|
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center mt-4">
|
||||||
|
<a href="signup.php" class="btn btn-light btn-lg px-4 gap-3">Join Pilot</a>
|
||||||
|
<a href="contact.php" class="btn btn-outline-light btn-lg px-4">Contact Us</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="py-4 bg-dark text-white">
|
||||||
|
<div class="container text-center">
|
||||||
|
<p>Email: <a href="mailto:contact@kotkakey.fi" class="text-white">contact@kotkakey.fi</a> | <a href="#" class="text-white">LinkedIn</a></p>
|
||||||
|
<p><a href="#" class="text-white">Privacy Policy</a> | GDPR Compliant</p>
|
||||||
|
<small>© <?php echo date("Y"); ?> Kotkakey. All Rights Reserved.</small>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
201
join-pool.php
Normal file
201
join-pool.php
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header("Location: login.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_GET['id'])) {
|
||||||
|
header("Location: pooled-requests.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userId = $_SESSION['user_id'];
|
||||||
|
$requestId = $_GET['id'];
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Fetch user data
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
// Fetch pooled request details
|
||||||
|
$stmt = $pdo->prepare("SELECT pr.*, u.name as creator_name FROM pooled_requests pr JOIN users u ON pr.user_id = u.id WHERE pr.id = ?");
|
||||||
|
$stmt->execute([$requestId]);
|
||||||
|
$request = $stmt->fetch();
|
||||||
|
|
||||||
|
if (!$request) {
|
||||||
|
header("Location: pooled-requests.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Join Pool - <?php echo htmlspecialchars($request['medicine_name']); ?> - Kotkakey</title>
|
||||||
|
<meta name="description" content="Details for the pooled request for <?php echo htmlspecialchars($request['medicine_name']); ?>.">
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #f7f9fc;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
}
|
||||||
|
.sidebar {
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 260px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-right: 1px solid #e9ecef;
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link {
|
||||||
|
color: #5a6474;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link.active, .sidebar .nav-link:hover {
|
||||||
|
color: #0057FF;
|
||||||
|
background-color: #f0f6ff;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link i {
|
||||||
|
margin-right: 0.75rem;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
.main-content {
|
||||||
|
margin-left: 260px;
|
||||||
|
padding: 2rem;
|
||||||
|
padding-top: 80px; /* Space for header */
|
||||||
|
}
|
||||||
|
.top-header {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 260px;
|
||||||
|
right: 0;
|
||||||
|
height: 64px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-bottom: 1px solid #e9ecef;
|
||||||
|
padding: 0 2rem;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.card-details {
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #e9ecef;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="sidebar">
|
||||||
|
<a class="navbar-brand mb-4" href="index.php">
|
||||||
|
<img src="assets/pasted-20251114-095035-cf5716ad.png" alt="Kotkakey Logo" height="40">
|
||||||
|
</a>
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="dashboard.php">
|
||||||
|
<i class="bi bi-grid-1x2-fill"></i> Dashboard
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="shortage-alerts.php">
|
||||||
|
<i class="bi bi-exclamation-triangle-fill"></i> Shortage Alerts
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="pooled-requests.php">
|
||||||
|
<i class="bi bi-box2-heart-fill"></i> Pooled Requests
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="predictions.php">
|
||||||
|
<i class="bi bi-graph-up-arrow"></i> Predictions
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item mt-auto">
|
||||||
|
<a class="nav-link" href="settings.php">
|
||||||
|
<i class="bi bi-gear-fill"></i> Settings
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<header class="top-header">
|
||||||
|
<div class="dropdown">
|
||||||
|
<a href="#" class="d-flex align-items-center link-dark text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="bi bi-person-circle fs-3 me-2"></i>
|
||||||
|
<span class="fw-semibold"><?php echo htmlspecialchars($user['name'] ?? 'User'); ?></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu text-small shadow">
|
||||||
|
<li><a class="dropdown-item" href="profile.php">Profile</a></li>
|
||||||
|
<li><a class="dropdown-item" href="settings.php">Settings</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main-content">
|
||||||
|
<nav aria-label="breadcrumb">
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li class="breadcrumb-item"><a href="pooled-requests.php">Pooled Requests</a></li>
|
||||||
|
<li class="breadcrumb-item active" aria-current="page"><?php echo htmlspecialchars($request['medicine_name']); ?></li>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
<h1 class="h2 mb-4 fw-bold">Pooled Request Details</h1>
|
||||||
|
|
||||||
|
<div class="card-details">
|
||||||
|
<h3 class="fw-semibold"><?php echo htmlspecialchars($request['medicine_name']); ?></h3>
|
||||||
|
<p class="text-muted">Created by <?php echo htmlspecialchars($request['creator_name']); ?> on <?php echo date("F j, Y", strtotime($request['created_at'])); ?></p>
|
||||||
|
|
||||||
|
<div class="row mt-4">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<h5>Status</h5>
|
||||||
|
<p><span class="badge bg-<?php echo strtolower($request['status']) == 'confirmed' ? 'success' : (strtolower($request['status']) == 'pending' ? 'warning' : 'primary'); ?>-subtle text-<?php echo strtolower($request['status']) == 'confirmed' ? 'success' : (strtolower($request['status']) == 'pending' ? 'warning' : 'primary'); ?>-emphasis rounded-pill fs-6"><?php echo htmlspecialchars($request['status']); ?></span></p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<h5>Participants</h5>
|
||||||
|
<p class="fs-5 fw-semibold"><?php echo $request['participants']; ?> Pharmacies</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<h5>Required Quantity</h5>
|
||||||
|
<p class="fs-5 fw-semibold">100 Units</p> <!-- Placeholder -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-4">
|
||||||
|
<h5>Description</h5>
|
||||||
|
<p>This is a placeholder description for the pooled request of <?php echo htmlspecialchars($request['medicine_name']); ?>. Details about the request, required quantity, and other relevant information will be displayed here.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-5 text-center">
|
||||||
|
<a href="#" class="btn btn-primary btn-lg">Join This Pool</a>
|
||||||
|
<a href="pooled-requests.php" class="btn btn-secondary btn-lg">Back to List</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
91
login.php
Normal file
91
login.php
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
$error_message = '';
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
if (isset($_POST['email']) && isset($_POST['password'])) {
|
||||||
|
$email = $_POST['email'];
|
||||||
|
$password = $_POST['password'];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE email = ?");
|
||||||
|
$stmt->execute([$email]);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
if ($user && password_verify($password, $user['password'])) {
|
||||||
|
$_SESSION['user_id'] = $user['id'];
|
||||||
|
header("Location: dashboard.php");
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$error_message = "Invalid email or password.";
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$error_message = "Database error: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Login – Kotkakey</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<header class="bg-white shadow-sm">
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="index.php">
|
||||||
|
<img src="assets/pasted-20251114-095035-cf5716ad.png" alt="Kotkakey Logo" height="40">
|
||||||
|
</a>
|
||||||
|
<div class="ms-auto d-flex align-items-center">
|
||||||
|
<span class="navbar-text me-3">EN / FI</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="container my-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-6 col-lg-4">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="card-title text-center mb-4">Login</h3>
|
||||||
|
<?php if ($error_message): ?>
|
||||||
|
<div class="alert alert-danger"><?php echo $error_message; ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="login.php" method="post">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="email" class="form-label">Email address</label>
|
||||||
|
<input type="email" class="form-control" id="email" name="email" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="password" class="form-label">Password</label>
|
||||||
|
<input type="password" class="form-control" id="password" name="password" required>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary w-100">Login</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="py-4 bg-dark text-white mt-auto">
|
||||||
|
<div class="container text-center">
|
||||||
|
<p>Email: <a href="mailto:contact@kotkakey.fi" class="text-white">contact@kotkakey.fi</a> | <a href="#" class="text-white">LinkedIn</a></p>
|
||||||
|
<p><a href="#" class="text-white">Privacy Policy</a> | GDPR Compliant</p>
|
||||||
|
<small>© <?php echo date("Y"); ?> Kotkakey. All Rights Reserved.</small>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
6
logout.php
Normal file
6
logout.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
session_unset();
|
||||||
|
session_destroy();
|
||||||
|
header("Location: login.php");
|
||||||
|
exit;
|
||||||
183
pooled-requests.php
Normal file
183
pooled-requests.php
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header("Location: login.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userId = $_SESSION['user_id'];
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Fetch user data
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
// Fetch all pooled requests
|
||||||
|
$stmt = $pdo->prepare("SELECT pr.*, u.name as creator_name FROM pooled_requests pr JOIN users u ON pr.user_id = u.id ORDER BY pr.created_at DESC");
|
||||||
|
$stmt->execute();
|
||||||
|
$all_requests = $stmt->fetchAll();
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Pooled Requests - Kotkakey</title>
|
||||||
|
<meta name="description" content="View and join pooled medicine requests.">
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #f7f9fc;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
}
|
||||||
|
.sidebar {
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 260px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-right: 1px solid #e9ecef;
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link {
|
||||||
|
color: #5a6474;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link.active, .sidebar .nav-link:hover {
|
||||||
|
color: #0057FF;
|
||||||
|
background-color: #f0f6ff;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link i {
|
||||||
|
margin-right: 0.75rem;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
.main-content {
|
||||||
|
margin-left: 260px;
|
||||||
|
padding: 2rem;
|
||||||
|
padding-top: 80px; /* Space for header */
|
||||||
|
}
|
||||||
|
.top-header {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 260px;
|
||||||
|
right: 0;
|
||||||
|
height: 64px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-bottom: 1px solid #e9ecef;
|
||||||
|
padding: 0 2rem;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.table-wrapper {
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #e9ecef;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="sidebar">
|
||||||
|
<a class="navbar-brand mb-4" href="index.php">
|
||||||
|
<img src="assets/pasted-20251114-095035-cf5716ad.png" alt="Kotkakey Logo" height="40">
|
||||||
|
</a>
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="dashboard.php">
|
||||||
|
<i class="bi bi-grid-1x2-fill"></i> Dashboard
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="shortage-alerts.php">
|
||||||
|
<i class="bi bi-exclamation-triangle-fill"></i> Shortage Alerts
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="pooled-requests.php">
|
||||||
|
<i class="bi bi-box2-heart-fill"></i> Pooled Requests
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="predictions.php">
|
||||||
|
<i class="bi bi-graph-up-arrow"></i> Predictions
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item mt-auto">
|
||||||
|
<a class="nav-link" href="settings.php">
|
||||||
|
<i class="bi bi-gear-fill"></i> Settings
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<header class="top-header">
|
||||||
|
<div class="dropdown">
|
||||||
|
<a href="#" class="d-flex align-items-center link-dark text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="bi bi-person-circle fs-3 me-2"></i>
|
||||||
|
<span class="fw-semibold"><?php echo htmlspecialchars($user['name'] ?? 'User'); ?></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu text-small shadow">
|
||||||
|
<li><a class="dropdown-item" href="profile.php">Profile</a></li>
|
||||||
|
<li><a class="dropdown-item" href="settings.php">Settings</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main-content">
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
|
<h1 class="h2 fw-bold mb-0">All Pooled Requests</h1>
|
||||||
|
<a href="create-pool.php" class="btn btn-primary">Create New Pool</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-wrapper">
|
||||||
|
<table class="table table-hover align-middle">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Medicine</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Participants</th>
|
||||||
|
<th>Created By</th>
|
||||||
|
<th>Created On</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($all_requests as $request): ?>
|
||||||
|
<tr>
|
||||||
|
<td><strong><?php echo htmlspecialchars($request['medicine_name']); ?></strong></td>
|
||||||
|
<td><span class="badge bg-<?php echo strtolower($request['status']) == 'confirmed' ? 'success' : (strtolower($request['status']) == 'pending' ? 'warning' : 'primary'); ?>-subtle text-<?php echo strtolower($request['status']) == 'confirmed' ? 'success' : (strtolower($request['status']) == 'pending' ? 'warning' : 'primary'); ?>-emphasis rounded-pill"><?php echo htmlspecialchars($request['status']); ?></span></td>
|
||||||
|
<td><?php echo $request['participants']; ?> Pharmacies</td>
|
||||||
|
<td><?php echo htmlspecialchars($request['creator_name']); ?></td>
|
||||||
|
<td><?php echo date("Y-m-d", strtotime($request['created_at'])); ?></td>
|
||||||
|
<td><a href="join-pool.php?id=<?php echo $request['id']; ?>" class="btn btn-sm btn-outline-primary">View & Join</a></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
210
predictions.php
Normal file
210
predictions.php
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header("Location: login.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userId = $_SESSION['user_id'];
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Fetch user data
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
// Fetch shortage predictions
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM shortage_predictions WHERE user_id = ? ORDER BY days_to_shortage ASC");
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
$predictions = $stmt->fetchAll();
|
||||||
|
|
||||||
|
// Prepare data for the chart
|
||||||
|
$prediction_labels = [];
|
||||||
|
$prediction_data = [];
|
||||||
|
foreach ($predictions as $prediction) {
|
||||||
|
$prediction_labels[] = $prediction['medicine_name'];
|
||||||
|
$prediction_data[] = $prediction['days_to_shortage'];
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Shortage Predictions - Kotkakey</title>
|
||||||
|
<meta name="description" content="View medicine shortage predictions.">
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #f7f9fc;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
}
|
||||||
|
.sidebar {
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 260px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-right: 1px solid #e9ecef;
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link {
|
||||||
|
color: #5a6474;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link.active, .sidebar .nav-link:hover {
|
||||||
|
color: #0057FF;
|
||||||
|
background-color: #f0f6ff;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link i {
|
||||||
|
margin-right: 0.75rem;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
.main-content {
|
||||||
|
margin-left: 260px;
|
||||||
|
padding: 2rem;
|
||||||
|
padding-top: 80px; /* Space for header */
|
||||||
|
}
|
||||||
|
.top-header {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 260px;
|
||||||
|
right: 0;
|
||||||
|
height: 64px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-bottom: 1px solid #e9ecef;
|
||||||
|
padding: 0 2rem;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.chart-wrapper {
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #e9ecef;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="sidebar">
|
||||||
|
<a class="navbar-brand mb-4" href="index.php">
|
||||||
|
<img src="assets/pasted-20251114-095035-cf5716ad.png" alt="Kotkakey Logo" height="40">
|
||||||
|
</a>
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="dashboard.php">
|
||||||
|
<i class="bi bi-grid-1x2-fill"></i> Dashboard
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="shortage-alerts.php">
|
||||||
|
<i class="bi bi-exclamation-triangle-fill"></i> Shortage Alerts
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="pooled-requests.php">
|
||||||
|
<i class="bi bi-box2-heart-fill"></i> Pooled Requests
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="predictions.php">
|
||||||
|
<i class="bi bi-graph-up-arrow"></i> Predictions
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item mt-auto">
|
||||||
|
<a class="nav-link" href="settings.php">
|
||||||
|
<i class="bi bi-gear-fill"></i> Settings
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<header class="top-header">
|
||||||
|
<div class="dropdown">
|
||||||
|
<a href="#" class="d-flex align-items-center link-dark text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="bi bi-person-circle fs-3 me-2"></i>
|
||||||
|
<span class="fw-semibold"><?php echo htmlspecialchars($user['name'] ?? 'User'); ?></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu text-small shadow">
|
||||||
|
<li><a class="dropdown-item" href="profile.php">Profile</a></li>
|
||||||
|
<li><a class="dropdown-item" href="settings.php">Settings</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main-content">
|
||||||
|
<h1 class="h2 mb-4 fw-bold">Shortage Predictions</h1>
|
||||||
|
|
||||||
|
<div class="chart-wrapper">
|
||||||
|
<canvas id="predictionsChart"></canvas>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.2/dist/chart.umd.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
const ctx = document.getElementById('predictionsChart').getContext('2d');
|
||||||
|
new Chart(ctx, {
|
||||||
|
type: 'bar',
|
||||||
|
data: {
|
||||||
|
labels: <?php echo json_encode($prediction_labels); ?>,
|
||||||
|
datasets: [{
|
||||||
|
label: 'Predicted Days to Shortage',
|
||||||
|
data: <?php echo json_encode($prediction_data); ?>,
|
||||||
|
backgroundColor: [
|
||||||
|
'rgba(231, 76, 60, 0.7)',
|
||||||
|
'rgba(243, 156, 18, 0.7)',
|
||||||
|
'rgba(46, 204, 113, 0.7)',
|
||||||
|
'rgba(52, 152, 219, 0.7)',
|
||||||
|
'rgba(155, 89, 182, 0.7)'
|
||||||
|
],
|
||||||
|
borderColor: [
|
||||||
|
'#e74c3c',
|
||||||
|
'#f39c12',
|
||||||
|
'#2ecc71',
|
||||||
|
'#3498db',
|
||||||
|
'#9b59b6'
|
||||||
|
],
|
||||||
|
borderWidth: 1
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
responsive: true,
|
||||||
|
plugins: {
|
||||||
|
legend: {
|
||||||
|
display: true,
|
||||||
|
position: 'top',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scales: {
|
||||||
|
y: {
|
||||||
|
beginAtZero: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
214
profile.php
Normal file
214
profile.php
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header("Location: login.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userId = $_SESSION['user_id'];
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Fetch user data
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
// Handle profile update
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$name = trim($_POST['name']);
|
||||||
|
$email = trim($_POST['email']);
|
||||||
|
$password = $_POST['password'];
|
||||||
|
|
||||||
|
// Basic validation
|
||||||
|
if (!empty($name) && !empty($email)) {
|
||||||
|
$sql = "UPDATE users SET name = ?, email = ? WHERE id = ?";
|
||||||
|
$params = [$name, $email, $userId];
|
||||||
|
|
||||||
|
if (!empty($password)) {
|
||||||
|
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
|
||||||
|
$sql = "UPDATE users SET name = ?, email = ?, password = ? WHERE id = ?";
|
||||||
|
$params = [$name, $email, $hashedPassword, $userId];
|
||||||
|
}
|
||||||
|
|
||||||
|
$updateStmt = $pdo->prepare($sql);
|
||||||
|
if ($updateStmt->execute($params)) {
|
||||||
|
// Refresh user data
|
||||||
|
header("Location: profile.php?success=1");
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$error = "Failed to update profile. Please try again.";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$error = "Name and Email are required.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Refetch user data after potential update
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>User Profile - Kotkakey</title>
|
||||||
|
<meta name="description" content="Manage your Kotkakey user profile.">
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #f7f9fc;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
}
|
||||||
|
.sidebar {
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 260px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-right: 1px solid #e9ecef;
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link {
|
||||||
|
color: #5a6474;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link.active, .sidebar .nav-link:hover {
|
||||||
|
color: #0057FF;
|
||||||
|
background-color: #f0f6ff;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link i {
|
||||||
|
margin-right: 0.75rem;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
.main-content {
|
||||||
|
margin-left: 260px;
|
||||||
|
padding: 2rem;
|
||||||
|
padding-top: 80px; /* Space for header */
|
||||||
|
}
|
||||||
|
.top-header {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 260px;
|
||||||
|
right: 0;
|
||||||
|
height: 64px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-bottom: 1px solid #e9ecef;
|
||||||
|
padding: 0 2rem;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.card-profile {
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #e9ecef;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="sidebar">
|
||||||
|
<a class="navbar-brand mb-4" href="index.php">
|
||||||
|
<img src="assets/pasted-20251114-095035-cf5716ad.png" alt="Kotkakey Logo" height="40">
|
||||||
|
</a>
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="dashboard.php">
|
||||||
|
<i class="bi bi-grid-1x2-fill"></i> Dashboard
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="shortage-alerts.php">
|
||||||
|
<i class="bi bi-exclamation-triangle-fill"></i> Shortage Alerts
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="pooled-requests.php">
|
||||||
|
<i class="bi bi-box2-heart-fill"></i> Pooled Requests
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="predictions.php">
|
||||||
|
<i class="bi bi-graph-up-arrow"></i> Predictions
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item mt-auto">
|
||||||
|
<a class="nav-link active" href="profile.php">
|
||||||
|
<i class="bi bi-person-circle"></i> Profile
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#">
|
||||||
|
<i class="bi bi-gear-fill"></i> Settings
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<header class="top-header">
|
||||||
|
<div class="dropdown">
|
||||||
|
<a href="#" class="d-flex align-items-center link-dark text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="bi bi-person-circle fs-3 me-2"></i>
|
||||||
|
<span class="fw-semibold"><?php echo htmlspecialchars($user['name'] ?? 'User'); ?></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu text-small shadow">
|
||||||
|
<li><a class="dropdown-item active" href="profile.php">Profile</a></li>
|
||||||
|
<li><a class="dropdown-item" href="#">Settings</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main-content">
|
||||||
|
<h1 class="h2 mb-4 fw-bold">User Profile</h1>
|
||||||
|
|
||||||
|
<?php if (isset($_GET['success'])): ?>
|
||||||
|
<div class="alert alert-success">Profile updated successfully!</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (isset($error)): ?>
|
||||||
|
<div class="alert alert-danger"><?php echo $error; ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="card-profile">
|
||||||
|
<form method="POST" action="profile.php">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Full Name</label>
|
||||||
|
<input type="text" class="form-control" id="name" name="name" value="<?php echo htmlspecialchars($user['name'] ?? ''); ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="email" class="form-label">Email Address</label>
|
||||||
|
<input type="email" class="form-control" id="email" name="email" value="<?php echo htmlspecialchars($user['email'] ?? ''); ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="password" class="form-label">New Password</label>
|
||||||
|
<input type="password" class="form-control" id="password" name="password">
|
||||||
|
<small class="form-text text-muted">Leave blank to keep your current password.</small>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Update Profile</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
186
settings.php
Normal file
186
settings.php
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header("Location: login.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userId = $_SESSION['user_id'];
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Fetch user data
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Settings - Kotkakey</title>
|
||||||
|
<meta name="description" content="Manage your account and notification settings.">
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #f7f9fc;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
}
|
||||||
|
.sidebar {
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 260px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-right: 1px solid #e9ecef;
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link {
|
||||||
|
color: #5a6474;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link.active, .sidebar .nav-link:hover {
|
||||||
|
color: #0057FF;
|
||||||
|
background-color: #f0f6ff;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link i {
|
||||||
|
margin-right: 0.75rem;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
.main-content {
|
||||||
|
margin-left: 260px;
|
||||||
|
padding: 2rem;
|
||||||
|
padding-top: 80px; /* Space for header */
|
||||||
|
}
|
||||||
|
.top-header {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 260px;
|
||||||
|
right: 0;
|
||||||
|
height: 64px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-bottom: 1px solid #e9ecef;
|
||||||
|
padding: 0 2rem;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
border: 1px solid #e9ecef;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="sidebar">
|
||||||
|
<a class="navbar-brand mb-4" href="index.php">
|
||||||
|
<img src="assets/pasted-20251114-095035-cf5716ad.png" alt="Kotkakey Logo" height="40">
|
||||||
|
</a>
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="dashboard.php">
|
||||||
|
<i class="bi bi-grid-1x2-fill"></i> Dashboard
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="shortage-alerts.php">
|
||||||
|
<i class="bi bi-exclamation-triangle-fill"></i> Shortage Alerts
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="pooled-requests.php">
|
||||||
|
<i class="bi bi-box2-heart-fill"></i> Pooled Requests
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="predictions.php">
|
||||||
|
<i class="bi bi-graph-up-arrow"></i> Predictions
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item mt-auto">
|
||||||
|
<a class="nav-link active" href="settings.php">
|
||||||
|
<i class="bi bi-gear-fill"></i> Settings
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<header class="top-header">
|
||||||
|
<div class="dropdown">
|
||||||
|
<a href="#" class="d-flex align-items-center link-dark text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="bi bi-person-circle fs-3 me-2"></i>
|
||||||
|
<span class="fw-semibold"><?php echo htmlspecialchars($user['name'] ?? 'User'); ?></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu text-small shadow">
|
||||||
|
<li><a class="dropdown-item" href="profile.php">Profile</a></li>
|
||||||
|
<li><a class="dropdown-item" href="settings.php">Settings</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main-content">
|
||||||
|
<h1 class="h2 mb-4 fw-bold">Settings</h1>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="card-title mb-0">Account Settings</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<p class="text-muted">Manage your account details.</p>
|
||||||
|
<!-- Placeholder for account settings form -->
|
||||||
|
<form>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Name</label>
|
||||||
|
<input type="text" class="form-control" id="name" value="<?php echo htmlspecialchars($user['name'] ?? ''); ?>">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="email" class="form-label">Email address</label>
|
||||||
|
<input type="email" class="form-control" id="email" value="<?php echo htmlspecialchars($user['email'] ?? ''); ?>" readonly>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Save Changes</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card mt-4">
|
||||||
|
<div class="card-header">
|
||||||
|
<h5 class="card-title mb-0">Notification Settings</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<p class="text-muted">Choose how you receive notifications.</p>
|
||||||
|
<!-- Placeholder for notification settings -->
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" type="checkbox" role="switch" id="emailNotifications" checked>
|
||||||
|
<label class="form-check-label" for="emailNotifications">Email Notifications</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-switch mt-2">
|
||||||
|
<input class="form-check-input" type="checkbox" role="switch" id="smsNotifications">
|
||||||
|
<label class="form-check-label" for="smsNotifications">SMS Notifications</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
229
shortage-alerts.php
Normal file
229
shortage-alerts.php
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header("Location: login.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userId = $_SESSION['user_id'];
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// Fetch user data
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
// Fetch shortage alerts
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM shortage_predictions WHERE user_id = ? ORDER BY days_to_shortage ASC");
|
||||||
|
$stmt->execute([$userId]);
|
||||||
|
$alerts = $stmt->fetchAll();
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Shortage Alerts - Kotkakey</title>
|
||||||
|
<meta name="description" content="View and manage medicine shortage alerts.">
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #f7f9fc;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
}
|
||||||
|
.sidebar {
|
||||||
|
height: 100vh;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 260px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-right: 1px solid #e9ecef;
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link {
|
||||||
|
color: #5a6474;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link.active, .sidebar .nav-link:hover {
|
||||||
|
color: #0057FF;
|
||||||
|
background-color: #f0f6ff;
|
||||||
|
}
|
||||||
|
.sidebar .nav-link i {
|
||||||
|
margin-right: 0.75rem;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
.main-content {
|
||||||
|
margin-left: 260px;
|
||||||
|
padding: 2rem;
|
||||||
|
padding-top: 80px; /* Space for header */
|
||||||
|
}
|
||||||
|
.top-header {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 260px;
|
||||||
|
right: 0;
|
||||||
|
height: 64px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-bottom: 1px solid #e9ecef;
|
||||||
|
padding: 0 2rem;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.table-wrapper {
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #e9ecef;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
.risk-high { color: #e74c3c; }
|
||||||
|
.risk-medium { color: #f39c12; }
|
||||||
|
.risk-low { color: #2ecc71; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="sidebar">
|
||||||
|
<a class="navbar-brand mb-4" href="index.php">
|
||||||
|
<img src="assets/pasted-20251114-095035-cf5716ad.png" alt="Kotkakey Logo" height="40">
|
||||||
|
</a>
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="dashboard.php">
|
||||||
|
<i class="bi bi-grid-1x2-fill"></i> Dashboard
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="shortage-alerts.php">
|
||||||
|
<i class="bi bi-exclamation-triangle-fill"></i> Shortage Alerts
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="pooled-requests.php">
|
||||||
|
<i class="bi bi-box2-heart-fill"></i> Pooled Requests
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="predictions.php">
|
||||||
|
<i class="bi bi-graph-up-arrow"></i> Predictions
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item mt-auto">
|
||||||
|
<a class="nav-link" href="settings.php">
|
||||||
|
<i class="bi bi-gear-fill"></i> Settings
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<header class="top-header">
|
||||||
|
<div class="dropdown">
|
||||||
|
<a href="#" class="d-flex align-items-center link-dark text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<i class="bi bi-person-circle fs-3 me-2"></i>
|
||||||
|
<span class="fw-semibold"><?php echo htmlspecialchars($user['name'] ?? 'User'); ?></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu text-small shadow">
|
||||||
|
<li><a class="dropdown-item" href="profile.php">Profile</a></li>
|
||||||
|
<li><a class="dropdown-item" href="settings.php">Settings</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main-content">
|
||||||
|
<h1 class="h2 mb-4 fw-bold">Shortage Alerts</h1>
|
||||||
|
|
||||||
|
<div class="table-wrapper">
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
|
<h4 class="fw-semibold mb-0">All Alerts</h4>
|
||||||
|
<div class="input-group" style="width: 300px;">
|
||||||
|
<input type="text" id="searchInput" class="form-control" placeholder="Search alerts...">
|
||||||
|
<span class="input-group-text"><i class="bi bi-search"></i></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table class="table table-hover align-middle" id="alertsTable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Medicine</th>
|
||||||
|
<th scope="col">Days to Shortage</th>
|
||||||
|
<th scope="col">Risk Level</th>
|
||||||
|
<th scope="col">Last Updated</th>
|
||||||
|
<th scope="col">Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($alerts as $alert): ?>
|
||||||
|
<tr>
|
||||||
|
<td><strong><?php echo htmlspecialchars($alert['medicine_name']); ?></strong></td>
|
||||||
|
<td><?php echo htmlspecialchars($alert['days_to_shortage']); ?></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
$risk = 'Low';
|
||||||
|
$risk_class = 'risk-low';
|
||||||
|
if ($alert['days_to_shortage'] < 20) {
|
||||||
|
$risk = 'High';
|
||||||
|
$risk_class = 'risk-high';
|
||||||
|
} elseif ($alert['days_to_shortage'] < 40) {
|
||||||
|
$risk = 'Medium';
|
||||||
|
$risk_class = 'risk-medium';
|
||||||
|
}
|
||||||
|
echo "<span class='$risk_class'>$risk</span>";
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td><?php echo date("Y-m-d H:i", strtotime($alert['updated_at'])); ?></td>
|
||||||
|
<td>
|
||||||
|
<a href="#" class="btn btn-sm btn-outline-primary">View Details</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
const searchInput = document.getElementById('searchInput');
|
||||||
|
const table = document.getElementById('alertsTable');
|
||||||
|
const rows = table.getElementsByTagName('tr');
|
||||||
|
|
||||||
|
searchInput.addEventListener('keyup', function () {
|
||||||
|
const filter = searchInput.value.toLowerCase();
|
||||||
|
for (let i = 1; i < rows.length; i++) {
|
||||||
|
let cells = rows[i].getElementsByTagName('td');
|
||||||
|
let found = false;
|
||||||
|
for (let j = 0; j < cells.length; j++) {
|
||||||
|
if (cells[j] && cells[j].innerText.toLowerCase().indexOf(filter) > -1) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
|
rows[i].style.display = "";
|
||||||
|
} else {
|
||||||
|
rows[i].style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
27
signup-thank-you.php
Normal file
27
signup-thank-you.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
$pageTitle = "Thank You - Kotkakey";
|
||||||
|
$pageDescription = "Thank you for your interest in the Kotkakey pilot program.";
|
||||||
|
|
||||||
|
// Include header
|
||||||
|
include __DIR__ . '/index.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<main class="container mt-5 pt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<div class="card shadow-sm text-center" style="border-radius: 0.5rem; border: 0;">
|
||||||
|
<div class="card-body p-5">
|
||||||
|
<h1 class="display-5">Thank You!</h1>
|
||||||
|
<p class="lead">Your application to join the pilot program has been received.</p>
|
||||||
|
<p>We appreciate your interest in helping us solve medicine shortages. Our team will review your information and contact you shortly with the next steps.</p>
|
||||||
|
<hr class="my-4">
|
||||||
|
<a href="/" class="btn btn-primary" style="background-color: #0057FF; border: none;">Return to Homepage</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Include footer (handled by including index.php)
|
||||||
|
?>
|
||||||
187
signup.php
Normal file
187
signup.php
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
<?php
|
||||||
|
$pageTitle = "Pilot Signup - Kotkakey";
|
||||||
|
$pageDescription = "Join the Kotkakey pilot program to help solve medicine shortages in Finland.";
|
||||||
|
|
||||||
|
$errors = [];
|
||||||
|
$inputs = [];
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
// Sanitize and validate inputs
|
||||||
|
$organization = filter_input(INPUT_POST, 'organization', FILTER_SANITIZE_STRING);
|
||||||
|
$role = filter_input(INPUT_POST, 'role', FILTER_SANITIZE_STRING);
|
||||||
|
$contact_person = filter_input(INPUT_POST, 'contact_person', FILTER_SANITIZE_STRING);
|
||||||
|
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
|
||||||
|
$phone = filter_input(INPUT_POST, 'phone', FILTER_SANITIZE_STRING);
|
||||||
|
$address = filter_input(INPUT_POST, 'address', FILTER_SANITIZE_STRING);
|
||||||
|
$patients_served = filter_input(INPUT_POST, 'patients_served', FILTER_SANITIZE_NUMBER_INT);
|
||||||
|
$challenges = filter_input(INPUT_POST, 'challenges', FILTER_SANITIZE_STRING);
|
||||||
|
$consent = filter_input(INPUT_POST, 'consent', FILTER_VALIDATE_BOOLEAN);
|
||||||
|
|
||||||
|
$inputs = compact('organization', 'role', 'contact_person', 'email', 'phone', 'address', 'patients_served', 'challenges', 'consent');
|
||||||
|
|
||||||
|
// Basic validation
|
||||||
|
if (empty($organization)) {
|
||||||
|
$errors['organization'] = 'Organization name is required.';
|
||||||
|
}
|
||||||
|
if (empty($role)) {
|
||||||
|
$errors['role'] = 'Please select a role.';
|
||||||
|
}
|
||||||
|
if (empty($contact_person)) {
|
||||||
|
$errors['contact_person'] = 'Contact person is required.';
|
||||||
|
}
|
||||||
|
if (!$email) {
|
||||||
|
$errors['email'] = 'A valid email is required.';
|
||||||
|
}
|
||||||
|
if (empty($phone)) {
|
||||||
|
$errors['phone'] = 'Phone number is required.';
|
||||||
|
}
|
||||||
|
if (!$consent) {
|
||||||
|
$errors['consent'] = 'You must agree to the terms.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
require_once __DIR__ . '/mail/MailService.php';
|
||||||
|
|
||||||
|
$to = 'info@kotkakey.com';
|
||||||
|
$subject = 'New Pilot Signup: ' . htmlspecialchars($organization);
|
||||||
|
|
||||||
|
$html_content = "<h2>New Pilot Program Signup</h2>";
|
||||||
|
$html_content .= "<ul>";
|
||||||
|
$html_content .= "<li><strong>Organization:</strong> " . htmlspecialchars($organization) . "</li>";
|
||||||
|
$html_content .= "<li><strong>Role:</strong> " . htmlspecialchars($role) . "</li>";
|
||||||
|
$html_content .= "<li><strong>Contact Person:</strong> " . htmlspecialchars($contact_person) . "</li>";
|
||||||
|
$html_content .= "<li><strong>Email:</strong> " . htmlspecialchars($email) . "</li>";
|
||||||
|
$html_content .= "<li><strong>Phone:</strong> " . htmlspecialchars($phone) . "</li>";
|
||||||
|
$html_content .= "<li><strong>Address / Region:</strong> " . htmlspecialchars($address) . "</li>";
|
||||||
|
$html_content .= "<li><strong>Patients Served:</strong> " . htmlspecialchars($patients_served) . "</li>";
|
||||||
|
$html_content .= "<li><strong>Main Challenges:</strong><br>" . nl2br(htmlspecialchars($challenges)) . "</li>";
|
||||||
|
$html_content .= "</ul>";
|
||||||
|
|
||||||
|
$text_content = "New Pilot Program Signup
|
||||||
|
|
||||||
|
";
|
||||||
|
$text_content .= "Organization: " . $organization . "
|
||||||
|
";
|
||||||
|
$text_content .= "Role: " . $role . "
|
||||||
|
";
|
||||||
|
$text_content .= "Contact Person: " . $contact_person . "
|
||||||
|
";
|
||||||
|
$text_content .= "Email: " . $email . "
|
||||||
|
";
|
||||||
|
$text_content .= "Phone: " . $phone . "
|
||||||
|
";
|
||||||
|
$text_content .= "Address / Region: " . $address . "
|
||||||
|
";
|
||||||
|
$text_content .= "Patients Served: " . $patients_served . "
|
||||||
|
";
|
||||||
|
$text_content .= "Main Challenges:
|
||||||
|
" . $challenges . "
|
||||||
|
";
|
||||||
|
|
||||||
|
// Use the generic sendMail function
|
||||||
|
$result = MailService::sendMail($to, $subject, $html_content, $text_content, ['reply_to' => $email]);
|
||||||
|
|
||||||
|
if (!empty($result['success'])) {
|
||||||
|
header('Location: signup-thank-you.php');
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
// Log error, maybe set a generic error message for the user
|
||||||
|
error_log('MailService Error: ' . ($result['error'] ?? 'Unknown error'));
|
||||||
|
$errors['submit'] = 'Sorry, there was a problem sending your application. Please try again later.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Include header
|
||||||
|
include __DIR__ . '/index.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<main class="container mt-5 pt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<div class="card shadow-sm" style="border-radius: 0.5rem; border: 0;">
|
||||||
|
<div class="card-body p-5">
|
||||||
|
<h1 class="display-5 text-center mb-4">Join the Pilot Program</h1>
|
||||||
|
<p class="text-center text-muted mb-5">Become a part of the solution to medicine shortages. Fill out the form below to apply for the Kotkakey pilot program.</p>
|
||||||
|
|
||||||
|
<?php if (!empty($errors['submit'])): ?>
|
||||||
|
<div class="alert alert-danger"><?php echo htmlspecialchars($errors['submit']); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<form action="signup.php" method="POST" novalidate>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="organization" class="form-label">Organization / Pharmacy Name</label>
|
||||||
|
<input type="text" class="form-control <?php echo isset($errors['organization']) ? 'is-invalid' : ''; ?>" id="organization" name="organization" value="<?php echo htmlspecialchars($inputs['organization'] ?? ''); ?>" required>
|
||||||
|
<div class="invalid-feedback"><?php echo htmlspecialchars($errors['organization'] ?? ''); ?></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="role" class="form-label">Role</label>
|
||||||
|
<select class="form-select <?php echo isset($errors['role']) ? 'is-invalid' : ''; ?>" id="role" name="role" required>
|
||||||
|
<option value="">Select your role...</option>
|
||||||
|
<option value="Farmaseutti" <?php echo ($inputs['role'] ?? '') === 'Farmaseutti' ? 'selected' : ''; ?>>Farmaseutti</option>
|
||||||
|
<option value="Proviisori" <?php echo ($inputs['role'] ?? '') === 'Proviisori' ? 'selected' : ''; ?>>Proviisori</option>
|
||||||
|
<option value="Pharmacy Owner" <?php echo ($inputs['role'] ?? '') === 'Pharmacy Owner' ? 'selected' : ''; ?>>Pharmacy Owner</option>
|
||||||
|
<option value="Chain Lead" <?php echo ($inputs['role'] ?? '') === 'Chain Lead' ? 'selected' : ''; ?>>Chain Lead</option>
|
||||||
|
<option value="Other" <?php echo ($inputs['role'] ?? '') === 'Other' ? 'selected' : ''; ?>>Other</option>
|
||||||
|
</select>
|
||||||
|
<div class="invalid-feedback"><?php echo htmlspecialchars($errors['role'] ?? ''); ?></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="contact_person" class="form-label">Contact Person</label>
|
||||||
|
<input type="text" class="form-control <?php echo isset($errors['contact_person']) ? 'is-invalid' : ''; ?>" id="contact_person" name="contact_person" value="<?php echo htmlspecialchars($inputs['contact_person'] ?? ''); ?>" required>
|
||||||
|
<div class="invalid-feedback"><?php echo htmlspecialchars($errors['contact_person'] ?? ''); ?></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="email" class="form-label">Email</label>
|
||||||
|
<input type="email" class="form-control <?php echo isset($errors['email']) ? 'is-invalid' : ''; ?>" id="email" name="email" value="<?php echo htmlspecialchars($inputs['email'] ?? ''); ?>" required>
|
||||||
|
<div class="invalid-feedback"><?php echo htmlspecialchars($errors['email'] ?? ''); ?></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="phone" class="form-label">Phone</label>
|
||||||
|
<input type="tel" class="form-control <?php echo isset($errors['phone']) ? 'is-invalid' : ''; ?>" id="phone" name="phone" value="<?php echo htmlspecialchars($inputs['phone'] ?? ''); ?>" required>
|
||||||
|
<div class="invalid-feedback"><?php echo htmlspecialchars($errors['phone'] ?? ''); ?></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="address" class="form-label">Address / Region</label>
|
||||||
|
<input type="text" class="form-control" id="address" name="address" value="<?php echo htmlspecialchars($inputs['address'] ?? ''); ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="patients_served" class="form-label">Number of Patients Served / Pharmacy Size</label>
|
||||||
|
<input type="number" class="form-control" id="patients_served" name="patients_served" value="<?php echo htmlspecialchars($inputs['patients_served'] ?? ''); ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="challenges" class="form-label">Main Shortage Challenges (Optional)</label>
|
||||||
|
<textarea class="form-control" id="challenges" name="challenges" rows="4"><?php echo htmlspecialchars($inputs['challenges'] ?? ''); ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-check mb-4">
|
||||||
|
<input class="form-check-input <?php echo isset($errors['consent']) ? 'is-invalid' : ''; ?>" type="checkbox" value="1" id="consent" name="consent" required>
|
||||||
|
<label class="form-check-label" for="consent">
|
||||||
|
I agree to the processing of my data as described in the Privacy Policy and consent to be contacted about the pilot program.
|
||||||
|
</label>
|
||||||
|
<div class="invalid-feedback"><?php echo htmlspecialchars($errors['consent'] ?? ''); ?></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-grid">
|
||||||
|
<button type="submit" class="btn btn-primary btn-lg" style="background-color: #0057FF; border: none;">Submit Application</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Include footer
|
||||||
|
// We are including index.php which contains the full page layout.
|
||||||
|
// To prevent re-rendering the whole page, we can't include a separate footer.
|
||||||
|
// This is a temporary workaround. A better solution would be to have separate header/footer files.
|
||||||
|
?>
|
||||||
52
thank-you.php
Normal file
52
thank-you.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Thank You - Kotkakey</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<header class="bg-white shadow-sm">
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="index.php">
|
||||||
|
<img src="assets/pasted-20251114-095035-cf5716ad.png" alt="Kotkakey Logo" height="40">
|
||||||
|
</a>
|
||||||
|
<div class="ms-auto">
|
||||||
|
<span class="navbar-text me-3">EN / FI</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<section class="section text-center">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<div class="card p-4 p-md-5">
|
||||||
|
<h1 class="display-4">Thank You!</h1>
|
||||||
|
<p class="lead">Your message has been sent successfully. We will get back to you as soon as possible.</p>
|
||||||
|
<a href="index.php" class="btn btn-primary mt-3">Return to Homepage</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="py-4 bg-dark text-white mt-auto">
|
||||||
|
<div class="container text-center">
|
||||||
|
<p>Email: <a href="mailto:info@kotkakey.com" class="text-white">info@kotkakey.com</a> | <a href="https://www.linkedin.com/company/kotkakey" class="text-white">LinkedIn</a></p>
|
||||||
|
<p><a href="#" class="text-white">Privacy Policy</a> | GDPR Compliant</p>
|
||||||
|
<small>© <?php echo date("Y"); ?> Kotkakey. All Rights Reserved.</small>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user