diff --git a/endpoints/subscription/add.php b/endpoints/subscription/add.php index 1071d8351..ed6f92fa1 100644 --- a/endpoints/subscription/add.php +++ b/endpoints/subscription/add.php @@ -144,6 +144,7 @@ function resizeAndUploadLogo($uploadedFile, $uploadDir, $name) { $payerUserId = $_POST["payer_user_id"]; $categoryId = $_POST['category_id']; $notes = $_POST["notes"]; + $url = $_POST['url']; $logoUrl = $_POST['logo-url']; $logo = ""; $notify = isset($_POST['notifications']) ? true : false; @@ -158,15 +159,15 @@ function resizeAndUploadLogo($uploadedFile, $uploadDir, $name) { if (!$isEdit) { $sql = "INSERT INTO subscriptions (name, logo, price, currency_id, next_payment, cycle, frequency, notes, - payment_method_id, payer_user_id, category_id, notify) + payment_method_id, payer_user_id, category_id, notify, url) VALUES (:name, :logo, :price, :currencyId, :nextPayment, :cycle, :frequency, :notes, - :paymentMethodId, :payerUserId, :categoryId, :notify)"; + :paymentMethodId, :payerUserId, :categoryId, :notify, :url)"; } else { $id = $_POST['id']; if ($logo != "") { - $sql = "UPDATE subscriptions SET name = :name, logo = :logo, price = :price, currency_id = :currencyId, next_payment = :nextPayment, cycle = :cycle, frequency = :frequency, notes = :notes, payment_method_id = :paymentMethodId, payer_user_id = :payerUserId, category_id = :categoryId, notify = :notify WHERE id = :id"; + $sql = "UPDATE subscriptions SET name = :name, logo = :logo, price = :price, currency_id = :currencyId, next_payment = :nextPayment, cycle = :cycle, frequency = :frequency, notes = :notes, payment_method_id = :paymentMethodId, payer_user_id = :payerUserId, category_id = :categoryId, notify = :notify, url = :url WHERE id = :id"; } else { - $sql = "UPDATE subscriptions SET name = :name, price = :price, currency_id = :currencyId, next_payment = :nextPayment, cycle = :cycle, frequency = :frequency, notes = :notes, payment_method_id = :paymentMethodId, payer_user_id = :payerUserId, category_id = :categoryId, notify = :notify WHERE id = :id"; + $sql = "UPDATE subscriptions SET name = :name, price = :price, currency_id = :currencyId, next_payment = :nextPayment, cycle = :cycle, frequency = :frequency, notes = :notes, payment_method_id = :paymentMethodId, payer_user_id = :payerUserId, category_id = :categoryId, notify = :notify, url = :url WHERE id = :id"; } } @@ -188,6 +189,7 @@ function resizeAndUploadLogo($uploadedFile, $uploadDir, $name) { $stmt->bindParam(':payerUserId', $payerUserId, SQLITE3_INTEGER); $stmt->bindParam(':categoryId', $categoryId, SQLITE3_INTEGER); $stmt->bindParam(':notify', $notify, SQLITE3_INTEGER); + $stmt->bindParam(':url', $url, SQLITE3_TEXT); if ($stmt->execute()) { $success['status'] = "Success"; diff --git a/endpoints/subscription/get.php b/endpoints/subscription/get.php index c0f29aa07..1b9b1122d 100644 --- a/endpoints/subscription/get.php +++ b/endpoints/subscription/get.php @@ -25,6 +25,7 @@ $subscriptionData['payer_user_id'] = $row['payer_user_id']; $subscriptionData['category_id'] = $row['category_id']; $subscriptionData['notify'] = $row['notify']; + $subscriptionData['url'] = $row['url']; $subscriptionJson = json_encode($subscriptionData); header('Content-Type: application/json'); diff --git a/endpoints/subscriptions/get.php b/endpoints/subscriptions/get.php index bb6f2561e..d1eb6820c 100644 --- a/endpoints/subscriptions/get.php +++ b/endpoints/subscriptions/get.php @@ -53,6 +53,7 @@ $print[$id]['category_id'] = $subscription['category_id']; $print[$id]['payer_user_id'] = $subscription['payer_user_id']; $print[$id]['price'] = floatval($subscription['price']); + $print[$id]['url'] = $subscription['url']; if (isset($_COOKIE['convertCurrency']) && $_COOKIE['convertCurrency'] === 'true' && $currencyId != $mainCurrencyId) { $print[$id]['price'] = getPriceConverted($print[$id]['price'], $currencyId, $db); diff --git a/images/siteicons/filter.png b/images/siteicons/filter.png new file mode 100644 index 000000000..5cbc99104 Binary files /dev/null and b/images/siteicons/filter.png differ diff --git a/images/siteicons/web.png b/images/siteicons/web.png new file mode 100644 index 000000000..2a7b42f21 Binary files /dev/null and b/images/siteicons/web.png differ diff --git a/includes/list_subscriptions.php b/includes/list_subscriptions.php index feaf6d6bb..4144e74d8 100644 --- a/includes/list_subscriptions.php +++ b/includes/list_subscriptions.php @@ -101,6 +101,17 @@ function printSubscriptions($subscriptions, $sort, $categories, $members) { Subscription Paid By Category + + URL + +
+ +
+
diff --git a/migrations/000004.php b/migrations/000004.php new file mode 100644 index 000000000..9f1ec444b --- /dev/null +++ b/migrations/000004.php @@ -0,0 +1,12 @@ +query("SELECT * FROM pragma_table_info('subscriptions') where name='url'"); + $columnRequired = $columnQuery->fetchArray(SQLITE3_ASSOC) === false; + + if ($columnRequired) { + $db->exec('ALTER TABLE subscriptions ADD COLUMN url VARCHAR(255);'); + } + +?> \ No newline at end of file diff --git a/scripts/dashboard.js b/scripts/dashboard.js index 150c6b0bf..b17e89601 100644 --- a/scripts/dashboard.js +++ b/scripts/dashboard.js @@ -67,6 +67,8 @@ function fillEditFormFields(subscription) { nextPament.value = subscription.next_payment; const notes = document.querySelector("#notes"); notes.value = subscription.notes; + const url = document.querySelector("#url"); + url.value = subscription.url; const notifications = document.querySelector("#notifications"); if (notifications) { diff --git a/styles/styles.css b/styles/styles.css index f738cf03e..03185a3ec 100644 --- a/styles/styles.css +++ b/styles/styles.css @@ -283,6 +283,12 @@ main > .contain { flex-basis: 33%; } +.subscription-secondary > .url { + flex-basis: 20px; + margin-left: auto; + cursor: pointer; +} + @media (max-width: 768px) { .subscription-main > .name { display: none; @@ -308,6 +314,10 @@ main > .contain { margin-right: 10px; } +.subscription-secondary .url img { + margin-right: 0px;; +} + .empty-page { display: block; max-width: 90%;