Skip to content

Instantly share code, notes, and snippets.

@alifhaikal88
Last active August 4, 2025 01:49
Show Gist options
  • Save alifhaikal88/984da2f038fa389c877db51fa1f89491 to your computer and use it in GitHub Desktop.
Save alifhaikal88/984da2f038fa389c877db51fa1f89491 to your computer and use it in GitHub Desktop.
AXP Intern Todo: Status Badge Enhancement Documentation - Comprehensive guide for intern to recreate status badge enhancement changes from commit 98735d396de21f66f9a428128d98d410ce5965bf

Intern Todo: Status Badge Enhancement and Label Updates

Overview

This document outlines the tasks to recreate changes from commit 98735d396de21f66f9a428128d98d410ce5965bf. The goal is to enhance status badges with tooltips and update filter labels for better UI brevity.

Project Context

  • Target Files:
    • src/_metronic/_helpers/PaymentHelpers.js
    • src/app/modules/payments/salesTransactions/SalesTransactionsPage.js
  • Objective: Replace verbose status text with abbreviated badges + tooltips, and shorten filter labels
  • Skills Required: React, Bootstrap components, UI/UX improvements

Part A: PaymentHelpers.js Enhancement (Priority: High-Medium)

Phase 1: Understanding & Setup (High Priority)

Task 1: Study Existing Code

  • Open src/_metronic/_helpers/PaymentHelpers.js
  • Review the showStatusBadge() function
  • Understand how status badges are currently rendered
  • Note the different status IDs and their corresponding labels
  • Document current badge variants (success, warning, danger, etc.)

Task 2: Import Required Components

  • Add OverlayTrigger and Tooltip to the react-bootstrap import
  • Current: import { Badge, Form } from 'react-bootstrap';
  • Target: import { Badge, Form, OverlayTrigger, Tooltip } from 'react-bootstrap';

Phase 2: Badge Replacements (Medium Priority)

Badge Conversion Pattern: Each badge should follow this structure:

<OverlayTrigger
  placement="top"
  overlay={<Tooltip id="[id]-tooltip">[ABBREVIATION] = [FULL_TEXT]</Tooltip>}
>
  <Badge variant="[variant]">[ABBREVIATION]</Badge>
</OverlayTrigger>

Task 3: Status ID 0 - Created

  • Replace <Badge variant="dark">Created</Badge>
  • With: CR badge + tooltip "CR = Created"
  • Use tooltip ID: cr-tooltip

Task 4: Status ID 1 - Pending Payment

  • Replace <Badge variant="warning">Pending Payment</Badge>
  • With: PP badge + tooltip "PP = Pending Payment"
  • Use tooltip ID: pp-tooltip

Task 5: Status ID 11 - Paid

  • Replace <Badge variant="success">Paid</Badge>
  • With: PD badge + tooltip "PD = Paid"
  • Use tooltip ID: pd-tooltip

Task 6: Status ID 22 - Failed

  • Replace <Badge variant="danger">Failed</Badge>
  • With: FL badge + tooltip "FL = Failed"
  • Use tooltip ID: fl-tooltip

Task 7: Status ID 23 - Timeout

  • Replace <Badge variant="danger">Timeout</Badge>
  • With: TO badge + tooltip "TO = Timeout"
  • Use tooltip ID: to-tooltip

Task 8: Status ID 33 - Void

  • Replace <Badge variant="info">Void</Badge>
  • With: VD badge + tooltip "VD = Void"
  • Use tooltip ID: vd-tooltip

Task 9: Status ID 43 - Pending Refund

  • Replace <Badge variant="warning">Pending Refund</Badge>
  • With: PR badge + tooltip "PR = Pending Refund"
  • Use tooltip ID: pr-tooltip

Task 10: Status ID 44 - Refund

  • Replace <Badge variant="warning">Refund</Badge>
  • With: RF badge + tooltip "RF = Refund"
  • Use tooltip ID: rf-tooltip

Task 11: Status ID 55 - Canceled

  • Replace <Badge variant="danger">Canceled</Badge>
  • With: CN badge + tooltip "CN = Canceled"
  • Use tooltip ID: cn-tooltip

Task 12: Status ID 2 - In Progress

  • Replace <Badge variant="warning">In Progress</Badge>
  • With: IP badge + tooltip "IP = In Progress"
  • Use tooltip ID: ip-tooltip

Task 13: Status ID 3 - Pending Authorization

  • Replace <Badge variant="warning">Pending Authorization</Badge>
  • With: PA badge + tooltip "PA = Pending Authorization"
  • Use tooltip ID: pa-tooltip

Task 14: Status ID 4 - Pending Termination

  • Replace <Badge variant="secondary">Pending Termination</Badge>
  • With: PT badge + tooltip "PT = Pending Termination"
  • Use tooltip ID: pt-tooltip

Task 15: Status ID 5 - Pending Maintenance

  • Replace <Badge variant="secondary">Pending Maintenance</Badge>
  • With: PM badge + tooltip "PM = Pending Maintenance"
  • Use tooltip ID: pm-tooltip

Task 16: Refund Request Status - Processing Refund

  • Replace <Badge variant="warning">Processing Refund</Badge>
  • With: PR badge + tooltip "PR = Processing Refund"
  • Use tooltip ID: pr-tooltip

Task 17: Default Case - Unknown

  • Replace <Badge variant="dark">Unknown</Badge>
  • With: UN badge + tooltip "UN = Unknown"
  • Use tooltip ID: un-tooltip

Part B: SalesTransactionsPage.js Label Updates (Priority: Low-Medium)

Phase 3: Filter Label Optimization

Task 18: Study Filter Configuration

  • Open src/app/modules/payments/salesTransactions/SalesTransactionsPage.js
  • Locate the filter configuration around line 166
  • Understand the checkbox list structure
  • Note which labels need shortening for better UI

Task 19: Update Pending Payment Label

  • Find label: 'Pending Payment' (value: 1)
  • Replace with: 'Pen. Payment'
  • Maintain the same value and checked properties

Task 20: Update In Processing Label

  • Find label: 'In Processing' (value: 2)
  • Replace with: 'Processing'
  • Maintain the same value and checked properties

Task 21: Update Pending Authorization Label

  • Find label: 'Pending Authorization' (value: 3)
  • Replace with: 'Pen. Auth'
  • Maintain the same value and checked properties

Part C: Testing & Quality Assurance (Priority: High-Medium)

Phase 4: Verification

Task 22: Test Status Badge Display (High Priority)

  • Start the development server
  • Navigate to pages that display payment status badges
  • Verify all badges show correct abbreviations
  • Check that badge colors/variants are preserved
  • Test with different payment statuses

Task 23: Test Filter Labels (Medium Priority)

  • Navigate to Sales Transactions page
  • Verify filter checkbox labels are updated correctly
  • Ensure functionality remains the same
  • Check that filters still work properly

Task 24: Test Tooltip Functionality (Medium Priority)

  • Hover over each status badge
  • Verify tooltips appear with correct full text
  • Check tooltip positioning (should be "top")
  • Test on different browsers if possible
  • Ensure tooltips don't interfere with other UI elements

Task 25: Commit Changes (Low Priority)

  • Stage the modified files
  • Create descriptive commit message:
    Enhance PaymentHelpers with tooltips for status badges and update SalesTransactionsPage labels for brevity
    
  • Verify commit includes both files
  • Push changes to appropriate branch

Success Criteria

✅ PaymentHelpers.js

  • All 13+ status badges converted to 2-letter abbreviations
  • Each badge wrapped with OverlayTrigger and Tooltip
  • Tooltips show format: "AB = Full Description"
  • Original badge variants preserved
  • Import statement includes OverlayTrigger and Tooltip

✅ SalesTransactionsPage.js

  • 3 filter labels shortened appropriately
  • Filter functionality remains intact
  • UI appears cleaner with shorter labels

✅ Overall Quality

  • No console errors
  • Tooltips work on hover
  • All original functionality preserved
  • Code follows existing patterns and conventions

Learning Objectives

By completing this task, the intern will learn:

  1. React Component Enhancement: Adding interactive elements (tooltips) to existing components
  2. Bootstrap Integration: Using OverlayTrigger and Tooltip components
  3. UI/UX Principles: Balancing information density with usability
  4. Code Maintenance: Making systematic changes across multiple similar elements
  5. Testing Practices: Verifying functionality after UI changes

Resources


Notes

  • Maintain consistency in abbreviation patterns
  • Preserve original badge color schemes
  • Test thoroughly before committing
  • Ask questions if any pattern is unclear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment