<?php

/**
 * Provide an admin area view for the plugin
 *
 * This file is used to markup the admin-facing aspects of the plugin.
 *
 * @link       http://www.techspawn.com
 * @since      1.0.0
 *
 * @package    Wcmlim
 * @subpackage Wcmlim/admin/partials
 */

// Fetching the license-related options from the database
$wcmlim_license      = get_option('wcmlim_license'); // Default to empty if not set
$wcmlim_email        = get_option('wcmlim_email');   // Default to empty if not set
$wcmlim_license_key  = get_option('purchase_code'); // Default to empty if not set
?>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">


<!-- Replacing Design Preview Section -->
<div class="plugin-dashboard">
    <header class="dashboard-header">
        <h1>MULTILOCA - WooCommerce Multi Locations Inventory Management</h1>
    </header>

    <section class="features-grid">
        <div class="feature-card">
            <i class="fas fa-solid fa-location-pin feature-icon"></i>
            <h2>Find the Nearest Location</h2>
            <p>Enable visitors to easily locate nearby stores on product pages or throughout the website.</p>
        </div>
        <div class="feature-card">
            <i class="fas fa-solid fa-dollar-sign feature-icon"></i>
            <h2>Location-Wise Price</h2>
            <p>Implement location-wise pricing for targeted and effective pricing strategies.</p>
        </div>
        <div class="feature-card">
            <i class="fas fa-solid fa-truck feature-icon"></i>
            <h2>Location-Specific Shipping</h2>
            <p>Adjusts shipping methods and rates based on customer location and delivery preferences.</p>
        </div>
        <div class="feature-card">
            <i class="fas fa-solid fa-cart-plus feature-icon"></i>
            <h2>Ajax Add-to-Cart</h2>
            <p>Allow users to add products to the cart without reloading the page.</p>
        </div>
        <div class="feature-card">
            <i class="fas fa-map-marker-alt feature-icon"></i>
            <h2>Location Shop Manager</h2>
            <p>Assign shop managers to specific locations for streamlined operations.</p>
        </div>
        <div class="feature-card">
            <i class="fas fa-sync-alt feature-icon"></i>
            <h2>Auto Order Fullfilment Based on Rules</h2>
            <p>Automatically processes and ships orders based on rules.</p>
        </div>
        <div class="feature-card">
            <i class="fas fa-cogs feature-icon"></i>
            <h2>Backend-Only Mode</h2>
            <p>Simplifying the ordering process for customers automatically from the backend.</p>
        </div>
        <div class="feature-card">
            <i class="fas fa-code-branch feature-icon"></i>
            <h2>Rest API</h2>
            <p>Provides an API for retrieving and updating product stock at different locations.</p>
        </div>
    </section>

  <div class="license-section">
    <h2>License Key Verification</h2>
    <?php if ($wcmlim_license == "invalid" || $wcmlim_license == '') : ?>
        <div class="license-input">
            <input type="text" id="wcmlim_email" placeholder="Enter Registered Email Address" />
            <input type="text" id="purchase_code" placeholder="Enter Envato Purchase Code" />
            <button id="activateLicense" class="activate-license-btn" location.reload()>Activate</button>
        </div>
    <?php elseif ($wcmlim_license == "valid") : ?>
        <div class="license-input">
            <input type="text" id="wcmlim_email" value="<?php echo esc_attr($wcmlim_email); ?>" readonly />
             <?php
                $obfuscated_purchase_code = substr($wcmlim_license_key, 0, -3) . '***';
                ?>
              <input type="text" id="purchase_code" value="<?php echo esc_attr($obfuscated_purchase_code); ?>" readonly />
            <button id="removeLicense" class="remove-multiloca-license">Remove</button>
        </div>
    <?php endif; ?>
</div>


    <div class="notices-section">
        <h2>Notices</h2>
        <?php if ($wcmlim_license == '' || $wcmlim_license == "invalid") : ?>
            <div class="notice-card">
                <i class="fas fa-info-circle notice-icon"></i>
                <p>For any queries, kindly contact us at - <b>support@techspawn.com</b></p>
            </div>
            <div class="notice-card warning">
                <i class="fas fa-exclamation-circle notice-icon"></i>
                <p>Your plugin support is not active. Kindly renew your support.</p>
            </div>
            <div class="notice-card error">
                <i class="fas fa-times-circle notice-icon"></i>
                <p>Please enter your registered email address and Envato purchase code to activate the license.</p>
            </div>
        <?php elseif ($wcmlim_license == "valid") : ?>
            <div class="notice-card">
                <i class="fas fa-info-circle notice-icon"></i>
                <p>For any queries, kindly contact us at - <b>support@techspawn.com</b></p>
            </div>
            <div class="notice-card warning">
                <i class="fas fa-exclamation-circle notice-icon"></i>
                <p>Your support is expiring in the next 6 months.</p>
            </div>
        <?php endif; ?>
    </div>
</div>


<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
