mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-12 11:51:06 +03:30
add qrcode and arcode for test type
This commit is contained in:
@@ -18,8 +18,12 @@ class BarCodeController extends Controller
|
||||
|
||||
$Barcode = DNS1D::getBarcodePNG($Number, "C128");
|
||||
$QRCode = DNS2D::getBarcodePNG($URL, "QRCODE");
|
||||
$ShowLink = 'Show/'.$Type.'/'.$Number;
|
||||
if ($Type == 'TestType') {
|
||||
$QRCode = DNS2D::getBarcodePNG($Number, "QRCODE");
|
||||
}
|
||||
|
||||
return \MessageResponse::data(['Barcode' => 'data:image/png;base64,' .$Barcode, 'QRCode' => 'data:image/png;base64,' .$QRCode, 'ShowLink' => 'Show/'.$Type.'/'.$Number]);
|
||||
return \MessageResponse::data(['Barcode' => 'data:image/png;base64,' .$Barcode, 'QRCode' => 'data:image/png;base64,' .$QRCode, 'ShowLink' => $ShowLink]);
|
||||
}
|
||||
}
|
||||
public function generateQRcode(TestResult $TestResult)
|
||||
|
||||
@@ -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