123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>{{ title }}</title>
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-
- </head>
- <script>
- var USER_NAME = '{{user_name}}'
- console.log("user_name: " + USER_NAME);
- </script>
- <style>
- .input-cond-delete {
- background: #E43030;
- border: 1px solid #CFCFCF;
- box-sizing: border-box;
- border-radius: 5px;
- margin-left: 5px;
- width: auto;
- height: 33px;
- font-size: 16px;
- text-align: center;
- line-height: 16px;
- color: #FFFFFF;
- }
- .input-cond-add {
- background: #008CBA;
- border: 1px solid #CFCFCF;
- box-sizing: border-box;
- border-radius: 5px;
- margin-left: 5px;
- width: auto;
- /* width: 65px; */
- height: 33px;
- font-size: 16px;
- text-align: center;
- line-height: 16px;
- color: #FFFFFF;
- }
- .input-cond-action {
- background: #FFBD00;
- /* #6BF178 #53DD6C #FFBD00*/
- border: 1px solid #CFCFCF;
- box-sizing: border-box;
- border-radius: 5px;
- margin-left: 5px;
- width: auto;
- height: 33px;
- font-size: 16px;
- text-align: center;
- line-height: 16px;
- color: #000000;
- font-weight: bold;
- }
- .table-tr-title {
- background-color:rgb(0, 131, 72);
- color: #FFFFFF;
- font-weight: bold;
- }
- .table-tr-data {
- background-color:rgb(236, 247, 242);
- }
- .table-tr-newdata {
- background-color:rgb(245, 245, 245);
- }
- </style>
- <body>
- <div id="ERP_header">
- <!-- 匯入共同使用的 header.html 內容 -->
- {% include 'ERP_header.html' %}
- </div>
- <center><h6 style="margin: 20px;">通知列表</h6></center>
- 目前使用者:{{user_name}}<br>
- {% if notice_list == () %}
- 無通知
- {% else %}
- <table class="table table-bordered" style="margin-top: 10px;">
- <tr>
- <!-- <th>通知對象</th> -->
- <th>日期</th>
- <th>表單單號</th>
- <th>內容</th>
- <th>已完成</th>
- </tr>
- {% for notice in notice_list %}
- <tr>
- <!-- <td>{{notice[1]}}</td> -->
- <td>{{notice[2]}}</td>
- <td><a href="/PR_user_{{notice[3]}}" target="_blank">{{notice[3]}}</a></td>
- <td>{{notice[4]}}</td>
- <td>
- {% if notice[5] == 0 %}
- <input type="checkbox" id="notice_{{notice[0]}}_check" onclick="checkbox_check('{{notice[0]}}', '{{notice[3]}}')">
- {% elif notice[5] == 1 %}
- <input type="checkbox" id="notice_{{notice[0]}}_check" onclick="checkbox_check('{{notice[0]}}', '{{notice[3]}}')" checked>
- {% endif %}
- </td>
- </tr>
- {% endfor %}
- </table>
- {% endif%}
- </body>
- <script>
- function checkbox_check(NoticeNum, FormNum) {
- var checkbox_id = $('#notice_' + NoticeNum + '_check').prop("checked");
- console.log("checkbox_id: " + checkbox_id) // 勾選為 true, 取消為 false
- if (checkbox_id == true) {
- // 從空白到勾選
- var checkbox_confirm_true = confirm("[通知已完成]\n確定已完成 " + FormNum + " 表單, 後續不再提醒 ?")
- console.log("checkbox_confirm_true: " + checkbox_confirm_true)
- if (checkbox_confirm_true == true) {
- sql = 'UPDATE `通知列表` SET `已完成`="1" WHERE `通知編號`="' + NoticeNum + '"';
- var sql_data = { "sql":sql };
- console.log("sql")
- $.ajax({
- type:"GET",
- url:"/sql_get",
- dataType:"JSON",
- data:sql_data,
- async:false,
- success:function (res) {
- location.reload()
- },
- error: function (thrownError) {
- if (thrownError.statusText == "INTERNAL SERVER ERROR") {
- alert("通知 " + NoticeNum + " 勾選未成功")
- } else {
- alert("通知勾選 thrownError" + thrownError)
- }
- }
- })
- } else {
- $('#notice_' + NoticeNum + '_check').prop('checked', false);
- }
- } else {
- // // 從勾選到空白
- // var checkbox_confirm_false = confirm("[通知未完成]\n確定取消勾選 " + FormNum + " 表單?")
- // console.log("checkbox_confirm_false: " + checkbox_confirm_false)
- // if (checkbox_confirm_false == true) {
- // sql = 'UPDATE `通知列表` SET `已完成`="0" WHERE `通知編號`="' + NoticeNum + '"';
- // var sql_data = { "sql":sql };
- // console.log("sql")
- // $.ajax({
- // type:"GET",
- // url:"/sql_get",
- // dataType:"JSON",
- // data:sql_data,
- // async:false,
- // success:function (res) {
- // location.reload()
- // },
- // error: function (thrownError) {
- // if (thrownError.statusText == "INTERNAL SERVER ERROR") {
- // alert("通知 " + NoticeNum + " 取消勾選未成功")
- // } else {
- // alert("通知取消勾選 thrownError" + thrownError)
- // }
- // }
- // })
- // } else {
- // $('#notice_' + NoticeNum + '_check').prop('checked', true);
- // }
- }
- }
- </script>
- </html>
|