diff --git a/public_html/assets/api/install.php b/public_html/assets/api/install.php index 41cb5cb..228306c 100644 --- a/public_html/assets/api/install.php +++ b/public_html/assets/api/install.php @@ -438,6 +438,8 @@ trait InstallAPI { $cycle = intval($_POST['scheduled_cycle'] ?? 0); $lock_date = intval($_POST['lock_date'] ?? 0); + $need_oil = $_POST['need_oil'] ?? 0; // 0 or 1 + // Two-person OFF = NULL if (!$person_cnt) { $person_cnt = null; @@ -462,9 +464,9 @@ trait InstallAPI { iw_required_person_cnt = ".($person_cnt !== null ? intval($person_cnt) : "NULL").", iw_multi_person_reason = ".($person_reason ? "'".addslashes($person_reason)."'" : "NULL").", - iw_scheduled = '{$scheduled}', iw_scheduled_cycle = '{$cycle}', + iw_need_oil_pickup = '{$need_oil}', iw_status = 'WAITING' WHERE iw_uid = '{$iw_uid}' @@ -1107,7 +1109,7 @@ trait InstallAPI { cc_has_wheel='{$has_wheel}', cc_has_woodframe='{$has_frame}', cc_owner_type='{$owner_type}', - cc_install_date={$install_date}, + cc_install_date='{$install_date}', cc_install_at={$install_at_sql}, cc_install_note='{$install_note}', cc_modified_at=NOW(), @@ -1198,11 +1200,17 @@ trait InstallAPI { $this->upsertAdditionalNote($di, $additional_note); // 3) 컨테이너 반영 - if ($di['di_status'] === 'A' && $newStatus === 'P') { - $this->apply_container_changes_for_di($di_uid, $install_note, intval($di['di_customer_uid'])); + if ($di['di_status'] !== 'P' && $newStatus === 'P') { - // 3-1) 컨테이너 반영 후 customer 의 main 볼륨이랑 main 컨테이너 변경 - $this->updateCustomerMainContainer(intval($di['di_customer_uid']), $di['di_install_date']); + if ($di['di_container_applied'] == 0) { + $this->apply_container_changes_for_di($di_uid, $install_note, intval($di['di_customer_uid'])); + + // 3-1) 컨테이너 반영 후 customer 의 main 볼륨이랑 main 컨테이너 변경 + $this->updateCustomerMainContainer(intval($di['di_customer_uid']), $di['di_install_date']); + + // 실행 완료 기록 + $this->markContainerApplied($di_uid); + } } // 4) oil pickup → daily @@ -1367,6 +1375,25 @@ trait InstallAPI { } } + private function markContainerApplied( + int $di_uid + ) + { + $conn = $GLOBALS['conn']; + + $sql = " + UPDATE tbl_daily_install + SET + di_container_applied = 1 + WHERE di_uid = '{$di_uid}' + LIMIT 1 + "; + + if (!qry($sql)) { + throw new Exception('daily install status update failed'); + } + } + private function saveDailyFromInstallIfNeeded(int $di_uid, int $oil_qty, int $sludge): void { if ($oil_qty <= 0) return; diff --git a/public_html/doc/install_order.php b/public_html/doc/install_order.php index cdb6d47..e33e3a4 100644 --- a/public_html/doc/install_order.php +++ b/public_html/doc/install_order.php @@ -947,11 +947,6 @@ function updateCommentReadonlyByResult(){ }else{ textarea.removeAttribute('readonly'); textarea.classList.remove('bg-light'); - - // 기존 저장값이 있으면 유지, 없을 때만 빈칸 - if (selectedRow) { - textarea.value = selectedRow.di_install_note || ''; - } } } @@ -1488,6 +1483,11 @@ function renderWorkCell(row){ // 보조 아이콘 const icons = []; + const applied = String(row.di_container_applied || '0') === '1'; + if(applied > 0){ + icons.push(``); + } + const note = (row.di_additional_note || '').trim(); if(note.length > 0){ icons.push(``); diff --git a/public_html/doc/install_wait_list.php b/public_html/doc/install_wait_list.php index 9fe902d..ace2890 100644 --- a/public_html/doc/install_wait_list.php +++ b/public_html/doc/install_wait_list.php @@ -119,15 +119,15 @@ if ($iw_uids) { * 4) Customer images (install_order) * ============================ */ $imageMap = []; // [customer_uid => true] -if ($customer_uids) { - $in = implode(',', $customer_uids); +if ($iw_uids) { + $in = implode(',', $iw_uids); $sql_img = " SELECT DISTINCT i_customeruid FROM tbl_customer_image WHERE i_status = 'A' AND i_type = 'install_order' - AND i_customeruid IN ($in) + AND i_sourceuid IN ($in) "; $ri = $jdb->nQuery($sql_img, "Load customer images error"); @@ -431,6 +431,11 @@ function formatPhone($phone) { iwRecurringDays.value = data.iw_scheduled_cycle || ''; } + // Oil-Pickup + if (data.iw_need_oil_pickup == 1) { + btnNeedOilPickup.classList.add('iw-toggle-on'); + } + // job label 갱신 document.getElementById('iwStep3Title').innerText = `Step 3 of 3 - ${data.iw_work_type} Detail`; @@ -671,6 +676,13 @@ function formatPhone($phone) { + 0): ?> + + + Pickup + + +
diff --git a/public_html/include/top.php b/public_html/include/top.php index 4e20f06..a8b9654 100644 --- a/public_html/include/top.php +++ b/public_html/include/top.php @@ -81,20 +81,22 @@ $canExport = in_array($level, [1, 5, 6, 7]); - + + +
-
+
- +
@@ -207,7 +207,7 @@
-
+
+ +
+
+ +
+
@@ -237,7 +248,7 @@
-
+