parent
a8701ca5b0
commit
ba43ed2fcc
|
|
@ -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')
|
||||
)
|
||||
");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
|||
<a href="#" class="btn btn-sm btn-outline-secondary btn-edit-install-wait" data-cc-uid="<?=$cc['cc_uid']?>" title="Edit">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
<a href="#" class="btn btn-sm btn-outline-secondary btn-restore-install-wait" data-cc-uid="<?=$cc['cc_uid']?>" title="Restore">
|
||||
<i class="bi bi-arrow-counterclockwise"></i>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue