Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Household fix #165

Merged
merged 5 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/version.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php
$version = "v1.9.0";
$version = "v1.9.1";
?>
22 changes: 11 additions & 11 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@
</div>
</div>

<?php
if ($notificationsEnabled) {
?>
<div class="form-group-inline">
<input type="checkbox" id="notifications" name="notifications">
<label for="notifications"><?= translate('enable_notifications', $i18n) ?></label>
</div>
<?php
}
?>

<div class="form-group">
<label for="payment_method"><?= translate('payment_method', $i18n) ?></label>
<select id="payment_method" name="payment_method_id">
Expand Down Expand Up @@ -252,17 +263,6 @@
<label for="inactive"><?= translate('inactive', $i18n) ?></label>
</div>

<?php
if ($notificationsEnabled) {
?>
<div class="form-group-inline">
<input type="checkbox" id="notifications" name="notifications">
<label for="notifications"><?= translate('enable_notifications', $i18n) ?></label>
</div>
<?php
}
?>

<div class="buttons">
<input type="button" value="<?= translate('delete', $i18n) ?>" class="warning-button left" id="deletesub" style="display: none">
<input type="button" value="<?= translate('cancel', $i18n) ?>" class="secondary-button" onClick="closeAddSubscription()">
Expand Down
1 change: 1 addition & 0 deletions scripts/i18n/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let i18n = {
network_response_error: "Netzwerkfehler",
failed_add_member: "Hinzufügen von Mitglied fehlgeschlagen",
member: "Mitglied",
email: "E-Mail",
save_member: "Mitglied speichern",
delete_member: "Mitglied löschen",
failed_remove_member: "Mitglied konnte nicht gelöscht werden",
Expand Down
1 change: 1 addition & 0 deletions scripts/i18n/el.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let i18n = {
network_response_error: "Η ανταπόκριση του δικτύου δεν ήταν εντάξει",
failed_add_member: "Αποτυχία προσθήκης μέλους",
member: "Μέλος",
email: "Email",
save_member: "Αποθήκευση μέλους",
delete_member: "Διαγραφή μέλους",
failed_remove_member: "Αποτυχία διαγραφής μέλους",
Expand Down
1 change: 1 addition & 0 deletions scripts/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let i18n = {
network_response_error: "Network response was not ok",
failed_add_member: "Failed to add member",
member: "Member",
email: "Email",
save_member: "Save member",
delete_member: "Delete member",
failed_remove_member: "Failed to remove member",
Expand Down
1 change: 1 addition & 0 deletions scripts/i18n/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let i18n = {
network_response_error: "Error en la respuesta de la red",
failed_add_member: "Error al añadir miembro",
member: "Miembro",
email: "Correo electrónico",
save_member: "Guardar miembro",
delete_member: "Eliminar miembro",
failed_remove_member: "Error al eliminar miembro",
Expand Down
1 change: 1 addition & 0 deletions scripts/i18n/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let i18n = {
network_response_error: "La réponse du réseau n'était pas correcte",
failed_add_member: "Échec de l'ajout du membre",
member: "Membre",
email: "Courriel",
save_member: "Enregistrer le membre",
delete_member: "Supprimer le membre",
failed_remove_member: "Échec de la suppression du membre",
Expand Down
1 change: 1 addition & 0 deletions scripts/i18n/jp.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let i18n = {
network_response_error: "ネットワークの応答異常",
failed_add_member: "世帯員の追加に失敗",
member: "世帯員",
email: "メール",
save_member: "世帯員の保存",
delete_member: "世帯員の削除",
failed_remove_member: "世帯員の削除に失敗",
Expand Down
1 change: 1 addition & 0 deletions scripts/i18n/pt.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let i18n = {
'network_response_error': 'Erro de resposta de rede',
'failed_add_member': 'Falha ao adicionar membro',
'member': 'Membro',
'email': 'Email',
'save_member': 'Guardar membro',
'delete_member': 'Remover membro',
'failed_remove_member': 'Erro ao remover membro',
Expand Down
1 change: 1 addition & 0 deletions scripts/i18n/tr.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let i18n = {
network_response_error: "Ağ yanıtı kabul edilmedi",
failed_add_member: "Üye eklenemedi",
member: "Üye",
email: "E-posta",
save_member: "Üyeyi Kaydet",
delete_member: "Üyeyi Sil",
failed_remove_member: "Üye silinmedi",
Expand Down
1 change: 1 addition & 0 deletions scripts/i18n/zh_cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let i18n = {
'network_response_error': "网络响应不正常",
'failed_add_member': '添加成员失败',
'member': '成员',
'email': '电子邮箱',
'save_member': '保存成员',
'delete_member': '删除成员',
'failed_remove_member': '移除成员失败',
Expand Down
1 change: 1 addition & 0 deletions scripts/i18n/zh_tw.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let i18n = {
'network_response_error': "網路無回應",
'failed_add_member': '新增成員失敗',
'member': '成員',
'email': '電子信箱',
'save_member': '保存成員',
'delete_member': '刪除成員',
'failed_remove_member': '移除成員失敗',
Expand Down
7 changes: 7 additions & 0 deletions scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ function addMemberButton(memberId) {
input.name = "member";
input.value = translate('member');

let emailInput = document.createElement("input");
emailInput.type = "text";
emailInput.placeholder = translate('email');
emailInput.name = "email";
emailInput.value = "";

let editLink = document.createElement("button");
editLink.className = "image-button medium"
editLink.name = "save";
Expand Down Expand Up @@ -70,6 +76,7 @@ function addMemberButton(memberId) {
deleteLink.appendChild(deleteImage);

div.appendChild(input);
div.appendChild(emailInput);
div.appendChild(editLink);
div.appendChild(deleteLink);

Expand Down
102 changes: 51 additions & 51 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,18 +298,6 @@
</div>
</section>

<?php
$sql = "SELECT * FROM payment_methods";
$result = $db->query($sql);

if ($result) {
$payments = array();
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
$payments[] = $row;
}
}
?>

<?php
$sql = "SELECT * FROM currencies";
$result = $db->query($sql);
Expand Down Expand Up @@ -470,7 +458,57 @@
<input type="submit" value="<?= translate('save', $i18n) ?>" id="addFixerKey" onClick="addFixerKeyButton()"/>
</div>
</div>
</section>
</section>

<?php
$sql = "SELECT * FROM payment_methods";
$result = $db->query($sql);

if ($result) {
$payments = array();
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
$payments[] = $row;
}
}
?>

<section class="account-section">
<header>
<h2><?= translate('payment_methods', $i18n) ?></h2>
</header>
<div class="payments-list">
<?php
$paymentsInUseQuery = $db->query('SELECT id FROM payment_methods WHERE id IN (SELECT DISTINCT payment_method_id FROM subscriptions)');
$paymentsInUse = [];
while ($row = $paymentsInUseQuery->fetchArray(SQLITE3_ASSOC)) {
$paymentsInUse[] = $row['id'];
}

foreach ($payments as $payment) {
$inUse = in_array($payment['id'], $paymentsInUse);
?>
<div class="payments-payment"
data-enabled="<?= $payment['enabled']; ?>"
data-in-use="<?= $inUse ? 'yes' : 'no' ?>"
data-paymentid="<?= $payment['id'] ?>"
title="<?= $inUse ? translate('cant_delete_payment_method_in_use', $i18n) : ($payment['enabled'] ? translate('disable', $i18n) : translate('enable', $i18n)) ?>"
onClick="togglePayment(<?= $payment['id'] ?>)">
<img src="images/uploads/icons/<?= $payment['icon'] ?>" alt="Logo" />
<span class="payment-name">
<?= $payment['name'] ?>
</span>
</div>
<?php
}
?>
</div>
<div class="settings-notes">
<p>
<i class="fa-solid fa-circle-info"></i>
<?= translate('payment_methods_info', $i18n) ?>
</p>
</div>
</section>

<section class="account-section">
<header>
Expand Down Expand Up @@ -513,44 +551,6 @@
<?= translate('experimental_info', $i18n) ?>
</p>
</div>
</section>

<section class="account-section">
<header>
<h2><?= translate('payment_methods', $i18n) ?></h2>
</header>
<div class="payments-list">
<?php
$paymentsInUseQuery = $db->query('SELECT id FROM payment_methods WHERE id IN (SELECT DISTINCT payment_method_id FROM subscriptions)');
$paymentsInUse = [];
while ($row = $paymentsInUseQuery->fetchArray(SQLITE3_ASSOC)) {
$paymentsInUse[] = $row['id'];
}

foreach ($payments as $payment) {
$inUse = in_array($payment['id'], $paymentsInUse);
?>
<div class="payments-payment"
data-enabled="<?= $payment['enabled']; ?>"
data-in-use="<?= $inUse ? 'yes' : 'no' ?>"
data-paymentid="<?= $payment['id'] ?>"
title="<?= $inUse ? translate('cant_delete_payment_method_in_use', $i18n) : ($payment['enabled'] ? translate('disable', $i18n) : translate('enable', $i18n)) ?>"
onClick="togglePayment(<?= $payment['id'] ?>)">
<img src="images/uploads/icons/<?= $payment['icon'] ?>" alt="Logo" />
<span class="payment-name">
<?= $payment['name'] ?>
</span>
</div>
<?php
}
?>
</div>
<div class="settings-notes">
<p>
<i class="fa-solid fa-circle-info"></i>
<?= translate('payment_methods_info', $i18n) ?>
</p>
</div>
</section>

<section class="account-section">
Expand Down