<?php

/**
 * Funkcnost zaobstarava js v app.js
 * Do formu sa nastavuju classy podla toho co sa prave deje:
 *  - loading - ked prebieha request
 *  - success - ked uspesne prebehol
 *  - fail - ked to padlo tak sa prida class fail. po 5s sa automaticky odstrani
 */

// prettier-ignore
$gdpr_label = __("Súhlasím so", "rootcommerce") . " <a class='link gdpr-link privacy-policy-link' href='" . get_privacy_policy_url() . "'>" . __("spracovaním osobných údajov", "rootcommerce") . "</a> " . __("na marketingové účely.", "rootcommerce");
$title = __("Prihlásiť sa na odber", "rootcommerce");
$subscribe_label = __("Odoslať", "rootcommerce");
$form_id = uniqid("newsletter_form");
?>
<h4><?= $title ?></h4>
<form id="<?= $form_id ?>" class="newsletter-form">
    <div class="overlay"></div>
    <input type="email" class="input-text email" name="email" placeholder="email@domain.com" autocomplete="email" required />
    <input id="gdpr" type="checkbox" class="input-checkbox gdpr" name="gdpr" required />
    <label for="gdpr"><span><?= $gdpr_label ?></span></label>
    <button type="submit" class="button submit" name="subscribe_newsletter" value="<?= $subscribe_label ?>"><?= $subscribe_label ?></button>
    <p class="message error-message">Chybicka se vloudila</p>
    <p class="message success-message">OK</p>
</form>