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
5.9 KiB
173 lines
5.9 KiB
<?php
|
|
include "header.php";
|
|
|
|
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.');
|
|
|
|
// 部門職別
|
|
$db_query = "select department_id, name, role_id, role from department order by department_id";
|
|
$res = mysqli_query($link, $db_query);
|
|
while ($row = mysqli_fetch_assoc($res)) {
|
|
$depart_arr[$row["department_id"]] = $row["name"];
|
|
$role_arr[$row["department_id"]][$row["role_id"]] = $row["role"];
|
|
}
|
|
mysqli_free_result($res);
|
|
|
|
$data = array();
|
|
// sql語法存在變數中
|
|
$db_query = "SELECT * FROM account WHERE id=$id";
|
|
|
|
// 用mysqli_query方法執行(sql語法)將結果存在變數中
|
|
$data = mysqli_query($link,$db_query);
|
|
/*
|
|
include "inc/record_update.php";
|
|
|
|
try {
|
|
// 設置一個空陣列來放資料
|
|
$data = array();
|
|
// sql語法存在變數中
|
|
$db_query = "SELECT * FROM expert WHERE id=$id";
|
|
|
|
// 用mysqli_query方法執行(sql語法)將結果存在變數中
|
|
$data = mysqli_query($link,$db_query);
|
|
}catch (Exception $e) {
|
|
echo 'Caught exception: ', $e->getMessage(), "\n";
|
|
}
|
|
*/
|
|
foreach($data as $data) :
|
|
?>
|
|
<script>
|
|
$(function(){
|
|
var jroleStr = '<?php echo json_encode($role_arr); ?>';
|
|
var jroleArr = JSON.parse(jroleStr);
|
|
var optStr = "";
|
|
$("select[name=department_id]").change(function(){
|
|
if ($(this).val() != "") {
|
|
optStr = "";
|
|
for (var i in jroleArr[$(this).val()]) {
|
|
if ('undefined' !== jroleArr[$(this).val()][i]) {
|
|
optStr += '<option value="'+i+'">'+jroleArr[$(this).val()][i]+'</option>';
|
|
}
|
|
}
|
|
$("select[name=role_id]").html(optStr);
|
|
} else $("select[name=role_id]").html('<option value="">請選擇</option>');
|
|
})
|
|
});
|
|
</script>
|
|
<div class="container">
|
|
<form class="form-inline" method="post" action="account-record-update.php">
|
|
<input type="hidden" name="id" value="<?php echo $id; ?>">
|
|
|
|
<div>
|
|
<label for="accounttype">帳號類別</label>
|
|
<input type="text" name="accounttype" id="accounttype" value="<?php echo $data['accounttype']; ?>" readonly>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="accountid">帳號</label>
|
|
<input type="text" name="accountid" id="accountid" value="<?php echo $data['accountid']; ?>" readonly>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="pwd">密碼(必填)</label>
|
|
<input type="text" name="pwd" id="pwd" value="<?php echo $data['pwd']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="name">姓名(必填)</label>
|
|
<input type="text" name="name" id="name" value="<?php echo $data['name']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="tel">電話</label>
|
|
<input type="text" name="tel" id="tel" value="<?php echo $data['tel']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="address">地址</label>
|
|
<input type="text" name="address" id="address" value="<?php echo $data['address']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="email">電子郵箱</label>
|
|
<input type="text" name="email" id="email" value="<?php echo $data['email']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="lineid">Line ID</label>
|
|
<input type="text" name="lineid" id="lineid" value="<?php echo $data['lineid']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="wechatid">微信ID</label>
|
|
<input type="text" name="wechatid" id="wechatid" value="<?php echo $data['wechatid']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="phone_call_help">保養員聯絡手機號(客戶必填)</label>
|
|
<input type="text" name="phone_call_help" id="phone_call_help" value="<?php echo $data['phone_call_help']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="chat_for_help">線上文字客服</label>
|
|
<input type="text" name="chat_for_help" id="chat_for_help" value="<?php echo $data['chat_for_help']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="remote_help">遠端視頻帳號</label>
|
|
<input type="text" name="remote_help" id="remote_help" value="<?php echo $data['remote_help']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="repairerid">服務與支持人員工號(客戶必填)</label>
|
|
<input type="text" name="repairerid" id="repairerid" value="<?php echo $data['repairerid']; ?>">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="manager">直屬主管工號(員工必填)</label>
|
|
<input type="text" name="manager" id="manager" value="<?php echo $data['manager']; ?>">
|
|
</div>
|
|
<div>
|
|
<label for="department_id">部門(員工必填)</label>
|
|
<select name="department_id">
|
|
<option value="">請選擇</option>
|
|
<?php
|
|
foreach ($depart_arr as $k => $v) {
|
|
echo "<option value=\"".$k."\"";
|
|
if ($data["department_id"] == $k) echo " selected";
|
|
echo ">".$v."</option>";
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="role_id">職別(員工必填)</label>
|
|
<select name="role_id">
|
|
<?php
|
|
foreach ($role_arr[$data["department_id"]] as $k => $v) {
|
|
echo "<option value=\"".$k."\"";
|
|
if ($data["role_id"] == $k) echo " selected";
|
|
echo ">".$v."</option>";
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="creater">建檔人</label>
|
|
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly>
|
|
</div>
|
|
|
|
|
|
<div>
|
|
<button type="submit" name="update">確定</button>
|
|
</div>
|
|
<input type="hidden" name="token" value="<?php echo $token; ?>">
|
|
</form>
|
|
</div>
|
|
|
|
<?php
|
|
|
|
endforeach;
|
|
|
|
include "footer.php";
|
|
|
|
?>
|
|
|