<%= link_to admin_api_keys_path, class: "inline-flex items-center gap-2 text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors" do %>
Back to API Keys
<% end %>
<%= form_with url: admin_api_keys_path, method: :post, local: true, class: "space-y-6" do |f| %>
<%= label_tag "api_key[name]", "Name", class: "block text-sm font-medium text-gray-700" %>
<%= text_field_tag "api_key[name]", nil,
class: "block w-full pl-10 rounded-lg border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm py-3",
placeholder: "My Application",
required: true %>
A descriptive name to identify this API key
Permissions
<%= check_box_tag "api_key[send_sms]", "1", true,
class: "h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-600" %>
Send SMS
Allow sending outbound SMS messages
<%= check_box_tag "api_key[receive_sms]", "1", true,
class: "h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-600" %>
Receive SMS
Allow receiving and querying inbound SMS
<%= check_box_tag "api_key[manage_gateways]", "1", false,
class: "h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-600" %>
Manage Gateways
Allow managing gateway devices and settings
<%= check_box_tag "api_key[manage_otp]", "1", true,
class: "h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-600" %>
Manage OTP
Allow generating and verifying OTP codes
<%= label_tag "api_key[expires_at]", "Expiration Date (Optional)", class: "block text-sm font-medium text-gray-700" %>
<%= datetime_local_field_tag "api_key[expires_at]", nil,
class: "block w-full pl-10 rounded-lg border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm py-3" %>
Leave empty for no expiration
<%= submit_tag "Create API Key",
class: "inline-flex justify-center items-center gap-2 rounded-lg bg-blue-600 px-6 py-3 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 transition-all duration-200" %>
<%= link_to "Cancel", admin_api_keys_path,
class: "inline-flex justify-center items-center gap-2 rounded-lg bg-gray-100 px-6 py-3 text-sm font-semibold text-gray-700 hover:bg-gray-200 transition-all duration-200" %>
<% end %>