added delete button for clipart
This commit is contained in:
@@ -1128,12 +1128,19 @@ class AdminController extends Controller
|
||||
->with("array_commission", $array_commission);
|
||||
}
|
||||
|
||||
|
||||
public function printFiles()
|
||||
public function deleteClipart(Request $request)
|
||||
{
|
||||
$post = $request->all();
|
||||
$AdminModel = new AdminModel;
|
||||
|
||||
return view('admin_pages.print_files');
|
||||
$delete_clipart_array = $AdminModel->deleteClipart($post['id']);
|
||||
|
||||
return response()->json(array(
|
||||
'success' => true,
|
||||
'message'=> "Clipart is successfully deleted."
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -53,6 +53,7 @@ Route::group(['middleware' => 'auth'], function () {
|
||||
Route::post('clipart/delete-clipart-category', 'admin\AdminController@deleteClipartCategory');
|
||||
Route::post('clipart/save-clipart-cat-ordering', 'admin\AdminController@saveClipartCatOrdering');
|
||||
Route::post('clipart/update-clipart-category', 'admin\AdminController@updateClipartCategory');
|
||||
Route::post('clipart/delete', 'admin\AdminController@deleteClipart');
|
||||
|
||||
Route::get('visualizer/add', 'admin\AdminController@visualizerAdd');
|
||||
Route::get('visualizer', 'admin\AdminController@visualizer');
|
||||
|
||||
@@ -216,6 +216,14 @@ class AdminModel extends Model
|
||||
return $i;
|
||||
}
|
||||
|
||||
function deleteClipart($id){
|
||||
|
||||
$i = DB::table('cliparts')
|
||||
->where("Id", $id)
|
||||
->delete();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function updateClipartCategory($id, $data){
|
||||
|
||||
$i = DB::table('clipart_categories')
|
||||
@@ -226,10 +234,13 @@ class AdminModel extends Model
|
||||
|
||||
function selectCliparts(){
|
||||
|
||||
$i = DB::table('cliparts')
|
||||
->orderby("Id", "DESC")
|
||||
->paginate(16);
|
||||
$i = DB::table('cliparts')->select('cliparts.*', 'clipart_categories.CategoryName')
|
||||
->leftjoin('clipart_categories', 'clipart_categories.Id','=','cliparts.CategoryId')
|
||||
->orderby("Id", "DESC")
|
||||
->paginate(16);
|
||||
return $i;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function selectSports(){
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -37,7 +37,16 @@
|
||||
<div class="store-logo">
|
||||
<img src="{{ config('site_config.images_directory') . 'cliparts/' . $clipart->SVGFilename }}" width="100%" style="height: inherit;">
|
||||
</div>
|
||||
<hr style="margin-bottom: 0px !important;">
|
||||
|
||||
<div style="margin-bottom: 10px; border-bottom: 1px solid #eee;">
|
||||
<small style="color: #848484;"><b>Category:</b> <br>{{ $clipart->CategoryName }}</small>
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<button data-id="{{ $clipart->Id }}" class="btn btn-danger btn-block delete-clipart"><i class="fa fa-trash"></i> Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{{-- <li class="col-sm-2">
|
||||
<a class="thumbnail"></a>
|
||||
|
||||
Reference in New Issue
Block a user