EV3-375 Termékmodul főoldal bővítés "Az aktív árlistában szereplő termékek kapcsolója"

This commit is contained in:
E98Developer 2026-06-07 23:00:40 +02:00
parent 7043d6223c
commit c034bcd440
6 changed files with 52 additions and 5 deletions

View File

@ -313,6 +313,32 @@ public function getDataTableContent(Request $request): JsonResponse
$val = $searchParameter['specialOffer'] == '1' ? 1 : 0; $val = $searchParameter['specialOffer'] == '1' ? 1 : 0;
$Product->where('specialOffer', $val); $Product->where('specialOffer', $val);
} }
// Csak az utolsó (legfrissebb) aktív árlistában szereplő termékek szűrő
// Per supplier: a legfrissebb, de még ma előtti available dátumú árlista az érvényes
if (isset($searchParameter['onlyActivePriceList']) && $searchParameter['onlyActivePriceList'] == '1') {
$today = \Carbon\Carbon::today()->format('Y-m-d');
$latestPriceListIds = DB::table('price_lists as pl')
->joinSub(
DB::table('price_lists')
->where('available', '<=', $today)
->whereNull('deleted_at')
->select('supplier_id', DB::raw('MAX(available) as max_available'))
->groupBy('supplier_id'),
'latest',
function ($join) {
$join->on('pl.supplier_id', '=', 'latest.supplier_id')
->on('pl.available', '=', 'latest.max_available');
}
)
->whereNull('pl.deleted_at')
->pluck('pl.id');
$Product->whereHas('PriceList', function ($query) use ($latestPriceListIds) {
$query->whereIn('price_lists.id', $latestPriceListIds);
});
}
if (! $request->ajax()) { if (! $request->ajax()) {
// dd($searchParameter,$Product->toSql(), $request->input()); // dd($searchParameter,$Product->toSql(), $request->input());

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,8 @@
{ {
"/js/app.js": "/js/app.js?id=9656e746371b15d28c4e4f8f816f8fc1", "/js/app.js": "/js/app.js?id=9656e746371b15d28c4e4f8f816f8fc1",
"/js/app.js.map": "/js/app.js.map?id=5e840a79ad0112917eec1908319f0c8e", "/js/app.js.map": "/js/app.js.map?id=5e840a79ad0112917eec1908319f0c8e",
"/js/admin.js": "/js/admin.js?id=f9e506f8086395d68a888529fd392b8b", "/js/admin.js": "/js/admin.js?id=cd52a43f6016a6d671a1c0719e1386c3",
"/js/admin.js.map": "/js/admin.js.map?id=a4ee20441219d5be4e7e1e6282d2ac9e", "/js/admin.js.map": "/js/admin.js.map?id=9c2a1d66ed94420158282276be1df958",
"/js/module.js": "/js/module.js?id=378a05902533f9964348d11f3598ebe7", "/js/module.js": "/js/module.js?id=378a05902533f9964348d11f3598ebe7",
"/js/module.js.map": "/js/module.js.map?id=5280840a9916b3c3f516286796bdeb49", "/js/module.js.map": "/js/module.js.map?id=5280840a9916b3c3f516286796bdeb49",
"/js/components.js": "/js/components.js?id=aac1b5221c918d1afb98a34e79620cde", "/js/components.js": "/js/components.js?id=aac1b5221c918d1afb98a34e79620cde",

View File

@ -437,7 +437,7 @@ window.ProductAdmin=function (options,ProductItem) {
console.log('---******----'); console.log('---******----');
console.log(APP.ProductAdmin.getAjaxDataJson()); console.log(APP.ProductAdmin.getAjaxDataJson());
return $.extend({}, d, { return $.extend({}, d, {
ajaxData: APP.ProductAdmin.getAjaxDataJson ajaxData: APP.ProductAdmin.getAjaxDataJson()
}); });
}, },
type: ajaxMethod type: ajaxMethod

View File

@ -4,6 +4,27 @@
@csrf @csrf
@include('admin.statistics.filter') @include('admin.statistics.filter')
{{--
<div class="form-group row">
<div class="col-sm-10">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="onlyActivePriceList" value="1" id="onlyActivePriceList">
<label class="form-check-label" for="onlyActivePriceList">
Csak árlistában szereplő termékek
</label>
</div>
</div>
</div>
--}}
<div class="form-group row filter_specialOffer" style="display: none">
<label for="specialOfferSelect" class="col-sm-2 col-form-label">Csak árlistában szereplő termékek:</label>
<div class="col-sm-10">
<input class="form-check-input" type="checkbox" name="onlyActivePriceList" value="1" id="onlyActivePriceList">
</div>
</div>
<div class="form-group row"> <div class="form-group row">
<div class="col-sm-10"> <div class="col-sm-10">
<button type="button" class="btn btn-success FormSendButton" inputmode="text" value="">Lekérdezés inditása</button> <button type="button" class="btn btn-success FormSendButton" inputmode="text" value="">Lekérdezés inditása</button>