mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-10 19:41:07 +03:30
add qrcode and arcode for test type
This commit is contained in:
@@ -485,6 +485,60 @@ class TestResultController extends Controller
|
||||
//--------------------------------------------------------------------------Show
|
||||
public function showTestResult($id)
|
||||
{
|
||||
return view('ShowTestResult', compact('id'));
|
||||
$TestResult = TestResult::with('input_values', 'user.medical_center', 'test_type')->select('result', 'verified', 'device_id','user_id','id', 'test_type_id', 'created_at')->findOrFail($id);
|
||||
$options = [];
|
||||
foreach ($TestResult->input_values as $value) {
|
||||
$input = $value->input;
|
||||
|
||||
if ($input->parent_id != null && $input->parent['type'] == 'Form') {
|
||||
//----------------------------------------------------------------------FormType
|
||||
if ($input->type == 'Checkbox' || $input->type == 'Select' || $input['type'] == 'Radiobutton') {
|
||||
$input_options = InputValue::with('option')->where('test_result_id', $TestResult->id)->where('input_id', $input->id)->get();
|
||||
$options = [];
|
||||
foreach ($input_options as $input_option) {
|
||||
$options[] = $input_option->option->title;
|
||||
$input_values[$input->name] = $options;
|
||||
}
|
||||
|
||||
$children[$input->parent->name] = $input_values;
|
||||
$TestResult['children'] = $children;
|
||||
}
|
||||
else {
|
||||
|
||||
$children[$input->parent->name][$input->name] = $value->value;
|
||||
$TestResult['children'] = $children;
|
||||
}
|
||||
//-----------------------------------------------------------------------FormType
|
||||
}
|
||||
else {
|
||||
//-----------------------------------------------------------------------Anothertype
|
||||
if ($input->type == 'Checkbox' || $input->type == 'Select' || $input['type'] == 'Radiobutton') {
|
||||
$input_options = InputValue::with('option')->where('test_result_id', $TestResult->id)->where('input_id', $input->id)->get();
|
||||
$options = [];
|
||||
foreach ($input_options as $input_option) {
|
||||
$options[] = $input_option->option->title;
|
||||
}
|
||||
|
||||
$values[$input->name] = $options;
|
||||
$TestResult['options'] = $values;
|
||||
}
|
||||
else {
|
||||
$inputs[$input->name] = $value->value;
|
||||
$TestResult['inputs'] = $inputs;
|
||||
}
|
||||
//-----------------------------------------------------------------------Anothertype
|
||||
}
|
||||
}
|
||||
|
||||
$ImagesPath = [];
|
||||
if (count($TestResult->TitleImage)) {
|
||||
foreach ($TestResult->TitleImage as $Key => $TitleImage) {
|
||||
$ImagesPath[] = $TitleImage->path;
|
||||
}
|
||||
$TestResult['imagesPath'] = $ImagesPath;
|
||||
}
|
||||
// dd($TestResult->test_type()->device_label);
|
||||
$TestResult['device_label'] = $TestResult->test_type->device_label;
|
||||
return \MessageResponse::data($TestResult);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user