- Each monitoring location slot can now have a named location (e.g. "North Gate") - Location names and slot order are persisted and restored in the planner - Location names display in the expanded reservation card view - Added "Promote to Project" button that converts a reservation into a tracked project with monitoring locations and unit assignments pre-filled Requires DB migration on prod: ALTER TABLE job_reservation_units ADD COLUMN location_name TEXT; ALTER TABLE job_reservation_units ADD COLUMN slot_index INTEGER;
177 lines
11 KiB
HTML
177 lines
11 KiB
HTML
<!-- Reservations List -->
|
||
{% if reservations %}
|
||
<div class="space-y-2">
|
||
{% for item in reservations %}
|
||
{% set res = item.reservation %}
|
||
{% set card_id = "res-card-" ~ res.id %}
|
||
{% set detail_id = "res-detail-" ~ res.id %}
|
||
|
||
<div class="rounded-lg border border-gray-200 dark:border-gray-700"
|
||
style="border-left: 4px solid {{ res.color }};">
|
||
|
||
<!-- Header row (always visible, clickable) -->
|
||
<div class="res-card-header flex items-center justify-between p-4 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors select-none"
|
||
data-res-id="{{ res.id }}"
|
||
onclick="toggleResCard('{{ res.id }}')">
|
||
|
||
<div class="flex-1 min-w-0">
|
||
<div class="flex items-center gap-2 flex-wrap">
|
||
<h3 class="font-semibold text-gray-900 dark:text-white">{{ res.name }}</h3>
|
||
{% if res.device_type == 'slm' %}
|
||
<span class="px-2 py-0.5 text-xs font-medium bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400 rounded">SLM</span>
|
||
{% else %}
|
||
<span class="px-2 py-0.5 text-xs font-medium bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 rounded">Seismograph</span>
|
||
{% endif %}
|
||
{% if item.has_conflicts %}
|
||
<span class="px-2 py-0.5 text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 rounded"
|
||
title="{{ item.conflict_count }} unit(s) will need a calibration swap during this job">
|
||
{{ item.conflict_count }} cal swap{{ 's' if item.conflict_count != 1 else '' }}
|
||
</span>
|
||
{% endif %}
|
||
</div>
|
||
<p class="text-sm text-gray-500 dark:text-gray-400 mt-0.5">
|
||
{{ res.start_date.strftime('%b %d, %Y') }} –
|
||
{% if res.end_date %}
|
||
{{ res.end_date.strftime('%b %d, %Y') }}
|
||
{% elif res.end_date_tbd %}
|
||
<span class="text-yellow-600 dark:text-yellow-400 font-medium">TBD</span>
|
||
{% if res.estimated_end_date %}
|
||
<span class="text-gray-400">(est. {{ res.estimated_end_date.strftime('%b %d, %Y') }})</span>
|
||
{% endif %}
|
||
{% else %}
|
||
<span class="text-yellow-600 dark:text-yellow-400">Ongoing</span>
|
||
{% endif %}
|
||
</p>
|
||
</div>
|
||
|
||
<!-- Unit count -->
|
||
<div class="text-right mx-4 flex-shrink-0">
|
||
<p class="text-base font-bold text-gray-900 dark:text-white">
|
||
{% if res.quantity_needed %}
|
||
{{ item.assigned_count }}/{{ res.quantity_needed }}
|
||
{% else %}
|
||
{{ item.assigned_count }}
|
||
{% endif %}
|
||
</p>
|
||
<p class="text-xs text-gray-500 dark:text-gray-400">
|
||
{{ 'assigned' if item.assigned_count != 1 else 'assigned' }}
|
||
{% if res.quantity_needed %} needed{% endif %}
|
||
</p>
|
||
</div>
|
||
|
||
<!-- Action buttons (stop propagation so clicks don't toggle card) -->
|
||
<div class="flex items-center gap-1 flex-shrink-0">
|
||
<button onclick="event.stopPropagation(); openPlanner('{{ res.id }}')"
|
||
class="p-2 text-gray-400 hover:text-green-600 dark:hover:text-green-400 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700"
|
||
title="Plan units">
|
||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"/>
|
||
</svg>
|
||
</button>
|
||
<button onclick="event.stopPropagation(); openPromoteModal('{{ res.id }}', '{{ res.name }}')"
|
||
class="p-2 text-gray-400 hover:text-emerald-600 dark:hover:text-emerald-400 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700"
|
||
title="Promote to Project">
|
||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 10l7-7m0 0l7 7m-7-7v18"/>
|
||
</svg>
|
||
</button>
|
||
<button onclick="event.stopPropagation(); editReservation('{{ res.id }}')"
|
||
class="p-2 text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700"
|
||
title="Edit">
|
||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
|
||
</svg>
|
||
</button>
|
||
<button onclick="event.stopPropagation(); deleteReservation('{{ res.id }}', '{{ res.name }}')"
|
||
class="p-2 text-gray-400 hover:text-red-600 dark:hover:text-red-400 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700"
|
||
title="Delete">
|
||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
|
||
</svg>
|
||
</button>
|
||
<!-- Chevron (not in stopPropagation zone so clicking it still toggles the card) -->
|
||
<svg id="chevron-{{ res.id }}" class="w-4 h-4 text-gray-400 transition-transform duration-200 ml-1 pointer-events-none" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
|
||
</svg>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Expandable detail panel -->
|
||
<div id="{{ detail_id }}" class="hidden border-t border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-slate-800/60 px-4 py-3">
|
||
|
||
{% if res.notes %}
|
||
<p class="text-sm text-gray-500 dark:text-gray-400 mb-3 italic">{{ res.notes }}</p>
|
||
{% endif %}
|
||
|
||
<div class="grid grid-cols-2 gap-x-6 gap-y-1 text-sm mb-3">
|
||
{% if res.quantity_needed %}
|
||
<div class="text-gray-500 dark:text-gray-400">Est. units needed</div>
|
||
<div class="font-medium text-gray-800 dark:text-gray-200">{{ res.quantity_needed }}</div>
|
||
{% endif %}
|
||
<div class="text-gray-500 dark:text-gray-400">Assigned</div>
|
||
<div class="font-medium text-gray-800 dark:text-gray-200">{{ item.assigned_count }} unit{{ 's' if item.assigned_count != 1 else '' }}</div>
|
||
{% if res.quantity_needed and item.assigned_count < res.quantity_needed %}
|
||
<div class="text-gray-500 dark:text-gray-400">Still needed</div>
|
||
<div class="font-medium text-amber-600 dark:text-amber-400">{{ res.quantity_needed - item.assigned_count }} more</div>
|
||
{% endif %}
|
||
{% if item.has_conflicts %}
|
||
<div class="text-gray-500 dark:text-gray-400">Cal swaps</div>
|
||
<div class="font-medium text-amber-600 dark:text-amber-400">{{ item.conflict_count }} unit{{ 's' if item.conflict_count != 1 else '' }} will need swapping during job</div>
|
||
{% endif %}
|
||
</div>
|
||
|
||
{% if item.assigned_units %}
|
||
<p class="text-xs font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-2">Monitoring Locations</p>
|
||
<div class="flex flex-col gap-1">
|
||
{% for u in item.assigned_units %}
|
||
<div class="rounded bg-white dark:bg-slate-700 border border-gray-100 dark:border-gray-600 text-sm">
|
||
<div class="flex items-center gap-3 px-3 py-1.5">
|
||
<span class="text-gray-400 dark:text-gray-500 text-xs w-12 flex-shrink-0">Loc. {{ loop.index }}</span>
|
||
<div class="flex flex-col min-w-0">
|
||
{% if u.location_name %}
|
||
<span class="text-xs font-semibold text-gray-700 dark:text-gray-300 truncate">{{ u.location_name }}</span>
|
||
{% endif %}
|
||
<button onclick="openUnitDetailModal('{{ u.id }}')"
|
||
class="font-medium text-blue-600 dark:text-blue-400 hover:underline text-left text-sm">{{ u.id }}</button>
|
||
</div>
|
||
<span class="flex-1"></span>
|
||
{% if u.power_type == 'ac' %}
|
||
<span class="text-xs px-1.5 py-0.5 bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 rounded">A/C</span>
|
||
{% elif u.power_type == 'solar' %}
|
||
<span class="text-xs px-1.5 py-0.5 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-600 dark:text-yellow-400 rounded">Solar</span>
|
||
{% endif %}
|
||
{% if u.deployed %}
|
||
<span class="text-xs px-1.5 py-0.5 bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 rounded">Deployed</span>
|
||
{% else %}
|
||
<span class="text-xs px-1.5 py-0.5 bg-gray-100 dark:bg-gray-600 text-gray-500 dark:text-gray-400 rounded">Benched</span>
|
||
{% endif %}
|
||
{% if u.last_calibrated %}
|
||
<span class="text-xs text-gray-400 dark:text-gray-500">Cal: {{ u.last_calibrated.strftime('%b %d, %Y') }}</span>
|
||
{% endif %}
|
||
</div>
|
||
{% if u.notes %}
|
||
<p class="px-3 pb-1.5 text-xs text-gray-400 dark:text-gray-500 italic">{{ u.notes }}</p>
|
||
{% endif %}
|
||
</div>
|
||
{% endfor %}
|
||
</div>
|
||
{% else %}
|
||
<p class="text-sm text-gray-400 dark:text-gray-500 italic">No units assigned yet. Click the clipboard icon to plan.</p>
|
||
{% endif %}
|
||
</div>
|
||
|
||
</div>
|
||
{% endfor %}
|
||
</div>
|
||
|
||
<!-- toggleResCard, deleteReservation, editReservation, openUnitDetailModal defined in fleet_calendar.html -->
|
||
{% else %}
|
||
<div class="text-center py-8">
|
||
<svg class="w-12 h-12 mx-auto text-gray-400 dark:text-gray-500 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/>
|
||
</svg>
|
||
<p class="text-gray-500 dark:text-gray-400">No reservations found</p>
|
||
<p class="text-sm text-gray-400 dark:text-gray-500 mt-1">Click "New Reservation" to plan unit assignments</p>
|
||
</div>
|
||
{% endif %}
|