Advertisement
Guest User

Untitled

a guest
Aug 10th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.67 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5. <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
  6. <link href="static/css/myCss.css" rel="stylesheet">
  7. <meta charset="UTF-8">
  8. <link href="static/css/bootstrap.min.css" rel="stylesheet" media="screen">
  9. <link href="static/css/customIndex.css" rel="stylesheet">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <link href="static/css/bootstrap-responsive.css" rel="stylesheet">
  12. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  13.  
  14. <title>Index</title>
  15. </head>
  16.  
  17.  
  18. <body>
  19. <% include templates/navbar.ejs%>
  20.  
  21. <table class="table table-striped">
  22. <tr>
  23. <th> Project ID </th>
  24. <th> Request_Date </th>
  25. <th> Region </th>
  26. <th> Project_Location </th>
  27. <th> Requested_By </th>
  28. <th> Project_Responsibility </th>
  29. <th> Facility_Classification </th>
  30. <th> Project_Type </th>
  31. <th> Expected_Start_Date </th>
  32. <th> Expected_End_Date </th>
  33. <th> Work_Areas </th>
  34. <th> Conference_Rooms </th>
  35. <th> IDF_MDF </th>
  36. <th> Pantries </th>
  37. <th> Critical_Infrastructure </th>
  38. <th> Building_Support_Areas </th>
  39. <th> Data_Centers </th>
  40. <th> Other_Areas </th>
  41. <th> Project_Manager </th>
  42. <th> Project_Owner </th>
  43. <th> Project_Sponsor </th>
  44. <th> Functional_Currency </th>
  45. <th> Approval_Status </th>
  46. <th> CIP_NCIP </th>
  47. <th> Capital_Expense </th>
  48. <th> Approval </th>
  49. </tr>
  50.  
  51. <% for (var i = 0; i < list.length; /* I save the data in a variable 'quotation', I don't know how you named your variable */ i++) { %>
  52. <form method ="post" action = "/approveproject">
  53. <tr>
  54. <td name ="project_id"><%= list[i].Project_ID %></td>
  55. <td><%= list[i].Request_Date %></td>
  56. <td><%= list[i].Region %></td>
  57. <td><%= list[i].Project_Location %></td>
  58. <td><%= list[i].Requested_By%></td>
  59. <td><%= list[i].Project_Responsibility%></td>
  60. <td><%= list[i].Facility_Classification%></td>
  61. <td><%= list[i].Project_Type%></td>
  62. <td><%= list[i].Expected_Start_Date%></td>
  63. <td><%= list[i].Expected_End_Date%></td>
  64. <td><%= list[i].Work_Areas%></td>
  65. <td><%= list[i].Conference_Rooms%></td>
  66. <td><%= list[i].IDF_MDF%></td>
  67. <td><%= list[i].Pantries%></td>
  68. <td><%= list[i].Critical_Infrastructure%></td>
  69. <td><%= list[i].Building_Support_Areas%></td>
  70. <td><%= list[i].Data_Centers%></td>
  71. <td><%= list[i].Other_Areas%></td>
  72. <td><%= list[i].Project_Manager%></td>
  73. <td><%= list[i].Project_Owner%></td>
  74. <td><%= list[i].Project_Sponsor%></td>
  75. <td><%= list[i].Functional_Currency%></td>
  76. <td><%= list[i].Approval_Status%></td>
  77. <td>
  78. <div class="form-group">
  79. <input type="radio" class="form-check-input" name="cip_noncip" value="CIP" checked> CIP <br>
  80. <input type="radio" class="form-check-input" name="cip_noncip" value="NON-CIP"> NON-CIP
  81. </div>
  82. </td>
  83. <td>
  84. <div class="form-group">
  85. <input type="radio" class="form-check-input" name="capital_expensed" value="Capital" checked> Capital <br>
  86. <input type="radio" class="form-check-input" name="capital_expensed" value="Expensed"> Expensed
  87. </div>
  88. </td>
  89. <td>
  90. <input type="submit" value="Approve" class = "btn btn-primary">
  91. </td>
  92. </tr>
  93.  
  94. </form>
  95. <% } %>
  96. </table>
  97.  
  98. </body>
  99. </html>
  100.  
  101. var express = require('express');
  102. var router = express.Router();
  103. var sql = require('mssql');
  104.  
  105.  
  106. const config = {
  107. user: 'sa',
  108. password: 'password',
  109. server: 'localhost\SQLEXPRESS', // You can use 'localhost\instance' to connect to named instance
  110. database: 'pcgdb',
  111.  
  112. options: {
  113. encrypt: false // Use this if you're on Windows Azure
  114. }
  115. };
  116.  
  117.  
  118.  
  119. router.get('/', function(req, res, next) {
  120. sql.connect(config).then(() => {
  121. return sql.query`select * from projects where Approval_Status ='Not yet approved'`
  122. }).then(result => {
  123. console.log(result);
  124. res.render('approveProject', {list: result} )
  125. }).catch(err => {
  126. console.log(err)
  127. })
  128.  
  129. });
  130.  
  131.  
  132. router.post('/', function(req, res, next) {
  133. console.log(req.body.project_id)
  134. })
  135.  
  136.  
  137.  
  138.  
  139. module.exports = router;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement