Advertisement
Guest User

Untitled

a guest
Mar 1st, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.23 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <title>SimplyBPM | Customer 360 CRM | Dashboard</title>
  7. <!-- Tell the browser to be responsive to screen width -->
  8. <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  9. <!-- Bootstrap 3.3.5 -->
  10. <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
  11. <!-- Font Awesome -->
  12. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
  13. <!-- Ionicons -->
  14. <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  15. <!-- Theme style -->
  16. <link rel="stylesheet" href="assets/css/AdminLTE.min.css">
  17. <!-- AdminLTE Skins. Choose a skin from the css/skins
  18. folder instead of downloading all of them to reduce the load. -->
  19. <link rel="stylesheet" href="assets/css/skins/_all-skins.min.css">
  20.  
  21. <!-- SB css -->
  22. <link rel="stylesheet" href="assets/css/sbCustom.css">
  23.  
  24. </head>
  25. <body class="hold-transition skin-blue sidebar-mini">
  26. <div class="wrapper">
  27.  
  28. <!-- Header -->
  29. <div class="sbIncludeHTML" title="header.html">Include HTML here</div>
  30.  
  31. <!-- Left Nav -->
  32. <div class="sbIncludeHTML" title="leftNav.html">Include HTML here</div>
  33.  
  34. <!-- Content Wrapper. Contains page content -->
  35. <div class="content-wrapper">
  36.  
  37. <!-- Content Header (Page header) -->
  38. <section class="content-header">
  39. <h1>Customer 360 CRM <small>Dashboard</small></h1>
  40.  
  41. </section>
  42.  
  43. <!-- Main content -->
  44. <section class="content">
  45.  
  46. <!-- Small boxes (Stat box) -->
  47. <div class="row">
  48. <div class="col-lg-3 col-xs-6"> <!-- Box1 -->
  49. <!-- small box -->
  50. <div class="small-box bg-aqua">
  51. <div class="inner"><h3>9</h3><p>Unassigned</p></div>
  52. <div class="icon"><i class="ion ion-email-unread"></i></div>
  53. <a style="cursor:pointer;" class="small-box-footer" onclick="filterList('ALL',0)">Show all <i class="fa fa-arrow-circle-right"></i></a>
  54. </div>
  55. </div><!-- ./Box1 -->
  56.  
  57. <div class="col-lg-3 col-xs-6"> <!-- Box2 -->
  58. <!-- small box -->
  59. <div class="small-box bg-green">
  60. <div class="inner"><h3>3</h3><p>My Incidents</p></div>
  61. <div class="icon"><i class="ion ion-ios-list"></i></div>
  62. <a style="cursor:pointer;" class="small-box-footer" onclick="filterList('MYRECORDS',0)">Show all <i class="fa fa-arrow-circle-right"></i></a>
  63. </div>
  64. </div><!-- ./Box2-->
  65.  
  66. <div class="col-lg-3 col-xs-6"> <!-- Box3 -->
  67. <!-- small box -->
  68. <div class="small-box bg-yellow">
  69. <div class="inner"><h3>2</h3><p>New Incidents</p></div>
  70. <div class="icon"><i class="ion ion-ios-telephone"></i></div>
  71. <a style="cursor:pointer;" class="small-box-footer" onclick="filterList('NEW',0)">Show all <i class="fa fa-arrow-circle-right"></i></a>
  72. </div>
  73. </div><!-- ./Box3 -->
  74.  
  75. <div class="col-lg-3 col-xs-6"> <!-- Box4 -->
  76. <!-- small box -->
  77. <div class="small-box bg-red">
  78. <div class="inner"><h3>4</h3><p>Follow-up Today</p></div>
  79. <div class="icon"><i class="ion ion-ios-bell"></i></div>
  80. <a style="cursor:pointer;" class="small-box-footer" onclick="filterList('FOLLOWUPTODAY',0)">Show all <i class="fa fa-arrow-circle-right"></i></a>
  81. </div>
  82. </div><!-- ./Box4 -->
  83. </div><!-- /.row -->
  84.  
  85. <!-- Main row -->
  86. <div class="row">
  87. <!-- Left col -->
  88. <section class="col-lg-8 connectedSortable">
  89.  
  90. <!-- Search Options -->
  91. <div class="box box-primary">
  92. <div class="box-header"><span class="glyphicon glyphicon-search"></span><h3 class="box-title">Search</h3></div>
  93. <div class="box-body">
  94.  
  95. <div class="form-inline">
  96. <!-- Search ID box -->
  97. <div class="col-lg-7 col-md-7 col-sm-12 col-xs-12">
  98. <div class="form-group">
  99. <label for="INCIDENT_ID">Incident Search ID:</label>
  100. <input type="text" class="form-control sbDataFields" id="INCIDENT_ID" placeholder="Search ID">
  101. </div>
  102. </div>
  103.  
  104. <!-- Search Button -->
  105. <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
  106. <div class="form-group">
  107. <button type="button" name="search" id="search-btn1" class="btn btn-primary" onclick="searchRecord();">Search</button>&nbsp;&nbsp;
  108. <button type="button" onclick="window.location='incidentSearch.html'" name="search" id="search-btn2" class="btn btn-primary" >Advanced</button>
  109. </div>
  110. </div>
  111. </div>
  112.  
  113.  
  114. </div> <!-- ./Box Body -->
  115. </div> <!-- End of Search Box ./box-primary -->
  116.  
  117. <!-- Table of Incidents -->
  118. <div class="box box-primary">
  119. <!-- box-header -->
  120. <div class="box-header"><span class="glyphicon glyphicon-th-list"></span>
  121. <h3 class="box-title">Incident Table</h3>
  122.  
  123. </div><!-- /.box-header -->
  124. <!-- Table values -->
  125. <div class="box-body table-responsive">
  126. <table class="table table-hover" id="incidentList">
  127. <thead>
  128. <tr>
  129. <th>Alert</th>
  130. <th>Priority</th>
  131. <th>Incident ID</th>
  132. <th>Description</th>
  133. <th>Type</th>
  134. <th>Status</th>
  135. <th>Created On</th>
  136. <th>Assigned To</th>
  137. </tr>
  138. </thead>
  139. <tbody>
  140. </tbody>
  141. </table>
  142. <div class="box-tools pull-right">
  143. <ul class="pagination pagination-sm inline" id="pagination"> <!-- Scroll Buttons -->
  144. </ul>
  145. </div>
  146. </div><!-- /.box-body -->
  147. </div><!-- /.box-primary -->
  148. </section><!-- /.Left col -->
  149.  
  150. <!-- right col (We are only adding the ID to make the widgets sortable)-->
  151. <section class="col-lg-4 connectedSortable">
  152. <!-- Chat box -->
  153. <div class="sbIncludeHTML" title="notes.html">Include HTML here</div>
  154.  
  155. </section><!-- right col -->
  156. </div><!-- /.row (main row) -->
  157. </section><!-- /.content -->
  158. </div><!-- /.content-wrapper -->
  159.  
  160. <input type="text" value="" id="CURRENT_FILTER_TYPE" style="display:none"/>
  161.  
  162. <!-- Main Footer -->
  163. <footer class="main-footer">
  164. <div class="pull-right hidden-xs">
  165. <b>Version</b> 2.3.0
  166. </div>
  167. <strong>Copyright &copy; 2015-2016 <a href="http://www.cgsits.com/simplybpm">CGS IT Solutions</a>.</strong> All rights reserved.
  168. </footer> <!-- ./Main Footer -->
  169.  
  170. </div><!-- ./wrapper -->
  171.  
  172. <div class="modal fade" id="pleaseWaitDialog" tabindex="-1" role="dialog" aria-labelledby="pleaseWaitDialogLabel">
  173. <div class="modal-dialog" role="document">
  174. <div class="row">
  175. <div class="col-sm-12">
  176. <div class="modal-content">
  177. <div class="modal-header">
  178. <h4 class="modal-title" id="pleaseWaitDialogLabel">Processing...</h4>
  179. </div>
  180. <div class="modal-body">
  181. <div class="progress progress-striped active">
  182. <div class="progress-bar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width: 100%;">
  183. <span class="sr-only">70% Complete</span>
  184. </div>
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. </div>
  192.  
  193.  
  194. <!-- jQuery 2.1.4 -->
  195. <script src="assets/js/jQuery-2.1.4.min.js"></script>
  196.  
  197. <!-- Bootstrap 3.3.5 -->
  198. <script src="bootstrap/js/bootstrap.min.js"></script>
  199.  
  200. <!-- AdminLTE App -->
  201. <script src="assets/js/app.min.js"></script>
  202.  
  203. <script src="files/common.js"></script>
  204.  
  205. <script src="files/itsm.js"></script>
  206.  
  207. <script src="files/sbIncludeHTML.js"></script>
  208.  
  209.  
  210. <script>
  211. var totalRows = 0;
  212. var rowCount = 10;
  213. $(document).ready(function(){
  214. getAllRecords(0);
  215. getAllNotes();
  216. $(document).ajaxComplete(function(){
  217. readOnlyNotes();
  218. });
  219. });
  220.  
  221. function getAllRecords(rowOffset)
  222. {
  223. var dataString = "action=list&rowOffset=" + rowOffset + "&rowCount=" + rowCount;
  224. $("#pleaseWaitDialog").modal("show");
  225. $.ajax({
  226. type:"GET",
  227. url:"/api/itsm/incident",
  228. data:dataString,
  229. success:function(response)
  230. {
  231. $("#pleaseWaitDialog").modal("hide");
  232. var returnMessage = checkResponse(response);
  233. if(returnMessage == true)
  234. {
  235. generateTableHTML(response);
  236. pagination(true,'LIST');
  237. }
  238. else if(returnMessage != false)
  239. {
  240. alert(returnMessage);
  241. }
  242. }
  243. });
  244. }
  245.  
  246. function generateTableHTML(response)
  247. {
  248. var responseJSON = JSON.parse(response);
  249. var responseJSONList;
  250. if(responseJSON.TOTAL_ROWS && responseJSON.TOTAL_ROWS != null && responseJSON.TOTAL_ROWS != undefined)
  251. {
  252. totalRows = responseJSON.TOTAL_ROWS;
  253. }
  254. responseJSONList = responseJSON.RESULTS_SET;
  255. var incidentTable = document.getElementById("incidentList");
  256. var html = "";
  257. for(var i=0;i<responseJSONList.length;i++)
  258. {
  259. html += "<tr>";
  260. if(i%2 == 0)
  261. {
  262. html += "<td class='glyphicon glyphicon-bell text-red'></td>";
  263. }
  264. else
  265. {
  266. html += "<td></td>";
  267. }
  268. html += "<td>" + responseJSONList[i].PRIORITY; + "</td>";
  269. html += "<td><a href='incidentDetails.html?IID=" + responseJSONList[i].INCIDENT_ID + "'>" + responseJSONList[i].INCIDENT_ID + "</a></td>";
  270. html += "<td>" + responseJSONList[i].SHORT_DESC + "</td>";
  271. html += "<td>" + responseJSONList[i].INCIDENT_TYPE + "</td>";
  272. html += "<td>" + responseJSONList[i].STATUS + "</td>";
  273. html += "<td>" + responseJSONList[i].CREATED_DATE + "</td>";
  274. html += "<td>" + responseJSONList[i].ASSIGNED_TO + "</td>";
  275. html += "</tr>";
  276. }
  277. incidentTable.getElementsByTagName("tbody")[0].innerHTML = html;
  278. }
  279.  
  280. function filterList(type,rowOffset)
  281. {
  282. $("#pleaseWaitDialog").modal("show");
  283. var searchObject = new Object();
  284. var tempDate = new Date();
  285. if(type == "NEW")
  286. {
  287. searchObject["CREATED_DATE"] = yyyymmdd(tempDate);
  288. }
  289. else if(type == "FOLLOWUPTODAY")
  290. {
  291. searchObject["FOLLOW_UP_DATE"] = yyyymmdd(tempDate);
  292. }
  293. else if(type == "MYRECORDS")
  294. {
  295. searchObject["ASSIGNED_TO"] = "Troy";
  296. }
  297. else if(type == "ALL")
  298. {
  299. searchObject["1"] = "1";
  300. }
  301. var searchObjectString = JSON.stringify(searchObject);
  302. var dataString = "searchRequest=" + searchObjectString + "&action=search&rowOffset="+ rowOffset +"&rowCount=" + rowCount;
  303. $.ajax({
  304. type:"GET",
  305. url:"/api/itsm/incident",
  306. data:dataString,
  307. success:function(response)
  308. {
  309. $("#pleaseWaitDialog").modal("hide");
  310. var returnMessage = checkResponse(response);
  311. if(returnMessage == true)
  312. {
  313. document.getElementById("CURRENT_FILTER_TYPE").value = type;
  314. generateTableHTML(response);
  315. pagination(true,'FILTER');
  316. }
  317. else if(returnMessage != false)
  318. {
  319. alert(returnMessage);
  320. }
  321. }
  322. });
  323. }
  324.  
  325. function searchRecord()
  326. {
  327. $("#pleaseWaitDialog").modal("show");
  328. var searchObject = new Object();
  329. $(".sbDataFields").each(function(){
  330. searchObject[$(this).attr("id")] = encodeURIComponent($(this).val());
  331. });
  332. var searchObjectString = JSON.stringify(searchObject);
  333. var dataString = "searchRequest=" + searchObjectString + "&action=search&rowOffset=0&rowCount=1";
  334. $.ajax({
  335. type:"GET",
  336. url:"/api/itsm/incident",
  337. data:dataString,
  338. success:function(response)
  339. {
  340. $("#pleaseWaitDialog").modal("hide");
  341. var returnMessage = checkResponse(response);
  342. if(returnMessage == true)
  343. {
  344. generateTableHTML(response);
  345. pagination(false,'SEARCH');
  346. }
  347. else if(returnMessage != false)
  348. {
  349. alert(returnMessage);
  350. }
  351. }
  352. });
  353. }
  354. </script>
  355. </body>
  356. </html>
  357.  
  358. var express = require('express');
  359. var bodyParser = require('body-parser');
  360. var urlencodedParser = bodyParser.urlencoded({ extended: false });
  361. var mysql = require('mysql');
  362. var $ = require('jquery');
  363. var settings = {
  364. host: 'cgs-devdb.czspzuv6lcaw.us',
  365. database: 'Customer 360',
  366. user: 'cgsadmin',
  367. password: 'cypre55gs'
  368. };
  369. // Express
  370. var app = express();
  371. app.use(express.static(__dirname + '/public'));
  372. app.use(bodyParser.urlencoded({ extended: false}));
  373. app.use(bodyParser.json());
  374.  
  375. app.get('/dashboard.html', function (req, res) {
  376. res.sendFile( __dirname + "/" + "dashboard.html" );
  377. });
  378.  
  379. // Get information submitted
  380. app.get('/api/itsm/incident', function(req, res){
  381. var obj = {};
  382. var jsonString = JSON.stringify(req.body);
  383. console.log('body: ' + JSON.stringify(req.body));
  384. console.log(req.body);
  385. var qb = require('node-querybuilder').QueryBuilder(settings, 'mysql', 'single');
  386. // Generating Query
  387. qb.select('*')
  388. .where(req.body)
  389. .get('SM_INCIDENT', function(err,response) {
  390. if (err) return console.error("Uh oh! Couldn't get results: " + err.msg);
  391.  
  392. console.log("Query Ran: " + qb.last_query());
  393.  
  394. console.log(response);
  395. res.send(response); // sending back the response to ajax
  396. });
  397. });
  398. // Start server
  399. app.listen(8000);
  400. console.log("API is running on port");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement