search CRM for username
[APKPM.git] / templates / user.html.ep
diff --git a/templates/user.html.ep b/templates/user.html.ep
new file mode 100644 (file)
index 0000000..614eab3
--- /dev/null
@@ -0,0 +1,61 @@
+% layout 'angular';
+
+  <script>
+    function CRM($xhr) {
+      var self = this;
+   
+      this.fetch = function() {
+        self.clear();
+       self.url = '/g/' + self.function_name + '/' + self.args + '?callback=JSON_CALLBACK';
+        $xhr('JSON', self.url, function(code, response) {
+          self.code = code;
+          self.response = response;
+        });
+      };
+   
+      this.clear = function() {
+        self.url = null;
+        self.code = null;
+        self.response = null;
+      };
+
+    }
+
+    CRM.$inject = ['$xhr'];
+  </script>
+  <div ng:controller="CRM">
+    <input type="hidden" name="function_name" value="CRM_search"      size="20"/>
+    <label for="args">username:
+    <input type="text" name="args"     value="test" size="10"/>
+    </label>
+    <button ng:click="fetch()">fetch</button>
+    <button ng:click="clear()">clear</button>
+    <b ng:show="url && ! code">loading {{url}}</b>
+    <b ng:show="response">{{response.length}} results</b>
+    <table ng:show="response">
+    <tr>
+       <th>USERNAME</th>
+       <th>BROJ</th>
+       <th>USLUGA</th>
+       <th>IP_MANAGEMENT</th>
+       <th>IP_VOICE</th>
+       <th>KOLOKACIJA</th>
+       <th>OPT82</th>
+    </tr>
+    <tr ng:repeat="u in response">
+       <td>{{u.USERNAME}}</td>
+       <td>{{u.BROJ}}</td>
+       <td>{{u.USLUGA}}</td>
+       <td>{{u.IP_MANAGEMENT}}</td>
+       <td>{{u.IP_VOICE}}</td>
+       <td>{{u.KOLOKACIJA}}</td>
+       <td>{{u.OPT82}}</td>
+    </tr>
+    </table>
+    <input type=checkbox name=debug value=1>
+    <pre ng:show=debug>
+url={{url}}
+code={{code}}
+response={{response}}
+    </pre>
+  </div>