getStatus() : ''; $due = is_callable( [ $invoice, 'getDueDate' ] ) ? (string) $invoice->getDueDate() : ''; return self::displayKey( $status, $due ); } /** * Human label for a status key. * * @param string $key Status key. * @return string */ public static function label( string $key ): string { $labels = [ 'available' => __( 'Available', 'easy-invoice' ), 'paid' => __( 'Paid', 'easy-invoice' ), 'partial' => __( 'Partially paid', 'easy-invoice' ), 'unpaid' => __( 'Unpaid', 'easy-invoice' ), 'overdue' => __( 'Overdue', 'easy-invoice' ), 'draft' => __( 'Draft', 'easy-invoice' ), 'cancelled' => __( 'Cancelled', 'easy-invoice' ), 'canceled' => __( 'Cancelled', 'easy-invoice' ), 'sent' => __( 'Sent', 'easy-invoice' ), 'pending' => __( 'Pending', 'easy-invoice' ), ]; return $labels[ strtolower( $key ) ] ?? ucfirst( $key ); } /** * Tailwind badge classes for a status key. * * @param string $key Status key. * @return string */ public static function badgeClass( string $key ): string { switch ( strtolower( $key ) ) { case 'paid': return 'bg-green-100 text-green-800 ring-1 ring-green-200'; case 'partial': case 'unpaid': case 'pending': return 'bg-yellow-100 text-yellow-800 ring-1 ring-yellow-200'; case 'overdue': return 'bg-red-100 text-red-800 ring-1 ring-red-200'; case 'available': case 'sent': return 'bg-blue-100 text-blue-800 ring-1 ring-blue-200'; default: return 'bg-gray-100 text-gray-800 ring-1 ring-gray-200'; } } }