echo JsonResponse::error("Could not add the lab details"); exit; } } else { echo JsonResponse::accessDenied(); exit; } } else { echo JsonResponse::error("No lab type or data to add"); exit; } } elseif ($intent == 'updateLabDetails') { if (isset($_REQUEST['labType']) && $data) { $labType = $_REQUEST['labType']; $role = isset($labType_Role[$labType]) ? $labType_Role[$labType] : null; if ($role && RoleController::hasPermission($lab_attendant_id, $role, READ_WRITE)) { $lab = new LaboratoryController(); $response = $lab->updateLabDetails($labType, $data); /*echo JsonResponse::success($data); exit();*/ if ($response['status']) { echo JsonResponse::success("Successfully updated"); exit; } else { echo JsonResponse::error($response['message']); exit; } } else { echo JsonResponse::accessDenied(); exit; }