CRM example
[APKPM.git] / public / CRM.html
diff --git a/public/CRM.html b/public/CRM.html
new file mode 100644 (file)
index 0000000..ff43941
--- /dev/null
@@ -0,0 +1,56 @@
+<!doctype html>
+<html xmlns:ng="http://angularjs.org">
+ <script src="http://code.angularjs.org/angular-0.9.12.min.js" ng:autobind></script>
+ <body>
+  <script>
+    function PingCntl($xhr) {
+      var self = this;
+   
+      this.fetch = function() {
+        self.clear();
+       self.url = '/g/' + self.function + '/' + self.args + '?callback=JSON_CALLBACK';
+        $xhr('JSON', self.url, function(code, response) {
+          self.code = code;
+          self.response = response;
+        });
+      };
+   
+      this.clear = function() {
+        self.code = null;
+        self.response = null;
+      };
+    }
+    PingCntl.$inject = ['$xhr'];
+  </script>
+  <div ng:controller="PingCntl">
+    <input type="text" name="function" value="CRM_username"      size="20"/>
+    <input type="text" name="args"     value="test" size="10"/>
+    <button ng:click="fetch()">fetch</button>
+    <button ng:click="clear()">clear</button>
+    <b ng:show="url && ! code">loading {{url}}</b>
+    <table ng:show="response">
+    <tr>
+       <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.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>
+    <pre>
+url={{url}}
+code={{code}}
+response={{response}}
+    </pre>
+  </div>
+ </body>
+</html>