<?php
require_once '../config/config.php';
require_once '../includes/auth.php';

requireCompanyLogin();
ensureFeatureAndPaymentTables();

$companyId = (int)($_SESSION['company_id'] ?? 0);

// Settings
$stmt = $pdo->query("SELECT setting_key, setting_value FROM settings WHERE setting_key IN (
    'gold_price','featured_service_price',
    'payment_bank_name','payment_account_name','payment_iban','payment_branch','payment_note'
)");
$s = [];
while ($row = $stmt->fetch()) {
    $s[$row['setting_key']] = $row['setting_value'];
}
$goldPrice = $s['gold_price'] ?? '';
$featuredPrice = $s['featured_service_price'] ?? '200';

$page_title = 'Ücretli Alınabilecek Hizmetler';
include 'includes/header.php';
?>

<div class="row">
    <div class="col-md-8">
        <div class="card mb-4">
            <div class="card-header">
                <h5 class="mb-0">Ücretli Alınabilecek Hizmetler</h5>
            </div>
            <div class="card-body">
                <div class="alert alert-info">
                    <i class="fas fa-info-circle me-2"></i>
                    Ödemeyi yaptıktan sonra lütfen <strong>Ödeme Bildirimi</strong> gönderin. Admin onayından sonra işlemler aktif edilir.
                </div>

                <div class="row g-3">
                    <div class="col-md-6">
                        <div class="border rounded p-3 h-100">
                            <h6 class="mb-2"><i class="fas fa-crown me-2 text-warning"></i>Gold Paket</h6>
                            <div class="text-muted small mb-2">WhatsApp, hızlı arama, sosyal medya linkleri</div>
                            <div class="h5 mb-3"><?= $goldPrice !== '' ? e($goldPrice) . ' TL' : 'Fiyat ayarlanmamış' ?></div>
                            <a class="btn btn-outline-primary btn-sm" href="<?= SITE_URL ?>/company/payment-notice.php?type=gold">
                                Ödeme Bildirimi Yap
                            </a>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="border rounded p-3 h-100">
                            <h6 class="mb-2"><i class="fas fa-bullhorn me-2"></i>İlanı Ana Sayfada Göster</h6>
                            <div class="text-muted small mb-2">Onaylandıktan sonra 15 gün yayında kalır</div>
                            <div class="h5 mb-3"><?= e($featuredPrice) ?> TL / 15 gün</div>
                            <a class="btn btn-outline-primary btn-sm" href="<?= SITE_URL ?>/company/payment-notice.php?type=featured_service">
                                Ödeme Bildirimi Yap
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="card">
            <div class="card-header">
                <h5 class="mb-0">Kısa Yollar</h5>
            </div>
            <div class="card-body">
                <a href="<?= SITE_URL ?>/company/services/index.php" class="btn btn-primary w-100 mb-2">
                    Hizmetlerim
                </a>
                <a href="<?= SITE_URL ?>/company/payment-notice.php" class="btn btn-outline-secondary w-100">
                    Ödeme Bildirimi
                </a>
            </div>
        </div>

        <div class="card mt-3">
            <div class="card-header">
                <h5 class="mb-0">Ücretli hizmetler için banka bilgileri</h5>
            </div>
            <div class="card-body small">
                <div><strong>Banka:</strong> <?= e($s['payment_bank_name'] ?? '-') ?></div>
                <div><strong>Hesap Sahibi:</strong> <?= e($s['payment_account_name'] ?? '-') ?></div>
                <div><strong>IBAN:</strong> <?= e($s['payment_iban'] ?? '-') ?></div>
                <div><strong>Şube/Hesap:</strong> <?= e($s['payment_branch'] ?? '-') ?></div>
                <?php if (!empty($s['payment_note'])): ?>
                    <div class="mt-2"><strong>Not:</strong> <?= e($s['payment_note']) ?></div>
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>

<?php include 'includes/footer.php'; ?>


