9 changed files with 607 additions and 29 deletions
@ -0,0 +1,201 @@ |
|||||
|
<?php |
||||
|
include("../header.php"); |
||||
|
require_once("./conn.php"); |
||||
|
$id = $_GET['contractid']; |
||||
|
$sql_str = "SELECT * FROM contract_r_signed_back WHERE id = :id ORDER BY id DESC"; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->bindParam(':id', $id); |
||||
|
$stmt->execute(); |
||||
|
$contract= $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
// echo '<pre>'; |
||||
|
// print_r($contract); |
||||
|
// echo '</pre>'; |
||||
|
// $files_id = $contract['files_id']; |
||||
|
// $sql_str = "SELECT * FROM contract_back_files WHERE files_id = :files_id "; |
||||
|
// $stmt = $conn->prepare($sql_str); |
||||
|
// $stmt->bindParam(':files_id', $files_id); |
||||
|
// $stmt->execute(); |
||||
|
// $files= $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
// $files = json_encode($files); |
||||
|
$accounttype = "M"; |
||||
|
$sql_str = "SELECT accountid, name FROM account WHERE accounttype = :accounttype"; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->bindParam(":accounttype", $accounttype); |
||||
|
$stmt -> execute(); |
||||
|
$persons = $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
$persons = array_map(function($person){ |
||||
|
return [ |
||||
|
'view'=>$person['accountid'] .'-'. $person['name'], |
||||
|
'value'=>$person['accountid'], |
||||
|
'name'=>$person['name'] |
||||
|
]; |
||||
|
}, $persons); |
||||
|
?> |
||||
|
<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> |
||||
|
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script> |
||||
|
|
||||
|
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js"></script> |
||||
|
<link |
||||
|
rel="stylesheet" |
||||
|
href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css" |
||||
|
/> |
||||
|
<div class="contract-management" x-data='contract_edit'> |
||||
|
<div class="form" method="post" id="form" enctype="multipart/form-data" > |
||||
|
<input type="hidden" name='form_name' value="main_form" /> |
||||
|
<div> |
||||
|
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td colspan="8"> |
||||
|
<h3 style='text-align:center'>合約管理(修理)</h3> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
|
||||
|
<tbody style="font-weight: bolder;margin-bottom: 20px" > |
||||
|
<tr> |
||||
|
<td colspan="7" style='vertical-align: middle;border-right:0px;'> |
||||
|
<h4>檢視合約</h4> |
||||
|
</td> |
||||
|
<td class="text-right" style='border-left:0px;'> |
||||
|
<button type="button" id="btn_close" class="btn btn-default" onclick="window.history.back();">返回</button> |
||||
|
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close();">關閉分頁</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align: middle">立約人</td> |
||||
|
<td> |
||||
|
<input class="form-control disabled_select" type="text" x-model="data.company" > |
||||
|
<p class="alerttext" x-show="data.company==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
|
||||
|
<td style="vertical-align: middle">維保人員</td> |
||||
|
<td style="vertical-align: middle"> |
||||
|
<select class="repaireid" id="repaireid" x-model="data.repaireid"> |
||||
|
<option value="">選擇營業員</option> |
||||
|
<?php foreach($persons as $person): ?> |
||||
|
<option value="<?php echo $person['value']; ?>"><?php echo $person['view']; ?></option> |
||||
|
<?php endforeach ?> |
||||
|
</select> |
||||
|
<p class="alerttext" x-show="data.repaireid==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
|
||||
|
<td style="vertical-align: middle">電梯編號</td> |
||||
|
<td> |
||||
|
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.facilityno" > |
||||
|
<p class="alerttext" x-show="data.facilityno==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
|
||||
|
<td style="vertical-align: middle">報價單編號</td> |
||||
|
<td> |
||||
|
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.repair_no" > |
||||
|
<p class="alerttext" x-show="data.repair_no==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align: middle">工程類別</td> |
||||
|
<td> |
||||
|
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.type" > |
||||
|
<p class="alerttext" x-show="data.type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
<td style="vertical-align: middle">簽訂時間</td> |
||||
|
<td> |
||||
|
<input class="form-control disabled_select" type="text" name="sign_date" x-model="data.sign_date" > |
||||
|
<p class="alerttext" x-show="data.sign_date==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
<td style="vertical-align: middle">發票抬頭</td> |
||||
|
<td> |
||||
|
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.invoice" > |
||||
|
<p class="alerttext" x-show="data.invoice==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
<td style="vertical-align: middle">統一編號</td> |
||||
|
<td> |
||||
|
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.taxid" > |
||||
|
<p class="alerttext" x-show="data.taxid==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align: middle">工程地址</td> |
||||
|
<td colspan=3> |
||||
|
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.address" > |
||||
|
<p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
<!-- <td style="vertical-align: middle">附件上傳</td> |
||||
|
<td colspan=3> |
||||
|
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" /> |
||||
|
<p class="alerttext" x-show="data.lm_tel==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> --> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
</tr> |
||||
|
<!-- <tr> |
||||
|
<td style="vertical-align: middle">附件</td> |
||||
|
<td colspan=7> |
||||
|
<div class="images"> |
||||
|
<template x-for="file in data.files" :key="file.id"> |
||||
|
<div class="image"> |
||||
|
<a :href="'./images/contracts/' + file.file_name" data-fancybox="gallery" :data-src="'./images/contracts/' + file.file_name" data-caption=""> |
||||
|
<img :src="'./images/contracts/' + file.file_name" /> |
||||
|
</a> |
||||
|
<i class="fas fa-times" @click="deleteFileFn(file.id)"></i> |
||||
|
</div> |
||||
|
</template> |
||||
|
</div> |
||||
|
|
||||
|
</td> |
||||
|
</tr> --> |
||||
|
|
||||
|
|
||||
|
</tbody> |
||||
|
</table> |
||||
|
<button @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>更新</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<div class="loader"></div> |
||||
|
</template> |
||||
|
</button> |
||||
|
<button type="button" class="btn btn-primary btn-lg pull-right savebtn" @click="window.location.href='./contract-repair-management.php?<?php echo $token_link; ?>'">回列表</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<script src="./js/jquery/jquery-3.1.1.min.js"></script> |
||||
|
<script src="semantic/dist/semantic.min.js" ></script> |
||||
|
<script src="./js/alpine.js"></script> |
||||
|
<script> |
||||
|
const user_id = '<?php echo $user_id; ?>'; |
||||
|
const user_name = '<?php echo $user_name; ?>'; |
||||
|
const id = <?php echo $contract['id']?>; |
||||
|
const repair_no = '<?php echo $contract['repair_no'];?>' |
||||
|
const contractno = '<?php echo $contract['contractno'];?>' |
||||
|
const company = '<?php echo $contract['company'];?>' |
||||
|
const taxid = '<?php echo $contract['taxid'];?>' |
||||
|
const facilityno = '<?php echo $contract['facilityno'];?>' |
||||
|
const address = '<?php echo $contract['address'];?>' |
||||
|
const type = '<?php echo $contract['type'];?>' |
||||
|
const invoice = '<?php echo $contract['invoice'];?>' |
||||
|
const repaireid = '<?php echo $contract['repaireid'];?>' |
||||
|
// const total_price = '<?php echo $contract['total_price'];?>' |
||||
|
const sign_date = '<?php echo $contract['sign_date'];?>' |
||||
|
$('#table_index').DataTable( |
||||
|
{ |
||||
|
"order": [ |
||||
|
[0, "desc"], |
||||
|
] |
||||
|
} |
||||
|
); |
||||
|
Fancybox.bind('[data-fancybox="gallery"]', { |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
</script> |
||||
|
|
@ -0,0 +1,119 @@ |
|||||
|
<?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> |
||||
|
</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> |
||||
|
<td><?php echo $contract['create_userid'] ?></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> |
Loading…
Reference in new issue