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.
214 lines
11 KiB
214 lines
11 KiB
<?php
|
|
include("../header.php");
|
|
require_once("./conn.php");
|
|
$id = $_GET['contractid'];
|
|
$sql_str = "SELECT a.*,b.name FROM contract_r_signed_back AS a LEFT JOIN account AS b ON a.repaireid = b.accountid
|
|
WHERE a.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['contract_status'] + 1);
|
|
// 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);
|
|
$contract_stauts = ["合約簽回", "採購", "工程發包", "工程中", "修理完成"];
|
|
|
|
|
|
|
|
?>
|
|
<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="<?php echo $contract['repaireid'] ?>"><?php echo $contract['repaireid'] . '-' . $contract['name'] ?></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" 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" 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 style="vertical-align: middle">工程進度</td>
|
|
<td style="vertical-align: middle">
|
|
<select class="contract_status" id="contract_status" x-model="data.contract_status">
|
|
<?php foreach ($contract_stauts as $key => $status) : ?>
|
|
<option value="<?php echo $key + 1 ?>"><?php echo $status; ?></option>
|
|
<?php endforeach ?>
|
|
</select>
|
|
<p class="alerttext" x-show="data.contract_status==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
|
|
</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 repaireid = '<?php echo $contract['repaireid']; ?>';
|
|
const total_price = '<?php echo $contract['total_price']; ?>';
|
|
const sign_date = '<?php echo $contract['sign_date']; ?>';
|
|
const invoice = '<?php echo $contract['invoice']; ?>'
|
|
const contract_status = '<?php echo $contract['contract_status']; ?>'
|
|
// $('#table_index').DataTable(
|
|
// {
|
|
// "order": [
|
|
// [0, "desc"],
|
|
// ]
|
|
// }
|
|
// );
|
|
// Fancybox.bind('[data-fancybox="gallery"]', {
|
|
|
|
// });
|
|
</script>
|