BananaCrystal / email-templates

This repository contains in-house email templates that serve as structure for our emails. Each template can be updated and modified to fit requirements.
MIT License
0 stars 0 forks source link

card_loads.rb #9

Open geekelo opened 1 month ago

geekelo commented 1 month ago

FILE

ActiveAdmin.register Card::Load do
  menu parent: 'Cards', label: 'Loads'

  includes :user, :processing_fee

  # See permitted parameters documentation:
  # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
  #
  # Uncomment all parameters which should be permitted for assignment
  #
  permit_params :status
  # or
  #
  # permit_params do
  #   permitted = [:user_id, :card_detail_id, :amount, :status, :external_id, :currency, :error_data, :loaded_at, :confirm_token, :confirmed_at]
  #   permitted << :other if params[:action] == 'create' && current_user.admin?
  #   permitted
  # end

  index do
    selectable_column
    id_column
    column :user
    column :processing_fee
    column :external_id
    column :currency
    column :status
    column :amount
    column :provider_fee do |cl|
      cl.total_provider_fee
    end
    column :bananacrystal_fee do |cl|
      cl.total_bananacrystal_fee
    end
    column :total_fee do |cl|
      cl.total_fee
    end
    column :created_at
    column :confirmed_at
    actions
  end

  show do
    attributes_table do
      row :id
      row :card_detail
      row :user
      row :processing_fee
      row :external_id
      row :amount
      row :currency
      row :provider_fee do |cl|
        cl.total_provider_fee
      end
      row :bananacrystal_fee do |cl|
        cl.total_bananacrystal_fee
      end
      row :total_fee do |cl|
        cl.total_fee
      end
      row :error_data
      row :loaded_at
      row :confirmed_at
      row :created_at
      row :updated_at
    end
  end

  form do |f|
    f.inputs do
      f.input :status, as: :select, collection: SetStatus::STATUS.values
    end
    f.actions
  end
end
geekelo commented 1 month ago

This file configures the ActiveAdmin interface for managing Card::Load records, which likely represent card loading transactions within the application. Here’s a breakdown of the key elements:

File: card_load.rb

1. Menu Configuration

2. Includes

3. Permitted Parameters

4. Index Page

5. Show Page

6. Form

Summary:

This configuration is suitable for an admin interface where managing and auditing card load transactions is a key requirement.