.on("submit", "[data-form=listProjects]", function(e) {
e.preventDefault();
formSendAjax($(this), function(list) {
$(".listCards").replaceWith(list);
$('.card img').each(function(index, item){
elementObserver.observe(item, function(item) {
$(item).attr('src', $(item).attr('data-src'));
});
});
});
return false;
})
.on("change", "[data-form=listProjects] [name=type]", function() {
$(this).closest("form").submit();
$("html, body").stop().animate({scrollTop: $(".withLeftPanel").position().top-HEADER_HEIGHT}, 500);
})
public function postGetProjects(Request $request) {
$type = $request->input('type');
$projects = AdmService::getProjects(['type' => $type]);
$grid = self::grid($projects, true);
$prGrid = $grid[0];
dd($prGrid);
$f = $grid[1];
$list = self::grid($projects, true, true);
$prList = $list[0];
$fM = $list[1];
return $this->rqSuccess($this->render('front.block.listCardsGrid', [
'prGrid' => $prGrid,
'full' => $f,
'prList' => $prList,
'fullMob' => $fM
]));
}
<form class="leftPanelMenu" data-form="listProjects" data-action="{{route('front_postGetProjects')}}"
autosend>
@foreach ([
'all' => 'все',
1 => 'интерьеры квартир',
4 => 'интерьеры загородных домов',
2 => 'коммерческие интерьеры',
3 => 'архитектурные проекты',
] as $val => $name)
<label class="lpm-custField">
<input type="radio" name="type" value="{{$val}}" {{$val == 'all' ? 'checked' : ''}}>
<span><span class="hidden">{{$name}}</span><a>{{$name}}</a></span>
</label>
@endforeach
</form>