8 changed files with 1226 additions and 0 deletions
@ -0,0 +1,61 @@ |
|||
<?php |
|||
require_once "database.php"; |
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
$do_ins = true; |
|||
$input = &$_POST; |
|||
$data = array_reduce(array( |
|||
"facilityno", "sitename", "siteaddress", "ngdescribe", "creater" |
|||
), function ($acc, $key) use ($input) { |
|||
switch ($key) { |
|||
default: |
|||
$acc[$key] = htmlspecialchars(stripslashes(trim($input[$key]))); |
|||
} |
|||
return $acc; |
|||
}, array("create_at" => date("Y-m-d H:i:s"))); |
|||
|
|||
if ($_FILES) { |
|||
$upd_base_path = "/wms/ngfeedback-uploads"; |
|||
if (!is_dir($_SERVER["DOCUMENT_ROOT"] . "/" . $upd_base_path)) { |
|||
mkdir($_SERVER["DOCUMENT_ROOT"] . "/" . $upd_base_path, 0777, true); |
|||
} |
|||
// file_put_contents("./izumi_debug.log", print_r($_FILES, true)."\r\n", FILE_APPEND); |
|||
if ($_FILES["ngimage"]["error"] == UPLOAD_ERR_OK) { |
|||
# 將檔案移至指定位置 |
|||
$data["ngimage"] = $upd_base_path . "/" . implode("__", array($data["facilityno"], strtotime($data["create_at"]))) . "." . pathinfo($_FILES["ngimage"]["name"], PATHINFO_EXTENSION); |
|||
move_uploaded_file($_FILES["ngimage"]["tmp_name"], $_SERVER["DOCUMENT_ROOT"] . "/" . $data["ngimage"]); |
|||
} else { |
|||
$do_ins = false; |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增失敗,請重新操作[F]')"; |
|||
echo "</script>"; |
|||
} |
|||
} |
|||
if ($do_ins) { |
|||
$db_query = sprintf("INSERT INTO ngfeedback (%s) VALUES (%s)", |
|||
implode(",", array_keys($data)), |
|||
implode(",", array_fill(0, count($data), "?"))); |
|||
$stmt = $link->prepare($db_query); |
|||
// 此處僅有字串格式 |
|||
$stmt->bind_param(implode("", array_fill(0, count($data), "s")), ...array_values($data)); |
|||
$stmt->execute(); |
|||
if ($mid = mysqli_insert_id($link)) { |
|||
// header("Location: ); |
|||
if (mysqli_affected_rows($link) > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "window.location.href='/wms/ngfeedback-index.php?function_name=ngfeedback&token=".$_POST["token"]."';"; |
|||
echo "</script>"; |
|||
//header("Location: pricereview-index.php"); |
|||
} else { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增失敗,請重新操作[I]')"; |
|||
echo "</script>"; |
|||
} |
|||
} else { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增失敗,請重新操作[M]')"; |
|||
echo "</script>"; |
|||
} |
|||
} |
|||
} |
|||
?> |
@ -0,0 +1,157 @@ |
|||
<?php |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
|
|||
include "ngfeedback-create-submit.php"; |
|||
?> |
|||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.7/dist/css/autoComplete.02.min.css"> |
|||
<style> |
|||
select, textarea { |
|||
margin: 8px 0; |
|||
} |
|||
.autoComplete_wrapper { width: 100%; } |
|||
.autoComplete_wrapper > input, |
|||
input[type=file] + .img-preview, |
|||
input[type=file], textarea { |
|||
width: 100%; |
|||
padding: 12px 20px; |
|||
margin: 8px 0; |
|||
display: block; |
|||
border: 1px solid #ccc; |
|||
border-radius: 4px; |
|||
box-sizing: border-box; |
|||
font-size: inherit; |
|||
height: auto; |
|||
} |
|||
.img-preview { |
|||
position: relative; |
|||
background-color: var(--bs-white, #fff); |
|||
} |
|||
.img-preview > .btn-icon { |
|||
position: absolute; |
|||
top: 1px; |
|||
right: 1px; |
|||
font-weight: 600; |
|||
cursor: pointer; |
|||
} |
|||
.btn-icon > svg { |
|||
width: 32px; |
|||
height: 32px; |
|||
} |
|||
.autoComplete_wrapper > ul[role=listbox] { |
|||
margin-top: -12px; |
|||
} |
|||
input[type=file][accept^=image].preview { |
|||
display: none; |
|||
} |
|||
input[type=file][accept^=image]:not(.preview) + .img-preview { |
|||
display: none; |
|||
} |
|||
</style> |
|||
<div class="container"> |
|||
<form role="form" class="form-horizontal" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<input type="hidden" name="token" value="<?=$token;?>"> |
|||
<input type="hidden" name="creater" value="<?=$user_id;?>"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="facilityno">電梯ID</label> |
|||
<input type="text" name="facilityno" id="facilityno" maxlength="15" required> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="sitename">現場名稱</label> |
|||
<input type="text" name="sitename" id="sitename" maxlength="20"> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="siteaddress">現場地址</label> |
|||
<input type="text" name="siteaddress" id="siteaddress" maxlength="255" required> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="ngdescribe">簡述不良內容</label> |
|||
<textarea name="ngdescribe" id="ngdescribe" rows="4" maxlength="128" required></textarea> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="ngimage">照片上傳</label> |
|||
<input type="file" name="ngimage" id="ngimage" accept="image/*" required> |
|||
<div id="ngimage-preview" class="img-preview"> |
|||
<img src="#" alt="preview image" style="margin: 0 auto; width: 100%; height: auto; border-radius: 0; float: none;"/> |
|||
<i class="btn-icon bi bi-x-square-fill" data-pid="ngimage" alt="移除照片" role="button" onclick="javascript:image_remove(this)" style="color: var(--bs-red, #dc3545);"> |
|||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-square-fill" viewBox="0 0 16 16"> |
|||
<path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm3.354 4.646L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 1 1 .708-.708z"/> |
|||
</svg> |
|||
</i> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-12 "> |
|||
<button type="submit" class="btn btn-primary btn-lg">點擊後建立不良反饋單</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.7/dist/autoComplete.min.js"></script> |
|||
<script> |
|||
function image_preview (event) { |
|||
var input = event.target; |
|||
var image = document.querySelector(`#${input.id}-preview > img`); |
|||
if (input.files && input.files[0]) { |
|||
var reader = new FileReader(); |
|||
reader.onload = function(e) { |
|||
image.src = e.target.result; |
|||
$(`#${input.id}`).addClass("preview"); |
|||
} |
|||
reader.readAsDataURL(input.files[0]); |
|||
return; |
|||
} |
|||
$(`#${input.id}`).removeClass("preview"); |
|||
} |
|||
function image_remove (el) { |
|||
var pid = $(el).attr("data-pid"); |
|||
var input = document.querySelector(`input#${pid}`); |
|||
input.value = ""; |
|||
$(`#${pid}`).removeClass("preview"); |
|||
} |
|||
$(function() { |
|||
$("#ngimage").on("change", function (event) { |
|||
image_preview(event); |
|||
}).trigger("change"); |
|||
|
|||
const autoCompleteJS = new autoComplete({ |
|||
selector: "#facilityno", |
|||
data: { |
|||
src: async () => { |
|||
if (!autoCompleteJS.input.value || autoCompleteJS.input.value.length < 2) { |
|||
return []; |
|||
} |
|||
try { |
|||
const source = await fetch('/wms/ngfeedbackapi.php?' + new URLSearchParams({ |
|||
type: "facilityno", |
|||
term: autoCompleteJS.input.value, |
|||
rn: 10, |
|||
})); |
|||
const data = await source.json(); |
|||
return data.data; |
|||
} catch (error) { |
|||
return error; |
|||
} |
|||
}, |
|||
keys: ["facilityno", "address"], |
|||
}, |
|||
resultItem: { |
|||
highlight: false |
|||
}, |
|||
events: { |
|||
input: { |
|||
selection: (event) => { |
|||
const selection = event.detail.selection.value; |
|||
autoCompleteJS.input.value = selection["facilityno"]; |
|||
$("#siteaddress").val(selection["address"]); |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
</script> |
|||
<?php |
|||
include "footer.php"; |
|||
?> |
@ -0,0 +1,455 @@ |
|||
<?php |
|||
include "header.php"; |
|||
$depart_id = accountidToDepartId($user_id); |
|||
|
|||
$dt_setup = array( |
|||
"columns" => array( |
|||
array( |
|||
"key" => "SEQ", |
|||
"field" => "id", |
|||
"label" => "項次", |
|||
"style" => "", |
|||
"width" => "60", |
|||
), |
|||
array( |
|||
"key" => "create_at", |
|||
"field" => "create_at", |
|||
"label" => "反饋日期", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
array( |
|||
"key" => "facilityno", |
|||
"field" => "facilityno", |
|||
"label" => "電梯編號", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
array( |
|||
"key" => "onsite_name", |
|||
"field" => "sitename", |
|||
"label" => "現場名稱", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
array( |
|||
"key" => "onsite_address", |
|||
"field" => "siteaddress", |
|||
"label" => "現場地址", |
|||
"style" => "", |
|||
"width" => "180", |
|||
), |
|||
array( |
|||
"key" => "creater", |
|||
"field" => "creater", |
|||
"label" => "不良單填單人員", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
array( |
|||
"key" => "describe", |
|||
"field" => "ngdescribe", |
|||
"label" => "簡述不良內容", |
|||
"style" => "", |
|||
"width" => "180", |
|||
), |
|||
array( |
|||
"key" => "ngimage", |
|||
"field" => "ngimage", |
|||
"label" => "照片上傳", |
|||
"style" => "", |
|||
"width" => "180", |
|||
), |
|||
array( |
|||
"key" => "verify", |
|||
"field" => "verify", |
|||
"label" => "品證人員", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
array( |
|||
"key" => "investigation_reason", |
|||
"field" => "investigationreason", |
|||
"label" => "現場調查原因", |
|||
"style" => "", |
|||
"width" => "180", |
|||
), |
|||
array( |
|||
"key" => "countermeasure", |
|||
"field" => "countermeasure", |
|||
"label" => "對策方式及再發防止", |
|||
"style" => "", |
|||
"width" => "180", |
|||
), |
|||
array( |
|||
"key" => "responsible_depart", |
|||
"field" => "responsibledepartment", |
|||
"label" => "判定責任單位", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
array( |
|||
"key" => "responsible_depart_leader", |
|||
"field" => "responsibledepartmentleader", |
|||
"label" => "責任單位主管", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
array( |
|||
"key" => "responsible_depart_responder", |
|||
"field" => "responder", |
|||
"label" => "責任單位回覆人", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
array( |
|||
"key" => "progress", |
|||
"field" => "progress", |
|||
"label" => "處理進度", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
array( |
|||
"key" => "reply_time", |
|||
"field" => "reply_at", |
|||
"label" => "回覆時間", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
array( |
|||
"key" => "reply_history", |
|||
"field" => "replyhistory", |
|||
"label" => "責任單位回覆", |
|||
"style" => "", |
|||
"width" => "360", |
|||
), |
|||
array( |
|||
"key" => "update_time", |
|||
"field" => "update_at", |
|||
"label" => "更新時間", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
array( |
|||
"key" => "reviewresult", |
|||
"field" => "reviewresult", |
|||
"label" => "判定結果", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
array( |
|||
"key" => "responsiblesupplier", |
|||
"field" => "responsiblesupplier", |
|||
"label" => "責任供應商", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
array( |
|||
"key" => "closer", |
|||
"field" => "closer", |
|||
"label" => "結案人員", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
array( |
|||
"key" => "close_time", |
|||
"field" => "close_at", |
|||
"label" => "結案時間", |
|||
"style" => "", |
|||
"width" => "120", |
|||
), |
|||
), |
|||
"datas" => array() |
|||
); |
|||
|
|||
$progress = array( |
|||
"0" => "待判定", |
|||
"1" => "待處理", |
|||
"2" => "處理中", |
|||
"9" => "已完成" |
|||
); |
|||
|
|||
$result = array( |
|||
"N" => "判定不良品", |
|||
"G" => "判定良品" |
|||
); |
|||
|
|||
$sql = "select *, |
|||
f_return_account_name(verify) as verify_name, |
|||
f_return_account_name(creater) as creater_name, |
|||
f_return_account_name(responsibledepartmentleader) as responsibledepartmentleader_name, |
|||
f_return_account_name(responder) as responder_name, |
|||
f_return_account_name(closer) as closer_name, |
|||
f_return_department_name(responsibledepartment) as responsibledepartment_name |
|||
from ngfeedback order by id desc"; |
|||
$rtn = mysqli_query($link, $sql); |
|||
$dt_setup["datas"] = mysqli_fetch_all($rtn, MYSQLI_ASSOC); |
|||
|
|||
// 結束連線 |
|||
mysqli_close($link); |
|||
if ($user_auth&2) { |
|||
?> |
|||
<p><a href="ngfeedback-create.php?function_name=ngfeedback&<?php echo $token_link; ?>" class="btn btn-info btn-sm" style="margin-left: 12px"> <span class="glyphicon glyphicon-plus"></span></a></p> |
|||
<?php |
|||
} |
|||
?> |
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
.dataTables_scrollHead .dataTable { |
|||
margin-bottom: -2px; |
|||
} |
|||
.dataTables_scrollBody .dataTable { |
|||
margin-bottom: 0; |
|||
} |
|||
td[key=ngimage] > img { |
|||
width: 163px; |
|||
} |
|||
.middle-center { |
|||
position: absolute; |
|||
top: 50%; |
|||
left: 50%; |
|||
transform: translate(-50%,-50%); |
|||
transform-origin:50% 50%; |
|||
text-align: center; |
|||
} |
|||
#dialog_pic { |
|||
position: fixed; |
|||
top: 0; |
|||
left: 0; |
|||
width: 100vw; |
|||
height: 100vh; |
|||
background: rgba(0, 0, 0, 0.65); |
|||
z-index: 99; |
|||
display: none; |
|||
} |
|||
#dialog_pic > .dialog-body { |
|||
width: auto; |
|||
max-width: 96%; |
|||
max-height: 96%; |
|||
padding: 12px; |
|||
background: var(--bs-white, #fff); |
|||
border-radius: 6px; |
|||
overflow: auto; |
|||
} |
|||
#dialog_pic > .dialog-body > img { |
|||
width: 100%; |
|||
height: 100%; |
|||
object-fit: contain; |
|||
} |
|||
td[key=reply_history] > div { |
|||
white-space: pre-line; |
|||
} |
|||
@media screen and (max-width: 600px) { |
|||
|
|||
table { |
|||
border: 0; |
|||
} |
|||
|
|||
table thead { |
|||
display: none; |
|||
} |
|||
|
|||
table tr { |
|||
margin-bottom: 10px; |
|||
display: block; |
|||
border-bottom: 2px solid #ddd; |
|||
} |
|||
|
|||
table td { |
|||
display: block; |
|||
text-align: right; |
|||
font-size: 14px; |
|||
border-bottom: 1px dotted #ccc; |
|||
width: 100%; |
|||
min-height: 36px; |
|||
} |
|||
|
|||
table td:last-child { |
|||
border-bottom: 0; |
|||
} |
|||
|
|||
table td:before { |
|||
content: attr(data-label); |
|||
float: left; |
|||
text-transform: uppercase; |
|||
font-weight: bold; |
|||
} |
|||
|
|||
#dialog_pic > .dialog-body { |
|||
width: 100%; |
|||
} |
|||
} |
|||
</style> |
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" class="table table-striped table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<?php |
|||
foreach ($dt_setup["columns"] as $col) { |
|||
echo "<th key='".$col["key"]."' width='".$col["width"]."' style='".$col["style"]."'>".$col["label"]."</th>"; |
|||
} |
|||
?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php |
|||
foreach($dt_setup["datas"] as $row) { |
|||
echo "<tr>"; |
|||
foreach ($dt_setup["columns"] as $col) { |
|||
echo "<td key='".$col["key"]."' width='".$col["width"]."' data-label='".$col["label"]."' style='".$col["style"]."'>"; |
|||
switch ($col["field"]) { |
|||
case "ngimage": |
|||
echo "<img class='image-fluid result_pics zoom' src='..".$row[$col["field"]]."'/>"; |
|||
break; |
|||
case "reviewresult": |
|||
if (!$row["reviewresult"] && $row["progress"] == "9" && in_array($depart_id, array("220", "912"))) { |
|||
echo "<a href=\"ngfeedback-update.php?function_name=ngfeedback&no=".$row["id"]."&$token_link\" class='btn btn-info btn-sm'><span style='font-size: 1.125em; font-weight: 600;'>品證人員填寫</span></a>"; |
|||
break; |
|||
} |
|||
case "verify": |
|||
if ($col["field"] == "verify" && !$row["verify"] && in_array($depart_id, array("220", "912"))) { |
|||
echo "<a href=\"ngfeedback-update.php?function_name=ngfeedback&no=".$row["id"]."&$token_link\" class='btn btn-info btn-sm'><span style='font-size: 1.125em; font-weight: 600;'>品證人員填寫</span></a>"; |
|||
break; |
|||
} |
|||
case "responder": |
|||
if (!in_array($row["progress"], array("0", "9")) && $col["field"] == "responder" && $row["responder"] && ($depart_id == "220" || $row["responder"] == $user_id)) { |
|||
echo "<a href=\"ngfeedback-update-reply.php?function_name=ngfeedback&no=".$row["id"]."&$token_link\" class='btn btn-info btn-sm'><span style='font-size: 1.125em; font-weight: 600;'>".$row["responder"]." 填寫</span></a>"; |
|||
break; |
|||
} |
|||
default: |
|||
if (in_array($col["field"], array("creater", "verify", "responsibledepartmentleader", "responsibledepartment", "responder", "closer"))) { |
|||
echo "<div>".implode(" ", array($row[$col["field"]], $row[$col["field"]."_name"]))."</div>"; |
|||
} else if ($col["field"] == "progress" && isset($progress[$row[$col["field"]]])) { |
|||
echo "<div data-progress='".$row[$col["field"]]."'>".$progress[$row[$col["field"]]]."</div>"; |
|||
} else if ($col["field"] == "reviewresult" && isset($result[$row[$col["field"]]])) { |
|||
echo "<div data-result='".$row[$col["field"]]."'>".$result[$row[$col["field"]]]."</div>"; |
|||
} else { |
|||
echo "<div>".$row[$col["field"]]."</div>"; |
|||
} |
|||
} |
|||
echo "</td>"; |
|||
} |
|||
echo "</tr>"; |
|||
} |
|||
?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<div id="dialog_pic"> |
|||
<div class="dialog-body middle-center"> |
|||
<img src="#" style="width: 100%; height: auto;"/> |
|||
</div> |
|||
</div> |
|||
<script> |
|||
var searchContent = ""; |
|||
var showNum = 10; |
|||
var nowPage = 1; |
|||
|
|||
var table = $('#table_index').DataTable({ |
|||
"scrollX": true, |
|||
/* |
|||
"language": { |
|||
"emptyTable": "無資料...", |
|||
"processing": "處理中...", |
|||
"loadingRecords": "載入中...", |
|||
"lengthMenu": "顯示_MENU_ 筆", |
|||
"zeroRecords": "沒有符合的結果", |
|||
"info": "第 _START_ 至 _END_ 項,共 _TOTAL_ 項", |
|||
"infoEmpty": "第 0 至 0 項,共 0 項", |
|||
"infoFiltered": "(從 _MAX_ 項結果中過濾)", |
|||
"infoPostFix": "", |
|||
"search": "", |
|||
"paginate": { |
|||
"first": "第一頁", |
|||
"previous": "上一頁", |
|||
"next": "下一頁", |
|||
"last": "最後一頁" |
|||
}, |
|||
"aria": { |
|||
"sortAscending": ": 升冪排列", |
|||
"sortDescending": ": 降冪排列" |
|||
} |
|||
} |
|||
*/ |
|||
}, { |
|||
"order": [ |
|||
[4, "desc"], |
|||
[8, "asc"] |
|||
] |
|||
}); |
|||
|
|||
// var table = $('#table_index').DataTable(); |
|||
table.search(searchContent).draw(); |
|||
table.page.len(showNum).draw(); |
|||
table.page((nowPage) - 1).draw('page'); |
|||
|
|||
// 監聽頁碼 |
|||
table.on('page.dt', function() { |
|||
searchDatatable(table); |
|||
}); |
|||
|
|||
// 監聽資料筆數 |
|||
table.on('length.dt', function(e, settings, len) { |
|||
searchDatatable(table); |
|||
}); |
|||
|
|||
// 監聽搜尋事件 |
|||
$("#table_index_filter > label > input").change(function() { |
|||
searchDatatable(table); |
|||
}); |
|||
|
|||
function searchDatatable(table) { |
|||
showNum = table.page.len(); |
|||
nowPage = table.page.info().page + 1; |
|||
searchContent = table.search(); |
|||
/* |
|||
window.location.href = "<?php echo "wipwhole-index.php?function_name=wipinstall&$token_link"; ?>" + |
|||
"&showNum=" + showNum + "&nowPage=" + nowPage + "&searchContent=" + searchContent + "&sheetNum=" + sheetNum + |
|||
"&contractno=" + contractno + "&facilityno=" + facilityno + "&custom=" + custom + |
|||
"&site_survey_contact_verify=" + site_survey_contact_verify + "&real_contract_arrival_date_start=" + real_contract_arrival_date_start + |
|||
"&real_contract_arrival_date_end=" + real_contract_arrival_date_end + "&area_no=" + area_no; |
|||
*/ |
|||
} |
|||
|
|||
$(function() { |
|||
$('img.zoom').on('click', function() { |
|||
$('#dialog_pic img').attr("src", $(this).attr("src")); |
|||
$('#dialog_pic').show(); |
|||
}); |
|||
// 点击显示的大图,触发事件,当触发当前页面内里任何处位置,就会隐藏显示的大图 |
|||
$('#dialog_pic').on('click', function() { |
|||
$(this).hide(); |
|||
}); |
|||
}); |
|||
</script> |
@ -0,0 +1,45 @@ |
|||
<?php |
|||
require_once "database.php"; |
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
$input = &$_POST; |
|||
$data = array_reduce(array( |
|||
"responder", "progress", "replyinput" |
|||
), function ($acc, $key) use ($input) { |
|||
switch ($key) { |
|||
default: |
|||
$acc[$key] = htmlspecialchars(stripslashes(trim($input[$key]))) ?: null; |
|||
} |
|||
return $acc; |
|||
}, array()); |
|||
|
|||
$db_query = "UPDATE ngfeedback as ng |
|||
INNER JOIN ( |
|||
SELECT |
|||
? as id, |
|||
? as responder, |
|||
? as progress, |
|||
CONCAT(f_return_account_name(?), '(', ?, ') ', ?) as replyinput, |
|||
CURRENT_TIMESTAMP as reply_at |
|||
) as reply ON reply.id = ng.id |
|||
SET |
|||
ng.responder = reply.responder, |
|||
ng.replyhistory = CONCAT(IFNULL(ng.replyhistory, ''), IF(ng.replyhistory IS NULL, '', CHAR(10)), '[', reply.reply_at, '] ', reply.replyinput), |
|||
ng.reply_at = reply.reply_at, |
|||
ng.progress = reply.progress"; |
|||
$stmt = $link->prepare($db_query); |
|||
$stmt->bind_param("isisss", $_POST["no"], $data["responder"], $data["progress"], $_POST["user_id"], $_POST["user_id"], $data["replyinput"]); |
|||
$stmt->execute(); |
|||
|
|||
if (mysqli_affected_rows($link) > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('更新成功');"; |
|||
echo "window.location.href='/wms/ngfeedback-index.php?function_name=ngfeedback&token=".$_POST["token"]."';"; |
|||
echo "</script>"; |
|||
//header("Location: pricereview-index.php"); |
|||
} else { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('更新失敗,請重新操作[I]')"; |
|||
echo "</script>"; |
|||
} |
|||
} |
|||
?> |
@ -0,0 +1,170 @@ |
|||
<?php |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
|
|||
include "ngfeedback-update-reply-submit.php"; |
|||
|
|||
$db_query = "SELECT *, |
|||
f_return_account_name(verify) as verify_name, |
|||
f_return_account_name(creater) as creater_name, |
|||
f_return_account_name(responsibledepartmentleader) as responsibledepartmentleader_name, |
|||
f_return_department_name(responsibledepartment) as responsibledepartment_name |
|||
FROM ngfeedback WHERE id = ?"; |
|||
$stmt = $link->prepare($db_query); |
|||
// 此處僅有字串格式 |
|||
$stmt->bind_param("i", ...[$_REQUEST["no"]]); |
|||
$stmt->execute(); |
|||
$result = $stmt->get_result(); |
|||
$data = mysqli_fetch_assoc($result); |
|||
|
|||
$db_query = "SELECT accountid, name FROM account |
|||
WHERE accounttype NOT IN ('A', 'X') AND department_id = ?"; |
|||
$stmt = $link->prepare($db_query); |
|||
// 此處僅有字串格式 |
|||
$stmt->bind_param("i", ...[$data["responsibledepartment"]]); |
|||
$stmt->execute(); |
|||
$result = $stmt->get_result(); |
|||
$opts = mysqli_fetch_all($result, MYSQLI_ASSOC); |
|||
?> |
|||
<style> |
|||
select, textarea { |
|||
margin: 8px 0; |
|||
} |
|||
div.input-style, textarea { |
|||
width: 100%; |
|||
padding: 12px 20px; |
|||
margin: 8px 0; |
|||
display: block; |
|||
border: 1px solid #ccc; |
|||
border-radius: 4px; |
|||
box-sizing: border-box; |
|||
background: var(--bs-white, #fff); |
|||
white-space: pre; |
|||
} |
|||
div.input-style:empty:after { |
|||
content: " "; |
|||
} |
|||
</style> |
|||
<div class="container"> |
|||
<form role="form" class="form-horizontal" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<input type="hidden" name="token" value="<?=$token;?>"> |
|||
<input type="hidden" name="user_id" value="<?=$user_id;?>"> |
|||
<input type="hidden" name="no" value="<?=$data["id"];?>"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="responder">責任單位回覆人</label> |
|||
<select name="responder" id="responder" <?echo $data["responsibledepartmentleader"] == $user_id ? "" : "readonly";?>required > |
|||
<?php |
|||
foreach ($opts as $opt) { |
|||
echo "<option value='".$opt["accountid"]."' ".($opt["accountid"] == $data["responder"] ? 'selected' : '').">".sprintf("%s (%s)", $opt["name"], $opt["accountid"])."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="progress">處理狀態</label> |
|||
<select name="progress" id="progress"> |
|||
<?php |
|||
foreach (array( |
|||
"1" => "待處理", |
|||
"2" => "處理中", |
|||
"9" => "已完成" |
|||
) as $val => $text) { |
|||
echo sprintf("<option value='%d' %s>%s</option>", $val, ($data["progress"] == $val ? "selected" : ""), $text); |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-6"> |
|||
<label for="replyhistory">回覆詳細</label> |
|||
<textarea class="input-style" id="replyhistory" rows="6" style="resize: none;" disabled><?=$data["replyhistory"]?></textarea> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="replyinput">責任單位回覆</label> |
|||
<textarea name="replyinput" id="replyinput" rows="6" maxlength="64" style="resize: none;" required></textarea> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-12"> |
|||
<button type="submit" class="btn btn-primary btn-lg">點擊後更新不良反饋單</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<div class="container"> |
|||
<form role="form" class="form-horizontal" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<h3 style="font-weight: 700;">品證部門回覆</h3> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="verify">品證人員</label> |
|||
<div class="input-style" id="verify"><?=implode(" ", array($data["verify"], $data["verify_name"]))?></div> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="responsibledepartment">判定責任單位</label> |
|||
<div class="input-style" id="responsibledepartment"><?=$data["responsibledepartment_name"]?></div> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="responsibledepartmentleader">判定責任單位主管</label> |
|||
<div class="input-style" id="responsibledepartmentleader"><?=implode(" ", array($data["responsibledepartmentleader"], $data["responsibledepartmentleader_name"]))?></div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-6"> |
|||
<label for="investigationreason">現場調查原因</label> |
|||
<textarea class="input-style" id="investigationreason" rows="6" maxlength="128" style="resize: none;" disabled><?=$data["investigationreason"]?></textarea> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="countermeasure">對策方法及再發防止</label> |
|||
<textarea class="input-style" id="countermeasure" rows="6" maxlength="128" style="resize: none;" disabled><?=$data["countermeasure"]?></textarea> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<div class="container"> |
|||
<form role="form" class="form-horizontal" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<h3 style="font-weight: 700;">不良單基本資料</h3> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="id">項次</label> |
|||
<div class="input-style" id="id"><?=$data["id"]?></div> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="create_at">反饋日期</label> |
|||
<div class="input-style" id="create_at"><?=$data["create_at"]?></div> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="creater">不良單填寫人</label> |
|||
<div class="input-style" id="creater"><?=implode(" ", array($data["creater"], $data["creater_name"]))?></div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="facilityno">電梯ID</label> |
|||
<div class="input-style" id="facilityno"><?=$data["facilityno"]?></div> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="sitename">現場名稱</label> |
|||
<div class="input-style" id="sitename"><?=$data["sitename"]?></div> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="siteaddress">現場地址</label> |
|||
<div class="input-style" id="siteaddress"><?=$data["siteaddress"]?></div> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="ngdescribe">簡述不良內容</label> |
|||
<textarea class="input-style" id="ngdescribe" rows="6" maxlength="128" style="resize: none;" disabled><?=$data["ngdescribe"]?></textarea> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="ngimage">照片上傳</label> |
|||
<div class="input-style" id="ngimage"><?php echo $data["ngimage"] ? "<img src='..".$data["ngimage"]."' style='margin: 0 auto; width: 100%; height: auto; border-radius: 0; float: none;'/>" : "";?></div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
|
@ -0,0 +1,92 @@ |
|||
<?php |
|||
require_once "database.php"; |
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
$input = &$_POST; |
|||
if ($input["progress"] == "9") { |
|||
$data = array_reduce(array( |
|||
"reviewresult", "responsiblesupplier", "closer" |
|||
), function ($acc, $key) use ($input) { |
|||
switch ($key) { |
|||
default: |
|||
$acc[$key] = htmlspecialchars(stripslashes(trim($input[$key]))) ?: null; |
|||
} |
|||
return $acc; |
|||
}, array("close_at" => date("Y-m-d H:i:s"))); |
|||
|
|||
$db_query = sprintf("UPDATE ngfeedback SET %s WHERE id = ?", |
|||
implode(",", array_map( |
|||
function ($_k) { |
|||
return sprintf("%s = ?", $_k); |
|||
}, array_keys($data) |
|||
) |
|||
)); |
|||
$stmt = $link->prepare($db_query); |
|||
// 此處僅有字串格式 |
|||
$stmt->bind_param(implode("", array_fill(0, count($data) + 1, "s")), ...array_values(array_merge($data, array("id" => $_POST["no"])))); |
|||
$stmt->execute(); |
|||
if (mysqli_affected_rows($link) > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('更新成功');"; |
|||
echo "window.location.href='/wms/ngfeedback-index.php?function_name=ngfeedback&token=".$_POST["token"]."';"; |
|||
echo "</script>"; |
|||
//header("Location: pricereview-index.php"); |
|||
} else { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('更新失敗,請重新操作[I]')"; |
|||
echo "</script>"; |
|||
} |
|||
} else { |
|||
$data = array_reduce(array( |
|||
"responsibledepartment", "investigationreason", "countermeasure", "verify" |
|||
), function ($acc, $key) use ($input) { |
|||
switch ($key) { |
|||
default: |
|||
$acc[$key] = htmlspecialchars(stripslashes(trim($input[$key]))) ?: null; |
|||
} |
|||
return $acc; |
|||
}, array("progress" => "1", "update_at" => date("Y-m-d H:i:s"))); |
|||
|
|||
if ($data["responsibledepartment"]) { |
|||
$db_query = "SELECT accountid FROM account WHERE department_id = ? ORDER BY role_id ASC, create_at DESC LIMIT 0 , 1"; |
|||
$stmt = $link->prepare($db_query); |
|||
// 此處僅有字串格式 |
|||
$stmt->bind_param("s", $data["responsibledepartment"]); |
|||
$stmt->execute(); |
|||
$result = $stmt->get_result(); |
|||
$uarr = mysqli_fetch_assoc($result); |
|||
$data["responsibledepartmentleader"] = isset($uarr["accountid"]) ? $uarr["accountid"] : null; |
|||
// 責任單位回覆人預設主管 |
|||
$data["responder"] = isset($uarr["accountid"]) ? $uarr["accountid"] : null; |
|||
} |
|||
|
|||
if ($data["responsibledepartmentleader"]) { |
|||
$db_query = sprintf("UPDATE ngfeedback SET %s WHERE id = ?", |
|||
implode(",", array_map( |
|||
function ($_k) { |
|||
return sprintf("%s = ?", $_k); |
|||
}, array_keys($data) |
|||
) |
|||
)); |
|||
$stmt = $link->prepare($db_query); |
|||
// 此處僅有字串格式 |
|||
$stmt->bind_param(implode("", array_fill(0, count($data) + 1, "s")), ...array_values(array_merge($data, array("id" => $_POST["no"])))); |
|||
$stmt->execute(); |
|||
if (mysqli_affected_rows($link) > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('更新成功');"; |
|||
echo "window.location.href='/wms/ngfeedback-index.php?function_name=ngfeedback&token=".$_POST["token"]."';"; |
|||
echo "</script>"; |
|||
//header("Location: pricereview-index.php"); |
|||
} else { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('更新失敗,請重新操作[I]')"; |
|||
echo "</script>"; |
|||
} |
|||
} else { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('更新失敗,請重新操作[L]')"; |
|||
echo "</script>"; |
|||
} |
|||
} |
|||
} |
|||
?> |
@ -0,0 +1,222 @@ |
|||
<?php |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
|
|||
include "ngfeedback-update-submit.php"; |
|||
|
|||
$db_query = "SELECT *, |
|||
f_return_account_name(verify) as verify_name, |
|||
f_return_account_name(creater) as creater_name, |
|||
f_return_account_name(responsibledepartmentleader) as responsibledepartmentleader_name, |
|||
f_return_account_name(responder) as responder_name, |
|||
f_return_department_name(responsibledepartment) as responsibledepartment_name |
|||
FROM ngfeedback WHERE id = ?"; |
|||
$stmt = $link->prepare($db_query); |
|||
// 此處僅有字串格式 |
|||
$stmt->bind_param("i", ...[$_REQUEST["no"]]); |
|||
$stmt->execute(); |
|||
$result = $stmt->get_result(); |
|||
$data = mysqli_fetch_assoc($result); |
|||
|
|||
$progress = array( |
|||
"0" => "待判定", |
|||
"1" => "待處理", |
|||
"2" => "處理中", |
|||
"9" => "已完成" |
|||
); |
|||
?> |
|||
<style> |
|||
select, textarea { |
|||
margin: 8px 0; |
|||
} |
|||
div.input-style, textarea { |
|||
width: 100%; |
|||
padding: 12px 20px; |
|||
margin: 8px 0; |
|||
display: block; |
|||
border: 1px solid #ccc; |
|||
border-radius: 4px; |
|||
box-sizing: border-box; |
|||
background: var(--bs-white, #fff); |
|||
white-space: pre; |
|||
} |
|||
div.input-style:empty:after { |
|||
content: " "; |
|||
} |
|||
</style> |
|||
<?php if ($data["progress"] == "9") { // determination ?>
|
|||
<div class="container"> |
|||
<form role="form" class="form-horizontal" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<input type="hidden" name="token" value="<?=$token;?>"> |
|||
<input type="hidden" name="closer" value="<?=$user_id;?>"> |
|||
<input type="hidden" name="progress" value="<?=$data["progress"];?>"> |
|||
<input type="hidden" name="no" value="<?=$data["id"];?>"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<h3 style="font-weight: 700;">審查結果填寫</h3> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="reviewresult">審查判定結果</label> |
|||
<select id="reviewresult" name="reviewresult"> |
|||
<option value="N">判定不良品</option> |
|||
<option value="G">判定良品</option> |
|||
</select> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="responsiblesupplier">責任供應商</label> |
|||
<input type="text" name="responsiblesupplier" id="responsiblesupplier" maxlength="20" placeholder="ex: 永佳捷科技"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-12"> |
|||
<button type="submit" class="btn btn-primary btn-lg">點擊後結束不良反饋單</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<div class="container"> |
|||
<form role="form" class="form-horizontal" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<h3 style="font-weight: 700;">責任單位回覆</h3> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="responder">責任單位回覆人</label> |
|||
<div class="input-style" id="responder"><?=implode(" ", array($data["responder"], $data["responder_name"]))?></div> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="progress">處理狀態</label> |
|||
<div class="input-style" id="progress"><?=$progress[$data["progress"]]?></div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-12"> |
|||
<label for="replyhistory">回覆詳細</label> |
|||
<textarea class="input-style" id="replyhistory" rows="6" style="resize: none;" disabled><?=$data["replyhistory"]?></textarea> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<div class="container"> |
|||
<form role="form" class="form-horizontal" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<h3 style="font-weight: 700;">品證部門填寫</h3> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="verify">結案人員</label> |
|||
<div class="input-style" id="verify"><?=implode(" ", array($data["verify"], $data["verify_name"]))?></div> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="responsibledepartment">判定責任單位</label> |
|||
<div class="input-style" id="responsibledepartment"><?=$data["responsibledepartment_name"]?></div> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="responsibledepartmentleader">判定責任單位主管</label> |
|||
<div class="input-style" id="responsibledepartmentleader"><?=implode(" ", array($data["responsibledepartmentleader"], $data["responsibledepartmentleader_name"]))?></div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-6"> |
|||
<label for="investigationreason">現場調查原因</label> |
|||
<textarea class="input-style" id="investigationreason" rows="6" maxlength="128" style="resize: none;" disabled><?=$data["investigationreason"]?></textarea> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="countermeasure">對策方法及再發防止</label> |
|||
<textarea class="input-style" id="countermeasure" rows="6" maxlength="128" style="resize: none;" disabled><?=$data["countermeasure"]?></textarea> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<?php } else { ?> |
|||
<div class="container"> |
|||
<form role="form" class="form-horizontal" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<input type="hidden" name="token" value="<?=$token;?>"> |
|||
<input type="hidden" name="verify" value="<?=$user_id;?>"> |
|||
<input type="hidden" name="progress" value="<?=$data["progress"];?>"> |
|||
<input type="hidden" name="no" value="<?=$data["id"];?>"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<h3 style="font-weight: 700;">品證部門判定</h3> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="responsibledepartment">判定責任單位</label> |
|||
<select name="responsibledepartment" id="responsibledepartment" required> |
|||
<option value="250">廠務部</option> |
|||
<option value="321">業務部</option> |
|||
<option value="50">工務總處</option> |
|||
<option value="521">安裝開發支援部</option> |
|||
<option value="531">北區維修保養部</option> |
|||
<option value="532">桃竹維修保養部</option> |
|||
<option value="533">中區維修保養部</option> |
|||
<option value="534">南區維修保養部</option> |
|||
<option value="541">宜花東工事部</option> |
|||
<option value="542">北區工事部</option> |
|||
<option value="543">桃竹工事部</option> |
|||
<option value="544">中區工事部</option> |
|||
<option value="545">南區工事部</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-6"> |
|||
<label for="investigationreason">現場調查原因</label> |
|||
<textarea name="investigationreason" id="investigationreason" rows="6" maxlength="128" required></textarea> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="countermeasure">對策方法及再發防止</label> |
|||
<textarea name="countermeasure" id="countermeasure" rows="6" maxlength="255" required></textarea> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-12"> |
|||
<button type="submit" class="btn btn-primary btn-lg">點擊後更新不良反饋單</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<?php } ?> |
|||
<div class="container"> |
|||
<form role="form" class="form-horizontal" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<h3 style="font-weight: 700;">不良單基本資料</h3> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="id">項次</label> |
|||
<div class="input-style" id="id"><?=$data["id"]?></div> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="create_at">反饋日期</label> |
|||
<div class="input-style" id="create_at"><?=$data["create_at"]?></div> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="creater">不良單填寫人</label> |
|||
<div class="input-style" id="creater"><?=implode(" ", array($data["creater"], $data["creater_name"]))?></div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="facilityno">電梯ID</label> |
|||
<div class="input-style" id="facilityno"><?=$data["facilityno"]?></div> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="sitename">現場名稱</label> |
|||
<div class="input-style" id="sitename"><?=$data["sitename"]?></div> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="siteaddress">現場地址</label> |
|||
<div class="input-style" id="siteaddress"><?=$data["siteaddress"]?></div> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="ngdescribe">簡述不良內容</label> |
|||
<textarea class="input-style" id="ngdescribe" rows="6" maxlength="128" style="resize: none;" disabled><?=$data["ngdescribe"]?></textarea> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="ngimage">照片上傳</label> |
|||
<div class="input-style" id="ngimage"><?php echo $data["ngimage"] ? "<img src='..".$data["ngimage"]."' style='margin: 0 auto; width: 100%; height: auto; border-radius: 0; float: none;'/>" : "";?></div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
|
@ -0,0 +1,24 @@ |
|||
<?php |
|||
// include "header_nomenu.php"; |
|||
require_once dirname(__FILE__)."/database.php"; |
|||
|
|||
if ($_SERVER["REQUEST_METHOD"] == "GET") { |
|||
switch ($_GET["type"]) { |
|||
case "facilityno": |
|||
$stmt = $link->prepare("SELECT facilityno, address FROM facility |
|||
WHERE facilityno LIKE CONCAT(?, '%') ORDER BY facilityno ASC LIMIT 0 , ?"); |
|||
// 此處僅有字串格式term |
|||
$stmt->bind_param("si", ...[$_GET["term"], $_GET["rn"]]); |
|||
$stmt->execute(); |
|||
$datas = $stmt->get_result()->fetch_all(MYSQLI_ASSOC); |
|||
break; |
|||
} |
|||
|
|||
} |
|||
|
|||
die(json_encode(array( |
|||
"count" => count($datas), |
|||
"data" => $datas |
|||
))); |
|||
exit; |
|||
?> |
Loading…
Reference in new issue