← back to Butlr

views/partials/wizard-state.ejs

13 lines

<%
  // Carry every state field as a hidden input so step N+1 has everything from steps 1..N.
  // Skip the field the current step is about to overwrite (passed in as `skip`).
  var skipSet = (typeof skip !== 'undefined' && skip) ? new Set(skip) : new Set();
  var allFields = ['category','business_slug','business_name','business_phone','goal','notes','account_number','last4_ssn','billing_zip','date_of_birth','auth_password','callback_name','callback_phone','callback_email','best_time_window','max_hold_minutes','max_spend_cents'];
%>
<% allFields.forEach(function(f) { if (!skipSet.has(f) && state[f]) { %>
<input type="hidden" name="<%= f %>" value="<%= state[f] %>">
<% } }); %>
<% ['consent_recording','notify_sms','notify_email','consent_terms'].forEach(function(f) { if (!skipSet.has(f) && state[f]) { %>
<input type="hidden" name="<%= f %>" value="on">
<% } }); %>