1316 lines
58 KiB
PHP
1316 lines
58 KiB
PHP
<?php
|
||
include('includes/config/config.php');
|
||
|
||
if(isset($_REQUEST['appointmnentId'])){
|
||
|
||
$sql="select * from employee_appointment where appointment_id='".$_REQUEST['appointmnentId']."'";
|
||
//echo "query:".$sql;
|
||
$result = mysqli_query($conn,$sql);
|
||
$num_rows=@mysqli_num_rows($result);
|
||
$row =null;
|
||
if($num_rows>0)
|
||
{
|
||
$row=@mysqli_fetch_array($result);
|
||
}
|
||
$sql_for_treatment="select * from treatment where appointment_id='".$_REQUEST['appointmnentId']."'";
|
||
$result_for_treatment =@mysqli_query($conn,$sql_for_treatment);
|
||
$num_rows_treatment=@mysqli_num_rows($result_for_treatment);
|
||
|
||
|
||
|
||
}
|
||
?>
|
||
|
||
<style>#modal-add-req{overflow-y:scroll;}</style>
|
||
|
||
<div class="modal fade" id="modal-add-employee" role="dialog"
|
||
aria-hidden="true">
|
||
<form role="form" id="employee_form" name="debitNoteForm" method="post">
|
||
<div class="modal-dialog">
|
||
<div class="modal-content">
|
||
<div class="modal-header modal-header-success'">
|
||
<button type="button" class="close" data-dismiss="modal"
|
||
aria-hidden="true">×</button>
|
||
<h5 class='modal-title'>Debit Note Form</h5>
|
||
</div>
|
||
<div class="modal-body">
|
||
|
||
<div class="widget-body">
|
||
<div class="widget-main">
|
||
<div class="row">
|
||
<div class="col-xs-9">
|
||
<div class="widget-box">
|
||
|
||
<div class="widget-body">
|
||
<div class="widget-main">
|
||
<div class="row">
|
||
<div class="col-xs-12">
|
||
<div class="row">
|
||
<div class="col-sm-3">
|
||
<label class="control-label" for="reporting_time"><strong style="font-size:11px">Reporting Time</strong></label>
|
||
|
||
<div class="input-group" >
|
||
<input id="emp_id" name="emp_id" type="hidden" value="<?php echo $_REQUEST['flex_opd_id']?>"/>
|
||
<input id="appointment_id" name="appointment_id" type="hidden"/>
|
||
<input id="appointment_type" name="appointment_type" type="hidden" value="O"/>
|
||
<input id="reporting_time" type="text" style="height:30px" class="form-control" name="reporting_time" />
|
||
<span class="input-group-addon" >
|
||
<i class="fa fa-clock-o bigger-110" style="height:5px"></i>
|
||
</span>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="col-sm-3">
|
||
<label class="control-label" for="injury_time_injury"><strong style="font-size:11px">Injury Time</strong></label>
|
||
|
||
<div class="input-group">
|
||
<input id="injury_time_injury" type="text" class="form-control" style="height:30px" name="injury_time_injury" value="<?php echo $row['injury_time']?>"/>
|
||
<span class="input-group-addon">
|
||
<i class="fa fa-clock-o bigger-110" style="height:5px"></i>
|
||
</span>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="space-6"></div>
|
||
|
||
<div class="row">
|
||
<div class="col-sm-6">
|
||
<label class="control-label" for="form-field-8"><strong style="font-size:11px">Injury Description</strong></label>
|
||
|
||
<textarea rows="3" cols="10" class="autosize-transition form-control" style="overflow: hidden; overflow-wrap: break-word; " name="injury_complaints" id="injury_complaints" placeholder="Injury Description" maxlength="500"></textarea>
|
||
</div>
|
||
|
||
|
||
<div class="col-sm-6">
|
||
<label class="control-label" for="form-field-8"><strong style="font-size:11px">On Examination Findings</strong></label>
|
||
|
||
<textarea rows="3" cols="8" class="autosize-transition form-control" style="overflow: hidden; overflow-wrap: break-word; "id="examination_remarks_injury" name="examination_remarks_injury" placeholder="On Examination Symptoms" maxlength="500"><?php echo $row['examination_remarks']?></textarea>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="space-6"></div>
|
||
|
||
<div class="row">
|
||
<div class="col-sm-12">
|
||
<label class="control-label" for="form-field-8"><strong style="font-size:11px">Incident Location</strong></label>
|
||
<table class="table table-bordered table-hover simple-table">
|
||
<thead>
|
||
<tr class="active">
|
||
|
||
<th><strong style="font-size:11px">Business Unit</strong></th>
|
||
<th><strong style="font-size:11px">Sub Unit</strong></th>
|
||
<th><strong style="font-size:11px">Section</strong></th>
|
||
<th><strong style="font-size:11px">Sub-Section</strong></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
|
||
<tr>
|
||
<td class="col-sm-3">
|
||
<select class="chosen-select form-control" id="injury_firm" name="injury_firm" data-placeholder="Business Unit" style="display: none;">
|
||
<option value=""> </option>
|
||
<?php echo generateOption('tbl_firms','firm_name','firm_id',$row['bu_id'],''); ?>
|
||
</select>
|
||
</td>
|
||
<td class="col-sm-3">
|
||
<select class="chosen-select form-control" id="injury_sbu" name="injury_sbu" data-placeholder="Department" style="display: none;">
|
||
<option value=""> </option>
|
||
<?php echo generateOption('sub_business_unit','sbu_name','sbu_id',$row['sbu_id'],''); ?>
|
||
</select>
|
||
</td>
|
||
<td class="col-sm-3">
|
||
<select class="chosen-select form-control" id="injury_section" name="injury_section" data-placeholder="Section" style="display: none;">
|
||
<option value=""> </option>
|
||
<?php echo generateOption('section','section_name','section_id',$row['section_id'],''); ?>
|
||
</select>
|
||
</td>
|
||
<td class="col-sm-3">
|
||
<select class="chosen-select form-control" id="injury_sub_section" name="injury_sub_section" data-placeholder="Sub-Section" style="display: none;">
|
||
<option value=""> </option>
|
||
<?php echo generateOption('sub_section','sub_section_name','sub_section_id',$row['sub_section_id'],''); ?>
|
||
</select>
|
||
</td>
|
||
</tr>
|
||
|
||
</tbody>
|
||
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<div class="row">
|
||
<div class="col-sm-12">
|
||
<label class="control-label" for="form-field-8"><strong style="font-size:11px">Injury</strong></label>
|
||
<table class="table table-bordered table-hover simple-table">
|
||
<thead>
|
||
<tr class="active">
|
||
|
||
<th><strong style="font-size:11px">Type</strong></th>
|
||
<th><strong style="font-size:11px">Part</strong></th>
|
||
<th><strong style="font-size:11px">Classification</strong></th>
|
||
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
|
||
<tr>
|
||
<td class="col-sm-4">
|
||
<select multiple="" class="chosen-select form-control" id="injury_type" name="injury_type[]" data-placeholder="Injury Type...">
|
||
<?php echo generateOption('injury_type','injury_type_name','injury_type_id',''); ?>
|
||
</select>
|
||
</td>
|
||
<td class="col-sm-4">
|
||
<select multiple="" class="chosen-select form-control" id="injury_part" name="injury_part[]" data-placeholder="Injury Part.." >
|
||
<?php echo generateOption('injury_part','inj_name','inj_id','',''); ?>
|
||
</select>
|
||
</td>
|
||
<td class="col-sm-4">
|
||
<select multiple="" class="chosen-select form-control" id="injury_class" name="injury_class[]" data-placeholder="Injury Classification..">
|
||
<?php echo generateOption('injury_class','inj_class_name','inj_class_id','',''); ?>
|
||
</select>
|
||
</td>
|
||
|
||
</tr>
|
||
|
||
</tbody>
|
||
|
||
</table>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<div class="space-6"></div>
|
||
|
||
<div class="row">
|
||
<div class="col-sm-6">
|
||
<label class="control-label" for="remarks"><strong style="font-size:11px">Procedure</strong></label>
|
||
<textarea id="remarks" name="remarks" placeholder="Procedure.." rows="3" cols="6" class="autosize-transition form-control" style="overflow: hidden; overflow-wrap: break-word; "></textarea>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-top:40px">
|
||
<div class="col-sm-12">
|
||
<table id="treatmentTable<?php echo $row_history['appointment_id']?>" class="table table-striped table-bordered">
|
||
<thead>
|
||
<tr class="active" >
|
||
<th style="font-size:11px; text-align: center;" >Medicine</th>
|
||
<th style="font-size:11px; text-align: center;">Dosage</th>
|
||
<th style="font-size:11px; text-align: center;">For Days</th>
|
||
<th style="font-size:11px; text-align: center;">Qty</th>
|
||
<th style="font-size:11px; text-align: center;">Price</th>
|
||
<th style="font-size:11px; text-align: center;">Stock</th>
|
||
<th style="font-size:11px; text-align: center;">Issued</th>
|
||
<th style="font-size:11px; text-align: center;">Total</th>
|
||
<th style="font-size:11px; text-align: center;">
|
||
<button type="button" onclick="addRow('<?php echo $row_history['appointment_id']?>')" class="btn btn-info btn-sm" id="addrow<?php echo $row_history['appointment_id']?>">
|
||
<span class="glyphicon glyphicon-plus"></span>
|
||
|
||
</button>
|
||
|
||
</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
|
||
<tr style="width:40%">
|
||
<td class="col-sm-2" style="width:15%">
|
||
<select class="chosen-select form-control" onchange="getItemDetails(this.value,'current_stock<?php echo $row_history['appointment_id']?>_0','current_stock<?php echo $row_history['appointment_id']?>0','current_rate<?php echo $row_history['appointment_id']?>_0','current_rate<?php echo $row_history['appointment_id']?>0','<?php echo $row_history['appointment_id']?>_0', '0');" id="treatment_item<?php echo $row_history['appointment_id']?>_0" name="treatment_item0" data-placeholder="Treatment...">
|
||
<option value=""> </option>
|
||
<?php echo generateOption('tbl_items','item_name','item_id',$row_history_treatment['item_id'],''); ?>
|
||
</select>
|
||
</td>
|
||
<td class="col-sm-2" style="width:15%">
|
||
<select class="chosen-select form-control" id="treatment_item_dosage<?php echo $row_history['appointment_id']?>_0"name="treatment_item_dosage0" data-placeholder="Dosages..." onchange="getFrequenceyQty(this.value,'frequency_qty<?php echo $row_history['appointment_id']?>_0','dosage<?php echo $row_history['appointment_id']?>_0','<?php echo $row_history['appointment_id']?>','0');">
|
||
<option value=""> </option>
|
||
<?php echo generateOption('medicine_frequency','medicine_frequency','frequency_id','',''); ?>
|
||
</select>
|
||
</td>
|
||
<td class="col-sm-1" style="width:8%">
|
||
<input type="number" style="height:25px;font-size:12px" class="form-control"name="treatment_item_days0" id="treatment_item_days<?php echo $row_history['appointment_id']?>_0" value="1" onblur="updateTotalMedicineQty('frequency_qty<?php echo $row_history['appointment_id']?>_0','treatment_item_days<?php echo $row_history['appointment_id']?>_0','treatment_item_total<?php echo $row_history['appointment_id']?>_0')"/>
|
||
</td>
|
||
|
||
<td class="col-sm-1" style="width:5%">
|
||
<input type="hidden" name="frequency_qty0" id="frequency_qty<?php echo $row_history['appointment_id']?>_0" />
|
||
<input type="hidden" name="dosage0" id="dosage<?php echo $row_history['appointment_id']?>_0" />
|
||
|
||
|
||
<div style="text-align:center" id="treatment_item_total<?php echo $row_history['appointment_id']?>_0">
|
||
</div>
|
||
<input type="hidden" style="height:25px;font-size:12px" class="form-control"name="treatment_item_total0" id="treatment_item_total<?php echo $row_history['appointment_id']?>_0" />
|
||
</td>
|
||
|
||
<td class="col-sm-1" style="width:5%">
|
||
<div style="text-align:center" id="current_rate<?php echo $row_history['appointment_id']?>0" >
|
||
</div>
|
||
|
||
<input type="hidden" style="height:25px;font-size:12px" class="form-control" name="current_rate0" id="current_rate<?php echo $row_history['appointment_id']?>_0" />
|
||
</td>
|
||
<td class="col-sm-1" style="width:5%">
|
||
<div style="text-align:center" id="current_stock<?php echo $row_history['appointment_id']?>0">
|
||
</div>
|
||
<input type="hidden" name="current_stock0" id="current_stock<?php echo $row_history['appointment_id']?>_0" />
|
||
|
||
</td>
|
||
|
||
<td class="col-sm-1" style="width:5%">
|
||
<input type="text" style="height:25px;font-size:12px" class="form-control"name="treatment_item_qtygvn0" id="treatment_item_qtygvn<?php echo $row_history['appointment_id']?>_0" onchange="itemLevelTotol('treatment_item_qtygvn<?php echo $row_history['appointment_id']?>_0','current_rate<?php echo $row_history['appointment_id']?>_0','treatment_item_total_amount<?php echo $row_history['appointment_id']?>_0','treatment_item_total_amount<?php echo $row_history['appointment_id']?>0') "/>
|
||
</td>
|
||
|
||
<td class="col-sm-1" style="width:5%">
|
||
<div style="text-align:center" id="treatment_item_total_amount<?php echo $row_history['appointment_id']?>0"></div>
|
||
<input type="hidden" style="height:25px;font-size:12px" class="form-control"name="treatment_item_total_amount0" id="treatment_item_total_amount<?php echo $row_history['appointment_id']?>_0" />
|
||
<td class="col-sm-1" style="width:5%"><a class="deleteRow"></a>
|
||
|
||
</td>
|
||
</tr>
|
||
|
||
</tbody>
|
||
<tfoot>
|
||
<tr>
|
||
<td colspan="7" style="text-align: right;">
|
||
<strong style="font-size:11px">
|
||
Total Amount :<strong></td>
|
||
<td colspan="2" >
|
||
|
||
<input type="hidden" name="count_treatment_item" id="count_treatment_item<?php echo $row_history['appointment_id']?>" value="1" />
|
||
<input type="hidden" style="height:25px;font-size:12px;width:60px;align:center" class="form-control" name="order_level_total" id="order_level_total" />
|
||
<div id="order_level_total_div" style="margin-left:30px"></div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
</tr>
|
||
</tfoot>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<div class="row">
|
||
|
||
<div class="col-sm-6">
|
||
<label class="control-label" for="referral"><strong style="font-size:11px">Referral</strong></label>
|
||
<textarea name="referral" rows="4" cols="8"id="referral" placeholder="Referral" class="autosize-transition form-control" style="overflow: hidden; overflow-wrap: break-word; "></textarea>
|
||
</div>
|
||
|
||
<div class="col-sm-6">
|
||
<label class="control-label" for="followup"><strong style="font-size:11px">Follow-up</strong></label>
|
||
<textarea id="followup" rows="4" cols="8"name="followup" placeholder="Follow Up" class="autosize-transition form-control" style="overflow: hidden; overflow-wrap: break-word; "></textarea>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div><!-- /.col-xs-12 -->
|
||
</div><!--row end-->
|
||
|
||
</div><!--end of widget-main-->
|
||
</div><!--end of widget-body-->
|
||
</div><!--end of widget-box-->
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<div class="col-xs-3">
|
||
<div class="widget-box">
|
||
|
||
<div class="widget-body">
|
||
<div class="widget-main">
|
||
<div class="row">
|
||
<div class="col-sm-12">
|
||
<label class="control-label" for="form-field-select-1"><strong style="font-size:11px">Emergency?</strong></label>
|
||
|
||
<select class="form-control" style="height:30px;" id="isEmergency" name="isEmergency">
|
||
<option value="0" selected>No</option>
|
||
<option value="1">Yes</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="space-6"></div>
|
||
<div class="row">
|
||
<div class="col-sm-12">
|
||
<div>
|
||
<input type="number" style="height:30px;" class="col-xs-4" placeholder="SBP" id="sbp" name="sbp" value="<?php echo $row['bp_sbp']?>" >
|
||
<input type="number" style="height:30px;"class="col-xs-4" id="DBP" name="dbp" placeholder="DBP" value="<?php echo $row['bp_dbp']?>">
|
||
<input type="number" style="height:30px;" class="col-xs-4" id="heart_rate" name="heart_rate" placeholder="Heart Rate" value="<?php echo $row['heart_rate']?>" >
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="space-6"></div>
|
||
<div class="row">
|
||
<div class="col-sm-12">
|
||
<div>
|
||
<input type="number" style="height:30px;" class="col-xs-4" placeholder="FBS" id="fbs" name="fbs" value="<?php echo $row['blood_sugar_fbs']?>">
|
||
<input type="number" style="height:30px;" class="col-xs-4" id="rbs" name="rbs" placeholder="RBS" value="<?php echo $row['blood_sugar_rbs']?>">
|
||
<input type="number" style="height:30px;" class="col-xs-4" id="ppbs" name="ppbs" placeholder="PPBS" value="<?php echo $row['blood_sugar_ppbs']?>">
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="space-6"></div>
|
||
<div class="row">
|
||
<div class="col-sm-12">
|
||
<label class="control-label" for="referral"><strong style="font-size:11px">Referral</strong></label>
|
||
<textarea name="referral" id="referral" placeholder="Referral" rows="3" cols="10" class="autosize-transition form-control" style="overflow: hidden; overflow-wrap: break-word; "></textarea>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="space-6"></div>
|
||
<div class="row">
|
||
<div class="col-sm-12">
|
||
<label class="control-label" for="followup"><strong style="font-size:11px">Follow Up</strong></label>
|
||
<textarea id="followup" name="followup" placeholder="Follow Up" rows="3" cols="10" class="autosize-transition form-control" style="overflow: hidden; overflow-wrap: break-word; "></textarea>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
<div class="modal-footer">
|
||
<div class="form-group form-group-sm">
|
||
|
||
<button type="button" class="btn btn-success" id="addReqSave"
|
||
onClick="validation()">
|
||
<span class="glyphicon glyphicon-floppy-save">Save</span>
|
||
</button>
|
||
|
||
<button type="button" class="btn btn-danger">
|
||
<span class="glyphicon glyphicon-remove" class="close"
|
||
data-dismiss="modal" aria-hidden="true">Cancel</span>
|
||
</button>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<style>
|
||
.modal-dialog {
|
||
padding: 15px;
|
||
width: 90%;
|
||
}
|
||
</style>
|
||
<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" />
|
||
<link rel="stylesheet" href="adminlte/bower_components/bootstrap/less/type.less" />
|
||
<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">
|
||
|
||
$(document).ready(function () {
|
||
$(".glyphicon").css("top","");
|
||
|
||
|
||
});
|
||
|
||
function open_treatments(appointment_id){
|
||
$('#modal-add-consultation').modal("show");
|
||
|
||
}
|
||
|
||
</script>
|
||
|
||
<script type="text/javascript">
|
||
// getMedicine();
|
||
function getMedicine(){
|
||
|
||
$("#appointment_id").val("<?php echo $row['appointment_date']?>");
|
||
var appointment_id='<?php echo $row['appointment_id']?>'
|
||
$("#appointment_id").val(appointment_id);
|
||
var content="";
|
||
content+="<thead>"
|
||
content+="<tr class=\"active\" >"
|
||
content+="<th style=\"font-size:11px; text-align: center;\" >Medicine</th>"
|
||
content+="<th style=\"font-size:11px; text-align: center;\">Dosage</th>"
|
||
content+="<th style=\"font-size:11px; text-align: center;\">For Days</th>"
|
||
content+="<th style=\"font-size:11px; text-align: center;\">Qty</th>"
|
||
content+="<th style=\"font-size:11px; text-align: center;\">Price</th>"
|
||
content+="<th style=\"font-size:11px; text-align: center;\">Stock</th>"
|
||
content+="<th style=\"font-size:11px; text-align: center;\">Issued</th>"
|
||
content+="<th style=\"font-size:11px; text-align: center;\">Total</th>"
|
||
content+="<th style=\"font-size:11px; text-align: center;\">"
|
||
content+="<button type=\"button\" onclick=\"addRow('<?php echo $row['appointment_id']?>')\" class=\"btn btn-info btn-sm\" id=\"addrow<?php echo $row_history['appointment_id']?>\">"
|
||
content+="<span class=\"glyphicon glyphicon-plus\"></span></button></th></tr></thead>"
|
||
content+="<tbody>";
|
||
$("#treatmentTableForEdit").html(content);
|
||
<?php $row_treatment =null;?>
|
||
|
||
|
||
var count=0;
|
||
<?php while($row_treatment=@mysqli_fetch_array($result_for_treatment)){
|
||
/*$query_current_stock="select current_stock_level tbl_items where item_id='".$row_treatment['item_id']."' ";
|
||
$result_current_stock=@mysqli_query($conn,$query_current_stock);
|
||
$row_current_stock=@mysqli_fetch_array($result_current_stock); */
|
||
?>
|
||
content="";
|
||
content+="<tr style=\"width:40%\">"
|
||
content+="<td class=\"col-sm-2\" style=\"width:10%\">"
|
||
content+="<select class=\"chosen-select form-control\" id=\"treatment_item"+appointment_id+'_'+count+"\" name=\"treatment_item"+appointment_id+count+"\" onchange=\"getItemDetails(this.value,'current_stock"+appointment_id+"_"+count+"','current_stock"+appointment_id+count+"','current_rate"+appointment_id+"_"+count+"','current_rate"+appointment_id+count+"','"+appointment_id+"', '"+count+"');\" data-placeholder=\"Treatment...\">"
|
||
content+="<?php echo generateOption('tbl_items','item_name','item_id',$row_treatment['item_id'],'');?></select></td>"
|
||
content+="<td class=\"col-sm-2\" style=\"width:10%\">"
|
||
content+="<select class=\"chosen-select form-control\" id=\"treatment_item_dosage"+appointment_id+'_'+count+"\" name=\"treatment_item_dosage"+appointment_id+count+"\" data-placeholder=\"Dosages...\" onchange=\"getFrequenceyQty(this.value,'frequency_qty"+appointment_id+"_"+count+"','dosage"+appointment_id+"_"+count+"','"+appointment_id+"', '"+count+"');\">"
|
||
content+="<?php echo generateOption('medicine_frequency','medicine_frequency','frequency_id',$row_treatment['frequency_id'],''); ?>"
|
||
content+="</select>"
|
||
content+="<input type=\"hidden\" name=\"treatment_id"+appointment_id+count+"\" id=\"treatment_id"+appointment_id+'_'+count+"\" value=\"<?php echo $row_treatment['treatment_id']?>\"></td>"
|
||
content+="<td class=\"col-sm-2\" style=\"width:10%\">"
|
||
content+="<input type=\"number\" style=\"height:25px;font-size:12px\" class=\"form-control\" name=\"treatment_item_days"+appointment_id+count+"\" id=\"treatment_item_days"+appointment_id+'_'+count+"\" value=\"1\" onchange=\"updateTotalMedicineQty('frequency_qty"+appointment_id+"_"+count+"','treatment_item_days"+appointment_id+'_'+count+"','treatment_item_total"+appointment_id+'_'+count+"','treatment_item_total"+appointment_id+count+"');\"/>"
|
||
content+="</td>"
|
||
|
||
content+="<td class=\"col-sm-1\" style=\"width:5%\">"
|
||
content+="<input type=\"hidden\" name=\"frequency_qty"+appointment_id+count+"\" id=\"frequency_qty"+appointment_id+'_'+count+"\" />"
|
||
content+="<input type=\"hidden\" name=\"dosage"+appointment_id+count+"\" id=\"dosage"+appointment_id+'_'+count+"\" />"
|
||
content+="<div style=\"text-align:center\" id=\"treatment_item_total"+appointment_id+count+"\">"
|
||
content+="</div>"
|
||
content+="<input type=\"hidden\" style=\"height:25px;font-size:12px\" class=\"form-control\" name=\"treatment_item_total"+appointment_id+count+"\" id=\"treatment_item_total"+appointment_id+'_'+count+"\" />"
|
||
content+="</td>"
|
||
|
||
content+="<td class=\"col-sm-1\" style=\"width:5%\">"
|
||
content+="<div style=\"text-align:center\" id=\"current_rate"+appointment_id+count+"\" >"
|
||
content+="</div>"
|
||
|
||
content+="<input type=\"hidden\" style=\"height:25px;font-size:12px\" class=\"form-control\" name=\"current_rate"+appointment_id+count+"\" id=\"current_rate"+appointment_id+'_'+count+"\" />"
|
||
content+="</td>"
|
||
content+="<td class=\"col-sm-1\" style=\"width:5%\">"
|
||
content+="<div style=\"text-align:center\" id=\"current_stock"+appointment_id+count+"\">"
|
||
content+="</div>"
|
||
content+="<input type=\"hidden\" name=\"current_stock"+appointment_id+count+"\" id=\"current_stock"+appointment_id+'_'+count+"\" />"
|
||
|
||
content+="</td>"
|
||
|
||
content+="<td class=\"col-sm-1\" style=\"width:5%\">"
|
||
content+="<input type=\"text\" style=\"height:25px;font-size:12px\" class=\"form-control\" name=\"treatment_item_qtygvn"+appointment_id+count+"\" id=\"treatment_item_qtygvn"+appointment_id+'_'+count+"\" value=\"<?php echo $row_treatment['issued_qty']?>\" onchange=\"itemLevelTotol('treatment_item_qtygvn"+appointment_id+"_"+count+"','current_rate"+appointment_id+"_"+count+"','treatment_item_total_amount"+appointment_id+"_"+count+"','treatment_item_total_amount"+appointment_id+count+"')\"/>"
|
||
content+="</td>"
|
||
|
||
content+="<td class=\"col-sm-1\" style=\"width:5%\">"
|
||
content+="<div style=\"text-align:center\" id=\"treatment_item_total_amount"+appointment_id+count+"\"><?php echo $row_treatment['price']?></div>"
|
||
content+="<input type=\"hidden\" style=\"height:25px;font-size:12px\" class=\"form-control\" name=\"treatment_item_total_amount"+appointment_id+count+"\" id=\"treatment_item_total_amount"+appointment_id+'_'+count+"\" value=\"<?php echo $row_treatment['price']?>\" />"
|
||
content+="<td class=\"col-sm-1\" style=\"width:5%\"><a class=\"deleteRow\"></a>"
|
||
|
||
content+="</td>"
|
||
content+="</tr>"
|
||
$("#treatmentTableForEdit").append(content);
|
||
getItemDetails($("#treatment_item"+appointment_id+'_'+count).val(),"current_stock"+appointment_id+'_'+count,"current_stock"+appointment_id+count,"current_rate"+appointment_id+'_'+count,"current_rate"+appointment_id+count,appointment_id+"_"+count,count);
|
||
getFrequenceyQty($("#treatment_item_dosage"+appointment_id+'_'+count).val(),"frequency_qty"+appointment_id+'_'+count,"dosage"+appointment_id+'_'+count,appointment_id,count);
|
||
updateTotalMedicineQty("frequency_qty"+appointment_id+'_'+count,"treatment_item_days"+appointment_id+'_'+count,"treatment_item_total"+appointment_id+'_'+count,"treatment_item_total"+appointment_id+count);
|
||
//itemLevelTotol("treatment_item_qtygvn"+appointment_id+"_"+count,"current_rate"+appointment_id+"_"+count,"treatment_item_total_amount"+appointment_id+"_"+count,"treatment_item_total_amount"+appointment_id+count);
|
||
|
||
count=count+1;
|
||
|
||
|
||
|
||
//onchange=\"getItemDetails(this.value,'current_stock"+appointment_id+'_'+count,"current_stock"+appointment_id+'_'+count,"current_rate"+appointment_id+'_'+count,"current_rate"+appointment_id+'_'+count,appointment_id+"_"+count, count);\"
|
||
//'dosage<?php echo $row['appointment_id']?>_0','<?php echo $row['appointment_id']?>',"+count+");\">"
|
||
|
||
//$('#treatment_item'+appointment_id+'_'+count+").val()
|
||
|
||
|
||
|
||
<?php
|
||
|
||
}
|
||
|
||
//getItemDetails(item_id, current_stock_field,current_stock_field_div, current_rate_field,current_rate_field_div, appointment_id, counter)
|
||
|
||
?>
|
||
|
||
|
||
//alert(no_rows);
|
||
|
||
|
||
|
||
|
||
|
||
//var itemOptions="<?php echo generateOption('tbl_items','item_name','item_id',$row_treatment['item_id'],''); ?>"
|
||
//$("#treatment_item0").html(itemOptions);
|
||
var content="";
|
||
content+="</tbody>"
|
||
content+="<tfoot>"
|
||
content+="<tr>"
|
||
content+="<td colspan=\"7\" style=\"text-align: right;\">"
|
||
content+="<strong style=\"font-size:11px;\">Total Amount :</strong></td>"
|
||
content+="<td colspan=\"2\" >"
|
||
content+="<input type=\"hidden\" name=\"count_treatment_item\" id=\"count_treatment_item\" />"
|
||
|
||
content+="<input type=\"hidden\" style=\"height:25px;font-size:12px;width:60px;align:center\" class=\"form-control\" name=\"order_level_total\" id=\"order_level_total\" value=\"<?php echo $row['total_amount']?>\" />"
|
||
content+="<div id=\"order_level_total_div\" style=\"margin-left:30px\"><?php echo $row['total_amount']?></div>"
|
||
content+="</td>"
|
||
content+="</tr>"
|
||
content+="<tr>"
|
||
content+="</tr>"
|
||
content+="</tfoot>"
|
||
$("#treatmentTableForEdit").append(content);
|
||
|
||
$("#count_treatment_item").val(count);
|
||
|
||
}
|
||
function addRow(appointment_id){
|
||
var counter=$("#count_treatment_item").val();
|
||
var itemOptions="<?php echo generateOption('tbl_items','item_name','item_id','',''); ?>";
|
||
var itemDosages="<?php echo generateOption('medicine_frequency','medicine_frequency','frequency_id','',''); ?>";
|
||
|
||
var newRow = $("<tr>");
|
||
var cols = "";
|
||
var select_treatment="";
|
||
select_treatment+="<select onchange=\"getItemDetails(this.value,'current_stock"+appointment_id+"_"+counter+"','current_stock"+appointment_id+counter+"','current_rate"+appointment_id+"_"+counter+"','current_rate"+appointment_id+counter+"','"+appointment_id+"', '"+counter+"');\" class='chosen-select form-control'";
|
||
select_treatment+="id=\"treatment_item"+appointment_id+"_"+counter+"\"name=\"treatment_item"+appointment_id+counter+"\"data-placeholder=\"Treatment...\"";
|
||
//select_treatment+="style=\"display: none;\"";
|
||
select_treatment+=">";
|
||
|
||
select_treatment+="<option value=\"\"> </option>";
|
||
select_treatment+=itemOptions
|
||
select_treatment+="</select>";
|
||
|
||
cols += '<td>'+select_treatment+'</td>';
|
||
var select_dosage="";
|
||
select_dosage+="<select onchange=\"getFrequenceyQty(this.value,'frequency_qty"+appointment_id+"_"+counter+"','dosage"+appointment_id+"_"+counter+"','"+appointment_id+"', '"+counter+"');\" class='chosen-select form-control'";
|
||
select_dosage+="id=\"treatment_item_dosage"+appointment_id+"_"+counter+"\"name=\"treatment_item_dosage"+appointment_id+counter+"\"data-placeholder=\"Dosage...\"";
|
||
//select_dosage+="style=\"display: none;\"";
|
||
select_dosage+=">";
|
||
|
||
select_dosage+="<option value=\"\"> </option>";
|
||
select_dosage+=itemDosages
|
||
select_dosage+="</select>";
|
||
|
||
cols += '<td>'+select_dosage+'</td>';
|
||
cols += '<td><input type=\"hidden\" name=\"treatment_id'+appointment_id+counter+'" id=\"treatment_id'+appointment_id+'_'+counter+'" ><input type="number" style="height:25px;font-size:12px" class="form-control"id ="treatment_item_days'+appointment_id+'_'+counter+'" value="1" onblur="updateTotalMedicineQty(\'frequency_qty'+appointment_id+'_'+counter+'\',\'treatment_item_days'+appointment_id+'_'+counter+'\',\'treatment_item_total'+appointment_id+counter+'\')" name="treatment_item_days'+appointment_id + counter + '"/></td>';
|
||
cols += '<td><div style="text-align:center" id="treatment_item_total'+appointment_id+counter+'""></div><input type="hidden" style="height:25px;font-size:12px" class="form-control"id="treatment_item_total'+appointment_id+'_'+counter+'" name="treatment_item_total'+appointment_id + counter + '" readonly/></td>';
|
||
cols += '<td><input type="hidden" name="frequency_qty'+appointment_id+counter+'" id="frequency_qty'+appointment_id+'_'+counter+'" /><input type="hidden" name="dosage'+appointment_id+counter+'" id="dosage'+appointment_id+'_'+counter+'" /> <div style="text-align:center" id="current_rate'+appointment_id+counter+'" "></div><input type="hidden" style="height:25px;font-size:12px" class="form-control" id="current_rate'+appointment_id+'_'+counter+'" name="current_rate'+appointment_id + counter + '" onblur="updatePrice(\'treatment_item_qtygvn'+appointment_id+'_'+counter+'\',\'treatment_item'+appointment_id+'_'+counter+'\',\'current_rate'+appointment_id+'_'+counter+'\',\'current_stock'+appointment_id+'_'+counter+'\',\'price'+appointment_id+'_'+counter+'\')" /></td>';
|
||
cols += '<td><div style="text-align:center" id="current_stock'+appointment_id+counter + '" ></div><input type="hidden" style="height:25px;font-size:12px" class="form-control" id="current_stock'+appointment_id+'_'+counter+'" name="current_stock'+appointment_id + counter + '" /></td>';
|
||
cols += '<td><input type="text" style="height:25px;font-size:12px" class="form-control" id="treatment_item_qtygvn'+appointment_id+'_'+counter+'" name="treatment_item_qtygvn'+appointment_id + counter + '" onchange="itemLevelTotol(\'treatment_item_qtygvn'+appointment_id+'_'+counter+'\',\'current_rate'+appointment_id+'_'+counter+'\',\'treatment_item_total_amount'+appointment_id+'_'+counter+'\',\'treatment_item_total_amount'+counter+'\');" /></td>';
|
||
|
||
cols += '<td><div style="text-align:center" id="treatment_item_total_amount'+counter+'"></div><input type="hidden" style="height:25px;font-size:12px" class="form-control" id="treatment_item_total_amount'+appointment_id+'_'+counter+'" name="treatment_item_total_amount'+appointment_id + counter + '"/></td>';
|
||
cols += '<td><a href="#"><i class="ace-icon fa fa-trash-o bigger-130"></i></a></td>';
|
||
newRow.append(cols);
|
||
$("#treatmentTableForEdit").append(newRow);
|
||
//$('.chosen-select').chosen({allow_single_deselect:true});
|
||
//$('.chosen-select').next().css({'width': $('#treatment_item'+counter).parent().width()});
|
||
//$('#ailment_system').trigger('chosen:updated');
|
||
$('#treatment_item_dosage'+appointment_id+"_"+counter).chosen({allow_single_deselect:true});
|
||
$('#treatment_item_dosage'+appointment_id+"_"+counter).next().css({'width': $('#treatment_item_dosage'+counter).parent().width()});
|
||
|
||
$('#treatment_item'+appointment_id+"_"+counter).chosen({allow_single_deselect:true});
|
||
$('#treatment_item'+appointment_id+"_"+counter).next().css({'width': $('#treatment_item'+counter).parent().width()});
|
||
//$('#manufacturer').trigger('chosen:updated');
|
||
|
||
counter++;
|
||
$("#count_treatment_item").val(counter);
|
||
//resizeChosen();
|
||
//jQuery(window).on('resize', resizeChosen);
|
||
|
||
$("#treatmentTableForEdit").on("click", ".fa-trash-o", function (event) {
|
||
$(this).closest("tr").remove();
|
||
counter -= 1
|
||
$("#count_treatment_item").val(counter);
|
||
});
|
||
}
|
||
|
||
function validate_update(formId, appointment_id){
|
||
var appointment_date = $('#appointment_date'+appointment_id).val();
|
||
if(appointment_date == ''){
|
||
BootstrapDialog.alert('Please Enter Appointment Name.!!!');
|
||
return false;
|
||
}
|
||
var complaints = $('#complaints'+appointment_id).val();
|
||
if(complaints == ''){
|
||
BootstrapDialog.alert('Please Enter Complaints.!!!');
|
||
return false;
|
||
}
|
||
update_appointment(formId, appointment_id);
|
||
}
|
||
function update_appointment(formId, appointment_id){
|
||
$.ajax({
|
||
url : 'save_opd.php',
|
||
type : "POST",
|
||
data : $("#"+formId).serialize(),
|
||
success : function(data) {
|
||
|
||
BootstrapDialog.alert('Details Updated Successfully.');
|
||
//window.location = 'employee_appointment_form.php?appointmnentId='+appointmnentId+' ';
|
||
|
||
return;
|
||
},
|
||
error : function(data) {
|
||
BootstrapDialog.alert('Error Updating Details');
|
||
return;
|
||
}
|
||
});
|
||
//window.location.reload();
|
||
}
|
||
|
||
function getFrequenceyQty(frequency_id, qty_value_field_id, dosage_desc_field_id, appointment_id, counter){
|
||
|
||
$.ajax({
|
||
url : 'select_frequency.php?frequency_id='+frequency_id,
|
||
type : "GET",
|
||
//data : $("#"+formId).serialize(),
|
||
async:false,
|
||
success : function(data) {
|
||
var data = $.parseJSON(data);
|
||
//alert(data);
|
||
if(data.qty!=null){
|
||
$("#"+qty_value_field_id).val(data.qty);
|
||
$("#"+dosage_desc_field_id).val(data.frequency_description);
|
||
|
||
}
|
||
|
||
//BootstrapDialog.alert('Injury Details Updated Successfully.');
|
||
//location.reload();
|
||
//return;
|
||
},
|
||
error : function(data) {
|
||
BootstrapDialog.alert('Error pulling frequency qty');
|
||
return;
|
||
}
|
||
|
||
});
|
||
updateTotalMedicineQty('frequency_qty'+appointment_id+'_'+counter,'treatment_item_days'+appointment_id+'_'+counter,'treatment_item_total'+appointment_id+'_'+counter,'treatment_item_total'+appointment_id+counter)
|
||
}
|
||
|
||
function getItemDetails(item_id, current_stock_field,current_stock_field_div, current_rate_field,current_rate_field_div, appointment_id, counter){
|
||
|
||
$.ajax({
|
||
url : 'select_item.php?item_id='+item_id,
|
||
type : "GET",
|
||
//data : $("#"+formId).serialize(),
|
||
success : function(data) {
|
||
var data = $.parseJSON(data);
|
||
//alert(data);
|
||
//if(data.qty!=null){
|
||
$("#"+current_stock_field).val(data.current_stock_level);
|
||
document.getElementById(current_stock_field_div+"").innerText=data.current_stock_level;
|
||
$("#"+current_rate_field).val(data.current_rate);
|
||
if(typeof(counter)!='undefined' && counter != null){
|
||
document.getElementById(current_rate_field_div+"").innerText =data.current_rate;
|
||
}
|
||
|
||
|
||
//}
|
||
|
||
//BootstrapDialog.alert('Injury Details Updated Successfully.');
|
||
//location.reload();
|
||
//return;
|
||
},
|
||
error : function(data) {
|
||
BootstrapDialog.alert('Error pulling Item Details');
|
||
return;
|
||
}
|
||
});
|
||
}
|
||
|
||
function delete_appointment(appointment_id){
|
||
$("#flex_appointment_id").val(appointment_id);
|
||
|
||
BootstrapDialog.confirm('Are you sure to delete?', function(result){
|
||
if(result) {
|
||
$.ajax({
|
||
url : 'delete_appointment.php',
|
||
type : "POST",
|
||
data : $("#flex_appointment_form").serialize(),
|
||
success : function(data) {
|
||
if(data.indexOf("SUCCESS")!=-1){
|
||
BootstrapDialog.alert('Deleted Successfully.');
|
||
|
||
//$("#flex1").flexReload();
|
||
loadAppointmentHistory('<?php echo $_REQUEST['flex_opd_id']?>');
|
||
|
||
}else{
|
||
BootstrapDialog.alert('Error Deleting');
|
||
}
|
||
return;
|
||
},
|
||
error : function(data) {
|
||
BootstrapDialog.alert('Error Deleting');
|
||
return;
|
||
}
|
||
});
|
||
}
|
||
});
|
||
|
||
}
|
||
function itemLevelTotol(treatment_item_qtygvn_field,current_rate_field,treatment_item_total_amount_field,treatment_item_total_amount_field_div){
|
||
var appointment_id='<?php echo $row['appointment_id']?>'
|
||
var count= $("#count_treatment_item").val();
|
||
//alert(count);
|
||
var price=$("#"+current_rate_field).val();
|
||
var qty=$("#"+treatment_item_qtygvn_field).val();
|
||
var totalValue=price*qty;
|
||
///alert(totalValue);
|
||
$("#"+treatment_item_total_amount_field).val(totalValue);
|
||
document.getElementById(treatment_item_total_amount_field_div+"").innerText=totalValue;
|
||
|
||
orderLevelTotal(count);
|
||
}
|
||
|
||
function orderLevelTotal(count){
|
||
var totalAmount=0;
|
||
var appointment_id='<?php echo $row['appointment_id']?>'
|
||
//totalAmount=totalAmount+parseInt(treatment_item_total_amount_field_value);
|
||
for(var i=0;i<parseInt(count);i++){
|
||
totalAmount=totalAmount+parseInt($("#treatment_item_total_amount"+appointment_id+'_'+i).val());
|
||
}
|
||
|
||
//alert(totalAmount);
|
||
$("#order_level_total").val(totalAmount);
|
||
|
||
document.getElementById("order_level_total_div").innerText=totalAmount;
|
||
|
||
|
||
|
||
}
|
||
|
||
|
||
function updateTotalMedicineQty(frequency_qty_fieild,treatment_item_days_fieild,treatment_item_total_fieild,treatment_item_total_fieild_div)
|
||
{
|
||
frequency_qty = $("#"+frequency_qty_fieild).val();
|
||
treatment_item_days=$("#"+treatment_item_days_fieild).val();
|
||
if(treatment_item_days==null || treatment_item_days=='' || treatment_item_days==0){
|
||
treatment_item_days =1;
|
||
}
|
||
$("#"+treatment_item_total_fieild).val(treatment_item_days*frequency_qty);
|
||
document.getElementById(treatment_item_total_fieild_div+"").innerText =treatment_item_days*frequency_qty;
|
||
}
|
||
|
||
function updatePrice(qty_issued_field, item_id_field,current_rate_field,current_stock_field,price_field){
|
||
|
||
qty_issued = $("#"+qty_issued_field).val();
|
||
item_id = $("#"+item_id_field).val();
|
||
current_rate = $("#"+current_rate_field).val();
|
||
current_stock = $("#"+current_stock_field).val();
|
||
if(parseFloat(current_stock)<parseFloat(qty_issued)){
|
||
BootstrapDialog.alert('You trying to issue more than the available qty. Available:'+current_stock+", issued qty:"+qty_issued);
|
||
|
||
}
|
||
price = $("#"+price_field).val(qty_issued*current_rate);
|
||
|
||
|
||
}
|
||
function validate(){
|
||
var appointment_date = $('#appointment_date').val();
|
||
if(appointment_date == ''){
|
||
BootstrapDialog.alert('Please Enter Appointment Name.!!!');
|
||
return false;
|
||
}
|
||
var complaints = $('#complaints').val();
|
||
if(complaints == ''){
|
||
BootstrapDialog.alert('Please Enter Complaints.!!!');
|
||
return false;
|
||
}
|
||
save_appointment();
|
||
}
|
||
function save_appointment(){
|
||
$.ajax({
|
||
url : 'save_opd.php',
|
||
type : "POST",
|
||
data : $("#opd_form").serialize(),
|
||
success : function(data) {
|
||
var data = $.parseJSON(data);
|
||
//alert(data);
|
||
if(data.appointment_id!=null){
|
||
$("#appointment_id").val(data.appointment_id);
|
||
$("#appointment_id_pdf").val(data.appointment_id);
|
||
}
|
||
|
||
BootstrapDialog.alert('Details Saved Successfully.');
|
||
loadAppointmentHistory('<?php echo $_REQUEST['flex_opd_id']?>');
|
||
//return;
|
||
},
|
||
error : function(data) {
|
||
BootstrapDialog.alert('Error Saving Details');
|
||
//return;
|
||
}
|
||
});
|
||
}
|
||
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});
|
||
//resize the chosen on window resize
|
||
|
||
$(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.'
|
||
});
|
||
|
||
$.mask.definitions['~']='[+-]';
|
||
$('.input-mask-date').mask('99/99/9999');
|
||
$('.input-mask-phone').mask('(999) 999-9999');
|
||
$('.input-mask-eyescript').mask('~9.99 ~9.99 999');
|
||
$(".input-mask-product").mask("a*-999-a999",{placeholder:" ",completed:function(){alert("You typed the following: "+this.val());}});
|
||
|
||
|
||
|
||
$( "#input-size-slider" ).css('width','200px').slider({
|
||
value:1,
|
||
range: "min",
|
||
min: 1,
|
||
max: 8,
|
||
step: 1,
|
||
slide: function( event, ui ) {
|
||
var sizing = ['', 'input-sm', 'input-lg', 'input-mini', 'input-small', 'input-medium', 'input-large', 'input-xlarge', 'input-xxlarge'];
|
||
var val = parseInt(ui.value);
|
||
$('#form-field-4').attr('class', sizing[val]).attr('placeholder', '.'+sizing[val]);
|
||
}
|
||
});
|
||
|
||
$( "#input-span-slider" ).slider({
|
||
value:1,
|
||
range: "min",
|
||
min: 1,
|
||
max: 12,
|
||
step: 1,
|
||
slide: function( event, ui ) {
|
||
var val = parseInt(ui.value);
|
||
$('#form-field-5').attr('class', 'col-xs-'+val).val('.col-xs-'+val);
|
||
}
|
||
});
|
||
|
||
|
||
|
||
//"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'])
|
||
|
||
|
||
$('#id-input-file-3').ace_file_input({
|
||
style: 'well',
|
||
btn_choose: 'Drop files here or click to choose',
|
||
btn_change: null,
|
||
no_icon: 'ace-icon fa fa-cloud-upload',
|
||
droppable: true,
|
||
thumbnail: 'small'//large | fit
|
||
//,icon_remove:null//set null, to hide remove/reset button
|
||
/**,before_change:function(files, dropped) {
|
||
//Check an example below
|
||
//or examples/file-upload.html
|
||
return true;
|
||
}*/
|
||
/**,before_remove : function() {
|
||
return true;
|
||
}*/
|
||
,
|
||
preview_error : function(filename, error_code) {
|
||
//name of the file that failed
|
||
//error_code values
|
||
//1 = 'FILE_LOAD_FAILED',
|
||
//2 = 'IMAGE_LOAD_FAILED',
|
||
//3 = 'THUMBNAIL_FAILED'
|
||
//alert(error_code);
|
||
}
|
||
|
||
}).on('change', function(){
|
||
//console.log($(this).data('ace_input_files'));
|
||
//console.log($(this).data('ace_input_method'));
|
||
});
|
||
|
||
|
||
//$('#id-input-file-3')
|
||
//.ace_file_input('show_file_list', [
|
||
//{type: 'image', name: 'name of image', path: 'http://path/to/image/for/preview'},
|
||
//{type: 'file', name: 'hello.txt'}
|
||
//]);
|
||
|
||
|
||
|
||
|
||
//dynamically change allowed formats by changing allowExt && allowMime function
|
||
$('#id-file-format').removeAttr('checked').on('change', function() {
|
||
var whitelist_ext, whitelist_mime;
|
||
var btn_choose
|
||
var no_icon
|
||
if(this.checked) {
|
||
btn_choose = "Drop images here or click to choose";
|
||
no_icon = "ace-icon fa fa-picture-o";
|
||
|
||
whitelist_ext = ["jpeg", "jpg", "png", "gif" , "bmp"];
|
||
whitelist_mime = ["image/jpg", "image/jpeg", "image/png", "image/gif", "image/bmp"];
|
||
}
|
||
else {
|
||
btn_choose = "Drop files here or click to choose";
|
||
no_icon = "ace-icon fa fa-cloud-upload";
|
||
|
||
whitelist_ext = null;//all extensions are acceptable
|
||
whitelist_mime = null;//all mimes are acceptable
|
||
}
|
||
var file_input = $('#id-input-file-3');
|
||
file_input
|
||
.ace_file_input('update_settings',
|
||
{
|
||
'btn_choose': btn_choose,
|
||
'no_icon': no_icon,
|
||
'allowExt': whitelist_ext,
|
||
'allowMime': whitelist_mime
|
||
})
|
||
file_input.ace_file_input('reset_input');
|
||
|
||
file_input
|
||
.off('file.error.ace')
|
||
.on('file.error.ace', function(e, info) {
|
||
//console.log(info.file_count);//number of selected files
|
||
//console.log(info.invalid_count);//number of invalid files
|
||
//console.log(info.error_list);//a list of errors in the following format
|
||
|
||
//info.error_count['ext']
|
||
//info.error_count['mime']
|
||
//info.error_count['size']
|
||
|
||
//info.error_list['ext'] = [list of file names with invalid extension]
|
||
//info.error_list['mime'] = [list of file names with invalid mimetype]
|
||
//info.error_list['size'] = [list of file names with invalid size]
|
||
|
||
|
||
/**
|
||
if( !info.dropped ) {
|
||
//perhapse reset file field if files have been selected, and there are invalid files among them
|
||
//when files are dropped, only valid files will be added to our file array
|
||
e.preventDefault();//it will rest input
|
||
}
|
||
*/
|
||
|
||
|
||
//if files have been selected (not dropped), you can choose to reset input
|
||
//because browser keeps all selected files anyway and this cannot be changed
|
||
//we can only reset file field to become empty again
|
||
//on any case you still should check files with your server side script
|
||
//because any arbitrary file can be uploaded by user and it's not safe to rely on browser-side measures
|
||
});
|
||
|
||
|
||
/**
|
||
file_input
|
||
.off('file.preview.ace')
|
||
.on('file.preview.ace', function(e, info) {
|
||
console.log(info.file.width);
|
||
console.log(info.file.height);
|
||
e.preventDefault();//to prevent preview
|
||
});
|
||
*/
|
||
|
||
});
|
||
|
||
$('#spinner1').ace_spinner({value:0,min:0,max:200,step:10, btn_up_class:'btn-info' , btn_down_class:'btn-info'})
|
||
.closest('.ace-spinner')
|
||
.on('changed.fu.spinbox', function(){
|
||
//console.log($('#spinner1').val())
|
||
});
|
||
$('#spinner2').ace_spinner({value:0,min:0,max:10000,step:100, touch_spinner: true, icon_up:'ace-icon fa fa-caret-up bigger-110', icon_down:'ace-icon fa fa-caret-down bigger-110'});
|
||
$('#spinner3').ace_spinner({value:0,min:-100,max:100,step:10, on_sides: true, icon_up:'ace-icon fa fa-plus bigger-110', icon_down:'ace-icon fa fa-minus bigger-110', btn_up_class:'btn-success' , btn_down_class:'btn-danger'});
|
||
$('#spinner4').ace_spinner({value:0,min:-100,max:100,step:10, on_sides: true, icon_up:'ace-icon fa fa-plus', icon_down:'ace-icon fa fa-minus', btn_up_class:'btn-purple' , btn_down_class:'btn-purple'});
|
||
|
||
//$('#spinner1').ace_spinner('disable').ace_spinner('value', 11);
|
||
//or
|
||
//$('#spinner1').closest('.ace-spinner').spinner('disable').spinner('enable').spinner('value', 11);//disable, enable or change value
|
||
//$('#spinner1').closest('.ace-spinner').spinner('value', 0);//reset to 0
|
||
|
||
|
||
//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();
|
||
});
|
||
|
||
//or change it into a date range picker
|
||
$('.input-daterange').datepicker({autoclose:true});
|
||
|
||
|
||
//to translate the daterange picker, please copy the "examples/daterange-fr.js" contents here before initialization
|
||
$('input[name=date-range-picker]').daterangepicker({
|
||
'applyClass' : 'btn-sm btn-success',
|
||
'cancelClass' : 'btn-sm btn-default',
|
||
locale: {
|
||
applyLabel: 'Apply',
|
||
cancelLabel: 'Cancel',
|
||
}
|
||
})
|
||
.prev().on(ace.click_event, function(){
|
||
$(this).next().focus();
|
||
});
|
||
|
||
|
||
$('#timepicker1').timepicker({
|
||
minuteStep: 1,
|
||
showSeconds: true,
|
||
showMeridian: false,
|
||
disableFocus: true,
|
||
icons: {
|
||
up: 'fa fa-chevron-up',
|
||
down: 'fa fa-chevron-down'
|
||
}
|
||
}).on('focus', function() {
|
||
$('#timepicker1').timepicker('showWidget');
|
||
}).next().on(ace.click_event, function(){
|
||
$(this).prev().focus();
|
||
});
|
||
|
||
|
||
|
||
|
||
if(!ace.vars['old_ie']) $('#appointment_date').datetimepicker({
|
||
format: 'DD/MM/YYYY h:mm A',//use this option to display seconds
|
||
defaultDate: new Date(),
|
||
maxDate: new Date(),
|
||
icons: {
|
||
time: 'fa fa-clock-o',
|
||
date: 'fa fa-calendar',
|
||
up: 'fa fa-chevron-up',
|
||
down: 'fa fa-chevron-down',
|
||
previous: 'fa fa-chevron-left',
|
||
next: 'fa fa-chevron-right',
|
||
today: 'fa fa-arrows ',
|
||
clear: 'fa fa-trash',
|
||
close: 'fa fa-times'
|
||
}
|
||
}).next().on(ace.click_event, function(){
|
||
$(this).prev().focus();
|
||
});
|
||
|
||
|
||
$('#colorpicker1').colorpicker();
|
||
//$('.colorpicker').last().css('z-index', 2000);//if colorpicker is inside a modal, its z-index should be higher than modal'safe
|
||
|
||
$('#simple-colorpicker-1').ace_colorpicker();
|
||
//$('#simple-colorpicker-1').ace_colorpicker('pick', 2);//select 2nd color
|
||
//$('#simple-colorpicker-1').ace_colorpicker('pick', '#fbe983');//select #fbe983 color
|
||
//var picker = $('#simple-colorpicker-1').data('ace_colorpicker')
|
||
//picker.pick('red', true);//insert the color if it doesn't exist
|
||
|
||
|
||
$(".knob").knob();
|
||
|
||
|
||
var tag_input = $('#form-field-tags');
|
||
try{
|
||
tag_input.tag(
|
||
{
|
||
placeholder:tag_input.attr('placeholder'),
|
||
//enable typeahead by specifying the source array
|
||
source: ailments,//defined in ace.js >> ace.enable_search_ahead
|
||
/**
|
||
//or fetch data from database, fetch those that match "query"
|
||
source: function(query, process) {
|
||
$.ajax({url: 'remote_source.php?q='+encodeURIComponent(query)})
|
||
.done(function(result_items){
|
||
process(result_items);
|
||
});
|
||
}
|
||
*/
|
||
}
|
||
)
|
||
|
||
//programmatically add/remove a tag
|
||
var $tag_obj = $('#form-field-tags').data('tag');
|
||
$tag_obj.add('Programmatically Added');
|
||
|
||
var index = $tag_obj.inValues('some tag');
|
||
$tag_obj.remove(index);
|
||
}
|
||
catch(e) {
|
||
//display a textarea for old IE, because it doesn't support this plugin or another one I tried!
|
||
tag_input.after('<textarea id="'+tag_input.attr('id')+'" name="'+tag_input.attr('name')+'" rows="3">'+tag_input.val()+'</textarea>').remove();
|
||
//autosize($('#form-field-tags'));
|
||
}
|
||
|
||
|
||
/////////
|
||
$('#modal-form input[type=file]').ace_file_input({
|
||
style:'well',
|
||
btn_choose:'Drop files here or click to choose',
|
||
btn_change:null,
|
||
no_icon:'ace-icon fa fa-cloud-upload',
|
||
droppable:true,
|
||
thumbnail:'large'
|
||
})
|
||
|
||
//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();
|
||
});
|
||
|
||
});
|
||
|
||
function myDateFormater(myDate){
|
||
var d=new Date(myDate);
|
||
var m=d.getMonth()+1;
|
||
var y=d.getFullYear();
|
||
var date=d.getDate();
|
||
// alert(date+"/"+m+"/"+y);
|
||
return date+"/"+m+"/"+y;
|
||
|
||
}
|
||
|
||
</script>
|