Allow marking wishes as fulfilled
This commit is contained in:
parent
1037ccef66
commit
62ec209a5f
5 changed files with 33 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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.') ?>',
|
||||
|
||||
|
|
|
@ -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
|
|||
<span class="text"><?= __('Options') ?></span>
|
||||
<div class="menu">
|
||||
|
||||
<div class="item wish-fulfilled">
|
||||
<i class="check icon"></i>
|
||||
<?= __('Mark as fulfilled') ?>
|
||||
</div>
|
||||
|
||||
<a class="item" href="/?page=wish&id=<?= $this->id ?>">
|
||||
<i class="pen icon"></i>
|
||||
<?= __('Edit') ?>
|
||||
|
|
|
@ -80,7 +80,8 @@ $page->navigation();
|
|||
OR `status` IS NULL
|
||||
OR `status` < unix_timestamp(CURRENT_TIMESTAMP - INTERVAL ' . Wish::STATUS_TEMPORARY_MINUTES . ' MINUTE)
|
||||
)
|
||||
AND (`status` != "' . Wish::STATUS_UNAVAILABLE . '" OR `status` IS NULL)'
|
||||
AND (`status` != "' . Wish::STATUS_UNAVAILABLE . '" OR `status` IS NULL)
|
||||
AND (`status` != "' . Wish::STATUS_FULFILLED . '" OR `status` IS NULL)'
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue