v1.2.3
- [INSTALL WAIT LIST] List 생성자 표시 추가, Route 확인 버튼 추가, 재정렬하면 seq 가 계속 증가하는 버그 수정.
This commit is contained in:
parent
12dd0516b1
commit
be2a92d2db
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 => {
|
||||
|
|
@ -578,6 +618,7 @@ function formatPhone($phone) {
|
|||
<!-- LEFT -->
|
||||
<div class="d-flex gap-2 flex-wrap">
|
||||
<span class="badge <?=$workClass?>"><?=$work?></span>
|
||||
<small class="text-muted">created by <?=$row['iw_created_member']?></small>
|
||||
|
||||
<?php if ($row['iw_status'] === 'DRAFT'): ?>
|
||||
<span class="badge bg-dark text-white">
|
||||
|
|
@ -857,6 +898,10 @@ function formatPhone($phone) {
|
|||
|
||||
<!-- Button -->
|
||||
<div class="d-flex iw-ui-control align-items-center ms-auto gap-2">
|
||||
<button id="btnRouteSchedule" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-geo-alt"></i> Route
|
||||
</button>
|
||||
|
||||
<button id="btnModifySchedule" class="btn btn-outline-primary" disabled>
|
||||
<i class="bi bi-sliders"></i> Modify
|
||||
</button>
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue