@php $name = isset($element['name']) ? $element['name'] : 'fillProjectId'; $id = 'fillProjectId'; $label = isset($element['label']) ? $element['label'] : 'Project:'; $class = 'form-control custom-select2'; if (isset($element['attributes']['class'])) { $class .= ' ' . $element['attributes']['class']; } $attributes = ['id' => $id, 'class' => $class]; if (isset($element['attributes'])) { $attributes = array_merge($attributes, $element['attributes']); } // if client is ambala foundation and employee department id is 6 // then they will get only microfinance project // determine the client is ambalaba foundation from domain url $microfinDepartmentEmploye = false; if (strpos(URL::current(), 'ambalafoundation') !== false && Auth::user()->emp_id_fk > 0 && Auth::user()->branchId == 1) { $departmentId = DB::table('hr_emp_org_info') ->where('emp_id_fk', Auth::user()->emp_id_fk) ->value('department'); if ($departmentId == 6) { $microfinDepartmentEmploye = true; } } if ($microfinDepartmentEmploye) { $options = DB::table('gnr_project') ->where('id', 1) ->select(DB::raw("CONCAT(LPAD(projectCode, 3, 0), ' - ', name) AS nameWithCode"), 'id') ->pluck('nameWithCode', 'id') ->all(); } else { if (Auth::user()->branchId != 1) { $options = DB::table('gnr_project') ->where('id', Auth::user()->project_id_fk) ->select(DB::raw("CONCAT(LPAD(projectCode, 3, 0), ' - ', name) AS nameWithCode"), 'id') ->pluck('nameWithCode', 'id') ->all(); } else { $options = ['' => 'All'] + DB::table('gnr_project') ->select(DB::raw("CONCAT(LPAD(projectCode, 3, 0), ' - ', name) AS nameWithCode"), 'id') ->pluck('nameWithCode', 'id') ->all(); } } if (isset($element['options'])) { $options = $element['options']; } $defaultValue = isset($element['defaultValue']) ? $element['defaultValue'] : ''; $col = isset($element['col']) ? 'col-xs-' . $element['col'] : 'col-xs-2'; @endphp