Blame view

src/app/frontend/views/series_of_letters/addEdit.php 4.06 KB
3b975a80   Administrator   change request to...
1
2
3
4
5
6
7
  <div id="addEdit">
      <div class="inner"><?= $this->flash->output(); ?></div>
      <div class="inner">
          <div class="clearfix">
              <form enctype="multipart/form-data" method="post" action="" id="email_event_add_edit">
                  <div class="version_1 clearfix">
  
3b975a80   Administrator   change request to...
8
9
  
                      <div class="input-group">
50f0e821   Administrator   change request to...
10
                          <input type="checkbox" id="status" name="status" class="unique" value="value='<?=  (isset( $page->status ) && !empty( $page->status ) ? $page->status : '') ?>'">
4081157a   Administrator   change request to...
11
                          <label for="status">Статус рассылки</label>
3b975a80   Administrator   change request to...
12
13
14
15
16
                      </div>
  
  
  
                      <div class="input-group">
4081157a   Administrator   change request to...
17
                          <span class="input-group-addon title-block-sizing">Название рассылки</span>
50f0e821   Administrator   change request to...
18
                          <input type="text" name="name" class="form-control" value='<?=  (isset( $page->name ) && !empty( $page->name ) ? $page->name : '') ?>'>
3b975a80   Administrator   change request to...
19
20
                      </div>
  
50f0e821   Administrator   change request to...
21
22
23
24
                      <div class="input-group">
                          <span class="input-group-addon title-block-sizing">Период</span>
                          <input type="text" name="period_val" class="form-control" value='<?=  (isset( $page->period_val ) && !empty( $page->period_val ) ? $page->period_val : '') ?>'>
                      </div>
3b975a80   Administrator   change request to...
25
  
0ac35279   Administrator   change request to...
26
  
509f8795   Administrator   change request to...
27
28
29
30
31
32
                      <table id="templates-list" class="table table-hover">
                      </table>
                      <div class="input-group">
                          <span class="input-group-addon title-block-sizing">Введите название письма</span>
                          <input type="text" value="" class="form-control" name="autocomplete_user_email" id="autocomplete_templates"  autocomplete="off">
                      </div>
0ac35279   Administrator   change request to...
33
  
509f8795   Administrator   change request to...
34
35
36
37
38
39
40
41
                      <table class="table table-hover">
                          <thead>
                          <tr>
                              <th id="name">Имя</th>
                              <th class="table-buttons"></th>
                          </tr>
                          </thead>
                          <tbody id="result">
4081157a   Administrator   change request to...
42
  
509f8795   Administrator   change request to...
43
44
                          </tbody>
                      </table>
4081157a   Administrator   change request to...
45
  
3b975a80   Administrator   change request to...
46
  
3b975a80   Administrator   change request to...
47
48
  
                  <div class="input-group">
43d8495a   Administrator   change request to...
49
                      <a href="<?= $this->url->get( 'series_of_letters/index') ?>" class="news_cancel float">Отмена</a>
3b975a80   Administrator   change request to...
50
51
52
53
54
55
56
                      <input type="submit" class="news_submit float" name="save" value="Сохранить">
                  </div>
  
              </form>
          </div>
      </div>
  </div>
4081157a   Administrator   change request to...
57
58
  <script>
      jQuery(document).ready( function() {
09aa724a   Administrator   change request to...
59
60
  
          $('#autocomplete_templates').on('keyup', function () {
a78c80af   Administrator   change request to...
61
              console.log('here is a lot off information');
4081157a   Administrator   change request to...
62
63
64
              var like = $(this).val();
  
              if (like.length > 3) {
8faffe86   Administrator   change request to...
65
                  $.post('/series_of_letters/gettemplate', {like: like}, function (data) {
4081157a   Administrator   change request to...
66
67
68
69
70
                      var ajax = $.parseJSON(data);
                      var count = ajax.length;
                      var block = $('#result');
                      block.html('');
                      for (var i = 0; i < count; i++) {
b7d96b61   Administrator   change request to...
71
                          var row = "<tr><td id='name'>" + ajax[i]['name'] + "</td><td><p data-id='" + ajax[i]['id'] + "' class = 'btn btn-primary select-template'>Добавить в список</p></td></tr>";
4081157a   Administrator   change request to...
72
73
74
75
76
77
78
                          block.append(row);
                      }
                  });
              }
          });
  
  
b7d96b61   Administrator   change request to...
79
          $('#result').on('click', '.select-template', function () {
83d5cde0   Administrator   change request to...
80
              var event = $(this).data('id');
4081157a   Administrator   change request to...
81
82
              var row = $(this).closest('tr');
              var block = $('#templates-list');
4081157a   Administrator   change request to...
83
              var name = row.find('#name').html();
83d5cde0   Administrator   change request to...
84
85
              var new_row = "<tr><td id='name'>" + name + "</td><td><p class = 'btn btn-primary delete-row'>Убрать из списка</p>" +
                  "<input type='hidden' value='" + event + "' name='event[]'></td></tr>";
4081157a   Administrator   change request to...
86
87
88
89
90
91
92
93
94
95
              block.append(new_row);
              row.remove();
          });
  
          $('#templates-list').on('click', '.delete-row', function () {
              var row = $(this).closest('tr');
              row.remove();
          });
      });
  </script>