@foreach ($mainSubSection->subSections as $sub_section)
@php $name_of_section = substr($sub_section->name['en'], strpos($sub_section->name['en'] , "Against")+8 ); @endphp
@if($name_of_section == 'Products')
@php
$name_of_section ='Products / Services';
@endphp
@endif
@if ($section->name['en'] !== 'Sales Breakdown Analysis Report' && $mainSubSection->name['en'] !== "Average Prices" )
@if ($name_of_section == "Products / Services")
@php $name_of_section = "Product Or Service Names" @endphp
@elseif($name_of_section == "Products Items")
@php $name_of_section = "Product Items" @endphp
@endif
{{-- @if($sub_section->name['en'] == '') --}}
@if ( ( false !== $found = array_search(\Str::singular($name_of_section),$viewing_names)) ||
str_contains($name_of_section,"es Analysis")
// ||
// str_contains($name_of_section,"s")
||
str_contains($name_of_section,"Sales Analysis")
// ||str_contains($name_of_section,"Sales Breakdown")
||(str_contains($name_of_section,"zones") && isset($exportables['zone']))
||(
str_contains($name_of_section,"Customers")
&& (isset($exportables['customer_name']) || isset($exportables['customer_code']))
)
||
($name_of_section == 'Sales Discounts' && (count(array_intersect(['Quantity Discount','Cash Discount','Special Discount','zones'],$viewing_names)) > 0) ) )
@if($name_of_section == 'customers')
@endif
@if($sub_section->name['en'] == 'Products Against Zones')
@endif
@endif
@elseif ($mainSubSection->name['en'] == "Average Prices" )
@php $name_of_section = substr($sub_section->name['en'], strpos($sub_section->name['en'] , "Average Prices Per ")+19 );
@endphp
@if (false !== $found = array_search(\Str::singular($name_of_section),$viewing_names) )
@endif
@elseif ( $section->name['en'] == 'Sales Breakdown Analysis Report')
{{-- @dump('qqq ') --}}
@if ($mainSubSection->name['en'] !== "Customers Nature" ||
($mainSubSection->name['en'] == "Customers Nature" && false !== $found = array_search('Customer Name',$viewing_names)) ||
($mainSubSection->name['en'] == "Service Providers" && (count(array_intersect(['Service Provider Type','Service Provider Name','Service Provider Birth Year'],$viewing_names)) >0)) )
@if ($mainSubSection->name['en'] == 'One Dimension')
@php $name_of_section = str_replace( " Sales Breakdown Analysis",'', $sub_section->name['en'] );@endphp
@elseif ($mainSubSection->name['en'] == 'Sales Discounts')
@php $name_of_section = str_replace( " Versus Discounts",'', $sub_section->name['en'] );@endphp
@elseif ($mainSubSection->name['en'] == 'Customers Nature')
@php $name_of_section = str_replace( " Versus Customers Natures Analysis",'', $sub_section->name['en'] );@endphp
@elseif ($mainSubSection->name['en'] == 'Interval Comparing')
@php $name_of_section = str_replace( " Sales Interval Comparing Analysis",'', $sub_section->name['en'] );@endphp
@if ($name_of_section == "Service Provider")
@php $name_of_section = "Service Provider Name" @endphp
@elseif($name_of_section == "Service Provider Age Range")
@php $name_of_section = "Service Provider Birth Year"; @endphp
@endif
@elseif ($mainSubSection->name['en'] == 'Two Dimension')
@php
$name_of_section = substr($sub_section->name['en'], strpos($sub_section->name['en'] , "Versus ")+7 );
$name_of_second_section = substr($sub_section->name['en'], strpos($sub_section->name['en'] , " Versus ") );
$name_of_first_section = str_replace( $name_of_second_section,'', $sub_section->name['en'] );
if($name_of_section == "Products Items"){
$name_of_section = "Product Items" ;
}
if($name_of_section === 'Products Items Ranking'){
$name_of_section = "Product Items";
}
if($name_of_section === 'Product Items Ranking'){
}
@endphp
@endif
@if ($name_of_section == "Products / Services" )
@php $name_of_section = "Product Or Service Names"; @endphp
@endif
@if (isset($name_of_first_section) && $name_of_first_section == "Products / Services" )
@php $name_of_first_section = "Product Or Service Names"; @endphp
@endif
@if (isset($name_of_first_section) && $name_of_first_section == "Products / Services" )
@php $name_of_first_section = "Branch"; @endphp
@endif
@if ($name_of_section == "Product Items Ranking" )
@php $name_of_section = "Product Items Ranking"; @endphp
@endif
{{-- @dump($mainSubSection->name['en']) --}}
@if ((!isset($name_of_first_section) && false !== $found = array_search(\Str::singular($name_of_section),$viewing_names)) ||
( isset($name_of_first_section) && (false !== $found = array_search(\Str::singular($name_of_section),$viewing_names)) && (false !== $found = array_search(\Str::singular($name_of_first_section),$viewing_names)) ) || ($sub_section->name['en'] =="Discounts Breakdown Analysis") ||
($sub_section->name['en'] == "Customers Natures Analysis") || ( ($sub_section->name['en'] == "Discounts Sales Interval Comparing Analysis") && (count(array_intersect(['Quantity Discount','Cash Discount','Special Discount'],$viewing_names)) > 0))
|| $sub_section->name['en'] == 'Products Items Versus Branches' && isset($exportables['product_item']) && isset($exportables['branch'])
// || $sub_section->name['en'] == 'Business Sectors Versus Customers Natures Analysis'
|| ($mainSubSection->name['en'] == "Service Providers")
|| ($name_of_section == "Product Items Ranking" && isset($exportables['product_item'] ) && /* not sure salah */ isset($exportables['branch'] ) )
|| ($name_of_section == "Customers" && (isset($exportables['customer_name']) ))
)
@endif
@endif
@php !isset($name_of_first_section) ?: $name_of_first_section = null ; @endphp
@endif
@endforeach