<?php
    $checkMaintenance = core::isMaintenance();
    $checkDebug = core::isDebug();
    $checkLogSuccess = core::getConfig("LOG_SUCCESS");
    $checkLogWarning = core::getConfig("LOG_WARNING");
    $checkLogError = core::getConfig("LOG_ERROR");
?>

<h4>Général</h4>
<div class="element-parametres form-check form-switch">
    <input class="form-check-input" type="checkbox" role="switch" id="checkMaintenance" <?php core::checkboxSelecter($checkMaintenance) ?>>
    <label class="form-check-label" for="checkMaintenance">Site en mode maintenance (les salariés ne pourront plus faire d'action sur le site)</label>
</div>

<div class="element-parametres form-check form-switch">
    <input class="form-check-input" type="checkbox" role="switch" id="checkDebug" <?php core::checkboxSelecter($checkDebug) ?>>
    <label class="form-check-label" for="checkDebug">Afficher les erreurs (débug)</label>
</div>

<h4>Historique</h4>
<div class="element-parametres form-check form-switch">
    <input class="form-check-input" type="checkbox" role="switch" id="checkLogSuccess" <?php core::checkboxSelecter($checkLogSuccess) ?>>
    <label class="form-check-label" for="checkLogSuccess">Historiser les actions réalisées avec succès</label>
</div>

<div class="element-parametres form-check form-switch">
    <input class="form-check-input" type="checkbox" role="switch" id="checkLogWarning" <?php core::checkboxSelecter($checkLogWarning) ?>>
    <label class="form-check-label" for="checkLogWarning">Historiser les actions réalisées avec warning</label>
</div>

<div class="element-parametres form-check form-switch">
    <input class="form-check-input" type="checkbox" role="switch" id="checkLogError" <?php core::checkboxSelecter($checkLogError) ?>>
    <label class="form-check-label" for="checkLogError">Historiser les actions en erreur</label>
</div>

<script>
    $(document).ready(function() {
        $('#checkMaintenance').on('change', function() {
            window.location.href = "/submit.php?from=parametres-maintenance-activation&actif=" + $("#checkMaintenance").prop('checked');
        });

        $('#checkDebug').on('change', function() {
            window.location.href = "/submit.php?from=parametres-debug-activation&actif=" + $("#checkDebug").prop('checked');
        });

        $('#checkLogSuccess').on('change', function() {
            window.location.href = "/submit.php?from=parametres-config&name=LOG_SUCCESS&value=" + $("#checkLogSuccess").prop('checked');
        });

        $('#checkLogWarning').on('change', function() {
            window.location.href = "/submit.php?from=parametres-config&name=LOG_WARNING&value=" + $("#checkLogWarning").prop('checked');
        });

        $('#checkLogError').on('change', function() {
            window.location.href = "/submit.php?from=parametres-config&name=LOG_ERROR&value=" + $("#checkLogError").prop('checked');
        });
    });
</script>
