- [INSTALL ORDER] 순서 재정렬 버그 수정.
- [INSTALL WAIT LIST] Assign 후 리스트에 마우스 오버했을 때 노트 tooltip 표시.
This commit is contained in:
Hyojin Ahn 2026-04-30 13:50:53 -04:00
parent d1c74c15da
commit 4d70ee6c83
4 changed files with 49 additions and 22 deletions

View File

@ -559,6 +559,9 @@ trait InstallAPI {
di.di_lng, di.di_lng,
di.di_work_type, di.di_work_type,
di.di_status, di.di_status,
di.di_request_note,
di.di_cs_note,
di.di_work_note,
c.c_name AS di_customer_name, c.c_name AS di_customer_name,
SUM( SUM(
CASE CASE
@ -776,12 +779,19 @@ trait InstallAPI {
$base_seq = 0; $base_seq = 0;
if (!$has_existing && $has_trial) { if ($has_existing) {
$seq_values = array_map(function($r){
return intval($r['di_order_seq'] ?? 0);
}, $existing_rows);
$min_seq = min(array_filter($seq_values));
$base_seq = $min_seq - 1;
} else if ($has_trial) {
$qr_max = qry(" $qr_max = qry("
SELECT MAX(di_order_seq) AS max_seq SELECT MAX(di_order_seq) AS max_seq
FROM tbl_daily_install FROM tbl_daily_install
WHERE di_driver_uid = '{$di_driver_uid}' WHERE di_driver_uid = '{$di_driver_uid}'
AND di_install_date = '{$di_install_date}' AND di_install_date = '{$di_install_date}'
"); ");
$row_max = fetch_array($qr_max); $row_max = fetch_array($qr_max);
@ -2197,6 +2207,7 @@ trait InstallAPI {
public function daily_install_reorder() { public function daily_install_reorder() {
$driver_uid = intval($_POST['driver_uid'] ?? 0); $driver_uid = intval($_POST['driver_uid'] ?? 0);
$install_date = trim($_POST['install_date'] ?? '');
$orderJson = $_POST['order_list'] ?? ''; $orderJson = $_POST['order_list'] ?? '';
$fail = function($stage, $msg, $extra = []) { $fail = function($stage, $msg, $extra = []) {
@ -2218,21 +2229,6 @@ trait InstallAPI {
$fail('decode', 'invalid order list'); $fail('decode', 'invalid order list');
} }
// driver의 install_date는 하나라고 가정 (화면 기준)
$qr = qry("
SELECT di_install_date
FROM tbl_daily_install
WHERE di_driver_uid = '{$driver_uid}'
LIMIT 1
");
$row = mysqli_fetch_assoc($qr);
if(!$row){
$fail('select_date', 'no install data');
}
$install_date = $row['di_install_date'];
qry("START TRANSACTION"); qry("START TRANSACTION");
foreach($orderList as $item){ foreach($orderList as $item){
@ -2249,8 +2245,8 @@ trait InstallAPI {
UPDATE tbl_daily_install UPDATE tbl_daily_install
SET di_order_seq = '{$seq}' SET di_order_seq = '{$seq}'
WHERE di_uid = '{$di_uid}' WHERE di_uid = '{$di_uid}'
AND di_driver_uid = '{$driver_uid}' AND di_driver_uid = '{$driver_uid}'
AND di_status = 'A' AND di_status = 'A'
LIMIT 1 LIMIT 1
"; ";

View File

@ -2383,3 +2383,9 @@ tr.status-X {
border-radius: 0 0 5px 5px; border-radius: 0 0 5px 5px;
} }
} }
.tooltip-inner {
text-align: left;
max-width: 300px;
white-space: normal;
}

View File

@ -421,6 +421,7 @@ let installData = <?=json_encode($installData)?>;
let driverInitialMap = <?=json_encode($driverInitialMap)?>; let driverInitialMap = <?=json_encode($driverInitialMap)?>;
let reorderModeDriverUid = null; let reorderModeDriverUid = null;
let reorderSelectedRow = null; // currently selected for reorder let reorderSelectedRow = null; // currently selected for reorder
const selectedDate = "<?= $selectedDate ?>";
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
renderList(); renderList();
@ -1697,6 +1698,7 @@ function saveDriverOrder(driverUid){
api('daily_install_reorder', { api('daily_install_reorder', {
driver_uid: driverUid, driver_uid: driverUid,
install_date: selectedDate,
order_list: JSON.stringify(orderList) order_list: JSON.stringify(orderList)
}, (res) => { }, (res) => {

View File

@ -1285,6 +1285,16 @@ function formatPhone($phone) {
<td class="text-center">${r.is_trial ? '' : `<button class="btn btn-sm btn-outline-danger btn-unassign" title="Remove from schedule"> <i class="bi bi-dash-circle"></i></button>`}</td> <td class="text-center">${r.is_trial ? '' : `<button class="btn btn-sm btn-outline-danger btn-unassign" title="Remove from schedule"> <i class="bi bi-dash-circle"></i></button>`}</td>
`; `;
const tooltipHtml = `
Req note: ${r.di_request_note || '-'}<br>
CS note: ${r.di_cs_note || '-'}<br>
Work note: ${r.di_work_note || '-'}
`;
tr.setAttribute('data-bs-toggle', 'tooltip');
tr.setAttribute('data-bs-html', 'true');
tr.setAttribute('title', tooltipHtml);
tr.style.cursor = 'pointer'; tr.style.cursor = 'pointer';
//tr.onclick = () => focusMapMarker(r.di_uid); //tr.onclick = () => focusMapMarker(r.di_uid);
tbody.appendChild(tr); tbody.appendChild(tr);
@ -1293,6 +1303,12 @@ function formatPhone($phone) {
bindCheckboxEvents(); bindCheckboxEvents();
updateModifyButtonState(); updateModifyButtonState();
initInstallListSortable(); initInstallListSortable();
initTooltips();
}
function initTooltips() {
const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
tooltipTriggerList.forEach(el => new bootstrap.Tooltip(el));
} }
function safeFitBounds(bounds, tryCount = 0) { function safeFitBounds(bounds, tryCount = 0) {
@ -1669,14 +1685,21 @@ function formatPhone($phone) {
} }
function applyOrderSeqFromDom() { function applyOrderSeqFromDom() {
const trs = document.querySelectorAll('#iwListBody tr'); const trs = Array.from(document.querySelectorAll('#iwListBody tr'));
if (!trs.length) return;
const seqValues = trs
.map(tr => parseInt(tr.dataset.orderSeq || '0', 10))
.filter(v => v > 0);
const startSeq = seqValues.length ? Math.min(...seqValues) : 1;
trs.forEach((tr, idx) => { trs.forEach((tr, idx) => {
const newSeq = idx + 1; const newSeq = startSeq + idx;
tr.dataset.orderSeq = String(newSeq); tr.dataset.orderSeq = String(newSeq);
const tds = tr.querySelectorAll('td'); const tds = tr.querySelectorAll('td');
const tdSeq = tds[1]; // 0: checkbox, 1: sequence const tdSeq = tds[1];
if (tdSeq) tdSeq.textContent = newSeq; if (tdSeq) tdSeq.textContent = newSeq;
}); });