2019-12-02 03:32:03 +00:00
|
|
|
{% extends "base.html" %}
|
|
|
|
{% set active_page = "admin_domain_template" %}
|
2023-02-20 01:50:27 +00:00
|
|
|
{% block title %}<title>Zone Templates - {{ SITE_NAME }}</title>{% endblock %}
|
2023-02-18 16:04:14 +00:00
|
|
|
|
|
|
|
{% block dashboard_stat %}
|
2023-02-20 01:50:27 +00:00
|
|
|
<div class="content-header">
|
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="row mb-2">
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<h1 class="m-0 text-dark">Zone Templates</h1>
|
|
|
|
</div>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<ol class="breadcrumb float-sm-right">
|
|
|
|
<li class="breadcrumb-item"><a href="{{ url_for('dashboard.dashboard') }}">Dashboard</a></li>
|
|
|
|
<li class="breadcrumb-item active">Zone Templates</li>
|
|
|
|
</ol>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-02-18 14:04:37 +00:00
|
|
|
</div>
|
2023-02-18 16:04:14 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
2023-02-20 01:50:27 +00:00
|
|
|
<section class="content">
|
|
|
|
<div class="container-fluid">
|
|
|
|
{% with errors = get_flashed_messages(category_filter=["error"]) %}
|
|
|
|
{% if errors %}
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-12">
|
|
|
|
<div class="alert alert-danger alert-dismissible">
|
|
|
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
|
|
|
|
</button>
|
|
|
|
<h4>
|
|
|
|
<i class="fa-solid fa-ban"></i> Error!
|
|
|
|
</h4>
|
|
|
|
<div class="alert-message block-message error">
|
|
|
|
<a class="close" href="#">x</a>
|
|
|
|
<ul>
|
|
|
|
{%- for msg in errors %}
|
|
|
|
<li>{{ msg }}</li>
|
|
|
|
{% endfor -%}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endwith %}
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-12">
|
|
|
|
<div class="card card-outline card-primary shadow">
|
|
|
|
<div class="card-header">
|
|
|
|
<h3 class="card-title">Templates</h3>
|
|
|
|
<div class="card-tools">
|
|
|
|
<a href="{{ url_for('admin.create_template') }}">
|
|
|
|
<button type="button" class="btn btn-primary">
|
|
|
|
<i class="fa-solid fa-plus"></i> Create Template
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- /.card-header -->
|
|
|
|
<div class="card-body table-responsive">
|
|
|
|
<table id="tbl_template_list"
|
|
|
|
class="table table-bordered table-striped table-hover table-sm records">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Total Records</th>
|
|
|
|
<th>Actions</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for template in templates %}
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<a href="{{ url_for('admin.edit_template', template=template.name) }}">
|
|
|
|
<strong>{{ template.name }}</strong>
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
<td>{{ template.description }}</td>
|
|
|
|
<td>{{ template.records|count }}</td>
|
|
|
|
<td>
|
|
|
|
<div class="dropdown">
|
|
|
|
<button class="btn btn-primary dropdown-toggle" type="button"
|
|
|
|
id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true"
|
|
|
|
aria-expanded="false">
|
2023-02-20 13:32:53 +00:00
|
|
|
<i class="fa-solid fa-bars"></i>
|
2023-02-20 01:50:27 +00:00
|
|
|
</button>
|
|
|
|
<div class="dropdown-menu" aria-labelledby="dropdownMenu">
|
|
|
|
<button type="button" class="dropdown-item btn-warning"
|
|
|
|
onclick="window.location.href='{{ url_for('admin.edit_template', template=template.name) }}'">
|
|
|
|
<i class="fa-solid fa-edit"></i> Edit Template
|
|
|
|
</button>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<button type="button"
|
|
|
|
class="dropdown-item btn-secondary button_delete"
|
|
|
|
id="{{ template.name }}">
|
|
|
|
<span style="color: red;">
|
|
|
|
<i class="fa-solid fa-trash"></i> Delete Template
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<!-- /.card-body -->
|
|
|
|
</div>
|
|
|
|
<!-- /.card -->
|
|
|
|
</div>
|
|
|
|
<!-- /.col -->
|
2023-02-18 16:04:14 +00:00
|
|
|
</div>
|
2023-02-20 01:50:27 +00:00
|
|
|
<!-- /.row -->
|
2019-12-02 03:32:03 +00:00
|
|
|
</div>
|
2023-02-20 01:50:27 +00:00
|
|
|
<!-- /.container-fluid -->
|
|
|
|
</section>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block head_styles %}
|
|
|
|
<style>
|
|
|
|
/* Page Specific Overrides */
|
|
|
|
table.records tbody td:first-of-type,
|
|
|
|
table.records tbody td:nth-child(0n+2) { text-align: left; }
|
|
|
|
</style>
|
2019-12-02 03:32:03 +00:00
|
|
|
{% endblock %}
|
2023-02-18 16:04:14 +00:00
|
|
|
|
2019-12-02 03:32:03 +00:00
|
|
|
{% block extrascripts %}
|
2023-02-20 01:50:27 +00:00
|
|
|
<script>
|
|
|
|
// Initialize DataTables
|
|
|
|
$("#tbl_template_list").DataTable({
|
|
|
|
"paging": true,
|
|
|
|
"lengthChange": true,
|
|
|
|
"searching": true,
|
|
|
|
"ordering": true,
|
|
|
|
"info": false,
|
|
|
|
"autoWidth": false
|
|
|
|
});
|
2023-02-18 16:04:14 +00:00
|
|
|
|
2023-02-20 01:50:27 +00:00
|
|
|
// handle delete button
|
|
|
|
$(document.body).on("click", ".button_delete", function (e) {
|
|
|
|
var template = $(this).prop('id');
|
|
|
|
$.post($SCRIPT_ROOT + '/admin/template/' + template + '/delete', {
|
|
|
|
'_csrf_token': '{{ csrf_token() }}'
|
|
|
|
}, function () {
|
|
|
|
window.location.href = '{{ url_for('admin.templates') }}';
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
2019-12-02 03:32:03 +00:00
|
|
|
{% endblock %}
|
2023-02-18 16:04:14 +00:00
|
|
|
|
2019-12-02 03:32:03 +00:00
|
|
|
{% block modals %}
|
2023-02-18 16:04:14 +00:00
|
|
|
{% endblock %}
|