@props(['demographyconfigId','moduleid','mandatory','results']) @php $Field=DB::table('DemographyConfig')->where('DemographyConfigId',$demographyconfigId)->get()->first(); $DisplayName=$Field->LabelValue; $ColumnName=$Field->ColumnName; $DropDownNameId=$Field->DropDownNameId; $DependentField=$Field->DependentField; $mandatory=$Field->Required; use App\Models\Demography; $DependentFieldId=explode(",",$Field->DependentFieldId); $DependentFieldColumnName=""; $DependentFieldColumnNameValue=""; try { if($DependentFieldId[0]) { $DependentFieldColumnName=Demography::GetDependentFieldColumnName($moduleid,$DependentFieldId[0]); $DependentFieldColumnNameValue=$results->$DependentFieldColumnName; } } catch(\Exception $e){} $parentDropDownListValues=[]; $LabelValue=$results->$ColumnName; $DropDownNameData=DB::table('DropDownNames')->where('DropDownNameId',$DropDownNameId)->get()->First(); $ParentDropDownNameId=$DropDownNameData->ReferenceID; $ParentColumnValue=""; $ParentColumnName=""; if($ParentDropDownNameId) { $ParentColumn=DB::table('DemographyConfig')->where('ModuleId',$moduleid)->where('DropDownNameId',$ParentDropDownNameId)->get(['ColumnName'])->first(); $ParentColumnName=$ParentColumn->ColumnName; $ParentColumnValue=$results->$ParentColumnName; } $DropdownsList=[]; if($ParentColumnValue) { //$DropdownsList=DB::table('DropDownLists') //->where('DropDownNameId',$DropDownNameId) //->where('DropDownListStatus',1) //->where('ReferenceID',$ParentColumnValue) //->get(['DropDownListId','DropDownListName','ReferenceID']); $DropdownsList= DB::table('DropDownLists') ->where('DropDownNameId', $DropDownNameId) ->whereRaw('find_in_set(?, ReferenceID)', [$ParentColumnValue]) ->where('DeletedStatus',0) ->where('DropDownListStatus',1) ->get(['DropDownListId','DropDownListName','ReferenceID']); } else { $DropdownsList=DB::table('DropDownLists')->where('DropDownNameId',$DropDownNameId)->where('DropDownListStatus',1)->get(['DropDownListId','DropDownListName','ReferenceID']); } if($mandatory==1) { $ReruiredField="required"; $DisplayredStar="*"; } else { $ReruiredField=""; $DisplayredStar=""; } //print_r($parentDropDownListValues); $checkApi=explode("/",$_SERVER['REQUEST_URI']); $apiUrl=""; if(strtolower($checkApi[1])=="api") { $apiUrl="api/"; } if($DependentField==1) { if(in_array($DependentFieldColumnNameValue,$DependentFieldId)) { $displayHide=""; } else { $displayHide="displayHide"; $RequiredField=""; } } else { $displayHide=""; } @endphp
Please fill the {{$DisplayName}}