diff --git a/.gitignore b/.gitignore index 9143a9f13..e8272de2f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ .DS_Store .idea/ .vscode/ +/logos/* +docker-compose.dev.yaml diff --git a/includes/i18n/ca.php b/includes/i18n/ca.php old mode 100644 new mode 100755 index 2bb480352..c9cba5384 --- a/includes/i18n/ca.php +++ b/includes/i18n/ca.php @@ -35,6 +35,7 @@ "profile" => "Perfil", "dashboard" => "Taulell", "subscriptions" => "Subscripcions", + "subscriptions_count" => "{count} Subscripcions", "stats" => "Estadístiques", "settings" => "Configuració", "admin" => "Admin", diff --git a/includes/i18n/cs.php b/includes/i18n/cs.php old mode 100644 new mode 100755 index 13d276329..c65786117 --- a/includes/i18n/cs.php +++ b/includes/i18n/cs.php @@ -35,6 +35,7 @@ "profile" => "Profil", "dashboard" => "Přehled", "subscriptions" => "Předplatná", + "subscriptions_count" => "{count} Předplatná", "stats" => "Statistiky", "settings" => "Nastavení", "admin" => "Administrace", diff --git a/includes/i18n/da.php b/includes/i18n/da.php old mode 100644 new mode 100755 index 09d5f3429..1bee9cfe4 --- a/includes/i18n/da.php +++ b/includes/i18n/da.php @@ -35,6 +35,7 @@ "profile" => "Profil", "dashboard" => "Dashboard", "subscriptions" => "Abonnementer", + "subscriptions_count" => "{count} Abonnementer", "stats" => "Statistik", "settings" => "Indstillinger", "admin" => "Admin", diff --git a/includes/i18n/de.php b/includes/i18n/de.php old mode 100644 new mode 100755 index cc4aff4ab..21ae427b2 --- a/includes/i18n/de.php +++ b/includes/i18n/de.php @@ -35,6 +35,7 @@ "profile" => "Profil", "dashboard" => "Dashboard", "subscriptions" => "Abonnements", + "subscriptions_count" => "{count} Abonnements", "stats" => "Statistiken", "settings" => "Einstellungen", "admin" => "Admin", diff --git a/includes/i18n/el.php b/includes/i18n/el.php old mode 100644 new mode 100755 index cb96bee63..d71022201 --- a/includes/i18n/el.php +++ b/includes/i18n/el.php @@ -35,6 +35,7 @@ "profile" => "Προφίλ", "dashboard" => "Πίνακας", "subscriptions" => "Συνδρομές", + "subscriptions_count" => "{count} Συνδρομές", "stats" => "Στατιστικές", "settings" => "Ρυθμίσεις", "admin" => "Διαχείριση", diff --git a/includes/i18n/en.php b/includes/i18n/en.php old mode 100644 new mode 100755 index 9ee31d9d3..be0f36c55 --- a/includes/i18n/en.php +++ b/includes/i18n/en.php @@ -35,6 +35,7 @@ "profile" => "Profile", "dashboard" => "Dashboard", "subscriptions" => "Subscriptions", + "subscriptions_count" => "{count} Subscriptions", "stats" => "Statistics", "settings" => "Settings", "admin" => "Admin", diff --git a/includes/i18n/es.php b/includes/i18n/es.php old mode 100644 new mode 100755 index f581004dc..484e044ab --- a/includes/i18n/es.php +++ b/includes/i18n/es.php @@ -35,6 +35,7 @@ "profile" => "Perfil", "dashboard" => "Tablero", "subscriptions" => "Suscripciones", + "subscriptions_count" => "{count} Suscripciones", "stats" => "Estadísticas", "settings" => "Configuración", "admin" => "Admin", diff --git a/includes/i18n/fr.php b/includes/i18n/fr.php old mode 100644 new mode 100755 index 9371cd23a..939a4e0ef --- a/includes/i18n/fr.php +++ b/includes/i18n/fr.php @@ -35,6 +35,7 @@ "profile" => "Profil", "dashboard" => "Accueil", "subscriptions" => "Abonnements", + "subscriptions_count" => "{count} Abonnements", "stats" => "Statistiques", "settings" => "Paramètres", "admin" => "Admin", diff --git a/includes/i18n/getlang.php b/includes/i18n/getlang.php old mode 100644 new mode 100755 index a80f93eef..58ae99e36 --- a/includes/i18n/getlang.php +++ b/includes/i18n/getlang.php @@ -9,18 +9,26 @@ } } -function translate($text, $translations) +function translate($text, $translations, $variables = []) { if (array_key_exists($text, $translations)) { - return $translations[$text]; + $translation = $translations[$text]; } else { require 'en.php'; - if (array_key_exists($text, $i18n)) { - return $i18n[$text]; + if (isset($i18n[$text])) { + $translation = $i18n[$text]; } else { return "[i18n String Missing]"; } } + + if (!empty($variables)) { + foreach ($variables as $key => $value) { + $translation = str_replace([':' . $key, '{' . $key . '}'], $value, $translation); + } + } + + return $translation; } ?> \ No newline at end of file diff --git a/includes/i18n/id.php b/includes/i18n/id.php old mode 100644 new mode 100755 index 7390ccd16..495e902cf --- a/includes/i18n/id.php +++ b/includes/i18n/id.php @@ -35,6 +35,7 @@ "profile" => "Profil", "dashboard" => "Dasbor", "subscriptions" => "Langganan", + "subscriptions_count" => "{count} Langganan", "stats" => "Statistik", "settings" => "Pengaturan", "admin" => "Admin", diff --git a/includes/i18n/it.php b/includes/i18n/it.php old mode 100644 new mode 100755 index 334206330..6d57b8236 --- a/includes/i18n/it.php +++ b/includes/i18n/it.php @@ -38,6 +38,7 @@ "profile" => 'Profilo', "dashboard" => 'Dashboard', "subscriptions" => 'Abbonamenti', + "subscriptions_count" => "{count} Abbonamenti", "stats" => 'Statistiche', "settings" => 'Impostazioni', "admin" => 'Amministrazione', diff --git a/includes/i18n/jp.php b/includes/i18n/jp.php old mode 100644 new mode 100755 index c3aaf7542..c497dbaff --- a/includes/i18n/jp.php +++ b/includes/i18n/jp.php @@ -35,6 +35,7 @@ "profile" => "プロフィール", "dashboard" => "ダッシュボード", "subscriptions" => "定期購入", + "subscriptions_count" => "{count} 定期購入", "stats" => "統計", "settings" => "設定", "admin" => "管理者", diff --git a/includes/i18n/ko.php b/includes/i18n/ko.php old mode 100644 new mode 100755 index b10680b4f..e4906d3fd --- a/includes/i18n/ko.php +++ b/includes/i18n/ko.php @@ -35,6 +35,7 @@ "profile" => "프로필", "dashboard" => "대시보드", "subscriptions" => "구독", + "subscriptions_count" => "{count} 구독", "stats" => "통계", "settings" => "설정", "admin" => "관리자", diff --git a/includes/i18n/languages.php b/includes/i18n/languages.php old mode 100644 new mode 100755 diff --git a/includes/i18n/nl.php b/includes/i18n/nl.php old mode 100644 new mode 100755 index 51c61e101..a877ccb3e --- a/includes/i18n/nl.php +++ b/includes/i18n/nl.php @@ -35,6 +35,7 @@ "profile" => "Profiel", "dashboard" => "Dashboard", "subscriptions" => "Abonnementen", + "subscriptions_count" => "{count} Abonnementen", "stats" => "Statistieken", "settings" => "Instellingen", "admin" => "Beheer", diff --git a/includes/i18n/pl.php b/includes/i18n/pl.php old mode 100644 new mode 100755 index 66a7a2d5a..bcddcddba --- a/includes/i18n/pl.php +++ b/includes/i18n/pl.php @@ -35,6 +35,7 @@ "profile" => "Profil", "dashboard" => "Panel", "subscriptions" => "Subskrypcje", + "subscriptions_count" => "{count} Subskrypcje", "stats" => "Statystyki", "settings" => "Ustawienia", "admin" => "Admin", diff --git a/includes/i18n/pt.php b/includes/i18n/pt.php old mode 100644 new mode 100755 index 06d8b8e74..d5e919b34 --- a/includes/i18n/pt.php +++ b/includes/i18n/pt.php @@ -35,6 +35,7 @@ "profile" => "Perfil", "dashboard" => "Painel", "subscriptions" => "Subscrições", + "subscriptions_count" => "{count} Subscrições", "stats" => "Estatísticas", "settings" => "Definições", "admin" => "Administração", diff --git a/includes/i18n/pt_br.php b/includes/i18n/pt_br.php old mode 100644 new mode 100755 index 73fbfc9d0..fb0dae2e2 --- a/includes/i18n/pt_br.php +++ b/includes/i18n/pt_br.php @@ -35,6 +35,7 @@ "profile" => "Perfil", "dashboard" => "Painel", "subscriptions" => "Assinaturas", + "subscriptions_count" => "{count} Assinaturas", "stats" => "Estatísticas", "settings" => "Configurações", "admin" => "Admin", diff --git a/includes/i18n/ru.php b/includes/i18n/ru.php old mode 100644 new mode 100755 index d158fd16c..d4fa4d5b4 --- a/includes/i18n/ru.php +++ b/includes/i18n/ru.php @@ -35,6 +35,7 @@ "profile" => "Профиль", "dashboard" => "Панель", "subscriptions" => "Подписки", + "subscriptions_count" => "{count} Подписки", "stats" => "Статистика", "settings" => "Настройки", "admin" => "Администратор", diff --git a/includes/i18n/sl.php b/includes/i18n/sl.php old mode 100644 new mode 100755 index 32ad4c852..ba1cb7fc8 --- a/includes/i18n/sl.php +++ b/includes/i18n/sl.php @@ -35,6 +35,7 @@ "profile" => "Profil", "dashboard" => "Panel", "subscriptions" => "Naročnine", + "subscriptions_count" => "{count} Naročnine", "stats" => "Statistika", "settings" => "Nastavitve", "admin" => "Skrbnik", diff --git a/includes/i18n/sr.php b/includes/i18n/sr.php old mode 100644 new mode 100755 index 315edf65a..c1859b2f4 --- a/includes/i18n/sr.php +++ b/includes/i18n/sr.php @@ -35,6 +35,7 @@ "profile" => "Профил", "dashboard" => "Панел", "subscriptions" => "Претплате", + "subscriptions_count" => "{count} Претплате", "stats" => "Статистике", "settings" => "Подешавања", "admin" => "Админ", diff --git a/includes/i18n/sr_lat.php b/includes/i18n/sr_lat.php old mode 100644 new mode 100755 index 9949f1fc7..7e294e0c5 --- a/includes/i18n/sr_lat.php +++ b/includes/i18n/sr_lat.php @@ -35,6 +35,7 @@ "profile" => "Profil", "dashboard" => "Panel", "subscriptions" => "Pretplate", + "subscriptions_count" => "{count} Pretplate", "stats" => "Statistike", "settings" => "Podešavanja", "admin" => "Admin", diff --git a/includes/i18n/tr.php b/includes/i18n/tr.php old mode 100644 new mode 100755 index d1ee8f3a5..162c4ecf5 --- a/includes/i18n/tr.php +++ b/includes/i18n/tr.php @@ -35,6 +35,7 @@ "profile" => "Profil", "dashboard" => "Panel", "subscriptions" => "Abonelikler", + "subscriptions_count" => "{count} Abonelikler", "stats" => "İstatistikler", "settings" => "Ayarlar", "admin" => "Yönetici", diff --git a/includes/i18n/uk.php b/includes/i18n/uk.php old mode 100644 new mode 100755 index 3a191586a..f085cfe7f --- a/includes/i18n/uk.php +++ b/includes/i18n/uk.php @@ -35,6 +35,7 @@ "profile" => "Профіль", "dashboard" => "Панель", "subscriptions" => "Підписки", + "subscriptions_count" => "{count} Підписки", "stats" => "Статистика", "settings" => "Налаштування", "admin" => "Адміністратор", diff --git a/includes/i18n/vi.php b/includes/i18n/vi.php old mode 100644 new mode 100755 index bd5ca1a0a..edaf23c28 --- a/includes/i18n/vi.php +++ b/includes/i18n/vi.php @@ -35,6 +35,7 @@ "profile" => "Hồ sơ", "dashboard" => "Bảng", "subscriptions" => "Đăng ký", + "subscriptions_count" => "{count} Đăng ký", "stats" => "Thống kê", "settings" => "Cài đặt", "admin" => "Quản trị viên", diff --git a/includes/i18n/zh_cn.php b/includes/i18n/zh_cn.php old mode 100644 new mode 100755 index 4b8361bba..e90634b2a --- a/includes/i18n/zh_cn.php +++ b/includes/i18n/zh_cn.php @@ -38,6 +38,7 @@ "profile" => "个人资料", "dashboard" => "仪表盘", "subscriptions" => "订阅", + "subscriptions_count" => "{count} 订阅", "stats" => "统计", "settings" => "设置", "admin" => "管理员", diff --git a/includes/i18n/zh_tw.php b/includes/i18n/zh_tw.php old mode 100644 new mode 100755 index 4b3054350..792d04dee --- a/includes/i18n/zh_tw.php +++ b/includes/i18n/zh_tw.php @@ -35,6 +35,7 @@ "profile" => "個人檔案", "dashboard" => "儀表板", "subscriptions" => "訂閱服務", + "subscriptions_count" => "{count} 訂閱服務", "stats" => "統計資訊", "settings" => "設定", "admin" => "管理員", diff --git a/includes/stats_calculations.php b/includes/stats_calculations.php index c93776a0a..e01e90691 100644 --- a/includes/stats_calculations.php +++ b/includes/stats_calculations.php @@ -18,6 +18,23 @@ function getPricePerMonth($cycle, $frequency, $price) } } +function getPricePerYear($cycle, $frequency, $price) +{ + switch ($cycle) { + case 1: + $numberOfPaymentsPerYear = (365 / $frequency); + return $price * $numberOfPaymentsPerYear; + case 2: + $numberOfPaymentsPerYear = (52.14 / $frequency); + return $price * $numberOfPaymentsPerYear; + case 3: + $numberOfPaymentsPerYear = (12 / $frequency); + return $price * $numberOfPaymentsPerYear; + case 4: + return $price / $frequency; + } +} + function getPriceConverted($price, $currency, $database, $userId) { $query = "SELECT rate FROM currencies WHERE id = :currency AND user_id = :userId"; @@ -84,6 +101,11 @@ function getPriceConverted($price, $currency, $database, $userId) $mostExpensiveSubscription['price'] = 0; $amountDueThisMonth = 0; $totalCostPerMonth = 0; +$totalCostPerYear = 0; +$monthlySubscriptions = 0; +$monthlySubscriptionsCost = 0; +$yearlySubscriptions = 0; +$yearlySubscriptionsCost = 0; $totalSavingsPerMonth = 0; $totalCostsInReplacementsPerMonth = 0; @@ -155,10 +177,20 @@ function getPriceConverted($price, $currency, $database, $userId) $replacementSubscriptionId = $subscription['replacement_subscription_id']; $originalSubscriptionPrice = getPriceConverted($price, $currency, $db, $userId); $price = getPricePerMonth($cycle, $frequency, $originalSubscriptionPrice); + $priceInYear = getPricePerYear($cycle, $frequency, $originalSubscriptionPrice); if ($inactive == 0) { + if($cycle != 4) { + $monthlySubscriptions++; + $monthlySubscriptionsCost += $price; + }else{ + $yearlySubscriptions++; + $yearlySubscriptionsCost += $priceInYear; + } + $activeSubscriptions++; $totalCostPerMonth += $price; + $totalCostPerYear += $priceInYear; $memberCost[$payerId]['cost'] += $price; $categoryCost[$categoryId]['cost'] += $price; $paymentMethodsCount[$paymentMethodId]['count'] += 1; @@ -214,7 +246,7 @@ function getPriceConverted($price, $currency, $database, $userId) $totalSavingsPerMonth -= $totalCostsInReplacementsPerMonth; // Calculate yearly price - $totalCostPerYear = $totalCostPerMonth * 12; + // $totalCostPerYear = $totalCostPerMonth * 12; // Calculate average subscription monthly cost if ($activeSubscriptions > 0) { diff --git a/index.php b/index.php old mode 100644 new mode 100755 index 1eb2d8243..9a375e629 --- a/index.php +++ b/index.php @@ -295,6 +295,7 @@ class="subscription-item-logo" title=""> +

@@ -316,6 +317,32 @@ class="subscription-item-logo" title="">
+ + + +
+

+
+

$monthlySubscriptions])?>

+

+ +

+
+
+ + + +
+

+
+

$yearlySubscriptions])?>

+

+ +

+
+
+ + diff --git a/styles/styles.css b/styles/styles.css index fb75d5cae..c4a38a27d 100644 --- a/styles/styles.css +++ b/styles/styles.css @@ -2911,7 +2911,7 @@ input[type="radio"]:checked+label::after { border-radius: 16px; box-shadow: var(--box-shadow); padding: 20px; - width: 155px; + width: 170px; height: 145px; flex: 0 0 auto; /* prevent flex resizing */ @@ -2922,7 +2922,7 @@ input[type="radio"]:checked+label::after { } .dashboard-subscriptions-list>.subscription-item.thin { - height: 115px; + height: 135px; } .dashboard-subscriptions-list>.subscription-item .subscription-item-title { @@ -3097,4 +3097,5 @@ input[type="radio"]:checked+label::after { .spinner.ai-spinner { margin: auto; } -} \ No newline at end of file +} +