488 lines
29 KiB
PHP
488 lines
29 KiB
PHP
<!DOCTYPE html>
|
||
<html lang="en">
|
||
|
||
<head>
|
||
@include('layouts.shared/title-meta', ['title' => 'Form'])
|
||
@include('layouts.shared/head-css', ['mode' => $mode ?? '', 'demo' => $demo ?? ''])
|
||
<link href="{{ asset('assets/libs/sweetalert2/sweetalert2.min.css') }}" rel="stylesheet" type="text/css" />
|
||
</head>
|
||
<div id="pageloader">
|
||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||
</div>
|
||
|
||
<body class="loading">
|
||
<div class="account-pages">
|
||
<div class="container">
|
||
<div class="row justify-content-center">
|
||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||
<div class="card bg-pattern">
|
||
<div class="card-body p-3 row">
|
||
|
||
@if (Session::has('error'))
|
||
<div class="alert alert-danger">{{ Session::get('error') }}</div>
|
||
<br>
|
||
@endif
|
||
@if (session('success'))
|
||
<div class=" alert alert-success">{{ session('success') }}
|
||
</div>
|
||
<br>
|
||
@endif
|
||
<div class="col-12">
|
||
<h4 class="page-title">{{ $form->title }}</h4>
|
||
</div>
|
||
|
||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||
<input type="hidden" name="form_id" value="{{ $form_id }}">
|
||
@csrf
|
||
@if ($id)
|
||
<input type="hidden" name="id" value="{{ $id }}">
|
||
@endif
|
||
@if (isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||
<div class="col-md-12 mb-2">
|
||
<label for="field-user_id" class="form-label"> Select User / Territory <span
|
||
class="text-danger">*</span> </label>
|
||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||
<option value=""> -- Select -- </option>
|
||
@foreach ($form->users as $option)
|
||
<option value="{{ $option->value }}"
|
||
hierarchy="{{ $option->hierarchy_id }}"
|
||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||
{{ $option->display }}</option>
|
||
@endforeach
|
||
</select>
|
||
</div>
|
||
@endif
|
||
|
||
@foreach ($questions as $question)
|
||
@if($question->type == 'radio')
|
||
@continue;
|
||
@endif
|
||
<div class="col-md-12 mb-2">
|
||
<label for="field-{{ $question->code }}"
|
||
class="form-label">{{ $question->question }} {!! $question->required == 'yes' ? '<span class="text-danger">*</span>' : '' !!}
|
||
</label>
|
||
@switch($question->type)
|
||
@case('hidden')
|
||
<input type="{{ $question->type }}" id="field-{{ $question->code }}"
|
||
name="{{ $question->code }}"
|
||
value="{{ isset($question->value) ? $question->value : '' }}">
|
||
@break
|
||
|
||
@case('text')
|
||
@case('email')
|
||
|
||
@case('tel')
|
||
@case('date')
|
||
<input type="{{ $question->type }}" id="field-{{ $question->code }}"
|
||
name="{{ $question->code }}" class="form-control"
|
||
{{ $question->required == 'yes' ? 'required' : '' }}
|
||
value="{{ isset($question->value) ? $question->value : '' }}">
|
||
@break
|
||
|
||
@case('number')
|
||
<input type="{{ $question->type }}" min="0" max="9999999999"
|
||
step="1" id="field-{{ $question->code }}"
|
||
name="{{ $question->code }}" class="form-control"
|
||
{{ $question->required == 'yes' ? 'required' : '' }}
|
||
value="{{ isset($question->value) ? $question->value : 0 }}">
|
||
@break
|
||
|
||
@case('textarea')
|
||
<textarea id="field-{{ $question->code }}" name="{{ $question->code }}" class="form-control"
|
||
{{ $question->required == 'yes' ? 'required' : '' }}>{{ isset($question->value) ? $question->value : '' }}</textarea>
|
||
@break
|
||
|
||
@case('dropdown')
|
||
<select class="form-control" id="field-{{ $question->code }}"
|
||
name="{{ $question->code }}"
|
||
{{ $question->required == 'yes' ? 'required' : '' }}>
|
||
<option value=""> -- Select -- </option>
|
||
@foreach ($question->options as $option)
|
||
<option value="{{ $option->value }}"
|
||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||
{{ $option->display }}</option>
|
||
@endforeach
|
||
</select>
|
||
@break
|
||
|
||
@case('checkbox')
|
||
@foreach ($question->options as $option)
|
||
<div class="form-check mb-2 form-check-primary">
|
||
<input class="form-check-input" type="checkbox"
|
||
id="field-{{ $question->code }}-{{ $option->value }}"
|
||
name="{{ $question->code }}[]" value="{{ $option->value }}"
|
||
{{ isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked' : '' }}>
|
||
<label class="form-check-label"
|
||
for="field-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
|
||
</div>
|
||
@endforeach
|
||
@break
|
||
|
||
@case('radio')
|
||
@foreach ($question->options as $option)
|
||
<div class="form-check">
|
||
<input type="radio"
|
||
id="field-{{ $question->code }}-{{ $option->value }}"
|
||
name="{{ $question->code }}" class="form-check-input" value="{{$option->value}}"
|
||
{{ isset($question->value) && $question->value != $question->value ? 'checked' : '' }}>
|
||
<label class="form-check-label"
|
||
for="field-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
|
||
</div>
|
||
@endforeach
|
||
@break
|
||
|
||
@case('file')
|
||
<input type="file" id="field-{{ $question->code }}"
|
||
name="{{ $question->code }}" class="form-control" value=""
|
||
accept="image/jpg, image/jpeg, image/png" required>
|
||
@break
|
||
|
||
@case('multitextbox')
|
||
<div class="row">
|
||
@foreach ($question->options as $option)
|
||
<div class="col-6">{{ $option->display }}</div>
|
||
<div class="col-6 mb-1">
|
||
<input type="number" id="field-{{ $option->value }}"
|
||
name="{{ $option->value }}" class="form-control" required
|
||
value="{{ isset($option->val) ? $option->val : 0 }}">
|
||
</div>
|
||
@endforeach
|
||
</div>
|
||
@break
|
||
|
||
@case('radiometrix')
|
||
@foreach ($question->options as $option)
|
||
<div class="row">
|
||
<div class="col-5">{{ $option->display }}</div>
|
||
<div class="col-7 mb-1">
|
||
@php
|
||
$nn = json_decode($option->value);
|
||
@endphp
|
||
@foreach ($nn as $value)
|
||
<input type="radio"
|
||
id="field-{{ $option->display }}-{{ $value }}"
|
||
name="{{ $question->code }}[{{$option->display}}]" value="{{$value}}" class="form-check-input"
|
||
{{ isset($question->display) && $option->display != $option->display ? 'checked' : '' }}>
|
||
{{ $value }}
|
||
@endforeach
|
||
</div>
|
||
|
||
</div>
|
||
@endforeach
|
||
@break
|
||
@endswitch
|
||
</div>
|
||
@endforeach
|
||
|
||
<div class="mb-3">
|
||
<strong>How is your COPD? Take the COPD Assessment Test (CAT)</strong>
|
||
<p style="margin-bottom: 0.5rem;">
|
||
This questionnaire will help you and your healthcare professional measure the impact COPD (Chronic Obstructive Pulmonary Disease) is having on your wellbeing and daily life. Your answers, and test score, can be used by you and your healthcare professional to help improve the management of your COPD and get the greatest benefit from treatment.
|
||
</p>
|
||
<p>
|
||
For each item below, place a mark (X) in the box that best describes you currently. Be sure to only select one response for each question.
|
||
</p>
|
||
</div>
|
||
|
||
<div class="table-responsive">
|
||
<table class="table table-bordered mb-0">
|
||
<thead>
|
||
<tr>
|
||
<th style="width: 30%;"></th>
|
||
<th></th>
|
||
<th style="width: 30%;"></th>
|
||
<th class="cat-score-col">Score</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
@foreach ($questions as $question)
|
||
@if($question->type == 'radio')
|
||
@php
|
||
$parts = explode('~', $question->question);
|
||
$first = isset($parts[0]) ? $parts[0] : '';
|
||
$third = isset($parts[1]) ? $parts[1] : '';
|
||
@endphp
|
||
<tr>
|
||
<td>{{ $first }}</td>
|
||
<td>
|
||
<div class="radio-row-touching">
|
||
@foreach ($question->options as $option)
|
||
<label class="custom-radio-x">
|
||
<input type="radio"
|
||
id="field-{{ $question->code }}-{{ $option->value }}"
|
||
name="{{ $question->code }}"
|
||
value="{{ $option->value }}"
|
||
class="cat-radio-input"
|
||
{{ isset($question->value) && $question->value == $option->value ? 'checked' : '' }}>
|
||
<span class="square"></span>
|
||
</label>
|
||
@endforeach
|
||
</div>
|
||
</td>
|
||
<td>{{ $third }}</td>
|
||
<td class="cat-score-col">
|
||
<span>0</span>
|
||
</td>
|
||
</tr>
|
||
@endif
|
||
@endforeach
|
||
<tr class="cat-total-row">
|
||
<td colspan="3" style="text-align:right;">Total Score</td>
|
||
<td class="">
|
||
<span id="cat-total-score">0</span>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
@if (!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'))
|
||
<div class="text-center d-grid mt-3">
|
||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit
|
||
</button>
|
||
</div>
|
||
@endif
|
||
</form>
|
||
|
||
<div class="card mt-4">
|
||
<div class="card-header bg-light">
|
||
<strong>COPD Assessment Test (CAT) Score Interpretation</strong>
|
||
</div>
|
||
<div class="card-body p-2">
|
||
<div class="table-responsive">
|
||
<table class="table table-bordered table-sm mb-0" style="font-size: 0.95rem;">
|
||
<thead class="table-secondary">
|
||
<tr>
|
||
<th style="width: 10%;">Score</th>
|
||
<th style="width: 15%;">Impact Level</th>
|
||
<th>Inference (Broad Clinical Picture)</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><10</td>
|
||
<td>Low</td>
|
||
<td>
|
||
COPD causes a few problems and affects routine work, otherwise most days are good.<br>
|
||
• They usually cough several days a week<br>
|
||
• They get breathless when playing sports<br>
|
||
• They get exhausted easily
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>10–20</td>
|
||
<td>Medium</td>
|
||
<td>
|
||
COPD is one of the bothersome problems that they have. They are characterized by presence of about an equal number of good and bad days.<br>
|
||
• They are breathless on most days and usually wake up with bothersome symptoms.<br>
|
||
• These problems can only walk up a flight of stairs slowly.
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>21–30</td>
|
||
<td>High</td>
|
||
<td>
|
||
COPD hampers their routine work.<br>
|
||
• They are breathless walking around the home, while talking and after short exercise.<br>
|
||
• Their chest makes them feel tired and their chest symptoms disturb their sleep at night.<br>
|
||
• They feel that this chest problem is not in their control and thus are panicked.
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>31–40</td>
|
||
<td>Very high</td>
|
||
<td>
|
||
COPD stops them doing everything they want to do.<br>
|
||
• Their routine tasks such as taking a bath or shower, requires longer time than usual.<br>
|
||
• They are unable to go out of the house for shopping or meeting friends, doing housework because of their condition.<br>
|
||
• Often, they feel much better from their bed or chair.
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="mt-2" style="font-size: 0.85rem;">
|
||
<strong>Reference:</strong> COPD Assessment Test User Guide. Available at: <a href="http://www.catestonline.org/content/dam/global/catestonline/documents/CAT" target="_blank">http://www.catestonline.org/content/dam/global/catestonline/documents/CAT</a><br>
|
||
Accessed on 18th June 2024.
|
||
</div>
|
||
<div class="mt-1" style="font-size: 0.8rem; color: #666;">
|
||
<em>Disclaimer: This content is for informational purposes only. The information is not intended to serve as medical advice nor is it to be construed as a substitute for medical opinion given by a Registered Medical Practitioner. Kindly consult a qualified doctor (Registered Medical Practitioner) before starting any treatment.</em>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div> <!-- end card-body -->
|
||
|
||
</div>
|
||
<!-- end card -->
|
||
|
||
<!-- end row -->
|
||
|
||
</div> <!-- end col -->
|
||
</div>
|
||
<!-- end row -->
|
||
</div>
|
||
<!-- end container -->
|
||
</div>
|
||
<!-- end page -->
|
||
|
||
@include('layouts.shared/footer-script')
|
||
|
||
<style type="text/css">
|
||
#pageloader {
|
||
background: rgba(255, 255, 255, 0.8);
|
||
display: none;
|
||
height: 100%;
|
||
position: fixed;
|
||
width: 100%;
|
||
z-index: 9999;
|
||
}
|
||
|
||
#pageloader img {
|
||
left: 50%;
|
||
margin-left: -32px;
|
||
margin-top: -32px;
|
||
position: absolute;
|
||
top: 50%;
|
||
}
|
||
</style>
|
||
<style>
|
||
.custom-radio-x {
|
||
position: relative;
|
||
display: inline-block;
|
||
width: 28px;
|
||
height: 28px;
|
||
margin: 0;
|
||
}
|
||
.custom-radio-x:not(:last-child) {
|
||
border-right: none;
|
||
}
|
||
.custom-radio-x .square {
|
||
width: 28px;
|
||
height: 28px;
|
||
border: 2px solid #888;
|
||
border-radius: 4px 0 0 4px;
|
||
background: #fff;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 1.5rem;
|
||
color: #007bff;
|
||
transition: border-color 0.2s;
|
||
margin: 0;
|
||
}
|
||
.custom-radio-x:first-child .square {
|
||
border-radius: 4px 0 0 4px;
|
||
}
|
||
.custom-radio-x:last-child .square {
|
||
border-radius: 0 4px 4px 0;
|
||
}
|
||
.custom-radio-x:not(:first-child):not(:last-child) .square {
|
||
border-radius: 0;
|
||
}
|
||
.custom-radio-x input[type="radio"] {
|
||
opacity: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
position: absolute;
|
||
left: 0;
|
||
top: 0;
|
||
margin: 0;
|
||
z-index: 2;
|
||
cursor: pointer;
|
||
}
|
||
.custom-radio-x input[type="radio"]:checked + .square {
|
||
border-color: #007bff;
|
||
background: #e6f0ff;
|
||
}
|
||
.custom-radio-x input[type="radio"]:checked + .square::after {
|
||
content: "X";
|
||
font-weight: bold;
|
||
color: #007bff;
|
||
font-size: 1.3rem;
|
||
}
|
||
.radio-row-touching {
|
||
display: flex;
|
||
flex-direction: row;
|
||
gap: 0;
|
||
}
|
||
/* 4th column: dark color */
|
||
.cat-score-col {
|
||
background:rgb(255, 156, 156) !important;
|
||
color: #fff !important;
|
||
font-weight: bold;
|
||
text-align: center;
|
||
width: 10%;
|
||
}
|
||
.cat-total-row td {
|
||
font-weight: bold;
|
||
font-size: 1.1rem;
|
||
background: #212529 !important;
|
||
color: #fff !important;
|
||
}
|
||
</style>
|
||
|
||
|
||
<script src="{{ asset('assets/libs/sweetalert2/sweetalert2.min.js') }}"></script>
|
||
<script type="text/javascript">
|
||
jQuery(document).ready(function($) {
|
||
$('label[for="field-i_am_vey_happy"]').html("How is your COPD? Take the COPD Assessment Test (CAT)<br/>This questionnaire will help you and your healthcare professional measure the impact COPD (Chronic Obstructive Pulmonary Disease) is having on your wellbeing and daily life. Your answers, and test score, can be used by you and your healthcare professional to help improve the management of your COPD and get the greatest benefit from treatment.<br/>For each item below, place a mark (X) in the box that best describes you currently. Be sure to only select one response for each question.<br/>Example: I am very happy ~ I am very sad");
|
||
|
||
|
||
// When a .cat-radio-input is clicked, update the corresponding .cat-score-col and total
|
||
$(document).on('click', '.cat-radio-input', function() {
|
||
// Get the selected value
|
||
var selectedValue = $(this).val();
|
||
|
||
// Find the closest row (tr) and update the .cat-score-col td in that row
|
||
var $row = $(this).closest('tr');
|
||
$row.find('.cat-score-col').text(selectedValue);
|
||
|
||
// Now, recalculate the total score
|
||
var total = 0;
|
||
$('.cat-score-col').each(function() {
|
||
var val = parseInt($(this).text(), 10);
|
||
if (!isNaN(val)) {
|
||
total += val;
|
||
}
|
||
});
|
||
|
||
// Set the total into the element with id cat-total-score
|
||
$('#cat-total-score').text(total);
|
||
});
|
||
|
||
$('#report-form').on('submit', function(event) {
|
||
event.preventDefault();
|
||
$("#pageloader").fadeIn();
|
||
$.ajax({
|
||
type: "POST",
|
||
url: '/srvey/ajaxsubmit',
|
||
data: new FormData($('#report-form')[0]),
|
||
processData: false,
|
||
contentType: false,
|
||
success: function(data) {
|
||
$("#pageloader").fadeOut();
|
||
if (data.status == 'success') {
|
||
Swal.fire({
|
||
title: 'Great!',
|
||
text: 'Your data is successfully submitted!',
|
||
icon: 'success'
|
||
})
|
||
$('#report-form').trigger("reset");
|
||
} else {
|
||
Swal.fire({
|
||
icon: 'error',
|
||
title: 'Data not submitted',
|
||
text: 'Something went wrong, please try again after some time!'
|
||
})
|
||
}
|
||
},
|
||
});
|
||
});
|
||
});
|
||
</script>
|
||
</body>
|
||
|
||
</html>
|