<?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 Cars Additionals</h4>
    </div>
    <div class="card-body">
        <form action="<?= site_url('/cars_additionals/1'); ?>" method="post">
            
            <div class="form-group">
                <label for="json">JSON Data</label>
                <textarea class="form-control w-100" id="json_data" name="json_data" rows="10" required><?= old('json_data', isset($additionals['json']) ? $additionals['json'] : ''); ?></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("cars_additionals").classList.add("active");
    document.getElementById("cars_additionals_bar").classList.add("active");
</script>

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