Blame view

resources/views/modals/vacancy/add_comment.blade.php 2.35 KB
465aace57   Fedor   task-132687 minor...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  <div id="add_comment" class="modal">
      <div class="modal__body">
          <div class="modal__title">Комментарий для работодателя</div>
          <form class="modal__form comment_form">
              @csrf
              <div class="modal__form-item" style="display:none">
                  <!-- Отправитель сообщения: -->
                  <input type="hidden" id="response_user_id" name="_user_id" class="input" placeholder="user_id" value="">
                  <!-- Получатель сообщения: -->
                  <input type="hidden" id="response_to_user_id" name="_to_user_id" class="input" placeholder="to_user_id" value="">
                  <!-- Вакансия: -->
                  <input type="hidden" id="response_vacancy" name="_vacancy" class="input" placeholder="vacancy" value="">
              </div>
              <div class="modal__form-item">
                  <textarea id="comment_text" class="textarea" name="text" placeholder="Комментарий" required value=""></textarea>
                  <label for="comment_text">Не заполнено поле</label>
              </div>
              <div class="modal__form-item">
465aace57   Fedor   task-132687 minor...
19
20
                  <button type="button"
                          data-fancybox
465aace57   Fedor   task-132687 minor...
21
                          data-src="#response_sent"
6bad752f0   Fedor   task-132687 minor...
22
23
24
25
26
                          class="button main__employer-page-two-item-button send_resume">Отправить</button>
                  <button type="button"
                          data-fancybox
                          data-src="#response_sent_no_comment"
                          class="button main__employer-page-two-item-button send_resume">Пропустить</button>
465aace57   Fedor   task-132687 minor...
27
28
29
30
31
32
              </div>
          </form>
      </div>
  </div>
  
  <script>
6bad752f0   Fedor   task-132687 minor...
33
34
35
36
37
38
39
40
41
42
43
44
45
      $(document).on('click', '.send_resume', function(){
          var data = {
              user_from: $('#response_user_id').val(),
              user_to: $('#response_to_user_id').val(),
              vacancy: $('#response_vacancy').val(),
              _token: '{{csrf_token()}}'
          }
  
          var comment = $('.comment_form textarea').serializeArray()[0].value;
  
          if (comment !== '') {
              data.comment = comment;
          }
465aace57   Fedor   task-132687 minor...
46
47
48
          $.ajax({
              url: '{{ route('worker.new_message') }}',
              type: 'POST',
6bad752f0   Fedor   task-132687 minor...
49
              data: data,
465aace57   Fedor   task-132687 minor...
50
51
52
53
54
55
              success: function (data) {
                  //
              }
          })
      })
  </script>