Need a tel to register

Stephen Paul Weber created

Change summary

forms/admin_register_with_sgx.rb       | 11 +++++++++++
lib/admin_actions/register_with_sgx.rb |  9 +++++++--
2 files changed, 18 insertions(+), 2 deletions(-)

Detailed changes

forms/admin_register_with_sgx.rb 🔗

@@ -0,0 +1,11 @@
+form!
+title "Register with SGX"
+instructions "DO NOT use this for simple number change"
+
+field(
+	var: "tel",
+	type: "text-single",
+	datatype: "html:tel",
+	label: "Number to use?",
+	value: ""
+)

lib/admin_actions/register_with_sgx.rb 🔗

@@ -2,8 +2,13 @@
 
 class AdminAction
 	class RegisterWithSgx
-		def self.call(customer, **)
-			customer.register!
+		def self.call(customer, reply:, **)
+			reply.call(
+				FormTemplate.render("admin_register_with_sgx")
+			).then { |response|
+				tel = response.form.field("tel").value.to_s
+				customer.register!(tel)
+			}
 		end
 	end
 end