{% extends 'dashboard/admin_dashboard/main.html' %}
{% load static %}
{% block content %}
<h4 class="fw-bold py-3 mb-4">
    <span class="text-muted fw-light">Gate Pass Management /</span> Edit Gate Pass
</h4>

<div style="padding: 10px;">
    {% if messages %}
        {% for message in messages %}
            <div class="alert {% if 'success' in message.tags %}alert-success alert-dismissible{% elif 'danger' in message.tags %}alert-danger alert-dismissible{% endif %}" role="alert" id="success-alert">
                {{ message }}
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
        {% endfor %}
    {% endif %}
</div>

<div class="row">
    <div class="col-md-12">
        <div class="card mb-4">
            <form role="form" method="POST" enctype="multipart/form-data" autocomplete="off">
                {% csrf_token %}
                <div class="card-body">

                    <!-- Gate Pass Name -->
                    <div class="row mb-3">
                        <div class="col-md-12">
                            <label class="form-label">Gate Pass Name <span class="text-danger">*</span></label>
                            <input type="text" class="form-control" name="gate_pass_name" value="{{ all_gate_pass_template.gate_pass_name }}" required>
                        </div>
                    </div>

                    <!-- Gate Pass Template -->
                    <div class="row mb-3">
                        <div class="col-md-12">
                            <label class="form-label">Gate Pass Template <span class="text-danger">*</span></label>
                            <textarea name="gate_pass_template" class="form-control summernote" rows="5" required>{{ all_gate_pass_template.gate_pass_template }}</textarea>
                        </div>
                    </div>

                    <!-- Submit Button -->
                    <div class="mt-3 d-flex justify-content-end">
                        <button type="submit" class="btn btn-primary" id="btn_submit">Update</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>


<!-- 1. jQuery -->
<!--<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>-->

<!-- 2. Bootstrap CSS & JS -->
<!--<link href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" rel="stylesheet">-->
<!--<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>-->

<!-- 3. Summernote CSS & JS -->
<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-bs4.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-bs4.min.js"></script>


<!-- 5. Initialize Summernote -->
<script>
$(document).ready(function() {
    $('.summernote').summernote({
        height: 200,
        toolbar: [
            ['style', ['style']],
            ['font', ['bold', 'italic', 'underline', 'clear']],
            ['fontname', ['fontname']],
            ['fontsize', ['fontsize']],
            ['color', ['color']],
            ['para', ['ul', 'ol', 'paragraph']],
            ['insert', ['link', 'picture', 'video']],
            ['view', ['fullscreen', 'codeview', 'help']]
        ]
    });
});
</script>

{% endblock %}