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_chargeback_transfers.rb #29

Open geekelo opened 1 month ago

geekelo commented 1 month ago

FILE

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

  config.sort_order = 'created_at_desc'

  menu parent: 'Legacy', label: 'Master Wallet - Chargebacks'
  # 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, :payment_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, :payment_id, :wallet_id]
  #   permitted << :other if params[:action] == 'create' && current_user.admin?
  #   permitted
  # end
  index title: 'Chargebacks Master Wallet Transfers' do
    selectable_column
    id_column
    column :user
    column :transfer_type
    column :amount
    column :currency
    column :payment
    column 'Payment Net Amount' do |transfer|
      transfer.payment.net_amount
    end
    column 'Payment Fees' do |transfer|
      transfer.payment.fees
    end
    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 sets up an admin interface for managing LoanTransaction records. The interface is designed to allow for viewing and updating existing records while preventing the creation or deletion of records. Here's a detailed explanation:

1. Menu Configuration

2. Actions Configuration

3. Includes

4. Sorting Configuration

5. Permitted Parameters

6. Index Page Configuration

Summary

This ActiveAdmin configuration provides a well-structured interface for viewing and managing LoanTransaction records. Admins can filter and sort through transactions, view detailed information, and edit records as needed. By excluding actions such as creating or deleting records, the configuration ensures that only existing data can be managed, which may be a deliberate choice to maintain data integrity for loan transactions.