diff --git a/public_html/assets/api/daily.php b/public_html/assets/api/daily.php
index 90d0cd2..956e328 100644
--- a/public_html/assets/api/daily.php
+++ b/public_html/assets/api/daily.php
@@ -318,7 +318,7 @@ class DailyService extends CONF {
// 숫자 필드 기본값
$intFields = [
'd_quantity',
- 'd_sludge'
+ //'d_sludge' 주석처리-값이 비었을 때 0이 되지 않게
];
foreach ($intFields as $f) {
@@ -692,6 +692,13 @@ class DailyService extends CONF {
$isTop = $customer['c_is_top'] ?? '';
+ // [추가된 로직] d_sludge 업데이트 판단
+ // 화면에서 넘어온 d_sludge가 빈칸이 아니면 c_sludge를 갱신
+ if (isset($after['d_sludge']) && (string)$after['d_sludge'] !== '') {
+ $val = (int)$after['d_sludge'];
+ $updateFields[] = "c_sludge = '{$val}'";
+ }
+
// --------------------------------------------------
// 0) Ghost Check
// --------------------------------------------------
diff --git a/public_html/doc/customer_detail.php b/public_html/doc/customer_detail.php
index 0d19a61..0b921ea 100644
--- a/public_html/doc/customer_detail.php
+++ b/public_html/doc/customer_detail.php
@@ -396,6 +396,15 @@ if ($mode == "update") {
$c_driveruidSTRM .= "";
}
+
+ // --- 슬러지 기본값 설정 로직 추가 시작 ---
+ // d_sludge(오늘 입력값)가 없으면 고객 정보의 c_sludge를 기본값으로 사용
+ if (!isset($d_sludge) || trim((string)$d_sludge) === '') {
+ $display_sludge = $c_sludge;
+ } else {
+ $display_sludge = $d_sludge;
+ }
+ // --- 로직 추가 끝 ---
}
addLog ("add", "CUSTOMER DETAIL", "VIEW", $lguserid, $query, $c_uid);
@@ -2615,7 +2624,11 @@ $(document).ready(function(){
d_payamount: {
required: "#d_paystatuspaid:checked",
//minlength: 6,
- },
+ },
+ // --- 슬러지 규칙 추가 ---
+ d_sludge: {
+ required: true
+ }
},
messages: {
d_quantity: {
@@ -2625,18 +2638,50 @@ $(document).ready(function(){
d_payamount: {
required: "Please input Cash Amount",
//minlength: "Minimum of 6 characters.",
- },
+ },
+ // --- 슬러지 메시지 추가 ---
+ d_sludge: {
+ required: "Please input Sludge value"
+ }
},
errorElement : 'div',
+ errorPlacement: function(error, element) {
+ // 메시지 스타일 조정
+ error.css({
+ "color": "red",
+ "font-size": "13px",
+ "margin-top": "2px",
+ "display": "block"
+ });
+
+ if (element.hasClass("d_sludge")) {
+ // 슬러지 버튼 박스(.number-input) 전체의 뒤에 에러 배치
+ error.insertAfter(element.closest('.number-input'));
+ } else {
+ error.insertAfter(element);
+ }
+ },
+ highlight: function(element) {
+ $(element).css('border', '2px solid red');
+ },
+ unhighlight: function(element) {
+ $(element).css('border', '');
+ },
+ // 핵심: 이 핸들러가 있어야 검증 실패 시 제출을 막습니다.
+ submitHandler: function(form) {
+ form.submit();
+ }
+ });
+
- submitHandler: function(form) {
- //if (grecaptcha.getResponse(1) == '') alert("Error");
- //else form.submit();
- form.submit();
- }
-
- });
+ // 증감 버튼 클릭 시 0이라도 값이 있으면 에러 즉시 삭제
+ $(document).on('click', '.number-input button', function() {
+ var $input = $(this).siblings('input.d_sludge');
+ setTimeout(function() {
+ $input.valid(); // 실시간 검증 트리거
+ }, 10);
+ });
// 2. [추가 코드] 오프캔버스 객체 생성 및 버튼 이벤트
var canvasEl = document.getElementById("customerInfoCanvas");
@@ -2748,22 +2793,21 @@ $(document).ready(function(){
- | Oil Quantity |
-
-
- |
+ Quantity |
+
+
+ |
- | Sludge (%) |
-
-
-
-
-
-
-
- |
+ Sludge (%) |
+
+
+
+
+
+
+ |
if ($d_paymenttype =="CA") { ?>
diff --git a/public_html/doc/map.php b/public_html/doc/map.php
index ceafb93..5022c22 100644
--- a/public_html/doc/map.php
+++ b/public_html/doc/map.php
@@ -415,6 +415,7 @@ function popup(){
Oil Quantity |
+ Please input Oil Quantity
|
@@ -424,9 +425,12 @@ function popup(){
-
+
+ Please input the Sludge value.
+
+
@@ -1506,7 +1510,10 @@ function popup(){
let loadingTxt = 'Loading...';
jQuery("#map-modal-input .shortinput-store-name").text(loadingTxt);
-
+ // =슬러지 에러메세지 초기화=====================================================
+ jQuery(".qty-error, .sludge-error").hide();
+ jQuery("#map-modal-input .d_quantity, #map-modal-input .d_sludge").css("border", "1px solid #ced4da");
+ // ===========================================================================
jQuery("#map-modal-input .d_uid, #map-modal-input .d_customeruid, #map-modal-input .d_customerno, #map-modal-input .orderdate, #map-modal-input .d-ruid, #map-modal-input .d_visitdate, #map-modal-input .d_quantity, #map-modal-input .d_sludge, #map-modal-input .d_note").val('');
jQuery("#map-modal-input .d_payamount, #map-modal-input .d_payeename").val('');
jQuery("#map-modal-input .d_customeruid").val(customer_id);
@@ -1583,11 +1590,25 @@ function popup(){
}
function saveInputValidation(){
- jQuery("#map-modal-input .d_visitdate, #map-modal-input .d_quantity").css("border","1px solid black");
+ // 1. 초기화 (테두리 원복 및 에러메시지 숨김)
+ jQuery("#map-modal-input .d_quantity, #map-modal-input .d_sludge").css("border", "1px solid black");
+ jQuery(".qty-error, .sludge-error").hide();
- if(jQuery("#map-modal-input .d_quantity").val().trim() === '') {
- jQuery("#map-modal-input .d_quantity").css("border","1px solid red");
- return false;
+ // 2. 수량(Quantity) 검사
+ if(jQuery("#map-modal-input .d_quantity").val().trim() === '') {
+ jQuery("#map-modal-input .d_quantity").css("border", "1px solid red");
+ jQuery(".qty-error").show(); // 수량 에러 문구 표시
+ jQuery("#map-modal-input .d_quantity").focus();
+ return false;
+ }
+
+ // 3. 슬러지(Sludge) 검사
+ if(jQuery("#map-modal-input .d_sludge").val().trim() === '') {
+ // .number-input 박스 자체나 input에 빨간 테두리
+ jQuery("#map-modal-input .d_sludge").css("border", "1px solid red");
+ jQuery(".sludge-error").show(); // 슬러지 에러 문구 표시
+ jQuery("#map-modal-input .d_sludge").focus();
+ return false;
}
return true;
diff --git a/public_html/lib/order_lib.php b/public_html/lib/order_lib.php
index fc86f2d..49eaf02 100644
--- a/public_html/lib/order_lib.php
+++ b/public_html/lib/order_lib.php
@@ -93,7 +93,6 @@ $qry_sludge = "SELECT c_sludge FROM tbl_customer WHERE c_uid ='$d_customeruid' "
$rt_sludge = $jdb->fQuery($qry_sludge, "fetch query error");
-
// Get Driver Info (Request)
$qry_dr = "SELECT * FROM tbl_driver WHERE dr_status = 'A' ".$add_qry." ORDER by dr_initial ASC ";
$rt_dr = $jdb->nQuery($qry_dr, "list error");
@@ -110,7 +109,8 @@ while($lt_dr=mysqli_fetch_array($rt_dr, MYSQLI_ASSOC)) {
?>
-
+
+
@@ -224,7 +224,13 @@ $(document).ready(function(){
d_payamount: {
required: "#d_paystatuspaid:checked",
//minlength: 6,
- },
+ },
+ // --- d_sludge 규칙 추가 ---
+ d_sludge: {
+ required: true,
+ min: 0,
+ max: 100
+ }
},
messages: {
d_quantity: {
@@ -234,11 +240,26 @@ $(document).ready(function(){
d_payamount: {
required: "Please input Cash Amount",
//minlength: "Minimum of 6 characters.",
- },
+ },
+ // --- d_sludge 메시지 추가 ---
+ d_sludge: {
+ required: "Please input the Sludge value.",
+
+ }
},
errorElement : 'div',
+ errorPlacement: function(error, element) {
+ if (element.hasClass("d_sludge")) {
+ // 슬러지 전용 컨테이너 하단에 에러 표시
+ error.appendTo(element.closest(".number-input-container"));
+ } else {
+ // 나머지 필드들은 기본 위치(input 바로 뒤)
+ error.insertAfter(element);
+ }
+ },
+
submitHandler: function(form) {
var $inputs = $(form).find("input, select, button, textarea");
@@ -295,6 +316,8 @@ $(document).ready(function(){
+
+