414 lines
16 KiB
PHP
Executable File

<!--sidebar end-->
<!--main content start-->
<style>
.required-field:before {content: "*";color: red;}
.errmsg{
color: #e76a6a;
font-size: 11px;
}
</style>
<?php if($this->session->flashdata('feedback_error')){ ?>
<script>
Swal.fire({
position: 'center',
icon: 'error',
title: '<?php echo $this->session->flashdata('feedback_error'); ?>',
showConfirmButton: false,
timer: 3500
})
</script>
<?php unset($_SESSION['feedback_error']);} ?>
<?php if($this->session->flashdata('feedback_success')){ ?>
<script>
Swal.fire({
position: 'center',
icon: 'success',
title: '<?php echo $this->session->flashdata('feedback_success'); ?>',
showConfirmButton: false,
timer: 3500
})
</script>
<?php unset($_SESSION['feedback_success']);} ?>
<div class="app-content content">
<section class="content-wrapper">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-md-6">
<h3 class="font-weight-bold">
<?php
switch($search)
{
case 'pendingApplication':
echo lang('Caregiver Pending Application');
break;
case 'pendingAcceptance':
echo lang('Caregiver Pending Acceptance');
break;
default:
echo lang('Caregiver');
break;
}
?>
</h3>
</div>
<div class="col-md-6 no-print pull-right">
<a href="<?php echo base_url(); ?>caregivers/addNewCaregiver">
<div class="btn-group float-right">
<button id="" class="btn btn-info btn-min-width mr-1 mb-1">
<i class="fa fa-plus-circle"></i> <?php echo lang('add_new'); ?>
</button>
</div>
</a>
</div>
</div>
</div>
<hr class="mt-0 mb-0" />
<div class="card-content collapse show">
<div class="card-body card-dashboard">
<div class="panel-body">
<div class="adv-table editable-table ">
<div class="space15"></div>
<?php
if(isset($dlGvdftsdr) && $dlGvdftsdr==202){
?>
<button onclick="deleteCaregiverAllInfoAtOnce()">Delete</button>
<button onclick="checkAllMyGtfgsdvhjgsdjfj()">Check All</button>
<?php
}
?>
<table class="table table-striped table-bordered dom-jQuery-events" id="editable-sample" cellspacing="0" width="100%">
<thead>
<tr>
<th><?php echo lang('Sl.No.'); ?></th>
<th><?php echo lang('Type'); ?></th>
<th><?php echo lang('name'); ?></th>
<th><?php echo lang('email'); ?></th>
<th><?php echo lang('phone'); ?></th>
<th class="w-15"><?php echo lang('Address (City,Zipcode)'); ?></th>
<th><?php echo lang('percentage'); ?></th>
<th class="no-print"><?php echo lang('options'); ?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- pctgelab -->
<!-- Modal -->
<div class="modal fade" id="pctgElab" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Percentage breakdown</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div id="TabPctg"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<!-- pctgelab -->
<!-- Modal For Mail -->
<div class="modal mail_modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><?php echo lang("Send Mail"); ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form id="myfrom" action="<?php echo base_url(); ?>caregivers/send_caregiver_mail" method="post" onsubmit="return ValidationEvent()">
<div class="modal-body">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
<div class="row">
<input type="hidden" name="Ion_id" id="caregiver_ion_id" value="">
<input type="hidden" name="id" id="caregiver_id" value="">
<input type="hidden" name="to_mail" class="to_mail" value="">
<div class="form-group col-md-12">
<label class="required-field"><?php echo lang('Subject'); ?></label>
<input type="text" class="form-control" name="subject" id="subject">
<span id="subjectErr" class="errmsg"></span>
</div>
<div class="form-group col-md-12">
<label class="required-field">Message Contain</label>
<textarea class="form-control" name="msg" id="mail_msgtxt">
</textarea>
<span id="msgtextErr" class="errmsg"></span>
</div>
<!-- <div id="submitbutton">
<button class="btn btn-primary submtStl" name="upload" type="submit" id="submit_pic" > Submit</button>
</div> -->
</div>
</div>
<div class="modal-footer">
<button name="upload" type="submit" id="submit_mail" class="btn btn-primary file-upload">Send</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal" style="background-color: #e76b6b;">Close</button>
</div>
</form>
</div>
</div>
</div>
<!-- Modal For Mail -->
<!--main content end-->
<!--footer start-->
<script src="https://cdn.ckeditor.com/ckeditor5/24.0.0/classic/ckeditor.js"></script>
<script>
ClassicEditor
.create( document.querySelector( '#mail_msgtxt' ) )
.catch( error => {
console.error( error );
} );
</script>
<script>
function send_email(_this){
$(".mail_modal").modal("show");
var caregiver_id = $(_this).attr("cg_id");
var to_mail = $(_this).attr("to_mail");
var ion_id = $(_this).attr("ion_id");
$('#caregiver_id').val(caregiver_id);
$('#caregiver_ion_id').val(ion_id);
$('.to_mail').val(to_mail);
}
function ValidationEvent() {
var sub = $('#subject').val();
// var msg = $('textarea[name="msg"]').val();
var msg = $('textarea#mail_msgtxt').val();
msg=msg.trim();
$('#subjectErr').text('');
$('#msgtextErr').text('');
// console.log('sub', sub);
// console.log('msg:::::', msg);
// console.log('...........');
// alert(msg);
if(sub ==''){
$('#subjectErr').text('This field is required');
return false;
}
// else if(msg == ''){
// $('#msgtextErr').text('This field is required');
// return false;
// }
else{
$('.mail_modal').modal('toggle');
return true;
}
}
</script>
<script>
$(document).ready(function () {
var table = $('#editable-sample').DataTable({
responsive: true,
"processing": true,
"serverSide": true,
"searchable": true,
"ajax": {
url: "caregivers/getNurse<?php if(isset($search) && $search != ''){ echo "/".$search; } ?>",
type: 'POST',
data: {
'<?php echo $this->security->get_csrf_token_name(); ?>' : '<?php echo $this->security->get_csrf_hash(); ?>',dlGvdftsdr:<?=isset($dlGvdftsdr)?intval($dlGvdftsdr):0?>
},
},
scroller: {
loadingIndicator: true
},
dom: "<'row'<'col-sm-5 data-table-pagelimit'l><'col-sm-6 data-table-search'f><'col-sm-1 text-center data-table-button-collection'B>>" +
"<'row'<'col-sm-12 data-table-body'tr>>" +
"<'row'<'col-sm-5 data-table-pagecountsummary'i><'col-sm-7 data-table-pagination'p>>",
buttons: [
{
extend: 'collection',
text: '...',
buttons: [
'copyHtml5',
'excelHtml5',
'csvHtml5',
'pdfHtml5',
{
extend: 'print',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6],
}
}
]
},
],
aLengthMenu: [
[10, 25, 50, 100,],
[10, 25, 50, 100]
],
iDisplayLength: 100,
"order": [[0, "desc"]],
"language": {
"lengthMenu": "_MENU_",
search: "_INPUT_",
"url": "common/assets/DataTables/languages/<?php echo $this->language; ?>.json"
},
// "columnDefs": [
// { "orderable": false, "targets": [0,5] }
// ]
});
table.buttons().container().appendTo('.custom_buttons');
});
</script>
<script type="text/javascript">
if(typeof swalAlert==="undefined"){
function swalAlert(icon,msg){
Swal.fire({
position: 'center',
icon: icon,
title: msg,
showConfirmButton: false,
timer: 1500
});
}
}
function checkAllMyGtfgsdvhjgsdjfj(){
$('input.twrdtssgdctsr5tfddt[type="checkbox"]').prop('checked', true);
}
function deleteCaregiverAllInfoAtOnce(){
if(!window.confirm("Do you want to delete?")){
return false;
}
var checkedValues=[];
$('input.twrdtssgdctsr5tfddt[type="checkbox"]').each(function() {
if ($(this).is(':checked')) {
checkedValues.push($(this).val());
}
});
var checkedValues_str='';
if(checkedValues.length>0){
checkedValues_str=checkedValues.join(',');
}
if(checkedValues_str!=""){
var request={
'caregiver_ids':checkedValues_str,
'type':'bulk'
};
var url="<?=base_url()?>dbclean/hms_delete_all_caregiver_info";
$.ajax({
type: 'POST',
url: url,
data: {
<?=$this->security->get_csrf_token_name()?>:'<?=$this->security->get_csrf_hash()?>',
body: request
},
beforeSend: function(){
// console.log("Deleting Caregiver...");
callLoader_hgy44vg(true,'Deleteing Caregiver...');
},
success: function(response) {
var data=$.parseJSON(response);
swalAlert(data.status==200?'success':'error',data.msg);
callLoader_hgy44vg(false);
$('input.twrdtssgdctsr5tfddt[type="checkbox"]').each(function() {
if ($(this).is(':checked')) {
$(this).closest('tr[role="row"]').remove();
}
});
// location.reload();
},
error: function(){
callLoader_hgy44vg(false);
console.error("something bad happened while calling ajax-dbclean/hms_delete_all_caregiver_info");
},
complete: function(){
// console.log("Completed Caregiver Deletion...");
}
});
}
}
function deleteCaregiverAllInfo(ths,caregiver_id){
try{
var caregiver_name=$(ths).find('span').text();
if(!window.confirm("Do you want to delete '"+caregiver_name+"'?")){
return false;
}
var request={
'caregiver_id':caregiver_id
};
var url="<?=base_url()?>dbclean/hms_delete_all_caregiver_info";
$.ajax({
type: 'POST',
url: url,
data: {
<?=$this->security->get_csrf_token_name()?>:'<?=$this->security->get_csrf_hash()?>',
body: request
},
beforeSend: function(){
// console.log("Deleting Caregiver...");
callLoader_hgy44vg(true,'Deleteing Caregiver...');
},
success: function(response) {
var data=$.parseJSON(response);
swalAlert(data.status==200?'success':'error',data.msg);
callLoader_hgy44vg(false);
$(ths).closest('tr[role="row"]').remove();
// location.reload();
},
error: function(){
callLoader_hgy44vg(false);
console.error("something bad happened while calling ajax-dbclean/hms_delete_all_caregiver_info");
},
complete: function(){
// console.log("Completed Caregiver Deletion...");
}
});
}
catch(error){
console.error("Error occured in function deleteCaregiverAllInfo();");
}
}
</script>