ESH/ambulance_details.php

1294 lines
58 KiB
PHP
Raw Normal View History

2024-10-23 18:28:06 +05:30
<?php include('techsyn_header.php');
include('log_entry.php');
?>
<style type="text/css">
.mobile_list {
display: none;
}
@media (max-width: 800px) {}
</style>
<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state" id="main-container">
<script type="text/javascript">
try {
ace.settings.loadState('main-container')
} catch (e) {}
</script>
<?php include('techsyn_sidebar.php'); ?>
<!--breadcrumb-->
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="ace-icon fa fa-home home-icon"></i>
<a href="#">Home</a>
</li>
<li class="#">Ambulance Management</li>
<li class="active">Ambulance Movement</li>
</ul>
</div>
<!-- End of breadcrumb -->
<?php
$row = null;
//$x=this.value;
//error_log("checkvalue".$x);
$amb_id = '';
if (isset($_REQUEST['flex_ambulance_id'])) {
$sql = "SELECT * FROM `ambulance_usage_details` where ambulance_usage_id='" . $_REQUEST['flex_ambulance_id'] . "'";
$result = mysqli_query($conn, $sql);
$num_rows = mysqli_num_rows($result);
$row = mysqli_fetch_assoc($result);
error_log("sql" . $sql);
error_log("sql1" . $row['ambulance_driver']);
error_log("sql2" . $row['ambulance_number']);
}
?>
<div class="page-content">
<div class="box box-primary" style="padding: 10px; margin: 2px 0px 50px 5px; width: 99.5%; ">
<form id="ambulance_form" method="post">
<!-- box-body-->
<div class="box-body" id="reload_amb">
<div class="row">
<div class="col-sm-2">
<div class="form-group">
<label>Date<span style="color: red">*</span></label>
<input class="form-control date-picker" style="width:100%"
value="<?php echo date_format(date_create($row['usage_date']), "d/m/Y") ?>"
name="ambulance_date" id="ambulance_date" type="text"
data-date-format="dd/mm/yyyy" /><input type="hidden"
name="ambulance_usage_id" id="ambulance_usage_id" />
</div>
<!-- /.input group -->
</div>
<div class="col-sm-3">
<div class="form-group">
<label>Ambulance Number<span style="color: red">*</span></label>
<select class="form-control select2" id="ambulance_number"
name="ambulance_number" onchange="setValue(this.value)"
data-placeholder="Choose Ambulance number">
<option disabled selected>PLEASE SELECT OPTION</option>
<?php
$sql_driver = "SELECT CONCAT(' ( ' , p.ambulance_number , ' ) ' ,p.ambulance_name) AS ambulance_name , p.id from ambulance_details_new p inner join ohc_type d ON p.ohc_type_id = d.ohc_type_id and d.ohc_type_id ='" . $_SESSION['current_ohcttype'] . "' ";
generate_options($sql_driver, $row['ambulance_id'], 'id', 'ambulance_name', '', '');
?>
</select>
<!-- /.input group -->
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label>Driver Name<span style="color: red">*</span></label>
<select class="form-control select2" id="ambulance_driver"
name="ambulance_driver" onchange="setValue(this.value)"
data-placeholder="Select Ambulance Driver">
<?php
$sql_driver = "SELECT concat(p.staff_name ,' ',p.emp_code) as pname , p.staff_id from staff_master p inner join staff_category_master d ON p.staff_category = d.id WHERE d.category_name IN ('driver' , 'Driver' , 'DRIVER')";
generate_options($sql_driver, $row['driver_id'], 'staff_id', 'pname', '', '');
?>
</select>
</div>
</div>
<div class="form-group col-sm-3">
<label>Doctor and Paramedic Name<span style="color: red">*</span></label>
<select class="chosen-select form-control" id="paramedic_id" multiple
name="paramedic_id" data-placeholder="Select Doctor and Paramedic">
<?php
$sql_paramedic = "SELECT concat(p.staff_name ,' ',p.emp_code) as pname , p.staff_id from staff_master p inner join staff_category_master d ON p.staff_category = d.id WHERE d.category_name Not IN ('driver' , 'Driver' , 'DRIVER')";
generate_options($sql_paramedic, $row['paramedic_id'], 'staff_id', 'pname', '', '');
?>
</select>
</div>
<input type="hidden" id='paramedic_id_str' name="paramedic_id_str" />
</div>
<div class="row">
<div class="form-group col-sm-2">
<label>Duty Type</label>
<select class="form-control select2" onchange="disableField()" name="ambulance_duty"
id="ambulance_duty">
<option selected disabled>SELECT OPTION</option>
<?php echo generateOption('duty_type_master', "CONCAT( duty, ' ( ' , duty_code , ' ) ' )", 'duty_id', $row['duty_type'], ''); ?>
</select>
</div>
<div class="form-group col-sm-3">
<label>From</label>
<input type="text" name="ambulance_from"
value="<?php echo $row['ambulance_from'] ?>" id="ambulance_from"
class="form-control" />
</div>
<div class="form-group col-sm-3">
<label>To</label>
<input type="text" name="ambulance_to" id="ambulance_to"
value="<?php echo $row['ambulance_to'] ?>" class="form-control" />
</div>
<div class="form-group col-sm-3">
<label>Out KM</label>
<input type="number" onchange="calculateTOTAL()" name="ambulance_out_km"
value="<?php echo $row['ambulance_out_km'] ?>" id="ambulance_out_km"
class="form-control" />
</div>
</div>
<br>
<div class="row">
<div class="form-group col-sm-2">
<label>In KM</label>
<input onchange="calculateTOTAL()" type="number" name="ambulance_in_km"
value="<?php echo $row['ambulance_in_km'] ?>" id="ambulance_in_km"
class="form-control" />
</div>
<div class="form-group col-sm-3">
<label>Total KM</label>
<input type="number" readonly name="ambulance_total_km" id="ambulance_total_km"
value="<?php echo $row['ambulance_total_km'] ?>" class="form-control" />
</div>
<div class="form-group col-sm-3">
<label>Out Time</label>
<input type="time" name="ambulance_out_time"
value="<?php echo $row['ambulance_out_time'] ?>" id="ambulance_out_time"
class="form-control" />
</div>
<div class="form-group col-sm-3">
<label>In Time</label>
<input type="time" name="ambulance_in_time"
value="<?php echo $row['ambulance_in_time'] ?>" id="ambulance_in_time"
class="form-control" />
</div>
</div>
<br>
<div class="row">
<div class="form-group col-sm-2">
<label>Patient Name<span style="color: red">*</span></label>
<div class="input-group">
<select class="form-control select2 " id="patient_name" name="patient_name"
onchange="setValue(this.value)" data-placeholder="Select Patient">
<option selected disabled>SELECT OPTION</option>
<?php echo generateOption('patient_master', 'patient_name', 'id', $row['patient_id'], ''); ?>
</select> <span onclick="addNewPatient()" class="input-group-addon"> <i
class="ace-icon fa fa-plus"></i>
</span>
</div>
</div>
<div class="form-group col-sm-4">
<label>Remarks</label>
<textarea name="ambulance_details" cols="5" rows="3" id="ambulance_details"
class="form-control"><?php echo $row['ambulance_details'] ?></textarea>
</div>
</div>
<!-- <div class="row">
<div class="col-sm-12">
<table id="myTable" class="table table-bordered order-list">
<thead>
</thead>
<?php
$row = null;
//$x=this.value;
//error_log("checkvalue".$x);
if (isset($_REQUEST['flex_ambulance_id'])) {
$sql = "select * from ambulance_details where ambulance_id='" . $_REQUEST['flex_ambulance_id'] . "'";
$result = mysqli_query($conn, $sql);
$num_rows = mysqli_num_rows($result);
$row = mysqli_fetch_array($result);
}
do {
?>
<tbody>
<tr>
<input type="hidden" name="ambulance_usage_id"
id="ambulance_usage_id"
value="<?php echo $row['ambulance_usage_id'] ?>" />
<div class="input-group">
<thead>
<tr>
</tr>
</thead>
<tr>
</tr>
<?php
$i++;
} while ($row = mysqli_fetch_array($result)) //end of while
?>
<input type="hidden" name="count_items" id="count_items"
value="" />
</tbody>
<tfoot>
<tr>
</tr>
</tfoot>
</table>
</div>
</div> -->
<!-- End box-body-->
<!--box-footer-->
<br>
<?php
$hasWriteAccess = isAccessible($_SESSION['RoleId'], $menu_key, 'W');
?>
<?php if ($hasWriteAccess) { ?>
<div class="box-footer" style="text-align: center;">
<button class="btn btn-success save_button" type="button" id="save_button"
onclick="validate();">
<i class="ace-icon fa fa-floppy-o bigger-110"></i>
Save
</button>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<button class="btn btn-info new_button" id="new_button" type="reset"
onclick="show_save_button();">
<i class="ace-icon fa fa-plus-square-o bigger-110"></i>
New
</button>
<br>
<br>
<div class="mobile_list" id="mobile_list">
<button style="width: 30%;" class="btn btn-danger new_button" type="button"
id="new_button" onclick="listForMobile()">
<i class="ace-icon fa fa-list-o bigger-110"></i>
LIST
</button>
</div>
</div>
<?php } ?>
<!--End box-footer-->
</form>
<form id="quickpatientform" method="post">
<div id="myModal" class="modal fade" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Add New Patient</h5>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body">
<label>Patient Name</label>
<input class="form-control" type="text" id="patient_name" name="patient_name">
<br>
<label>Client Name</label>
<select name="client_id" id="client_id" class="form-control">
<option selected disabled>SELECT OPTION</option>
<?php
echo generateOption('client_master', 'client_name', 'id', '', '');
?>
</select>
<br>
<label>Client Locations</label>
<select name="client_location" id="client_location" class="form-control">
<option selected disabled>SELECT OPTION</option>
</select>
<br>
<label>Mobile Number</label>
<input class="form-control" type="number" id="primary_phone"
name="primary_phone"> <br>
<label> Birth Date / Age </label>
<div class="input-group">
<input class="form-control col-sm-2 date-picker" id="dob" name="dob"
type="text" onChange="calculateAge('dob','emp_age')"
data-date-format="dd/mm/yyyy" placeholder="Date of Birth(dd/mm/yyyy)"
value="<?php echo date("d/m/Y", strtotime($dob)); ?>">
<span class="input-group-addon"> <i class="ace-icon fa fa-calendar"></i>
</span> <input class="col-xs-12 col-sm-2 form-control" type="number"
id="emp_age" name="emp_age" onChange="checkAge('emp_age','dob')"
placeholder="Age if DOB unknown">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary"
data-dismiss="modal">Cancel</button>
<button onclick="PatientValidate()" type="button"
class="btn btn-primary">Save</button>
</div>
</div>
</div>
</div>
</form>
<script>
function listForMobile() {
window.location.replace("ambulance_mobile.php");
}
function PatientValidate() {
// var name = $("#patient_name").val();
// console.log("Name "+$("#patient_name").val());
// if (name == "") {
// BootstrapDialog.alert('Please Enter Patient Name.!!!');
// return false;
// }
// var number = $("#primary_phone").val();
// if (number == "") {
// BootstrapDialog.alert('Please Enter Mobile No.!!!');
// return false;
// }
// var dob = $("#dob").val();
// if (dob == "") {
// BootstrapDialog.alert('Please Enter Birth Date.!!!');
// return false;
// }
saveQuickpatient();
}
function saveQuickpatient() {
$.ajax({
url: 'save_patient.php',
type: "POST",
data: $("#quickpatientform").serialize(),
success: function(data) {
BootstrapDialog.alert('Patient Details Saved Successfully.');
$("#dob").val("");
$("#emp_age").val("");
$("#primary_phone").val("");
$("#client_id").val("");
$("#patient_name").val("");
return;
},
error: function(data) {
BootstrapDialog.alert('Error Saving patient Details');
return;
}
});
$('.close').click();
location.reload();
}
function checkAge(ageField, dobField) {
var age = $("#" + ageField).val();
// if($("#"+dobField).val()==''){
var dobCal = getCalculatedDOBFromAge(age);
$("#" + dobField).datepicker('setDate', dobCal);
// }
}
function calculateAge(dobField, ageField) {
var dob = $("#" + dobField).val();
//if(dob!=''){
var age = getAge(age);
$("#" + ageField).val(age);
// }
}
function addNewPatient() {
$("#myModal").modal('show');
}
</script>
</div>
<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state grigbolte" id="main-container">
<script type="text/javascript">
try {
ace.settings.loadState('main-container')
} catch (e) {}
</script>
<br>
<br>
<!--breadcrumb-->
<div class="main-content">
<div class="main-content-inner">
<!-- End of breadcrumb -->
<div class="page-content" style="margin-top: -47px;">
<div id="flexigridDiv" class="table-responsive">
<form><input type="hidden" name="f1" method="post" id="flex_appointment_form"
action="bio_medical_waste_generation_excel.php">
<div id="flex1" style="width:100%">
<input type="hidden" name="flex_ambulance_id" id="flex_ambulance_id" />
</div>
</form>
<form name="export_form" method="post" id="export_form" action="">
<input type="hidden" name="pdf_action" id="pdf_action"
value="ambulance_move_pdf.php" />
<input type="hidden" name="excel_action" id="excel_action"
value="excel_ambulance.php" />
</form>
</div>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<script type="text/javascript">
$(function() {
var w = screen.width * .90;
var h = 0;
h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .75;
$("#flex1").flexigrid({
url: 'ambulance_details_script.php',
dataType: 'json',
colModel: [
{
display: 'Sr',
name: 'count',
width: 25,
sortable: false,
align: 'left'
},
{
display: '',
name: 'link',
width: 100,
sortable: false,
align: 'left'
},
{
display: ' Date',
name: 'usage_date',
width: 120,
sortable: true,
align: 'left'
},
{
display: 'Ambulance number',
name: 'ambulance_id',
width: 130,
sortable: true,
align: 'left'
},
{
display: 'Driver Name',
name: 'ambulance_driver',
width: 130,
sortable: true,
align: 'left'
},
{
display: 'Dr And Paramedics',
name: 'paramedics',
width: 130,
sortable: true,
align: 'left'
},
{
display: 'Patient Name',
name: 'patient_id',
width: 130,
sortable: true,
align: 'left'
},
{
display: 'Client',
name: 'client_id',
width: 130,
sortable: true,
align: 'left'
},
{
display: 'Client Location',
name: 'client_id',
width: 130,
sortable: true,
align: 'left'
},
{
display: 'Duty Type',
name: 'duty_type',
width: 130,
sortable: true,
align: 'left'
},
{
display: 'From ',
name: 'ambulance_from',
width: 120,
sortable: true,
align: 'left'
},
{
display: 'To',
name: 'ambulance_to',
width: 120,
sortable: true,
align: 'left'
},
// {
// display: 'Type of Duty',
// name: 'ambulance_duty',
// width: w * .07,
// sortable: false,
// align: 'left'
// },
],
buttons: [
// {name: 'Add', bclass: 'add', onpress : add},
//{separator: true},
//{name: 'PDFReport', bclass: 'print', onpress : pdfReport},
// {separator: true},
{
name: 'PDF',
bclass: 'print',
onpress: pdf
},
{
separator: true
},
{
name: 'Excel',
bclass: 'print_excel',
onpress: excel
},
{
name: 'Download Template',
bclass: 'print_excel',
onpress: download_template
},
{
separator: true
},
{
name: 'Upload Excel',
bclass: 'print_excel',
onpress: upload_excel
},
{
separator: true
}
],
searchitems: [{
display: 'Select Filter'
}, {
display: 'Ambulance number',
name: 'ambulance_number'
},
{
display: 'Driver',
name: 'ambulance_driver'
},
{
display: 'patient_name',
name: 'ambulance_used'
},
{
display: 'Duty Type',
name: 'ambulance_duty'
},
{
display: 'Ambulance Date(DD/MM/YYYY)',
name: 'ambulance_date'
},
{
display: 'Ambulance Date Between(DD/MM/YYYY-DD/MM/YYYY)',
name: 'ambulance_date_between'
},
],
sortname: "usage_date",
sortorder: "desc",
usepager: true, //pagination
//title:"Employee OPD",
useRp: true,
rp: 50, //records per page
showTableToggleBtn: false, //toggle button for the whole table
resizable: true,
// width: w,
height: h,
singleSelect: true
});
});
function add() {
$("#ambulance_date").val("");
$("#ambulance_number").val("");
$("#ambulance_driver").val("");
$('#paramedic_id').val("");
$('#paramedic_id').trigger('chosen:updated');
$("#paramedic_id_str").val("");
$('#ambulance_from').val("");
$("#ambulance_to").val("");
$("#ambulance_out_km").val("");
$("#ambulance_in_km").val("");
$('#ambulance_total_km').val("");
$("#ambulance_out_time").val("");
$("#ambulance_in_time").val("");
$("#ambulance_duty").val("");
$("#ambulance_used").val("");
$("#ambulance_details").val("");
$("#ambulance_id").val("");
$('#modal-add-ambulance-form').modal("show");
}
function save_ambulance_details() {
$.ajax({
url: 'save_ambulance_details.php',
type: "POST",
data: $("#ambulance_movement_form").serialize(),
success: function(data) {
BootstrapDialog.alert('Ambulance Usage Saved Successfully.');
$("#flex1").flexReload();
$("#ambulance_date").val("");
$("#ambulance_number").val("");
$("#ambulance_driver").val("");
$('#paramedic_id').val("");
$('#paramedic_id').trigger('chosen:updated');
$('#ambulance_from').val("");
$("#ambulance_to").val("");
$("#ambulance_out_km").val("");
$("#ambulance_in_km").val("");
$('#ambulance_total_km').val("");
$("#ambulance_out_time").val("");
$("#ambulance_in_time").val("");
$("#ambulance_duty").val("");
$("#ambulance_used").val("");
$("#ambulance_details").val("");
$("#ambulance_id").val("");
return;
},
error: function(data) {
BootstrapDialog.alert('Error Saving Ambulance Usage');
return;
}
});
$('.close').click();
}
function show_save_button() {
$("#save_button").show();
$('#paramedic_id').val("");
$('#paramedic_id').trigger('chosen:updated');
$("#ambulance_id0").val("");
}
function open_ambulance_move(flex_ambulance_id, action) {
if (action == "V") {
//$(".save_button").hide()
location.href = "view_ambulance_details.php?flex_ambulance_id=" + flex_ambulance_id + "";
$(".save_button").hide()
} else {
location.href = "ambulance_details.php?flex_ambulance_id=" + flex_ambulance_id + "";
}
}
function delete_ambulance_form(ambulance_id) {
$.ajax({
url: 'delete_ambulance_details.php',
data: {
ambulance_id: ambulance_id
},
type: 'POST',
dataType: 'json',
success: function(data) {
if (data == 'SUCCESS') {
BootstrapDialog.alert(' Ambulance Deleted Successfully');
$("#flex1").flexReload();
return;
}
},
error: function(data) {
BootstrapDialog.alert('Error Deleting Ambulance');
return;
}
});
}
function open_ambulance_form(ambulance_id, access) {
if (access == 'V') {
$("#save_button").hide()
} else if (access == 'E')
$("#save_button").show()
$.ajax({
url: 'select_ambulance_details.php',
data: {
ambulance_id: ambulance_id
},
type: 'POST',
dataType: 'json',
success: function(data) {
// alert(data.paramedic_id);
$("#ambulance_date").val(myDateFormat(data.usage_date));
$("#ambulance_usage_id").val(data.ambulance_usage_id);
$("#ambulance_number").val(data.ambulance_id);
$("#city").val(data.city);
$("#ambulance_driver").val(data.driver_id).trigger("selected");
paramedicarray = data.paramedic_id.split(",");
$('#paramedic_id').val(paramedicarray);
$('#paramedic_id').trigger('chosen:updated');
$("#ambulance_from").val(data.ambulance_from);
$("#ambulance_to").val(data.ambulance_to);
$("#ambulance_out_km").val(data.ambulance_out_km);
$("#ambulance_in_km").val(data.ambulance_in_km);
$("#ambulance_total_km").val(data.ambulance_total_km);
$("#ambulance_out_time").val(data.ambulance_out_time);
$("#ambulance_in_time").val(data.ambulance_in_time);
$("#ambulance_duty").val(data.duty_type).trigger("selected");
$("#ambulance_details").val(data.ambulance_details);
$("#ambulance_used").val(data.ambulance_used);
$("#ambulance_id").val(data.ambulance_id);
$("#patient_name").val(data.patient_id).trigger("selected");
$(".select2").select2();
//$('#modal-add-ambulance-form').modal("show");
},
error: function(data) {
BootstrapDialog.alert('Error Populating Ambulance Details');
return;
}
});
}
function pdf() {
window.open('ajax_pdf.php', 'Ambulance Lis');
}
function excel() {
window.open('ajax_excel.php', 'Ambulance List');
}
function upload_excel() {
window.location = 'upload_excel_ambulance_usage.php';
}
function download_template() {
window.location = 'templates/ambulance_usage_format.xlsx';
}
function myDateFormat(date) {
var d = new Date(date);
var day = d.getDate();
var m = d.getMonth() + 1;
var y = d.getFullYear();
if (day < 10) {
day = '0' + day;
}
if (m < 10) {
m = `0${m}`;
}
return day + "-" + m + "-" + y;
}
function setValue(value) {
// body....
$.ajax({
url: 'ambulance_getdata.php',
data: {
ambulance_id: value
},
type: 'POST',
dataType: 'json',
success: function(data) {
if (data.success == "true") {
$("#ambulance_out_km").val(data.ambulance_in_km);
return;
}
},
error: function(data) {
BootstrapDialog.alert('Error Ambulance details not found');
return;
}
});
}
</script>
<?php include('techsyn_footer.php'); ?>
</div>
<!-- End of page-content -->
</div>
</div>
</div>
<script>
function disableField() {
var duty = $("#ambulance_duty").val();
$.ajax({
type: 'post',
url: 'get_duty_type.php',
data: {
id: duty
},
success: function(data) {
let duty = JSON.parse(data);
// alert(data);
if (duty === "SPOT TREATMENT") {
// $("#ambulance_to").attr('disabled', 'disabled');
// $("#ambulance_from").attr('disabled', 'disabled');
// $("#ambulance_out_km").attr('disabled', 'disabled');
// $("#ambulance_in_km").attr('disabled', 'disabled');
$("#ambulance_to").val("NA");
$("#ambulance_from").val("NA");
$("#ambulance_out_km").val("0");
$("#ambulance_in_km").val("0");
$('#ambulance_total_km').val("0");
var date = new Date();
var currentTime = date.toString().substring(16, 21);
// alert(currentTime);
$("#ambulance_out_time").val(currentTime);
$("#ambulance_in_time").val(currentTime);
} else {
// $("#ambulance_to").removeAttr('disabled');
// $("#ambulance_from").removeAttr('disabled');
// $("#ambulance_out_km").removeAttr('disabled');
// $("#ambulance_in_km").removeAttr('disabled');
$("#ambulance_to").val("");
$("#ambulance_from").val("");
$("#ambulance_out_km").val("");
$("#ambulance_in_km").val("");
$("#ambulance_out_time").val("");
$("#ambulance_in_time").val("");
}
},
error: function(data) {
}
})
}
$(document).on('change', '#client_id', function() {
let client_id = $("#client_id").val();
$('#client_location').html(" ");
$('#client_location').append('<option value=""> </option>');
$.ajax({
type: 'post',
url: 'get_location.php',
data: {
client_id: client_id
},
dataType: 'json',
success: function(data) {
if (data != '' && data != null) {
// alert(data);
$("#client_location").append(data);
}
},
error: function(data) {
}
})
});
function validate() {
var ambulance_date = $('#ambulance_date').val();
if (ambulance_date == '') {
BootstrapDialog.alert('Please Enter Ambulance Date.!!!');
return false;
}
var ambulance_number = $('#ambulance_number').val();
if (ambulance_number == '' || ambulance_number == null) {
BootstrapDialog.alert('Please Enter Ambulance Number.!!!');
return false;
}
var ambulance_driver = $('#ambulance_driver').val();
if (ambulance_driver == '') {
BootstrapDialog.alert('Please Enter Driver Name.!!!');
return false;
}
var patient_name = $("#patient_name").val();
if (patient_name == null || patient_name == '') {
BootstrapDialog.alert('Please Select Patient Name.!!!');
return false;
}
var ambulance_duty = $('#ambulance_duty').val();
if (ambulance_duty == '' || ambulance_duty == null) {
BootstrapDialog.alert('Please Enter Duty Type.!!!');
return false;
}
var ambulance_from = $('#ambulance_from').val();
if (ambulance_from == '') {
BootstrapDialog.alert('Please Enter Ambulance From.!!!');
return false;
}
var ambulance_to = $('#ambulance_to').val();
if (ambulance_to == '') {
BootstrapDialog.alert('Please Enter Ambulance To.!!!');
return false;
}
var ambulance_out_time = $('#ambulance_out_time').val();
if (ambulance_out_time == '') {
BootstrapDialog.alert('Please Enter Ambulance Out Time.!!!');
return false;
}
var ambulance_in_time = $('#ambulance_in_time').val();
if (ambulance_in_time == '') {
BootstrapDialog.alert('Please Enter Ambulance In Time.!!!');
return false;
}
var ambulance_total_km = $('#ambulance_total_km').val();
if (ambulance_total_km == '' || ambulance_total_km < 0) {
BootstrapDialog.alert('Please Enter Correct Ambulance In & Out Details.!!!');
return false;
}
// var ambulance_details = $('#ambulance_details').val();
// if (ambulance_details == '') {
// BootstrapDialog.alert('Please Enter Ambulance Details.!!!');
// return false;
// }
save();
}
</script>
<style>
#modal-add-ailment {
overflow-y: scroll;
}
</style>
<?php include('techsyn_footer.php'); ?>
<script type="text/javascript">
$('.select2').select2()
jQuery(function($) {
var myTable =
$('#dynamic-table')
.DataTable({
bAutoWidth: false,
"aoColumns": [{
"bSortable": false
},
null, null, null, null, null,
{
"bSortable": false
}
],
"aaSorting": [],
select: {
style: 'multi'
}
});
var defaultCopyAction = myTable.button(1).action();
myTable.button(1).action(function(e, dt, button, config) {
defaultCopyAction(e, dt, button, config);
$('.dt-button-info').addClass('gritter-item-wrapper gritter-info gritter-center white');
});
var defaultColvisAction = myTable.button(0).action();
myTable.button(0).action(function(e, dt, button, config) {
defaultColvisAction(e, dt, button, config);
if ($('.dt-button-collection > .dropdown-menu').length == 0) {
$('.dt-button-collection')
.wrapInner('<ul class="dropdown-menu dropdown-light dropdown-caret dropdown-caret" />')
.find('a').attr('href', '#').wrap("<li />")
}
$('.dt-button-collection').appendTo('.tableTools-container .dt-buttons')
});
setTimeout(function() {
$($('.tableTools-container')).find('a.dt-button').each(function() {
var div = $(this).find(' > div').first();
if (div.length == 1) div.tooltip({
container: 'body',
title: div.parent().text()
});
else $(this).tooltip({
container: 'body',
title: $(this).text()
});
});
}, 500);
myTable.on('select', function(e, dt, type, index) {
if (type === 'row') {
$(myTable.row(index).node()).find('input:checkbox').prop('checked', true);
}
});
myTable.on('deselect', function(e, dt, type, index) {
if (type === 'row') {
$(myTable.row(index).node()).find('input:checkbox').prop('checked', false);
}
});
$('th input[type=checkbox], td input[type=checkbox]').prop('checked', false);
$('#dynamic-table > thead > tr > th input[type=checkbox], #dynamic-table_wrapper input[type=checkbox]').eq(
0).on('click', function() {
var th_checked = this.checked;
$('#dynamic-table').find('tbody > tr').each(function() {
var row = this;
if (th_checked) myTable.row(row).select();
else myTable.row(row).deselect();
});
});
$('#dynamic-table').on('click', 'td input[type=checkbox]', function() {
var row = $(this).closest('tr').get(0);
if (this.checked) myTable.row(row).deselect();
else myTable.row(row).select();
});
$(document).on('click', '#dynamic-table .dropdown-toggle', function(e) {
e.stopImmediatePropagation();
e.stopPropagation();
e.preventDefault();
});
var active_class = 'active';
$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function() {
var th_checked = this.checked;
$(this).closest('table').find('tbody > tr').each(function() {
var row = this;
if (th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0)
.prop('checked', true);
else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop(
'checked', false);
});
});
$('#simple-table').on('click', 'td input[type=checkbox]', function() {
var $row = $(this).closest('tr');
if ($row.is('.detail-row ')) return;
if (this.checked) $row.addClass(active_class);
else $row.removeClass(active_class);
});
$('[data-rel="tooltip"]').tooltip({
placement: tooltip_placement
});
function tooltip_placement(context, source) {
var $source = $(source);
var $parent = $source.closest('table')
var off1 = $parent.offset();
var w1 = $parent.width();
var off2 = $source.offset();
if (parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2)) return 'right';
return 'left';
}
/***************/
$('.show-details-btn').on('click', function(e) {
e.preventDefault();
$(this).closest('tr').next().toggleClass('open');
$(this).find(ace.vars['.icon']).toggleClass('fa-angle-double-down').toggleClass(
'fa-angle-double-up');
});
/***************/
})
function calculateTOTAL() {
var ambulance_out_km = $("#ambulance_out_km").val();
var ambulance_in_km = $("#ambulance_in_km").val();
if (ambulance_out_km != null && ambulance_out_km != '' && ambulance_in_km != null && ambulance_in_km != '') {
ambulance_out_km = parseFloat(ambulance_out_km);
ambulance_in_km = parseFloat(ambulance_in_km);
if (ambulance_out_km != 0.0)
var total_km = (ambulance_in_km - ambulance_out_km);
$("#ambulance_total_km").val(total_km.toFixed(1));
}
}
function save() {
$("#paramedic_id_str").val($("#paramedic_id").val());
$.ajax({
url: 'save_ambulance_details.php ',
type: "POST",
data: $("#ambulance_form").serialize(),
success: function(data) {
BootstrapDialog.alert('Ambulance Details Saved Successfully.');
$("#ambulance_date").val("");
$("#ambulance_number").val("");
$("#ambulance_driver").val("");
$('#paramedic_id').val("");
$('#paramedic_id').trigger('chosen:updated');
$("#paramedic_id_str").val("");
$('#ambulance_from').val("");
$("#ambulance_to").val("");
$("#ambulance_out_km").val("");
$("#ambulance_in_km").val("");
$('#ambulance_total_km').val("");
$("#ambulance_out_time").val("");
$("#ambulance_in_time").val("");
$("#ambulance_duty").val("");
$("#ambulance_used").val("");
$("#ambulance_details").val("");
$("#ambulance_id").val("");
$("#flex1").flexReload();
// location.href = "ambulance_details.php";
return;
},
error: function(data) {
BootstrapDialog.alert('Error Saving Ambulance Details');
return;
}
});
$('.close').click();
// location.href="procurement_list.php";
}
$('.date-picker').datepicker({
autoclose: true,
format: 'dd/mm/yyyy'
}).next().on(ace.click_event, function() {
$(this).prev().focus();
});
</script>
<!-- bootstrap & fontawesome -->
<link rel="stylesheet" href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />
<!-- page specific plugin styles -->
<link rel="stylesheet" href="assets/css/jquery-ui.custom.min.css" />
<link rel="stylesheet" href="assets/css/chosen.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-datepicker3.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-timepicker.min.css" />
<link rel="stylesheet" href="assets/css/daterangepicker.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-colorpicker.min.css" />
<script type="text/javascript" src="js/typeahead.bundle.js"></script>
<script src="assets/js/jquery-ui.custom.min.js"></script>
<script src="assets/js/jquery.ui.touch-punch.min.js"></script>
<script src="assets/js/chosen.jquery.min.js"></script>
<script src="assets/js/spinbox.min.js"></script>
<script src="assets/js/bootstrap-datepicker.min.js"></script>
<script src="assets/js/bootstrap-timepicker.min.js"></script>
<script src="assets/js/jquery.dataTables.min.js"></script>
<script src="assets/js/jquery.dataTables.bootstrap.min.js"></script>
<script src="assets/js/dataTables.buttons.min.js"></script>
<script src="assets/js/buttons.flash.min.js"></script>
<script src="assets/js/buttons.html5.min.js"></script>
<script src="assets/js/buttons.print.min.js"></script>
<script src="assets/js/buttons.colVis.min.js"></script>
<script src="assets/js/dataTables.select.min.js"></script>
<script src="assets/js/moment.min.js"></script>
<script src="assets/js/daterangepicker.min.js"></script>
<script src="assets/js/bootstrap-datetimepicker.min.js"></script>
<script src="assets/js/bootstrap-colorpicker.min.js"></script>
<script src="assets/js/jquery.knob.min.js"></script>
<script src="assets/js/autosize.min.js"></script>
<script src="assets/js/jquery.inputlimiter.min.js"></script>
<script src="assets/js/jquery.maskedinput.min.js"></script>
<script src="assets/js/bootstrap-tag.min.js"></script>
<script src="assets/js/ace-elements.min.js"></script>
<script type="text/javascript">
jQuery(function($) {
$('#id-disable-check').on('click', function() {
var inp = $('#form-input-readonly').get(0);
if (inp.hasAttribute('disabled')) {
inp.setAttribute('readonly', 'true');
inp.removeAttribute('disabled');
inp.value = "This text field is readonly!";
} else {
inp.setAttribute('disabled', 'disabled');
inp.removeAttribute('readonly');
inp.value = "This text field is disabled!";
}
});
if (!ace.vars['touch']) {
$('.chosen-select').chosen({
allow_single_deselect: true
});
$(window)
.off('resize.chosen')
.on('resize.chosen', function() {
$('.chosen-select').each(function() {
var $this = $(this);
$this.next().css({
'width': $this.parent().width()
});
})
}).trigger('resize.chosen');
//resize chosen on sidebar collapse/expand
$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
if (event_name != 'sidebar_collapsed') return;
$('.chosen-select').each(function() {
var $this = $(this);
$this.next().css({
'width': $this.parent().width()
});
})
});
$('#chosen-multiple-style .btn').on('click', function(e) {
var target = $(this).find('input[type=radio]');
var which = parseInt(target.val());
if (which == 2) $('#form-field-select-4').addClass('tag-input-style');
else $('#form-field-select-4').removeClass('tag-input-style');
});
}
$('[data-rel=tooltip]').tooltip({
container: 'body'
});
$('[data-rel=popover]').popover({
container: 'body'
});
autosize($('textarea[class*=autosize]'));
$('textarea.limited').inputlimiter({
remText: '%n character%s remaining...',
limitText: 'max allowed : %n.'
});
//"jQuery UI Slider"
//range slider tooltip example
$("#slider-range").css('height', '200px').slider({
orientation: "vertical",
range: true,
min: 0,
max: 100,
values: [17, 67],
slide: function(event, ui) {
var val = ui.values[$(ui.handle).index() - 1] + "";
if (!ui.handle.firstChild) {
$("<div class='tooltip right in' style='display:none;left:16px;top:-6px;'><div class='tooltip-arrow'></div><div class='tooltip-inner'></div></div>")
.prependTo(ui.handle);
}
$(ui.handle.firstChild).show().children().eq(1).text(val);
}
}).find('span.ui-slider-handle').on('blur', function() {
$(this.firstChild).hide();
});
$("#slider-range-max").slider({
range: "max",
min: 1,
max: 10,
value: 2
});
$("#slider-eq > span").css({
width: '90%',
'float': 'left',
margin: '15px'
}).each(function() {
// read initial values from markup and remove that
var value = parseInt($(this).text(), 10);
$(this).empty().slider({
value: value,
range: "min",
animate: true
});
});
$("#slider-eq > span.ui-slider-purple").slider('disable'); //disable third item
$('#id-input-file-1 , #id-input-file-2').ace_file_input({
no_file: 'No File ...',
btn_choose: 'Choose',
btn_change: 'Change',
droppable: false,
onchange: null,
thumbnail: false //| true | large
//whitelist:'gif|png|jpg|jpeg'
//blacklist:'exe|php'
//onchange:''
//
});
//pre-show a file name, for example a previously selected file
//$('#id-input-file-1').ace_file_input('show_file_list', ['myfile.txt'])
//datepicker plugin
//link
$('.date-picker').datepicker({
autoclose: true,
todayHighlight: true
})
//show datepicker when clicking on the icon
.next().on(ace.click_event, function() {
$(this).prev().focus();
});
//chosen plugin inside a modal will have a zero width because the select element is originally hidden
//and its width cannot be determined.
//so we set the width after modal is show
$('#modal-form').on('shown.bs.modal', function() {
if (!ace.vars['touch']) {
$(this).find('.chosen-container').each(function() {
$(this).find('a:first-child').css('width', '210px');
$(this).find('.chosen-drop').css('width', '210px');
$(this).find('.chosen-search input').css('width', '200px');
});
}
})
/**
//or you can activate the chosen plugin after modal is shown
//this way select element becomes visible with dimensions and chosen works as expected
$('#modal-form').on('shown', function () {
$(this).find('.modal-chosen').chosen();
})
*/
$(document).one('ajaxloadstart.page', function(e) {
autosize.destroy('textarea[class*=autosize]')
$('.limiterBox,.autosizejs').remove();
$('.daterangepicker.dropdown-menu,.colorpicker.dropdown-menu,.bootstrap-datetimepicker-widget.dropdown-menu')
.remove();
});
});
</script>