<?php $this->include('rs/utils.php') ?>
<?= $this->extend('rs/template-admin'); ?>

<?= $this->section('content'); ?>

<?php if (session()->getFlashdata('success')): ?>
    <div class="alert alert-success">
        <?= session()->getFlashdata('success') ?>
    </div>
<?php endif; ?>

<?php if (session()->getFlashdata('error')): ?>
    <div class="alert alert-danger">
        <?= session()->getFlashdata('error') ?>
    </div>
<?php endif; ?>

<style>
    .form-control {
        border: 1px solid #aaa !important;
    }
    .btn {
        margin: 5px;
    }
</style>

<div class="card shadow mb-4">
    <div class="card-header justify-content-between align-items-center">
        <h4 class="card-title">Edit Public Terms and Conditions</h4>
    </div>
    <div class="card-body">
        <form action="<?= site_url('/public_terms/1'); ?>" method="post">
            
            <div class="form-group">
                <label for="public_terms">Public Terms and Conditions</label>
                <textarea class="form-control w-100" id="public_terms_data" name="public_terms_data" rows="10" required><?= old('public_terms_data', isset($additionals['public_terms']) ? $additionals['public_terms'] : ''); ?></textarea>
            </div>
            
            <div class="form-group">
                <button type="submit" class="btn btn-primary">Save Changes</button>
                <a href="<?= site_url('/settings'); ?>" class="btn btn-secondary">Cancel</a>
            </div>
        </form>
    </div>
</div>

<script type="text/javascript">
    document.getElementById("public_terms_bar").classList.add("active");
</script>

<?= $this->endsection(); ?>
