added delete button for clipart

This commit is contained in:
franknstayn
2020-03-07 17:52:22 +08:00
parent 55033c6695
commit 6c9cc4fa65
5 changed files with 68 additions and 6 deletions

View File

@@ -471,6 +471,7 @@ desired effect
$('.available-colors').append('<button type="button" data-id="' + id + '" data-orig-color="'+fill+'" id="btn_' + id + '" data-toggle="popover" title="HEX Color" data-content="' + fill + '" class="btn btn-default change_color" style="background-color:' + fill + '"></button>');
}
console.log(obj);
$('.available-colors').append('</div></div>');
$('.additional-info').css("display", "block");
@@ -1249,6 +1250,39 @@ desired effect
}
});
});
$(document).on('button click', '.delete-clipart', function() {
if (!confirm("Are you sure you want to delete this Clipart?")) {
return false;
}
var clipart_id = $(this).data('id');
$.ajax({
type : 'POST',
url : "{{ url('admin/clipart/delete') }}",
data : {
id: clipart_id
},
beforeSend: function(xhr){
var token = $('meta[name="csrf_token"]').attr('content');
if (token) {
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
}
},
success : function(response){
console.log(response)
if(response.success){
alert(response.message);
location.reload();
}
}
});
});
}); // end document ready