DmitrMakeev commited on
Commit
35737ae
·
verified ·
1 Parent(s): 176466c

Update pages.html

Browse files
Files changed (1) hide show
  1. pages.html +53 -65
pages.html CHANGED
@@ -459,90 +459,79 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
459
 
460
 
461
 
 
462
  // Создаем новый тип компонента для формы
463
  editor.Components.addType('custom-form', {
464
  model: {
465
  defaults: {
466
  // HTML-код формы
467
  content: `
468
- <div class="container">
469
- <form id="contactForm">
470
- <h4>КЛУБ-ПРАКТИК. 255 техник для психолога - 2024</h4>
471
- <div class="form-group">
472
- <label for="name">Имя</label>
473
- <input type="text" id="name" required>
474
- </div>
475
-
476
- <div class="form-group">
477
- <label for="email">Почта</label>
478
- <input type="email" id="email" required>
479
- </div>
480
-
481
- <div class="form-group">
482
- <label for="phone">Телефон</label>
483
- <input type="tel" id="phone" required>
484
- </div>
485
-
486
- <div class="form-group">
487
- <label for="options">Выберите тариф</label>
488
- <select id="options" required>
489
  <option value="" disabled selected>Тариф</option>
490
  <option>БИЗНЕС - 69 970р.</option>
491
  <option>PREMIUM - 89 970р.</option>
492
  <option>VIP - 149 990р.</option>
493
- </select>
494
- </div>
495
-
496
- <div class="form-check">
497
- <input type="checkbox" id="newsletter" required>
498
- <label for="newsletter">Согласие на email рассылку</label>
499
- </div>
500
-
501
- <div class="form-group">
502
- <a href="#" id="privacyPolicyLink">Политика конфиденциальности</a>
 
 
 
 
 
 
 
503
  </div>
504
-
505
- <button type="submit" class="btn-primary">ПЕРЕЙТИ К ОПЛАТЕ</button>
506
- </form>
507
-
508
- <div id="privacyModal" class="modal">
509
- <div class="modal-content">
510
- <span class="close">&times;</span>
511
- <iframe src="https://riverpsy.com/policy" frameborder="0"></iframe>
512
- </div>
513
- </div>
514
- </div>
515
- `, // Вставьте сюда HTML-код формы
516
  // Скрипт для обработки отправки формы
517
- document.addEventListener('DOMContentLoaded', function() {
518
- const submitUrlInput = document.getElementById('submitUrl');
519
-
520
- document.getElementById('contactForm').addEventListener('submit', function(event) {
521
- event.preventDefault();
522
- const formData = new FormData(this);
523
- const data = {};
524
- formData.forEach((value, key) => {
525
  data[key] = value;
526
- });
527
- fetch(submitUrlInput.value, {
528
  method: 'POST',
529
  headers: {
530
- 'Content-Type': 'application/json'
531
  },
532
  body: JSON.stringify(data)
533
- })
534
- .then(response => response.json())
535
- .then(data => {
536
  console.log('Success:', data);
537
- })
538
- .catch((error) => {
539
  console.error('Error:', error);
 
540
  });
541
- });
542
- });
543
-
544
- script: function(props) {
545
- // Вставьте сюда JavaScript-код для обработки формы
546
  },
547
  // Свойства, которые будут передаваться в скрипт
548
  'script-props': ['submitUrl'],
@@ -579,7 +568,6 @@ editor.Blocks.add('custom-form-block', {
579
 
580
 
581
 
582
-
583
 
584
 
585
  // Добавление кнопки для открытия редактора кода
 
459
 
460
 
461
 
462
+ // Создаем новый тип компонента для формы
463
  // Создаем новый тип компонента для формы
464
  editor.Components.addType('custom-form', {
465
  model: {
466
  defaults: {
467
  // HTML-код формы
468
  content: `
469
+ <div class="container">
470
+ <form id="contactForm">
471
+ <h4>КЛУБ-ПРАКТИК. 255 техник для психолога - 2024</h4>
472
+ <div class="form-group">
473
+ <label for="name">Имя</label>
474
+ <input type="text" id="name" required>
475
+ </div>
476
+ <div class="form-group">
477
+ <label for="email">Почта</label>
478
+ <input type="email" id="email" required>
479
+ </div>
480
+ <div class="form-group">
481
+ <label for="phone">Телефон</label>
482
+ <input type="tel" id="phone" required>
483
+ </div>
484
+ <div class="form-group">
485
+ <label for="options">Выберите тариф</label>
486
+ <select id="options" required>
 
 
 
487
  <option value="" disabled selected>Тариф</option>
488
  <option>БИЗНЕС - 69 970р.</option>
489
  <option>PREMIUM - 89 970р.</option>
490
  <option>VIP - 149 990р.</option>
491
+ </select>
492
+ </div>
493
+ <div class="form-check">
494
+ <input type="checkbox" id="newsletter" required>
495
+ <label for="newsletter">Согласие на email рассылку</label>
496
+ </div>
497
+ <div class="form-group">
498
+ <a href="#" id="privacyPolicyLink">Политика конфиденциальности</a>
499
+ </div>
500
+ <button type="submit" class="btn-primary">ПЕРЕЙТИ К ОПЛАТЕ</button>
501
+ </form>
502
+ <div id="privacyModal" class="modal">
503
+ <div class="modal-content">
504
+ <span class="close">&times;</span>
505
+ <iframe src="https://riverpsy.com/policy" frameborder="0"></iframe>
506
+ </div>
507
+ </div>
508
  </div>
509
+ `,
 
 
 
 
 
 
 
 
 
 
 
510
  // Скрипт для обработки отправки формы
511
+ script: function(props) {
512
+ const form = this.querySelector('#contactForm');
513
+ form.addEventListener('submit', function(event) {
514
+ event.preventDefault();
515
+ const formData = new FormData(form);
516
+ const data = {};
517
+ formData.forEach((value, key) => {
 
518
  data[key] = value;
519
+ });
520
+ fetch(props.submitUrl, {
521
  method: 'POST',
522
  headers: {
523
+ 'Content-Type': 'application/json'
524
  },
525
  body: JSON.stringify(data)
526
+ })
527
+ .then(response => response.json())
528
+ .then(data => {
529
  console.log('Success:', data);
530
+ })
531
+ .catch((error) => {
532
  console.error('Error:', error);
533
+ });
534
  });
 
 
 
 
 
535
  },
536
  // Свойства, которые будут передаваться в скрипт
537
  'script-props': ['submitUrl'],
 
568
 
569
 
570
 
 
571
 
572
 
573
  // Добавление кнопки для открытия редактора кода