2018-08-18 11:41:59 +00:00
|
|
|
{% extends "base.html" %}
|
2023-02-13 03:57:21 +00:00
|
|
|
|
2018-08-18 11:41:59 +00:00
|
|
|
{% set active_page = "admin_settings" %}
|
2023-02-13 03:57:21 +00:00
|
|
|
|
2018-08-18 11:41:59 +00:00
|
|
|
{% block title %}
|
2023-02-13 03:57:21 +00:00
|
|
|
<title>
|
|
|
|
Basic Settings - {{ SITE_NAME }}
|
|
|
|
</title>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block dashboard_stat %}
|
2023-02-02 21:19:15 +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">
|
|
|
|
Settings
|
|
|
|
<small>Basic</small>
|
|
|
|
</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">Settings - Basic</li>
|
|
|
|
</ol>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-02-13 03:57:21 +00:00
|
|
|
{% endblock %}
|
2023-02-02 21:19:15 +00:00
|
|
|
|
2023-02-13 03:57:21 +00:00
|
|
|
{% block content %}
|
2016-04-29 21:36:37 +00:00
|
|
|
<section class="content">
|
2023-02-02 21:19:15 +00:00
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-header with-border">
|
|
|
|
<h3 class="card-title">Basic Settings</h3>
|
|
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
|
|
<table id="tbl_settings" class="table table-bordered table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2023-02-13 03:57:21 +00:00
|
|
|
<th>Setting Name</th>
|
|
|
|
<th>Current Value</th>
|
|
|
|
<th>Action</th>
|
2023-02-02 21:19:15 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for setting in settings %}
|
|
|
|
<tr class="odd">
|
|
|
|
<td>
|
|
|
|
{{ setting }}
|
|
|
|
</td>
|
2023-02-13 03:57:21 +00:00
|
|
|
{% if SETTING.get(setting) in [False] %}
|
2023-02-02 21:19:15 +00:00
|
|
|
<td>{{ SETTING.get(setting)|display_setting_state }}</td>
|
|
|
|
<td width="6%">
|
2023-02-13 03:57:21 +00:00
|
|
|
<button type="button" class="btn btn-success setting-toggle-button" id="{{ setting }}">
|
|
|
|
<i class="fas fa-toggle-on"></i> Turn On
|
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
{% elif SETTING.get(setting) in [True] %}
|
|
|
|
<td>{{ SETTING.get(setting)|display_setting_state }}</td>
|
|
|
|
<td width="6%">
|
|
|
|
<button type="button" class="btn btn-danger setting-toggle-button" id="{{ setting }}">
|
|
|
|
<i class="fas fa-toggle-off"></i> Turn Off
|
2023-02-02 21:19:15 +00:00
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
{% else %}
|
|
|
|
<td>
|
|
|
|
<input name="value" id="value" value="{{ SETTING.get(setting) }}">
|
|
|
|
</td>
|
|
|
|
<td width="6%">
|
2023-02-13 03:57:21 +00:00
|
|
|
<button type="button" class="btn btn-primary setting-save-button" id="{{ setting }}">
|
|
|
|
<i class="fas fa-save"></i> Save
|
2023-02-02 21:19:15 +00:00
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
{% endif %}
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2016-06-18 04:41:01 +00:00
|
|
|
</div>
|
2023-02-02 21:19:15 +00:00
|
|
|
</div>
|
2016-04-29 21:36:37 +00:00
|
|
|
</section>
|
2018-11-21 03:24:33 +00:00
|
|
|
{% endblock %}
|
2023-02-13 03:57:21 +00:00
|
|
|
|
2016-04-29 21:36:37 +00:00
|
|
|
{% block extrascripts %}
|
2023-02-13 03:57:21 +00:00
|
|
|
<script>
|
2016-06-18 04:41:01 +00:00
|
|
|
// set up history data table
|
|
|
|
$("#tbl_settings").DataTable({
|
2023-02-13 03:57:21 +00:00
|
|
|
"paging": false,
|
|
|
|
"lengthChange": false,
|
|
|
|
"searching": true,
|
|
|
|
"ordering": true,
|
|
|
|
"info": true,
|
|
|
|
"autoWidth": false
|
2016-06-18 04:41:01 +00:00
|
|
|
});
|
2019-12-02 03:32:03 +00:00
|
|
|
$(document.body).on('click', '.setting-toggle-button', function () {
|
2023-02-13 03:57:21 +00:00
|
|
|
var setting = $(this).prop('id');
|
|
|
|
applyChanges({
|
|
|
|
'_csrf_token': '{{ csrf_token() }}'
|
|
|
|
}, $SCRIPT_ROOT + '/admin/setting/basic/' + setting + '/toggle', false, true)
|
2016-06-18 04:41:01 +00:00
|
|
|
});
|
2018-11-21 03:24:33 +00:00
|
|
|
|
2019-12-02 03:32:03 +00:00
|
|
|
$(document.body).on('click', '.setting-save-button', function () {
|
2023-02-13 03:57:21 +00:00
|
|
|
var setting = $(this).prop('id');
|
|
|
|
var value = $(this).parents('tr').find('#value')[0].value;
|
|
|
|
var postdata = {
|
|
|
|
'value': value,
|
|
|
|
'_csrf_token': '{{ csrf_token() }}'
|
|
|
|
};
|
|
|
|
applyChanges(postdata, $SCRIPT_ROOT + '/admin/setting/basic/' + setting + '/edit', false, true)
|
2016-06-18 04:41:01 +00:00
|
|
|
});
|
2023-02-13 03:57:21 +00:00
|
|
|
</script>
|
|
|
|
{% endblock %}
|