ohctech_p8/form/add_drug_allergy.php

80 lines
2.6 KiB
PHP
Raw Normal View History

2024-10-16 19:18:52 +05:30
<style>
#modal-add-ailment {
overflow-y: scroll;
}
</style>
<div class="modal fade" id="modal-add-drug-allergy" name="modal-add-drug-allergy" role="dialog" aria-hidden="true">
<form role="form" id="drug_allergy_new" name="drug_allergy_new" action="#" method="post">
<div class="modal-dialog">
<div class="modal-content">
<div class="widget-header">
<h5 class="widget-title">Add Drug Allergy</h5>
<div class="widget-toolbar">
<div class="widget-menu">
<a href="#" class="close" data-action="close" data-dismiss="modal">
<i class="ace-icon fa fa-times"></i>
</a>
</div>
</div>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12 form-group">
<input type="hidden" id="patient_id_drug" name="patient_id_drug" value="">
<label for="drug_allergy">Salt Names</label>
<select class="form-control chosen-select" name="drug_allergy_new_id[]" multiple="" id="drug_allergy_new_id" value="drug_allergy_new_id">
<?php
echo generateOptionForMultiple('salt_master', 'salt_name', 'salt_id', '', '');
?>
</select>
</div>
</div>
</div>
<div class="widget-toolbox padding-8 clearfix">
<button type="button" class="btn btn-info btn-sm" onclick="add_allergy();"><i class="ace-icon fa fa-floppy-o bigger-110"></i> Add </button>
</div>
</div>
</div>
</form>
</div>
<script>
function add_allergy() {
var drug_allergy = $('#drug_allergy_new_id').val();
if (drug_allergy == null || drug_allergy == '') {
BootstrapDialog.alert("You didn't select any drug allergy.!!!");
$('.close').click();
return false;
} else {
var patient_emp_id = $("#patient_id_drug").val();
var drug_allergy = $('#drug_allergy_new_id').val();
$('.close').click();
$.ajax({
type: 'post',
url: 'update_remove_drug_allergy.php',
data: {
drug_allergies: drug_allergy,
emp_id: patient_emp_id
},
success: function(data) {
if (data == 400) {
BootstrapDialog.alert("Something went wrong while saving");
} else if (data == 200) {
BootstrapDialog.alert("Done");
}
setTimeout(() => {
location.reload();
}, 1000);
},
error: function(data) {
BootstrapDialog.alert("Something went wrong while saving");
}
})
}
}
</script>