@extends('layouts.posPurchageOrder.partyCatalog') @section('maincontent') @php if(!empty($brand_active)){ $brand_active = implode(',',$brand_active); }else{ $brand_active = ''; } @endphp
@csrf
@if(!empty($sampling) )
@php $mainImage = empty($sampImage) ? asset('placeholder.png') : $sampImage; @endphp {{ $sampling->name }}
@endif @if(!empty($upcoming) )
@php $mainImage = empty($upcImage) ? asset('placeholder.png') : $upcImage; @endphp {{ $upcoming->article }}
@endif @if(!empty($new_arrival))
@php $mainImage = empty($newImage) ? asset('placeholder.png') : $newImage; @endphp {{ $new_arrival->article }}
@endif @if(!empty($repeatArticle))
@php $mainImage = empty($reptImage) ? asset('placeholder.png') : $reptImage; @endphp {{ $repeatArticle->article }}
@endif @if(!empty($clearence) )
@php $mainImage = empty($clearImage) ? asset('placeholder.png') : $clearImage; @endphp {{ $clearence->article }}
@endif
@foreach($category as $cat) @php $section= \App\Section::where('is_active',1)->where('id',$cat->id)->Where('parent_id','!=',0)->first(); if(empty($section)) { continue; } $articleList = \App\Article::where('category_id', $cat->id)->OrWhere('oc_wh_products.sub_category_id', $cat->id) ->where('oc_wh_products.is_active', '=', 1)->get()->pluck('code')->toArray(); if (($key = array_search($pos_id, $partyStore)) !== false) { $wareStock = \App\WarehouseProduct::where('warehouse_id',$warehouse->id); }else{ $wareStock = \App\WarehouseProduct_1::where('warehouse_id',1); } $warticles = $wareStock->distinct('article')->whereIn('brand_id',explode(',',$brand_active))->whereIn('article',$articleList) ->where('qty','>',0)->get()->pluck('article')->toArray(); if(empty($warticles)){ continue; } $mainImage = ''; $product = \DB::table('oc_wh_products')->Join('oc_wh_product_images', 'oc_wh_products.id', '=', 'oc_wh_product_images.product_id') ->where('category_id', $cat->id) ->OrWhere('oc_wh_products.sub_category_id', $cat->id) ->where('oc_wh_products.is_active', '=', 1) ->whereIn('oc_wh_products.code',$warticles) ->whereIn('sort_order', [0, 1]) ->orderBy('oc_wh_products.id','DESC') ->first(); if (!empty($product)) { if (!empty($product->imgname)) { $mainImage = asset('uploads/articles/photos/thumbnail' . $product->imgname); } } $mainImage = empty($mainImage) ? asset('placeholder.png') : $mainImage; @endphp @if(!empty($product)) @endif @endforeach
 
@endsection