Compare commits

...

4 Commits

4 changed files with 18 additions and 14 deletions

View File

@ -105,7 +105,7 @@ class EvaluationController extends Controller
'keyword' => 'nullable|string'
]);
$user = User::findOrFail($request->input('user_id'));
$user = User::find($request->input('user_id'));
$query = TechnicalUser::query();
$query = TechnicalUser::where('user_id', $user->id);
@ -236,16 +236,16 @@ class EvaluationController extends Controller
$table->addRow();
$table->addCell(1500, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER])->addText('Level', ['bold' => true], ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
$table->addCell(4500, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER])->addText('Name', ['bold' => true], ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
$table->addCell(1500, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER])->addText('Point', ['bold' => true], ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
$table->addCell(3500, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER])->addText('Name', ['bold' => true], ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
$table->addCell(2500, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER])->addText('Point', ['bold' => true], ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
$table->addCell(2500, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER])->addText('Last Update', ['bold' => true], ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
foreach ($technicalData as $technical) {
$updated_at = $technical['updated_at'] ? Carbon::parse($technical['updated_at'])->format('d/m/Y H:i:s') : null;
$table->addRow();
$table->addCell(1500, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER, 'valign' => 'center'])->addText($technical['level'], [], ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
$table->addCell(4500)->addText($technical['name']);
$table->addCell(1500, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER, 'valign' => 'center'])->addText($technical['point'], [], ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
$table->addCell(3500)->addText($technical['name']);
$table->addCell(2500, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER, 'valign' => 'center'])->addText($technical['point'], [], ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
$table->addCell(2500)->addText($updated_at);
}

View File

@ -121,7 +121,7 @@ class TechnicalController extends Controller
->orderBy('point', 'desc')
->get();
if ($technicals->isEmpty()) {
return AbstractController::ResultError("No technicals found for this user.");
return [];
}
// Chuẩn bị dữ liệu để trả về

View File

@ -88,9 +88,11 @@ function OrganizationSettings() {
size: '40%',
header: 'Created at',
render: (row: any) => {
return (
<Box>{moment(row?.created_at).format('HH:mm:ss DD/MM/YYYY')}</Box>
)
if (row?.created_at) {
return (
<Box>{moment(row?.created_at).format('HH:mm:ss DD/MM/YYYY')}</Box>
)
}
},
},
{

View File

@ -300,11 +300,13 @@ const Profile = () => {
size: '40%',
header: 'Last update',
render: (row: any) => {
return (
<Text ta="start">
{moment(row?.updated_at).format('HH:mm:ss DD/MM/YYYY')}
</Text>
)
if (row?.updated_at) {
return (
<Text ta="start">
{moment(row?.updated_at).format('HH:mm:ss DD/MM/YYYY')}
</Text>
)
}
},
},
]