diff --git a/CHANGELOG.md b/CHANGELOG.md index 454afe7b..5b83206f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - This changelog - Wish properties +- Button to mark wish as fulfilled -### Changed -- Improved card design +### Improved +- Card design ### Fixed - Various small bugs diff --git a/src/assets/js/wishlists.js b/src/assets/js/wishlists.js index 035c391a..f9cc6f22 100644 --- a/src/assets/js/wishlists.js +++ b/src/assets/js/wishlists.js @@ -296,6 +296,27 @@ $(function () { } }); + /** + * Mark as Fulfilled + */ + $(document).on('click', '.wish-fulfilled', function() { + var button = $(this); + var card = button.closest('.card'); + + button.api({ + action : 'update wish status', + method : 'PUT', + data : { + wish_id : card.attr('data-id'), + wish_status : wish_status_fulfilled, + }, + on : 'now', + onSuccess : function(response, element, xhr) { + card.closest('.column').fadeOut(); + }, + }); + }); + /** * Delete Wish */ diff --git a/src/classes/page.php b/src/classes/page.php index 58c08c83..2b635cc4 100644 --- a/src/classes/page.php +++ b/src/classes/page.php @@ -310,6 +310,7 @@ class Page var $_GET = JSON.parse('= isset($_SESSION['_GET']) ? json_encode($_SESSION['_GET']) : json_encode(array()) ?>'); var wish_status_temporary = '= Wish::STATUS_TEMPORARY ?>'; var wish_status_unavailable = '= Wish::STATUS_UNAVAILABLE ?>'; + var wish_status_fulfilled = '= Wish::STATUS_FULFILLED ?>'; var text = { wishlist_no_selection : '= __('No wishlist selected.') ?>', diff --git a/src/classes/wish.php b/src/classes/wish.php index 1c1cd5d3..40a3bd57 100644 --- a/src/classes/wish.php +++ b/src/classes/wish.php @@ -16,6 +16,7 @@ class Wish public const STATUS_TEMPORARY = 'temporary'; public const STATUS_TEMPORARY_MINUTES = 30; public const STATUS_UNAVAILABLE = 'unavailable'; + public const STATUS_FULFILLED = 'fulfilled'; public static array $priorities; @@ -205,6 +206,11 @@ class Wish = __('Options') ?>