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.
208 lines
6.9 KiB
208 lines
6.9 KiB
<?php
|
|
include "../header.php";
|
|
|
|
$data = array();
|
|
|
|
function getAllFacilitynos($link, $user_id)
|
|
{
|
|
$sql_cmd = sql_myself($user_id, "repairerid");
|
|
$sql = "
|
|
SELECT facilityno
|
|
FROM facility
|
|
$sql_cmd
|
|
";
|
|
$result = mysqli_query($link, $sql);
|
|
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
|
|
return "'" . implode("','", array_column($data, 'facilityno')) . "'";
|
|
}
|
|
|
|
if (getAccounttype($link, $user_id) == "B") {
|
|
$facilitynos = getAllFacilitynos($link, $user_id);
|
|
} else if (in_array(accountidToDepartId($user_id), ['912', '220'])) {
|
|
$facilitynos = '';
|
|
} else if (in_array($user_id, ['M0061', 'M0112', 'C0004', 'M0154'])) {
|
|
$facilitynos = '';
|
|
} else {
|
|
$facilitynos = "'NA'";
|
|
}
|
|
|
|
$last2mon = date("Y/m/d 00:00:00", strtotime("-2 month"));
|
|
$sql = "
|
|
SELECT
|
|
*
|
|
FROM fault_notification_job_handling
|
|
WHERE 1 = 1
|
|
AND calltime >= '$last2mon'
|
|
";
|
|
$sql .= !empty($facilitynos) ? " AND facilityno IN ($facilitynos)" : "";
|
|
$sql .= "
|
|
ORDER BY id DESC
|
|
";
|
|
|
|
$data = mysqli_query($link, $sql);
|
|
|
|
if ($user_auth & 2) {
|
|
?>
|
|
<p><a href="fault-create.php?function_name=faultreview&<?php echo $token_link; ?>" class="btn btn-info btn-sm" style="margin-left: 12px"> <span class="glyphicon glyphicon-plus"></span></a></p>
|
|
<?php
|
|
}
|
|
if ($data) :
|
|
?>
|
|
<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;
|
|
|
|
}
|
|
|
|
@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;
|
|
}
|
|
|
|
table td:last-child {
|
|
border-bottom: 0;
|
|
}
|
|
|
|
table td:before {
|
|
content: attr(data-label);
|
|
float: left;
|
|
text-transform: uppercase;
|
|
font-weight: bold;
|
|
}
|
|
}
|
|
</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>廠牌</th>-->
|
|
<th>來電時間</th>
|
|
<th>處理人員</th>
|
|
<th>備註欄</th>
|
|
<?php //if($permission==0) {
|
|
?>
|
|
<?php if ($user_auth & 2) { ?>
|
|
<th>修改</th>
|
|
<!-- <th>刪除</th>-->
|
|
<?php } ?>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
foreach ($data as $key => $data) :
|
|
?>
|
|
<tr>
|
|
<td><?php echo $key + 1; ?></td>
|
|
<td><?php echo $data['facilityno']; ?></td>
|
|
<td><a href="fault-detail.php?account=<?php echo $user_id; ?>&id=<?php echo $data['id']; ?>&function_name=faultreview&<?php echo $token_link; ?>"><?php echo $data['sitename']; ?></a></td>
|
|
<td><?php echo $data['faultstate']; ?></td>
|
|
<td><?php echo $data['caller']; ?></td>
|
|
<td><?php echo $data['address']; ?></td>
|
|
<!-- <td>--><?php //echo $data['buildingnumber'];
|
|
?><!--</td>-->
|
|
<!-- <td>--><?php //echo $data['positionnumber'];
|
|
?><!--</td>-->
|
|
<!-- <td>--><?php //echo $data['brandmodel'];
|
|
?><!--</td>-->
|
|
<td><?php echo $data['calltime']; ?></td>
|
|
<td><?php echo $data['handlestaff']; ?></td>
|
|
<td><?php echo $data['remarks']; ?></td>
|
|
<?php //if($permission==0) {
|
|
?>
|
|
<?php if ($user_auth & 2) { ?>
|
|
<td>
|
|
<?php
|
|
if (!in_array($data['caller'], ['system', 'system/Monarch', 'system/aijiati'])) {
|
|
?>
|
|
<p>
|
|
<a href="faultreview-edit.php?account=<?php echo $user_id; ?>&id=<?php echo $data['id']; ?>&function_name=faultreview&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
|
|
<span class="glyphicon glyphicon-pencil"></span>
|
|
</a>
|
|
</p>
|
|
<?php
|
|
}
|
|
?>
|
|
</td>
|
|
<!-- <td>-->
|
|
<!-- <p>-->
|
|
<!-- <a href="faultreview-delete.php?account=--><?php //echo $user_id;
|
|
?><!--&id=--><?php //echo $data['id'];
|
|
?><!--" class="btn btn-info btn-sm" onClick="return confirm('確定刪除?')">-->
|
|
<!-- <span class="glyphicon glyphicon-remove"></span>-->
|
|
<!-- </a>-->
|
|
<!-- </p>-->
|
|
<!---->
|
|
<!-- </td>-->
|
|
<?php } ?>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php
|
|
else :
|
|
echo "<h2>There is no record!</h2>";
|
|
endif;
|
|
|
|
#代表結束連線
|
|
mysqli_close($link);
|
|
|
|
include "../footer.php";
|
|
?>
|