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_requests.rb #11

Open geekelo opened 1 month ago

geekelo commented 1 month ago

FILE

ActiveAdmin.register Card::Request do
  actions :all, except: :destroy
  menu parent: 'Cards', label: 'Requests'
  includes :user, :processing_fee

  permit_params :status, :external_id

  index do
    selectable_column
    id_column
    column :user
    column :card_type
    column :card_network
    column :external_id, label: 'External ID'
    column :status
    column :phone_number do |cr|
      cr.phone_number
    end
    column :provider_fee do |cr|
      cr.total_provider_fee
    end
    column :bananacrystal_fee do |cr|
      cr.total_bananacrystal_fee
    end
    column :total_fee do |cr|
      cr.total_fee
    end
    column :created_at
    column :confirmed_at
    actions
  end

  show do
    attributes_table do
      row :id
      row :user
      row :processing_fee
      row :provider_fee do |cr|
        cr.total_provider_fee
      end
      row :bananacrystal_fee do |cr|
        cr.total_bananacrystal_fee
      end
      row :total_fee do |cr|
        cr.total_fee
      end
      row :salutation
      row :card_type
      row :card_network
      row :external_id, label: 'External ID'
      row :status
      row :gender
      row :marital_status do |cr|
        cr.marital_status
      end
      row :phone_number do |cr|
        cr.phone_number
      end
      row :emergency_contact_name do |cr|
        cr.emergency_contact_name
      end
      row :emergency_contact_phone_number do |cr|
        cr.emergency_contact_phone_number
      end
      row :id_type
      row :passport_number do |cr|
        cr.passport_number
      end
      row :passport_issued_date do |cr|
        cr.passport_issued_date
      end
      row :passport_expiry_date do |cr|
        cr.passport_expiry_date
      end
      row :passport_issued_by do |cr|
        cr.passport_issued_by
      end
      row :address do |cr|
        cr.address
      end
      row :city do |cr|
        cr.city
      end
      row :state do |cr|
        cr.state
      end
      row :country do |cr|
        cr.country
      end
      row :postal_code do |cr|
        cr.postal_code
      end
      row :error_data
      row :created_at
      row :updated_at
      row :confirmed_at
      row :passport_bio_page do |cr|
        link_to 'Passport bio page', url_for(cr.passport_bio_page_file), target: '_blank' if cr.passport_bio_page_file&.attached?
      end
      row :passport_bio_selfie do |cr|
        link_to 'Passport bio with selfie', url_for(cr.passport_with_selfie_file), target: '_blank' if cr.passport_with_selfie_file&.attached?
      end
      row :digital_signature do |cr|
        link_to 'Digital Signature', url_for(cr.digital_signature_file), target: '_blank' if cr.digital_signature_file&.attached?
      end
    end
  end

  form do |f|
    f.inputs do
      unless Rails.env.production?
        f.input :external_id, label: 'External ID'
      end
      f.input :status, as: :select, collection: SetStatus::STATUS.values
    end
    f.actions
  end
end
geekelo commented 1 month ago

This file defines the ActiveAdmin interface for managing Card::Request records. It provides a comprehensive setup to handle the display, editing, and creation of card requests, while excluding the delete (destroy) action.

File: card_request.rb

1. Menu Configuration

2. Actions

3. Includes

4. Permitted Parameters

5. Index Page

6. Show Page

7. Form

Summary:

This setup is tailored for administrators to effectively manage card requests with a focus on security, data integrity, and user convenience.