<?php
require_once 'auth.php';
require 'system_log_helper.php';

require_login();
$user = current_user();

// sayfa görüntüleme logu
system_log('page_view', 'jobs.php?'.($_SERVER['QUERY_STRING'] ?? ''));

$job_id   = $_GET['id'] ?? null;
$password = $_GET['password'] ?? null;

if (!$job_id || !$password) {
    die("Eksik bilgi.");
}
?>
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <title>İş Oluşturuldu</title>
    <link rel="stylesheet" href="style.css">

    <style>
        /* Bu kısım sadece bu sayfa için küçük ek tasarım */
        .created-wrapper {
            max-width: 520px;
            margin: 40px auto;
        }

        .created-card {
            background: #ffffff;
            border-radius: 12px;
            padding: 28px 26px 24px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.10);
            text-align: center;
            position: relative;
            overflow: hidden;
        }

        .created-card::before {
            content: "";
            position: absolute;
            top: -80px;
            right: -80px;
            width: 180px;
            height: 180px;
            background: linear-gradient(135deg, #007bff, #00bcd4);
            opacity: 0.15;
            border-radius: 50%;
        }

        .created-icon {
            width: 70px;
            height: 70px;
            border-radius: 50%;
            margin: 0 auto 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #e6f7ec;
            color: #28a745;
            font-size: 38px;
        }

        .created-title {
            font-size: 22px;
            margin-bottom: 6px;
        }

        .created-subtitle {
            font-size: 14px;
            color: #666;
            margin-bottom: 20px;
        }

        .created-row {
            display: flex;
            justify-content: space-between;
            margin: 4px 0;
            font-size: 15px;
        }

        .created-row span:first-child {
            color: #777;
        }

        .created-password-box {
            margin: 18px 0 12px;
            padding: 14px 16px;
            border-radius: 10px;
            background: #fff7e6;
            border: 1px solid #ffe0b3;
            text-align: left;
        }

        .created-password-label {
            font-size: 13px;
            color: #b26a00;
            text-transform: uppercase;
            letter-spacing: .04em;
        }

        .created-password-value {
            font-size: 26px;
            font-weight: 700;
            color: #ff8c00;
            margin-top: 4px;
        }

        .created-warning {
            font-size: 13px;
            color: #b52b27;
            display: flex;
            align-items: flex-start;
            gap: 6px;
            margin-top: 8px;
        }

        .created-warning-icon {
            font-size: 16px;
            margin-top: 1px;
        }

        .created-actions {
            margin-top: 22px;
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            justify-content: center;
        }

        .btn-primary {
            background: #007bff;
            color: #fff !important;
            border-radius: 999px;
            padding: 8px 18px;
            border: none;
            cursor: pointer;
            text-decoration: none;
            font-size: 14px;
        }

        .btn-secondary {
            background: #f1f1f1;
            color: #333 !important;
            border-radius: 999px;
            padding: 8px 18px;
            border: none;
            cursor: pointer;
            text-decoration: none;
            font-size: 14px;
        }

        .btn-primary:hover {
            background: #0064d1;
        }

        .btn-secondary:hover {
            background: #e1e1e1;
        }

        @media (max-width: 600px) {
            .created-wrapper {
                margin: 20px 10px;
            }
            .created-card {
                padding: 22px 18px 20px;
            }
        }
    </style>
</head>
<body>

<div class="created-wrapper">
    <div class="created-card">

        <div class="created-icon">
            ✓
        </div>

        <h1 class="created-title">İş Başarıyla Oluşturuldu</h1>
        <p class="created-subtitle">
            İş kaydınız sisteme eklendi. Aşağıdaki iş parolasını teknisyene iletmeyi unutmayın.
        </p>

        <div class="created-row">
            <span>İş Numarası</span>
            <span><strong>#<?php echo htmlspecialchars($job_id); ?></strong></span>
        </div>

        <div class="created-password-box">
            <div class="created-password-label">İş Parolası</div>
            <div class="created-password-value">
                <?php echo htmlspecialchars($password); ?>
            </div>
            <div class="created-warning">
                <span class="created-warning-icon">⚠️</span>
                <span>
                    Bu parolayı teknisyene verene kadar kaybetmeyin. Teknisyen iş detaylarını görmeden önce bu parolayı girmek zorundadır.
                </span>
            </div>
        </div>

        <div class="created-actions">
            <a class="btn-primary" href="job_edit.php?id=<?php echo $job_id; ?>">İşi Aç</a>
            <a class="btn-secondary" href="jobs.php">İş Listesine Dön</a>
        </div>

    </div>
</div>

</body>
</html>
