diff --git a/forms/admin_menu.rb b/forms/admin_menu.rb index 391f36c2420edd2226f67b25b06196e0837137c8..b5d0888e964ce335b5072d76efc0f012885fa04f 100644 --- a/forms/admin_menu.rb +++ b/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", diff --git a/lib/admin_command.rb b/lib/admin_command.rb index 6314f828cc2e7b362cc239b51e3348e393c0c927..f1e115599dec04004a66c2584be812cd723687c9 100644 --- a/lib/admin_command.rb +++ b/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