#? stdtmpl(subsChar = '$', metaChar = '#')
#import "../helpers/global", "../helpers/form", "../helpers/auth", "../models/reminder"
#import "main_template_top.nimf", "main_template_bottom.nimf"
#proc remindersTemplate*(allReminders: seq[Reminder], csrfToken: string, fr: FormResult): string =
# result = ""
  ${mainTemplateTop("Upcoming Reminders",csrfToken)}
  <div class="text-center">
      <span class="text-2xl">Upcoming Reminders</span><a href="/create-reminder" class="a-btn-grn ml-8">+ New Reminder</a>
  </div>
  #if allReminders.len > 0:
  <div class="mt-8 flex flex-row p-2 border-b border-indigo-400">
      <div class="basis-2/4"><span class="text-xl">Title</span></div>
      <div class="basis-1/12"><span class="text-xl">Repeats?</span></div>
      <div class="basis-1/4"><span class="text-xl">Next Send Date</span></div>
      <div class="basis-1/4"><span class="text-xl">Actions</span></div>
  </div>
  #else:
  <br><br><h2 class="text-lg text-orange-400">You don't have any Reminders yet.</h2>
  #end if
  #for reminder in allReminders:
    <div class="flex flex-row p-2">
      <div class="basis-2/4"><span class="text-lg">${reminder.title}</span></div>
      <div class="basis-1/12"><span class="text-lg">
      #if reminder.repeats == 0:
        No
      #else:
        Yes
      #end if
      </span></div>
      <div class="basis-1/4"><span class="text-lg">${reminder.sendDate}</span></div>
      <div class="basis-1/4">
          <span><a href="/reminder/${reminder.id}/update" class="a-btn-grn">View/Edit</a></span>
          <form method="POST" action="/reminder/delete" accept-charset="utf-8" class="inline">
              <input type="hidden" name="csrf_token" value="${csrfToken}">
              <input type="hidden" name="reminder_id" value="${reminder.id}" />
              <button class="btn-red" type="submit"><span class="help-text" title="Delete the Reminder. Warning! Will not ask for confirmation.">Delete</span></button>
          </form>
      </div>
  </div>
  #end for
        
  <div class="page-js"></div>
  ${mainTemplateBottom()}  
#end proc
