diff --git a/wms/contract/api/postContractNewApplyData.php b/wms/contract/api/postContractNewApplyData.php
index dec5c161..3cd1682f 100644
--- a/wms/contract/api/postContractNewApplyData.php
+++ b/wms/contract/api/postContractNewApplyData.php
@@ -201,6 +201,21 @@ if(isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 0
$stmt ->bindParam(':updated_by', $updated_by);
$stmt ->execute();
}
+ $deleted_at = date("Y-m-d H:i:s");
+ $removefiles = json_decode($_POST['removefiles'], true);
+ print_r($removefiles);
+ if(count($removefiles) > 0){
+ foreach($removefiles as $file){
+ $sql_str = "UPDATE contract_apply_files SET deleted_at = :deleted_at WHERE id = :fileid";
+ $stmt = $conn -> prepare($sql_str);
+ $stmt ->bindParam(':deleted_at', $deleted_at);
+ $stmt ->bindParam(':fileid', $file);
+ $stmt ->execute();
+ }
+ }
+
+
+
header("HTTP/1.1 201 success!");
$conn->commit();
@@ -251,6 +266,7 @@ if(isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 2
$progress = $_POST['progress'];
$review_comment = $_POST['review_comment'];
$user_id = $_POST['review_person_id'];
+ echo $user_id;
$review_date = date('Y-m-d H:i:s');
$conn->beginTransaction();
try{
diff --git a/wms/contract/contract-new-apply.php b/wms/contract/contract-new-apply.php
index 1f2948ec..c618f482 100644
--- a/wms/contract/contract-new-apply.php
+++ b/wms/contract/contract-new-apply.php
@@ -92,6 +92,7 @@ if(empty($contract_new_apply)){
}
$sql_str = "SELECT file_name FROM contract_apply_files WHERE contract_id = :contract_id AND deleted_at IS NULL";
+ $sql_str = "SELECT contract_apply_files.file_name, contract_apply_files.id as id FROM contract_new_apply LEFT JOIN contract_apply_files ON contract_new_apply.id = contract_apply_files.contract_id WHERE contract_new_apply.mid = :contract_id AND contract_apply_files.deleted_at IS NULL";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':contract_id', $id);
$stmt->execute();
@@ -451,7 +452,6 @@ $person = $contract['person'];
-
附件上傳 |
@@ -459,9 +459,13 @@ $person = $contract['person'];
-
- X
-
+
+
+
+
@@ -501,7 +505,7 @@ $person = $contract['person'];
業務承辦人 |
- |
+ |
結案同意
結案不同意
@@ -636,6 +640,7 @@ $person = $contract['person'];
const secondPayDeadline = ;
const total_items = ;
const contract_new_apply_id = ;
+ const originfiles = [...];
diff --git a/wms/contract/images/contracts_new_files/m202312201449117041v7041M1汰改合約書.doc b/wms/contract/images/contracts_new_files/m202312201449117041v7041M1汰改合約書.doc
new file mode 100644
index 00000000..03df41fe
Binary files /dev/null and b/wms/contract/images/contracts_new_files/m202312201449117041v7041M1汰改合約書.doc differ
diff --git a/wms/contract/js/alpine.js b/wms/contract/js/alpine.js
index fe060601..de76f0d3 100644
--- a/wms/contract/js/alpine.js
+++ b/wms/contract/js/alpine.js
@@ -1212,6 +1212,8 @@ const contractNewApply = ()=>{
secondPayDeadline: secondPayDeadline,
total_items: total_items,
files:[],
+ removefiles:[],
+ originfiles: originfiles,
},
pays:{
1:{
@@ -1297,6 +1299,7 @@ const contractNewApply = ()=>{
form.append('user_id', user_id);
form.append('pays', JSON.stringify(this.pays));
form.append('status', 0);
+ form.append('removefiles', JSON.stringify(this.data.removefiles))
form.append('salesman_comment', this.data.salesman_comment);
for (var i = 0; i < this.data.files.length; i++) {
form.append('files[]', this.data.files[i]);
@@ -1305,11 +1308,11 @@ const contractNewApply = ()=>{
if(res.status === 201){
alert('暫存成功');
console.log(res.data);
- window.location.reload();
+ // window.location.reload();
}else if(res.status === 200){
alert('更新成功');
console.log(res.data);
- window.location.reload();
+ // window.location.reload();
}
this.isLoading = false
}).catch(error=>{
@@ -1400,9 +1403,7 @@ const contractNewApply = ()=>{
})
},
disagree(){
- if(!confirm('確定退回嗎?')){
- return;
- }
+ if(!confirm('確定退回嗎?')) return;
this.isLoading = true
const form = new FormData();
form.append('contract_new_apply_id', contract_new_apply_id);
@@ -1415,7 +1416,7 @@ const contractNewApply = ()=>{
if(res.status === 200){
alert('退回成功');
console.log(res.data);
- window.location.reload();
+ // window.location.reload();
}
this.isLoading = false
}).catch(error=>{
@@ -1426,6 +1427,13 @@ const contractNewApply = ()=>{
uploadFiles(e){
this.data.files = e.target.files
},
+ removeFile(id){
+ if(!confirm('確定移除該檔案嗎?')) return;
+ console.log(id);
+ this.data.removefiles.push(id);
+ this.data.originfiles.splice(id, 1);
+ this.data.originfiles = this.data.originfiles.filter(file=> file.id != id)
+ }
}
}
\ No newline at end of file
|