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.
198 lines
6.8 KiB
198 lines
6.8 KiB
<?php
|
|
include "header.php";
|
|
|
|
$accounttype_arr = ["A" => "客戶", "B" => "保養人員", "C" => "檢查人員", "D" => "契約人員", "M" => "員工", "E" => "管理員(IT)", "X" => "未分類"]; #A=客戶 B=保養人員 C=檢查人員 D=契約人員 E=管理人員 M=永佳捷員工 X=未分類
|
|
|
|
// 工務總處、王凱欣可瀏覽全部資料
|
|
$sql = "select department_id from account where accountid = '$user_id'";
|
|
$res = mysqli_query($link, $sql);
|
|
$row = mysqli_fetch_row($res);
|
|
$user_department_id = $row[0];
|
|
mysqli_free_result($res);
|
|
|
|
// 設置一個空陣列來放資料
|
|
$data = array();
|
|
// sql語法存在變數中
|
|
$sql_cmd = sql_myself($user_id);
|
|
if ($user_department_id == "501" || $user_id == "M0105") $sql_cmd = "";
|
|
$sql = "SELECT * FROM account $sql_cmd ORDER BY id";
|
|
// 用mysqli_query方法執行(sql語法)將結果存在變數中
|
|
$data = mysqli_query($link, $sql);
|
|
?>
|
|
|
|
<!-- <a href="create.php"><h2>新增</h2></a> -->
|
|
<?php if ($user_auth & 2) { ?>
|
|
<p>
|
|
<a href="account-create.php?function_name=account&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
|
|
<span class="glyphicon glyphicon-plus"></span>
|
|
</a>
|
|
</p>
|
|
<?php
|
|
}
|
|
|
|
if ($data) :
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
if (empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])) {
|
|
echo "<p class='error'>Please fill up the required field!</p>";
|
|
} else {
|
|
header("Location:account-index.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;
|
|
|
|
}
|
|
</style>
|
|
|
|
<div style="overflow-x:auto;">
|
|
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
|
|
<thead>
|
|
<tr>
|
|
<th>項次</th>
|
|
<th>帳號類型</th>
|
|
<th>帳號</th>
|
|
<!--<th>密碼</th>-->
|
|
<th>姓名</th>
|
|
<th>電話</th>
|
|
<th>地址</th>
|
|
<th>電子郵件</th>
|
|
<th>Line ID</th>
|
|
<th>微信id</th>
|
|
<th>遠端協助</th>
|
|
<th>維修ID</th>
|
|
<th>直屬主管</th>
|
|
<th>建檔人</th>
|
|
<th>建檔時間</th>
|
|
<?php if ($user_auth & 2) { ?>
|
|
<th>修改</th>
|
|
<th>新人資料</th>
|
|
<!--<th>刪除</th>-->
|
|
<?php } ?>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
<?php foreach ($data as $data) : ?>
|
|
<tr>
|
|
<td><?php echo $data['id']; ?></td>
|
|
<td data-toggle="tooltip" data-placement="right" title="
|
|
<?php
|
|
if (isset($accounttype_arr[$data['accounttype']])) {
|
|
echo $accounttype_arr[$data['accounttype']];
|
|
} else {
|
|
echo $data['accounttype'];
|
|
}
|
|
?>
|
|
">
|
|
<?php
|
|
if (isset($accounttype_arr[$data['accounttype']])) {
|
|
echo $accounttype_arr[$data['accounttype']];
|
|
} else {
|
|
echo $data['accounttype'];
|
|
}
|
|
?></td>
|
|
<td><?php echo $data['accountid']; ?></td>
|
|
<!--<td><?php echo $data['pwd']; ?></td>-->
|
|
<td><?php echo $data['name']; ?></td>
|
|
<td><?php echo $data['tel']; ?></td>
|
|
<td><?php echo $data['address']; ?></td>
|
|
<td><?php echo $data['email']; ?></td>
|
|
<td><?php echo $data['lineid']; ?></td>
|
|
<td><?php echo $data['wechatid']; ?></td>
|
|
<td><a href="<?php echo $data['remote_help']; ?>">連結<a /></td>
|
|
<td><?php echo $data['repairerid']; ?></td>
|
|
<td><?php echo $data['manager']; ?></td>
|
|
<td><?php echo $data['creater']; ?></td>
|
|
<td><?php echo $data['create_at']; ?></td>
|
|
<?php if ($user_auth & 2) { ?>
|
|
<td>
|
|
<p>
|
|
<a href="account-edit.php?id=<?php echo $data['id']; ?>&function_name=account&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
|
|
<span class="glyphicon glyphicon-pencil"></span>
|
|
</a>
|
|
</p>
|
|
</td>
|
|
<!--<td>
|
|
<p>
|
|
<a href="account-delete.php?id=<?php echo $data['id']; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')">
|
|
<span class="glyphicon glyphicon-remove"></span>
|
|
</a>
|
|
</p>
|
|
</td>-->
|
|
<?php } ?>
|
|
<td>
|
|
<button type="button" class="btn" onclick="sendJuniorStaffDoc(<?php echo $data['id']; ?>)">寄送</button>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<script>
|
|
function sendJuniorStaffDoc(id) {
|
|
$.ajax({
|
|
url: window.location.origin + '/wms/account-index-submit.php',
|
|
type: 'POST',
|
|
data: {
|
|
'method': 'sendJuniorStaffDoc',
|
|
'id': id
|
|
},
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
alert("寄送成功!");
|
|
},
|
|
error: function(xhr, status, error) {
|
|
alert("寄送失敗!");
|
|
}
|
|
});
|
|
|
|
}
|
|
</script>
|
|
<?php
|
|
|
|
else :
|
|
echo "<h2>There is no record!</h2>";
|
|
endif;
|
|
|
|
#代表結束連線
|
|
mysqli_close($link);
|
|
|
|
include "footer.php";
|
|
|
|
?>
|