notice.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>{{ title }}</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. </head>
  8. <script>
  9. var USER_NAME = '{{user_name}}'
  10. console.log("user_name: " + USER_NAME);
  11. </script>
  12. <style>
  13. .input-cond-delete {
  14. background: #E43030;
  15. border: 1px solid #CFCFCF;
  16. box-sizing: border-box;
  17. border-radius: 5px;
  18. margin-left: 5px;
  19. width: auto;
  20. height: 33px;
  21. font-size: 16px;
  22. text-align: center;
  23. line-height: 16px;
  24. color: #FFFFFF;
  25. }
  26. .input-cond-add {
  27. background: #008CBA;
  28. border: 1px solid #CFCFCF;
  29. box-sizing: border-box;
  30. border-radius: 5px;
  31. margin-left: 5px;
  32. width: auto;
  33. /* width: 65px; */
  34. height: 33px;
  35. font-size: 16px;
  36. text-align: center;
  37. line-height: 16px;
  38. color: #FFFFFF;
  39. }
  40. .input-cond-action {
  41. background: #FFBD00;
  42. /* #6BF178 #53DD6C #FFBD00*/
  43. border: 1px solid #CFCFCF;
  44. box-sizing: border-box;
  45. border-radius: 5px;
  46. margin-left: 5px;
  47. width: auto;
  48. height: 33px;
  49. font-size: 16px;
  50. text-align: center;
  51. line-height: 16px;
  52. color: #000000;
  53. font-weight: bold;
  54. }
  55. .table-tr-title {
  56. background-color:rgb(0, 131, 72);
  57. color: #FFFFFF;
  58. font-weight: bold;
  59. }
  60. .table-tr-data {
  61. background-color:rgb(236, 247, 242);
  62. }
  63. .table-tr-newdata {
  64. background-color:rgb(245, 245, 245);
  65. }
  66. </style>
  67. <body>
  68. <div id="ERP_header">
  69. <!-- 匯入共同使用的 header.html 內容 -->
  70. {% include 'ERP_header.html' %}
  71. </div>
  72. <center><h6 style="margin: 20px;">通知列表</h6></center>
  73. 目前使用者:{{user_name}}<br>
  74. {% if notice_list == () %}
  75. 無通知
  76. {% else %}
  77. <table class="table table-bordered" style="margin-top: 10px;">
  78. <tr>
  79. <!-- <th>通知對象</th> -->
  80. <th>日期</th>
  81. <th>表單單號</th>
  82. <th>內容</th>
  83. <th>已完成</th>
  84. </tr>
  85. {% for notice in notice_list %}
  86. <tr>
  87. <!-- <td>{{notice[1]}}</td> -->
  88. <td>{{notice[2]}}</td>
  89. <td><a href="/PR_user_{{notice[3]}}" target="_blank">{{notice[3]}}</a></td>
  90. <td>{{notice[4]}}</td>
  91. <td>
  92. {% if notice[5] == 0 %}
  93. <input type="checkbox" id="notice_{{notice[0]}}_check" onclick="checkbox_check('{{notice[0]}}', '{{notice[3]}}')">
  94. {% elif notice[5] == 1 %}
  95. <input type="checkbox" id="notice_{{notice[0]}}_check" onclick="checkbox_check('{{notice[0]}}', '{{notice[3]}}')" checked>
  96. {% endif %}
  97. </td>
  98. </tr>
  99. {% endfor %}
  100. </table>
  101. {% endif%}
  102. </body>
  103. <script>
  104. function checkbox_check(NoticeNum, FormNum) {
  105. var checkbox_id = $('#notice_' + NoticeNum + '_check').prop("checked");
  106. console.log("checkbox_id: " + checkbox_id) // 勾選為 true, 取消為 false
  107. if (checkbox_id == true) {
  108. // 從空白到勾選
  109. var checkbox_confirm_true = confirm("[通知已完成]\n確定已完成 " + FormNum + " 表單, 後續不再提醒 ?")
  110. console.log("checkbox_confirm_true: " + checkbox_confirm_true)
  111. if (checkbox_confirm_true == true) {
  112. sql = 'UPDATE `通知列表` SET `已完成`="1" WHERE `通知編號`="' + NoticeNum + '"';
  113. var sql_data = { "sql":sql };
  114. console.log("sql")
  115. $.ajax({
  116. type:"GET",
  117. url:"/sql_get",
  118. dataType:"JSON",
  119. data:sql_data,
  120. async:false,
  121. success:function (res) {
  122. location.reload()
  123. },
  124. error: function (thrownError) {
  125. if (thrownError.statusText == "INTERNAL SERVER ERROR") {
  126. alert("通知 " + NoticeNum + " 勾選未成功")
  127. } else {
  128. alert("通知勾選 thrownError" + thrownError)
  129. }
  130. }
  131. })
  132. } else {
  133. $('#notice_' + NoticeNum + '_check').prop('checked', false);
  134. }
  135. } else {
  136. // // 從勾選到空白
  137. // var checkbox_confirm_false = confirm("[通知未完成]\n確定取消勾選 " + FormNum + " 表單?")
  138. // console.log("checkbox_confirm_false: " + checkbox_confirm_false)
  139. // if (checkbox_confirm_false == true) {
  140. // sql = 'UPDATE `通知列表` SET `已完成`="0" WHERE `通知編號`="' + NoticeNum + '"';
  141. // var sql_data = { "sql":sql };
  142. // console.log("sql")
  143. // $.ajax({
  144. // type:"GET",
  145. // url:"/sql_get",
  146. // dataType:"JSON",
  147. // data:sql_data,
  148. // async:false,
  149. // success:function (res) {
  150. // location.reload()
  151. // },
  152. // error: function (thrownError) {
  153. // if (thrownError.statusText == "INTERNAL SERVER ERROR") {
  154. // alert("通知 " + NoticeNum + " 取消勾選未成功")
  155. // } else {
  156. // alert("通知取消勾選 thrownError" + thrownError)
  157. // }
  158. // }
  159. // })
  160. // } else {
  161. // $('#notice_' + NoticeNum + '_check').prop('checked', true);
  162. // }
  163. }
  164. }
  165. </script>
  166. </html>