Rapport-Laravel/resources/views/form/rapport-pulmocare/1776919106-b395f03f-a115-42...

203 lines
7.8 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>
@php
// echo "<pre>";
// print_r($form->user_id);
@endphp
<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-8">
<h4 class="page-title">{{ $form->title }}</h4>
</div>
@if (!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'))
<div class="col-4">
@if ($form->link_type == 'form')
<a href="/form/history" class="float-end pt-1">View History</a>
@else
<a href="{{ url()->previous() }}" class="float-end pt-1">Back</a>
@endif
</div>
@endif
@if (isset($form->user_info))
<div class="col-12">
<h6>Submitted By: {{ $form->user_info->name }}</h6>
</div>
@endif
@php
$qrUrl = 'https://rrtscreeningtool.vgreet.in?user_id=' . $form->user_id;
@endphp
<div class="text-center mt-3">
<p><strong>Scan QR Code</strong></p>
<div id="qrcode"></div>
<br>
<a id="qrLink" target="_blank"></a>
</div>
</div> <!-- end card-body -->
</div>
<!-- end card -->
<!-- end row -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->
<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%;
}
.form-label {
font-weight: bold;
font-size: 16px;
}
</style>
@include('layouts.shared/footer-script')
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
<script src="{{ asset('assets/libs/sweetalert2/sweetalert2.min.js') }}"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#field-user_id').change(function() {
let hierarchy = $('option:selected', this).attr('hierarchy');
$('#field-hierarchy_id').val(hierarchy)
event.preventDefault();
$.ajax({
type: "GET",
url: '/form/getdoctorlist?partition={{ $form->partition }}&hierarchy=' +
hierarchy,
processData: false,
contentType: false,
success: function(data) {
$("#pageloader").fadeOut();
$('#field-contact_id').html('')
$('#field-contact_id').append($("<option></option>").attr("value", '')
.text('-- Select --'));
for (let itm of data) {
$('#field-contact_id').append($("<option></option>").attr("value",
itm.value).text(itm.display));
}
},
});
console.log(hierarchy)
})
$('#report-form').on('submit', function(event) {
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "POST",
url: '/form/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.hasOwnProperty('message') ?
'You are not mapped to any position code' :
'Data not submitted',
text: data.hasOwnProperty('message') ?
'for resolution please email Position code, L1 Manager and L2 Manager details to support1@stratawiz.com' :
'Something went wrong, please try again after some time!'
})
}
},
});
});
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0');
var yyyy = today.getFullYear();
today = yyyy + '-' + mm + '-' + dd;
var plandateField = document.getElementById('field-record_date');
plandateField.setAttribute('max', today);
});
</script>
<script>
jQuery(document).ready(function($) {
const userId = "{{ $form->user_id }}";
const url = `https://rrtscreeningtool.vgreet.in?user_id=${userId}`;
// Set link
$('#qrLink').attr('href', url).text(url);
// Generate QR
if ($('#qrcode').length) {
new QRCode(document.getElementById("qrcode"), {
text: url,
width: 200,
height: 200
});
}
});
</script>
</body>
</html>