History file changes
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m41s Details

This commit is contained in:
Ravi Gulhane 2026-09-17 13:25:07 +05:30
parent 7f55aad9ed
commit 9e92f5f382
7 changed files with 262 additions and 3 deletions

View File

@ -168,6 +168,8 @@ class FormController extends Controller
$form = $finfo->data->form ?? $formdata; $form = $finfo->data->form ?? $formdata;
$showPositions = $form->show_positions ?? $form->show_position ?? 'no'; $showPositions = $form->show_positions ?? $form->show_position ?? 'no';
$positionColumns = $this->getAvailablePositionColumns($finfo->data->submissions ?? [], $showPositions); $positionColumns = $this->getAvailablePositionColumns($finfo->data->submissions ?? [], $showPositions);
$userAttrs = $this->userAttributeCodes($form);
$userAttrLabels = $this->resolveUserAttributeLabels($userAttrs);
$listViewData = [ $listViewData = [
'questions' => $finfo->data->questions, 'questions' => $finfo->data->questions,
'submissions' => $finfo->data->submissions, 'submissions' => $finfo->data->submissions,
@ -177,6 +179,8 @@ class FormController extends Controller
'formdata' => $formdata, 'formdata' => $formdata,
'form' => $form, 'form' => $form,
'positionColumns' => $positionColumns, 'positionColumns' => $positionColumns,
'userAttrs' => $userAttrs,
'userAttrLabels' => $userAttrLabels,
]; ];
if (\View::exists('form.'.$formdata->partition.'.list-'.$formdata->form_id)) { if (\View::exists('form.'.$formdata->partition.'.list-'.$formdata->form_id)) {
return view('form.'.$formdata->partition.'.list-'.$formdata->form_id)->with($listViewData); return view('form.'.$formdata->partition.'.list-'.$formdata->form_id)->with($listViewData);
@ -305,6 +309,7 @@ class FormController extends Controller
$sessionForm = $request->session()->get('formdata'); $sessionForm = $request->session()->get('formdata');
$canDeleteByPermission = $request->input('delete_submission') == 1 $canDeleteByPermission = $request->input('delete_submission') == 1
|| $this->sessionFlag($sessionForm, 'delete_submission'); || $this->sessionFlag($sessionForm, 'delete_submission');
$userAttrs = $this->userAttributeCodes($formdata);
foreach($submissions as $submission) { foreach($submissions as $submission) {
if (!isset($submission->user_info->name)) continue; if (!isset($submission->user_info->name)) continue;
$row = [ $row = [
@ -315,6 +320,9 @@ class FormController extends Controller
"submission_id" => $submission->id, "submission_id" => $submission->id,
"actions" => [] "actions" => []
]; ];
foreach ($userAttrs as $attr) {
$row[$attr] = $this->userAttributeValue($submission->user_info ?? null, $attr);
}
// workflow status // workflow status
if (isset($formdata->workflow) && $formdata->workflow == 'yes') { if (isset($formdata->workflow) && $formdata->workflow == 'yes') {
@ -8167,11 +8175,20 @@ class FormController extends Controller
$data = ['form' => $history->data->form, 'questions' => $history->data->questions, 'submissions' => $history->data->submissions, 'formname' => $history->data->formname, 'form_id' => $form_id, 'formdata' => $formdata, 'can_delete_submission' => $canDeleteSubmission ]; $data = ['form' => $history->data->form, 'questions' => $history->data->questions, 'submissions' => $history->data->submissions, 'formname' => $history->data->formname, 'form_id' => $form_id, 'formdata' => $formdata, 'can_delete_submission' => $canDeleteSubmission ];
} }
$userAttrs = $this->userAttributeCodes($history->data->form ?? null);
$userAttrLabels = $this->resolveUserAttributeLabels($userAttrs);
$data['userAttrs'] = $userAttrs;
$data['userAttrLabels'] = $userAttrLabels;
if($request->input('export', false)) { if($request->input('export', false)) {
$exceldata = []; $exceldata = [];
$exceldata[] = [$formdata->title]; $exceldata[] = [$formdata->title];
$exceldata[] = ['']; $exceldata[] = [''];
$headers = ['Submission Date', 'Submitted By', 'Approval Status']; $headers = ['Submission Date', 'Submitted By'];
foreach ($userAttrs as $attr) {
$headers[] = $userAttrLabels[$attr] ?? ucwords(str_replace('_', ' ', (string) $attr));
}
$headers[] = 'Approval Status';
foreach($history->data->questions as $question) { foreach($history->data->questions as $question) {
if (isset($question->type) && $question->type == 'hidden') { if (isset($question->type) && $question->type == 'hidden') {
continue; continue;
@ -8190,6 +8207,9 @@ class FormController extends Controller
$row = []; $row = [];
$row[] = $submission->createdAt; $row[] = $submission->createdAt;
$row[] = isset($submission->user_info->name) ? $submission->user_info->name : ''; $row[] = isset($submission->user_info->name) ? $submission->user_info->name : '';
foreach ($userAttrs as $attr) {
$row[] = $this->userAttributeValue($submission->user_info ?? null, $attr);
}
$row[] = isset($submission->workflow_status) ? $submission->workflow_status : ''; $row[] = isset($submission->workflow_status) ? $submission->workflow_status : '';
foreach($history->data->questions as $q => $v) { foreach($history->data->questions as $q => $v) {
if (isset($v->type) && $v->type == 'hidden') { if (isset($v->type) && $v->type == 'hidden') {
@ -10313,6 +10333,11 @@ class FormController extends Controller
$exceldata[] = ['']; $exceldata[] = [''];
$headers = ['Submission Date', 'Submitted By', 'Employee Code', 'Approval Status']; $headers = ['Submission Date', 'Submitted By', 'Employee Code', 'Approval Status'];
$userAttrs = $this->userAttributeCodes($history->data->form ?? null);
$userAttrLabels = $this->resolveUserAttributeLabels($userAttrs);
foreach ($userAttrs as $attr) {
$headers[] = $userAttrLabels[$attr] ?? ucwords(str_replace('_', ' ', (string) $attr));
}
$exportShowPositions = $history->data->form->show_positions ?? $history->data->form->show_position ?? 'no'; $exportShowPositions = $history->data->form->show_positions ?? $history->data->form->show_position ?? 'no';
$exportPositionColumns = $this->getAvailablePositionColumns($history->data->submissions ?? [], $exportShowPositions); $exportPositionColumns = $this->getAvailablePositionColumns($history->data->submissions ?? [], $exportShowPositions);
$positionLabels = [ $positionLabels = [
@ -10347,6 +10372,9 @@ class FormController extends Controller
$row[] = isset($submission->user_info->name) ? $submission->user_info->name : ''; $row[] = isset($submission->user_info->name) ? $submission->user_info->name : '';
$row[] = isset($submission->user_info->employee_code) ? $submission->user_info->employee_code : ''; $row[] = isset($submission->user_info->employee_code) ? $submission->user_info->employee_code : '';
$row[] = isset($submission->workflow_status) ? $submission->workflow_status : ''; $row[] = isset($submission->workflow_status) ? $submission->workflow_status : '';
foreach ($userAttrs as $attr) {
$row[] = $this->userAttributeValue($submission->user_info ?? null, $attr);
}
foreach ($exportPositionColumns as $positionField) { foreach ($exportPositionColumns as $positionField) {
$row[] = isset($submission->{$positionField}) ? $submission->{$positionField} : ''; $row[] = isset($submission->{$positionField}) ? $submission->{$positionField} : '';
} }
@ -12509,4 +12537,75 @@ class FormController extends Controller
Log::debug($cmd); Log::debug($cmd);
} }
/**
* Selected user attribute codes when the form is configured to show them.
*/
protected function userAttributeCodes($form): array
{
if (!$form || ($form->show_user_attributes ?? 'no') !== 'yes') {
return [];
}
$raw = $form->user_attributes ?? [];
if (!is_array($raw)) {
return [];
}
$codes = [];
foreach ($raw as $code) {
if (is_object($code)) {
$code = $code->code ?? '';
}
$code = trim((string) $code);
if ($code !== '') {
$codes[] = $code;
}
}
return array_values(array_unique($codes));
}
protected function userAttributeValue($user, string $attr): string
{
if (!$user) {
return '-';
}
$prefixed = 'attribute_' . $attr;
if (isset($user->{$attr}) && $user->{$attr} !== '') {
return (string) $user->{$attr};
}
if (isset($user->{$prefixed}) && $user->{$prefixed} !== '') {
return (string) $user->{$prefixed};
}
return '-';
}
/**
* Map user attribute codes to display names.
*/
protected function resolveUserAttributeLabels(array $codes): array
{
$labels = [];
if (empty($codes)) {
return $labels;
}
$map = [];
try {
$userAttrs = $this->getlambda('get', 'ums', 'userattribute', 'get_all');
if (isset($userAttrs->data->items) && is_array($userAttrs->data->items)) {
foreach ($userAttrs->data->items as $attr) {
if (isset($attr->code)) {
$map[$attr->code] = $attr->attribute ?? $attr->code;
}
}
}
} catch (\Throwable $e) {
// Fall back to ucwords(code) below
}
foreach ($codes as $code) {
$labels[$code] = $map[$code] ?? ucwords(str_replace('_', ' ', (string) $code));
}
return $labels;
}
} }

View File

@ -153,9 +153,14 @@ class MetricreportController extends Controller
if (isset($response->data->graph->contact_attributes) && is_array($response->data->graph->contact_attributes)) { if (isset($response->data->graph->contact_attributes) && is_array($response->data->graph->contact_attributes)) {
$contact_attribute_labels = $this->resolveContactAttributeLabels($response->data->graph->contact_attributes); $contact_attribute_labels = $this->resolveContactAttributeLabels($response->data->graph->contact_attributes);
} }
$user_attribute_labels = [];
if (isset($response->data->graph)) {
$user_attribute_labels = $this->resolveUserAttributeLabels($this->userAttributeCodes($response->data->graph));
}
//echo '<pre>'; print_r(['periods' => $response->data->periods, 'charts' => $response->data->available_charts, 'graph' => $response->data->graph, 'post' => $post, 'colors' => $colors, 'breadcrumbs' => $breadcrumbs]); exit; //echo '<pre>'; print_r(['periods' => $response->data->periods, 'charts' => $response->data->available_charts, 'graph' => $response->data->graph, 'post' => $post, 'colors' => $colors, 'breadcrumbs' => $breadcrumbs]); exit;
return $this->view('report')->with(['periods' => $response->data->periods, 'charts' => $response->data->available_charts, 'graph' => $response->data->graph, 'post' => $post , 'colors' => $colors, 'breadcrumbs' => $breadcrumbs, 'contact_attribute_labels' => $contact_attribute_labels]); return $this->view('report')->with(['periods' => $response->data->periods, 'charts' => $response->data->available_charts, 'graph' => $response->data->graph, 'post' => $post , 'colors' => $colors, 'breadcrumbs' => $breadcrumbs, 'contact_attribute_labels' => $contact_attribute_labels, 'user_attribute_labels' => $user_attribute_labels]);
} }
public function export(Request $request) { public function export(Request $request) {
@ -177,6 +182,8 @@ class MetricreportController extends Controller
} }
} }
$exceldata[] = ['']; $exceldata[] = [''];
$userAttrCodes = $this->userAttributeCodes($response->data->graph);
$userAttrLabels = $this->resolveUserAttributeLabels($userAttrCodes);
switch($response->data->post->type) { switch($response->data->post->type) {
case 'leaderboard': case 'leaderboard':
case 'scoreboard': case 'scoreboard':
@ -185,6 +192,9 @@ class MetricreportController extends Controller
$headings = $hideRank $headings = $hideRank
? ["User Id", "User Name", "Employee Code", "Designation"] ? ["User Id", "User Name", "Employee Code", "Designation"]
: ["Rank", "User Id", "User Name", "Employee Code", "Designation"]; : ["Rank", "User Id", "User Name", "Employee Code", "Designation"];
foreach ($userAttrCodes as $attr) {
$headings[] = $userAttrLabels[$attr] ?? ucwords(str_replace('_', ' ', (string) $attr));
}
//'Manager 1 Name', 'Manager 1 Emp Code', 'Manager 1 Email', 'Manager 2 Name', 'Manager 2 Emp Code', 'Manager 2 Email' //'Manager 1 Name', 'Manager 1 Emp Code', 'Manager 1 Email', 'Manager 2 Name', 'Manager 2 Emp Code', 'Manager 2 Email'
$parentSample = []; $parentSample = [];
if (!empty($response->data->graph->values)) { if (!empty($response->data->graph->values)) {
@ -223,6 +233,9 @@ class MetricreportController extends Controller
(string)($user->employee_code ?? ''), (string)($user->employee_code ?? ''),
$user->designation ?? '', $user->designation ?? '',
]; ];
foreach ($userAttrCodes as $attr) {
$rowdata[] = $this->userAttributeValue($user, $attr);
}
$parents = (isset($user->parents) && !empty((array) $user->parents)) ? (array) $user->parents : []; $parents = (isset($user->parents) && !empty((array) $user->parents)) ? (array) $user->parents : [];
foreach ($parents as $par) { foreach ($parents as $par) {
$rowdata[] = isset($par->name) ? $par->name : '-'; $rowdata[] = isset($par->name) ? $par->name : '-';
@ -294,7 +307,11 @@ class MetricreportController extends Controller
break; break;
case 'details': case 'details':
if($response->data->graph->chart == 'tabular') { if($response->data->graph->chart == 'tabular') {
$headers = ['User', 'Employee Code', 'Email', 'Designation', 'Manager 1 Name', 'Manager 1 Emp Code', 'Manager 1 Email', 'Manager 2 Name', 'Manager 2 Emp Code', 'Manager 2 Email', 'Zone', 'Region', "Area", "Territory", "Role"]; $headers = ['User', 'Employee Code', 'Email', 'Designation'];
foreach ($userAttrCodes as $attr) {
$headers[] = $userAttrLabels[$attr] ?? ucwords(str_replace('_', ' ', (string) $attr));
}
$headers = array_merge($headers, ['Manager 1 Name', 'Manager 1 Emp Code', 'Manager 1 Email', 'Manager 2 Name', 'Manager 2 Emp Code', 'Manager 2 Email', 'Zone', 'Region', "Area", "Territory", "Role"]);
foreach($response->data->graph->values->metrics as $metric) { foreach($response->data->graph->values->metrics as $metric) {
$headers[] = $metric->metric; $headers[] = $metric->metric;
} }
@ -305,6 +322,9 @@ class MetricreportController extends Controller
$row[] = $user->employee_code; $row[] = $user->employee_code;
$row[] = $user->email; $row[] = $user->email;
$row[] = $user->designation; $row[] = $user->designation;
foreach ($userAttrCodes as $attr) {
$row[] = $this->userAttributeValue($user, $attr);
}
if(isset($user->parents->{'level_'.($user->level+1)})) { if(isset($user->parents->{'level_'.($user->level+1)})) {
$manager = $user->parents->{'level_'.($user->level+1)}; $manager = $user->parents->{'level_'.($user->level+1)};
@ -589,6 +609,12 @@ class MetricreportController extends Controller
$first->user->{$prop} = $canonical->user->{$prop}; $first->user->{$prop} = $canonical->user->{$prop};
} }
} }
foreach ($this->userAttributeCodes($graph) as $attr) {
if ((!isset($first->user->{$attr}) || $first->user->{$attr} === '' || $first->user->{$attr} === '-')
&& isset($canonical->user->{$attr})) {
$first->user->{$attr} = $canonical->user->{$attr};
}
}
} }
$graph->values = array_values(array_filter($graph->values, function ($val, $i) use ($uid) { $graph->values = array_values(array_filter($graph->values, function ($val, $i) use ($uid) {
@ -629,4 +655,75 @@ class MetricreportController extends Controller
return $labels; return $labels;
} }
/**
* Selected user attribute codes when the view is configured to show them.
*/
protected function userAttributeCodes($graph): array
{
if (($graph->show_user_attributes ?? 'no') !== 'yes') {
return [];
}
$raw = $graph->user_attributes ?? [];
if (!is_array($raw)) {
return [];
}
$codes = [];
foreach ($raw as $code) {
if (is_object($code)) {
$code = $code->code ?? '';
}
$code = trim((string) $code);
if ($code !== '') {
$codes[] = $code;
}
}
return array_values(array_unique($codes));
}
protected function userAttributeValue($user, string $attr): string
{
if (!$user) {
return '-';
}
$prefixed = 'attribute_' . $attr;
if (isset($user->{$attr}) && $user->{$attr} !== '') {
return (string) $user->{$attr};
}
if (isset($user->{$prefixed}) && $user->{$prefixed} !== '') {
return (string) $user->{$prefixed};
}
return '-';
}
/**
* Map user attribute codes to display names.
*/
protected function resolveUserAttributeLabels(array $codes): array
{
$labels = [];
if (empty($codes)) {
return $labels;
}
$map = [];
try {
$userAttrs = $this->getlambda('get', 'ums', 'userattribute', 'get_all');
if (isset($userAttrs->data->items) && is_array($userAttrs->data->items)) {
foreach ($userAttrs->data->items as $attr) {
if (isset($attr->code)) {
$map[$attr->code] = $attr->attribute ?? $attr->code;
}
}
}
} catch (\Throwable $e) {
// Fall back to ucwords(code) below
}
foreach ($codes as $code) {
$labels[$code] = $map[$code] ?? ucwords(str_replace('_', ' ', (string) $code));
}
return $labels;
}
} }

View File

@ -40,6 +40,9 @@
<thead> <thead>
<tr> <tr>
<th data-priority="1">Submission Date</th> <th data-priority="1">Submission Date</th>
@foreach(($userAttrs ?? []) as $attr)
<th data-priority="1">{{ $userAttrLabels[$attr] ?? ucwords(str_replace('_', ' ', $attr)) }}</th>
@endforeach
@foreach($questions as $code => $question) @foreach($questions as $code => $question)
@if($question->type == 'hidden') @if($question->type == 'hidden')
@continue; @continue;
@ -59,6 +62,20 @@
@foreach($submissions as $submission) @foreach($submissions as $submission)
<tr> <tr>
<th>{{date("d M Y", strtotime($submission->updatedAt))}}</th> <th>{{date("d M Y", strtotime($submission->updatedAt))}}</th>
@foreach(($userAttrs ?? []) as $attr)
@php
$uaUser = $submission->user_info ?? null;
$uaVal = '-';
if ($uaUser) {
if (isset($uaUser->{$attr}) && $uaUser->{$attr} !== '') {
$uaVal = $uaUser->{$attr};
} elseif (isset($uaUser->{'attribute_'.$attr}) && $uaUser->{'attribute_'.$attr} !== '') {
$uaVal = $uaUser->{'attribute_'.$attr};
}
}
@endphp
<td>{{ $uaVal }}</td>
@endforeach
@foreach($questions as $code => $question) @foreach($questions as $code => $question)
@if($question->type == 'hidden') @if($question->type == 'hidden')
@continue; @continue;

View File

@ -67,6 +67,9 @@
<th data-priority="1">Submission Date</th> <th data-priority="1">Submission Date</th>
<th data-priority="1">Submitted By</th> <th data-priority="1">Submitted By</th>
<th data-priority="1">Employee Code</th> <th data-priority="1">Employee Code</th>
@foreach(($userAttrs ?? []) as $attr)
<th data-priority="1">{{ $userAttrLabels[$attr] ?? ucwords(str_replace('_', ' ', $attr)) }}</th>
@endforeach
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' ) @if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' )
<th data-priority="1">Workflow Status</th> <th data-priority="1">Workflow Status</th>
@endif @endif
@ -227,6 +230,9 @@
{ "data": "date" }, { "data": "date" },
{ "data": "name" }, { "data": "name" },
{ "data": "employee_code" }, { "data": "employee_code" },
@foreach(($userAttrs ?? []) as $attr)
{ "data": "{{ $attr }}" },
@endforeach
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' ) @if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' )
{ "data": "workflow_status" }, { "data": "workflow_status" },
@endif @endif

View File

@ -67,6 +67,9 @@
<th data-priority="1">Submission Date</th> <th data-priority="1">Submission Date</th>
<th data-priority="1">Submitted By</th> <th data-priority="1">Submitted By</th>
<th data-priority="1">Employee Code</th> <th data-priority="1">Employee Code</th>
@foreach(($userAttrs ?? []) as $attr)
<th data-priority="1">{{ $userAttrLabels[$attr] ?? ucwords(str_replace('_', ' ', $attr)) }}</th>
@endforeach
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' ) @if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' )
<th data-priority="1">Workflow Status</th> <th data-priority="1">Workflow Status</th>
@endif @endif
@ -227,6 +230,9 @@
{ "data": "date" }, { "data": "date" },
{ "data": "name" }, { "data": "name" },
{ "data": "employee_code" }, { "data": "employee_code" },
@foreach(($userAttrs ?? []) as $attr)
{ "data": "{{ $attr }}" },
@endforeach
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' ) @if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' )
{ "data": "workflow_status" }, { "data": "workflow_status" },
@endif @endif

View File

@ -15,6 +15,11 @@
<div class="row"> <div class="row">
<div class="col-12 pt-1"> <div class="col-12 pt-1">
<h4 class="header-title">{{$graph->name}}</h4> <h4 class="header-title">{{$graph->name}}</h4>
@php
$showUserAttrs = ($graph->show_user_attributes ?? 'no') === 'yes';
$userAttrs = ($showUserAttrs && isset($graph->user_attributes) && is_array($graph->user_attributes)) ? $graph->user_attributes : [];
$userAttrLabels = $user_attribute_labels ?? [];
@endphp
</div> </div>
<div class="col-6 pt-1"> <div class="col-6 pt-1">
@ -137,6 +142,9 @@
<tr> <tr>
@if($graph->agg_type != 'team' || $post['type'] != 'leaderboard')<th>Rank</th>@endif @if($graph->agg_type != 'team' || $post['type'] != 'leaderboard')<th>Rank</th>@endif
<th>User</th> <th>User</th>
@foreach($userAttrs as $attr)
<th>{{ $userAttrLabels[$attr] ?? ucwords(str_replace('_', ' ', $attr)) }}</th>
@endforeach
@foreach($graph->metrics as $val) @foreach($graph->metrics as $val)
@if(isset($val->is_visible) && $val->is_visible) @if(isset($val->is_visible) && $val->is_visible)
<th>{{$val->display}}</th> <th>{{$val->display}}</th>
@ -155,6 +163,9 @@
<td><img src="https://ui-avatars.com/api/?background={{$i>3?$colors[4]:$colors[$i]}}&name={{$val->rank}}" class="avatar-md"></td> <td><img src="https://ui-avatars.com/api/?background={{$i>3?$colors[4]:$colors[$i]}}&name={{$val->rank}}" class="avatar-md"></td>
@endif @endif
<td style="text-align:left;">{{ isset($val->user->name) ? $val->user->name : '' }} <br />{{ isset($val->user->designation) ? $val->user->designation : '' }}</td> <td style="text-align:left;">{{ isset($val->user->name) ? $val->user->name : '' }} <br />{{ isset($val->user->designation) ? $val->user->designation : '' }}</td>
@foreach($userAttrs as $attr)
<td>{{ $val->user->{$attr} ?? '-' }}</td>
@endforeach
@if($graph->type == 'verses') @if($graph->type == 'verses')
@foreach($graph->metrics as $m) @foreach($graph->metrics as $m)
@if(isset($m->is_visible) && $m->is_visible) @if(isset($m->is_visible) && $m->is_visible)
@ -242,6 +253,9 @@
<tr> <tr>
<th colspan="2">User</th> <th colspan="2">User</th>
<th>Employee Code</th> <th>Employee Code</th>
@foreach($userAttrs as $attr)
<th>{{ $userAttrLabels[$attr] ?? ucwords(str_replace('_', ' ', $attr)) }}</th>
@endforeach
<th>Zone</th> <th>Zone</th>
<th>Region</th> <th>Region</th>
<th>Area</th> <th>Area</th>
@ -259,6 +273,9 @@
<td><img src="{{isset($user->avatar) ? $user->avatar : ''}}" class="avatar-sm rounded-circle"></td> <td><img src="{{isset($user->avatar) ? $user->avatar : ''}}" class="avatar-sm rounded-circle"></td>
<td>{{ $user->name }} <br/>{{$user->designation}}</td> <td>{{ $user->name }} <br/>{{$user->designation}}</td>
<td>{{ isset($user->employee_code) ? $user->employee_code:''}}</td> <td>{{ isset($user->employee_code) ? $user->employee_code:''}}</td>
@foreach($userAttrs as $attr)
<td>{{ $user->{$attr} ?? '-' }}</td>
@endforeach
<td>{{ isset($user->positions->Zone) ? $user->positions->Zone : '-' }}</td> <td>{{ isset($user->positions->Zone) ? $user->positions->Zone : '-' }}</td>
<td>{{ isset($user->positions->Region) ? $user->positions->Region : '-' }}</td> <td>{{ isset($user->positions->Region) ? $user->positions->Region : '-' }}</td>
<td>{{ isset($user->positions->Area) ? $user->positions->Area : '-' }}</td> <td>{{ isset($user->positions->Area) ? $user->positions->Area : '-' }}</td>

View File

@ -29,6 +29,11 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<h4 class="header-title mb-2">{{$graph->name}}</h4> <h4 class="header-title mb-2">{{$graph->name}}</h4>
@php
$showUserAttrs = ($graph->show_user_attributes ?? 'no') === 'yes';
$userAttrs = ($showUserAttrs && isset($graph->user_attributes) && is_array($graph->user_attributes)) ? $graph->user_attributes : [];
$userAttrLabels = $user_attribute_labels ?? [];
@endphp
<div class="row"> <div class="row">
<div class="col-6 pt-1"> <div class="col-6 pt-1">
<p class="text-muted"> {!!$graph->agg_type == 'team' ? '<i class="mdi mdi-account-group" aria-hidden="true"></i>' : '<i class="mdi mdi-account" aria-hidden="true"></i>' !!} {{ucwords($graph->agg_type)}} Report</p> <p class="text-muted"> {!!$graph->agg_type == 'team' ? '<i class="mdi mdi-account-group" aria-hidden="true"></i>' : '<i class="mdi mdi-account" aria-hidden="true"></i>' !!} {{ucwords($graph->agg_type)}} Report</p>
@ -161,6 +166,9 @@
<th colspan="2">User</th> <th colspan="2">User</th>
<th>Employee Code</th> <th>Employee Code</th>
<th>Designation</th> <th>Designation</th>
@foreach($userAttrs as $attr)
<th>{{ $userAttrLabels[$attr] ?? ucwords(str_replace('_', ' ', $attr)) }}</th>
@endforeach
<th>Zone</th> <th>Zone</th>
<th>Region</th> <th>Region</th>
<th>Area</th> <th>Area</th>
@ -204,6 +212,9 @@
<td> <td>
{{ isset($val->user->designation) ? $val->user->designation : '-' }} {{ isset($val->user->designation) ? $val->user->designation : '-' }}
</td> </td>
@foreach($userAttrs as $attr)
<td>{{ $val->user->{$attr} ?? '-' }}</td>
@endforeach
<td>{{ isset($val->user->positions->Zone) ? $val->user->positions->Zone : (isset($val->user->positions->Country) ? $val->user->positions->Country : '-' ) }}</td> <td>{{ isset($val->user->positions->Zone) ? $val->user->positions->Zone : (isset($val->user->positions->Country) ? $val->user->positions->Country : '-' ) }}</td>
<td>{{ isset($val->user->positions->Region) ? $val->user->positions->Region : '-' }}</td> <td>{{ isset($val->user->positions->Region) ? $val->user->positions->Region : '-' }}</td>
@ -303,6 +314,9 @@
<tr> <tr>
<th colspan="2">User</th> <th colspan="2">User</th>
<th>Employee Code</th> <th>Employee Code</th>
@foreach($userAttrs as $attr)
<th>{{ $userAttrLabels[$attr] ?? ucwords(str_replace('_', ' ', $attr)) }}</th>
@endforeach
@if(!isset($graph->show_positions) || (isset($graph->show_positions) && $graph->show_positions)) @if(!isset($graph->show_positions) || (isset($graph->show_positions) && $graph->show_positions))
<th>Zone</th> <th>Zone</th>
<th>Region</th> <th>Region</th>
@ -321,6 +335,9 @@
<td><img src="{{isset($user->avatar) ? $user->avatar : 'https://ui-avatars.com/api/?background=random&name='.$user->name}}" class="avatar-sm rounded-circle"></td> <td><img src="{{isset($user->avatar) ? $user->avatar : 'https://ui-avatars.com/api/?background=random&name='.$user->name}}" class="avatar-sm rounded-circle"></td>
<td>{{ isset($user->name) ? $user->name : '-' }} <br/>{{isset($user->designation) ? $user->designation : '-'}}</td> <td>{{ isset($user->name) ? $user->name : '-' }} <br/>{{isset($user->designation) ? $user->designation : '-'}}</td>
<td>{{ isset($user->employee_code) ? $user->employee_code:''}}</td> <td>{{ isset($user->employee_code) ? $user->employee_code:''}}</td>
@foreach($userAttrs as $attr)
<td>{{ $user->{$attr} ?? '-' }}</td>
@endforeach
@if(!isset($graph->show_positions) || (isset($graph->show_positions) && $graph->show_positions)) @if(!isset($graph->show_positions) || (isset($graph->show_positions) && $graph->show_positions))
<td>{{ isset($user->positions->Zone) ? $user->positions->Zone : '-' }}</td> <td>{{ isset($user->positions->Zone) ? $user->positions->Zone : '-' }}</td>
<td>{{ isset($user->positions->Region) ? $user->positions->Region : '-' }}</td> <td>{{ isset($user->positions->Region) ? $user->positions->Region : '-' }}</td>