diff --git a/public_html/assets/api/customer.php b/public_html/assets/api/customer.php index 79c465f..7d6e5aa 100644 --- a/public_html/assets/api/customer.php +++ b/public_html/assets/api/customer.php @@ -113,10 +113,18 @@ class CustomerService extends CONF // ===================================== else { + // 주소/우편번호가 바뀌면 좌표 초기화 + $this->handleGeoReset($beforeData, $data); + $setParts = []; foreach ($data as $k => $v) { + if ($v === null) { + $setParts[] = "{$k}=NULL"; + continue; + } + $vEsc = mysqli_real_escape_string( $connect, (string)$v @@ -814,6 +822,14 @@ class CustomerService extends CONF ); } + // c_time_restricted: Y/N 로 강제 (MIS 전용 필드) + // - hasCustomerChanges() 의 $businessFields 에 없으므로 ERP outbox 로 안 나감 + if (isset($data['c_time_restricted'])) { + $v = $data['c_time_restricted']; + $data['c_time_restricted'] = + ($v === 'Y' || $v === '1' || $v === 1 || $v === true) ? 'Y' : 'N'; + } + return $data; } @@ -953,4 +969,61 @@ class CustomerService extends CONF return false; } +} + +/* ===================================================================== + * 이 파일을 "직접 호출"했을 때만 동작하는 경량 디스패처. + * (다른 코드에서 require 될 땐 위 CustomerService 클래스만 제공) + * + * action = patchTimeRestricted + * - c_time_restricted (Y|N) 만 patchCustomer() 로 갱신 + * - c_time_restricted 는 hasCustomerChanges()의 $businessFields 에 없으므로 + * ERP outbox 로 나가지 않음 + * - 입력: POST c_uid, value(Y|N) / 출력: { ok, value } + * ===================================================================== */ +$__self = basename(__FILE__); +$__script = isset($_SERVER['SCRIPT_FILENAME']) ? basename($_SERVER['SCRIPT_FILENAME']) : ''; +if ($__script === $__self) { + + if (is_file(getenv("DOCUMENT_ROOT")."/include/session_include.php")) { + include_once getenv("DOCUMENT_ROOT")."/include/session_include.php"; + } + + header('Content-Type: application/json; charset=utf-8'); + + $action = $_POST['action'] ?? $_GET['action'] ?? ''; + + try { + + if ($action === 'patchTimeRestricted') { + + $c_uid = intval($_POST['c_uid'] ?? $_GET['c_uid'] ?? 0); + $value = ((($_POST['value'] ?? $_GET['value'] ?? '')) === 'Y') ? 'Y' : 'N'; + + if ($c_uid <= 0) { + echo json_encode(['ok' => false, 'msg' => 'invalid c_uid']); + exit; + } + + $user = $_SESSION['ss_INITIAL'] ?? ($_SESSION['ss_UID'] ?? 'system'); + + $svc = new CustomerService(); + $svc->patchCustomer( + $c_uid, + [ + 'c_time_restricted' => $value, + 'c_updatedby' => $user, + ], + ['skip_after' => true] // 부수효과(runAfterChange) 생략 + ); + + echo json_encode(['ok' => true, 'value' => $value]); + exit; + } + + echo json_encode(['ok' => false, 'msg' => 'unknown action']); + + } catch (Exception $e) { + echo json_encode(['ok' => false, 'msg' => $e->getMessage()]); + } } \ No newline at end of file diff --git a/public_html/assets/css/customer_access.css b/public_html/assets/css/customer_access.css new file mode 100644 index 0000000..d8511fb --- /dev/null +++ b/public_html/assets/css/customer_access.css @@ -0,0 +1,64 @@ +/* ===================================================================== + * customer_access.css + * Access Time / Closing Days 표시(칩) + 클릭 편집 박스 공용 스타일 + * - customer_detail.php, map.php, shortInfo_lib.php, customer_access_display.php 공용 + * - 클래스 기준(스코프 없음)이라 어느 화면에 넣어도 동일하게 적용됨 + * ===================================================================== */ + +/* 필드 박스 (흰색) */ +.at-field, .cd-field { + background:#fff; border:1px solid #ccc; border-radius:4px; + padding:8px 10px; min-height:36px; height:100%; box-sizing:border-box; +} +/* td 안에서 박스가 셀 높이를 채우도록 (td height:100% 는 auto 로 계산되므로 1px 시드) */ +.td-text-info:has(> .box-clickable) { height:1px; } + +/* Access Time */ +.at-wrap { display:flex; flex-direction:column; gap:2px; } +.at-row { display:flex; align-items:center; gap:8px; line-height:1.6; } +.at-row.at-off { opacity:.55; } +.at-dow { display:inline-block; width:36px; font-weight:600; font-size:14px; color:#444; } +.at-dow.at-wknd { color:#c0392b; } +.at-win { display:flex; flex-wrap:wrap; gap:5px; } +.at-chip { + display:inline-block; padding:1px 8px; border-radius:4px; + background:#eef3fb; border:1px solid #cfddf2; color:#23548f; + font-size:14px; white-space:nowrap; +} +.at-dash { color:#bbb; font-size:14px; } + +/* Closing Days */ +.cd-wrap { display:flex; flex-direction:column; gap:5px; } +.cd-chip { + display:inline-flex; align-items:center; gap:6px; + padding:2px 9px; border-radius:4px; align-self:flex-start; + background:#fbf1f1; border:1px solid #e8c9c9; color:#a23a3a; + font-size:14px; white-space:nowrap; +} +.cd-range { font-weight:600; } +.cd-note { color:#8a6d3b; font-style:italic; font-size:13px; } +.cd-empty { color:#bbb; font-size:14px; } + +/* 박스 전체 클릭 → 수정 팝업 */ +.box-clickable { cursor:pointer; position:relative; transition:border-color .12s, background-color .12s; } +.box-clickable:hover { border-color:#7fb069; background:#fafdf7; } +.box-clickable::after { + content:"\270E"; position:absolute; top:5px; right:8px; + font-size:13px; color:#bbb; line-height:1; +} +.box-clickable:hover::after { color:#7fb069; } + +/* "지금 닫힘" 경고 배지 (마커/Info버튼/모달 Access Time 공용) */ +.closed-badge { + display:inline-flex; align-items:center; justify-content:center; + min-width:18px; height:18px; padding:0 5px; margin-left:6px; + background:#e53935; color:#fff; border-radius:9px; + font-size:13px; font-weight:700; line-height:1; vertical-align:middle; +} + +/* 오늘 요일 강조 (주황 하이라이트 + 붉은 테두리) */ +.at-row.at-today { + background:#fff6da; border:1px solid #e53935; border-radius:4px; + padding:1px 6px; margin:0 -7px; + opacity:1 !important; /* 오늘은 휴무여도 흐리게 하지 않음 */ +} \ No newline at end of file diff --git a/public_html/assets/internal_api.php b/public_html/assets/internal_api.php index e55e3c2..c4b6bf0 100644 --- a/public_html/assets/internal_api.php +++ b/public_html/assets/internal_api.php @@ -207,6 +207,7 @@ class API extends CONF { "qty" => $rstOptionPoint['d_quantity'], "estqty" => $rstOptionPoint['d_estquantity'], "color" => $color, + "d_status" => $rstOptionPoint['d_status'], "comment" => $rstOptionPoint['c_comment_ri'], "container_location" => stripslashes($rstOptionPoint['c_location']), "last_pickup_date" => $rstOptionPoint['c_lastpickupdate'], @@ -704,6 +705,7 @@ class API extends CONF { "qty" => $rstOptionPoint['d_quantity'], "estqty" => $rstOptionPoint['d_estquantity'], "color" => $color, + "d_status" => $rstOptionPoint['d_status'], "comment" => $rstOptionPoint['c_comment_ri'], "container_location" => stripslashes($rstOptionPoint['c_location']), "last_pickup_date" => $rstOptionPoint['c_lastpickupdate'], diff --git a/public_html/doc/customer_detail.php b/public_html/doc/customer_detail.php index 28f5062..c60eebc 100644 --- a/public_html/doc/customer_detail.php +++ b/public_html/doc/customer_detail.php @@ -162,6 +162,46 @@ if ($mode == "update") { $containerList[] = $row; } // + + // =============================== + // Access Time (요일별 수거 가능 시간창) + // $accessTimeMap[dow] = [ {open, close, note, seq}, ... ] + // =============================== + $accessTimeMap = []; + $qAT = " + SELECT ca_uid, ca_day_of_week, ca_seq, ca_open_time, ca_close_time, ca_note + FROM tbl_customer_accesstime + WHERE ca_customer_uid = '{$c_uid}' AND ca_status = 'A' + ORDER BY ca_day_of_week ASC, ca_seq ASC + "; + $rAT = mysqli_query($jdb->DBConn, $qAT); + if ($rAT) { + while ($row = mysqli_fetch_array($rAT, MYSQLI_ASSOC)) { + $accessTimeMap[(int)$row['ca_day_of_week']][] = $row; + } + } + + // =============================== + // Closing Days (휴무 날짜 구간) + // 지나간 구간(ccd_end_date < 오늘)은 화면에 표시하지 않음 + // =============================== + $closingDays = []; + $qCD = " + SELECT ccd_uid, ccd_start_date, ccd_end_date, ccd_note + FROM tbl_customer_closing_days + WHERE ccd_customer_uid = '{$c_uid}' + AND ccd_end_date >= CURDATE() + ORDER BY ccd_start_date ASC + "; + $rCD = mysqli_query($jdb->DBConn, $qCD); + if ($rCD) { + while ($row = mysqli_fetch_array($rCD, MYSQLI_ASSOC)) { + $closingDays[] = $row; + } + } + + // Restricted 체크박스 상태 (c_time_restricted = 'Y'/'N') + $isRestrictedChecked = ($c_time_restricted == 'Y') ? 'checked' : ''; } else { $c_salescommissiondateSTR = "NOT YET"; @@ -1373,6 +1413,9 @@ $(document).ready(function()

Restaurant Information

+ + + @@ -1553,6 +1596,62 @@ $(document).ready(function() + + + + + + + + @@ -1982,10 +2081,80 @@ $(document).ready(function() + + + + + + + +
Account No
Access Time
Restricted >
+ +
+
+ +
+ + + + + + > + + +
+ +
+
+
Closing Days +
+
+ + + + + + + + + + + +
+
+
Comment
- + - + - + +
Restaurant NameName
Payment TypeCheque
Pay StatusPaid
Comment - +
Container Location - +

@@ -686,6 +690,82 @@ function popup(){
+ + + + + +