added sort button to category group

added sort to prop
pull/44/head
A1Gard 6 months ago
parent 6b1b8baeaa
commit d885ce07be

@ -138,4 +138,20 @@ class PropController extends XController
return parent::restoreing(Prop::withTrashed()->where('id', $item)->first()); return parent::restoreing(Prop::withTrashed()->where('id', $item)->first());
} }
/*restore**/ /*restore**/
public function sort(){
return view('admin.props.prop-sort');
}
public function sortSave(Request $request){
foreach ($request->input('items') as $key => $v){
$p = Prop::whereId($v['id'])->first();
$p->sort = $key;
$p->save();
}
logAdmin(__METHOD__,__CLASS__,null);
return ['OK' => true,'message' => __("As you wished sort saved")];
}
} }

@ -13,3 +13,16 @@
@section('bulk') @section('bulk')
{{-- <option value="-"> - </option> --}} {{-- <option value="-"> - </option> --}}
@endsection @endsection
@section('list-foot')
<a
href="{{getRoute('sort')}}"
class="action-btn circle-btn"
data-bs-toggle="tooltip"
data-bs-placement="top"
data-bs-custom-class="custom-tooltip"
data-bs-title="{{__("Sort")}}"
style="inset-inline-end: 1.2rem;inset-inline-start: auto;"
>
<i class="ri-sort-asc"></i>
</a>
@endsection

@ -13,3 +13,16 @@
@section('bulk') @section('bulk')
{{-- <option value="-"> - </option> --}} {{-- <option value="-"> - </option> --}}
@endsection @endsection
@section('list-foot')
<a
href="{{getRoute('sort')}}"
class="action-btn circle-btn"
data-bs-toggle="tooltip"
data-bs-placement="top"
data-bs-custom-class="custom-tooltip"
data-bs-title="{{__("Sort")}}"
style="inset-inline-end: 1.2rem;inset-inline-start: auto;"
>
<i class="ri-sort-asc"></i>
</a>
@endsection

@ -13,3 +13,16 @@
@section('bulk') @section('bulk')
{{-- <option value="-"> - </option> --}} {{-- <option value="-"> - </option> --}}
@endsection @endsection
@section('list-foot')
<a
href="{{getRoute('sort')}}"
class="action-btn circle-btn"
data-bs-toggle="tooltip"
data-bs-placement="top"
data-bs-custom-class="custom-tooltip"
data-bs-title="{{__("Sort")}}"
style="inset-inline-end: 1.2rem;inset-inline-start: auto;"
>
<i class="ri-sort-asc"></i>
</a>
@endsection

@ -0,0 +1,26 @@
@extends('layouts.app')
@section('content')
<div id="sort-control">
<ol class="ol-sortable">
@foreach(\App\Models\Prop::orderBy('sort')->get() as $prop)
<li data-id="{{$prop->id}}" class="p-2">
<i class="ri-drag-move-2-line"></i>
{{$prop->label}} [{{$prop->name}}]
</li>
@endforeach
</ol>
</div>
<input type="hidden" id="sort-data" >
<button
data-link="{{getRoute('sort-save')}}"
id="save-sort"
class="action-btn circle-btn"
data-bs-toggle="tooltip"
data-bs-placement="top"
data-bs-custom-class="custom-tooltip"
data-bs-title="{{__("Save")}}"
>
<i class="ri-save-2-line"></i>
</button>
@endsection

@ -341,6 +341,7 @@
{{-- list content end--}} {{-- list content end--}}
</div> </div>
@yield('list-foot')
@if(hasRoute('create')) @if(hasRoute('create'))
<a class="action-btn circle-btn" <a class="action-btn circle-btn"
data-bs-toggle="tooltip" data-bs-toggle="tooltip"

@ -263,6 +263,8 @@ Route::prefix(config('app.panel.prefix'))->name('admin.')->group(
Route::post('update/{item}', [\App\Http\Controllers\Admin\PropController::class, 'update'])->name('update'); Route::post('update/{item}', [\App\Http\Controllers\Admin\PropController::class, 'update'])->name('update');
Route::get('delete/{item}', [\App\Http\Controllers\Admin\PropController::class, 'destroy'])->name('destroy'); Route::get('delete/{item}', [\App\Http\Controllers\Admin\PropController::class, 'destroy'])->name('destroy');
Route::post('bulk', [\App\Http\Controllers\Admin\PropController::class, "bulk"])->name('bulk'); Route::post('bulk', [\App\Http\Controllers\Admin\PropController::class, "bulk"])->name('bulk');
Route::post('sort/save', [\App\Http\Controllers\Admin\PropController::class, 'sortSave'])->name('sort-save');
Route::get('sort', [\App\Http\Controllers\Admin\PropController::class, 'sort'])->name('sort');
}); });
Route::prefix('sliders')->name('slider.')->group( Route::prefix('sliders')->name('slider.')->group(
function () { function () {

Loading…
Cancel
Save