From ba43ed2fccb7945217f27925feddb960f8fbda46 Mon Sep 17 00:00:00 2001 From: Hyojin Ahn Date: Thu, 28 May 2026 08:46:24 -0400 Subject: [PATCH] =?UTF-8?q?v1.2.35=20-=20[CUSTOMER]=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=EB=90=9C=20Container=20=EB=B3=B5=EA=B5=AC=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public_html/assets/api/install.php | 23 ++++++++++++----- public_html/doc/customer_detail.php | 38 +++++++++++++++++++++++++---- 2 files changed, 50 insertions(+), 11 deletions(-) diff --git a/public_html/assets/api/install.php b/public_html/assets/api/install.php index 2f2b55e..80936a6 100644 --- a/public_html/assets/api/install.php +++ b/public_html/assets/api/install.php @@ -1240,7 +1240,7 @@ trait InstallAPI { $c_uid = intval($_POST['c_uid'] ?? 0); $type = addslashes($_POST['type'] ?? ''); - if( $mode != 'PICKUP' ) $capacity = $_POST['capacity'] !== '' ? intval($_POST['capacity']) : "NULL"; + if( $mode != 'PICKUP' && $mode != 'RESTORE') $capacity = $_POST['capacity'] !== '' ? intval($_POST['capacity']) : "NULL"; $is_used = $_POST['is_used'] ?? 'N'; $has_lock = $_POST['has_lock'] ?? 'N'; $has_wheel = $_POST['has_wheel'] ?? 'N'; @@ -1333,6 +1333,21 @@ trait InstallAPI { qry($sql); } + if($mode==='RESTORE'){ + $sql=" + UPDATE tbl_customer_container + SET + cc_status='A', + cc_pickup_date=NULL, + cc_pickup_note='', + cc_pickup_at=NULL, + cc_modified_at=NOW(), + cc_updateddate=DATE_FORMAT(NOW(),'%Y%m%d%H%i%s') + WHERE cc_uid='{$cc_uid}' + "; + qry($sql); + } + echo $this->json(['ok'=>1]); } @@ -1626,7 +1641,6 @@ trait InstallAPI { 'd_quantity' => $oil_qty, 'd_sludge' => $sludge, 'd_inputdate' => $now14, - 'd_is_transfer' => 'N', 'd_level' => $_SESSION['ss_LEVEL'] ?? '', 'd_createruid' => $_SESSION['ss_UID'] ?? '', 'd_createddate' => $now14, @@ -2035,9 +2049,6 @@ trait InstallAPI { // INSTALL else if($action === 'INSTALL'){ - - $nowYmdHis = date('YmdHis'); - qry(" INSERT INTO tbl_customer_container ( cc_customer_uid, @@ -2056,7 +2067,7 @@ trait InstallAPI { 'A', '{$note}', NOW(), NOW(), - NOW(), NOW() + DATE_FORMAT(NOW(),'%Y%m%d%H%i%s'), DATE_FORMAT(NOW(),'%Y%m%d%H%i%s') ) "); } diff --git a/public_html/doc/customer_detail.php b/public_html/doc/customer_detail.php index 80796eb..1d1d5b1 100644 --- a/public_html/doc/customer_detail.php +++ b/public_html/doc/customer_detail.php @@ -892,7 +892,7 @@ document.addEventListener('DOMContentLoaded', function(){ document.querySelectorAll('.cm-opt').forEach(b => b.disabled = false); } - // 🔹 Add + // Add const addBtn = document.getElementById('addContainer'); if(addBtn){ addBtn.onclick = function(){ @@ -903,7 +903,7 @@ document.addEventListener('DOMContentLoaded', function(){ }; } - // 🔹 Edit + // Edit document.querySelectorAll('.btn-edit-install-wait').forEach(btn => { btn.addEventListener('click', function (e) { e.preventDefault(); @@ -923,7 +923,7 @@ document.addEventListener('DOMContentLoaded', function(){ }); }); - // 🔹 Delete (Deactivate) + // Delete (Deactivate) document.querySelectorAll('.btn-delete-install-wait').forEach(btn=>{ btn.addEventListener('click', function(e){ e.preventDefault(); @@ -945,14 +945,39 @@ document.addEventListener('DOMContentLoaded', function(){ }); }); - // 🔹 옵션 토글 + // Restore + document.querySelectorAll('.btn-restore-install-wait').forEach(btn=>{ + btn.addEventListener('click', function(e){ + e.preventDefault(); + + if(!confirm('Restore this container?')){ + return; + } + + const payload = { + mode: 'RESTORE', + cc_uid: e.currentTarget.getAttribute('data-cc-uid'), + c_uid: c_uid + }; + + api('customer_container_save', payload, function(res){ + if(res.ok){ + location.reload(); + }else{ + alert('Error restoring container'); + } + }); + }); + }); + + // 옵션 토글 document.querySelectorAll('.cm-opt').forEach(btn=>{ btn.addEventListener('click', function(){ this.classList.toggle('active'); }); }); - // 🔹 Save + // Save document.getElementById('cm_save_btn').onclick = function(e){ e.preventDefault(); const payload = { @@ -1750,6 +1775,9 @@ $(document).ready(function() + + +