2019-12-02 03:32:03 +00:00
|
|
|
{% extends "base.html" %}
|
|
|
|
{% set active_page = "admin_domain_template" %}
|
2023-02-18 14:04:37 +00:00
|
|
|
{% block title %}<title>Templates - {{ SITE_NAME }}</title>{% endblock %}
|
2023-02-13 03:57:21 +00:00
|
|
|
|
|
|
|
{% block dashboard_stat %}
|
2023-02-18 14:04:37 +00:00
|
|
|
<!-- Content Header (Page header) -->
|
|
|
|
<section class="content-header">
|
|
|
|
<h1>
|
|
|
|
Templates
|
|
|
|
<small>List</small>
|
|
|
|
</h1>
|
|
|
|
<ol class="breadcrumb">
|
|
|
|
<li><a href="{{ url_for('admin.templates') }}"><i class="fa fa-dashboard"></i> Templates</a></li>
|
|
|
|
<li class="active">List</li>
|
|
|
|
</ol>
|
|
|
|
</section>
|
2023-02-13 03:57:21 +00:00
|
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
2023-02-18 14:04:37 +00:00
|
|
|
<!-- Main content -->
|
2023-02-13 03:57:21 +00:00
|
|
|
<section class="content">
|
2023-02-18 14:04:37 +00:00
|
|
|
{% with errors = get_flashed_messages(category_filter=["error"]) %} {% if errors %}
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="alert alert-danger alert-dismissible">
|
|
|
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
|
|
|
<h4>
|
|
|
|
<i class="icon fa 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>
|
2019-12-02 03:32:03 +00:00
|
|
|
</div>
|
2023-02-18 14:04:37 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %} {% endwith %}
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-xs-12">
|
|
|
|
<div class="box">
|
|
|
|
<div class="box-header">
|
|
|
|
<h3 class="box-title">Templates</h3>
|
|
|
|
</div>
|
|
|
|
<div class="box-body">
|
|
|
|
<a href="{{ url_for('admin.create_template') }}">
|
|
|
|
<button type="button" class="btn btn-flat btn-primary pull-left">
|
|
|
|
Create Template <i class="fa fa-plus"></i>
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div class="box-body">
|
|
|
|
<table id="tbl_template_list" class="table table-bordered table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Number of Records</th>
|
|
|
|
<th width="20%">Action</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>
|
|
|
|
<a href="{{ url_for('admin.edit_template', template=template.name) }}">
|
|
|
|
<button type="button" class="btn btn-flat btn-warning button_edit" id="btn_edit">
|
|
|
|
Edit <i class="fa fa-edit"></i>
|
|
|
|
</button>
|
|
|
|
</a>
|
|
|
|
<button type="button" class="btn btn-flat btn-danger button_delete" id="{{template.name}}">
|
|
|
|
Delete <i class="fa fa-trash"></i>
|
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2019-12-02 03:32:03 +00:00
|
|
|
</div>
|
2023-02-18 14:04:37 +00:00
|
|
|
<!-- /.box-body -->
|
2019-12-02 03:32:03 +00:00
|
|
|
</div>
|
2023-02-18 14:04:37 +00:00
|
|
|
<!-- /.box -->
|
2019-12-02 03:32:03 +00:00
|
|
|
</div>
|
2023-02-18 14:04:37 +00:00
|
|
|
<!-- /.col -->
|
2023-02-06 15:45:13 +00:00
|
|
|
</div>
|
2023-02-18 14:04:37 +00:00
|
|
|
<!-- /.row -->
|
2019-12-02 03:32:03 +00:00
|
|
|
</section>
|
2023-02-18 14:04:37 +00:00
|
|
|
<!-- /.content -->
|
2019-12-02 03:32:03 +00:00
|
|
|
{% endblock %}
|
|
|
|
{% block extrascripts %}
|
|
|
|
<script>
|
2023-02-18 14:04:37 +00:00
|
|
|
// set up history data table
|
2019-12-02 03:32:03 +00:00
|
|
|
$("#tbl_template_list").DataTable({
|
|
|
|
"paging": true,
|
|
|
|
"lengthChange": true,
|
|
|
|
"searching": true,
|
|
|
|
"ordering": true,
|
|
|
|
"info": false,
|
|
|
|
"autoWidth": false
|
|
|
|
});
|
|
|
|
// 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') }}';
|
|
|
|
});
|
2023-02-18 14:04:37 +00:00
|
|
|
|
2019-12-02 03:32:03 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
{% endblock %}
|
|
|
|
{% block modals %}
|
2023-02-18 14:04:37 +00:00
|
|
|
{% endblock %}
|