No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

269 líneas
11KB

  1. <section style="padding: 48px 0; max-width: 640px; margin: 0 auto; text-align: center;">
  2. <% If isValid Then %>
  3. <span class="eyebrow">Order link verified</span>
  4. <h1>Your order link is valid.</h1>
  5. <p>Jurisdiction number: <strong><%= H(order("JurisdictionNumber")) %></strong></p>
  6. <% Else %>
  7. <span class="eyebrow">Link problem</span>
  8. <h1>This link is invalid or has expired.</h1>
  9. <p>
  10. Please <a href="<%= H(Routes().AppURL & "request-order") %>">request a new order</a>
  11. to receive a fresh link.
  12. </p>
  13. <% End If %>
  14. </section>
  15. <% If isValid Then %>
  16. <link href="https://cdn.jsdelivr.net/npm/survey-core@2.5.36/survey-core.min.css" rel="stylesheet">
  17. <div id="surveyContainer" style="max-width: 760px; margin: 0 auto 64px; padding: 0 16px;"></div>
  18. <script src="https://cdn.jsdelivr.net/npm/survey-core@2.5.36/survey.core.min.js"></script>
  19. <script src="https://cdn.jsdelivr.net/npm/survey-js-ui@2.5.36/survey-js-ui.min.js"></script>
  20. <script>
  21. (function () {
  22. "use strict";
  23. var submitUrl = "<%= H(Routes().AppURL & "order/submit?token=" & Server.URLEncode(token)) %>";
  24. var csrfToken = "<%= H(csrfToken) %>";
  25. // Election-materials order form. Field (name) values match the OrderDetails table
  26. // columns 1:1 - see db/migrations/20260728145000_create_order_details_table.asp.
  27. // Content and branching sourced from docs/lucid/*.pdf.
  28. var surveyJson = {
  29. showProgressBar: "top",
  30. showQuestionNumbers: "off",
  31. completeText: "Submit Order",
  32. pages: [
  33. {
  34. name: "contact",
  35. title: "1. Contact Information",
  36. elements: [
  37. { type: "text", name: "ContactName", title: "Contact Name", isRequired: true },
  38. { type: "text", name: "Municipality", title: "Municipality", isRequired: true },
  39. { type: "text", name: "Phone", title: "Phone Number", inputType: "tel", isRequired: true }
  40. ]
  41. },
  42. {
  43. name: "purpleEnvelope",
  44. title: "2. Purple Ballot Envelope Quote Request",
  45. elements: [
  46. {
  47. type: "boolean", name: "PurpleWantsQuote", labelTrue: "Yes", labelFalse: "No",
  48. title: "Would you like a quote for KCI to print your purple AV envelopes?"
  49. },
  50. {
  51. type: "radiogroup", name: "PurplePrintOption",
  52. title: "Would you like KCI to print addresses on your purple envelopes or return postage only?",
  53. visibleIf: "{PurpleWantsQuote} = true",
  54. choices: [
  55. { value: "AddressesAndPostage", text: "Addresses and return postage" },
  56. { value: "PostageOnly", text: "Return postage only" }
  57. ]
  58. },
  59. {
  60. type: "radiogroup", name: "PurpleEnvelopeStock",
  61. title: "Are you planning to use KCI's purple envelopes or from your own stock?",
  62. visibleIf: "{PurplePrintOption} = 'AddressesAndPostage'",
  63. choices: [
  64. { value: "KCIStock", text: "KCI's stock" },
  65. { value: "OwnStock", text: "My own stock" }
  66. ]
  67. },
  68. {
  69. type: "text", name: "PurpleEnvelopeProvider",
  70. title: "Who is your purple envelope provider?",
  71. visibleIf: "{PurpleEnvelopeStock} = 'OwnStock'"
  72. },
  73. {
  74. type: "boolean", name: "PurpleWantsBlueEnvelopes", labelTrue: "Yes", labelFalse: "No",
  75. title: "Are you planning to use KCI blue envelopes?",
  76. visibleIf: "{PurplePrintOption} = 'AddressesAndPostage'"
  77. },
  78. {
  79. type: "radiogroup", name: "PurplePrintStyle",
  80. title: "Would you like your envelopes printed with color coding or black only?",
  81. visibleIf: "{PurplePrintOption} = 'AddressesAndPostage'",
  82. choices: [
  83. { value: "ColorCoding", text: "Color Coding" },
  84. { value: "BlackOnly", text: "Black Only" }
  85. ]
  86. },
  87. {
  88. type: "radiogroup", name: "PurpleColorCodingBy",
  89. title: "Color coding by precinct or by election?",
  90. visibleIf: "{PurplePrintStyle} = 'ColorCoding'",
  91. choices: [
  92. { value: "Precinct", text: "Precinct" },
  93. { value: "Election", text: "Election" }
  94. ]
  95. },
  96. {
  97. type: "text", name: "PurplePrecinctCount", title: "How many precincts?",
  98. inputType: "number", min: 0,
  99. visibleIf: "{PurpleColorCodingBy} = 'Precinct'"
  100. },
  101. {
  102. type: "boolean", name: "PurpleTrackMIBallot", labelTrue: "Yes", labelFalse: "No",
  103. title: "Would you like to track ballots using TrackMI Ballot?",
  104. visibleIf: "{PurplePrintOption} = 'AddressesAndPostage'"
  105. },
  106. {
  107. type: "text", name: "PurpleExtraEnvelopeQty",
  108. title: "How many extra purple envelopes would you like? (If none, please put zero)",
  109. inputType: "number", min: 0,
  110. visibleIf: "{PurplePrintOption} = 'AddressesAndPostage'"
  111. },
  112. {
  113. type: "text", name: "PurpleDeliveryDate", inputType: "date",
  114. title: "Please provide a date you would like these purple envelopes delivered.",
  115. visibleIf: "{PurpleWantsQuote} = true"
  116. }
  117. ]
  118. },
  119. {
  120. name: "blueEnvelope",
  121. title: "3. Blue AV Envelope Quote Request",
  122. elements: [
  123. {
  124. type: "boolean", name: "BlueWantsQuote", labelTrue: "Yes", labelFalse: "No",
  125. title: "Would you like to purchase blue AV envelopes from KCI?"
  126. },
  127. {
  128. type: "radiogroup", name: "BlueEnvelopeProvider",
  129. title: "Are you planning to use KCI's blue envelopes or another provider's?",
  130. visibleIf: "{BlueWantsQuote} = true",
  131. choices: [
  132. { value: "KCI", text: "KCI" },
  133. { value: "OtherProvider", text: "Other provider" }
  134. ]
  135. },
  136. {
  137. type: "boolean", name: "BluePrintPermit", labelTrue: "Yes", labelFalse: "No",
  138. title: "Would you like KCI to print a permit on your blue envelope?",
  139. visibleIf: "{BlueEnvelopeProvider} = 'KCI'"
  140. },
  141. {
  142. type: "text", name: "BluePermitNumber", title: "Permit Number",
  143. visibleIf: "{BluePrintPermit} = true"
  144. },
  145. {
  146. type: "text", name: "BluePermitCity", title: "City of permit holder",
  147. visibleIf: "{BluePrintPermit} = true"
  148. },
  149. {
  150. type: "radiogroup", name: "BluePermitClass", title: "NP or STD",
  151. visibleIf: "{BluePrintPermit} = true",
  152. choices: [
  153. { value: "NP", text: "NP" },
  154. { value: "STD", text: "STD" }
  155. ]
  156. },
  157. {
  158. type: "boolean", name: "BluePrintReturnAddress", labelTrue: "Yes", labelFalse: "No",
  159. title: "Would you like KCI to print return address information on the back of the blue envelope?",
  160. visibleIf: "{BlueEnvelopeProvider} = 'KCI'"
  161. },
  162. {
  163. type: "text", name: "BlueDeliveryDate", inputType: "date",
  164. title: "Please provide a date you would like the blue envelopes delivered.",
  165. visibleIf: "{BlueWantsQuote} = true"
  166. }
  167. ]
  168. },
  169. {
  170. name: "mailingService",
  171. title: "4. Ballot Mailing Service Quote Request",
  172. elements: [
  173. {
  174. type: "boolean", name: "MailingWantsService", labelTrue: "Yes", labelFalse: "No",
  175. title: "Would you like to save postage and have KCI mail your ballots?"
  176. },
  177. {
  178. type: "radiogroup", name: "MailingPostageOption",
  179. title: "Would you like KCI to apply postage?",
  180. visibleIf: "{MailingWantsService} = true",
  181. choices: [
  182. { value: "FirstClass", text: "Yes, at First Class Rate" },
  183. { value: "NonprofitRate", text: "Yes, at Nonprofit Rate" },
  184. { value: "No", text: "No" }
  185. ]
  186. },
  187. {
  188. type: "radiogroup", name: "MailingHasNonprofitStatus",
  189. title: "Do you have Nonprofit Status with the USPS?",
  190. visibleIf: "{MailingPostageOption} = 'NonprofitRate'",
  191. choices: [
  192. { value: "Yes", text: "Yes" },
  193. { value: "No", text: "No" },
  194. { value: "NotSure", text: "I'm not sure (that's okay, we can help you!)" }
  195. ]
  196. },
  197. {
  198. type: "boolean", name: "MailingWantsSorting", labelTrue: "Yes", labelFalse: "No",
  199. title: "Would you like KCI to sort your ballots?"
  200. },
  201. {
  202. type: "text", name: "MailingPickupDate", inputType: "date",
  203. title: "What is your preferred (first) pickup date?"
  204. }
  205. ]
  206. },
  207. {
  208. name: "additionalItems",
  209. title: "5. Additional Election Items Request",
  210. elements: [
  211. {
  212. type: "text", name: "SecrecySleevesQty", title: "Secrecy Sleeves (quantity)",
  213. inputType: "number", min: 0, defaultValue: 0
  214. },
  215. {
  216. type: "text", name: "IVotedStickerRolls", title: "\"I Voted\" Stickers (rolls of 250)",
  217. inputType: "number", min: 0, defaultValue: 0
  218. },
  219. {
  220. type: "text", name: "FutureVoterStickerRolls", title: "\"Future Voter\" Stickers (rolls of 500)",
  221. inputType: "number", min: 0, defaultValue: 0
  222. }
  223. ]
  224. }
  225. ]
  226. };
  227. var survey = new Survey.Model(surveyJson);
  228. survey.onComplete.add(function (sender) {
  229. fetch(submitUrl, {
  230. method: "POST",
  231. headers: {
  232. "Content-Type": "application/json",
  233. "X-CSRF-Token": csrfToken
  234. },
  235. body: JSON.stringify(sender.data)
  236. })
  237. .then(function (res) {
  238. return res.json().catch(function () { return {}; }).then(function (body) {
  239. return { ok: res.ok, body: body };
  240. });
  241. })
  242. .then(function (result) {
  243. var container = document.getElementById("surveyContainer");
  244. if (result.ok && result.body && result.body.success) {
  245. container.innerHTML =
  246. '<p style="text-align:center; padding: 32px 0;">' +
  247. "Thanks! Your order details have been submitted." +
  248. "</p>";
  249. } else {
  250. alert((result.body && result.body.error) || "Something went wrong submitting your order. Please try again.");
  251. }
  252. })
  253. .catch(function () {
  254. alert("Something went wrong submitting your order. Please check your connection and try again.");
  255. });
  256. });
  257. survey.render(document.getElementById("surveyContainer"));
  258. })();
  259. </script>
  260. <% End If %>

Powered by TurnKey Linux.