| @@ -83,9 +83,17 @@ | ||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Dynamically load the selected template |
| 86 | 86 | $template_file = easy_invoice_design_template( 'invoice', (string) $current_template ); |
| 87 | - if (file_exists($template_file)) { | |
| 87 | + if ( ! $invoice instanceof \EasyInvoice\Models\Invoice ) { | |
| 88 | + // Nothing to render yet. The designs read the model | |
| 89 | + // directly, so including one here would be fatal. | |
| 90 | + ?> | |
| 91 | + <div class="ei-preview-empty" style="text-align:center;padding:48px 24px;color:#64748b;"> | |
| 92 | + <p style="margin:0;font-size:14px;"><?php esc_html_e( 'Your invoice will appear here as you fill in the form.', 'easy-invoice' ); ?></p> | |
| 93 | + </div> | |
| 94 | + <?php | |
| 95 | + } elseif (file_exists($template_file)) { | |
| 88 | 96 | include_once $template_file; |
| 89 | 97 | } else { |
| 90 | 98 | // Show template not found message |
| 91 | 99 | ?> |