DB Update add User settings to enable / disable Dashboard Items Financial and Technical

This commit is contained in:
johnnyq
2023-12-21 16:36:31 -05:00
parent d21e5fafca
commit 297148bc63
5 changed files with 30 additions and 13 deletions

View File

@@ -7,12 +7,16 @@ if (isset($_GET['year'])) {
$year = date('Y');
}
if (isset($_GET['show_financial']) == 1) {
$show_financial = 1;
if (isset($_GET['enable_financial']) == 1) {
mysqli_query($mysqli, "UPDATE user_settings SET user_config_dashboard_financial_enable = 1 WHERE user_id = $session_user_id");
} else {
mysqli_query($mysqli, "UPDATE user_settings SET user_config_dashboard_financial_enable = 0 WHERE user_id = $session_user_id");
}
if (isset($_GET['show_technical']) == 1) {
$show_technical = 1;
if (isset($_GET['enable_technical']) == 1) {
mysqli_query($mysqli, "UPDATE user_settings SET user_config_dashboard_technical_enable = 1 WHERE user_id = $session_user_id");
} else {
mysqli_query($mysqli, "UPDATE user_settings SET user_config_dashboard_technical_enable = 0 WHERE user_id = $session_user_id");
}
//GET unique years from expenses, payments invoices and revenues
@@ -50,14 +54,14 @@ $sql_years_select = mysqli_query(
<?php if ($session_user_role == 1 || $session_user_role == 3 && $config_module_enable_accounting == 1) { ?>
<div class="custom-control custom-switch mr-sm-3 mb-3">
<input type="checkbox" onchange="this.form.submit()" class="custom-control-input" id="customSwitch1" name="show_financial" value="1" <?php if($show_financial == 1) { echo "checked"; } ?>>
<input type="checkbox" onchange="this.form.submit()" class="custom-control-input" id="customSwitch1" name="enable_financial" value="1" <?php if($user_config_dashboard_financial_enable == 1) { echo "checked"; } ?>>
<label class="custom-control-label" for="customSwitch1">Toggle Financial</label>
</div>
<?php } ?>
<?php if ($session_user_role >= 2 && $config_module_enable_ticketing == 1) { ?>
<div class="custom-control custom-switch mb-3">
<input type="checkbox" onchange="this.form.submit()" class="custom-control-input" id="customSwitch2" name="show_technical" value="1" <?php if($show_technical == 1) { echo "checked"; } ?>>
<input type="checkbox" onchange="this.form.submit()" class="custom-control-input" id="customSwitch2" name="enable_technical" value="1" <?php if($user_config_dashboard_technical_enable == 1) { echo "checked"; } ?>>
<label class="custom-control-label" for="customSwitch2">Toggle Technical</label>
</div>
<?php } ?>
@@ -66,7 +70,7 @@ $sql_years_select = mysqli_query(
<?php
if ($show_financial == 1) {
if ($user_config_dashboard_financial_enable == 1) {
// Enforce accountant / admin role for the financial dashboard
if ($_SESSION['user_role'] != 3 && $_SESSION['user_role'] != 1) {
@@ -528,7 +532,7 @@ $vendors_added = intval($row['vendors_added']);
<?php
if ($show_technical == 1) {
if ($user_config_dashboard_technical_enable == 1) {
// Get Total Clients added
$sql_clients = mysqli_fetch_assoc(mysqli_query(