$subsection_data) {
$is_active = ($subsection_key === $active_email_subsection) ? '' : 'hidden';
?>
$field_config) {
$current_value = $settings[$option_key] ?? ($field_config['default'] ?? '');
$field_id = esc_attr($option_key);
$field_type = $field_config['type'] ?? 'text';
$field_label = esc_html($field_config['label'] ?? '');
$field_placeholder = isset($field_config['placeholder']) ? esc_attr($field_config['placeholder']) : '';
$field_description = $field_config['description'] ?? '';
$field_name = 'settings[' . esc_attr($option_key) . ']';
$input_class = 'mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm';
$select_class = 'mt-1 block w-full pl-3 pr-10 py-2 text-base border border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md';
$col_span_class = esc_attr($field_config['col_span'] ?? 'sm:col-span-6');
echo '
';
if ($field_type !== 'checkbox') {
echo '
' . $field_label . ' ';
}
// Define required and aria_describedby variables
$required = !empty($field_config['required']) ? 'required' : '';
$aria_describedby = !empty($field_description) ? 'aria-describedby="' . $field_id . '-description"' : '';
switch ($field_type) {
case 'text':
case 'email':
case 'url':
case 'tel':
echo '
';
break;
case 'number':
$min = isset($field_config['min']) ? ' min="' . esc_attr($field_config['min']) . '"' : '';
$max = isset($field_config['max']) ? ' max="' . esc_attr($field_config['max']) . '"' : '';
$step = isset($field_config['step']) ? ' step="' . esc_attr($field_config['step']) . '"' : '';
echo '
';
break;
case 'textarea':
echo '
';
break;
case 'select':
echo '
';
if (!empty($field_config['options']) && is_array($field_config['options'])) {
foreach ($field_config['options'] as $opt_val => $opt_label) {
echo '' . esc_html($opt_label) . ' ';
}
}
echo ' ';
break;
case 'multiselect':
echo '
';
if (!empty($field_config['options']) && is_array($field_config['options'])) {
foreach ($field_config['options'] as $opt_val => $opt_label) {
$selected = is_array($current_value) && in_array($opt_val, $current_value) ? 'selected="selected"' : '';
echo '' . esc_html($opt_label) . ' ';
}
}
echo ' ';
break;
case 'readonly':
echo '
';
echo '
';
break;
case 'checkbox':
echo '
';
echo ' ';
echo ' ' . $field_label . ' ';
echo '
';
if (!empty($field_description)) {
echo '
' . esc_html($field_description) . '
';
}
break;
case 'image':
echo '
';
echo '
';
echo ' ';
echo ' ';
echo '
';
echo esc_html__('Change', 'easy-invoice');
echo ' ';
echo '
';
echo '
';
break;
case 'wp_editor':
wp_editor( $current_value, $field_id, ['textarea_name' => $field_name, 'teeny' => true, 'media_buttons' => false, 'textarea_rows' => 7, 'editor_class' => 'mt-1'] );
// Handle description for wp_editor specifically
if (!empty($field_description)) {
echo '
' . esc_html($field_description) . '
';
}
break;
case 'test_email':
echo '
';
echo '
';
echo ' ';
echo ' ';
echo ' ';
echo ' ' . esc_html__('Send Test Email', 'easy-invoice');
echo ' ';
echo '
';
echo '
';
echo '
';
break;
case 'test_template_email':
$template_type = $field_config['template_type'] ?? '';
$is_payment_test = ($field_id === 'easy_invoice_payment_test_template');
$width_class = $is_payment_test ? 'w-[200px]' : 'w-64';
echo '
';
echo '
';
echo ' ';
echo ' ';
echo ' ';
echo ' ' . esc_html__('Test Template', 'easy-invoice');
echo ' ';
echo '
';
echo '
';
echo '
';
break;
case 'test_payment_reminder_email':
echo '
';
echo '
';
echo ' ';
echo ' ';
echo ' ';
echo ' ' . esc_html__('Test Reminder', 'easy-invoice');
echo ' ';
echo '
';
echo '
';
echo '
';
break;
default:
echo '
';
break;
}
if ($field_type !== 'checkbox' && $field_type !== 'wp_editor' && !empty($field_description)) {
echo '
' . esc_html($field_description) . '
';
}
echo '
'; // Close the field wrapper div
}
}
?>
{{invoice_number}}
{{due_date}}
{{invoice_url}}
{{payment_url}}
{{quote_number}}
{{expiry_date}}
{{quote_url}}
{{client_name}}
{{client_first_name}}
{{client_last_name}}
{{client_email}}
{{client_address}}
{{company_name}}
{{total_amount}}
{{issue_date}}
{{company_email}}
{{company_phone}}
{{payment_terms}}
$subsection_data) {
$subsection_title = $subsection_data['title'] ?? '';
$subsection_description = $subsection_data['description'] ?? '';
?>
$field_config) {
$current_value = $settings[$option_key] ?? ($field_config['default'] ?? '');
easy_invoice_render_field($option_key, $field_config, $current_value);
}
}
?>
';
echo '
';
if (!empty($enable_tax_field['description'])) {
echo '
' . esc_html($enable_tax_field['description']) . '
';
}
echo '