diff --git a/endpoints/payments/get.php b/endpoints/payments/get.php
index fdd5f4e06..902c64559 100644
--- a/endpoints/payments/get.php
+++ b/endpoints/payments/get.php
@@ -39,7 +39,7 @@
= $payment['name'] ?>
31 && !$inUse) {
+ if (!$inUse) {
?>
x
diff --git a/endpoints/payments/rename.php b/endpoints/payments/rename.php
new file mode 100644
index 000000000..f7ba2507b
--- /dev/null
+++ b/endpoints/payments/rename.php
@@ -0,0 +1,41 @@
+ 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)
+ ]);
+}
+
+?>
\ No newline at end of file
diff --git a/includes/i18n/de.php b/includes/i18n/de.php
index 5cbabcfd9..82edb037b 100644
--- a/includes/i18n/de.php
+++ b/includes/i18n/de.php
@@ -136,12 +136,16 @@
"experimental_info" => "Experimentelle Einstellungen funktionieren möglicherweise nicht perfekt.",
"payment_methods" => "Zahlungsmethoden",
"payment_methods_info" => "Zahlungsmethode zum (de-)aktivieren anklicken.",
+ "rename_payment_methods_info" => "Klicken Sie auf den Namen einer Zahlungsmethode, um sie umzubenennen",
"cant_delete_payment_method_in_use" => "Genutzte Zahlungsmethoden können nicht deaktiviert werden",
"add_custom_payment" => "Eigene Zahlungsmethode hinzufügen",
"payment_method_name" => "Name der Zahlungsmethode",
"payment_method_added_successfuly" => "Zahlungsmethode erfolgreich hinzugefügt",
"disable" => "Deaktivieren",
"enable" => "Aktivieren",
+ "rename_payment_method" => "Zahlungsmethode umbenennen",
+ "payment_renamed" => "Zahlungsmethode umbenannt",
+ "payment_not_renamed" => "Zahlungsmethode konnte nicht umbenannt werden",
"test" => "Test",
"add" => "Hinzufügen",
"save" => "Speichern",
diff --git a/includes/i18n/el.php b/includes/i18n/el.php
index 52a8a1962..c4234c55f 100644
--- a/includes/i18n/el.php
+++ b/includes/i18n/el.php
@@ -136,12 +136,16 @@
"experimental_info" => "Οι πειραματικές ρυθμίσεις πιθανότατα δεν θα λειτουργούν τέλεια.",
"payment_methods" => "Τρόποι πληρωμής",
"payment_methods_info" => "Κάνε κλικ σε μια μέθοδο πληρωμής για να την απενεργοποιήσεις/ενεργοποιήσεις.",
+ "rename_payment_methods_info" => "Κάντε κλικ στο όνομα μιας μεθόδου πληρωμής για να τη μετονομάσετε.",
"cant_delete_payment_method_in_use" => "Δεν είναι εφικτό να απενεργοποιηθεί η χρησιμοποιούμενη μέθοδο πληρωμής",
"add_custom_payment" => "Προσθήκη προσαρμοσμένης μεθόδου πληρωμής",
"payment_method_name" => "Όνομα μεθόδου πληρωμής",
"payment_method_added_successfuly" => "Η μέθοδος πληρωμής προστέθηκε με επιτυχία",
"disable" => "Ανενεργό",
"enable" => "Ενεργό",
+ "rename_payment_method" => "Μετονομασία μεθόδου πληρωμής",
+ "payment_renamed" => "Η μέθοδος πληρωμής μετονομάστηκε",
+ "payment_not_renamed" => "Η μέθοδος πληρωμής δεν μετονομάστηκε",
"test" => "Δοκιμή",
"add" => "Προσθήκη",
"save" => "Αποθήκευση",
diff --git a/includes/i18n/en.php b/includes/i18n/en.php
index 5ff6a3c7f..cfcc650b8 100644
--- a/includes/i18n/en.php
+++ b/includes/i18n/en.php
@@ -136,12 +136,16 @@
"experimental_info" => "Experimental settings will probably not work perfectly.",
"payment_methods" => "Payment Methods",
"payment_methods_info" => "Click a payment method to disable / enable it.",
+ "rename_payment_methods_info" => "Click the name on a payment method to rename it.",
"cant_delete_payment_method_in_use" => "Can't disable used payment method",
"add_custom_payment" => "Add Custom Payment Method",
"payment_method_name" => "Payment Method Name",
"payment_method_added_successfuly" => "Payment method added successfully",
"disable" => "Disable",
"enable" => "Enable",
+ "rename_payment_method" => "Rename Payment Method",
+ "payment_renamed" => "Payment method renamed",
+ "payment_not_renamed" => "Payment method not renamed",
"test" => "Test",
"add" => "Add",
"save" => "Save",
diff --git a/includes/i18n/es.php b/includes/i18n/es.php
index 7ba4f279e..44ee4e23c 100644
--- a/includes/i18n/es.php
+++ b/includes/i18n/es.php
@@ -136,12 +136,16 @@
"experimental_info" => "Las configuraciones experimentales probablemente no funcionarán perfectamente.",
"payment_methods" => "Métodos de Pago",
"payment_methods_info" => "Haz clic en un método de pago para deshabilitarlo/habilitarlo.",
+ "rename_payment_methods_info" => "Haz clic en el nombre de un método de pago para cambiarle el nombre.",
"cant_delete_payment_method_in_use" => "No se puede desactivar el método de pago utilizado",
"add_custom_payment" => "Añadir método de pago personalizado",
"payment_method_name" => "Nombre del método de pago",
"payment_method_added_successfuly" => "Método de pago añadido con éxito",
"disable" => "Desactivar",
"enable" => "Activar",
+ "rename_payment_method" => "Renombrar método de pago",
+ "payment_renamed" => "Método de pago renombrado",
+ "payment_not_renamed" => "Error al renombrar el método de pago",
"test" => "Probar",
"add" => "Agregar",
"save" => "Guardar",
diff --git a/includes/i18n/fr.php b/includes/i18n/fr.php
index c57cbdb81..e53ba7f3f 100644
--- a/includes/i18n/fr.php
+++ b/includes/i18n/fr.php
@@ -136,12 +136,16 @@
"experimental_info" => "Les paramètres expérimentaux ne fonctionneront probablement pas parfaitement.",
"payment_methods" => "Méthodes de paiement",
"payment_methods_info" => "Cliquez sur une méthode de paiement pour la désactiver / l'activer.",
+ "rename_payment_methods_info" => "Cliquez sur le nom d'un mode de paiement pour le renommer.",
"cant_delete_payment_method_in_use" => "Impossible de désactiver la méthode de paiement utilisée",
"add_custom_payment" => "Ajouter un paiement personnalisé",
"payment_method_name" => "Nom de la méthode de paiement",
"payment_method_added_successfuly" => "Méthode de paiement ajoutée avec succès",
"disable" => "Désactiver",
"enable" => "Activer",
+ "rename_payment_method" => "Renommer la méthode de paiement",
+ "payment_renamed" => "Méthode de paiement renommée",
+ "payment_not_renamed" => "La méthode de paiement n'a pas été renommée",
"test" => "Test",
"add" => "Ajouter",
"save" => "Enregistrer",
diff --git a/includes/i18n/jp.php b/includes/i18n/jp.php
index ced80df59..ec3afd0d5 100644
--- a/includes/i18n/jp.php
+++ b/includes/i18n/jp.php
@@ -136,12 +136,16 @@
"experimental_info" => "実験的な設定は、おそらく完全には機能しません。",
"payment_methods" => "支払い方法",
"payment_methods_info" => "支払い方法をクリックして無効/有効を切り替えます。",
+ "rename_payment_methods_info" => "支払い方法の名前をクリックして、名前を変更します。",
"cant_delete_payment_method_in_use" => "支払い方法が使用中のため無効にできません。",
"add_custom_payment" => "カスタム支払い方法を追加",
"payment_method_name" => "支払い方法名",
"payment_method_added_successfuly" => "支払い方法が追加されました",
"disable" => "無効",
"enable" => "有効",
+ "rename_payment_method" => "支払い方法の名前を変更",
+ "payment_renamed" => "支払い方法が変更されました",
+ "payment_not_renamed" => "支払い方法が変更されませんでした",
"test" => "テスト",
"add" => "追加",
"save" => "保存",
diff --git a/includes/i18n/pt.php b/includes/i18n/pt.php
index 867c215eb..3f5f5840a 100644
--- a/includes/i18n/pt.php
+++ b/includes/i18n/pt.php
@@ -136,12 +136,16 @@
"experimental_info" => "Definições experimentais provavelmente não funcionarão correctamente.",
"payment_methods" => "Métodos de Pagamento",
"payment_methods_info" => "Clique num método de pagamento para o activar / desactivar.",
+ "rename_payment_methods_info" => "Clique no nome do método de pagamento para o renomear.",
"cant_delete_payment_method_in_use" => "Não pode desactivar metodo de pagamento em uso",
"add_custom_payment" => "Adicionar método de pagamento personalizado",
"payment_method_name" => "Nome do método de pagamento",
"payment_method_added_successfuly" => "Método de pagamento adicionado com sucesso",
"disable" => "Desactivar",
"enable" => "Activar",
+ "rename_payment_method" => "Renomear método de pagamento",
+ "payment_renamed" => "Método de pagamento renomeado",
+ "payment_not_renamed" => "Método de pagamento não renomeado",
"test" => "Testar",
"add" => "Adicionar",
"save" => "Guardar",
diff --git a/includes/i18n/tr.php b/includes/i18n/tr.php
index da49bc9f3..8d05ede92 100644
--- a/includes/i18n/tr.php
+++ b/includes/i18n/tr.php
@@ -136,12 +136,16 @@
"experimental_info" => "Deneysel ayarlar muhtemelen mükemmel çalışmayacak.",
"payment_methods" => "Ödeme Yöntemleri",
"payment_methods_info" => "Bir ödeme yöntemini devre dışı bırakmak / etkinleştirmek için tıklayın.",
+ "rename_payment_methods_info" => "Yeniden adlandırmak için bir ödeme yönteminin adına tıklayın.",
"cant_delete_payment_method_in_use" => "Kullanımda olan ödeme yöntemini devre dışı bırakamazsınız",
"add_custom_payment" => "Özel ödeme yöntemi ekle",
"payment_method_name" => "Ödeme Yöntemi Adı",
"payment_method_added_successfuly" => "Ödeme yöntemi başarıyla eklendi",
"disable" => "Devre Dışı Bırak",
"enable" => "Etkinleştir",
+ "rename_payment_method" => "Ödeme yöntemi adını değiştir",
+ "payment_renamed" => "Ödeme yöntemi adı değiştirildi",
+ "payment_not_renamed" => "Ödeme yöntemi adı değiştirilemedi",
"test" => "Test Et",
"add" => "Ekle",
"save" => "Kaydet",
diff --git a/includes/i18n/zh_cn.php b/includes/i18n/zh_cn.php
index 9571c3b43..405125cb5 100644
--- a/includes/i18n/zh_cn.php
+++ b/includes/i18n/zh_cn.php
@@ -143,12 +143,16 @@
"experimental_info" => "实验性设置,可能存在问题。",
"payment_methods" => "支付方式",
"payment_methods_info" => "点击支付方式以禁用/启用。",
+ "rename_payment_methods_info" => "点击付款方式名称,重新命名该付款方式。"
"cant_delete_payment_method_in_use" => "不能禁用正在使用的支付方式",
"add_custom_payment" => "添加自定义支付方式",
"payment_method_name" => "支付方式名称",
"payment_method_added_successfuly" => "支付方式已成功添加",
"disable" => "禁用",
"enable" => "启用",
+ "rename_payment_method" => "重命名支付方式",
+ "payment_renamed" => "支付方式已重命名",
+ "payment_not_renamed" => "支付方式未重命名",
"test" => "测试",
"add" => "添加",
"save" => "保存",
diff --git a/includes/i18n/zh_tw.php b/includes/i18n/zh_tw.php
index dae79a874..6838f4b93 100644
--- a/includes/i18n/zh_tw.php
+++ b/includes/i18n/zh_tw.php
@@ -136,12 +136,16 @@
"experimental_info" => "實驗性設定,可能存在問題。",
"payment_methods" => "付款方式",
"payment_methods_info" => "點選付款方式以停用/啟用。",
+ "rename_payment_methods_info" => "點選付款方式的名稱可對其進行重新命名。",
"cant_delete_payment_method_in_use" => "無法停用正在使用的付款方式",
"add_custom_payment" => "新增自訂付款方式",
"payment_method_name" => "付款方式名稱",
"payment_method_added_successfuly" => "付款方式已成功新增",
"disable" => "停用",
"enable" => "啟用",
+ "rename_payment_method" => "更改付款方式名稱",
+ "payment_renamed" => "付款方式名稱已更改",
+ "payment_not_renamed" => "付款方式名稱未更改",
"test" => "測試",
"add" => "新增",
"save" => "儲存",
diff --git a/scripts/settings.js b/scripts/settings.js
index 34a4a1c54..e6a50cbf2 100644
--- a/scripts/settings.js
+++ b/scripts/settings.js
@@ -429,7 +429,7 @@ function togglePayment(paymentId) {
const element = document.querySelector(`div[data-paymentid="${paymentId}"]`);
if (element.dataset.inUse === 'yes') {
- return showErrorMessage(translate(cant_disable_payment_in_use));
+ return showErrorMessage(translate('cant_disable_payment_in_use'));
}
const newEnabledState = element.dataset.enabled === '1' ? '0' : '1';
@@ -454,6 +454,69 @@ function togglePayment(paymentId) {
});
}
+document.body.addEventListener('click', function(e) {
+ let targetElement = e.target;
+ do {
+ if (targetElement.classList && targetElement.classList.contains('payments-payment')) {
+ let targetChild = e.target;
+ do {
+ if (targetChild.classList && targetChild.classList.contains('payment-name')) {
+ return;
+ }
+ targetChild = targetChild.parentNode;
+ } while (targetChild && targetChild !== targetElement);
+
+ const paymentId = targetElement.dataset.paymentid;
+ togglePayment(paymentId);
+ return;
+ }
+ targetElement = targetElement.parentNode;
+ } while (targetElement);
+});
+
+document.body.addEventListener('blur', function(e) {
+ let targetElement = e.target;
+ if (targetElement.classList && targetElement.classList.contains('payment-name')) {
+ const paymentId = targetElement.closest('.payments-payment').dataset.paymentid;
+ const newName = targetElement.textContent;
+ renamePayment(paymentId, newName);
+ }
+}, true);
+
+function renamePayment(paymentId, newName) {
+ const name = newName.trim();
+ const formData = new FormData();
+ formData.append('paymentId', paymentId);
+ formData.append('name', name);
+ fetch('endpoints/payments/rename.php', {
+ method: 'POST',
+ body: formData
+ }).then(response => {
+ if (!response.ok) {
+ throw new Error(translate('network_response_error'));
+ }
+ return response.json();
+ }).then(data => {
+ if (data.success) {
+ showSuccessMessage(`${newName} ${data.message}`);
+ } else {
+ showErrorMessage(data.message);
+ }
+ }).catch(error => {
+ showErrorMessage(translate('unknown_error'));
+ });
+}
+
+document.body.addEventListener('keypress', function(e) {
+ let targetElement = e.target;
+ if (targetElement.classList && targetElement.classList.contains('payment-name')) {
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ targetElement.blur();
+ }
+ }
+});
+
function handleFileSelect(event) {
const fileInput = event.target;
const iconPreview = document.querySelector('.icon-preview');
diff --git a/settings.php b/settings.php
index bfc184f92..b96e9d624 100644
--- a/settings.php
+++ b/settings.php
@@ -492,21 +492,18 @@
}
foreach ($payments as $payment) {
- $paymentIconFolder = $payment['id'] <= 31 ? 'images/uploads/icons/' : 'images/uploads/logos/';
+ $paymentIconFolder = $payment['id'] <= ? 'images/uploads/icons/' : 'images/uploads/logos/';
$inUse = in_array($payment['id'], $paymentsInUse);
?>
+ title="= $inUse ? translate('cant_delete_payment_method_in_use', $i18n) : ($payment['enabled'] ? translate('disable', $i18n) : translate('enable', $i18n)) ?>">
-
- = $payment['name'] ?>
-
+
">= $payment['name'] ?>
31 && !$inUse) {
+ if (!$inUse) {
?>
x
= translate('payment_methods_info', $i18n) ?>
+
+
+ = translate('rename_payment_methods_info', $i18n) ?>
+
diff --git a/styles/dark-theme.css b/styles/dark-theme.css
index 1b1be61f5..ec8abbeb4 100644
--- a/styles/dark-theme.css
+++ b/styles/dark-theme.css
@@ -20,6 +20,7 @@ header .logo .logo-image {
.account-section,
.avatar-select,
.logo-search,
+.icon-search,
.dropdown-content,
.sort-options,
.statistic,
diff --git a/styles/styles.css b/styles/styles.css
index f2e9d8d7e..ab20ebb92 100644
--- a/styles/styles.css
+++ b/styles/styles.css
@@ -617,6 +617,10 @@ main > .contain {
object-fit: contain;
}
+.payments-list .payments-payment > .payment-name {
+ cursor: text;
+}
+
.payments-list .payments-payment .delete-payment-method {
padding: 5px;
font-weight: bold;
@@ -841,7 +845,7 @@ input[type="checkbox"] {
}
.icon-search {
- width: 100px;
+ width: 112px;
height: 224px;
top: 50px;
right: 0px;