Browse Source

新梯合約管理

gary
10994015 1 year ago
parent
commit
246da5d796
  1. 60
      wms/contract/api/postContractData.php
  2. 115
      wms/contract/api/putContractData.php
  3. 61
      wms/contract/api/upload_chk.php
  4. 16
      wms/contract/contract-input.php
  5. 229
      wms/contract/contract-newelevator-edit.php
  6. 45
      wms/contract/contract-newelevator-input.php
  7. 105
      wms/contract/contract-newelevator-management.php
  8. 84
      wms/contract/styles/style.css
  9. 2
      wms/contract/styles/style.css.map
  10. 56
      wms/contract/styles/style.scss

60
wms/contract/api/postContractData.php

@ -2,6 +2,7 @@
require_once("../conn.php");
include_once("./getFacilityNo.php");
include_once("./getComboNo.php");
include_once("./upload_chk.php");
ini_set ( 'date.timezone' , 'Asia/Taipei' );
//保養簽回
if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'b') {
@ -425,62 +426,3 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
}
function upload_chk( $file, $path, $max_size, $allow_ext, $file_name ){
$source_file_name = $file['name']; //上傳檔案的原來檔案名稱
$file_type = $file['type']; //上傳檔案的類型(副檔名)
$tmp_name = $file['tmp_name']; //上傳到暫存空間的路徑/檔名
$file_size = $file['size']; //上傳檔案的檔案大小(容量)
$error = $file['error']; //上傳工作傳回的錯誤訊息編號
$msg = ''; //負責記錄回傳的訊息
//1.判斷錯誤編號只有為0時表示沒有錯誤發生,才表示上傳成功 =================
if( $error == 0 ){
//取得檔案延伸的副檔名, 以下函數可以取得檔案延伸的副檔名
//pathinfo(上傳檔案的原來檔案名稱, PATHINFO_EXTENSION)
$ext = pathinfo($source_file_name, PATHINFO_EXTENSION);
$ext = strtolower($ext); //將延伸的副檔名轉小寫
//2.判斷上傳檔案的大小 ====================================
if( $file_size > $max_size ){
//當目前檔案容量超過容量限制時, 以下準備顯示的資訊
if( $max_size >= 4096*4096 ){
$max_size /= (4096*4096);
$max_size .= 'M';
}elseif( $max_size >= 4096 ){
$max_size /= 4096;
$max_size .= 'K';
}
$msg ='上傳檔案過大,請選擇容量小於 '.$max_size.' 的檔案';
//3.判斷檔案類型 ===========================================
//in_array($ext, $allow_ext) 判斷 $ext變數的值 是否在 $allow_ext 這個陣列變數中
}elseif( !in_array( $ext, $allow_ext ) ){
$allow_str = ''; //準備將允許檔案類型的陣列內容, 組合成字串
foreach( $allow_ext as $key=>$value ){
//if的縮寫語法:條件?成立執行的工作:不成立執行的工作;
$key==0? $allow_str.= $value : $allow_str.=', '.$value;
}
$msg = '檔案類型不符合,請選擇 '.$allow_str.' 檔案';
//4.以上條件都沒問題的話, 則進行最後else中的工作===============
}else{
//搬移檔案 move_uploaded_file(要搬移的檔案, 目的地位置及目的檔案名稱), 成功傳回true(1)
$msg = @move_uploaded_file($tmp_name, $path.$file_name);
}
}else{
//這裡表示上傳有錯誤, 匹配錯誤編號顯示對應的訊息 ======================================
switch ($error) {
case 1: $msg = '上傳檔案超過 upload_max_filesize 容量最大值'; break;
case 2: $msg = '上傳檔案超過 post_max_size 總容量最大值'; break;
case 3: $msg = '檔案只有部份被上傳'; break;
case 4: $msg = '沒有檔案被上傳'; break;
case 6: $msg = '找不到主機端暫存檔案的目錄位置'; break;
case 7: $msg = '檔案寫入失敗'; break;
case 8: $msg = '上傳檔案被PHP程式中斷,表示主機端系統錯誤'; break;
}
} //if( $error == 0 ){ ..... end
return $msg; //回傳$msg的結果
}

115
wms/contract/api/putContractData.php

@ -0,0 +1,115 @@
<?php
require_once("../conn.php");
include_once("./upload_chk.php");
ini_set ( 'date.timezone' , 'Asia/Taipei' );
// echo json_encode(explode(',', $_POST['deletefiles']));
if(isset($_POST['contractno']) && $_POST['contractno']!="" && isset($_POST["id"]) && $_POST['id']!=""){
try{
$created_at = date('Y-m-d H:i:s');
$created_by = $_POST['user_id'];
$id = $_POST["id"];
$contract_no = !empty($_POST['contractno']) ? $_POST['contractno'] : null;
$customer = !empty($_POST['customer']) ? $_POST['customer'] : null;
$manager = !empty($_POST['manager']) ? $_POST['manager'] : null;
$vat = !empty($_POST['vat']) ? $_POST['vat'] : null;
$case_name = !empty($_POST['case_name']) ? $_POST['case_name'] : null;
$linkman = !empty($_POST['linkman']) ? $_POST['linkman'] : null;
$lm_tel = !empty($_POST['lm_tel']) ? $_POST['lm_tel'] : null;
$address = !empty($_POST['address']) ? $_POST['address'] : null;
$salesman = !empty($_POST['salesman']) ? $_POST['salesman'] : null;
$deletefiles = !empty($_POST['deletefiles']) ? $_POST['deletefiles'] : null;
$files_id = !empty($_POST['files_id']) ? $_POST['files_id'] : null;
$files = !empty($_FILES['files']) ? $_FILES['files'] : null;
$deletefilesArr = explode(',', $_POST['deletefiles']);
$conn->beginTransaction();
$sql_str = "UPDATE contract_m_signed_back SET contract_no=:contract_no, customer=:customer, manager=:manager, vat=:vat, case_name=:case_name, linkman=:linkman, lm_tel=:lm_tel, address=:address, salesman=:salesman WHERE id = :id";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(':contract_no' ,$contract_no);
$stmt -> bindParam(':customer' ,$customer);
$stmt -> bindParam(':manager' ,$manager);
$stmt -> bindParam(':vat' ,$vat);
$stmt -> bindParam(':case_name' ,$case_name);
$stmt -> bindParam(':linkman' ,$linkman);
$stmt -> bindParam(':lm_tel' ,$lm_tel);
$stmt -> bindParam(':address' ,$address);
$stmt -> bindParam(':salesman' ,$salesman);
$stmt -> bindParam(':id' ,$id);
$stmt -> execute();
if(!empty($deletefiles)){
$sql_str = "DELETE FROM contract_back_files WHERE id IN ($deletefiles)";
$stmt = $conn -> prepare($sql_str);
$stmt -> execute();
}
if(!empty($files)){
$englisharr = range('a', 'z');
$files = $_FILES['files'];
$newfiles = [];
foreach( $files as $file ){
$i = 0; //新陣列的索引編號
foreach( $file as $key => $val ){
$newfiles[$i]['name'] = $files['name'][$key];
$newfiles[$i]['type'] = $files['type'][$key];
$newfiles[$i]['tmp_name'] = $files['tmp_name'][$key];
$newfiles[$i]['error'] = $files['error'][$key];
$newfiles[$i]['size'] = $files['size'][$key];
$i++;
} //foreach 第2層 end
}
$max_size = 4096*4096; //設定允許上傳檔案容量的最大值(1M)
$allow_ext = array('jpeg', 'jpg', 'png','JPG','JPEG','PNG','GIF'); //設定允許上傳檔案的類型
$path = '../images/contracts/';
if (!file_exists($path)) { mkdir($path); }
$msg_result = ''; //負責接收所有檔案檢測後的回傳訊息
$datetime = (string)date('YmdHis');
$files_id = ($files_id !== null ) ? $files_id : 'm' . $datetime; // 新梯=>m + 日期時間
echo json_encode($newfiles);
foreach( $newfiles as $key => $file ){
$randNum = rand(1000,9999);
$randEnglish = $englisharr[rand(0,25)];
$file_name = 'm' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum.$file['name'];
$msg = upload_chk( $file,$path, $max_size, $allow_ext, $file_name );
if($msg==1){
$msg = '檔案傳送成功!';
$sql_str = "INSERT INTO contract_back_files (files_id, file_name, file_mime, file_size, created_at, created_by) VALUES (:files_id, :file_name, :file_mime, :file_size, :created_at, :created_by)";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(':files_id' ,$files_id);
$stmt -> bindParam(':file_name' ,$file_name);
$stmt -> bindParam(':file_mime' ,$file['type']);
$stmt -> bindParam(':file_size' ,$file['size']);
$stmt -> bindParam(':created_at' ,$created_at);
$stmt -> bindParam(':created_by' ,$created_by);
$stmt ->execute();
}
$msg_result .= '第' . ($key+1) . '個上傳檔案的結果:' . $msg . '<br/>';
$src_name = $path.$file['name'];
if( file_exists($src_name) ){
//副檔名
$extname = pathinfo($src_name, PATHINFO_EXTENSION);
//主檔名
$basename = basename($src_name, '.'.$extname);
}
}
}else{
$files = null;
}
$conn->commit();
}catch(PDOException $e) {
$conn->rollback();
echo $e->getMessage();
die('Error!:'.$e->getMessage());
}
}

61
wms/contract/api/upload_chk.php

@ -0,0 +1,61 @@
<?php
function upload_chk( $file, $path, $max_size, $allow_ext, $file_name ){
$source_file_name = $file['name']; //上傳檔案的原來檔案名稱
$file_type = $file['type']; //上傳檔案的類型(副檔名)
$tmp_name = $file['tmp_name']; //上傳到暫存空間的路徑/檔名
$file_size = $file['size']; //上傳檔案的檔案大小(容量)
$error = $file['error']; //上傳工作傳回的錯誤訊息編號
$msg = ''; //負責記錄回傳的訊息
//1.判斷錯誤編號只有為0時表示沒有錯誤發生,才表示上傳成功 =================
if( $error == 0 ){
//取得檔案延伸的副檔名, 以下函數可以取得檔案延伸的副檔名
//pathinfo(上傳檔案的原來檔案名稱, PATHINFO_EXTENSION)
$ext = pathinfo($source_file_name, PATHINFO_EXTENSION);
$ext = strtolower($ext); //將延伸的副檔名轉小寫
//2.判斷上傳檔案的大小 ====================================
if( $file_size > $max_size ){
//當目前檔案容量超過容量限制時, 以下準備顯示的資訊
if( $max_size >= 4096*4096 ){
$max_size /= (4096*4096);
$max_size .= 'M';
}elseif( $max_size >= 4096 ){
$max_size /= 4096;
$max_size .= 'K';
}
$msg ='上傳檔案過大,請選擇容量小於 '.$max_size.' 的檔案';
//3.判斷檔案類型 ===========================================
//in_array($ext, $allow_ext) 判斷 $ext變數的值 是否在 $allow_ext 這個陣列變數中
}elseif( !in_array( $ext, $allow_ext ) ){
$allow_str = ''; //準備將允許檔案類型的陣列內容, 組合成字串
foreach( $allow_ext as $key=>$value ){
//if的縮寫語法:條件?成立執行的工作:不成立執行的工作;
$key==0? $allow_str.= $value : $allow_str.=', '.$value;
}
$msg = '檔案類型不符合,請選擇 '.$allow_str.' 檔案';
//4.以上條件都沒問題的話, 則進行最後else中的工作===============
}else{
//搬移檔案 move_uploaded_file(要搬移的檔案, 目的地位置及目的檔案名稱), 成功傳回true(1)
$msg = @move_uploaded_file($tmp_name, $path.$file_name);
}
}else{
//這裡表示上傳有錯誤, 匹配錯誤編號顯示對應的訊息 ======================================
switch ($error) {
case 1: $msg = '上傳檔案超過 upload_max_filesize 容量最大值'; break;
case 2: $msg = '上傳檔案超過 post_max_size 總容量最大值'; break;
case 3: $msg = '檔案只有部份被上傳'; break;
case 4: $msg = '沒有檔案被上傳'; break;
case 6: $msg = '找不到主機端暫存檔案的目錄位置'; break;
case 7: $msg = '檔案寫入失敗'; break;
case 8: $msg = '上傳檔案被PHP程式中斷,表示主機端系統錯誤'; break;
}
} //if( $error == 0 ){ ..... end
return $msg; //回傳$msg的結果
}

16
wms/contract/contract-input.php

@ -17,8 +17,9 @@ $contractpersons = $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" integrity="sha512-aoTNnqZcT8B4AmeCFmiSnDlc4Nj/KPaZyB5G7JnOnUEkdNpCZs1LCankiYi01sLTyWy+m2P+W4XM+BuQ3Q4/Dg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<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-input-component" x-data="{
init(){
@ -262,7 +263,7 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%">
<thead>
<tr>
<td colspan="9">
<td colspan="8">
<h3 style='text-align:center'>合約入力(保養)</h3>
</td>
</tr>
@ -411,12 +412,12 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
<p class="alerttext" x-show="data.area==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">詳細地址</td>
<td colspan="3">
<td colspan="2">
<input 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 >
<td colspan="2">
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
<p class="alerttext" x-show="data.files==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
@ -577,8 +578,5 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
</div>
</div>
<script
src="./js/jquery/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous"></script>
<script src="./js/jquery/jquery-3.1.1.min.js"></script>
<script src="semantic/dist/semantic.min.js" ></script>

229
wms/contract/contract-newelevator-edit.php

@ -0,0 +1,229 @@
<?php
include("../header.php");
require_once("./conn.php");
$id = $_GET['contractid'];
$sql_str = "SELECT * FROM contract_m_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);
$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 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='{
isLoading:false,
data:{
id:<?php echo $id; ?>,
contractno:"<?php echo $contract["contract_no"]; ?>",
customer:"<?php echo $contract["customer"]; ?>",
manager:"<?php echo $contract["manager"]; ?>",
vat:"<?php echo $contract["vat"]; ?>",
case_name:"<?php echo $contract["case_name"]; ?>",
linkman:"<?php echo $contract["linkman"]; ?>",
lm_tel:"<?php echo $contract["lm_tel"]; ?>",
address:"<?php echo $contract["address"]; ?>",
salesman:"<?php echo $contract["salesman"]; ?>",
files:<?php echo $files; ?>,
newfiles:[],
deletefiles:[],
files_id: "<?php echo $contract["files_id"]; ?>",
},
deleteFileFn(id){
if(!confirm("確定要刪除嗎?")) return
this.data.files = this.data.files.filter(file=> id != file.id)
this.data.deletefiles.push(id)
console.log(this.data.deletefiles);
},
save(){
this.isLoading = true
const form = new FormData();
form.append("id", this.data.id);
form.append("contractno", this.data.contractno);
form.append("customer", this.data.customer);
form.append("manager", this.data.manager);
form.append("vat", this.data.vat);
form.append("case_name", this.data.case_name);
form.append("linkman", this.data.linkman);
form.append("lm_tel", this.data.lm_tel);
form.append("address", this.data.address);
form.append("salesman", this.data.salesman);
form.append("deletefiles", this.data.deletefiles);
form.append("files_id", this.data.files_id);
form.append("user_id", "<?php echo $user_id; ?>");
for (var i = 0; i < this.data.newfiles.length; i++) {
form.append("files[]", this.data.newfiles[i]);
}
axios.post("./api/putContractData.php", form).then(res=>{
console.log(res.data)
if(res.status === 200){
alert("更新成功")
}
this.isLoading = false
}).catch(error=>{
let code = error.response.status;
if(code == 422){
this.fail_arr = error.response.data
}
this.isLoading = false
})
},
uploadFiles(e){
this.data.newfiles = e.target.files
},
}'>
<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.customer" >
<p class="alerttext" x-show="data.customer==''"><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.manager" >
<p class="alerttext" x-show="data.manager==''"><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.vat" >
<p class="alerttext" x-show="data.vat==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">營業員</td>
<td style="vertical-align: middle">
<select class="salesman" id="salesman" x-model="data.salesman">
<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.case_name==''"><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.linkman" >
<p class="alerttext" x-show="data.linkman==''"><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.lm_tel" >
<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 colspan=3>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.case_name" >
<p class="alerttext" x-show="data.salesman==''"><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>
</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-newelevator-management.php?<?php echo $token_link; ?>'">回列表</button>
</div>
</div>
</div>
<script src="semantic/dist/semantic.min.js" ></script>
<script>
$('#table_index').DataTable(
{
"order": [
[0, "desc"],
]
}
);
Fancybox.bind('[data-fancybox="gallery"]', {
});
</script>

45
wms/contract/contract-newelevator-input.php

@ -1,16 +1,28 @@
<?php
include("../header.php");
require_once("./conn.php");
$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 defer src="./js/alpinejs/cdn.min.js"></script>
<script src="./js/axios/axios.min.js" integrity="sha512-aoTNnqZcT8B4AmeCFmiSnDlc4Nj/KPaZyB5G7JnOnUEkdNpCZs1LCankiYi01sLTyWy+m2P+W4XM+BuQ3Q4/Dg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="./js/axios/axios.min.js"></script>
<div class="contract-input-component" x-data="{
init(){
},
data:{
contractno:'D23080110',
@ -112,7 +124,7 @@ require_once("./conn.php");
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%">
<thead>
<tr>
<td colspan="9">
<td colspan="8">
<h3 style='text-align:center'>合約入力(新梯)</h3>
</td>
</tr>
@ -121,10 +133,10 @@ require_once("./conn.php");
<tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==1">
<tr>
<td style="vertical-align: middle">合約號</td>
<td>
<td colspan=5>
<input class="form-control" @keyup="nextStepKeyupFn($event)" type="text" name="contractno" x-model="data.contractno" >
</td>
<td style="vertical-align: middle">
<td colspan="2" style="vertical-align: middle">
<label for="customize">
<input type="checkbox" x-model="customize" id="customize" />自定義欄位
</label>
@ -160,10 +172,16 @@ require_once("./conn.php");
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.vat" >
<p class="alerttext" x-show="data.vat==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">營業員工號</td>
<td style="vertical-align: middle">營業員</td>
<td style="vertical-align: middle">
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.salesman" >
<p class="alerttext" x-show="data.case_name==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<div class="ui form">
<select class="salesman" id="salesman" x-model="data.salesman">
<?php foreach($persons as $person): ?>
<option value="<?php echo $person['value']; ?>"><?php echo $person['view']; ?></option>
<?php endforeach ?>
</select>
</div>
<p class="alerttext" x-show="data.salesman==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
@ -180,7 +198,7 @@ require_once("./conn.php");
<td style="vertical-align: middle">案件名稱</td>
<td colspan=3>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.case_name" >
<p class="alerttext" x-show="data.salesman==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<p class="alerttext" x-show="data.case_name==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
@ -225,9 +243,4 @@ require_once("./conn.php");
</div>
</div>
</div>
<script
src="./js/jquery/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous"></script>
<script src="semantic/dist/semantic.min.js" ></script>
<script src="./js/jquery/jquery-3.1.1.min.js"></script>

105
wms/contract/contract-newelevator-management.php

@ -0,0 +1,105 @@
<?php
include("../header.php");
require_once("./conn.php");
$sql_str = "SELECT * FROM contract_m_signed_back ";
$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="{
}">
<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>
</tr>
</thead>
<tbody>
<?php foreach($contracts as $contract): ?>
<tr>
<td><?php echo $contract['id']; ?></td>
<td><?php echo $contract['contract_no'] ?></td>
<td><?php echo $contract['customer'] ?></td>
<td><?php echo $contract['manager'] ?></td>
<td><?php echo $contract['vat'] ?></td>
<td><?php echo $contract['created_by'] ?></td>
<td><?php echo $contract['created_at'] ?></td>
<td style="width:30px">
<p>
<a href="contract-newelevator-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="repair-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" style="margin-left:10px;" onClick="return confirm('Are you sure you want to delete?')">
<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>

84
wms/contract/styles/style.css

@ -541,14 +541,14 @@ main table td, main table th {
transform: rotate(360deg);
}
}
.contract-input-component .form {
.contract-input-component .form, .contract-management .form {
margin: 0 auto;
}
.contract-input-component .form .dropdown {
.contract-input-component .form .dropdown, .contract-management .form .dropdown {
width: 100%;
margin-top: 7px;
}
.contract-input-component .form .savebtn {
.contract-input-component .form .savebtn, .contract-management .form .savebtn {
margin-right: 13px;
display: flex;
justify-content: center;
@ -557,7 +557,7 @@ main table td, main table th {
height: 45px;
font-size: 15px;
}
.contract-input-component .form table .alerttext {
.contract-input-component .form table .alerttext, .contract-management .form table .alerttext {
font-size: 13px;
color: #a00;
font-weight: 500;
@ -565,48 +565,104 @@ main table td, main table th {
font-weight: 900;
padding: 0;
}
.contract-input-component .form input[type=file] {
.contract-input-component .form input[type=file], .contract-management .form input[type=file] {
padding: 12px 20px;
margin: 8px 0;
}
.contract-input-component .error {
.contract-input-component .error, .contract-management .error {
display: flex;
flex-direction: column;
margin: 15px;
}
.contract-input-component .error .errortext {
.contract-input-component .error .errortext, .contract-management .error .errortext {
font-size: 16px;
font-weight: 500;
color: #a00;
}
.contract-input-component .input-group-btn {
.contract-input-component .input-group-btn, .contract-management .input-group-btn {
font-size: 16px;
}
@media screen and (max-width: 600px) {
.contract-input-component table {
.contract-input-component table, .contract-management table {
border: 0;
}
.contract-input-component table thead {
.contract-input-component table thead, .contract-management table thead {
display: none;
}
.contract-input-component table tr {
.contract-input-component table tr, .contract-management table tr {
margin-bottom: 10px;
display: block;
border-bottom: 2px solid #ddd;
}
.contract-input-component table td {
.contract-input-component table td, .contract-management table td {
display: block;
text-align: left;
font-size: 14px;
border-bottom: 1px dotted #ccc;
}
.contract-input-component table td:last-child {
.contract-input-component table td:last-child, .contract-management table td:last-child {
border-bottom: 0;
}
.contract-input-component table td:before {
.contract-input-component table td:before, .contract-management table td:before {
content: attr(data-label);
float: left;
text-transform: uppercase;
font-weight: bold;
}
}
.contract-input-component .images, .contract-management .images {
display: flex;
flex-wrap: wrap;
padding: 20px;
}
.contract-input-component .images > .image, .contract-management .images > .image {
position: relative;
margin: 10px;
}
.contract-input-component .images > .image:hover > i, .contract-management .images > .image:hover > i {
opacity: 1;
}
.contract-input-component .images > .image > i, .contract-management .images > .image > i {
position: absolute;
top: -12px;
right: -12px;
color: #b00;
cursor: pointer;
opacity: 0;
transition: 0.3s;
}
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: 0.5rem;
margin-top: 0.5rem;
}/*# sourceMappingURL=style.css.map */

2
wms/contract/styles/style.css.map

File diff suppressed because one or more lines are too long

56
wms/contract/styles/style.scss

@ -562,7 +562,7 @@ main{
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.contract-input-component{
.contract-input-component, .contract-management{
.form{
margin:0 auto;
.dropdown{
@ -640,4 +640,58 @@ main{
font-weight: bold;
}
}
.images{
display: flex;
flex-wrap: wrap;
padding: 20px;
>.image{
position: relative;
margin:10px;
&:hover > i{
opacity: 1;
}
>i{
position: absolute;
top: -12px;
right:-12px;
color:#b00;
cursor: pointer;
opacity: 0;
transition: .3s;
}
}
}
}
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;
}
Loading…
Cancel
Save