<!DOCTYPE html>
<html lang="nl">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title><%= client ? 'Bewerk' : 'Nieuwe' %> Cliënt — Mek-Tech Consulting</title>
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="/css/style.css">
  <link rel="stylesheet" href="/css/dynamic.css">
  <link rel="icon" href="/img/favicon.svg" type="image/svg+xml">
</head>
<body>
  <nav class="navbar"><div class="nav-inner"><a href="/" class="nav-brand"><img src="/img/logo.svg" class="nav-logo" alt="Mek-Tech"></a><div style="display:flex;align-items:center;gap:.4rem"><a href="/" class="nav-icon-btn" title="Dashboard"><i data-lucide="layout-dashboard" style="width:15px;height:15px"></i> Dashboard</a><button class="theme-toggle" id="themeToggle" onclick="toggleTheme()"></button><a href="/auth/logout" class="nav-icon-btn" style="color:var(--red)"><i data-lucide="log-out" style="width:15px;height:15px"></i> Uitloggen</a></div></div></nav>

  <div class="container">
    <a href="javascript:history.back()" class="back-link"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 18 9 12 15 6"/></svg> Terug</a>
<div class="page-header">
      <div>
        <a href="/clients" class="back-link">← Terug naar cliënten</a>
        <h1><%= client ? 'Bewerk: ' + client.name : 'Nieuwe Cliënt' %></h1>
      </div>
    </div>

    <% if (error) { %><div class="alert alert-error"><%= error %></div><% } %>

    <form action="/clients/<%= client ? client.id + '/edit' : 'new' %>" method="POST" class="form-card">
      <div class="form-grid">
        <div class="field">
          <label for="name">Bedrijfsnaam *</label>
          <input type="text" name="name" id="name" value="<%= client ? client.name : '' %>" required>
        </div>
        <div class="field">
          <label for="industry">Sector/Industrie</label>
          <input type="text" name="industry" id="industry" value="<%= client ? client.industry : '' %>">
        </div>
        <div class="field">
          <label for="website">Website</label>
          <input type="url" name="website" id="website" value="<%= client ? client.website : '' %>" placeholder="https://">
        </div>
        <div class="field">
          <label for="source">Bron / Hoe gevonden?</label>
          <input type="text" name="source" id="source" value="<%= client ? client.source : '' %>" placeholder="Referral, LinkedIn, etc.">
        </div>
        <div class="field">
          <label for="contact_name">Contactpersoon</label>
          <input type="text" name="contact_name" id="contact_name" value="<%= client ? client.contact_name : '' %>">
        </div>
        <div class="field">
          <label for="contact_email">Contact Email</label>
          <input type="email" name="contact_email" id="contact_email" value="<%= client ? client.contact_email : '' %>">
        </div>
        <div class="field">
          <label for="contact_phone">Contact Telefoon</label>
          <input type="text" name="contact_phone" id="contact_phone" value="<%= client ? client.contact_phone : '' %>">
        </div>
        <div class="field">
          <label for="status">Status</label>
          <select name="status" id="status">
            <option value="lead" <%= client && client.status === 'lead' ? 'selected' : '' %>>Lead</option>
            <option value="active" <%= client && client.status === 'active' ? 'selected' : '' %>>Actief</option>
            <option value="paused" <%= client && client.status === 'paused' ? 'selected' : '' %>>Gepauzeerd</option>
            <option value="archived" <%= client && client.status === 'archived' ? 'selected' : '' %>>Gearchiveerd</option>
          </select>
        </div>
      </div>
      <div class="field">
        <label for="notes">Notities</label>
        <textarea name="notes" id="notes" rows="4"><%= client ? client.notes : '' %></textarea>
      </div>
      <div class="form-actions">
        <button type="submit" class="btn btn-accent"><%= client ? 'Opslaan' : 'Cliënt toevoegen' %></button>
        <a href="/clients" class="btn btn-secondary">Annuleren</a>
      </div>
    </form>
  </div>
<script src="/js/theme.js"></script></body>
</html>
