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

master_wallet_payout_fee_transfers.rb #31

Open geekelo opened 1 month ago

geekelo commented 1 month ago

FILE

ActiveAdmin.register MasterWalletPayoutFeeTransfer do
  actions :all, except: %i[destroy create new]
  permit_params :status, :external_status
  includes :user, :payout

  config.sort_order = 'created_at_desc'

  menu parent: 'Legacy', label: 'Master Wallet - Payout Fees'
  # 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 :transfer_type, :master_wallet_id, :source, :destination, :amount, :currency, :external_id, :external_status, :status, :error_code, :description, :risk_evaluation_decision, :risk_evaluation_reason, :user_id, :payout_id, :wallet_id
  #
  # or
  #
  # permit_params do
  #   permitted = [:transfer_type, :master_wallet_id, :source, :destination, :amount, :currency, :external_id, :external_status, :status, :error_code, :description, :risk_evaluation_decision, :risk_evaluation_reason, :user_id, :payout_id, :wallet_id]
  #   permitted << :other if params[:action] == 'create' && current_user.admin?
  #   permitted
  # end
  index do
    selectable_column
    id_column
    column :user
    column :transfer_type
    column :amount
    column :currency
    column :payout
    column :status
    column :external_status
    column :source do |transfer|
      transfer.source['id'] if transfer.source
    end
    column :destination do |transfer|
      transfer.destination['id'] if transfer.destination
    end
    column :created_at
    actions
  end

  form do |f|
    f.semantic_errors(*f.object.errors.attribute_names)
    f.inputs do
      panel 'Info' do
        f.input :status
        f.input :external_status
      end
      panel 'Soft Delete' do 
        f.input :discarded_at, as: :date_time_picker, datepicker_options: { min_date: Time.now, max_date: Time.now }
        para 'Add at discarded_at date only if you need to discard this master wallet transfer (e.g. to resolve and allow re-processing when the transfer is stuck in pending or there are errors).'.html_safe
      end
    end
    f.actions
  end
end
geekelo commented 1 month ago

This ActiveAdmin configuration is set up to manage MasterWalletPayoutFeeTransfer records, which likely represent the fees associated with payout transfers from a master wallet. Here's an overview of the configuration:

1. Actions Configuration

2. Permitted Parameters

3. Includes

4. Sorting Configuration

5. Menu Configuration

6. Index Page Configuration

7. Form Configuration

Summary

This configuration provides a controlled interface for managing MasterWalletPayoutFeeTransfer records within the ActiveAdmin framework. It allows for viewing and editing specific details of each transfer, with the ability to soft delete records when necessary. The interface is optimized for admin use, with clear organization and helpful notes to guide the process of managing payout fees associated with master wallets.