feat: include customer context in admin menu

Amolith created

Display customer ID and contact information (Jabber ID, phone number)
when selecting actions to help admins identify which customer they're
working with.

Implements: https://todo.sr.ht/~singpolyma/soprani.ca/465
Assisted-by: MiniMax M2 via Crush <crush@charm.land>

Change summary

forms/admin_menu.rb  | 18 +++++++++++++++++-
lib/admin_command.rb |  5 ++++-
2 files changed, 21 insertions(+), 2 deletions(-)

Detailed changes

forms/admin_menu.rb 🔗

@@ -1,5 +1,5 @@
 form!
-title "Menu"
+title(@customer_id ? "Customer #{@customer_id}" : "Menu")
 
 if @notice
 	field(
@@ -8,6 +8,22 @@ if @notice
 	)
 end
 
+if @jid
+	field(
+		type: "fixed",
+		label: "Jabber ID",
+		value: @jid.to_s
+	)
+end
+
+if @tel
+	field(
+		type: "fixed",
+		label: "Phone Number",
+		value: @tel
+	)
+end
+
 field(
 	var: "action",
 	type: "list-single",

lib/admin_command.rb 🔗

@@ -85,7 +85,10 @@ class AdminCommand
 	def menu_or_done(command_action=:execute, notice: nil)
 		return Command.finish("Done") if command_action == :complete
 
-		reply(FormTemplate.render("admin_menu", notice: notice)).then do |response|
+		reg = @target_customer.registered?
+		vars = { notice: notice, customer_id: @target_customer.customer_id,
+		         jid: @target_customer.jid, tel: reg&.phone }
+		reply(FormTemplate.render("admin_menu", **vars)).then do |response|
 			if response.form.field("action")
 				handle(response.form.field("action").value, response.action)
 			end