= $member['name'] ?>
@@ -139,8 +196,11 @@
$category['name'] = translate("no_category", $i18n);
}
$selectedClass = '';
- if (isset($_GET['category']) && $_GET['category'] == $category['id']) {
- $selectedClass = 'selected';
+ if (isset($_GET['category'])) {
+ $categoryIds = explode(',', $_GET['category']);
+ if (in_array($category['id'], $categoryIds)) {
+ $selectedClass = 'selected';
+ }
}
?>
@@ -163,8 +223,11 @@
@@ -276,6 +339,10 @@
if (isset($settings['showMonthlyPrice']) && $settings['showMonthlyPrice'] === 'true') {
$print[$id]['price'] = getPricePerMonth($cycle, $frequency, $print[$id]['price']);
}
+ if (isset($settings['showOriginalPrice']) && $settings['showOriginalPrice'] === 'true') {
+ $print[$id]['original_price'] = floatval($subscription['price']);
+ $print[$id]['original_currency_code'] = $currencies[$subscription['currency_id']]['code'];
+ }
}
if ($sortOrder == "alphanumeric") {
diff --git a/migrations/000026.php b/migrations/000026.php
index bd773e073..ef4f11886 100644
--- a/migrations/000026.php
+++ b/migrations/000026.php
@@ -1,10 +1,18 @@
query("SELECT * FROM pragma_table_info('email_notifications') where name='other_email'");
+$columnQuery = $db->query("SELECT * FROM pragma_table_info('email_notifications') where name='other_emails'");
$columnRequired = $columnQuery->fetchArray(SQLITE3_ASSOC) === false;
if ($columnRequired) {
- $db->exec('ALTER TABLE email_notifications ADD COLUMN other_email TEXT DEFAULT "";');
+ $db->exec('ALTER TABLE email_notifications ADD COLUMN other_emails TEXT DEFAULT "";');
}
+
+$columnQuery = $db->query("SELECT * FROM pragma_table_info('settings') where name='show_original_price'");
+$columnRequired = $columnQuery->fetchArray(SQLITE3_ASSOC) === false;
+
+if ($columnRequired) {
+ $db->exec('ALTER TABLE settings ADD COLUMN show_original_price BOOLEAN DEFAULT 0');
+}
\ No newline at end of file
diff --git a/scripts/dashboard.js b/scripts/dashboard.js
index ba243f256..1d86e6e31 100644
--- a/scripts/dashboard.js
+++ b/scripts/dashboard.js
@@ -207,7 +207,8 @@ function cloneSubscription(event, id) {
})
.then(data => {
if (data.success) {
- fetchSubscriptions();
+ const id = data.id;
+ fetchSubscriptions(id, event);
showSuccessMessage(decodeURI(data.message));
} else {
showErrorMessage(data.message || translate('error'));
@@ -288,15 +289,15 @@ function closeLogoSearch() {
logoResults.innerHTML = "";
}
-function fetchSubscriptions() {
+function fetchSubscriptions(id, event) {
const subscriptionsContainer = document.querySelector("#subscriptions");
let getSubscriptions = "endpoints/subscriptions/get.php";
- if (activeFilters['category'] !== "") {
- getSubscriptions += `?category=${activeFilters['category']}`;
+ if (activeFilters['categories'].length > 0) {
+ getSubscriptions += `?categories=${activeFilters['categories']}`;
}
- if (activeFilters['member'] !== "") {
- getSubscriptions += getSubscriptions.includes("?") ? `&member=${activeFilters['member']}` : `?member=${activeFilters['member']}`;
+ if (activeFilters['members'].length > 0) {
+ getSubscriptions += getSubscriptions.includes("?") ? `&members=${activeFilters['members']}` : `?members=${activeFilters['members']}`;
}
if (activeFilters['payments'].length > 0) {
getSubscriptions += getSubscriptions.includes("?") ? `&payments=${activeFilters['payments']}` : `?payments=${activeFilters['payments']}`;
@@ -317,6 +318,10 @@ function fetchSubscriptions() {
mainActions.classList.remove("hidden");
}
}
+
+ if (id && event) {
+ openEditSubscription(event, id);
+ }
})
.catch(error => {
console.error(translate('error_reloading_subscription'), error);
@@ -346,18 +351,18 @@ function convertSvgToPng(file, callback) {
const reader = new FileReader();
reader.onload = function (e) {
- const img = new Image();
- img.src = e.target.result;
- img.onload = function() {
- const canvas = document.createElement('canvas');
- canvas.width = img.width;
- canvas.height = img.height;
- const ctx = canvas.getContext('2d');
- ctx.drawImage(img, 0, 0);
- const pngDataUrl = canvas.toDataURL('image/png');
- const pngFile = dataURLtoFile(pngDataUrl, file.name.replace(".svg", ".png"));
- callback(pngFile);
- };
+ const img = new Image();
+ img.src = e.target.result;
+ img.onload = function () {
+ const canvas = document.createElement('canvas');
+ canvas.width = img.width;
+ canvas.height = img.height;
+ const ctx = canvas.getContext('2d');
+ ctx.drawImage(img, 0, 0);
+ const pngDataUrl = canvas.toDataURL('image/png');
+ const pngFile = dataURLtoFile(pngDataUrl, file.name.replace(".svg", ".png"));
+ callback(pngFile);
+ };
};
reader.readAsDataURL(file);
@@ -365,16 +370,16 @@ function convertSvgToPng(file, callback) {
function dataURLtoFile(dataurl, filename) {
let arr = dataurl.split(','),
- mime = arr[0].match(/:(.*?);/)[1],
- bstr = atob(arr[1]),
- n = bstr.length,
- u8arr = new Uint8Array(n);
-
- while(n--){
- u8arr[n] = bstr.charCodeAt(n);
+ mime = arr[0].match(/:(.*?);/)[1],
+ bstr = atob(arr[1]),
+ n = bstr.length,
+ u8arr = new Uint8Array(n);
+
+ while (n--) {
+ u8arr[n] = bstr.charCodeAt(n);
}
- return new File([u8arr], filename, {type:mime});
+ return new File([u8arr], filename, { type: mime });
}
function submitFormData(formData, submitButton, endpoint) {
@@ -403,7 +408,7 @@ document.addEventListener('DOMContentLoaded', function () {
subscriptionForm.addEventListener("submit", function (e) {
e.preventDefault();
-
+
submitButton.disabled = true;
const formData = new FormData(subscriptionForm);
@@ -411,12 +416,12 @@ document.addEventListener('DOMContentLoaded', function () {
const file = fileInput.files[0];
if (file && file.type === "image/svg+xml") {
- convertSvgToPng(file, function(pngFile) {
- formData.set("logo", pngFile);
- submitFormData(formData, submitButton, endpoint);
- });
- } else {
+ convertSvgToPng(file, function (pngFile) {
+ formData.set("logo", pngFile);
submitFormData(formData, submitButton, endpoint);
+ });
+ } else {
+ submitFormData(formData, submitButton, endpoint);
}
});
@@ -459,8 +464,8 @@ function closeSubMenus() {
}
const activeFilters = [];
-activeFilters['category'] = "";
-activeFilters['member'] = "";
+activeFilters['categories'] = [];
+activeFilters['members'] = [];
activeFilters['payments'] = [];
activeFilters['state'] = "";
@@ -502,41 +507,32 @@ document.querySelectorAll('.filter-item').forEach(function (item) {
if (this.hasAttribute('data-categoryid')) {
const categoryId = this.getAttribute('data-categoryid');
- if (activeFilters['category'] === categoryId) {
- activeFilters['category'] = "";
+ if (activeFilters['categories'].includes(categoryId)) {
+ const categoryIndex = activeFilters['categories'].indexOf(categoryId);
+ activeFilters['categories'].splice(categoryIndex, 1);
this.classList.remove('selected');
} else {
- activeFilters['category'] = categoryId;
- Array.from(this.parentNode.children).forEach(sibling => {
- sibling.classList.remove('selected');
- });
+ activeFilters['categories'].push(categoryId);
this.classList.add('selected');
}
} else if (this.hasAttribute('data-memberid')) {
const memberId = this.getAttribute('data-memberid');
- if (activeFilters['member'] === memberId) {
- activeFilters['member'] = "";
- this.classList.remove('selected');
- } else {
- activeFilters['member'] = memberId;
- Array.from(this.parentNode.children).forEach(sibling => {
- sibling.classList.remove('selected');
- });
- this.classList.add('selected');
- }
+ if (activeFilters['members'].includes(memberId)) {
+ const memberIndex = activeFilters['members'].indexOf(memberId);
+ activeFilters['members'].splice(memberIndex, 1);
+ this.classList.remove('selected');
+ } else {
+ activeFilters['members'].push(memberId);
+ this.classList.add('selected');
+ }
} else if (this.hasAttribute('data-paymentid')) {
const paymentId = this.getAttribute('data-paymentid');
if (activeFilters['payments'].includes(paymentId)) {
- const index = activeFilters['payments'].indexOf(paymentId);
- activeFilters['payments'].splice(index, 1);
+ const paymentIndex = activeFilters['payments'].indexOf(paymentId);
+ activeFilters['payments'].splice(paymentIndex, 1);
this.classList.remove('selected');
} else {
activeFilters['payments'].push(paymentId);
- /*
- Array.from(this.parentNode.children).forEach(sibling => {
- sibling.classList.remove('selected');
- });
- */
this.classList.add('selected');
}
} else if (this.hasAttribute('data-state')) {
@@ -553,7 +549,7 @@ document.querySelectorAll('.filter-item').forEach(function (item) {
}
}
- if (activeFilters['category'] !== "" || activeFilters['member'] !== "" || activeFilters['payments'].length > 0) {
+ if (activeFilters['categories'].length > 0 || activeFilters['members'].length > 0 || activeFilters['payments'].length > 0) {
document.querySelector('#clear-filters').classList.remove('hide');
} else {
document.querySelector('#clear-filters').classList.add('hide');
@@ -566,8 +562,8 @@ document.querySelectorAll('.filter-item').forEach(function (item) {
function clearFilters() {
const searchInput = document.querySelector("#search");
searchInput.value = "";
- activeFilters['category'] = "";
- activeFilters['member'] = "";
+ activeFilters['categories'] = [];
+ activeFilters['members'] = [];
activeFilters['payments'] = [];
document.querySelectorAll('.filter-item').forEach(function (item) {
item.classList.remove('selected');
diff --git a/scripts/notifications.js b/scripts/notifications.js
index a83df1add..515f49afd 100644
--- a/scripts/notifications.js
+++ b/scripts/notifications.js
@@ -65,7 +65,7 @@ function saveNotificationsEmailButton() {
const smtpUsername = document.getElementById("smtpusername").value;
const smtpPassword = document.getElementById("smtppassword").value;
const fromEmail = document.getElementById("fromemail").value;
- const otherEmail = document.getElementById("otheremail").value;
+ const otherEmails = document.getElementById("otheremails").value;
const data = {
enabled: enabled,
@@ -75,7 +75,7 @@ function saveNotificationsEmailButton() {
smtpusername: smtpUsername,
smtppassword: smtpPassword,
fromemail: fromEmail,
- otheremail: otherEmail
+ otheremails: otherEmails
};
makeFetchCall('endpoints/notifications/saveemailnotifications.php', data, button);
diff --git a/scripts/settings.js b/scripts/settings.js
index b83734113..85c0db2cf 100644
--- a/scripts/settings.js
+++ b/scripts/settings.js
@@ -927,6 +927,13 @@ function setDisabledToBottom() {
storeSettingsOnDB('disabled_to_bottom', value);
}
+function setShowOriginalPrice() {
+ const showOriginalPriceCheckbox = document.querySelector("#showoriginalprice");
+ const value = showOriginalPriceCheckbox.checked;
+
+ storeSettingsOnDB('show_original_price', value);
+}
+
function saveCategorySorting() {
const categories = document.getElementById('categories');
const categoryIds = Array.from(categories.children).map(category => category.dataset.categoryid);
diff --git a/settings.php b/settings.php
index 857844bc9..ee750b8ce 100644
--- a/settings.php
+++ b/settings.php
@@ -249,7 +249,7 @@ class="thin mobile-grow" />
$notificationsEmail['smtp_username'] = $row['smtp_username'];
$notificationsEmail['smtp_password'] = $row['smtp_password'];
$notificationsEmail['from_email'] = $row['from_email'];
- $notificationsEmail['other_email'] = $row['other_email'];
+ $notificationsEmail['other_emails'] = $row['other_emails'];
$rowCount++;
}
@@ -261,7 +261,7 @@ class="thin mobile-grow" />
$notificationsEmail['smtp_username'] = "";
$notificationsEmail['smtp_password'] = "";
$notificationsEmail['from_email'] = "";
- $notificationsEmail['other_email'] = "";
+ $notificationsEmail['other_emails'] = "";
}
// Discord notifications
@@ -483,10 +483,11 @@ class="one-third" value="= $notificationsEmail['smtp_port'] ?>" />
placeholder="= translate('from_email', $i18n) ?>"
value="= $notificationsEmail['from_email'] ?>" />
+
-
+