128 lines
8.3 KiB
HTML
128 lines
8.3 KiB
HTML
{{define "content"}}
|
|
<h1 class="text-3xl font-bold mb-4 text-gray-800">Quotes Expiring</h1>
|
|
<div class="pl-4">
|
|
<!-- Expiring Soon Section -->
|
|
<h2 class="text-xl font-semibold mt-6 mb-2">Expiring Soon</h2>
|
|
<table class="min-w-full border text-center align-middle mt-1 ml-4">
|
|
<thead>
|
|
<tr>
|
|
<th class="px-4 py-3 border font-semibold text-gray-700 align-middle">Quote</th>
|
|
<th class="px-4 py-3 border font-semibold text-gray-700 align-middle">Enquiry</th>
|
|
<th class="px-4 py-3 border font-semibold text-gray-700 align-middle">Issued By</th>
|
|
<th class="px-4 py-3 border font-semibold text-gray-700 align-middle">Issued At</th>
|
|
<th class="px-4 py-3 border font-semibold text-gray-700 align-middle">Expires</th>
|
|
<th class="px-4 py-3 border font-semibold text-gray-700 align-middle">Reminder</th>
|
|
<th class="px-4 py-3 border font-semibold text-gray-700 align-middle">Reminder Sent</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .ExpiringSoonQuotes}}
|
|
<tr class="hover:bg-slate-50 transition">
|
|
<td class="px-4 py-2 border align-middle"><a href="/documents/view/{{.ID}}" class="text-blue-600 underline">{{.ID}}</a></td>
|
|
<td class="px-4 py-2 border align-middle"><a href="/enquiries/view/{{.EnquiryID}}" class="text-blue-600 underline">{{.EnquiryRef}}</a></td>
|
|
<td class="px-4 py-2 border align-middle">{{.Username}}</td>
|
|
<td class="px-4 py-2 border align-middle"><span class="localdate">{{.DateIssued}}</span></td>
|
|
<td class="px-4 py-2 border align-middle"><span class="localdate">{{.ValidUntil}}</span> <span class="text-gray-500">({{.ValidUntilRelative}})</span></td>
|
|
<td class="px-4 py-2 border align-middle">
|
|
{{if .LatestReminderType}}
|
|
{{if or (eq .LatestReminderType "First Reminder") (eq .LatestReminderType "First Reminder Sent")}}
|
|
<span class="inline-block px-3 py-1 rounded-full text-xs font-semibold bg-blue-100 text-blue-700 border border-blue-200">{{.LatestReminderType}}</span>
|
|
{{else if or (eq .LatestReminderType "Second Reminder") (eq .LatestReminderType "Second Reminder Sent")}}
|
|
<span class="inline-block px-3 py-1 rounded-full text-xs font-semibold bg-yellow-100 text-yellow-700 border border-yellow-200">{{.LatestReminderType}}</span>
|
|
{{else if or (eq .LatestReminderType "Final Reminder") (eq .LatestReminderType "Final Reminder Sent")}}
|
|
<span class="inline-block px-3 py-1 rounded-full text-xs font-semibold bg-red-100 text-red-700 border border-red-200">{{.LatestReminderType}}</span>
|
|
{{else}}
|
|
<span class="inline-block px-3 py-1 rounded-full text-xs font-semibold bg-gray-200 text-gray-700 border border-gray-300">{{.LatestReminderType}}</span>
|
|
{{end}}
|
|
{{else}}
|
|
<span class="inline-block px-3 py-1 rounded-full text-xs font-semibold bg-gray-200 text-gray-700 border border-gray-300">No Reminder Sent</span>
|
|
{{end}}
|
|
</td>
|
|
<td class="px-4 py-2 border align-middle">
|
|
{{if .LatestReminderSent}}<span class="localdatetime">{{.LatestReminderSent}}</span>{{else}}-{{end}}
|
|
</td>
|
|
</tr>
|
|
{{else}}
|
|
<tr><td colspan="7" class="px-4 py-2 border text-center align-middle">No quotes expiring soon.</td></tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
<!-- Recently Expired Quotes Section -->
|
|
<h2 class="text-xl font-semibold mt-6 mb-2">Recently Expired</h2>
|
|
<table class="min-w-full border mb-6 text-center align-middle mt-1 ml-4">
|
|
<thead>
|
|
<tr>
|
|
<th class="px-4 py-3 border font-semibold text-gray-700 align-middle">Quote</th>
|
|
<th class="px-4 py-3 border font-semibold text-gray-700 align-middle">Enquiry</th>
|
|
<th class="px-4 py-3 border font-semibold text-gray-700 align-middle">Issued By</th>
|
|
<th class="px-4 py-3 border font-semibold text-gray-700 align-middle">Issued At</th>
|
|
<th class="px-4 py-3 border font-semibold text-gray-700 align-middle">Expires</th>
|
|
<th class="px-4 py-3 border font-semibold text-gray-700 align-middle">Reminder</th>
|
|
<th class="px-4 py-3 border font-semibold text-gray-700 align-middle">Reminder Sent</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .RecentlyExpiredQuotes}}
|
|
<tr class="hover:bg-slate-50 transition">
|
|
<td class="px-4 py-2 border align-middle"><a href="/documents/view/{{.ID}}" class="text-blue-600 underline">{{.ID}}</a></td>
|
|
<td class="px-4 py-2 border align-middle"><a href="/enquiries/view/{{.EnquiryID}}" class="text-blue-600 underline">{{.EnquiryRef}}</a></td>
|
|
<td class="px-4 py-2 border align-middle">{{.Username}}</td>
|
|
<td class="px-4 py-2 border align-middle"><span class="localdate">{{.DateIssued}}</span></td>
|
|
<td class="px-4 py-2 border align-middle"><span class="localdate">{{.ValidUntil}}</span> <span class="text-gray-500">({{.ValidUntilRelative}})</span></td>
|
|
<td class="px-4 py-2 border align-middle">
|
|
{{if .LatestReminderType}}
|
|
{{if or (eq .LatestReminderType "First Reminder Sent") (eq .LatestReminderType "First Reminder")}}
|
|
<span class="inline-block px-3 py-1 rounded-full text-xs font-semibold bg-blue-100 text-blue-700 border border-blue-200">{{.LatestReminderType}}</span>
|
|
{{else if or (eq .LatestReminderType "Second Reminder Sent") (eq .LatestReminderType "Second Reminder")}}
|
|
<span class="inline-block px-3 py-1 rounded-full text-xs font-semibold bg-yellow-100 text-yellow-700 border border-yellow-200">{{.LatestReminderType}}</span>
|
|
{{else if or (eq .LatestReminderType "Final Reminder Sent") (eq .LatestReminderType "Final Reminder")}}
|
|
<span class="inline-block px-3 py-1 rounded-full text-xs font-semibold bg-red-100 text-red-700 border border-red-200">{{.LatestReminderType}}</span>
|
|
{{else}}
|
|
<span class="inline-block px-3 py-1 rounded-full text-xs font-semibold bg-gray-200 text-gray-700 border border-gray-300">{{.LatestReminderType}}</span>
|
|
{{end}}
|
|
{{else}}
|
|
<span class="inline-block px-3 py-1 rounded-full text-xs font-semibold bg-gray-200 text-gray-700 border border-gray-300">No Reminder Sent</span>
|
|
{{end}}
|
|
</td>
|
|
<td class="px-4 py-2 border align-middle">
|
|
{{if .LatestReminderSent}}<span class="localdatetime">{{.LatestReminderSent}}</span>{{else}}-{{end}}
|
|
</td>
|
|
</tr>
|
|
{{else}}
|
|
<tr><td colspan="7" class="px-4 py-2 border text-center align-middle">No recently expired quotes.</td></tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<script>
|
|
// Convert .localdate to browser local date, .localdatetime to browser local date+time (no offset)
|
|
function formatLocalDate(isoString) {
|
|
if (!isoString) return '';
|
|
var d = new Date(isoString);
|
|
if (isNaN(d.getTime())) return isoString;
|
|
return d.toLocaleDateString();
|
|
}
|
|
function formatLocalDateTime(isoString) {
|
|
if (!isoString) return '';
|
|
var d = new Date(isoString);
|
|
if (isNaN(d.getTime())) return isoString;
|
|
// Show date and time in local time, no offset
|
|
return d.toLocaleString([], { hour: '2-digit', minute: '2-digit', second: '2-digit', year: 'numeric', month: '2-digit', day: '2-digit' });
|
|
}
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
document.querySelectorAll('.localdate').forEach(function(el) {
|
|
var iso = el.textContent.trim();
|
|
if (iso) {
|
|
el.textContent = formatLocalDate(iso);
|
|
}
|
|
});
|
|
document.querySelectorAll('.localdatetime').forEach(function(el) {
|
|
var iso = el.textContent.trim();
|
|
if (iso) {
|
|
el.textContent = formatLocalDateTime(iso);
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{{end}}
|