@ -9,9 +9,10 @@ if(!(isset($_GET['id']) && !empty($_GET['id']))){
}
}
$id = $_GET["id"];
$id = $_GET["id"];
$sql_str = "SELECT contract_new_apply.*, account.name as review_person_name
$sql_str = "SELECT contract_new_apply.*, person_ account.name AS review_person_n ame, per son_final_account.name AS review_final _person_name
FROM contract_new_apply
FROM contract_new_apply
LEFT JOIN account ON contract_new_apply.review_person_id = account.accountid
LEFT JOIN account AS person_account ON contract_new_apply.review_person_id = person_account.accountid
LEFT JOIN account AS person_final_account ON contract_new_apply.review_final_person_id = person_final_account.accountid
WHERE contract_new_apply.mid = :mid";
WHERE contract_new_apply.mid = :mid";
$stmt = $conn->prepare($sql_str);
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid',$id);
$stmt->bindParam(':mid',$id);
@ -101,6 +102,7 @@ if(empty($contract_new_apply)){
}
}
$secondPayDeadline = $contract['secondPayDeadline'] ?? 0;
$secondPayDeadline = $contract['secondPayDeadline'] ?? 0;
$status = isset($contract['status']) ? $contract['status'] : -1;
$status = isset($contract['status']) ? $contract['status'] : -1;
$progress = isset($contract['progress']) ? $contract['progress'] : 0;
$person = $contract['person'];
$person = $contract['person'];
?>
?>
@ -140,12 +142,12 @@ $person = $contract['person'];
< / td >
< / td >
< td style = "vertical-align: middle" > 統一編號< / td >
< td style = "vertical-align: middle" > 統一編號< / td >
< td >
< td >
< input class = "form-control disabled_select" type = "text" x-model = "data.vat" >
< input class = "form-control disabled_select" type = "text" x-model = "data.vat" disabled >
< p class = "alerttext" x-show = "data.vat==''" > < i class = "fa-solid fa-circle-xmark" > < / i > 未填寫< / p >
< p class = "alerttext" x-show = "data.vat==''" > < i class = "fa-solid fa-circle-xmark" > < / i > 未填寫< / p >
< / td >
< / td >
< td style = "vertical-align: middle" > 合約書申請日期< / td >
< td style = "vertical-align: middle" > 合約書申請日期< / td >
< td >
< td >
< input class = "form-control disabled_select" type = "date" x-model = "data.apply_date" >
< input class = "form-control disabled_select" type = "date" x-model = "data.apply_date" disabled >
< p class = "alerttext" x-show = "data.apply_date==''" > < i class = "fa-solid fa-circle-xmark" > < / i > 未填寫< / p >
< p class = "alerttext" x-show = "data.apply_date==''" > < i class = "fa-solid fa-circle-xmark" > < / i > 未填寫< / p >
< / td >
< / td >
< td style = "vertical-align: middle" > 申請類別< / td >
< td style = "vertical-align: middle" > 申請類別< / td >
@ -159,17 +161,17 @@ $person = $contract['person'];
< tr >
< tr >
< td style = "vertical-align: middle" > 案件名稱< / td >
< td style = "vertical-align: middle" > 案件名稱< / td >
< td style = "vertical-align: middle" colspan = "3" >
< td style = "vertical-align: middle" colspan = "3" >
< input class = "form-control disabled_select" type = "text" x-model = "data.case_name" >
< input class = "form-control disabled_select" type = "text" x-model = "data.case_name" disabled >
< p class = "alerttext" x-show = "data.case_name==''" > < 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 >
< / td >
< td style = "vertical-align: middle" > 立約人< / td >
< td style = "vertical-align: middle" > 立約人< / td >
< td style = "vertical-align: middle" >
< td style = "vertical-align: middle" >
< input class = "form-control disabled_select" type = "text" x-model = "data.company" >
< input class = "form-control disabled_select" type = "text" x-model = "data.company" disabled >
< p class = "alerttext" x-show = "data.company==''" > < i class = "fa-solid fa-circle-xmark" > < / i > 未填寫< / p >
< p class = "alerttext" x-show = "data.company==''" > < i class = "fa-solid fa-circle-xmark" > < / i > 未填寫< / p >
< / td >
< / td >
< td style = "vertical-align: middle" > 負責人< / td >
< td style = "vertical-align: middle" > 負責人< / td >
< td style = "vertical-align: middle" >
< td style = "vertical-align: middle" >
< input class = "form-control disabled_select" type = "text" x-model = "data.manager" >
< input class = "form-control disabled_select" type = "text" x-model = "data.manager" disabled >
< p class = "alerttext" x-show = "data.manager==''" > < i class = "fa-solid fa-circle-xmark" > < / i > 未填寫< / p >
< p class = "alerttext" x-show = "data.manager==''" > < i class = "fa-solid fa-circle-xmark" > < / i > 未填寫< / p >
< / td >
< / td >
< / tr >
< / tr >
@ -193,7 +195,7 @@ $person = $contract['person'];
< tr >
< tr >
< td style = "vertical-align: middle" > 聯絡地址< / td >
< td style = "vertical-align: middle" > 聯絡地址< / td >
< td style = "vertical-align: middle" colspan = 3 >
< td style = "vertical-align: middle" colspan = 3 >
< input class = "form-control disabled_select" type = "text" x-model = "data.address" >
< input class = "form-control disabled_select" type = "text" x-model = "data.address" disabled >
< p class = "alerttext" x-show = "data.address==''" > < i class = "fa-solid fa-circle-xmark" > < / i > 未填寫< / p >
< p class = "alerttext" x-show = "data.address==''" > < i class = "fa-solid fa-circle-xmark" > < / i > 未填寫< / p >
< / td >
< / td >
< td style = "vertical-align: middle" > 完工期限< / td >
< td style = "vertical-align: middle" > 完工期限< / td >
@ -407,7 +409,7 @@ $person = $contract['person'];
< / td >
< / td >
< td >
< td >
< div class = "ui labeled input" >
< div class = "ui labeled input" >
< input type = "number" placeholder = "90" style = "width:65px;padding:0 12px;" x-model = "pays[ <?php echo $pay [ 'pay_kind' ]; ?> ].condition_date" >
< input type = "number" placeholder = "90" style = "width:65px;padding:0 12px;" x-model = "pays[ <?php echo $pay [ 'pay_kind' ]; ?> ].condition_date" disabled >
< div class = "ui label" >
< div class = "ui label" >
天
天
< / div >
< / div >
@ -415,7 +417,7 @@ $person = $contract['person'];
< / td >
< / td >
< td >
< td >
< div class = "ui labeled input" >
< div class = "ui labeled input" >
< input type = "number" placeholder = "90" style = "width:65px;padding:0 12px;" x-model = "pays[ <?php echo $pay [ 'pay_kind' ]; ?> ].pay_period" >
< input type = "number" placeholder = "90" style = "width:65px;padding:0 12px;" x-model = "pays[ <?php echo $pay [ 'pay_kind' ]; ?> ].pay_period" disabled >
< div class = "ui label" >
< div class = "ui label" >
天
天
< / div >
< / div >
@ -448,13 +450,17 @@ $person = $contract['person'];
< thead style = "font-weight: bolder;margin-bottom: 20px;" >
< thead style = "font-weight: bolder;margin-bottom: 20px;" >
< tr >
< tr >
< td colspan = 8 >
< td colspan = 8 >
< h4 style = 'text-align:center;font-weight: bolder' > 附件上傳 < / h4 >
< h4 style = 'text-align:center;font-weight: bolder' > 其他 < / h4 >
< / td >
< / td >
< / tr >
< / tr >
< / thead >
< / thead >
< tbody >
< tbody >
< tr >
< tr >
< td colspan = "4" > 附件上傳< / td >
< td colspan = "1" > 說明< / td >
< td colspan = "2" >
< textarea name = "description" x-model = "data.description" > < / textarea >
< / td >
< td colspan = "1" > 附件上傳< / td >
< td colspan = "4" >
< td colspan = "4" >
<?php if ( $status < 1 ) : ?>
<?php if ( $status < 1 ) : ?>
< input type = "file" name = "file[]" multiple draggable = "true" @ change = "uploadFiles($event)" / >
< input type = "file" name = "file[]" multiple draggable = "true" @ change = "uploadFiles($event)" / >
@ -463,7 +469,9 @@ $person = $contract['person'];
< template x-if = "file" >
< template x-if = "file" >
< div >
< div >
< a :href = "'./images/contracts_new_files/' + file.file_name" download x-text = "file.file_name" > < / a >
< a :href = "'./images/contracts_new_files/' + file.file_name" download x-text = "file.file_name" > < / a >
<?php if ( $status <= 0 ) : ?>
< span @ click = "removeFile(file.id)" style = "margin-left:10px;cursor:pointer;color:#f019" > X< / span >
< span @ click = "removeFile(file.id)" style = "margin-left:10px;cursor:pointer;color:#f019" > X< / span >
<?php endif ; ?>
< / div >
< / div >
< / template >
< / template >
< / template >
< / template >
@ -487,7 +495,7 @@ $person = $contract['person'];
< td > 結果< / td >
< td > 結果< / td >
< td colspan = 2 > 意見< / td >
< td colspan = 2 > 意見< / td >
< td > 時間< / td >
< td > 時間< / td >
< td colspan = 2 > <?php if ( $user_id === "M0174" && $status == 1 ) : ?> 審核意見<?php endif ; ?> </ td >
< td colspan = 2 > <?php if (( $user_id === "M0174" || $user_id === "M0107" || $user_id === "M0060" ) && $status == 1 ) : ?> 審核意見<?php endif ; ?> </ td >
< / tr >
< / tr >
< tr >
< tr >
< td > 營業員< / td >
< td > 營業員< / td >
@ -499,8 +507,8 @@ $person = $contract['person'];
< / td >
< / td >
< td colspan = 2 > ---< / td >
< td colspan = 2 > ---< / td >
< td > <?php echo ( $contract [ 'submit_date' ]) ?? "---" ; ?> </ td >
< td > <?php echo ( $contract [ 'submit_date' ]) ?? "---" ; ?> </ td >
< td colspan = 2 rowspan = "2 " >
< td colspan = 2 rowspan = "3 " >
<?php if ( $user_id === "M0174" && $status == 1 ) : ?>
<?php if (( $user_id === "M0174" || $user_id === "M0107" || $user_id === "M0060" ) && $status == 1 ) : ?>
< textarea class = "form-control opinion" x-model = "data.review_comment" > < / textarea >
< textarea class = "form-control opinion" x-model = "data.review_comment" > < / textarea >
<?php endif ; ?>
<?php endif ; ?>
< / td >
< / td >
@ -509,13 +517,24 @@ $person = $contract['person'];
< td > 業務承辦人< / td >
< td > 業務承辦人< / td >
< td >< span > <?php echo ( ! isset ( $contract [ 'review_person_name' ]) || empty ( $contract [ 'review_person_name' ])) ? "---" : $contract [ 'review_person_name' ] . "(" . $contract [ 'review_person_id' ] . ")" ; ?> </ span ></ td >
< td >< span > <?php echo ( ! isset ( $contract [ 'review_person_name' ]) || empty ( $contract [ 'review_person_name' ])) ? "---" : $contract [ 'review_person_name' ] . "(" . $contract [ 'review_person_id' ] . ")" ; ?> </ span ></ td >
< td >
< td >
<?php if ( $status == 3 ) : ?> < span class = "successtext" > 結案 同意</ span > <?php endif ; ?>
<?php if (( $status == 1 || $status == 3 ) && $progress >= 2 ) : ?> < span class = "successtext" > 已 同意</ span > <?php endif ; ?>
<?php if ( $status == 2 ) : ?> < span class = "failtext" > 結案不同意</ span > <?php endif ; ?>
<?php if ( $status == 2 ) : ?> < span class = "failtext" > 結案不同意</ span > <?php endif ; ?>
<?php if ( $status < 2 ) : ?> < span > ---</ span > <?php endif ; ?>
<?php if ( $status < 2 && $progress < 2 ) : ?> < span > ---</ span > <?php endif ; ?>
< / td >
< / td >
< td colspan = 2 > <?php echo $contract [ 'review_comment' ] ?? "---" ; ?> </ td >
< td colspan = 2 > <?php echo $contract [ 'review_comment' ] ?? "---" ; ?> </ td >
< td > <?php echo $contract [ 'review_date' ] ?? "---" ; ?> </ td >
< td > <?php echo $contract [ 'review_date' ] ?? "---" ; ?> </ td >
< / tr >
< / tr >
< tr >
< td > 業務部協理< / td >
< td >< span > <?php echo ( ! isset ( $contract [ 'review_final_person_name' ]) || empty ( $contract [ 'review_final_person_name' ])) ? "---" : $contract [ 'review_final_person_name' ] . "(" . $contract [ 'review_final_person_id' ] . ")" ; ?> </ span ></ td >
< td >
<?php if ( $status == 3 ) : ?> < span class = "successtext" > 結案同意</ span > <?php endif ; ?>
<?php if ( $status == 2 ) : ?> < span class = "failtext" > 結案不同意</ span > <?php endif ; ?>
<?php if ( $status < 2 ) : ?> < span > ---</ span > <?php endif ; ?>
< / td >
< td colspan = 2 > <?php echo $contract [ 'review_final_comment' ] ?? "---" ; ?> </ td >
< td > <?php echo $contract [ 'review_final_date' ] ?? "---" ; ?> </ td >
< / tr >
<!-- <tr>
<!-- <tr>
< td colspan = "2" style = "font-weight:bold" > 業務部承辦人< / td >
< td colspan = "2" style = "font-weight:bold" > 業務部承辦人< / td >
< td colspan = "2" >
< td colspan = "2" >
@ -553,10 +572,18 @@ $person = $contract['person'];
< / template >
< / template >
< / button >
< / button >
<?php endif ; ?>
<?php endif ; ?>
<?php if ( $status == 1 && ( $user_id == "M0107" || $user_id == "M0060" || $user_id == "M0174" )) : ?>
<?php if ( $status == 1 && (( $user_id == "M0107" && $contract [ 'progress' ] <= 1 ) || ( $user_id == "M0060" && $contract [ 'progress' ] == 2 ) || $user_id == "M0174" )) : ?>
< button x-show = "true" x-on:click = "agree()" :disabled = "isLoading" type = "button" class = "btn btn-primary btn-lg pull-right savebtn" >
< button x-show = "true" x-on:click = "agree()" :disabled = "isLoading" type = "button" class = "btn btn-primary btn-lg pull-right savebtn" >
< template x-if = "!isLoading" >
< template x-if = "!isLoading" >
< span > 同意(結案)< / span >
< span >
<?php
if($user_id === "M0107" & & $contract['progress'] < = 1 ){
echo "同意(上呈)";
}elseif($user_id === "M0060" & & $contract['progress'] == 2){
echo "同意(結案)";
}
?>
< / span >
< / template >
< / template >
< template x-if = "isLoading" >
< template x-if = "isLoading" >
< div class = "loader" > < / div >
< div class = "loader" > < / div >
@ -613,6 +640,10 @@ $person = $contract['person'];
const workdeadline_b = 7;
const workdeadline_b = 7;
const total_items = <?php echo $total_items ?? '' ; ?> ;
const total_items = <?php echo $total_items ?? '' ; ?> ;
const isFirst = <?php echo $isFirst ; ?> ;
const isFirst = <?php echo $isFirst ; ?> ;
const originfiles = [];
const description = '';
const contractstatus = null;
const progress = 0;
< / script >
< / script >
<?php else : ?>
<?php else : ?>
< script >
< script >
@ -642,10 +673,12 @@ $person = $contract['person'];
const secondPayDeadline = <?php echo $secondPayDeadline ?? '' ; ?> ;
const secondPayDeadline = <?php echo $secondPayDeadline ?? '' ; ?> ;
const total_items = <?php echo $contract [ 'total_items' ] ?? '' ; ?> ;
const total_items = <?php echo $contract [ 'total_items' ] ?? '' ; ?> ;
const contract_new_apply_id = <?php echo $contract_new_apply_id ; ?> ;
const contract_new_apply_id = <?php echo $contract_new_apply_id ; ?> ;
const originfiles = [...<?php echo json_encode ( $files ); ?> ];
const originfiles = [...<?php echo json_encode ( $files ) ?? []; ?> ];
const description = '<?php echo $contract [ 'description' ]; ?> ';
const contractstatus = <?php echo $contract [ 'status' ]; ?> ;
const progress = <?php echo $contract [ 'progress' ]; ?> ;
< / script >
< / script >
<?php endif ; ?>
<?php endif ; ?>
<?php if ( $status > 0 || ( $person != $user_id && $user_id != "M0174" )) : ?>
<?php if ( $status > 0 || ( $person != $user_id && $user_id != "M0174" )) : ?>
< script >
< script >
@ -653,12 +686,16 @@ $person = $contract['person'];
const input = document.querySelectorAll('input');
const input = document.querySelectorAll('input');
const alerttext = document.querySelectorAll('p.alerttext');
const alerttext = document.querySelectorAll('p.alerttext');
const select = document.querySelectorAll('select');
const select = document.querySelectorAll('select');
const textarea = document.querySelectorAll('textarea');
for(let i=0;i< input.length ; i + + ) {
for(let i=0;i< input.length ; i + + ) {
input[i].disabled = true
input[i].disabled = true
}
}
for(let i=0;i< select.length ; i + + ) {
for(let i=0;i< select.length ; i + + ) {
select[i].disabled = true
select[i].disabled = true
}
}
for(let i=0;i< textarea.length ; i + + ) {
textarea[i].disabled = true
}
for(let i=0;i< alerttext.length ; i + + ) {
for(let i=0;i< alerttext.length ; i + + ) {
alerttext[i].style.display = "none"
alerttext[i].style.display = "none"
}
}