From be2a92d2db0dbafa4d18cf78c981878509c81993 Mon Sep 17 00:00:00 2001 From: Hyojin Ahn Date: Tue, 28 Apr 2026 08:31:02 -0400 Subject: [PATCH] =?UTF-8?q?v1.2.3=20-=20[INSTALL=20WAIT=20LIST]=20List=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=EC=9E=90=20=ED=91=9C=EC=8B=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80,=20Route=20=ED=99=95=EC=9D=B8=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80,=20=EC=9E=AC=EC=A0=95=EB=A0=AC=ED=95=98?= =?UTF-8?q?=EB=A9=B4=20seq=20=EA=B0=80=20=EA=B3=84=EC=86=8D=20=EC=A6=9D?= =?UTF-8?q?=EA=B0=80=ED=95=98=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public_html/assets/api/install.php | 18 +++++++- public_html/doc/install_wait_list.php | 62 +++++++++++++++++++++++++-- 2 files changed, 76 insertions(+), 4 deletions(-) diff --git a/public_html/assets/api/install.php b/public_html/assets/api/install.php index fb7048a..a1e3972 100644 --- a/public_html/assets/api/install.php +++ b/public_html/assets/api/install.php @@ -748,9 +748,25 @@ trait InstallAPI { return intval($a['di_order_seq'] ?? 0) <=> intval($b['di_order_seq'] ?? 0); }); + $has_existing = is_array($existing_rows) && count($existing_rows) > 0; + $has_trial = is_array($trial_rows) && count($trial_rows) > 0; + + $base_seq = 0; + + if (!$has_existing && $has_trial) { + $qr_max = qry(" + SELECT MAX(di_order_seq) AS max_seq + FROM tbl_daily_install + WHERE di_driver_uid = '{$di_driver_uid}' + AND di_install_date = '{$di_install_date}' + "); + + $row_max = fetch_array($qr_max); + $base_seq = intval($row_max['max_seq'] ?? 0); + } + $seq = 1; foreach($all as &$r){ - // base_seq 더해줌 $r['di_order_seq'] = $base_seq + $seq++; } unset($r); diff --git a/public_html/doc/install_wait_list.php b/public_html/doc/install_wait_list.php index f393fbd..ca33c4f 100644 --- a/public_html/doc/install_wait_list.php +++ b/public_html/doc/install_wait_list.php @@ -30,8 +30,10 @@ $total_count = $jdb->rQuery($sql_cnt, "Install wait list count error"); // 1) Load waitlist // ============================ $sql = " - SELECT * - FROM tbl_install_waitlist + SELECT iw.*, CONCAT(m.m_firstname, ' ', m.m_lastname) as iw_created_member + FROM tbl_install_waitlist iw + LEFT OUTER JOIN tbl_member m + ON iw.iw_created_by = m.m_uid WHERE iw_status in ('WAITING','DRAFT') $add_where ORDER BY iw_requested_due_date ASC, iw_request_at ASC @@ -329,6 +331,44 @@ function formatPhone($phone) { modal.show(); } + function openRoute() { + + const OFFICE = "4490 Chesswood Dr, North York, ON M3J 2B9"; + + const rows = []; + + document.querySelectorAll('#iwListBody tr').forEach(tr => { + + const address = tr.dataset.address || ''; + const city = tr.dataset.city || ''; + const postal = tr.dataset.postal || ''; + + if (!address) return; + + rows.push({ + address: [address, city, postal].filter(Boolean).join(', '), + order: parseInt(tr.dataset.orderSeq || 0) + }); + }); + + if (!rows.length) { + showPopupMessage('No route data.', 'error', 1500); + return; + } + + // 순서 정렬 (중요) + rows.sort((a, b) => a.order - b.order); + + const waypoints = rows.map(r => r.address).join('|'); + + let url = `https://www.google.com/maps/dir/?api=1`; + url += `&origin=${encodeURIComponent(OFFICE)}`; + url += `&destination=${encodeURIComponent(OFFICE)}`; + url += `&waypoints=${encodeURIComponent(waypoints)}`; + + window.open(url, '_blank'); + } + function loadInstallWaitForEdit(iw_uid) { // 1) install_wait 메타 로드 api('get_install_wait_detail', { iw_uid }, data => { @@ -577,7 +617,8 @@ function formatPhone($phone) {
- + + created by @@ -857,6 +898,10 @@ function formatPhone($phone) {
+ + @@ -1167,6 +1212,9 @@ function formatPhone($phone) { rows.forEach(r => { const tr = document.createElement('tr'); + tr.dataset.address = r.di_address || ''; + tr.dataset.city = r.di_city || ''; + tr.dataset.postal = r.di_postal || ''; if (r.is_trial) { tr.dataset.isTrial = '1'; tr.dataset.iwUid = r.iw_uid; // waitlist uid @@ -1866,6 +1914,14 @@ while ($row = mysqli_fetch_assoc($rmem)) { return; } + const routeBtn = e.target.closest('#btnRouteSchedule'); + if (routeBtn) { + e.preventDefault(); + + openRoute(); + return; + } + // 3) WAIT CARD CLICK (trial toggle) const card = e.target.closest('.wait-card'); if (!card) return;