Blame view

frontend/views/site/index.php 2.02 KB
54f2fc2b   Alexey Boroda   first commit
1
  <?php
fc4126a3   Alexey Boroda   -Some chages
2
3
4
5
6
7
8
      
      /**
       * @var                       $this yii\web\View
       * @var \common\models\Call[] $calls
       */
      
      $this->title = 'My Yii Application';
54f2fc2b   Alexey Boroda   first commit
9
10
  ?>
  <div class="site-index">
fc4126a3   Alexey Boroda   -Some chages
11
12
13
14
15
16
17
    
    <div class="jumbotron">
    
    </div>
    
    <div class="body-content">
      
1ec8d36c   Alexey Boroda   -Searching applied
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
      <div id="app">
        <div class="row">
          <table class="bordered">
            <thead>
              <tr>
                <th>ID</th>
                <th>Company</th>
                <th>Status</th>
                <th>Duration</th>
              </tr>
            </thead>
            <tbody>
              <tr v-if="" v-for="call in calls">
                <td>{{call.id}}</td>
                <td>{{call.company}}</td>
                <td>{{call.status}}</td>
                <td>{{call.duration}}</td>
              </tr>
            </tbody>
          </table>
          <div class="row">
            <div class="col s5 input-field">
              <label for="search-company">Company</label>
              <input v-model="search" id="search-company" type="text">
              <button v-on:click="fetchSearch()" class="waves-effect waves-light btn">Search</button>
            </div>
            
          </div>
        </div>
        
54f2fc2b   Alexey Boroda   first commit
48
      </div>
fc4126a3   Alexey Boroda   -Some chages
49
    </div>
54f2fc2b   Alexey Boroda   first commit
50
  </div>
1ec8d36c   Alexey Boroda   -Searching applied
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
  
  <script>
      new Vue({
          el: '#app',
          data: {
              calls: null,
              search: null
          },
          created: function() {
              this.fetchData()
          },
          methods: {
              fetchData: function() {
                  var self = this;
                  axios.get('/rest/calls')
                       .then(function(response) {
                           console.log(response.data);
                           self.calls = response.data;
                       });
              },
              fetchSearch: function() {
                  var self = this;
                  axios.get('/rest/calls/search?word=' + self.search)
                       .then(function(response) {
                           console.log(response.data);
                           self.calls = response.data;
                       });
              }
          }
      })
  </script>