<!DOCTYPE html>

<html lang="uk">

<head>

  <meta charset="UTF-8">

  <title>Люди — Роботи</title>

  <style>

    body { font-family: Arial, sans-serif; margin: 40px; background: #f9f9f9; }

    h1 { color: #1a3a6e; }

    form { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); margin-bottom: 30px; }

    label { display: block; margin-top: 10px; font-weight: bold; }

    input, select, textarea, button { width: 100%; padding: 10px; margin-top: 5px; border: 1px solid #ccc; border-radius: 4px; }

    button { background: #1a3a6e; color: #fff; font-weight: bold; cursor: pointer; }

    button:hover { background: #274a8a; }

  </style>

</head>

<body>

  <h1>Люди — Роботи</h1>

 

  <!-- Форма заявки -->

  <form id="peopleRobotsForm">

    <label>Хто рекомендував:</label>

    <input type="text" name="q1_recommended_by" required>

 

    <label>Власник бізнесу?</label>

    <select name="q2_is_owner" required>

      <option value="Так">Так</option>

      <option value="Ні">Ні</option>

      <option value="Планую">Планую</option>

    </select>

 

    <label>Ваш email:</label>

    <input type="email" name="email" required>

 

    <button type="submit">Надіслати заявку</button>

  </form>

 

  <!-- Форма відгуку -->

  <form id="reviewForm">

    <label>Ваш email:</label>

    <input type="email" name="email" required>

 

    <label>Ваш відгук:</label>

    <textarea name="review_text" required></textarea>

 

    <button type="submit">Надіслати відгук</button>

  </form>

 

  <script>

    const scriptURL = 'https://script.google.com/macros/s/ AKfycbxR7JCbOG_FnSRq82GNeyFAPdFf9bAd5_XoebCYlnn3BG28k6VmE4IjgD8YbCgXBpOK/exec';

 

    // Заявка

    const form1 = document.getElementById('peopleRobotsForm');

    form1.addEventListener('submit', e => {

      e.preventDefault();

      const data = {

        type: 'form',

        timestamp: new Date().toISOString(),

        action: 'Заявка',

        q1_recommended_by: form1.q1_recommended_by.value,

        q2_is_owner: form1.q2_is_owner.value,

        q3_join_chat: '',

        q4_can_contact: '',

        q5_contact_info: '',

        q6_wants_survey: '',

        email: form1.email.value

      };

      fetch(scriptURL, {

        method: 'POST',

        body: JSON.stringify(data),

        headers: { 'Content-Type': 'application/json' }

      })

      .then(res => res.json())

      .then(res => alert('Заявка надіслана!'))

      .catch(err => alert('Помилка: ' + err.message));

    });

 

    // Відгук

    const form2 = document.getElementById('reviewForm');

    form2.addEventListener('submit', e => {

      e.preventDefault();

      const data = {

        type: 'review',

        timestamp: new Date().toISOString(),

        email: form2.email.value,

        review_text: form2.review_text.value

      };

      fetch(scriptURL, {

        method: 'POST',

        body: JSON.stringify(data),

        headers: { 'Content-Type': 'application/json' }

      })

      .then(res => res.json())

      .then(res => alert('Відгук надіслано!'))

      .catch(err => alert('Помилка: ' + err.message));

    });

  </script>

</body>

</html>