<?php
$vehicaUpdaterNotice = get_option('vehica_updater_notice');
update_option('vehica_updater_notice', '0');
?>
<style>
    body {
        background: #fff !important;
    }

    #wpfooter {
        display: none !important;
    }

    #wpbody-content {
        padding-bottom: 0 !important;
    }

    #wpcontent {
        padding-left: 0 !important;
    }

    .error,
    .notice,
    .updated,
    .update-nag {
        display: none !important;
    }

    .clearfix::after {
        display: block;
        content: "";
        clear: both;
    }

    h1 {
        font-size: 36px;
        margin-bottom: 20px;
        margin-top: 0;
        font-size: 36px;
        height: 36px;
        float: left;
        width: 100%;
    }

    .vehica-updater-container {
        padding: 60px
    }

    .vehica-updater__box {
        max-width: 770px;
        min-height: 92px;
        border: 1px solid #D9E2EC;
        padding: 40px;
        border-radius: 5px;
        font-size: 16px;
        line-height: 22px;
        background: #f3f3f3;
        color: #23282d;
    }
</style>

<div class="vehica-updater-container">
    <h1><?php esc_html_e('HomeHub Updater', 'vehica-updater'); ?></h1>
    <div class="clearfix"></div>
    <div class="vehica-updater__box">
        <div>
            <form
                    action="<?php echo esc_url(admin_url('admin-post.php?action=vehica_updater_save_purchase_code')); ?>"
                    method="post"
            >
                <div style="margin:0 0 10px 0">
                    <strong><?php esc_html_e('ATENÇÃO: Não fornecemos atualizações gratuitas!', 'vehica-updater'); ?></strong>
                </div>          
                Porém, é altamente recomendado que se faça uma atualização ao menos 1 vez a cada 6 meses!
                <div style="margin-top:30px;">
                    <strong><?php esc_html_e('Para mais informações,', 'vehica-updater'); ?></strong>
                    <a style="font-weight:500; text-decoration:underline!important;"
                            target="_blank"
                              href="https://scripts.seisbrasil.com/fale-conosco/">Contate-nos!</a>
                </div> 
            </form>
        </div>
    </div>

    <?php if (!empty(vehica_get_purchase_code()) && empty(get_option('vehica_invalid_purchase_code'))) : ?>
        <div class="vehica-updater__box" style="margin-top:30px">
            <div>
                <div class="vehica-updater-app">
                    <div>
                        <vehica-updater
                                :plugins="<?php echo htmlspecialchars(json_encode(vehica_updater_get_plugins())); ?>"
                                theme-status="<?php echo esc_attr(vehica_updater_get_theme_status()); ?>"
                                query-url="<?php echo esc_url(admin_url('admin-post.php?action=')); ?>"
                        >
                            <div slot-scope="updater">
                                <div style="margin-top:20px;">
                                    <a
                                            v-if="updater.showUpdateButton"
                                            href="<?php echo esc_url(admin_url('admin-post.php?action=vehica_check_updates')); ?>"
                                            class="vehica-button vehica-button--accent"
                                            style="float:left; margin-bottom:0;"
                                    >
                                        <?php esc_html_e('Check for new updates', 'vehica-updater'); ?>
                                    </a>
                                </div>
                                <div class="clearfix"></div>

                                <?php if (vehica_require_update()) : ?>
                                    <div>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </vehica-updater>
                    </div>
                </div>
            </div>
        </div>
    <?php endif; ?>
</div>