wecuro_blog/application/modules/caregivers/views/saveAuthorizationRelease.php

242 lines
9.2 KiB
PHP
Executable File

<?php
$url=$user_folder."/"."AUTH_RELEASE_".str_pad($ion_id, 6,"0",STR_PAD_LEFT).".pdf";
$Authfile=file_exists($url)?1:0;
?>
<div class="tab-content auth-release-pdf-container" id="myTabContent">
<input type="hidden" id="cg_id" value="<?php echo $nurse->caregiver_table_id;?>">
<div class="tab-pane disc_tab fade active in show" id="authorization-release-tab-dsc" role="tabpanel" aria-labelledby="" style="padding: 20px; border: 1px solid #ccc; margin-bottom: 15px; border-radius: 5px;">
<form role="form" action="<?php echo base_url(); ?>CaregiversDashboard/saveDocumentSignature" onsubmit="return validateFormSig('authorization_release_tab')" id="caregiverBasicForm" method="post" enctype="multipart/form-data" class="needs-validation auth-release-signform">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
<input type="hidden" name="documentType" value="AuthRelease">
<input type="hidden" name="id" id="caregiver_id" value="<?php if (!empty($nurse->caregiver_table_id)) echo $nurse->caregiver_table_id; ?>">
<input type="hidden" name="form_tab_status" value="0">
<input type="hidden" name="form_status" value="0">
<!-- Information Release pdf -->
<div class="row">
<div class="col-lg-12 form-group">
<?php
if($Authfile==0){
?>
<div class="w-100 ms-auto pt-4 pb-4">
<div class="center pb-1">
<img src="https://raw.githubusercontent.com/Codelessly/FlutterLoadingGIFs/master/packages/cupertino_activity_indicator_large.gif">
</div>
<h5 class="text-center timeCount"></h5>
<h4 class="text-center text-info">Don't Reload the Page</h4>
<p class="text-center p-0 m-0 timeCount-next">Please Wait We Are Creating Files...</p>
<h6 class="text-center">
<small>MAKE SURE YOU HAVE A STRONG INTERNATE CONNECTION!!</small>
</h6>
</div>
<?php
}else{
?>
<embed
src="<?php echo base_url()?><?php echo $url;?>#toolbar=0&scrollbar=0&navpanes=0&view=FitH"
type="application/pdf"
frameBorder="0"
scrolling="auto"
height="600px"
width="100%"
></embed>
<?php
}
?>
</div>
<div class="col-lg-12 form-group">
<input type="hidden" name="signature" id="signature_final_field_authorization_release_tab" value="">
<input type="hidden" name="date" id="signature_final_date_authorization_release_tab" value="">
</div>
</div>
<!-- End of Information Release pdf -->
<hr class="mt-3">
<?php
if(!in_array("AuthRelease",$signature_type)){
?>
<div id="date_signature_container_authorization_release_tab">
<div class="row mt-3">
<div class="col-lg-5 form-group">
<div style="width:fit-content;">
<label>Signature</label>
<label class="pull-right">
<span style="cursor: pointer" onclick="clearCanvas('authorization_release_tab')" class="badge badge-info">Erasess</span>
</label>
<canvas class="form-control----- cnvs-dynmv2v" id="signature_canvas_authorization_release_tab" width="400" height="200"></canvas>
</div>
</div>
<div class="col-lg-6 form-group">
<label>Date</label>
<?php $now_time=date('Y-m-d'); ?>
<input type="datetime" class="form-control" name="signature_field_date_authorization_release_tab" id="signature_field_date_authorization_release_tab" value="<?php echo date('m-d-Y'); ?> <?php echo date('H:i:s'); ?>" required readonly>
</div>
</div>
<hr>
<div class="row">
<div class="form-group col-md-12" style="padding: 20px;">
<button type="submit" name="submit" id="next_authorization_release_tab" class="btn btn-info" onclick="return signatureVal('authorization_release_tab')"><?php echo lang('Save'); ?></button>
</div>
</div>
</div>
<?php
}else{
?>
<div class="row">
<div class="form-group col-md-12" style="padding: 20px;">
<button type="button" id="next_basic_info_tab" class="btn btn-success"><?php echo lang('Start Application'); ?></button>
</div>
</div>
<?php
}
?>
<div class="container-next" id="container_next_authorization_release_tab">
<div class="row">
<div class="form-group col-md-12" style="padding: 20px;">
<button type="button" id="next_basic_info_tab" class="btn btn-success"><?php echo lang('Start Application'); ?></button>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="tab-content loading-content">
<div class="w-100 ms-auto pt-4 pb-4">
<div class="center pb-1">
<img src="https://raw.githubusercontent.com/Codelessly/FlutterLoadingGIFs/master/packages/cupertino_activity_indicator_large.gif">
</div>
<h5 class="text-center timeCount"></h5>
<h4 class="text-center text-info">Don't Reload the Page</h4>
<p class="text-center p-0 m-0 timeCount-next">Please Wait We Are Creating Files...</p>
<h6 class="text-center">
<small>MAKE SURE YOU HAVE A STRONG INTERNATE CONNECTION!!</small>
</h6>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/signature_pad/1.5.3/signature_pad.min.js"></script>
<script type="text/javascript">
$('document').ready(function(){
setSignatureCanvasDimension();
var signaturePad=new SignaturePad(document.getElementById('signature_canvas_authorization_release_tab'), {
backgroundColor: 'white',
minWidth: 0.8,
maxWidth: 1.0,
penColor: 'black'
});
});
$(window).resize(function(){
setSignatureCanvasDimension();
});
function setSignatureCanvasDimension(){
/*Set canvas dimensions based on the window size*/
var ft_canvas=document.getElementById('signature_canvas_authorization_release_tab');
var ctx=ft_canvas.getContext('2d');
var wnw=window.innerWidth;
if(wnw>576){
var w=(wnw*0.8)>400?400:wnw*0.8;
var h=w*(200/400);
}else{
var w=(wnw*0.8)-70;
var h=w*(200/400);
}
ft_canvas.width=w;
ft_canvas.height=h;
/*Set canvas dimensions based on the window size*/
}
</script>
<script type="text/javascript">
$(document).ready(function(){
$(".container-next").hide();
$(".loading-content").hide();
$("#tab0-tab").click(function(){
hitAuthReleaseAjax();
});
$("#next_basic_info_tab").click(function(){
$("#tab0-tab").removeClass('active in show');
$("#tab0").removeClass('active');
$("#tab1").addClass('active in show');
$("#tab1-tab").addClass('active');
});
});
$(document).ready(function(){
var Authfile=<?=$Authfile?>;
if(Authfile==0){
hitAuthReleaseAjax();
location.reload();
}
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$(".auth-release-signform").submit(function(e) {
e.preventDefault(); // avoid to execute the actual submit of the form.
var form = $(this);
var url = form.attr('action');
$.ajax({
type: "POST",
url: url,
data: form.serialize(), // serializes the form's elements.
beforeSend : function(){
$(".loading-content").show();
$(".auth-release-pdf-container").hide();
},
success: function(data){
Swal.fire({
position: 'center',
icon: 'success',
title: 'Signature successfully saved.',
showConfirmButton: false,
timer: 2500
});
$(".loading-content").hide();
$(".auth-release-pdf-container").show();
location.reload();
}
});
});
});
</script>
<script type="text/javascript">
function hitAuthReleaseAjax(){
var cg_id=$("#cg_id").val();
$.ajax({
url:"<?php echo base_url()?>CaregiversDashboard/authreleaseAjax",
type:"GET",
data:{cg_id:cg_id},
// dataType: "json",
beforeSend : function(){
$(".loading-content").show();
$(".auth-release-pdf-container").hide();
//loading timer
$(".timeCount-next").html("Please Wait We Are Creating Files...");
$(".timeCount").show();
var targetTime=7;
var i=0;
var x = setInterval(function(){
var distance = targetTime-i;
$(".timeCount").html(distance+"s");
if(distance<=0){
clearInterval(x);
$(".timeCount-next").html("Files Are Ready Almost....");
$(".timeCount").hide();
}
i++;
}, 1000);
//loading timer
},
success:function(data){
// alert(data);
$(".loading-content").hide();
$(".auth-release-pdf-container").show();
}
});
}
</script>