You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
173 lines
6.7 KiB
173 lines
6.7 KiB
<?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>
|