Allow adding and editing product prices
This commit is contained in:
parent
95bbc03f2b
commit
e1ec8bd69f
7 changed files with 110 additions and 57 deletions
|
@ -332,9 +332,18 @@ $(function () {
|
|||
formEdit.addClass('loading');
|
||||
formEdit.trigger('reset');
|
||||
formEdit.find('.dropdown').dropdown('restore defaults');
|
||||
formEdit.find('.item[data-tab="product"]').addClass('disabled');
|
||||
formEdit.find('.item').tab('change tab', 'general');
|
||||
|
||||
/** Checkbox */
|
||||
formEdit.find('.checkbox').checkbox({
|
||||
onChecked : function() {
|
||||
formEdit.find('.item[data-tab="product"]').removeClass('disabled');
|
||||
},
|
||||
onUnchecked : function() {
|
||||
formEdit.find('.item[data-tab="product"]').addClass('disabled');
|
||||
},
|
||||
});
|
||||
|
||||
/** Get Wish */
|
||||
var wishID = $(this).attr('data-id');
|
||||
|
||||
|
@ -350,12 +359,21 @@ $(function () {
|
|||
.then(function(response) {
|
||||
var wish = response.info;
|
||||
|
||||
/** General */
|
||||
$('[name="wish_id"]').val(wish.id);
|
||||
$('[name="wish_title"]').val(wish.title);
|
||||
$('[name="wish_description"]').val(wish.description);
|
||||
$('[name="wish_url"]').val(wish.url);
|
||||
$('.ui.selection.dropdown.priority').dropdown('set selected', wish.priority);
|
||||
$('[name="wish_is_purchasable"]').prop('checked', wish.is_purchasable);
|
||||
|
||||
if (wish.is_purchasable) {
|
||||
formEdit.find('.checkbox').checkbox('check');
|
||||
} else {
|
||||
formEdit.find('.checkbox').checkbox('uncheck');
|
||||
}
|
||||
|
||||
/** Product */
|
||||
$('[name="wish_price"]').val(wish.price);
|
||||
})
|
||||
.catch(handleFetchCatch)
|
||||
.finally(function() {
|
||||
|
@ -450,9 +468,18 @@ $(function () {
|
|||
var formAdd = $('.form.wishlist-wish-add');
|
||||
formAdd.trigger('reset');
|
||||
formAdd.find('.dropdown').dropdown('restore defaults');
|
||||
formAdd.find('.item[data-tab="product"]').addClass('disabled');
|
||||
formAdd.find('.item').tab('change tab', 'general');
|
||||
|
||||
/** Checkbox */
|
||||
formAdd.find('.checkbox').checkbox({
|
||||
onChecked : function() {
|
||||
formAdd.find('.item[data-tab="product"]').removeClass('disabled');
|
||||
},
|
||||
onUnchecked : function() {
|
||||
formAdd.find('.item[data-tab="product"]').addClass('disabled');
|
||||
},
|
||||
});
|
||||
|
||||
/** Modal */
|
||||
var modalWishlistWishAdd = $('.ui.modal.wishlist-wish-add');
|
||||
modalWishlistWishAdd.find('[name="wishlist_id"]').val($('.ui.dropdown.wishlists').dropdown('get value'));
|
||||
|
@ -602,7 +629,7 @@ $(function () {
|
|||
.then(handleFetchError)
|
||||
.then(handleFetchResponse)
|
||||
.then(function(response) {
|
||||
if (true !== response.success) {
|
||||
if (!response.lastInsertId) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -633,7 +660,7 @@ $(function () {
|
|||
.then(handleFetchError)
|
||||
.then(handleFetchResponse)
|
||||
.then(function(response) {
|
||||
if (true !== response.success) {
|
||||
if (!response.lastInsertId) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue