@php
$userAccessibleBranchIds = App\Service\Service::getEngagedBranchesByUserId(Auth::user()->id);
$options = ['0' => 'All'];
$branchOptions = $options + DB::table('gnr_branch')
->select(DB::raw("CONCAT(LPAD(branchCode, 3, 0), ' - ', name) AS nameWithCode"), 'id')
->whereIn('id', $userAccessibleBranchIds)
->pluck('nameWithCode', 'id')
->all();
$productOptions = $options + DB::table('mfn_loans_product')
->where('mfn_loans_product.isPrimaryProduct', '=', 1)
->select(DB::raw("CONCAT(LPAD(code, 3, 0), ' - ', shortName) AS nameWithCode"), 'id')
->whereIn('id', $userAccessibleBranchIds)
->pluck('nameWithCode', 'id')
->all();
// GET ALL FUNDING ORGANIZATION
$intitalFundingOrgs = [''=>'--All--','-1'=>'PKSF & Others'];
$searchFundingOrgs = $intitalFundingOrgs + DB::table('mfn_funding_organization')->pluck('name', 'id')->all();
$searchElements = [
['element' => 'report_level', 'attributes' => ['print' => '0'], 'child_print' => '1', 'child_print_order' => 2],
['element' => 'branchId', 'options' => $branchOptions, 'col' => 2],
['element' => 'custom', 'id' => 'fillFundingOrg', 'name' => 'fillFundingOrg', 'type' => 'select', 'label' => 'F. Org:', 'options' => $searchFundingOrgs, 'col' => 2],
['element' => 'custom', 'id' => 'productId', 'name' => 'productNameId', 'type' => 'select', 'label' => 'Product Name:', 'options' => $productOptions, 'col' => 2],
['element' => 'dateFrom', 'label' => 'From:', 'col' => 1, 'attributes' => ['print' => '0']],
['element' => 'dateTo', 'label' => 'To:', 'col' => 1, 'attributes' => ['print' => '0']],
];
@endphp
@include('partials.searchPanel.main', ['searchElements' => $searchElements])