← back to Butlr

views/public/call.ejs

94 lines

<%- include('../partials/head', { title, meta_desc }) %>
<%- include('../partials/header') %>

<main class="call-detail">
  <section class="section">
    <div class="wrap narrow">
      <p class="muted small"><a href="/calls">← All calls</a></p>

      <header class="call-detail-head">
        <h1><%= call.business_name %></h1>
        <span class="status status-<%= call.status %>"><%= call.status %></span>
      </header>

      <% if (['failed','canceled','cancelled','done'].includes(call.status)) { %>
        <% var capped = (typeof callCount !== 'undefined' && typeof maxCalls !== 'undefined') && callCount >= maxCalls; %>
        <% if (capped) { %>
          <p class="muted small" style="margin:12px 0 24px;padding:10px;border:1px solid var(--line);border-radius:6px;background:rgba(255,80,80,0.06)">
            <strong>Retry limit reached.</strong> Butlr has dialed this number <%= callCount %> times — the cap is <%= maxCalls %>. No further retries permitted.
          </p>
        <% } else { %>
          <form method="POST" action="/new/retry/<%= call.id %>" class="retry-form" style="margin:12px 0 24px">
            <button type="submit" class="btn primary">↻ Retry this call</button>
            <span class="muted small" style="margin-left:10px">
              Re-queues the same number, goal, and account info as a new call.
              <% if (typeof callCount !== 'undefined' && typeof maxCalls !== 'undefined') { %>
                · <%= callCount %> of <%= maxCalls %> calls used.
              <% } %>
            </span>
          </form>
        <% } %>
      <% } %>

      <p class="muted">
        <%= call.category_label %> · <%= call.business_phone %> · queued <%= call.created_at.replace('T',' ').slice(0,16) %>
      </p>

      <section class="block">
        <h2>Goal</h2>
        <p class="prose"><%= call.goal %></p>
        <% if (call.notes) { %>
          <h3>Notes for the rep</h3>
          <p class="prose"><%= call.notes %></p>
        <% } %>
      </section>

      <section class="block">
        <h2>Account info</h2>
        <% if (!revealed) { %>
          <p class="muted small">Masked by default. <a class="btn ghost btn-small" href="?reveal=1">Reveal (this view only)</a></p>
        <% } else { %>
          <p class="muted small"><a class="btn ghost btn-small" href="?">Re-mask</a></p>
        <% } %>
        <dl class="kv">
          <% if (call.account_number) { %><dt>Account number</dt><dd><%= call.account_number %></dd><% } %>
          <% if (call.last4_ssn)      { %><dt>Last 4 SSN</dt><dd><%= call.last4_ssn %></dd><% } %>
          <% if (call.billing_zip)    { %><dt>Billing ZIP</dt><dd><%= call.billing_zip %></dd><% } %>
          <% if (call.date_of_birth)  { %><dt>DOB</dt><dd><%= call.date_of_birth %></dd><% } %>
          <% if (call.auth_password)  { %><dt>Verbal auth</dt><dd><%= call.auth_password %></dd><% } %>
          <% if (!call.account_number && !call.last4_ssn && !call.billing_zip && !call.date_of_birth && !call.auth_password) { %>
            <dt>—</dt><dd>No account info submitted</dd>
          <% } %>
        </dl>
      </section>

      <section class="block">
        <h2>Callback</h2>
        <dl class="kv">
          <dt>Name</dt><dd><%= call.callback_name || '—' %></dd>
          <dt>Phone</dt><dd><%= call.callback_phone || '—' %></dd>
          <dt>Email</dt><dd><%= call.callback_email || '—' %></dd>
          <dt>Best time</dt><dd><%= call.best_time_window || '—' %></dd>
        </dl>
      </section>

      <section class="block">
        <h2>Limits & consent</h2>
        <dl class="kv">
          <dt>Max hold</dt><dd><%= call.max_hold_minutes %> min</dd>
          <dt>Max spend</dt><dd>$<%= (call.max_spend_cents/100).toFixed(2) %></dd>
          <dt>Recording</dt><dd><%= call.consent_recording ? '✓ consented' : '— not consented (no recording)' %></dd>
          <dt>SMS notify</dt><dd><%= call.notify_sms ? '✓ on' : '—' %></dd>
          <dt>Email notify</dt><dd><%= call.notify_email ? '✓ on' : '—' %></dd>
        </dl>
      </section>

      <p class="muted small detail-disclaim">
        Phase 1 MVP — this captures the submission. Phase 2 wires Twilio Voice for the actual dial + hold-wait + bridge-on-pickup. Status here is currently <code><%= call.status %></code>.
      </p>
    </div>
  </section>
</main>

<%- include('../partials/footer') %>