Refactor
This commit is contained in:
parent
6f44e8032f
commit
d33fb99277
2 changed files with 44 additions and 44 deletions
|
@ -100,50 +100,6 @@ $(function() {
|
|||
filterRemoteData: true
|
||||
});
|
||||
|
||||
/**
|
||||
* Commit to Product
|
||||
*/
|
||||
$(document).on('click', '.ui.button.commit', function() {
|
||||
var button = $(this);
|
||||
var card = button.closest('.ui.card');
|
||||
var column = card.closest('.column');
|
||||
|
||||
$('body')
|
||||
.modal({
|
||||
title: 'Really commit?',
|
||||
content: 'Would you really like to commit to this purchase? It will no longer appear in the wishlist anymore.',
|
||||
class: 'tiny',
|
||||
actions: [
|
||||
{
|
||||
text: 'Yes, commit',
|
||||
class: 'approve primary'
|
||||
},
|
||||
{
|
||||
text: 'Cancel',
|
||||
class: ''
|
||||
}
|
||||
],
|
||||
onApprove: function() {
|
||||
/**
|
||||
* Update product status
|
||||
*/
|
||||
button.api({
|
||||
action: 'update product status',
|
||||
method: 'PUT',
|
||||
data: {
|
||||
productID: card.data('id'),
|
||||
productStatus: 'unavailable'
|
||||
},
|
||||
on: 'now',
|
||||
onSuccess: function(response, element, xhr) {
|
||||
column.fadeOut();
|
||||
},
|
||||
});
|
||||
}
|
||||
})
|
||||
.modal('show');
|
||||
});
|
||||
|
||||
/**
|
||||
* Delete Product
|
||||
*/
|
||||
|
|
|
@ -29,4 +29,48 @@ $(function() {
|
|||
})
|
||||
.modal('show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Commit to Product
|
||||
*/
|
||||
$(document).on('click', '.ui.button.commit', function() {
|
||||
var button = $(this);
|
||||
var card = button.closest('.ui.card');
|
||||
var column = card.closest('.column');
|
||||
|
||||
$('body')
|
||||
.modal({
|
||||
title: 'Really commit?',
|
||||
content: 'Would you really like to commit to this purchase? It will no longer appear in the wishlist anymore.',
|
||||
class: 'tiny',
|
||||
actions: [
|
||||
{
|
||||
text: 'Yes, commit',
|
||||
class: 'approve primary'
|
||||
},
|
||||
{
|
||||
text: 'Cancel',
|
||||
class: ''
|
||||
}
|
||||
],
|
||||
onApprove: function() {
|
||||
/**
|
||||
* Update product status
|
||||
*/
|
||||
button.api({
|
||||
action: 'update product status',
|
||||
method: 'PUT',
|
||||
data: {
|
||||
productID: card.data('id'),
|
||||
productStatus: 'unavailable'
|
||||
},
|
||||
on: 'now',
|
||||
onSuccess: function(response, element, xhr) {
|
||||
column.fadeOut();
|
||||
},
|
||||
});
|
||||
}
|
||||
})
|
||||
.modal('show');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue