ESH/injury_new.php
2024-10-23 18:28:06 +05:30

1354 lines
77 KiB
PHP

<!-- 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>
<?php $rolecode = $_SESSION['RoleCode']; ?>
<script type="text/javascript">
function itemLevelTotol(treatment_item_qtygvn_field, current_rate_field, treatment_item_total_amount_field,
treatment_item_total_amount_field_div) {
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);
}
$("#treatmentTable").on("click", ".fa-trash-o", function(event) {
$(this).closest("tr").remove();
var counter = $("#count_treatment_item").val();
counter -= 1
$("#count_treatment_item").val(counter);
});
function orderLevelTotal(count) {
var totalAmount = 0;
//totalAmount=totalAmount+parseInt(treatment_item_total_amount_field_value);
for (var i = 0; i < count; i++) {
if ($("#treatment_item_total_amount_" + i).val() == "" || $("#treatment_item_total_amount_" + i).val() ==
null) {
$("#treatment_item_total_amount_" + i).val(0);
}
totalAmount = totalAmount + parseInt($("#treatment_item_total_amount_" + i).val());
}
//alert(totalAmount);
$("#order_level_total").val(totalAmount);
document.getElementById("order_level_total_div").innerText = totalAmount;
}
function setFieldDisableOrEnable(value) {
var count = $("#count_treatment_item").val();
if (value == 'Y') {
// $("[name='field07']").prop("disabled", false);
for (var i = 0; i < count; i++) {
$("#treatment_item_qtygvn_" + i).prop("disabled", false);
}
} else if (value == 'N') {
for (var i = 0; i < count; i++) {
$("#treatment_item_qtygvn_" + i).prop("disabled", true);
}
}
}
jQuery(function($) {
<?php if ($_SESSION['RoleCode'] == $_SESSION['RoleCode']) { ?>
$("#forwardButton").on("click", function() {
BootstrapDialog.show({
title: 'Forward',
message: '<select class="form-control" id="forward_status" style="margin-left:100px;width:60%">' +
'<option value="<?php echo $__STATUS_PHARMACY_PENDING ?>">Forward To Nursing</option>' +
'<option value="<?php echo $__STATUS_DOCTOR_PENDING ?>">Forward To Doctor</option>',
buttons: [{
label: 'OK',
action: function() {
$("#attendedStatus").val($("#forward_status").val());
validate($("#forward_status").val())
$(".close").click();
}
}]
});
});
<?php } else { ?>
validate($("#forward_status").val())
<?php } ?>
$('#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]'));
//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
$('#absence_date_range').datepicker({
autoclose: true,
format: 'dd/mm/yyyy',
startDate: '1d',
todayHighlight: 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(),
//minDate: new Date()-10,
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();
})
if (!ace.vars['old_ie']) $('#injury_time').datetimepicker({
format: 'DD/MM/YYYY h:mm A', //use this option to display seconds
defaultDate: new Date(),
maxDate: new Date(),
//minDate: new Date()-10,
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();
})
if (!ace.vars['old_ie']) $('#out_time').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();
});
});
</script>
<form id="opd_form" method="post">
<div class="widget-box box box-warning" style="border-top: 3px solid #d2d6de; border-top-color: #d2d6de">
<div class="widget-header" data-action="fullscreen">
<h5 class="widget-title">Injury > &nbsp; <?php echo $patient_name ?> &nbsp;<a target="_blank" href="emp_dashboard.php?flex_patient_id=<?php echo $row1['emp_id'] ?>"><i style="font-size: 17px;" class="glyphicon glyphicon-user"></i></a>
</h5>
<div class="widget-toolbar" style="float: right">
<div class="clearfix">
<div class="pull-right tableTools-container">
<div class="dt-buttons btn-overlap btn-group">
<a class="dt-button buttons-csv buttons-html5 btn btn-white btn-primary btn-bold" id="forwardButton" tabindex="0" aria-controls="dynamic-table" data-original-title="Save" title="Save"><span><i class="fa fa-save bigger-110 blue"></i> <span class="hidden">Save</span></span></a>
<a id="hide" style="display: none" class="dt-button buttons-print btn btn-white btn-primary btn-bold" onclick="exporttopdf();" tabindex="0" aria-controls="dynamic-table" data-original-title="Print" title="Print"><span><i class="fa fa-print bigger-110 grey"></i>
<span class="hidden">Print</span></span></a> <a class="dt-button buttons-print btn btn-white btn-primary btn-bold" data-action="fullscreen" tabindex="0" aria-controls="dynamic-table" data-original-title="" title=""> <span><i class="fa fa fa-expand bigger-110 grey"></i>
<span class="hidden">Maximize</span></span></a> <input type="hidden" name="attendedStatus" id="attendedStatus" value="<?php echo $__STATUS_RECEPTIONIST_ATTENDED ?>" />
</div>
</div>
</div>
</div>
</div>
<div class="widget-body ">
<div class="widget-main">
<div class="row">
<div class="col-xs-9 table-responsive">
<div class="widget-box box box-warning">
<div class="widget-body">
<div class="widget-main">
<div class="row">
<div class="col-xs-12">
<div class="row">
<div class="col-sm-2">
<label class="control-label" for="appointment_id"><strong style="font-size: 11px">Medical Record No:</strong></label>
<?php
//$ticket_no = getTableFieldValue('employee_appointment','max(appointment_id)');
$ticket_no = creatingTicketNoInjury();
?>
<input id="ticket_no" type="hidden" name="ticket_no" value="<?php echo $ticket_no; ?>" /> <input id="appointment_id" type="hidden" name="appointment_id" />
<div class="input-group">
<?php echo $ticket_no; ?>
</div>
</div>
<!-- <div class="col-sm-3">
<label class="control-label" for="appointment_date"><strong
style="font-size: 11px">Token No</strong></label>
<div class="input-group">
<input id="token_no" name="token_no" type="text"/>
</div>
</div> -->
<div class="col-sm-2">
<label class="control-label" for="appointment_date"><strong style="font-size: 11px">In Time</strong></label>
<div class="input-group">
<input id="emp_id" name="emp_id" type="hidden" value="<?php echo ($_REQUEST['flex_opd_id'] != '' ? $_REQUEST['flex_opd_id'] : $_REQUEST['flex_patient_id']) ?>" />
<input id="appointment_type" name="appointment_type" type="hidden" value="I" /> <input id="appointment_date" type="text" style="height: 30px" class="form-control" name="appointment_date" /> <span class="input-group-addon">
<i class="fa fa-clock-o bigger-110" style="height: 5px; width: 30px"></i>
</span>
</div>
</div>
<!-- <div class="col-sm-3">
<label class="control-label" for="appointment_date"><strong style="font-size: 11px">Clearance Time</strong></label>
<div class="input-group">
<input id="out_time" type="text" style="height: 30px" class="form-control" name="out_time" /> <span class="input-group-addon"> <i class="fa fa-clock-o bigger-110" style="height: 5px; width: 30px"></i>
</span>
</div>
</div>
-->
<div class=" col-sm-2">
<label class="control-label" for="followup_to_opd"><strong style="font-size: 11px">Case type</strong></label>
<select class="form-control" id="case_type" name="case_type">
<option value="">None</option>
<?php echo generateOption('case_type','case_name','case_code','','') ?>
</select>
</div>
<div class="col-sm-3">
<label class="control-label" for="shift_type">SHIFT
</label>
<select class="form-control select2" id="shift_type" name="shift_type">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="G">G</option>
</select>
</div>
<div class=" col-sm-3">
<label class="control-label" for="followup_to_opd"><strong style="font-size: 11px">Followup to(if
Applicable)</strong></label>
<div class="input-group">
<select id="followup_to_opd" style="width: 160px;" name="followup_to_opd">
<option value="">None</option>
<?php echo generateOptionWithWhereClause('employee_appointment', "CONCAT(ticket_no,' ',DATE_FORMAT(appointment_date,'%d-%b-%Y %l:%i %p '))", 'appointment_id', '', '', 'emp_id', ($_REQUEST['flex_opd_id'] != '' ? $_REQUEST['flex_opd_id'] : $_REQUEST['flex_patient_id'])); ?>
</select>
</div>
</div>
</div>
<div class="space-6"></div>
<!-- <div class="row">
<div class="col-sm-6">
<label class="control-label" for="injury_time"><strong
style="font-size: 11px">Injury Time</strong></label>
<div class="input-group">
<input id="injury_time" type="text" class="form-control"
style="height: 30px" name="injury_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-6">
<label class="control-label" for="form-field-8"><strong
style="font-size: 11px">Incident Location</strong></label>
<input type="text" class="form-control"
name="incident_location" id="incident_location"
value="<?php echo $row['incident_location'] ?>"
placeholder="Location where injury happend"
maxLength="200">
</div>
</div>
<div class="space-6"></div> -->
<!-- <div class="row">
<div class="col-sm-4">
<label class="control-label" for="form-field-8"><strong
style="font-size: 11px">Division where incindent occured</strong></label>
<select class="form-control" name="division"
id="division">
<option disabled selected>Please
select option</option>
<?php echo generateOption('bussiness_unit', 'bu_name', 'bu_id', '', ''); ?>
</select>
</div>
<div class="col-sm-4">
<label class="control-label" for="form-field-8"><strong
style="font-size: 11px">Sub Division(Department) where incident occured</strong></label>
<select name="dept" id="dept" class="form-control">
<option value="" disabled selected>Please select an option</option>
<?php echo generateOption('department', 'dept_name', 'dept_id', $row['dept'], '') ?>
</select>
</div>
<div class="col-sm-4">
<label class="control-label" for="form-field-8"><strong
style="font-size: 11px">Sub station(Ute)</strong></label>
<select class="form-control" name="section" id="section">
<option disabled selected>Please
select option</option>
<?php echo generateOption('section', 'section_name', 'section_id', '', ''); ?>
</select>
</div>
</div> -->
<div class="space-6"></div>
<div class="row">
<div class="col-sm-2">
<label class="control-label" for="form-field-8"><strong style="font-size: 11px">Referred By</strong></label>
<br>
<select class="form-control" id="referred_by" name="referred_by">
<option value="" disabled selected>Please select an option
</option>
<?php echo generateOption('referred_by_master', 'referred_by', 'id', $row['referred_by'], '') ?>
</select>
</div>
<div class="col-sm-2">
<label class="control-label" for="form-field-8"><strong style="font-size: 11px">INJURY DEFINE</strong></label>
<br>
<select class="form-control" id="injury_def" name="injury_def">
<option value="" disabled selected>Please select an option
</option>
<option value="init">Initiated
</option>
<option value="not-init">Not Initiated
</option>
</select>
</strong></label>
<br>
</div>
<div class="col-sm-2">
<label class="control-label" for="injury_time"><strong style="font-size: 11px">Injury Time</strong></label>
<div class="input-group">
<input id="injury_time" type="text" style="height: 30px" class="form-control" name="injury_time" /> <span class="input-group-addon">
<i class="fa fa-clock-o bigger-110" style="height: 5px; width: 30px"></i>
</span>
</div>
</div>
<?php
$complaint_config = getFieldFromTable('value', 'config', 'key_name', 'complaint_tag_switch');
error_log("complaints_config tag switch " . $complaint_config . " compare " . strcmp(strtolower($complaint_config), "false"));
if (!strcmp(strtolower($complaint_config), "false")) {
?>
<div class="col-sm-3">
<label class="control-label" for="form-field-8"><strong style="font-size: 10px">Complaints</strong></label>
<br>
<div>
<select class="form-control chosen-select" name="complaints[]" id="complaints" multiple>
<?php echo generateOption('complaints', 'complaint', 'complaint_id', '', '') ?>
</select>
</div>
</div>
<?php
} else { ?>
<div class="col-sm-3">
<label class="control-label" for="form-field-8"><strong style="font-size: 10px">Complaints</strong></label>
<br>
<div class="input-group">
<input type="text" class="form-control" id="complaints" name="complaints" data-placeholder="Complaints" />
</div>
</div>
<?php } ?>
<?php
if ($_SESSION['RoleCode'] == $_SESSION['RoleCode']) {
?>
<input type="hidden" name="doctor_attended_flag" id="doctor_attended_flag" value="N"> <input type="hidden" name="medicine_disbursement" value="N">
<div class="col-sm-3">
<label class="control-label" for="ailment"><strong style="font-size: 11px">OHC Staff Notes</strong></label>
<textarea name="remarks_rece" rows="3" cols="8" id="remarks_rece" placeholder="Remaks" class="autosize-transition form-control" style="overflow: hidden; overflow-wrap: break-word;"></textarea>
</div>
<?php } else { ?>
<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="10" class="autosize-transition form-control" style="overflow: hidden; overflow-wrap: break-word;" id="examination_remarks" name="examination_remarks" placeholder="On Examination Symptoms" maxlength="500"></textarea>
</div>
<?php
}
?>
</div>
<?php
if ($_SESSION['RoleCode'] != $_SESSION['RoleCode']) {
?>
<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="row">
<div class="col-sm-6">
<label class="control-label" for="remarks"><strong style="font-size: 11px">Procedure</strong></label>
<textarea id="proc_remarks" name="proc_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-responsive">
<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
Per Unit</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
Price</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 generateMedicineOptions($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','treatment_item_total_div0')" />
</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_div<?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" />
<input type="hidden" name="treatment_id0" id="treatment_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" disabled 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');checkQty(); " />
</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_new" id="count_treatment_item_new" value="1" />
<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-3">
<label class=" control-label " for="form-field-8"><strong ` style="font-size: 11px">Medicine Disbursment</strong>
</label>
</div>
<div class="col-sm-1">
<input type="radio" name="medicine_disbursement" value="Y" onchange="setFieldDisableOrEnable(this.value)"> Yes<br>
</div>
<div class="col-sm-1">
<input type="radio" name="medicine_disbursement" value="N" checked onchange="setFieldDisableOrEnable(this.value)"> No
</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>
<?php } ?>
</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 table-responsive">
<div class="widget-box box box-danger">
<div class="widget-body">
<div class="widget-main">
<div class="row">
<div class="col-sm-6">
<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 class="col-sm-6">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">Chargeable?</strong></label> <select class="form-control" style="height: 30px;" id="isChargeable" name="isChargeable">
<option value="0">No</option>
<option value="1" selected>Yes</option>
</select>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<div class="col-xs-4" style="margin-left: -12px">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">Weight</strong></label>
<input type="number" style="height: 30px;" min="0" max="1000" placeholder="WEIGHT(kg)" id="weight" name="weight" onchange="calculateBMI()">
</div>
<div class="col-xs-4">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">Height</strong></label>
<input type="number" min="0" max="1000" style="height: 30px;" id="height" name="height" placeholder="HEIGHT (cms)" min="0" max="1000" onchange="calculateBMI()">
</div>
<div class="col-xs-4">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">BMI</strong></label>
<input type="number" style="height: 30px;width: 85px" id="bmi" name="bmi" placeholder="BMI(KG/m2)" min="0" max="200">
</div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<div class="col-xs-4" style="margin-left: -12px">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">SBP</strong></label>
<input type="number" style="height: 30px;" min="0" max="1000" placeholder="SBP" id="sbp" name="sbp">
</div>
<div class="col-xs-4">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">DBP</strong></label>
<input type="number" min="0" max="1000" style="height: 30px;" id="DBP" name="dbp" placeholder="DBP" min="0" max="1000">
</div>
<div class="col-xs-4">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">Temperature</strong></label>
<input type="number" style="height: 30px;width: 85px" min="0" max="1000" placeholder="Temp.(F)" id="temperature" name="temperature" value="<?php echo $row['temperature'] ?>" maxlength="10">
</div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<div class="col-xs-4" style="margin-left: -12px">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">Respiratory Rate</strong></label>
<input type="number" style="height: 30px;" min="0" max="1000" placeholder="Respiratory rate" id="resp_rate" name="resp_rate">
</div>
<div class="col-xs-4">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">Heart Rate</strong></label>
<input type="number" style="height: 30px;" id="heart_rate" name="heart_rate" placeholder="Heart Rate(BPM)" min="0" max="200">
</div>
<div class="col-xs-4">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">Urine output</strong></label>
<input type="number" min="0" max="1000" style="height: 30px;width: 85px" id="urine_output" name="urine_output" placeholder="Urine Output">
</div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<div class="col-xs-4" style="margin-left: -12px">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">FBS</strong></label>
<input type="number" style="height: 30px;" min="0" max="1000" placeholder="FBS" id="fbs" name="fbs">
</div>
<div class="col-xs-4">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">RBS</strong></label>
<input type="number" min="0" max="1000" style="height: 30px;" id="rbs" name="rbs" placeholder="RBS">
</div>
<div class="col-xs-4">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">PPBS</strong></label>
<input type="number" min="0" max="1000" style="height: 30px;width: 85px" id="ppbs" name="ppbs" placeholder="PPBS">
</div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<div class="col-xs-4" style="margin-left: -12px">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">SPO2</strong></label>
<input type="number" min="0" max="1000" style="height: 30px;" id="spo2_percent" name="spoc2_percent" placeholder="SPO2" value="<?php echo $row['spo2_percent'] ?>" maxlength="10">
</div>
<div class="col-xs-4">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">AVPU</strong></label>
<input type="number" min="0" max="1000" style="height: 30px;" id="avpu" name="avpu" placeholder="AVPU" value="<?php echo $row['avpu'] ?>" maxlength="10">
</div>
<div class="col-xs-4">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 11px">TRAMA</strong></label>
<input type="number" min="0" max="1000" style="height: 30px;width: 85px" id="trama" name="trama" placeholder="Trama" value="<?php echo $row['trama'] ?>" maxlength="10">
</div>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<div class="col-xs-4" style="margin-left: -12px">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 9px">oxygen supplementation</strong></label>
<input type="number" min="0" max="1000" style="height: 30px;" id="oxygen_supply" name="oxygen_supply" placeholder="Oxygen supplementation" value="<?php echo $row['oxygen_supply'] ?>" maxlength="10">
</div>
<div class="col-xs-4">
<label class="control-label" for="form-field-select-1"><strong style="font-size: 9px">glasgow coma scale</strong></label>
<input type="number" min="0" max="1000" style="height: 30px;" id="glasgow_coma_scale" name="glasgow_coma_scale" placeholder="Glasgow coma scale" value="<?php echo $row['glasgow_coma_scale'] ?>" maxlength="10">
</div>
<div class="col-xs-4">
<br>
<label class="control-label" for="form-field-select-1"><strong style="font-size: 9px">Mobility</strong></label>
<input type="number" min="0" max="1000" style="height: 31px;width: 85px" id="mobility" name="mobility" placeholder="Mobility" value="<?php echo $row['mobility'] ?>" maxlength="10">
</div>
</div>
</div>
<?php if ($_SESSION['RoleCode'] != $_SESSION['RoleCode']) { ?>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<label class="control-label" for="injury_part"><strong style="font-size: 11px">Affected Body Parts</strong></label>
<select multiple="" class="chosen-select form-control" id="injury_part" name="injury_part[]" data-placeholder="Affected Body Parts..">
<?php echo generateOption('injury_part', 'inj_name', 'inj_id', '', ''); ?>
</select>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<label class="control-label" for="health_advice_name"><strong style="font-size: 11px">Health Advices</strong></label> <select multiple="" class="chosen-select form-control" id="health_advice_name" name="health_advice_name[]" data-placeholder="Health Advices..">
<?php echo generateOption('health_advice', 'health_advice_name', 'health_advice_id', '', ''); ?>
</select>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<label class="control-label" for="additional_advices"><strong style="font-size: 11px">Recommended Tests For
Checkup</strong></label>
<select multiple="" class="chosen-select form-control" id="recommended_test" name="recommended_test[]" data-placeholder="Doctor Recommended Tests..">
<?php echo generateOptionForMultiple('checkup_form_section', 'section_name', 'section_id', $row['tests'], ''); ?>
</select>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12">
<label class="control-label" for="additional_advices"><strong style="font-size: 11px">Additional Precautions</strong></label>
<textarea name="remarks" placeholder="Additional Precautions.." rows="3" cols="8" id="remarks" class="autosize-transition form-control" style="overflow: hidden; overflow-wrap: break-word;"></textarea>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<form id="pdfform" target="_blank">
<input type="hidden" id="appointment_id_pdf" name="appointment_id_pdf">
</form>
<script>
$(document).ready(function() {
$("#hide").hide();
});
function exporttopdf() {
document.forms['pdfform'].action = "injury_form_pdf.php";
document.forms['pdfform'].method = "post";
document.forms['pdfform'].submit();
}
addRow('');
addRow('');
var flag = 0;
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 style=\"width:70%\">");
var cols = "";
var select_treatment = "";
select_treatment += "<select onchange=\"getItemDetails(this.value,'current_stock" + "_" + counter +
"','current_stock_div" + counter + "','current_rate" + "_" + counter + "','current_rate_div" + counter + "','" +
appointment_id + "', '" + counter + "');\" class='chosen-select form-control'";
select_treatment += "id=\"treatment_item" + "_" + counter + "\"name=\"treatment_item" + counter +
"\"data-placeholder=\"Treatment...\"";
//select_treatment+="style=\"display: none;\"";
select_treatment += ">";
select_treatment += "<option value=\"\"> </option>";
select_treatment += itemOptions
select_treatment += "</select>";
cols += '<td style=\"width:15%\">' + select_treatment + '</td>';
var select_dosage = "";
select_dosage += "<select onchange=\"getFrequenceyQty(this.value,'frequency_qty" + "_" + counter + "','dosage" +
"_" + counter + "','" + appointment_id + "', '" + counter + "');\" class='chosen-select form-control'";
select_dosage += "id=\"treatment_item_dosage" + "_" + counter + "\"name=\"treatment_item_dosage" + counter +
"\"data-placeholder=\"Dosage...\"";
//select_dosage+="style=\"display: none;\"";
select_dosage += ">";
select_dosage += "<option value=\"\"> </option>";
select_dosage += itemDosages
select_dosage += "</select>";
cols += '<td style=\"width:15%\" >' + select_dosage + '</td>';
cols += '<td style=\"width:10%\"><input type=\"hidden\" name=\"treatment_id' + counter + '" id=\"treatment_id' +
'_' + counter +
'" ><input type="number" style="height:25px;font-size:12px" class="form-control"id ="treatment_item_days' +
'_' + counter + '" value="1" onblur="updateTotalMedicineQty(\'frequency_qty' + '_' + counter +
'\',\'treatment_item_days' + '_' + counter + '\',\'treatment_item_total_' + counter +
'\',\'treatment_item_total_div' + counter + '\')" name="treatment_item_days' + counter + '"/></td>';
cols += '<td style=\"width:5%\" ><div style="text-align:center" id="treatment_item_total_div' + counter +
'""></div><input type="hidden" style="height:25px;font-size:12px" class="form-control"id="treatment_item_total_' +
counter + '" name="treatment_item_total' + appointment_id + counter + '" readonly/></td>';
cols += '<td style=\"width:5%\"><input type="hidden" name="frequency_qty' + counter + '" id="frequency_qty' + '_' +
counter + '" /><input type="hidden" name="dosage' + counter + '" id="dosage' + appointment_id + '_' + counter +
'" /> <div style="text-align:center" id="current_rate_div' + counter +
'" "></div><input type="hidden" style="height:25px;font-size:12px" class="form-control" id="current_rate' +
'_' + counter + '" name="current_rate' + counter + '" onblur="updatePrice(\'treatment_item_qtygvn' + '_' +
counter + '\',\'treatment_item' + '_' + counter + '\',\'current_rate' + '_' + counter + '\',\'current_stock' +
'_' + counter + '\',\'price' + '_' + counter + '\')" /></td>';
cols += '<td style=\"width:5%\"><div style="text-align:center" id="current_stock_div' + counter +
'" ></div><input type="hidden" style="height:25px;font-size:12px" class="form-control" id="current_stock' +
'_' + counter + '" name="current_stock' + counter + '" /></td>';
cols +=
'<td style=\"width:5%\"><input type="text" style="height:25px;font-size:12px" class="form-control" id="treatment_item_qtygvn' +
'_' + counter + '" name="treatment_item_qtygvn' + counter +
'" onchange="itemLevelTotol(\'treatment_item_qtygvn' + '_' + counter + '\',\'current_rate' + '_' + counter +
'\',\'treatment_item_total_amount' + '_' + counter + '\',\'treatment_item_total_amount_div' + counter +
'\');checkQty()" /></td>';
cols += '<td style=\"width:5%\"><div style="text-align:center" id="treatment_item_total_amount_div' + counter +
'"></div><input type="hidden" style="height:25px;font-size:12px" class="form-control" id="treatment_item_total_amount' +
'_' + counter + '" name="treatment_item_total_amount' + counter + '"/></td>';
if (counter > 0)
cols += '<td style=\"width:5%\"><a href="#"><i class="ace-icon fa fa-trash-o bigger-130"></i></a></td>';
else
cols += '<td style=\"width:5%\"></td>';
newRow.append(cols);
$("#treatmentTable").append(newRow);
if (parseInt(counter) > 2) {
// $('.chosen-select').chosen({allow_single_deselect:true});
//$('.chosen-select').next().css({'width': $('#treatment_item'+counter).parent().width()});
$('#treatment_item_dosage' + "_" + counter).chosen({
allow_single_deselect: true
});
$('#treatment_item_dosage' + "_" + counter).next().css({
'width': '100%'
});
$('#treatment_item' + "_" + counter).chosen({
allow_single_deselect: true
});
$('#treatment_item' + "_" + counter).next().css({
'width': '100%'
});
}
if (parseInt($("#count_treatment_item_new").val()) > parseInt($("#count_treatment_item").val())) {
$('#treatment_item_dosage' + "_" + counter).chosen({
allow_single_deselect: true
});
$('#treatment_item_dosage' + "_" + counter).next().css({
'width': '100%'
});
$('#treatment_item' + "_" + counter).chosen({
allow_single_deselect: true
});
$('#treatment_item' + "_" + counter).next().css({
'width': '100%'
});
flag = 1;
} else if (flag == 1 && parseInt(counter) == 2) {
$('#treatment_item_dosage' + "_" + counter).chosen({
allow_single_deselect: true
});
$('#treatment_item_dosage' + "_" + counter).next().css({
'width': '100%'
});
$('#treatment_item' + "_" + counter).chosen({
allow_single_deselect: true
});
$('#treatment_item' + "_" + counter).next().css({
'width': '100%'
});
}
counter++;
$("#count_treatment_item" + appointment_id).val(counter);
$("#count_treatment_item_new").val(counter);
//resizeChosen();
//jQuery(window).on('resize', resizeChosen);
$("#treatmentTable").on("click", ".fa-trash-o", function(event) {
$(this).closest("tr").remove();
counter -= 1
$("#count_treatment_item").val(counter);
});
var valueChecked = $('input[name=medicine_disbursement]:checked').val();
setFieldDisableOrEnable(valueChecked)
}
function getBMI(height, weight) {
//var height=$("#"+heightField).val();
//var weight=$("#"+WeightField).val();
if (height != null && height != '' && weight != null && weight != '') {
height = parseFloat(height);
weight = parseFloat(weight);
if (height != 0.0)
var bmi = (weight / (height / 100 * height / 100));
return bmi.toFixed(1);
}
return "";
}
function calculateBMI() {
var height = $("#height").val();
var weight = $("#weight").val();
$("#bmi").val(getBMI(height, weight));
}
function checkQty() {
var counter = $("#count_treatment_item").val();
for (var i = 0; i < counter; i++) {
var treatment_qty = $("#treatment_item_total_" + i).val();
var issued_qty = $("#treatment_item_qtygvn_" + i).val();
if (issued_qty == null || issued_qty == '') {
issued_qty = 0;
}
if (issued_qty > treatment_qty) {
BootstrapDialog.alert(' Issue Qty should be less than or equal to Treatment Qty .!!!');
return false;
}
}
}
function setFieldDisableOrEnable(value) {
var count = $("#count_treatment_item").val();
if (value == 'Y') {
// $("[name='field07']").prop("disabled", false);
for (var i = 0; i < count; i++) {
$("#treatment_item_qtygvn_" + i).prop("disabled", false);
}
} else if (value == 'N') {
for (var i = 0; i < count; i++) {
$("#treatment_item_qtygvn_" + i).prop("disabled", true);
}
}
}
<?php if (!strcmp(strtolower($complaint_config), "true")) { ?>
if ($('#complaints')) {
var complaints = new Array();
getComplaints();
function getComplaints() {
$.ajax({
url: 'select_complaints.php',
type: "GET",
success: function(data) {
complaints = $.parseJSON(data);
},
error: function(data) {
BootstrapDialog.alert('Error pulling Complaints!!');
return;
}
});
}
}
if ($('#complaints')) {
setTimeout(function() {
var tag_input_complaints = $('#complaints');
try {
tag_input_complaints.tag({
placeholder: tag_input_complaints.attr('placeholder'),
source: complaints
})
//programmatically add/remove a tag
var $tag_obj = $('#complaints').data('tag');
//$tag_obj.add('Programmatically Added');
var existingComplaints = "<?php echo $row['complaints'] ?>"
if (existingComplaints != undefined && existingComplaints != null && existingComplaints != '') {
var existingComplaintsArr = existingComplaints.split(",");
jQuery.each(existingComplaintsArr, function(i, val) {
$tag_obj.add(val.toUpperCase());
});
}
//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_complaints.after('<textarea id="' + tag_input_complaints.attr('id') + '" name="' +
tag_input_complaints.attr('name') + '" rows="3">' + tag_input_complaints.val() +
'</textarea>').remove();
//autosize($('#form-field-tags'));
}
var y = $('#complaints').parents(".col-sm-3").width();
$('#complaints').siblings().css('width', y - 5);
}, 2000);
}
<?php } ?>
</script>