| 1 |
<?php |
| 2 |
/** |
| 3 |
* Notification Helper for Easy Invoice |
| 4 |
* |
| 5 |
* @package Easy_Invoice |
| 6 |
*/ |
| 7 |
|
| 8 |
if (!defined('ABSPATH')) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
/** |
| 13 |
* Display notification messages |
| 14 |
* |
| 15 |
* @param string $type The type of notification (success, error, warning, info) |
| 16 |
* @param string $message The message to display |
| 17 |
*/ |
| 18 |
function easy_invoice_display_notification($type, $message) { |
| 19 |
$bg_class = ''; |
| 20 |
$icon_class = ''; |
| 21 |
|
| 22 |
switch ($type) { |
| 23 |
case 'success': |
| 24 |
$bg_class = 'bg-green-100 border-green-400 text-green-700'; |
| 25 |
$icon_class = 'fas fa-check-circle'; |
| 26 |
break; |
| 27 |
case 'error': |
| 28 |
$bg_class = 'bg-red-100 border-red-400 text-red-700'; |
| 29 |
$icon_class = 'fas fa-exclamation-circle'; |
| 30 |
break; |
| 31 |
case 'warning': |
| 32 |
$bg_class = 'bg-yellow-100 border-yellow-400 text-yellow-700'; |
| 33 |
$icon_class = 'fas fa-exclamation-triangle'; |
| 34 |
break; |
| 35 |
default: |
| 36 |
$bg_class = 'bg-blue-100 border-blue-400 text-blue-700'; |
| 37 |
$icon_class = 'fas fa-info-circle'; |
| 38 |
} |
| 39 |
|
| 40 |
echo '<div class="border-l-4 p-4 mb-4 ' . esc_attr($bg_class) . '">'; |
| 41 |
echo '<div class="flex">'; |
| 42 |
echo '<div class="flex-shrink-0">'; |
| 43 |
echo '<i class="' . esc_attr($icon_class) . '"></i>'; |
| 44 |
echo '</div>'; |
| 45 |
echo '<div class="ml-3">'; |
| 46 |
echo '<p class="text-sm">' . esc_html($message) . '</p>'; |
| 47 |
echo '</div>'; |
| 48 |
echo '</div>'; |
| 49 |
echo '</div>'; |
| 50 |
} |