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.
 
 
 
 
 
 

131 lines
4.8 KiB

<?php
include("../header.php");
require_once("./conn.php");
$sql_str = "SELECT * FROM contract_r_signed_back WHERE 1=1 AND delete_status = 1 ORDER BY id DESC";
$stmt = $conn->prepare($sql_str);
$stmt->execute();
$contracts = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<link rel="stylesheet" href="./styles/style.css">
<link rel="stylesheet" href="semantic/dist/semantic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script defer src="./js/alpinejs/cdn.min.js"></script>
<script src="./js/axios/axios.min.js"></script>
<div class="contract-management" x-data="{
deleteFn(id,user){
if(confirm('確定要刪除嗎?')){
axios.get('./api/deleteNewContractData.php?contracttype=r&contractid='+id+'&user_id='+user).then(res=> {
console.log(res);
if(res.status === 204){
alert('刪除成功!')
location.reload();
}
})
}
}
}">
<div style="overflow-x:auto;margin-top:12px">
<a href="contract-repair-input.php?function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
<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>
</tr>
</thead>
<tbody>
<?php foreach ($contracts as $key => $contract) : ?>
<tr>
<td><?php echo $contract['id']; ?></td>
<td><?php echo $contract['contractno'] ?></td>
<td><?php echo $contract['company'] ?></td>
<td><?php echo $contract['taxid'] ?></td>
<td><?php echo $contract['total_price'] ?></td>
<th><?php if ($contract['contract_status'] == 1) {
echo '合約簽回';
} else if ($contract['contract_status'] == 2) {
echo '採購';
} else if ($contract['contract_status'] == 3) {
echo '工程發包';
} else if ($contract['contract_status'] == 4) {
echo '工程中';
} else if ($contract['contract_status'] == 5) {
echo '修理完成';
}
?></th>
<td><?php echo $contract['create_user'] ?></td>
<td><?php echo $contract['create_date'] ?></td>
<td style="width:30px">
<p>
<a href="contract-repair-edit.php?&contractid=<?php echo $contract['id']; ?>&function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-pencil"></span>
</a>
<a href="javascript:;" class="btn btn-info btn-sm" style="margin-left:10px;" @click="deleteFn(<?php echo $contract['id']; ?>,'<?php echo $user_id; ?>')">
<span class="glyphicon glyphicon-remove"></span>
</a>
</p>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
<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>
<script src="semantic/dist/semantic.min.js"></script>
<script>
$('#table_index').DataTable({
"order": [
[0, "desc"],
]
});
</script>