Add no visual

This commit is contained in:
Ludovic CANDELLIER
2022-01-25 22:59:17 +01:00
parent bdefa235eb
commit 9f6d21ef04
6 changed files with 11 additions and 6 deletions

View File

@@ -40,6 +40,7 @@ class OffersDataTable extends DataTable
}) })
->editColumn('status_id', function (Offer $offer) { ->editColumn('status_id', function (Offer $offer) {
return view("components.form.toggle", [ return view("components.form.toggle", [
'name' => 'status_id',
'value' => $offer->status_id, 'value' => $offer->status_id,
'on' => __('active'), 'on' => __('active'),
'off' => __('inactive'), 'off' => __('inactive'),

View File

@@ -77,7 +77,7 @@ class OfferController extends Controller
public function toggleActive(Request $request) public function toggleActive(Request $request)
{ {
$data = Offers::toggle_active($request->input('id'), ($request->input('active') == 'true') ? 1 : 0); $data = Offers::toggle_active($request->input('id'), ($request->input('status_id') == 'true') ? 1 : 0);
return response()->json(['error' => 0]); return response()->json(['error' => 0]);
} }

View File

@@ -115,7 +115,7 @@ class Article extends Model implements HasMedia
public function scopeWithAvailableOffers($query) public function scopeWithAvailableOffers($query)
{ {
return $query->whereHas('offers', function ($query) { return $query->whereHas('offers', function ($query) {
$query->where('status_id', 1); $query->byStatus(1);
}); });
} }

View File

@@ -44,7 +44,7 @@ class Offers
public static function getAll() public static function getAll()
{ {
return Offer::orderBy('value', 'asc')->get(); return Offer::get();
} }
public static function get($id) public static function get($id)
@@ -77,9 +77,9 @@ class Offers
return Offer::destroy($id); return Offer::destroy($id);
} }
public static function toggle_active($id, $active) public static function toggle_active($id, $status_id)
{ {
return self::update(['status_id' => $active], $id); return self::update(['status_id' => $status_id], $id);
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -1,6 +1,10 @@
<a href="{{ route('Shop.Articles.show', ['id' => $article['semences']['article_id'] ?? false ]) }}"> <a href="{{ route('Shop.Articles.show', ['id' => $article['semences']['article_id'] ?? false ]) }}">
<div class="card"> <div class="card">
<img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top" alt="..."> @if ($article['image'] !== null)
<img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top" alt="{{ $article['product_name'] }}">
@else
<img src="img/visuel-non-disponible.jpg" class="card-img-top">
@endif
<div class="card-body"> <div class="card-body">
<div class="row card-title"> <div class="row card-title">
<div class="col-10" style="font-weight: bold; color: green;"> <div class="col-10" style="font-weight: bold; color: green;">