Files
digest_app/templates/module_cms/terms_and_condition_edit.html
2024-04-08 00:33:02 +05:30

69 lines
2.7 KiB
HTML

{% extends 'base_structure/layout/base_template.html' %}
{% load static %}
{% block stylesheet %}
<!-- include required css cdn link through html here -->
{% include "cdn_through_html/quill_cdn_css.html" %}
{{form.media}}
{% endblock %}
{% block content %}
<div class="row layout-top-spacing">
<div class="col-lg-12">
<div class="row mb-2">
<div class="col">
<a href="{% url 'module_cms:terms_and_condition'%}" style="height: fit-content;width: fit-content;display: inline-block;">
<h3 class="card-title m-2 d-flex align-items-center gap-2" style="width: fit-content;"><span class="fw-bold material-symbols-outlined">
arrow_back
</span><span>{{operation}} Terms and Condition</span></h3>
</a>
</div>
</div>
<div class="row layout-spacing">
<div class="col-lg-12">
<div class="statbox widget box box-shadow">
<div class="widget-content widget-content-area">
<form method="POST" id="terms_and_condition">
{% csrf_token %}
{% include 'base_structure/includes/dynamic_template_form.html' with form=form %}
<div id="terms_condition_error" class="text-danger"></div>
<div class="mt-4 mb-0">
<div class="d-grid"><button class="btn btn-primary btn-block" type="submit">Submit</button></div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock content %}
{% block javascript %}
<!-- include required css cdn link through html here -->
{% include "cdn_through_html/quill_cdn_js.html" %}
<script>
$(document).ready(function() {
// Initialize form submission event handler
$("#terms_and_condition").submit(function(event) {
// Check if the Quill editor has any content
var quillContent = $("#quill-id_terms_condition .ql-editor").html().trim();
if (quillContent === '<p><br></p>') {
// If Quill editor content is empty, prevent form submission and display an error message
event.preventDefault();
$("#terms_condition_error").text("Please enter some text for the Terms and Conditions.").show();
} else {
// If Quill editor content is not empty, allow form submission
$("#terms_condition_error").hide();
}
});
});
</script>
{% endblock %}