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.
273 lines
10 KiB
273 lines
10 KiB
<!doctype html>
|
|
<style>
|
|
#appCapsule .btn-sm {
|
|
margin-top:4px;
|
|
height: 20px;
|
|
padding: 0px 8px;
|
|
font-size: 12px;
|
|
}
|
|
</style>
|
|
<html lang="en">
|
|
|
|
<!-- 主頁header -->
|
|
<?php
|
|
|
|
/*--- 處理session ----*/
|
|
include "include-session-security.php"; #確認session
|
|
/*
|
|
if(isset($_SESSION['user_id'])){
|
|
#echo $_SESSION['user_id'];
|
|
$customerid = $_SESSION['user_id'];
|
|
}
|
|
*/
|
|
/*--- 處理session ----*/
|
|
|
|
#$customerid = "A000000001";
|
|
include "include-header.php";
|
|
|
|
require_once "db/database.php"; # 載入db.php來連結資料庫
|
|
$data = array(); # 設置一個空陣列來放資料
|
|
$data_1 = array(); # 設置一個空陣列來放資料
|
|
|
|
$sql = "SELECT * FROM account WHERE accountid = '$user_id'";
|
|
//$sql = "select a.*, c.contractno from account a, contract c where a.accountid = c.customerid and a.accountid = '$user_id'";
|
|
$data = mysqli_query($link,$sql); # 用mysqli_query方法執行(sql語法)將結果存在變數中
|
|
/*
|
|
foreach($data as $data){
|
|
echo $data["accountid"] . $data["phone_call_help"] . $data["chat_for_help"] . $data["remote_help"] . "<br>";
|
|
}
|
|
*/
|
|
|
|
$schedule_arr = $data_2 = [];
|
|
|
|
// 所有電梯
|
|
$sql_faci = "select facilityno from facility where customerid = '$user_id' ";
|
|
if ($user_id == "A000000001") $sql_faci .= "and facilityno like 'M%' ";
|
|
$sql_faci .= "order by facilityno";
|
|
$res_faci = mysqli_query($link, $sql_faci);
|
|
while ($row_faci = mysqli_fetch_row($res_faci)) {
|
|
$schedule_arr[$row_faci[0]]["baditems"] = "";
|
|
$schedule_arr[$row_faci[0]]["item_detail"] = "";
|
|
$schedule_arr[$row_faci[0]]["actualdate"] = "";
|
|
}
|
|
mysqli_free_result($res_faci);
|
|
//print_r($schedule_arr);
|
|
//$sql_1 = "SELECT * FROM facility_current_status WHERE facilityno = any(SELECT facilityno FROM facility where customerid = '$user_id') order by contractno";
|
|
$sql_1 = "select id, facilityno, actualdate, item, item_detail, result from schedule where (facilityno, actualdate) in ";
|
|
$sql_1 .= "(select facilityno, max(actualdate) from schedule where facilityno = any(select facilityno from facility where customerid = '$user_id') and actualdate is not null group by facilityno)";
|
|
$data_1 = mysqli_query($link,$sql_1); # 用mysqli_query方法執行(sql語法)將結果存在變數中
|
|
foreach($data_1 as $v) {
|
|
$data_2[$v["facilityno"]]["id"] = $v["id"];
|
|
$data_2[$v["facilityno"]]["actualdate"] = $v["actualdate"];
|
|
$data_2[$v["facilityno"]]["item"] = $v["item"];
|
|
$data_2[$v["facilityno"]]["item_detail"] = $v["item_detail"];
|
|
$data_2[$v["facilityno"]]["result"] = $v["result"];
|
|
}
|
|
mysqli_free_result($data_1);
|
|
//print_r($data_2);
|
|
/*
|
|
foreach($data_1 as $data_1){
|
|
echo $data_1["contractno"] . $data_1["facilityno"] . $data_1["walking_hours"] . $data_1["walking_times"] . "<br>";
|
|
}
|
|
*/
|
|
|
|
?>
|
|
<!-- * 主頁header -->
|
|
|
|
<body>
|
|
|
|
<!-- loader -->
|
|
<div id="loader">
|
|
<div class="spinner-border text-primary" role="status"></div>
|
|
</div>
|
|
<!-- * loader -->
|
|
|
|
<!-- App Header -->
|
|
<div class="appHeader bg-primary text-light">
|
|
<div class="left">
|
|
<a href="javascript:;" class="headerButton goBack">
|
|
<ion-icon name="chevron-back-outline"></ion-icon>
|
|
</a>
|
|
</div>
|
|
<div class="pageTitle">電梯狀態</div>
|
|
<!--
|
|
<div class="right">
|
|
</div>
|
|
-->
|
|
</div>
|
|
<!-- * App Header -->
|
|
|
|
<!-- App Capsule -->
|
|
<div id="appCapsule">
|
|
|
|
|
|
<div class="section full mt-1 mb-2">
|
|
|
|
<!-- <div class="section-title">合約電梯運行狀況 -->
|
|
|
|
<!-- bottom right -->
|
|
<div class="fab-button animate top-right dropdown">
|
|
<a href="#" class="fab" data-toggle="dropdown">
|
|
<ion-icon name="hammer-outline"></ion-icon>
|
|
</a>
|
|
<div class="dropdown-menu">
|
|
<?php foreach($data as $data){ ?>
|
|
<a class="dropdown-item bg-danger" href="app-owner-repaircall.php?token=<?php echo $token; ?>">
|
|
<ion-icon name="mail-outline"></ion-icon>
|
|
<p>故障報修</p>
|
|
</a>
|
|
<a class="dropdown-item bg-success" href="app-owner-repaircall-list.php?token=<?php echo $token; ?>">
|
|
<ion-icon name="hourglass-outline"></ion-icon>
|
|
<p>修理進度</p>
|
|
</a>
|
|
|
|
<?php
|
|
if ($data['accounttype'] == "A"){
|
|
echo "<a class='dropdown-item bg-primary' href='tel:" . $data['phone_call_help'] . "'>";
|
|
echo "<ion-icon name='call-outline'></ion-icon>";
|
|
echo "<p>維保人員</p>";
|
|
echo "</a>";
|
|
|
|
echo "<a class='dropdown-item bg-primary' href='tel:" . $data['chat_for_help'] . "'>";
|
|
echo "<ion-icon name='chatbubble'></ion-icon>";
|
|
echo "<p>客服人員</p>";
|
|
echo "</a>";
|
|
}elseif ($data['accounttype'] == "B"){
|
|
echo "<a class='dropdown-item bg-primary' href='tel:" . $data['chat_for_help'] . "'>";
|
|
echo "<ion-icon name='chatbubble'></ion-icon>";
|
|
echo "<p>客服人員</p>";
|
|
echo "</a>";
|
|
|
|
echo "<a class='dropdown-item bg-primary' href='tel:" . $data['remote_help'] . "'>";
|
|
echo "<ion-icon name='videocam-outline'></ion-icon>";
|
|
echo "<p>技術支援</p>";
|
|
echo "</a>";
|
|
}
|
|
?>
|
|
|
|
<?php } ?>
|
|
</div>
|
|
</div>
|
|
<!-- * bottom right -->
|
|
|
|
</div>
|
|
<div class="wide-block pt-2 pb-1">
|
|
|
|
<!-- <p>XXXX年XX月維保款</p> -->
|
|
<!--
|
|
<div class="custom-control custom-checkbox mb-1">
|
|
-->
|
|
<!-- <input type="checkbox" class="custom-control-input" id="customCheckb1"> -->
|
|
<!-- <label>合約號:A0000001</label> -->
|
|
<div class="section full mb-2">
|
|
<div class="wide-block p-0">
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">項次</th>
|
|
<th scope="col">電梯編號</th>
|
|
<th scope="col">保養結果</th>
|
|
<th scope="col">保養日期</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$j=0;
|
|
foreach ($schedule_arr as $k => $v) {
|
|
$j=$j+1;
|
|
$item_arr = (!empty($data_2[$k])) ? json_decode($data_2[$k]["item"], true) : [];
|
|
$item_detail_arr = (!empty($data_2[$k])) ? json_decode($data_2[$k]["item_detail"], true) : [];
|
|
$result_arr = (!empty($data_2[$k])) ? json_decode($data_2[$k]["result"], true) : [];
|
|
$baditems = 0;
|
|
$m = count($result_arr);
|
|
for ($h=0; $h<$m ; $h++) {
|
|
if ($result_arr[$h] > 1) {
|
|
$baditems = $baditems + 1;
|
|
$schedule_arr[$k]["item_detail"] .= "<div>".mb_substr($item_detail_arr[$h],0,6)."...</div>";
|
|
}
|
|
}
|
|
if ($baditems > 0) {
|
|
$schedule_arr[$k]["baditems"] .= "<b style='color:red';>有" . $baditems . "項問題</b>";
|
|
} else {
|
|
if (!empty($data_2[$k])) $schedule_arr[$k]["baditems"] .= "<b style='color:blue';>Good!</b>";
|
|
$schedule_arr[$k]["item_detail"] .= "";
|
|
}
|
|
$sresult = "";
|
|
if (!empty($schedule_arr[$k]["baditems"])) {
|
|
if (!empty($schedule_arr[$k]["item_detail"])) {
|
|
$sresult .= '<a style="margin-top:6px;">'.$schedule_arr[$k]["baditems"].'<br>'.$schedule_arr[$k]["item_detail"].'</a>';
|
|
} else {
|
|
$sresult .= '<a>'.$schedule_arr[$k]["baditems"].'</a>';
|
|
}
|
|
} else {
|
|
$sresult .= '<a>新梯待保養</a>';
|
|
}
|
|
$schedule_arr[$k]["actualdate"] .= (!empty($data_2[$k])) ? $data_2[$k]["actualdate"] : "";
|
|
if (empty($schedule_arr[$k]["actualdate"])) {
|
|
$schedule_arr[$k]["actualdate"] = "預計 ".date("Y-m-15", strtotime("+1 month"));
|
|
}
|
|
$id_schedule = (!empty($data_2[$k])) ? $data_2[$k]["id"] : 0;
|
|
$detail = $ckmore = "";
|
|
if ($id_schedule > 0) {
|
|
$ckmore .= '<a href="/app/app-maintenance-uploadsuccess-photo-review_v2.php?token='.$token.'&id_schedule='.$id_schedule.'" class="btn btn-outline-warning btn-sm" target="_self" title="瀏覽保養照片">照片</a></div>';
|
|
$detail .= '<div><a href="/app/app-maintenance-uploadsuccess-survey.php?token='.$token.'&id_schedule='.$id_schedule.'&view=Y&fr=" class="btn btn-outline-secondary btn-sm" target="_self">明細</a> ';
|
|
}
|
|
?>
|
|
<tr>
|
|
<th scope="row"><?php echo $j; ?></th>
|
|
<td><?php
|
|
if ($j<0){
|
|
echo "<span style='color:#FF0000;'>" . $k . "<BR> (故障維修中!) </span>";
|
|
}/*elseif(strlen($id_schedule) > 0 ){
|
|
echo "<a href='app-maintenance-uploadsuccess-photo-review.php?id_schedule=" . $id_schedule . "&token=" . $token . "'>" . $k . "</a>";
|
|
}elseif(strlen($id_schedule) == 0 )*/{
|
|
}
|
|
echo '<a href="/app/app-owner-baseinfo.php?token='.$token.'&facilityno='.$k.'" target="_self">'.$k.'</a>';
|
|
?></td>
|
|
<td nowrap><?php echo $sresult.$detail.$ckmore; ?></td>
|
|
<td><?php echo $schedule_arr[$k]["actualdate"]; ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
<!-- <div class="section-title">合計金額:3300.0</div> -->
|
|
</div>
|
|
|
|
|
|
<!-- </div> -->
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
<!-- * App Capsule -->
|
|
|
|
<!-- 主頁頁尾 -->
|
|
<?php
|
|
include "include-footer.php";
|
|
mysqli_close($link); #代表結束連線
|
|
?>
|
|
<!-- * 主頁頁尾 -->
|
|
|
|
<!-- 主頁頁尾按鈕 -->
|
|
<?php
|
|
# include "include-bottom-menu.php";
|
|
?>
|
|
<!-- * 主頁頁尾按鈕 -->
|
|
|
|
<!-- ///////////// Js Files //////////////////// -->
|
|
<!-- Jquery -->
|
|
<?php
|
|
include "include-jsfiles.php";
|
|
?>
|
|
|
|
</body>
|
|
|
|
</html>
|