feat: allow to disable subscriptions (#144)
This commit is contained in:
parent
91e53a48e4
commit
50056d9f03
@ -33,7 +33,7 @@ $i18n = [
|
|||||||
'last_added' => "Zuletzt hinzugefügt",
|
'last_added' => "Zuletzt hinzugefügt",
|
||||||
'price' => "Preis",
|
'price' => "Preis",
|
||||||
'next_payment' => "Nächste Zahlung",
|
'next_payment' => "Nächste Zahlung",
|
||||||
'inactive' => "Deaktiviertes Abonnement",
|
'inactive' => "Abonnement deaktivieren",
|
||||||
'member' => "Mitglied",
|
'member' => "Mitglied",
|
||||||
'category' => "Kategorie",
|
'category' => "Kategorie",
|
||||||
'payment_method' => "Zahlungsmethode",
|
'payment_method' => "Zahlungsmethode",
|
||||||
|
|||||||
@ -33,7 +33,7 @@ $i18n = [
|
|||||||
'last_added' => "Τελευταία προσθήκη",
|
'last_added' => "Τελευταία προσθήκη",
|
||||||
'price' => "Τιμή",
|
'price' => "Τιμή",
|
||||||
'next_payment' => "Επόμενη πληρωμή",
|
'next_payment' => "Επόμενη πληρωμή",
|
||||||
'inactive' => "Ανενεργή συνδρομή",
|
'inactive' => "Απενεργοποίηση συνδρομής",
|
||||||
'member' => "Χρήστης",
|
'member' => "Χρήστης",
|
||||||
'category' => "Κατηγορία",
|
'category' => "Κατηγορία",
|
||||||
'payment_method' => "Τρόπος πληρωμής",
|
'payment_method' => "Τρόπος πληρωμής",
|
||||||
|
|||||||
@ -33,7 +33,7 @@ $i18n = [
|
|||||||
'last_added' => "Last Added",
|
'last_added' => "Last Added",
|
||||||
'price' => "Price",
|
'price' => "Price",
|
||||||
'next_payment' => "Next Payment",
|
'next_payment' => "Next Payment",
|
||||||
'inactive' => "Disabled Subscription",
|
'inactive' => "Disable Subscription",
|
||||||
'member' => "Member",
|
'member' => "Member",
|
||||||
'category' => "Category",
|
'category' => "Category",
|
||||||
'payment_method' => "Payment Method",
|
'payment_method' => "Payment Method",
|
||||||
|
|||||||
@ -33,7 +33,7 @@ $i18n = [
|
|||||||
'last_added' => "Última Añadida",
|
'last_added' => "Última Añadida",
|
||||||
'price' => "Precio",
|
'price' => "Precio",
|
||||||
'next_payment' => "Próximo Pago",
|
'next_payment' => "Próximo Pago",
|
||||||
'inactive' => "Suscripción desactivada",
|
'inactive' => "Desactivar Suscripción",
|
||||||
'member' => "Miembro",
|
'member' => "Miembro",
|
||||||
'category' => "Categoría",
|
'category' => "Categoría",
|
||||||
'payment_method' => "Método de Pago",
|
'payment_method' => "Método de Pago",
|
||||||
|
|||||||
@ -33,7 +33,7 @@ $i18n = [
|
|||||||
'last_added' => "Dernier ajouté",
|
'last_added' => "Dernier ajouté",
|
||||||
'price' => "Prix",
|
'price' => "Prix",
|
||||||
'next_payment' => "Prochain paiement",
|
'next_payment' => "Prochain paiement",
|
||||||
'inactive' => "Abonnement désactivé",
|
'inactive' => "Désactiver l'abonnement",
|
||||||
'member' => "Membre",
|
'member' => "Membre",
|
||||||
'category' => "Catégorie",
|
'category' => "Catégorie",
|
||||||
'payment_method' => "Méthode de paiement",
|
'payment_method' => "Méthode de paiement",
|
||||||
|
|||||||
@ -33,7 +33,7 @@ $i18n = [
|
|||||||
'last_added' => "最終追加日",
|
'last_added' => "最終追加日",
|
||||||
'price' => "金額",
|
'price' => "金額",
|
||||||
'next_payment' => "次回支払い",
|
'next_payment' => "次回支払い",
|
||||||
'inactive' => "無効なサブスクリプション",
|
'inactive' => "サブスクリプションを無効にする",
|
||||||
'member' => "メンバー",
|
'member' => "メンバー",
|
||||||
'category' => "カテゴリ",
|
'category' => "カテゴリ",
|
||||||
'payment_method' => "支払い方法",
|
'payment_method' => "支払い方法",
|
||||||
|
|||||||
@ -33,7 +33,7 @@ $i18n = [
|
|||||||
'last_added' => "Última Adicionada",
|
'last_added' => "Última Adicionada",
|
||||||
'price' => "Preço",
|
'price' => "Preço",
|
||||||
'next_payment' => "Próximo Pagamento",
|
'next_payment' => "Próximo Pagamento",
|
||||||
'inactive' => "Subscrição desactivada",
|
'inactive' => "Desactivar Subscrição",
|
||||||
'member' => "Membro",
|
'member' => "Membro",
|
||||||
'category' => "Categoria",
|
'category' => "Categoria",
|
||||||
'payment_method' => "Metodo de Pagamento",
|
'payment_method' => "Metodo de Pagamento",
|
||||||
|
|||||||
@ -33,6 +33,7 @@ $i18n = [
|
|||||||
'last_added' => "Son Eklenen",
|
'last_added' => "Son Eklenen",
|
||||||
'price' => "Fiyat",
|
'price' => "Fiyat",
|
||||||
'next_payment' => "Sonraki Ödeme",
|
'next_payment' => "Sonraki Ödeme",
|
||||||
|
'inactive' => "Aboneliği Devre Dışı Bırak",
|
||||||
'member' => "Üye",
|
'member' => "Üye",
|
||||||
'category' => "Kategori",
|
'category' => "Kategori",
|
||||||
'payment_method' => "Ödeme Yöntemi",
|
'payment_method' => "Ödeme Yöntemi",
|
||||||
@ -70,6 +71,7 @@ $i18n = [
|
|||||||
// Statistics page
|
// Statistics page
|
||||||
'general_statistics' => "Genel İstatistikler",
|
'general_statistics' => "Genel İstatistikler",
|
||||||
'active_subscriptions' => "Aktif Abonelikler",
|
'active_subscriptions' => "Aktif Abonelikler",
|
||||||
|
'inactive_subscriptions' => "Aktif Olmayan Abonelikler",
|
||||||
'monthly_cost' => "Aylık Maliyet",
|
'monthly_cost' => "Aylık Maliyet",
|
||||||
'yearly_cost' => "Yıllık Maliyet",
|
'yearly_cost' => "Yıllık Maliyet",
|
||||||
'average_monthly' => "Ortalama Aylık Abonelik Maliyeti",
|
'average_monthly' => "Ortalama Aylık Abonelik Maliyeti",
|
||||||
|
|||||||
@ -36,7 +36,7 @@ $i18n = [
|
|||||||
'last_added' => "创建时间",
|
'last_added' => "创建时间",
|
||||||
'price' => "价格",
|
'price' => "价格",
|
||||||
'next_payment' => "下次支付时间",
|
'next_payment' => "下次支付时间",
|
||||||
'inactive' => "禁用订阅",
|
'inactive' => "停用订阅",
|
||||||
'member' => "成员",
|
'member' => "成员",
|
||||||
'category' => "分类",
|
'category' => "分类",
|
||||||
'payment_method' => "支付方式",
|
'payment_method' => "支付方式",
|
||||||
|
|||||||
@ -36,6 +36,7 @@ $i18n = [
|
|||||||
'last_added' => "建立時間",
|
'last_added' => "建立時間",
|
||||||
'price' => "價格",
|
'price' => "價格",
|
||||||
'next_payment' => "下次付款時間",
|
'next_payment' => "下次付款時間",
|
||||||
|
'inactive' => "停用訂閱",
|
||||||
'member' => "成員",
|
'member' => "成員",
|
||||||
'category' => "分類",
|
'category' => "分類",
|
||||||
'payment_method' => "付款方式",
|
'payment_method' => "付款方式",
|
||||||
@ -75,6 +76,7 @@ $i18n = [
|
|||||||
// 統計頁面
|
// 統計頁面
|
||||||
'general_statistics' => "整體統計",
|
'general_statistics' => "整體統計",
|
||||||
'active_subscriptions' => "訂閱中",
|
'active_subscriptions' => "訂閱中",
|
||||||
|
'inactive_subscriptions' => "停用訂閱",
|
||||||
'monthly_cost' => "每月費用",
|
'monthly_cost' => "每月費用",
|
||||||
'yearly_cost' => "每年費用",
|
'yearly_cost' => "每年費用",
|
||||||
'average_monthly' => "平均每月訂閱費用",
|
'average_monthly' => "平均每月訂閱費用",
|
||||||
|
|||||||
@ -63,13 +63,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($subscriptions, function ($a, $b) {
|
|
||||||
if ($a['inactive'] == $b['inactive']) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return $a['inactive'] ? 1 : -1;
|
|
||||||
});
|
|
||||||
|
|
||||||
$currentCategory = 0;
|
$currentCategory = 0;
|
||||||
$currentPayerUserId = 0;
|
$currentPayerUserId = 0;
|
||||||
$currentPaymentMethodId = 0;
|
$currentPaymentMethodId = 0;
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
$version = "v1.4.1";
|
$version = "v1.5.0";
|
||||||
?>
|
?>
|
||||||
10
index.php
10
index.php
@ -195,11 +195,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group-inline">
|
|
||||||
<input type="checkbox" id="inactive" name="inactive">
|
|
||||||
<label for="inactive"><?= translate('inactive', $i18n) ?></label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="payment_method"><?= translate('payment_method', $i18n) ?></label>
|
<label for="payment_method"><?= translate('payment_method', $i18n) ?></label>
|
||||||
<select id="payment_method" name="payment_method_id">
|
<select id="payment_method" name="payment_method_id">
|
||||||
@ -252,6 +247,11 @@
|
|||||||
<input type="text" id="notes" name="notes" placeholder="<?= translate('notes', $i18n) ?>">
|
<input type="text" id="notes" name="notes" placeholder="<?= translate('notes', $i18n) ?>">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group-inline">
|
||||||
|
<input type="checkbox" id="inactive" name="inactive">
|
||||||
|
<label for="inactive"><?= translate('inactive', $i18n) ?></label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($notificationsEnabled) {
|
if ($notificationsEnabled) {
|
||||||
?>
|
?>
|
||||||
|
|||||||
19
stats.php
19
stats.php
@ -90,14 +90,6 @@ $result = $stmt->execute();
|
|||||||
$row = $result->fetchArray(SQLITE3_ASSOC);
|
$row = $result->fetchArray(SQLITE3_ASSOC);
|
||||||
$activeSubscriptions = $row['active_subscriptions'];
|
$activeSubscriptions = $row['active_subscriptions'];
|
||||||
|
|
||||||
// Calculate inactive subscriptions
|
|
||||||
$query = "SELECT COUNT(*) AS inactive_subscriptions FROM subscriptions WHERE inactive = 1";
|
|
||||||
$stmt = $db->prepare($query);
|
|
||||||
$stmt->bindParam(':inactive', $inactive, SQLITE3_INTEGER);
|
|
||||||
$result = $stmt->execute();
|
|
||||||
$row = $result->fetchArray(SQLITE3_ASSOC);
|
|
||||||
$inactiveSubscriptions = $row['inactive_subscriptions'];
|
|
||||||
|
|
||||||
// Calculate total monthly price
|
// Calculate total monthly price
|
||||||
$mostExpensiveSubscription = 0;
|
$mostExpensiveSubscription = 0;
|
||||||
$amountDueThisMonth = 0;
|
$amountDueThisMonth = 0;
|
||||||
@ -163,6 +155,7 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$numberOfElements = 6;
|
||||||
?>
|
?>
|
||||||
<section class="contain">
|
<section class="contain">
|
||||||
<h2><?= translate('general_statistics', $i18n) ?></h2>
|
<h2><?= translate('general_statistics', $i18n) ?></h2>
|
||||||
@ -171,15 +164,6 @@ if ($result) {
|
|||||||
<span><?= $activeSubscriptions ?></span>
|
<span><?= $activeSubscriptions ?></span>
|
||||||
<div class="title"><?= translate('active_subscriptions', $i18n) ?></div>
|
<div class="title"><?= translate('active_subscriptions', $i18n) ?></div>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($inactiveSubscriptions > 0) {
|
|
||||||
?>
|
|
||||||
<div class="statistic">
|
|
||||||
<span><?= $inactiveSubscriptions ?></span>
|
|
||||||
<div class="title"><?= translate('inactive_subscriptions', $i18n) ?></div>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<div class="statistic">
|
<div class="statistic">
|
||||||
<span><?= CurrencyFormatter::format($totalCostPerMonth, $code) ?></span>
|
<span><?= CurrencyFormatter::format($totalCostPerMonth, $code) ?></span>
|
||||||
<div class="title"><?= translate('monthly_cost', $i18n) ?></div>
|
<div class="title"><?= translate('monthly_cost', $i18n) ?></div>
|
||||||
@ -201,7 +185,6 @@ if ($result) {
|
|||||||
<div class="title"><?= translate('amount_due', $i18n) ?></div>
|
<div class="title"><?= translate('amount_due', $i18n) ?></div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
$numberOfElements = 6;
|
|
||||||
if (($numberOfElements + 1) % 3 == 0) {
|
if (($numberOfElements + 1) % 3 == 0) {
|
||||||
?>
|
?>
|
||||||
<div class="statistic empty"></div>
|
<div class="statistic empty"></div>
|
||||||
|
|||||||
@ -202,10 +202,11 @@ main > .contain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.subscription.inactive {
|
.subscription.inactive {
|
||||||
color: #808080;
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subscription.inactive span.price {
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
font-style: italic;
|
|
||||||
background-color: #F8F8FF;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.subscription-main {
|
.subscription-main {
|
||||||
@ -955,6 +956,7 @@ input[type="checkbox"] {
|
|||||||
display: none;
|
display: none;
|
||||||
width: 144px;
|
width: 144px;
|
||||||
width: max-content;
|
width: max-content;
|
||||||
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 380px) {
|
@media (max-width: 380px) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user