feat: allow sorting of categories in settings
feat: add filters to statistics page feat: allow renaming / translation of payment methods feat: allow deletion of the default payment methods
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
require_once '../../includes/connect_endpoint.php';
|
||||
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
|
||||
$categories = $_POST['categoryIds'];
|
||||
$order = 2;
|
||||
|
||||
foreach ($categories as $categoryId) {
|
||||
$sql = "UPDATE categories SET `order` = :order WHERE id = :categoryId";
|
||||
$stmt = $db->prepare($sql);
|
||||
$stmt->bindParam(':order', $order, SQLITE3_INTEGER);
|
||||
$stmt->bindParam(':categoryId', $categoryId, SQLITE3_INTEGER);
|
||||
$result = $stmt->execute();
|
||||
$order++;
|
||||
}
|
||||
|
||||
$response = [
|
||||
"success" => true,
|
||||
"message" => translate("sort_order_saved", $i18n)
|
||||
];
|
||||
echo json_encode($response);
|
||||
} else {
|
||||
$response = [
|
||||
"success" => false,
|
||||
"errorMessage" => translate("session_expired", $i18n)
|
||||
];
|
||||
echo json_encode($response);
|
||||
die();
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -39,7 +39,7 @@ if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
|
||||
<?= $payment['name'] ?>
|
||||
</span>
|
||||
<?php
|
||||
if ($payment['id'] > 31 && !$inUse) {
|
||||
if (!$inUse) {
|
||||
?>
|
||||
<div class="delete-payment-method" title="<?= translate('delete', $i18n) ?>" data-paymentid="<?= $payment['id'] ?>" onclick="deletePaymentMethod(<?= $payment['id'] ?>)">
|
||||
x
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
require_once '../../includes/connect_endpoint.php';
|
||||
session_start();
|
||||
|
||||
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
|
||||
die(json_encode([
|
||||
"success" => false,
|
||||
"message" => translate('session_expired', $i18n)
|
||||
]));
|
||||
}
|
||||
|
||||
if (!isset($_POST['paymentId']) || !isset($_POST['name']) || $_POST['paymentId'] === '' || $_POST['name'] === '') {
|
||||
die(json_encode([
|
||||
"success" => false,
|
||||
"message" => translate('fields_missing', $i18n)
|
||||
]));
|
||||
}
|
||||
|
||||
$paymentId = $_POST['paymentId'];
|
||||
$name = $_POST['name'];
|
||||
|
||||
$sql = "UPDATE payment_methods SET name = :name WHERE id = :paymentId";
|
||||
$stmt = $db->prepare($sql);
|
||||
$stmt->bindParam(':name', $name, SQLITE3_TEXT);
|
||||
$stmt->bindParam(':paymentId', $paymentId, SQLITE3_INTEGER);
|
||||
$result = $stmt->execute();
|
||||
|
||||
if ($result) {
|
||||
echo json_encode([
|
||||
"success" => true,
|
||||
"message" => translate('payment_renamed', $i18n)
|
||||
]);
|
||||
} else {
|
||||
echo json_encode([
|
||||
"success" => false,
|
||||
"message" => translate('payment_not_renamed', $i18n)
|
||||
]);
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user