614eab3adeedf3e95730dbee9dbf404f2305d843
[APKPM.git] / templates / user.html.ep
1 % layout 'angular';
2
3   <script>
4     function CRM($xhr) {
5       var self = this;
6    
7       this.fetch = function() {
8         self.clear();
9         self.url = '/g/' + self.function_name + '/' + self.args + '?callback=JSON_CALLBACK';
10         $xhr('JSON', self.url, function(code, response) {
11           self.code = code;
12           self.response = response;
13         });
14       };
15    
16       this.clear = function() {
17         self.url = null;
18         self.code = null;
19         self.response = null;
20       };
21
22     }
23
24     CRM.$inject = ['$xhr'];
25   </script>
26   <div ng:controller="CRM">
27     <input type="hidden" name="function_name" value="CRM_search"      size="20"/>
28     <label for="args">username:
29     <input type="text" name="args"     value="test" size="10"/>
30     </label>
31     <button ng:click="fetch()">fetch</button>
32     <button ng:click="clear()">clear</button>
33     <b ng:show="url && ! code">loading {{url}}</b>
34     <b ng:show="response">{{response.length}} results</b>
35     <table ng:show="response">
36     <tr>
37         <th>USERNAME</th>
38         <th>BROJ</th>
39         <th>USLUGA</th>
40         <th>IP_MANAGEMENT</th>
41         <th>IP_VOICE</th>
42         <th>KOLOKACIJA</th>
43         <th>OPT82</th>
44     </tr>
45     <tr ng:repeat="u in response">
46         <td>{{u.USERNAME}}</td>
47         <td>{{u.BROJ}}</td>
48         <td>{{u.USLUGA}}</td>
49         <td>{{u.IP_MANAGEMENT}}</td>
50         <td>{{u.IP_VOICE}}</td>
51         <td>{{u.KOLOKACIJA}}</td>
52         <td>{{u.OPT82}}</td>
53     </tr>
54     </table>
55     <input type=checkbox name=debug value=1>
56     <pre ng:show=debug>
57 url={{url}}
58 code={{code}}
59 response={{response}}
60     </pre>
61   </div>