Add related work orders to asset detail view (live extraction DB query). Add location filter to work orders list. Add Related Work Orders card in frontend.
This commit is contained in:
@@ -1492,6 +1492,12 @@
|
||||
<div id="detailSeedFields"></div>
|
||||
</div>
|
||||
|
||||
<!-- Related Work Orders (from extraction DB) -->
|
||||
<div class="card" id="detailRelatedWOCard" style="display:none;">
|
||||
<div class="card-title"><svg class="gi" aria-hidden="true"><use href="#gi-wrench"/></svg> Related Work Orders</div>
|
||||
<div id="detailRelatedWOList"></div>
|
||||
</div>
|
||||
|
||||
<!-- Check-in History -->
|
||||
<div class="card">
|
||||
<div class="card-title">Check-in History <span id="checkinCount" style="color:var(--accent2);"></span></div>
|
||||
@@ -5451,6 +5457,41 @@
|
||||
seedCard.style.display = 'none';
|
||||
}
|
||||
|
||||
// Related Work Orders from extraction DB
|
||||
const rwoCard = document.getElementById('detailRelatedWOCard');
|
||||
const rwoList = document.getElementById('detailRelatedWOList');
|
||||
if (a.related_work_orders && a.related_work_orders.length) {
|
||||
rwoCard.style.display = 'block';
|
||||
rwoList.innerHTML = a.related_work_orders.map(function(wo) {
|
||||
var statusColor = wo.status_code === '690970003' ? '#4ade80' :
|
||||
wo.status_code === '690970004' ? '#4ade80' :
|
||||
wo.status_code === '690970001' ? '#5b6ef7' :
|
||||
wo.status_code === '690970002' ? '#fbbf24' : '#8b8fa3';
|
||||
var statusIcon = wo.status_code === '690970003' ? '✅' :
|
||||
wo.status_code === '690970004' ? '✅' :
|
||||
wo.status_code === '690970001' ? '📅' :
|
||||
wo.status_code === '690970002' ? '🔧' : '📋';
|
||||
var locParts = [];
|
||||
if (wo.functional_location) locParts.push(esc(wo.functional_location));
|
||||
if (wo.account_name) locParts.push(esc(wo.account_name));
|
||||
var dateStr = '';
|
||||
if (wo.datewindow_start) {
|
||||
try { var d = new Date(wo.datewindow_start); dateStr = d.toLocaleDateString('en-US', {month:'short', day:'numeric'}); } catch(e) {}
|
||||
}
|
||||
return '<div style="padding:6px 0;border-bottom:1px solid var(--border);font-size:12px;">' +
|
||||
'<div style="display:flex;justify-content:space-between;">' +
|
||||
'<span style="font-weight:600;">' + statusIcon + ' ' + esc(wo.name) + '</span>' +
|
||||
'<span style="color:' + statusColor + ';font-size:11px;">' + esc(wo.status) + '</span>' +
|
||||
'</div>' +
|
||||
(locParts.length ? '<div style="color:var(--text2);font-size:11px;">📍 ' + locParts.join(' · ') + '</div>' : '') +
|
||||
(dateStr ? '<div style="color:var(--text2);font-size:11px;">📅 ' + dateStr + '</div>' : '') +
|
||||
(wo.summary ? '<div style="color:var(--text2);font-size:11px;">' + esc(wo.summary) + '</div>' : '') +
|
||||
'</div>';
|
||||
}).join('');
|
||||
} else {
|
||||
rwoCard.style.display = 'none';
|
||||
}
|
||||
|
||||
await loadCheckinHistory(id);
|
||||
} catch (e) {
|
||||
showToast(e.message, true);
|
||||
|
||||
Reference in New Issue
Block a user