<!DOCTYPE html>
<html lang="nl">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Work+Sans:wght@600;700;800&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="/css/jobkanon-licht.css">
  <meta name="description" content="Vacature plaatsen via Jobkanon. Direct live na betaling.">
  <title>Jobkanon — Vacature plaatsen</title>
</head>

<body>

<style>
.jk-nav {
  background: #1061c0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.jk-logo {
  font-family: 'Work Sans', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.5px;
}
.jk-logo span { color: #da5515; }

.jk-rechts {
  display: flex;
  align-items: center;
  gap: 12px;
}
.jk-chip {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  background: rgba(232,119,34,0.15);
  color: #da5515;
  border: 1px solid rgba(232,119,34,0.3);
  border-radius: 20px;
  padding: 4px 12px;
  white-space: nowrap;
}
.jk-dropdown { position: relative; }
.jk-dropdown-knop {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  padding: 6px 12px;
  cursor: pointer;
  transition: all .15s;
}
.jk-dropdown-knop:hover { background: rgba(255,255,255,0.1); color: #fff; }
.jk-dropdown-menu {
  display: none;
  position: absolute;
  top: 44px;
  right: 0;
  background: #1a1a1a;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200;
  overflow: hidden;
}
.jk-dropdown-menu.open { display: block; }
.jk-dropdown-menu a {
  display: block;
  padding: 10px 16px;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  transition: background .15s;
}
.jk-dropdown-menu a:hover { background: rgba(255,255,255,0.07); color: #fff; }
.jk-dropdown-menu .menu-scheiding {
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 4px 0;
}
</style>

<nav class="jk-nav">
  <a href="/" class="jk-logo">Job<span>kanon</span></a>
  <div class="jk-rechts">
    <span class="jk-chip">Vacature ecosysteem</span>
    <div class="jk-dropdown">
      <button class="jk-dropdown-knop" onclick="toggleJkDropdown(event)">info ▾</button>
      <div class="jk-dropdown-menu" id="jk-dropdown-menu">
        <a href="/kassa.php">Vacature plaatsen</a>
        <a href="/gids.php">Vacature gids</a>
        <div class="menu-scheiding"></div>
        <a href="/over.php">Over Jobkanon</a>
        <a href="/over.php#contact">Contact</a>
        <div class="menu-scheiding"></div>
        <a href="/algemene-voorwaarden.php">Algemene voorwaarden</a>
        <a href="/privacybeleid.php">Privacybeleid</a>
        <a href="/cookies.php">Cookiebeleid</a>
      </div>
    </div>
  </div>
</nav>

<script>
function toggleJkDropdown(e) {
  e.stopPropagation()
  document.getElementById('jk-dropdown-menu').classList.toggle('open')
}
document.addEventListener('click', () => {
  document.getElementById('jk-dropdown-menu')?.classList.remove('open')
})
</script>

<div class="wrap">
<span class="over-label">vacature plaatsen</span>
  <h1>Vacature plaatsen</h1>
  <p class="sub" style="font-weight:400;">Kies een platform, vul uw e-mailadres in en betaal. Direct live na betaling.<br>
  <a href="/gids.php" style="color:#da5515;font-size:13px;font-weight:500;text-decoration:none;">Weet u niet welk platform? → Raadpleeg de vacaturegids</a><br>
  <a href="/meer-vacatures.php" style="color:#da5515;font-size:13px;font-weight:500;text-decoration:none;">Vaker vacatures plaatsen? → Bekijk onze voordeelbundels</a></p>

  <div class="form-kaart">

    <!-- Platform dropdown -->
    <div class="veld">
      <label>Platform *</label>
      <select id="jk-niche" onchange="wisselNiche()">
        <option value="">— kies een platform —</option>
        <option value="horecavac"      data-naam="Horecavac.nl">Horecavac.nl — horeca breed</option>
        <option value="kokslive"       data-naam="Koks.live">Koks.live — keuken &amp; brigade</option>
        <option value="frontofficejobs" data-naam="FrontOfficeJobs.nl">FrontOfficeJobs.nl — receptie &amp; hospitality</option>
        <option value="vacaturelive"   data-naam="Vacaturelive.nl">Vacaturelive.nl — breed bereik</option>
        <option value="banen"          data-naam="Banen.in">Banen.in — per provincie &amp; stad</option>
        <option value="vacaturemeisje" data-naam="Vacaturemeisje.nl">Vacaturemeisje.nl — link naar uw vacaturepagina</option>
      </select>
    </div>

    <!-- +€10 Vacaturelive toggle -->
    <div class="toggle-rij" id="toggle-rij">
      <div class="toggle-tekst">
        <div class="toggle-titel">✅ Publiceer ook op Vacaturelive.nl</div>
        <div class="toggle-sub">Extra bereik — het verzamelplatform van het ecosysteem</div>
      </div>
      <span class="toggle-prijs">+ €10</span>
      <label class="switch">
        <input type="checkbox" id="jk-extra" onchange="berekenPrijs()">
        <span class="slider"></span>
      </label>
    </div>

    <!-- Prijs display -->
    <div class="prijs-rij" id="prijs-rij">
      <div>
        <div class="prijs-totaal" id="prijs-totaal">€35</div>
        <div class="prijs-detail" id="prijs-detail">2 weken online</div>
      </div>
      <div style="font-size:12px;color:#888;text-align:right;">
        iDEAL of creditcard<br>geen account nodig
      </div>
    </div>

    <!-- Email -->
    <div class="veld">
      <label>E-mailadres *</label>
      <input type="email" id="jk-email" placeholder="uw@bedrijf.nl" />
      <span class="fout-tekst" id="jk-fout"></span>
    </div>

    <!-- Button -->
    <div>
      <button class="btn-betalen" id="jk-knop" onclick="naarBetalen()" disabled>
        Kies eerst een platform
      </button>
      <p class="btn-sub" id="knop-sub">U vult eerst uw vacature in — betalen komt daarna. Alle bedragen excl. BTW.</p>
    </div>

  </div>
</div>

<footer>
  <span>&copy; 2026 ZK Online Jobmarketing · KVK 96664940</span>
  <span>
    <a href="https://horecavac.nl">horecavac.nl</a> &middot;
    <a href="https://koks.live">koks.live</a> &middot;
    <a href="https://frontofficejobs.nl">frontofficejobs.nl</a> &middot;
    <a href="https://vacaturelive.nl">vacaturelive.nl</a> &middot;
    <a href="https://banen.in">banen.in</a> &middot;
    <a href="https://vacaturemeisje.nl">vacaturemeisje.nl</a>
  </span>
</footer>

<script>
let geselecteerdeNiche = null

window.addEventListener('DOMContentLoaded', () => {
  const params     = new URLSearchParams(window.location.search)
  const niche      = params.get('niche')
  const vacatureId = params.get('vacature_id')
  const email      = params.get('email')

  if (niche) {
    const sel = document.getElementById('jk-niche')
    sel.value = niche
    wisselNiche()
  }
  if (email) document.getElementById('jk-email').value = decodeURIComponent(email)
  if (vacatureId) {
    window._vacature_id = vacatureId
    // Knoptekst aanpassen na wisselNiche
    setTimeout(() => {
      const knop = document.getElementById('jk-knop')
      if (!knop.disabled) knop.textContent = 'Afrekenen →'
    }, 50)
  }
})

function wisselNiche() {
  const sel   = document.getElementById('jk-niche')
  const niche = sel.value
  const knop  = document.getElementById('jk-knop')
  const opt   = sel.selectedOptions[0]

  geselecteerdeNiche = niche || null

  if (!niche) {
    knop.disabled = true
    knop.textContent = 'Kies eerst een platform'
    document.getElementById('prijs-rij').classList.remove('zichtbaar')
    document.getElementById('toggle-rij').classList.remove('zichtbaar')
    return
  }

  // Toon toggle alleen als het NIET vacaturelive zelf is en NIET vacaturemeisje
  const toonToggle = niche !== 'vacaturelive' && niche !== 'vacaturemeisje'
  document.getElementById('toggle-rij').classList.toggle('zichtbaar', toonToggle)
  if (!toonToggle) document.getElementById('jk-extra').checked = false

  document.getElementById('prijs-rij').classList.add('zichtbaar')

  berekenPrijs()
  knop.disabled = false
}

function berekenPrijs() {
  const niche     = geselecteerdeNiche
  const extraAan  = document.getElementById('jk-extra').checked
  const sel       = document.getElementById('jk-niche')
  const naam      = sel.selectedOptions[0]?.dataset?.naam || ''

  let basis   = 35
  let extra   = 0
  let detail  = '2 weken op ' + naam + ' · excl. BTW'
  let inclTxt = '2 weken online op ' + naam

  if (niche === 'vacaturemeisje') {
    basis  = 35
    detail = '3 maanden directe link naar uw vacaturepagina · excl. BTW'
    inclTxt = '3 maanden zichtbaar op Vacaturemeisje.nl'
    document.getElementById('jk-extra').checked = false
  }

  if (extraAan && niche !== 'vacaturelive' && niche !== 'vacaturemeisje') {
    extra   = 10
    inclTxt = '2 weken op ' + naam + ' én Vacaturelive.nl'
    detail  = '2 weken op ' + naam + ' én Vacaturelive.nl · excl. BTW'
  }

  const totaal = basis + extra
  document.getElementById('prijs-totaal').textContent = '€' + totaal
  document.getElementById('prijs-detail').textContent = detail

  const knop = document.getElementById('jk-knop')
  knop.textContent = window._vacature_id
    ? 'Afrekenen →'
    : 'Vacaturegegevens invullen op ' + naam + ' →'
}

const nichePlaatsenUrl = {
  horecavac:       'https://horecavac.nl/plaatsen.php',
  kokslive:        'https://kokslive.nl/plaatsen.php',
  frontofficejobs: 'https://frontofficejobs.nl/plaatsen.php',
  vacaturelive:    'https://vacaturelive.nl/plaatsen.php',
  banen:           'https://banen.in/plaatsen.php',
  vacaturemeisje:  'https://vacaturemeisje.nl/plaatsen.php',
}

function naarBetalen() {
  if (!geselecteerdeNiche) return

  const email = document.getElementById('jk-email').value.trim()
  const fout  = document.getElementById('jk-fout')
  fout.style.display = 'none'

  if (!email) {
    fout.textContent = 'Vul uw e-mailadres in.'
    fout.style.display = 'block'
    document.getElementById('jk-email').focus()
    return
  }
  if (!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email)) {
    fout.textContent = 'Vul een geldig e-mailadres in.'
    fout.style.display = 'block'
    return
  }

  const extra = document.getElementById('jk-extra').checked

  // Als vacature al ingevuld — direct naar Stripe
  if (window._vacature_id) {
    const knop = document.getElementById('jk-knop')
    knop.disabled = true
    knop.textContent = 'bezig...'
    fetch('/jobkanon-checkout.php', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        niche:              geselecteerdeNiche,
        email,
        vacature_id:        window._vacature_id,
        extra_vacaturelive: extra,
      })
    })
    .then(r => r.json())
    .then(data => {
      if (data.url) window.location.href = data.url
      else { knop.textContent = 'Er ging iets mis — probeer opnieuw'; knop.disabled = false }
    })
    .catch(() => { knop.textContent = 'Er ging iets mis — probeer opnieuw'; knop.disabled = false })
    return
  }

  // Geen vacature_id — naar plaatsen.php
  const basis = nichePlaatsenUrl[geselecteerdeNiche]
  if (!basis) {
    document.getElementById('jk-fout').textContent = 'Onbekend platform.'
    document.getElementById('jk-fout').style.display = 'block'
    return
  }

  const params = new URLSearchParams({
    email:  email,
    extra:  extra ? '1' : '0',
  })

  window.location.href = basis + '?' + params.toString()
}
</script>

</body>
</html>