355 lines
12 KiB
PHP
355 lines
12 KiB
PHP
<?
|
|
include getenv("DOCUMENT_ROOT")."/include/session_include.php";
|
|
|
|
//$func->checkAdmin("index.php");
|
|
|
|
$c_uid = trim($_POST["c_uid"]);
|
|
|
|
//echo "[$c_uid]";exit;
|
|
|
|
if ($mode == "") {
|
|
$mode = "update";
|
|
$btnName = "UPDATE";
|
|
$admTag = "DISABLED";
|
|
}
|
|
|
|
if($c_uid == "") {
|
|
$msg = "Invaild data. Please try again. [Err - c_uid / FORECAST-POPUP]";
|
|
$func -> modalMsg ($msg, 1);
|
|
exit();
|
|
} else {
|
|
|
|
// Get Information
|
|
$query = "SELECT * FROM tbl_customer WHERE c_uid = '$c_uid'";
|
|
$result=$jdb->fQuery($query, "fetch query error");
|
|
// echo"$query";
|
|
|
|
for($i=0; $i<sizeof($result); $i++)
|
|
{
|
|
//list($key, $value) = each($result);
|
|
foreach ( (Array) $result as $key => $value )
|
|
$$key = $value;
|
|
}
|
|
|
|
$c_locationSTR = str_replace("\\", "", $c_location);
|
|
$c_comment_riSTR = str_replace("\\", "", $c_comment_ri);
|
|
|
|
}
|
|
|
|
$c_paymenttypeSTR = $arrPaymenttype[$c_paymenttype];
|
|
|
|
if ($c_paymenttype =="CA") {
|
|
|
|
$query = "SELECT * FROM tbl_daily
|
|
WHERE d_customeruid = '$c_uid' AND d_status = 'F' AND d_quantity > 1 ORDER BY d_visitdate DESC LIMIT 1";
|
|
|
|
$result = $jdb->fQuery($query, "list error");
|
|
//echo "[$query]";
|
|
|
|
if ($result[0] != "") {
|
|
for($i=0; $i<sizeof($result); $i++)
|
|
{
|
|
//list($key, $value) = each($result);
|
|
foreach ( (Array) $result as $key => $value )
|
|
$$key = $value;
|
|
}
|
|
|
|
$d_visitdateSTR = $func -> convertFormat ($d_visitdate, 3);
|
|
|
|
if ($d_paystatus == "") $d_paystatus = "N";
|
|
$d_paystatusSTR = $arrPaidStatus[$d_paystatus];
|
|
|
|
if ($d_paystatus == "P") $d_paystatusSTR = $d_paystatusSTR." (".$d_visitdateSTR." / $".$d_payamount.")";
|
|
else $d_paystatusSTR = $d_paystatusSTR." (".$d_visitdateSTR.")";
|
|
}
|
|
else $d_paystatusSTR = "-";
|
|
}
|
|
|
|
$query_img = "
|
|
SELECT i_filepath, i_filename
|
|
FROM tbl_customer_image
|
|
WHERE i_customeruid = '$c_uid'
|
|
AND i_type = 'install'
|
|
AND i_status = 'A'
|
|
ORDER BY i_createddate DESC
|
|
LIMIT 1
|
|
";
|
|
$imgResult = $jdb->fQuery($query_img, "fetch image error");
|
|
|
|
$installImgUrl = "";
|
|
if (!empty($imgResult)) {
|
|
$installImgUrl = $imgResult['i_filepath'] . $imgResult['i_filename'];
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">CUSTOMER NOTE</h4>
|
|
<button type="button" class="btn" data-dismiss="modal" aria-label="Close" style="color:#fff;"><i class="bi bi-x"></i></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
|
|
<FORM NAME=customerShortInfo id=customerShortInfo METHOD=POST >
|
|
<input type=hidden name=actionStr value="SHORTINFO">
|
|
<input type=hidden name=actionPage value="">
|
|
<input type=hidden name=c_uid id=c_uid value="<?=$c_uid?>">
|
|
<input type=hidden name=c_accountno id=c_accountno value="<?=$c_accountno?>">
|
|
<input type=hidden name=mode id=mode value="update">
|
|
|
|
|
|
<table class="tb-info-box">
|
|
|
|
<tr>
|
|
<td class="td-title-info">Restaurant Name</td>
|
|
<td colspan="2" class="td-text-info">
|
|
<?=$c_name?>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Payment Type</td>
|
|
<td colspan="2" class="td-text-info">
|
|
<?=$c_paymenttypeSTR?>
|
|
</td>
|
|
</tr>
|
|
|
|
<? if ($c_paymenttype =="CA") { ?>
|
|
<tr>
|
|
<td class="td-title-info">Pay Status</td>
|
|
<td colspan="2" class="td-text-info">
|
|
<?=$d_paystatusSTR?>
|
|
</td>
|
|
</tr>
|
|
<? } ?>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Comment</td>
|
|
<td colspan="2" class="td-text-info">
|
|
<textarea id="c_comment_ri" class="textarea" name="c_comment_ri" rows="4" cols="20"><?=htmlspecialchars($c_comment_riSTR, ENT_QUOTES)?></textarea>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="td-title-info">Container Location</td>
|
|
<td colspan="2" class="td-text-info">
|
|
<textarea id="c_location" class="textarea" name="c_location" rows="2" cols="20"><?=htmlspecialchars($c_locationSTR, ENT_QUOTES)?></textarea>
|
|
</td>
|
|
</tr>
|
|
|
|
<!-- Access Time / Closing Days (표시 조각 AJAX 주입, 클릭 시 편집 팝업) -->
|
|
<tbody id="siAccessClosing"></tbody>
|
|
|
|
</table>
|
|
<br>
|
|
<div class="text-center grid-layout-col-2">
|
|
<?php if ($_SESSION['ss_LEVEL'] != 10): ?>
|
|
<button type="submit" id="buttonADD" class="btn-sub">SAVE</button>
|
|
<?php endif; ?>
|
|
<button type="button" class="btn-gray" data-dismiss="modal">CLOSE</button>
|
|
</div>
|
|
</FORM>
|
|
</div>
|
|
|
|
|
|
<div class="modal fade" id="myModalPopup" tabindex="-1" role="dialog" aria-labelledby="myModalPopup" style="opacity: 0.5; padding-right: 0px !important;">
|
|
<div class="modal-dialog modal-dialog-centered modal-xl" role="document">
|
|
<div class="modal-content" style="background-color:#2A9B56 !important; max-width:260px; margin: 0 auto;">
|
|
<div class="myModalPopup-body" style="text-align: center; border-radius: 5px; max-height:60px; font-size:18px; background-color:#2A9B56; color: #FFFFFF; font-weight: bold;padding:0.5em 1em; ">
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- ==============================================================
|
|
Access Time / Closing Days 편집 오버레이 (순수 오버레이)
|
|
- Bootstrap 모달 미사용: BS3/BS5 focus-trap 충돌 회피
|
|
- customer_access_time_popup.php / customer_closing_days_popup.php 재사용
|
|
============================================================== -->
|
|
<div id="siAccessPopupOverlay" style="display:none; position:fixed; top:0; left:0; right:0; bottom:0; z-index:100000; background:rgba(0,0,0,0.5);">
|
|
<div style="position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:92%; max-width:760px; background:#fff; border-radius:6px; overflow:hidden; box-shadow:0 10px 40px rgba(0,0,0,0.35);">
|
|
<div style="display:flex; justify-content:space-between; align-items:center; padding:10px 14px; background:#2A9B56; color:#fff;">
|
|
<h4 id="siAccessPopupTitle" style="margin:0; font-size:16px;">Edit</h4>
|
|
<button type="button" id="siAccessPopupClose" style="background:none; border:none; color:#fff; font-size:24px; line-height:1; cursor:pointer;">×</button>
|
|
</div>
|
|
<iframe id="siAccessPopupFrame" src="about:blank" title="Edit popup" style="width:100%; height:70vh; border:0; display:block;"></iframe>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
|
|
$(document).ready(function(){
|
|
|
|
$("#customerShortInfo").validate({
|
|
// Specify validation rules
|
|
/*ignore: ".ignore",
|
|
rules: {
|
|
d_quantity: {
|
|
required: true,
|
|
//minlength: 6,
|
|
},
|
|
d_payamount: {
|
|
required: "#d_paystatuspaid:checked",
|
|
//minlength: 6,
|
|
},
|
|
},
|
|
messages: {
|
|
d_quantity: {
|
|
required: "Please input Oil Quantity",
|
|
//minlength: "Minimum of 6 characters.",
|
|
},
|
|
d_payamount: {
|
|
required: "Please input Cash Amount",
|
|
//minlength: "Minimum of 6 characters.",
|
|
},
|
|
},
|
|
*/
|
|
errorElement : 'div',
|
|
|
|
|
|
submitHandler: function(form) {
|
|
|
|
var $inputs = $(form).find("input, select, button, textarea");
|
|
var serializedData = $(form).serialize();
|
|
|
|
//e.preventDefault();
|
|
/*
|
|
var d_mode = $('#mode').val();
|
|
var d_uid = $('#d_uid').val();
|
|
var d_visitdate = $('#d_visitdate').val();
|
|
var d_driveruid = $('#d_driveruid').val();
|
|
var d_customeruid = $('#d_customeruid').val();
|
|
var d_quantity = $('#d_quantity').val();
|
|
var d_sludge = $('#d_sludge').val();
|
|
var d_payamount = $('#d_payamount').val();
|
|
var d_paystatus = $('#d_paystatus').val();
|
|
var d_note = $('#d_note').val();
|
|
alert(d_mode); */
|
|
|
|
$.ajax({
|
|
url:"/lib/shortInfo_lib_process.php",
|
|
method:"POST",
|
|
data: serializedData,
|
|
|
|
/*
|
|
data:{d_mode:d_mode, d_uid:d_uid, d_visitdate:d_visitdate, d_driveruid:d_driveruid,
|
|
d_customeruid:d_customeruid, d_quantity:d_quantity, d_sludge:d_sludge,
|
|
d_payamount:d_payamount, d_paystatus:d_paystatus, d_note:d_note },
|
|
*/
|
|
//beforeSend:function(){
|
|
// $('#submitid').val("Updating");
|
|
//},
|
|
success:function(response){
|
|
//$('#addcartformid')[0].reset();
|
|
//For debugging
|
|
//$('.rt_debugging').html(response);
|
|
//alert(response);
|
|
if (response == "1") {
|
|
$('.myModalPopup-body').html("Saved Successfully.");
|
|
$('.myModalPopup-body').css('background-color', '#2A9B56');
|
|
$('#myModalcustomerShortInfo').modal('hide');
|
|
|
|
$('#myModalPopup').modal('show');
|
|
setTimeout(function () {
|
|
//$('#myModalcustomerShortInfo').modal('hide');
|
|
$('#myModalPopup').modal('hide');
|
|
parent.location.reload();
|
|
}, 1000);
|
|
} else if (response == "-1") {
|
|
$('.myModalPopup-body').html("You do not have permission.");
|
|
$('.myModalPopup-body').css('background-color', '#FF8205');
|
|
|
|
$('#myModalPopup').modal('show');
|
|
setTimeout(function () {
|
|
$('#myModalPopup').modal('hide');
|
|
}, 1500);
|
|
|
|
} else {
|
|
$('.myModalPopup-body').html("Failed. Please Try again.");
|
|
$('.myModalPopup-body').css('background-color', '#FF8205');
|
|
|
|
$('#myModalPopup').modal('show');
|
|
setTimeout(function () {
|
|
$('#myModalPopup').modal('hide');
|
|
}, 1500);
|
|
}
|
|
|
|
//$('#myModalAdminInfo').modal('hide');
|
|
//$('.cart-item-no').html(response);
|
|
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
function popup() {
|
|
const url = `/lib/customer_image_upload_popup.php?c_uid=<?=$c_uid?>&goStr=<?=$goStr?>`;
|
|
window.open(url, "uploadImage", "width=600,height=750,scrollbars=yes");
|
|
}
|
|
|
|
/* ----- Access Time / Closing Days 표시 + 편집 오버레이 ----- */
|
|
(function () {
|
|
var C_UID = "<?=$c_uid?>";
|
|
var popupConfig = {
|
|
accesstime: { url: '/lib/customer_access_time_popup.php', title: 'Access Time' },
|
|
closingdays: { url: '/lib/customer_closing_days_popup.php', title: 'Closing Days' }
|
|
};
|
|
var popupChanged = false;
|
|
|
|
// 이전 로드분 오버레이 제거 후 body 직속으로 이동 (중복/클리핑 방지)
|
|
jQuery('body > #siAccessPopupOverlay').remove();
|
|
var $overlay = jQuery('#siAccessPopupOverlay').appendTo(document.body);
|
|
|
|
function loadDisplay() {
|
|
if (!C_UID) { jQuery('#siAccessClosing').empty(); return; }
|
|
jQuery('#siAccessClosing').load('/lib/customer_access_display.php?c_uid=' + encodeURIComponent(C_UID));
|
|
}
|
|
loadDisplay();
|
|
|
|
function openPopup(key) {
|
|
var cfg = popupConfig[key];
|
|
if (!cfg || !C_UID) return;
|
|
popupChanged = false;
|
|
jQuery('#siAccessPopupTitle').text(cfg.title);
|
|
jQuery('#siAccessPopupFrame').attr('src', cfg.url + '?c_uid=' + encodeURIComponent(C_UID) + '&goStr=');
|
|
$overlay.css('display', 'block');
|
|
}
|
|
function closePopup() {
|
|
$overlay.css('display', 'none');
|
|
jQuery('#siAccessPopupFrame').attr('src', 'about:blank');
|
|
if (popupChanged) { loadDisplay(); popupChanged = false; }
|
|
}
|
|
|
|
jQuery(document).on('click', '#siAccessClosing .box-clickable[data-popup]', function () {
|
|
openPopup(jQuery(this).data('popup'));
|
|
});
|
|
jQuery('#siAccessPopupClose').on('click', closePopup);
|
|
$overlay.on('click', function (e) { if (e.target === this) closePopup(); });
|
|
|
|
// 자식 iframe(팝업 PHP)에서 호출
|
|
window.closeCustomerPopup = function (changed) {
|
|
if (changed) popupChanged = true;
|
|
closePopup();
|
|
};
|
|
})();
|
|
</script>
|
|
|
|
|
|
<link rel="stylesheet" href="/assets/css/customer_access.css">
|
|
|
|
<style>
|
|
.error{
|
|
color: red;
|
|
font-weight: 200;
|
|
margin-left: 0em;
|
|
}
|
|
</style>
|