Adding interface reference, fixing manual quote reminders dropdown width / anchor

This commit is contained in:
Finley Ghosh 2025-12-07 17:35:21 +11:00
parent d8526f12b6
commit b62877d1bd
2 changed files with 14 additions and 5 deletions

View file

@ -174,7 +174,7 @@ type QuoteQueries interface {
InsertQuoteReminder(ctx context.Context, params db.InsertQuoteReminderParams) (sql.Result, error)
GetExpiringSoonQuotes(ctx context.Context, dateADD interface{}) ([]db.GetExpiringSoonQuotesRow, error)
GetRecentlyExpiredQuotes(ctx context.Context, dateSUB interface{}) ([]db.GetRecentlyExpiredQuotesRow, error)
GetExpiringSoonQuotesOnDay(ctx context.Context, dateADD interface{}) ([]db.GetExpiringSoonQuotesOnDayRow, error)
GetExpiringSoonQuotesOnDay(ctx context.Context, arg db.GetExpiringSoonQuotesOnDayParams) ([]db.GetExpiringSoonQuotesOnDayRow, error)
GetRecentlyExpiredQuotesOnDay(ctx context.Context, dateSUB interface{}) ([]db.GetRecentlyExpiredQuotesOnDayRow, error)
DisableQuoteReminders(ctx context.Context, params db.DisableQuoteRemindersParams) (sql.Result, error)
EnableQuoteReminders(ctx context.Context, id int32) (sql.Result, error)
@ -259,7 +259,10 @@ func (h *QuotesHandler) GetOutstandingQuotesOnDay(r *http.Request, day int) ([]m
ctx := r.Context()
// If day is positive, get quotes expiring on that day; if negative, get recently expired quotes on that day in the past
if day >= 0 {
quotes, err := h.queries.GetExpiringSoonQuotesOnDay(ctx, day)
quotes, err := h.queries.GetExpiringSoonQuotesOnDay(ctx, db.GetExpiringSoonQuotesOnDayParams{
DATEADD: day,
DATEADD_2: day,
})
if err != nil {
return nil, err
}

View file

@ -65,6 +65,7 @@
{{if .RemindersDisabled}}
<button type="button" onclick="showEnableModal('{{.ID}}', '{{.EnquiryRef}}')" class="px-4 py-1.5 text-xs font-medium text-white bg-green-600 rounded-md hover:bg-green-700 focus:z-10">Re-enable Reminders</button>
{{else}}
<div class="relative inline-block">
<div class="inline-flex rounded-md shadow-sm" role="group">
{{if eq .LatestReminderType "No Reminder"}}
<button type="button" onclick="showConfirmModal(this, 1, '{{.EnquiryRef}}', '{{.CustomerName}}', 'First Reminder')" class="w-44 px-3 py-1.5 text-xs font-medium text-white bg-cmcblue rounded-l-md hover:bg-cmcblue/90 focus:z-10">Send First Reminder</button>
@ -80,7 +81,7 @@
<button type="button" onclick="toggleDropdown(this)" class="px-2 py-1.5 text-xs font-medium text-white bg-cmcblue border-l border-cmcblue/80 rounded-r-md hover:bg-cmcblue/90 focus:z-10"></button>
{{end}}
</div>
<div class="hidden absolute z-10 mt-1 bg-white divide-y divide-gray-100 rounded-md shadow-lg ring-1 ring-black ring-opacity-5" style="min-width: 150px;">
<div class="hidden absolute right-0 z-10 mt-1 bg-white divide-y divide-gray-100 rounded-md shadow-lg ring-1 ring-black ring-opacity-5" style="width: 200px;">
<ul class="py-1 text-xs text-gray-700">
<li><button type="button" onclick="showConfirmModal(this, 1, '{{.EnquiryRef}}', '{{.CustomerName}}', 'First Reminder')" class="block w-full text-left px-4 py-2 hover:bg-gray-100">Send First Reminder</button></li>
<li><button type="button" onclick="showConfirmModal(this, 2, '{{.EnquiryRef}}', '{{.CustomerName}}', 'Second Reminder')" class="block w-full text-left px-4 py-2 hover:bg-gray-100">Send Second Reminder</button></li>
@ -89,6 +90,7 @@
<li><button type="button" onclick="showDisableModal('{{.ID}}', '{{.EnquiryRef}}')" class="block w-full text-left px-4 py-2 hover:bg-gray-100 text-red-600">Disable Future Reminders</button></li>
</ul>
</div>
</div>
{{end}}
</form>
</td>
@ -162,6 +164,7 @@
{{if .RemindersDisabled}}
<button type="button" onclick="showEnableModal('{{.ID}}', '{{.EnquiryRef}}')" class="px-4 py-1.5 text-xs font-medium text-white bg-green-600 rounded-md hover:bg-green-700 focus:z-10">Re-enable Reminders</button>
{{else}}
<div class="relative inline-block">
<div class="inline-flex rounded-md shadow-sm" role="group">
{{if eq .LatestReminderType "No Reminder"}}
<button type="button" onclick="showConfirmModal(this, 1, '{{.EnquiryRef}}', '{{.CustomerName}}', 'First Reminder')" class="w-44 px-3 py-1.5 text-xs font-medium text-white bg-cmcblue rounded-l-md hover:bg-cmcblue/90 focus:z-10">Send First Reminder</button>
@ -177,7 +180,7 @@
<button type="button" onclick="toggleDropdown(this)" class="px-2 py-1.5 text-xs font-medium text-white bg-cmcblue border-l border-cmcblue/80 rounded-r-md hover:bg-cmcblue/90 focus:z-10"></button>
{{end}}
</div>
<div class="hidden absolute z-10 mt-1 bg-white divide-y divide-gray-100 rounded-md shadow-lg ring-1 ring-black ring-opacity-5" style="min-width: 150px;">
<div class="hidden absolute right-0 z-10 mt-1 bg-white divide-y divide-gray-100 rounded-md shadow-lg ring-1 ring-black ring-opacity-5" style="width: 200px;">
<ul class="py-1 text-xs text-gray-700">
<li><button type="button" onclick="showConfirmModal(this, 1, '{{.EnquiryRef}}', '{{.CustomerName}}', 'First Reminder')" class="block w-full text-left px-4 py-2 hover:bg-gray-100">Send First Reminder</button></li>
<li><button type="button" onclick="showConfirmModal(this, 2, '{{.EnquiryRef}}', '{{.CustomerName}}', 'Second Reminder')" class="block w-full text-left px-4 py-2 hover:bg-gray-100">Send Second Reminder</button></li>
@ -186,6 +189,7 @@
<li><button type="button" onclick="showDisableModal('{{.ID}}', '{{.EnquiryRef}}')" class="block w-full text-left px-4 py-2 hover:bg-gray-100 text-red-600">Disable Future Reminders</button></li>
</ul>
</div>
</div>
{{end}}
</form>
</td>
@ -526,11 +530,12 @@ document.getElementById('enableModalConfirmBtn').addEventListener('click', async
<input type="hidden" name="customer_name" value="${customerName}">
<input type="hidden" name="date_issued" value="${form.querySelector('input[name="date_issued"]').value}">
<input type="hidden" name="valid_until" value="${form.querySelector('input[name="valid_until"]').value}">
<div class="relative inline-block">
<div class="inline-flex rounded-md shadow-sm" role="group">
${buttonHTML}
${dropdownHTML}
</div>
<div class="hidden absolute z-10 mt-1 bg-white divide-y divide-gray-100 rounded-md shadow-lg ring-1 ring-black ring-opacity-5" style="min-width: 150px;">
<div class="hidden absolute right-0 z-10 mt-1 bg-white divide-y divide-gray-100 rounded-md shadow-lg ring-1 ring-black ring-opacity-5" style="width: 200px;">
<ul class="py-1 text-xs text-gray-700">
<li><button type="button" onclick="showConfirmModal(this, 1, '${enquiryRef}', '${customerName}', 'First Reminder')" class="block w-full text-left px-4 py-2 hover:bg-gray-100">Send First Reminder</button></li>
<li><button type="button" onclick="showConfirmModal(this, 2, '${enquiryRef}', '${customerName}', 'Second Reminder')" class="block w-full text-left px-4 py-2 hover:bg-gray-100">Send Second Reminder</button></li>
@ -539,6 +544,7 @@ document.getElementById('enableModalConfirmBtn').addEventListener('click', async
<li><button type="button" onclick="showDisableModal('${currentQuoteID}', '${enquiryRef}')" class="block w-full text-left px-4 py-2 hover:bg-gray-100 text-red-600">Disable Future Reminders</button></li>
</ul>
</div>
</div>
`;
}
});