| Current Path : /home/rtorresani/www/app/code/Torresani/Consent/view/frontend/templates/privacy/ |
| Current File : //home/rtorresani/www/app/code/Torresani/Consent/view/frontend/templates/privacy/index.phtml |
<p>
Visualizza e modifica i tuoi consensi di privacy.<br/><br/>
</p>
<p>
<?php
$responses = json_decode($block->getHelloWorld(), true);
$consents = [];
$emailUser = $responses[0]['subject']['email'];
foreach ($responses as $response) {
foreach ($response['preferences'] as $key => $preference) {
if (!array_key_exists($key,$consents)) {
$consents[$key] = $preference;
}
}
}
if (array_key_exists('form_key', $_POST)) {
if (array_key_exists('tcagreecreateaccountconsent1', $_POST)) {
$consents['consent1'] = 1;
} else {
$consents['consent1'] = 0;
}
if (array_key_exists('tcagreecreateaccountconsent2', $_POST)) {
$consents['consent2'] = 1;
} else {
$consents['consent2'] = 0;
}
if (array_key_exists('tcagreecreateaccountconsent3', $_POST)) {
$consents['consent3'] = 1;
} else {
$consents['consent3'] = 0;
}
}
?>
</p>
<form id="privacy-form" method="post">
<fieldset class="fieldset">
<label>La tua email:</label>
<input type="text" name="email" disabled="disabled" value="<?php echo $emailUser ?>"/>
<br/>
<br/>
<div class="field tcagreecreateaccount required" style="display: flex; align-items: flex-start;">
<input type="checkbox" id="tcagreecreateaccount" name="tcagreecreateaccount" class="input-checkbox checkbox required" value="1" <?php if (($consents['policy']??null)==1) { echo 'checked="checked"'; } ?> disabled="disabled">
<label for="tcagreecreateaccount" class="label">
<?php echo __('informativeprivacy')?>
</label>
</div>
<div class="field tcagreecreateaccount required" style="display: flex; align-items: flex-start;">
<input type="checkbox" id="tcagreecreateaccountterms" name="tcagreecreateaccountterms" class="input-checkbox checkbox required" value="1" <?php if (($consents['terms']??null)==1) { echo 'checked="checked"'; } ?> disabled="disabled">
<label for="tcagreecreateaccountterms" class="label">
<?php echo __('termcondition')?>
</label>
</div>
<div class="field tcagreecreateaccount required" style="display: flex; align-items: flex-start;">
<input type="checkbox" id="tcagreecreateaccountadult" name="tcagreecreateaccountadult" class="input-checkbox checkbox required" value="1" <?php if (($consents['adult']??null)==1) { echo 'checked="checked"'; } ?>>
<label for="tcagreecreateaccountadult" class="label">
<?php echo __('isadult')?>
</label>
</div>
<div class="field tcagreecreateaccount " style="display: flex; align-items: flex-start;">
<button class="btn btn-primary" onclick="jQuery('.consent').prop( 'checked', true); return false;">Acconsenti a tutto</button>
</div>
<div class="field tcagreecreateaccount" style="display: flex; align-items: flex-start;">
<input type="checkbox" id="tcagreecreateaccountconsent1" name="tcagreecreateaccountconsent1" class="input-checkbox checkbox consent" value="1" <?php if (($consents['consent1']??null)==1) { echo 'checked="checked"'; } ?>>
<label for="tcagreecreateaccountconsent1" class="label">
<?php echo __('consent1')?>
</label>
</div>
<div class="field tcagreecreateaccount" style="display: flex; align-items: flex-start;">
<input type="checkbox" id="tcagreecreateaccountconsent2" name="tcagreecreateaccountconsent2" class="input-checkbox checkbox consent" value="1" <?php if (($consents['consent2']??null)==1) { echo 'checked="checked"'; } ?>>
<label for="tcagreecreateaccountconsent2" class="label">
<?php echo __('consent2')?>
</label>
</div>
<div class="field tcagreecreateaccount" style="display: flex; align-items: flex-start;">
<input type="checkbox" id="tcagreecreateaccountconsent3" name="tcagreecreateaccountconsent3" class="input-checkbox checkbox consent" value="1" <?php if (($consents['consent3']??null)==1) { echo 'checked="checked"'; } ?>>
<label for="tcagreecreateaccountconsent3" class="label">
<?php echo __('consent3')?>
</label>
</div>
<button type="submit" id="contact-submit" class="action submit primary">
<span><?= $block->escapeHtml(__('Submit')) ?></span>
</button>
</fieldset>
<script>
_iub.cons_instructions.push(["load", {
form: {
selector: document.getElementById("privacy-form"),
map: {
subject: {
email: "email"
},
exclude: ['password', 'password_confirmation'],
preferences: {
policy: "tcagreecreateaccount",
terms: "tcagreecreateaccountterms",
adult: "tcagreecreateaccountadult",
consent1: "tcagreecreateaccountconsent1",
consent2: "tcagreecreateaccountconsent2",
consent3: "tcagreecreateaccountconsent3"
}
}
},
consent: {
legal_notices: [{
identifier: "privacy_policy",
},
{
identifier: 'cookie_policy',
},
{
identifier: "terms",
}
],
}
}]);
</script>
</form>