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

Update pages.html

Browse files
Files changed (1) hide show
  1. pages.html +77 -113
pages.html CHANGED
@@ -465,129 +465,94 @@ editor.Components.addType('custom-form', {
465
  defaults: {
466
  // HTML-код формы
467
  content: `
468
- <form id="custom-form">
469
- <h4>КЛУБ-ПРАКТИК. 255 техник для психолога - 2024</h4>
470
- <div class="form-group">
471
- <label for="name">Имя</label>
472
- <input type="text" id="name" name="name" required>
473
- </div>
474
- <div class="form-group">
475
- <label for="email">Почта</label>
476
- <input type="email" id="email" name="email" required>
477
- </div>
478
- <div class="form-group">
479
- <label for="phone">Телефон</label>
480
- <input type="tel" id="phone" name="phone" required>
481
- </div>
482
- <div class="form-group">
483
- <label for="options1">Выберите тариф 1</label>
484
- <select id="options1" name="options1" required>
485
- <option value="" disabled selected>Тариф 1</option>
486
- </select>
487
- </div>
488
- <div class="form-group">
489
- <label for="options2">Выберите тариф 2</label>
490
- <select id="options2" name="options2" required>
491
- <option value="" disabled selected>Тариф 2</option>
492
- </select>
493
- </div>
494
- <div class="form-group">
495
- <label for="options3">Выберите тариф 3</label>
496
- <select id="options3" name="options3" required>
497
- <option value="" disabled selected>Тариф 3</option>
498
- </select>
499
- </div>
500
- <div class="form-check">
501
- <input type="checkbox" id="newsletter" name="newsletter" required>
502
- <label for="newsletter">Согласие на email рассылку</label>
503
- </div>
504
- <button type="submit" class="btn-primary">ПЕРЕЙТИ К ОПЛАТЕ</button>
505
- </form>
506
- `,
507
- // Скрипт для обработки отправки формы
508
- script: function(props) {
509
- const optionsSelect1 = this.querySelector('#options1');
510
- const optionsSelect2 = this.querySelector('#options2');
511
- const optionsSelect3 = this.querySelector('#options3');
512
-
513
- // Обновление выпадающего списка 1 при загрузке
514
- const options1 = props.dropdownOptions1.split(',').map(option => option.trim()).filter(option => option !== '');
515
- options1.forEach(option => {
516
- const optionElement = document.createElement('option');
517
- optionElement.value = option;
518
- optionElement.textContent = option;
519
- optionsSelect1.appendChild(optionElement);
520
- });
521
-
522
- // Обновление выпадающего списка 2 при загрузке
523
- const options2 = props.dropdownOptions2.split(',').map(option => option.trim()).filter(option => option !== '');
524
- options2.forEach(option => {
525
- const optionElement = document.createElement('option');
526
- optionElement.value = option;
527
- optionElement.textContent = option;
528
- optionsSelect2.appendChild(optionElement);
529
- });
530
 
531
- // Обновление выпадающего списка 3 при загрузке
532
- const options3 = props.dropdownOptions3.split(',').map(option => option.trim()).filter(option => option !== '');
533
- options3.forEach(option => {
534
- const optionElement = document.createElement('option');
535
- optionElement.value = option;
536
- optionElement.textContent = option;
537
- optionsSelect3.appendChild(optionElement);
 
 
 
 
 
 
 
 
 
 
 
538
  });
539
-
540
- // Обработка отправки формы
541
- this.querySelector('#custom-form').addEventListener('submit', function(event) {
542
- event.preventDefault();
543
- const formData = new FormData(this);
544
- const data = {};
545
- formData.forEach((value, key) => {
546
- data[key] = value;
547
- });
548
- fetch(props.submitUrl, {
549
- method: 'POST',
550
- headers: {
551
- 'Content-Type': 'application/json'
552
- },
553
- body: JSON.stringify(data)
554
- })
555
- .then(response => response.json())
556
- .then(data => {
557
- console.log('Success:', data);
558
- })
559
- .catch((error) => {
560
- console.error('Error:', error);
561
- });
562
  });
 
 
 
 
 
563
  },
564
  // Свойства, которые будут передаваться в скрипт
565
- 'script-props': ['submitUrl', 'dropdownOptions1', 'dropdownOptions2', 'dropdownOptions3'],
566
- // Настройки для изменения URL отправки и опций выпадающих списков
567
  traits: [
568
  {
569
  type: 'text',
570
  name: 'submitUrl',
571
  label: 'Submit URL',
572
  changeProp: true
573
- },
574
- {
575
- type: 'text',
576
- name: 'dropdownOptions1',
577
- label: 'Dropdown Options 1 (comma separated)',
578
- changeProp: true
579
- },
580
- {
581
- type: 'text',
582
- name: 'dropdownOptions2',
583
- label: 'Dropdown Options 2 (comma separated)',
584
- changeProp: true
585
- },
586
- {
587
- type: 'text',
588
- name: 'dropdownOptions3',
589
- label: 'Dropdown Options 3 (comma separated)',
590
- changeProp: true
591
  }
592
  ]
593
  }
@@ -615,7 +580,6 @@ editor.Blocks.add('custom-form-block', {
615
 
616
 
617
 
618
-
619
 
620
 
621
  // Добавление кнопки для открытия редактора кода
 
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'],
549
+ // Настройки для изменения URL отправки
550
  traits: [
551
  {
552
  type: 'text',
553
  name: 'submitUrl',
554
  label: 'Submit URL',
555
  changeProp: true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
556
  }
557
  ]
558
  }
 
580
 
581
 
582
 
 
583
 
584
 
585
  // Добавление кнопки для открытия редактора кода