add qrcode and arcode for test type

This commit is contained in:
Fayyazi
2019-12-21 10:38:17 +03:30
parent e098af7bb3
commit 5b08142d5b
9 changed files with 319 additions and 7 deletions
+55 -1
View File
@@ -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);
}
}