<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
?>
<div id="kirilkirkov" class="wrap">
    <div>
        <div class="header p-4 flex items-center space-between">
            <div class="flex items-center">
                <img class="logo" src="<?php echo esc_url(plugins_url('../../Assets/Img/logo.svg', __FILE__ )); ?>" alt="<?php echo esc_attr( 'WP Invoices' ) ?>" />
            </div>
            <h1 class="text-white uppercase text-sm font-lighter p-0">
                <?php esc_html_e('Invoice Preview', 'kirilkirkov-pdf-invoice-manager' ); ?>
            </h1>
        </div>
        <div class="flex flex-wrap">
            <div class="w-full">
                <div class="section-body bg-white p-4 invoice-preview-page">
                    
                    <nav class="p-4 mb-4 preview-inv-nav">
                        <a href="<?php echo esc_url(admin_url( 'admin.php?page=' . $Config::SUB_MENU_PREVIEW_INVOICE_PAGE_SLUG . '&view=' . $invoice['id'] . '&download-invoice=original&nonce_download_invoice=' . wp_create_nonce('download_invoice_' . $invoice['id']) )) ?>" class="button media-button"><?php esc_html_e('Download/Print Original', 'kirilkirkov-pdf-invoice-manager' ) ?></a>
                        <a href="<?php echo esc_url(admin_url( 'admin.php?page=' . $Config::SUB_MENU_PREVIEW_INVOICE_PAGE_SLUG . '&view=' . $invoice['id'] . '&download-invoice=copy&nonce_download_invoice=' . wp_create_nonce('download_invoice_' . $invoice['id']) )) ?>" class="button media-button"><?php esc_html_e('Download/Print Copy', 'kirilkirkov-pdf-invoice-manager' ) ?></a>
                        <a href="<?php echo esc_url(admin_url( 'admin.php?page=' . $Config::SUB_MENU_SEND_INVOICE_PAGE_SLUG . '&id=' . $invoice['id'] )) ?>" class="button media-button"><?php esc_html_e('Send', 'kirilkirkov-pdf-invoice-manager' ) ?></a>
                        <a href="<?php echo esc_url(admin_url( 'admin.php?page=' . $Config::SUB_MENU_CREATE_INVOICE_PAGE_SLUG . '&edit=' . $invoice['id'] )) ?>" class="button media-button"><?php esc_html_e('Edit', 'kirilkirkov-pdf-invoice-manager' ) ?></a>
                        
                        <?php if(isset($invoice['wc_id']) && (int)$invoice['wc_id'] > 0) { ?>
                            <a href="<?php echo esc_url(admin_url( 'post.php?post=' . $invoice['wc_id'] . '&action=edit' )) ?>" class="button media-button" title="<?php esc_attr_e('WooCommerce Order Preview', 'kirilkirkov-pdf-invoice-manager' ) ?>"><?php esc_html_e('WC Order', 'kirilkirkov-pdf-invoice-manager' ) ?></a>
                        <?php } ?>

                        <a href="<?php echo esc_url(admin_url('options-general.php?page=' . $Config::SETTINGS_GET_PARAM)); ?>" class="button media-button"><?php esc_html_e( 'Settings', 'kirilkirkov-pdf-invoice-manager' ); ?></a>
                    </nav>
          
                    <div class="invoice-box">
                        <?php 
                            $kirilkirkovwipdf_is_download = false;

                            $kirilkirkovwipdf_choosed_template = get_option($Config::INPUTS_PREFIX.'current_template');
                            $kirilkirkovwipdf_round_to_decimals = (int)get_option( $Config::INPUTS_PREFIX.'count_decimal_digits' );
                            $kirilkirkovwipdf_numbers_format_system_ = $Config::get_numbers_format_system();
                            
                            if(!$kirilkirkovwipdf_choosed_template || $kirilkirkovwipdf_choosed_template === 'creative') {
                                require 'Templates/Design/Creative.php'; 
                            }
                            if($kirilkirkovwipdf_choosed_template && $kirilkirkovwipdf_choosed_template === 'apple') {
                                require 'Templates/Design/Apple.php'; 
                            }
                            if($kirilkirkovwipdf_choosed_template && $kirilkirkovwipdf_choosed_template === 'classic') {
                                require 'Templates/Design/Classic.php'; 
                            }
                            if($kirilkirkovwipdf_choosed_template && $kirilkirkovwipdf_choosed_template === 'designer') {
                                require 'Templates/Design/Designer.php'; 
                            }
                        ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>