Files
streamline-emr/docker/statistics/Modules/Theatre/Resources/views/anaesthetics/create.blade.php
T
2025-03-31 03:46:05 +03:00

1355 lines
72 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('anaesthetics.theatre_module_anaesthetics') }}</h4>
</div>
<div class="col-lg-8 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('home.dashboard') }}</a></li>
<li><a href="{{ route('anaesthetics.index') }}">{{ __('anaesthetics.anaesthetics') }}</a></li>
<li class="active">{{ __('anaesthetics.create_anaesthetics') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patients::allergies.header')
</div>
</div>
@if(isset($anaesthesia_records) && count($anaesthesia_records) > 0)
<div class="table-responsive row white-box" style="padding-top: 5px;">
<div class="col-md-12">
<b>{{ __('anaesthetics.previous_anaesthesia_started_on') }} <font color="blue">{{ streamline_date(get_name($episode_id, 'id', 'created_at', 'patient_episodes')) }}</font></b>
<table class="table table-striped table-bordered">
<thead>
<th>{{ __('anaesthetics.procedure') }}</th>
<th>{{ __('anaesthetics.surgery') }}</th>
<th>{{ __('anaesthetics.anaesthetist') }}</th>
<th>{{ __('anaesthetics.time_of_commencement') }}</th>
<th>{{ __('anaesthetics.date') }}</th>
<th></th>
<th></th>
</thead>
<tbody>
@foreach($anaesthesia_records as $anaesthesia)
<tr>
<td>{{ get_name($anaesthesia->procedure_id,'id','name','procedures') }}</td>
<td>{!! $anaesthesia->surgery_id != null ? '<font color="green">Done</font>' : '<font color="red">Not done</font>' !!}</td>
<td>{{ get_name($anaesthesia->anaesthetist,'id','first_name','users') }}</td>
<td>{{ $anaesthesia->time_commenced }}</td>
<td>{{ streamline_date($anaesthesia->created_at) }}</td>
<td><a class="btn btn-sm btn-info" href="/anaesthetics/view_history/{{ $anaesthesia->id }}">{{ __('anaesthetics.view_details') }}</a></td>
<td><a class="btn btn-sm btn-success" href="/anaesthetics/{{ $anaesthesia->id }}/edit">Edit Anaethesia</a></td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
<div class="row">
<div class="col-sm-12">
@include('flash::message')
@php
$consultation = \Streamline\Models\Consultation::where(['episode_id' => $episode_id, 'patient_id' => $patient_id])->first();
@endphp
@foreach ($errors->all() as $error)
<div><font color="red">{{ $error }}</font></div>
@endforeach
<div class="white-box">
<h3>{{ __('anaesthetics.create_new_anaesthesia') }}</h3><br>
{{ Form::open(['route' => 'anaesthetics.store','data-toggle'=>'validator']) }}
<div class="row">
<div class="col-sm-12">
<div class="table-responsive">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th>{{ __('inpatient.primary_diagnosis') }}</th>
<th>{{ __('inpatient.prompt') }}</th>
<th>{{ __('inpatient.references') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 30%;">
<div class="form-group">
{{ Form::select('primary_diagnosis', $diagnoses, $consultation ? $consultation->primary_diagnosis : "", ['class' => 'form-control select_field col-sm-12 compulsory', 'required', 'id' => 'primary_diagnosis']) }}
</div>
</td>
<td style="width: 45%; color: #C85F6A;"><div class="well well-sm" id="primary_diagnosis_prompt">{{ (isset($consultation->primary_diagnosis) && $consultation->primary_diagnosis != 0) ? $diagnoses_all->firstWhere('id',$consultation->primary_diagnosis)->prompts : "" }}&nbsp;</div></td>
<td style="width: 25%">
<div class="well well-sm" id="primary_diagnosis_reference">
@if(!is_null($consultation) && $consultation->primary_diagnosis != 0)
@php
$reference_names = explode(",", get_name($consultation->primary_diagnosis, 'id', 'reference_names', 'diagnoses'));
$reference_areas = explode(",", get_name($consultation->primary_diagnosis, 'id', 'reference_areas', 'diagnoses'));
@endphp
@for($i = 0; $i < count($reference_names); $i++)
@if(isset($reference_areas[$i]) && isset($reference_names[$i]))
<a href="{{ $reference_areas[$i] }}" target='_blank'> {{ $reference_names[$i] }} </a> <span style='color: red'> | </span>
@endif
@endfor
@endif
</div>
</td>
</tr>
<tr>
<td>
<a data-toggle="modal" data-target="#diagnosisModal" class="label labelLeft label-info pull-left" style="color: #fff;">{{ __('consultations.add_new_diagnosis') }}</a>
</td>
<td colspan="2"></td>
</tr>
</tbody>
</table>
</div>
<hr/>
<div class="table-responsive">
<table class="table color-table success-table table-condensed table-bordered" id="other_diagnosis_table">
<thead>
<tr>
<th class="text-center">#</th>
<th>{{ __('inpatient.other_diagnosis') }}</th>
<th>{{ __('inpatient.prompt') }}</th>
<th>{{ __('inpatient.references') }}</th>
</tr>
</thead>
<tbody>
@php
$other_diagnoses = [];
if($consultation){
$other_diagnoses = @unserialize($consultation->other_diagnoses);
}
@endphp
@if(empty($other_diagnoses))
<tr>
<td><input type="checkbox" name="chk" id="chk"></td>
<td style="width: 30%;">
{{ Form::select('other_diagnosis[]', $diagnoses, '', ['class' => 'form-control col-sm-12 sec_d']) }}
</td>
<td style="width: 45%"><div class="well well-sm" id="secondary_diagnosis_prompt1">&nbsp;</div></td>
<td style="width: 25%"><div class="well well-sm" id="secondary_diagnosis_reference1">&nbsp;</div></td>
</tr>
@else
@foreach($other_diagnoses as $diagnosis)
<tr>
<td><input type="checkbox" name="chk" id="chk"></td>
<td style="width: 30%;">
{{ Form::select('other_diagnosis[]', $diagnoses, $diagnosis, ['class' => 'form-control col-sm-12 select sec_d']) }}
</td>
<td style="width: 45%; color: #C85F6A;"><div class="well well-sm" id="secondary_diagnosis_prompt1">{{ is_object($diagnoses_all->firstWhere('id',$diagnosis)) ? $diagnoses_all->firstWhere('id',$diagnosis)->prompts : '' }}&nbsp;</div></td>
<td style="width: 25%"><div class="well well-sm" id="secondary_diagnosis_reference1">{{ is_object($diagnoses_all->firstWhere('id',$diagnosis)) ? $diagnoses_all->firstWhere('id',$diagnosis)->reference_names : '' }}&nbsp;</div></td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
<a class="btn btn-success btn-xs m-t-10" id="add_row" onclick="addRow('other_diagnosis_table')">{{ __('inpatient.add_row') }}</a>
<a class="btn btn-danger btn-xs m-t-10" id="delete_row" onclick="deleteRow('other_diagnosis_table')">{{ __('inpatient.delete_row') }}</a>
</div>
@php $surgery_complete = false; @endphp
@if(!is_null($surgery_done))
@php $surgery_complete = true; @endphp
<input type="hidden" name="surgery_id" value="{{ $surgery_done->id }}">
@endif
<input type="hidden" name="surgery_complete" value="{{ $surgery_complete }}">
<div class="col-sm-4">
<br><br>
<div class="form-group">
{{ Form::label('procedure_id',__('anaesthetics.surgical_procedure')) }}
{{ Form::select('procedure_id',$procedures,$surgery_complete ? $surgery_done->procedure_id : "",['class' => 'form-control compulsory', 'required', 'data-error'=>'','id'=>'procedure_id']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('anaesthetist',__('anaesthetics.anaesthetist')) }}
{{ Form::select('anaesthetist',$doctors,'',['class' => 'form-control compulsory', 'required', 'data-error'=>'','id'=>'anaesthetist']) }}
<div class="help-block with-errors"></div>
<a href="#modal_new_doctor" data-toggle="modal" id="new_doctor_modal"><small>add new doctor</small></a>
</div>
<div class="form-group">
{{ Form::label('anaesthetic_commence_time',__('anaesthetics.time_anaesthesia_commenced')) }}
{{ Form::time('anaesthetic_commence_time','',['class' => 'form-control compulsory', 'required', 'data-error'=>'','id'=>'anaesthetic_commence_time']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('mallampati_score',__('anaesthetics.mallampati_score')) }}
(<a href="#modal_new_mallampati" data-toggle="modal" id="new_mallampati_modal">Click To View Mallampati Details</a>)
<select class="form-control" name="mallampati_score" id="mallampati_score">
<option value="">- Select -</option>
<option value="I">Class I</option>
<option value="II">Class II</option>
<option value="III">Class III</option>
<option value="IV">Class IV</option>
</select>
</div>
<div class="form-group">
{{ Form::label('asa_classfication',__('anaesthetics.asa_classification')) }}
(<a href="#modal_new_asa" data-toggle="modal" id="new_asa_modal">Click To View ASA Classification Details</a>)
<select class="form-control compulsory" name="asa_classification" required id="asa_classification">
<option value="">- select -</option>
<option value="1">ASA 1</option>
<option value="2">ASA 2</option>
<option value="3">ASA 3</option>
<option value="4">ASA 4</option>
<option value="5">ASA 5</option>
<option value="6">ASA 6</option>
</select>
</div>
<div class="form-group row" id="sundries_used_div">
<div class="col-sm-8">
{{ Form::label('sundries_used','Sundries used') }}
{{ Form::select('sundries_used[]',$sundries_array,'',['class' => 'form-control sundries_sutures select_field', 'data-error'=>'','id'=>'vicryl_sutures_used']) }}
</div>
<div class="col-sm-4">
{{ Form::label('sundries_quantity_used','Quantity used') }}
{{ Form::number('sundries_quantity_used[]','',['class' => 'form-control', 'data-error'=>'']) }}
</div>
</div>
<span class="label label-info label-sm"><a href="#" id="addOption" style="color: #fff">Add other sundries used</a></span><br><br>
<div class="form-group row" id="extras_used_div">
<div class="col-sm-8">
{{ Form::label('extras_used','Extras used') }}
{{ Form::text('extras_used[]','',['class' => 'form-control', 'data-error'=>'']) }}
</div>
<div class="col-sm-4">
{{ Form::label('extras_cost','Cost') }}
{{ Form::number('extras_cost[]','',['class' => 'form-control', 'data-error'=>'']) }}
</div>
</div>
<span class="label label-info label-sm"><a href="#" id="addOptionExtras" style="color: #fff">Add other extras used</a></span><br><br>
</div>
<div class="col-sm-4">
<br><br>
<div class="form-group">
{{ Form::label('checklist_confirmed_by', __('anaesthetics.who_surgery_confirmed_by')) }}
{{ Form::select('checklist_confirmed_by',$nurses,'',['class' => 'form-control compulsory', 'required', 'data-error'=>'','id' => 'checklist_confirmed_by']) }}
<div class="help-block with-errors"></div>
<a href="#modal_new_nurse" data-toggle="modal" id="new_nurse_modal"><small>add new nurse</small></a>
</div>
<div class="form-group">
{{ Form::label('anaesthesia_type', __('anaesthetics.type_of_anaethesia')) }}
{{ Form::select('anaesthesia_type',$anaesthesia_types,'',['class' => 'form-control compulsory', 'required', 'data-error'=>'','id' => 'anaesthesia_type']) }}
<div class="help-block with-errors"></div>
</div>
<div id="general_div1" style="display: none;">
<div class="form-group">
{{ Form::label('induction', __('anaesthetics.induction')) }}
{{ Form::select('induction[]',$anaesthesia_inductions,'',['class' => 'form-control compulsory exclude_required','id' => 'induction', 'multiple' => 'true']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div id="for_all_div1" style="display: none;">
<table class="table-borderless table-condensed">
<tr>
<td><input type="checkbox" class="" name="adrenaline"> Adrenaline</td>
<td> <input type="checkbox" class="" name="atropine" > Atropine </td>
<td><input type="checkbox" class="" name="diazepam" > Diazepam </td>
</tr>
<tr>
<td><input type="checkbox" class="" name="ergometrine" > Ergometrine </td>
<td><input type="checkbox" class="" name="ephedrine"> Ephedrine</td>
<td><input type="checkbox" class="" name="hydralazine"> Hydralazine</td>
</tr>
<tr>
<td><input type="checkbox" class="" name="misoprostol"> Misoprostol</td>
<td><input type="checkbox" class="" name="oxygen" > Oxygen </td>
<td><input type="checkbox" class="" name="oxytocin" > Oxytocin</td>
</tr>
<tr>
<td><input type="checkbox" class="" name="paracetamol"> Paracetamol Suppository</td>
<td><input type="checkbox" class="" name="tranexamic_acid"> Tranexamic acid</td>
</tr>
</table>
<br>
<div class="form-group">
{{ Form::label('antibiotics', __('anaesthetics.antibiotics')) }}
<div id="selected_antibiotics">
{{ Form::select('antibiotics[]',$anti_biotics,0,['class' => 'form-control compulsory', 'required', 'data-error'=>'', 'style' => 'width: 85%; display: inline-block']) }}
<a class="add_antibiotics label-info label" style="float: right; color: white"><small>Add <sup>+</sup></small></a><br>
</div>
</div>
<div class="form-group">
{{ Form::label('airway', __('anaesthetics.airway')) }}
{{ Form::select('airway',$airways,'',['class' => 'form-control compulsory', 'required', 'data-error'=>'','id' => 'airway']) }}
<div class="help-block with-errors"></div>
<a href="#modal_new_airway" data-toggle="modal" id="new_airway_modal"><small> Add new</small></a>
</div>
</div>
<div id="ett_div" class="form-group" style="display: none;">
{{ Form::label('ett','ETT (mm)') }}
{{ Form::select('ett',$anaesthesia_etts,'',['class' => 'form-control', 'data-error'=>'','id' => 'ett']) }}
</div>
<div id="regional_local_div1" style="display: none;">
<div class="form-group">
{{ Form::label('agent_used', __('anaesthetics.agent_used')) }}
{{ Form::select('agent_used[]',$anaesthetic_agents,'',['class' => 'form-control', 'id' => 'agent_used_1', 'multiple' => 'true']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('technique', __('anaesthetics.technique')) }}
{{ Form::select('technique[]',$anaesthetic_techniques,'',['class' => 'form-control', 'data-error'=>'','id' => 'technique', 'multiple' => 'true']) }}
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="col-sm-4">
<br><br>
<div id="regional_local_div2" style="display: none;">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ __('anaesthetics.monitoring_in_addtion_statement') }}.
</div>
<!--In database as Monitoring_Signs-->
<table class="table table-responsive table-condensed table-striped">
<tbody>
<tr>
<td>Continuous SaO2</td>
<td> <input type="checkbox" name="continuos_sao2" value="Continuous SaO2"></td>
</tr>
<tr>
<td>Intermittent SaO2</td>
<td><input type="checkbox" name="intermittent_sao2" value="Intermittent SaO2"></td>
</tr>
<tr>
<td>Full vital signs monitor</td>
<td><input type="checkbox" name="full_vital_monitor" value="Full vital signs monitor"></td>
</tr>
<tr>
<td>End tidal CO2</td>
<td><input type="checkbox" name="end_tidal_co2" value="End tidal CO2"></td>
</tr>
</tbody>
</table>
<br>
</div>
<div id="spinal_div" style="display: none;">
<div class="form-group">
{{ Form::label('needle_type', __('anaesthetics.type_of_needle_used')) }}
{{ Form::select('needle_type',$needle_types,'',['class' => 'form-control', 'data-error'=>'','id' => 'needle_type']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('agent_used', __('anaesthetics.agent_used')) }}
{{ Form::select('agent_used[]',$anaesthetic_agents,'',['class' => 'form-control', 'id' => 'agent_used_2', 'multiple' => 'true']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('volume_administered', __('anaesthetics.volume_administered')) }}
{{ Form::number('volume_administered','',['class' => 'form-control compulsory', 'step'=>'0.1','id' => 'volume_administered']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div id="general_div2" style="display: none;">
<div id="exclude-in-general-iv">
<div class="form-group">
{{ Form::label('muscle_relaxant', __('anaesthetics.muscle_relaxants')) }}
{{ Form::select('muscle_relaxant',$muscle_relaxants,0,['class' => 'form-control', 'data-error'=>'','id' => 'muscle_relaxant']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('volatile_liquid_anaethetics', __('anaesthetics.volatile_liquid_anaethetics')) }}
{{ Form::select('volatile_liquid_anaethetics',$volatile_liquid_anaethetics,1,['class' => 'form-control', 'data-error'=>'','id' => 'volatile_liquid_anaethetics']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group" id="volatile_liquid_anaesthetic_used_div">
{{ Form::label('volatile_liquid_anaesthetic_used', __('anaesthetics.volatile_liquid_anaesthetic_used')) }}
{{ Form::number('volatile_liquid_anaesthetic_used','0',['class' => 'form-control compulsory', 'step'=>'0.1','id' => 'volatile_liquid_anaesthetic_used']) }}
<div class="help-block with-errors"></div>
</div>
<div id="tank_div" class="alert alert-info" style="display: none;">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ __('anaesthetics.approximate_equivalents') }}
<table class="table-condensed table-borderless">
<tr>
<td>1 Tank = 150mls</td>
<td>3/4 = 110mls</td>
</tr>
<tr>
<td>1/2 = 75mls</td>
<td>1/4 = 40mls</td>
<td>1/6 = 25mls</td>
</tr>
</table>
</div>
</div>
</div>
<div id="for_all_div2" style="display: none;">
<div class="form-group">
{{ Form::label('analgesic', __('anaesthetics.analgesics')) }}
{{ Form::select('analgesic[]',$analgesics,0,['class' => 'form-control','id' => 'analgesic', 'multiple' => 'true']) }}
<div class="help-block with-errors"></div>
<a href="#modal_new_analgesic" data-toggle="modal" id="new_analgesic_modal"><small>add new</small></a>
</div>
<div class="form-group">
<fieldset class="field">
<legend>{{ __('anaesthetics.iv_fluids_given_during_surgery') }}</legend>
<div class="row">
<div class="col-sm-2">
<a class="add_iv_fluid_button label-info label pull-right" style="font-size: smaller; color: white">Add<sup>+</sup></a>
</div>
<div class="col-sm-10">
<div class="input_fields_wrap">
<div class="separator bottom row">
<table id="iv_fluids_table" class="table-borderless table-condensed" style="display: none">
<tr><th>Name</th><th>Units</th></tr>
@foreach($iv_fluid_ids as $k => $v)
<tr><td>{{ get_name($v, "id", "name", "iv_fluids") }}</td><td>{{ $iv_fluid_units[$k] }} mls</td></tr>
@endforeach
</table>
{{ Form::select('iv_fluid_id[]',$iv_fluids,0,['class' => 'form-control col-sm-7']) }} &nbsp;
<input type="number" name="iv_fluid_units[]" id="iv_fluid_units" class="form-control col-sm-3" value="0">(mls)<br>
</div>
</div>
</div>
</div>
</fieldset>
</div>
<div class="form-group">
{{ Form::label('blood_given', __('anaesthetics.blood_given')) }}
{{ Form::number('blood_given',0,['class' => 'form-control compulsory', 'step'=>'0.1','id' => 'blood_given']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="form-group">
{{ Form::label('comments', __('anaesthetics.comments')) }}
{{ Form::textarea('comments','',['class' => 'form-control', 'data-error'=>'','cols'=>'4']) }}
<div class="help-block with-errors"></div>
</div>
<div class="alert-danger">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ __('anaesthetics.any_risks_alert') }}
</div>
<div>
<input type="hidden" name="episode_id" value="{{ $episode_id }}">
<input type="hidden" name="patient_id" value="{{ $patient_id }}"><br>
<button type="submit" class="btn btn-icon btn-success">Submit</button>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-8">
<!-- <div id="drugs-div">
<div class="col-md-4">
<label class="">Other Drugs Given <span class="label label-info label-sm" id="add-drug-row" style="padding: 2px">Add+</span></label>
{{ Form::select('drugs[]', $drugs, '', ['class' => 'form-control select','style'=>'margin-bottom: 5px;']) }}
</div>
<div class="col-md-2">
<label class="">Dose</label>
{{ Form::number('dose[]', '', ['class' => 'form-control']) }}
</div>
<div class="col-md-2">
<label class="">Units</label>
{{ Form::select("units[]", $units, "", ["class" => "form-control select"]) }}
</div>
</div> -->
<div class="form-group" id="wrapper">
<div id="drugs_div">
<div class="row input_fields_wrap1 copy1">
<div class="col-md-4">
<label class="">{{ __('anaesthetics.other_drugs_given') }}</label>
{{ Form::select('drugs[]', $drugs, '', ['class' => 'form-control select select_field','style'=>'margin-bottom: 5px;']) }}
</div>
<div class="col-md-2">
<label class="">{{ __('anaesthetics.dose') }}</label>
{{ Form::number('dose[]', '', ['class' => 'form-control']) }}
</div>
<div class="col-md-2">
<label class="">{{ __('anaesthetics.units') }}</label>
{{ Form::select("units[]", $units, "", ["class" => "form-control select"]) }}
</div>
</div>
</div>
</div>
<label><span class="label label-info label-sm" id="add-drug-row" style="padding: 2px">{{ __('anaesthetics.add_more_drugs') }}</span></label>
</div>
<div class="col-sm-4"></div>
</div>
</div>
</div>
</div>
<!-- start of bootstrap modals -->
<div class="modal fade" id="modal_new_mallampati" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1">Mallampati Score</h4>
</div>
<div class="modal-body">
<table class="table bordered">
<tbody>
<tr>
<td>
{{ Form::radio('mallampati_class', 1, false, ['id'=>'mallampati_class_1']) }} Class I (Easy)
</td>
<td>
Visualisation of the fauces, uvula, and both anterior and posterior pillars
</td>
<td>
<img src="{{ asset('uploads/resources/class-1-left-illustration.png') }}">
</td>
<td>
<img src="{{ asset('uploads/resources/class-1-right-illustration.png') }}">
</td>
</tr>
<tr>
<td>
{{ Form::radio('mallampati_class', 2, false, ['id'=>'mallampati_class_2']) }} Class II
</td>
<td>
Visualisation of the soft palate, fauces and uvula
</td>
<td>
<img src="{{ asset('uploads/resources/class-2-left-illustration.png') }}">
</td>
<td>
<img src="{{ asset('uploads/resources/class-2-right-illustration.png') }}">
</td>
</tr>
<tr>
<td>
{{ Form::radio('mallampati_class', 3, false, ['id'=>'mallampati_class_3']) }} Class III
</td>
<td>
Visualisation of the soft palate and the base of the uvula
</td>
<td>
<img src="{{ asset('uploads/resources/class-3-left-illustration.png') }}">
</td>
<td>
<img src="{{ asset('uploads/resources/class-3-right-illustration.png') }}">
</td>
</tr>
<tr>
<td>
{{ Form::radio('mallampati_class', 4, false, ['id'=>'mallampati_class_4']) }} Class IV
</td>
<td>
The soft palate is not visible at all
</td>
<td>
<img src="{{ asset('uploads/resources/class-4-left-illustration.png') }}">
</td>
<td>
<img src="{{ asset('uploads/resources/class-4-right-illustration.png') }}">
</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<input type="button" class="btn btn-success" id="submitMallampti" value="Save"/>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_new_asa" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1">American Society of Anesthesiologists (ASA) CLASSIFICATION</h4>
</div>
<div class="modal-body">
<table class="table bordered">
<thead>
<tr>
<th style="width: 10%">&nbsp;</th>
<th style="width: 90%">&nbsp;</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{ Form::radio('asa_classification_radio', 1, false, ['id'=>'asa_1']) }} ASA 1
</td>
<td>
Healthy patients
</td>
</tr>
<tr>
<td>
{{ Form::radio('asa_classification_radio', 2, false, ['id'=>'asa_2']) }} ASA 2
</td>
<td>
Mild to moderate systemic disease caused by the surgical condition or by other pathological processes, and medically well controlled
</td>
</tr>
<tr>
<td>
{{ Form::radio('asa_classification_radio', 3, false, ['id'=>'asa_3']) }} ASA 3
</td>
<td>
Severe disease process which limits activity but is not incapacitating
</td>
</tr>
<tr>
<td>
{{ Form::radio('asa_classification_radio', 4, false, ['id'=>'asa_4']) }} ASA 4
</td>
<td>
Severe incapacitating disease that is a constant threat to life
</td>
</tr>
<tr>
<td>
{{ Form::radio('asa_classification_radio', 5, false, ['id'=>'asa_5']) }} ASA 5
</td>
<td>
Moribund patient not expected to survive 24 hours with or without an operation
</td>
</tr>
<tr>
<td>
{{ Form::radio('asa_classification_radio', 6, false, ['id'=>'asa_6']) }} ASA 6
</td>
<td>
Declared brain-dead patient whose organs are being removed for donor purposes
</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<input type="button" class="btn btn-success" id="submitASA" value="Save"/>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_new_nurse" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1">Register a new nurse</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>First Name</label>
<input class="form-control compulsory" id="nurse_fname" name="nurse_fname" type="text" />
</div>
<div class="form-group">
<label>Last Name</label>
<input class="form-control compulsory" id="nurse_lname" name="nurse_lname" type="text" />
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<input type="button" class="btn btn-success" id="submitNurse" value="Save"/>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_new_doctor" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1">Register a new doctor</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>First Name</label>
<input class="form-control compulsory" id="doc_fname" name="doc_fname" type="text" />
</div>
<div class="form-group">
<label>Last Name</label>
<input class="form-control compulsory" id="doc_lname" name="doc_lname" type="text" />
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<input type="button" class="btn btn-success" id="submitDoctor" value="Save"/>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_new_airway" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1">Register a new airway</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>Name</label>
<input class="form-control compulsory" id="airway_name" name="airway_name" type="text" />
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<input type="button" class="btn btn-success" id="submitAirway" value="Save"/>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_new_analgesic" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1">Register a new analgesic</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>Name</label>
<input class="form-control compulsory" id="analgesic_name" name="analgesic_name" type="text" />
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<input type="button" class="btn btn-success" id="submitAnalgesic" value="Save"/>
</div>
</div>
</div>
</div>
@include('patients::consultations.add_diagnosis')
<!-- end of bootstrap modals -->
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
function submitDiagnosis(){
var diagnosis_name = $("#diagnosis_name").val();
var icd10_code = $("#icd10_code").val();
var hmis_no_outpatient = $("#hmis_no_outpatient").val();
var hmis_no_inpatient = $("#hmis_no_inpatient").val();
var hmis_category = $("#hmis_category").val();
var diagnosis_prompts = $("#diagnosis_prompts").val();
var chronic_yes = $("#chronic_yes").val();
var chronic_no = $("#chronic_no").val();
var chronic_status = null;
if($('#chronic_yes').is(':checked')){
chronic_status = 1;
} else if($('#chronic_no').is(':checked')){
chronic_status = 0;
}
if ($("#diagnosis_name").val() === "" || !$("#diagnosis_name").val()) {
alert("Please make sure that you fill in a diagnosis name");
return false;
}
var data = {'diagnosis_name':diagnosis_name, 'icd10_code': icd10_code, 'hmis_no_outpatient': hmis_no_outpatient, 'hmis_no_inpatient': hmis_no_inpatient, 'hmis_category': hmis_category, 'diagnosis_prompts': diagnosis_prompts, chronic_status: 'chronic_status'};
$.ajax({
method: 'POST',
url: '/consultation/add_diagnosis',
data: data,
success: function(response){
if(!isNaN(response)){
//response = last inserted id
$('.primaryDiagnosis').append($('<option>', {
value: response,
text: diagnosis_name
}));
$('.primaryDiagnosis').val(response);//preselect the newly added referral
$('#diagnosisModal').modal('hide'); //manually hide the modal
} else {
alert("error occurred");
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
$(document).ready(function () {
generalSelect2Set();
$(".add_antibiotics").click(function (e) {
var anti_biotics_options = {!! json_encode($anti_biotics) !!};
var anti_biotics_dropdown = "";
for (var key in anti_biotics_options) {
if (anti_biotics_options.hasOwnProperty(key)) {
anti_biotics_dropdown += "<option value='" + key + "'>" + anti_biotics_options[key] + "</option>";
}
}
$("#selected_antibiotics").append("<br><div class='separator top'><select name='antibiotics[]' class='form-control compulsory' style='width: 85%; display: inline-block'><option value=''>-- Select --</option>" + anti_biotics_dropdown + "</select>&nbsp;<a class='remove_field' style='color: maroon;'><sup>X</sup></a></div>");
});
$("#selected_antibiotics").on("click", ".remove_field", function (e) {
e.preventDefault();
$(this).parent('div').remove();
});
$("#anaesthesia_type").change(function () {
procedure_id = $("#anaesthesia_type").val();
$.ajax({
type: "post",
url: "/get_procedure_slug",
data: {procedure_id: procedure_id},
cache: false,
success: function (result) {
var slug = result;
/* display according to procedure slug */
if (slug == "Spinal") { // Spinal
$("#spinal_div").show();
$("#general_div1").hide();
$("#general_div2").hide();
$("#regional_local_div1").hide();
$("#regional_local_div2").show();
$("#tank_div").hide();
$("#ett_div").hide();
$("#for_all_div1").show();
$("#for_all_div2").show();
//$("#spinal_div :not(:checkbox, .exclude_required)").attr('required', true);
//$("#for_all_div1 :not(:checkbox, .exclude_required)").attr('required', true);
//$("#for_all_div2 :not(:checkbox, .exclude_required)").attr('required', true);
$("#general_div1 :input").removeAttr("required");
$("#general_div2 :input").removeAttr("required");
$("#regional_local_div1 :input").removeAttr("required");
$("#tank_div :input").removeAttr("required");
$("#analgesic,#agent_used_1,#agent_used_2,#technique,#induction").removeAttr("required");
} else if (slug == "General") { // General
$("#spinal_div").hide();
$("#general_div1").show();
$("#general_div2").show();
$("#regional_local_div1").hide();
$("#regional_local_div2").show();
$("#ett_div").show();
$("#tank_div").show();
$("#for_all_div1").show();
$("#for_all_div2").show();
$("#exclude-in-general-iv").show(); // Including muscle relaxants and halothane used
/* $("#muscle_relaxant").attr('required', true);
$("#volatile_liquid_anaesthetic_used").attr('required', true);
$("#general_div1 :not(:checkbox, .exclude_required)").attr("required", true);
$("#general_div2 :not(:checkbox, .exclude_required)").attr("required", true);
$("#tank_div :not(:checkbox, .exclude_required)").attr("required", true);
$("#for_all_div1 :not(:checkbox, .exclude_required)").attr("required", true); */
//$("#for_all_div2 :not(:checkbox, .exclude_required)").attr("required", true);
$("#spinal_div :input").removeAttr("required");
$("#regional_local_div1:input").removeAttr("required");
$("#analgesic,#agent_used_1,#agent_used_2,#technique,#induction").removeAttr("required");
}
else if (slug == "general-iv") { //General IV
$("#spinal_div").hide();
$("#general_div1").show();
$("#general_div2").show();
$("#regional_local_div1").hide();
$("#regional_local_div2").show();
$("#ett_div").show();
$("#tank_div").show();
$("#for_all_div1").show();
$("#for_all_div2").show();
$("#exclude-in-general-iv").hide(); // Excluding muscle relaxants and halothane used
$("#muscle_relaxant").removeAttr('required');
$("#volatile_liquid_anaesthetic_used").removeAttr('required');
/* $("#general_div1 :not(:checkbox, .exclude_required)").attr("required", true);
$("#general_div2 :not(:checkbox, .exclude_required)").attr("required", true);
$("#tank_div :not(:checkbox, .exclude_required)").attr("required", true);
$("#for_all_div1 :not(:checkbox, .exclude_required)").attr("required", true); */
//$("#for_all_div2 :not(:checkbox, .exclude_required)").attr("required", true);
$("#spinal_div :input").removeAttr("required");
$("#regional_local_div1:input").removeAttr("required");
$("#analgesic,#agent_used_1,#agent_used_2,#technique,#induction").removeAttr("required");
}
else if (slug == "Regional" || slug == "Local") { // Regional or Local infiltration
$("#spinal_div").hide();
$("#general_div1").hide();
$("#general_div2").hide();
$("#ett_div").hide();
$("#regional_local_div1").show();
$("#regional_local_div2").show();
$("#tank_div").hide();
$("#for_all_div1").show();
$("#for_all_div2").show();
//$("#regional_local_div1 :not(:checkbox, .exclude_required)").attr("required", true);
//$("#regional_local_div2 :not(:checkbox, .exclude_required)").attr("required", true);
//$("#for_all_div1 :not(:checkbox, .exclude_required)").attr("required", true);
//$("#for_all_div2 :not(:checkbox, .exclude_required)").attr("required", true);
$("#spinal_div :input").removeAttr("required");
$("#general_div1 :input").removeAttr("required");
$("#general_div2 :input").removeAttr("required");
$("#tank_div :input").removeAttr("required");
$("#analgesic,#agent_used_1,#agent_used_2,#technique,#induction").removeAttr("required");
} else if (slug == "None") { //None
$("#spinal_div").hide();
$("#general_div1").hide();
$("#general_div2").hide();
$("#ett_div").hide();
$("#regional_local_div1").hide();
$("#regional_local_div2").hide();
$("#tank_div").hide();
$("#for_all_div1").hide();
$("#for_all_div2").hide();
$("#spinal_div :input").removeAttr("required");
$("#general_div1 :input").removeAttr("required");
$("#general_div2 :input").removeAttr("required");
$("#regional_local_div1 :input").removeAttr("required");
$("#regional_local_div2 :input").removeAttr("required");
$("#tank_div :input").removeAttr("required");
$("#for_all_div1 :input").removeAttr("required");
//$("#for_all_div2 :input").removeAttr("required");
$("#analgesic,#agent_used_1,#agent_used_2,#technique,#induction").removeAttr("required");
} else {
$("#spinal_div").hide();
$("#general_div1").hide();
$("#general_div2").hide();
$("#ett_div").hide();
$("#regional_local_div1").hide();
$("#regional_local_div2").hide();
$("#tank_div").hide();
$("#for_all_div1").hide();
$("#for_all_div2").hide();
$("#spinal_div :input").removeAttr("required");
$("#general_div1 :input").removeAttr("required");
$("#general_div2 :input").removeAttr("required");
//$("#regional_local_div1 :input").removeAttr("required");
//$("#regional_local_div2 :input").removeAttr("required");
$("#tank_div :input").removeAttr("required");
$("#for_all_div1 :input").removeAttr("required");
$("#for_all_div2 :input").removeAttr("required");
$("#analgesic,#agent_used_1,#agent_used_2,#technique,#induction").removeAttr("required");
}
/* end display according to slug */
}
});
$("#analgesic,#agent_used_1,#agent_used_2,#technique,#induction").removeAttr("required");
});
var max_iv_fluid_fields = 10; //maximum input boxes allowed
var iv_fluid_wrapper = $(".input_fields_wrap"); //Fields iv_fluid_wrapper
var add_iv_fluid_button = $(".add_iv_fluid_button"); //Add button ID
var x1 = 1; //initial text box count
// Adding iv fluids
$(add_iv_fluid_button).click(function (e) { //on add input button click
e.preventDefault();
var iv_fluids_options = {!! json_encode($iv_fluids) !!};
var iv_fluids_dropdown = "";
for (var key in iv_fluids_options) {
if (iv_fluids_options.hasOwnProperty(key)) {
iv_fluids_dropdown += "<option value='" + key + "'>" + iv_fluids_options[key] + "</option>";
}
}
if (x1 < max_iv_fluid_fields) { //max input box allowed
x1++; //text box increment
$(iv_fluid_wrapper).append("<br><div class='row'><select name='iv_fluid_id[]' class='form-control col-sm-7'><option value=''>-- select --</option>" + iv_fluids_dropdown + "</select>&nbsp;<input type='number' name='iv_fluid_units[]' id='iv_fluid_units' class='form-control col-sm-3'><div col-sm-2><small>(mls)</small>" + "<a href='#' class='remove_field' style='color: maroon'><sup>X</sup></a></div></div>");
}
});
// Removing added iv fluids
$(iv_fluid_wrapper).on("click", ".remove_field", function (e) { //user click on remove text
e.preventDefault();
$(this).parent('div').parent('div').remove();
x1--;
});
//Adding new rows of drugs given
/*$('#add-drug-row').click(function(){
$('#drugs-div').append('<div class="row"><div class="col-md-4">{{ Form::select("drugs[]", $drugs, "", ["class" => "form-control select","style"=>"margin-bottom: 5px;"]) }}</div>' +
'<div class="col-md-2">{{ Form::number("dose[]", "", ["class" => "form-control"]) }}</div>' +
'<div class="col-md-2">{{ Form::select("units[]", $units, "", ["class" => "form-control select"]) }}</div></div>');
});*/
let drugsArray = {!! json_encode($drugs) !!};
let drugsoptions = '';//initialize the options tag
drugsoptions += '<option value>--Select --</option>';
for (let drug in drugsArray) {
if (drugsArray.hasOwnProperty(drug)) {
drugsoptions += '<option value=' + drug + '>' + drugsArray[drug] + '</option>';
}
}
let unitsArray = {!! json_encode($units) !!};
let unitsoptions = '';//initialize the options tag
unitsoptions += '<option value>--Select --</option>';
for (let unit in unitsArray) {
if (unitsArray.hasOwnProperty(unit)) {
unitsoptions += '<option value=' + unit + '>' + unitsArray[unit] + '</option>';
}
}
/* do this much better dynamic addition :) */
var max_fields1 = 24; //maximum divs allowed
var x1 = 1; //initial div count
$("#add-drug-row").on("click", function (e) {
e.preventDefault();
if (x1 < max_fields1) {
x1++;
let html_text = "<br><div class='row input_fields_wrap1'><div class='col-md-4'><label><?php echo __('anaesthetics.other_drugs_given'); ?></label>";
html_text += "<select class='form-control select select_field' name='drugs[]'>"+drugsoptions+"</select></div>";
html_text += "<div class='col-md-2'><label><?php echo __('anaesthetics.dose'); ?></label><input type='number' name='dose[]' class='form-control'/></div>";
html_text += "<div class='col-md-2'><label><?php echo __('anaesthetics.units'); ?></label><select class='form-control select' name='units[]'>"+unitsoptions+"</select>";
html_text += "<a href='#' class='remove_field1' style='color: maroon'><sup>X</sup></a></div></div>";
$("#drugs_div").append(html_text);
generalSelect2Set();
}
});
$("#wrapper").on("click", ".remove_field1", function (e) {
e.preventDefault();
$(this).parent('div').remove();
x1--;
});
/*
* -- End adding rows of drugs
*/
$('#submitMallampti').click(function () {
var mall_class_1 = $('#mallampati_class_1').val();
var mall_class_2 = $('#mallampati_class_2').val();
var mall_class_3 = $('#mallampati_class_3').val();
var mall_class_4 = $('#mallampati_class_4').val();
if (mall_class_1 == '' || mall_class_2 == '') {
alert("Please fill out the mallampati score name");
} else {
if (document.getElementById("mallampati_class_1").checked) {
$('#mallampati_score').val("I"); //preselect the newly added nurse
} else if(document.getElementById("mallampati_class_2").checked){
$('#mallampati_score').val("II");
} else if(document.getElementById("mallampati_class_3").checked){
$('#mallampati_score').val("III");
} else if(document.getElementById("mallampati_class_4").checked){
$('#mallampati_score').val("IV");
}
$('#modal_new_mallampati').modal('hide'); //manually hide the modal
}
});
$('#submitASA').click(function () {
var asa_1 = $('#asa_1').val();
var asa_2 = $('#asa_2').val();
var asa_3 = $('#asa_3').val();
var asa_4 = $('#asa_4').val();
var asa_5 = $('#asa_5').val();
var asa_6 = $('#asa_6').val();
if (asa_1 == '' || asa_2 == '' || asa_3 == '' || asa_4 == '' || asa_4 == '' || asa_5 == '' || asa_6 == '') {
alert("Please fill out the mallampati score name");
} else {
if (document.getElementById("asa_1").checked) {
$('#asa_classification').val(1); //preselect the newly added nurse
} else if(document.getElementById("asa_2").checked){
$('#asa_classification').val(2);
} else if(document.getElementById("asa_3").checked){
$('#asa_classification').val(3);
} else if(document.getElementById("asa_4").checked){
$('#asa_classification').val(4);
} else if(document.getElementById("asa_5").checked){
$('#asa_classification').val(5);
} else if(document.getElementById("asa_6").checked){
$('#asa_classification').val(6);
}
$('#modal_new_asa').modal('hide'); //manually hide the modal
}
});
$('#primary_diagnosis').on('change', function () {
var data = 'diagnosis_id=' + $(this).val();
$.ajax({
type: "get",
url: "/diagnoses/get_diagnosis",
data: data,
cache: false,
success: function (result) {
var prompt_and_references = result.split('&&');
$('#primary_diagnosis_prompt').html(prompt_and_references[0]);
$('#primary_diagnosis_reference').html(prompt_and_references[1]);
}
});
});
$('#wrapper').on( 'change', '[id^=other_diagnosis_id_]', function () {
var data = 'diagnosis_id=' + $(this).val();
var other_diagnosis_id = $(this).attr('id');
var nth = other_diagnosis_id.substring(19); //remove "other_diagnosis_id_" from strg to remain with the no e.g 1003
var prompt_id = parseInt(nth) - 1000;
var reference_id = prompt_id + 100;
$.ajax({
type: "get",
url: "/diagnoses/get_diagnosis",
data: data,
cache: false,
success: function (result) {
var prompt_and_references = result.split('&&');
if (nth < 1000) {
$('#secondary_diagnosis_prompt1').html(prompt_and_references[0]);
$('#secondary_diagnosis_reference1').html(prompt_and_references[1]);
}
else{
// this is for prompts and references added dynamically using the addrow button
$('#secondary_diagnosis_prompt'+prompt_id).html(prompt_and_references[0]);
$('#secondary_diagnosis_reference'+reference_id).html(prompt_and_references[1]);
}
}
});
});
$('#submitNurse').click(function () {
var lname = $('#nurse_lname').val();
var fname = $('#nurse_fname').val();
if (lname == '' || fname == '') {
alert("Please fill out the nurse name");
} else {
$.ajax({
type: "post",
url: "/add_new_nurse",
data: {lname: lname, fname: fname},
cache: false,
success: function (result) {
//return the id of the saved nurse in the users table and preselect it
$('#checklist_confirmed_by').append($('<option>', {
value: result,
text: fname
}));
$('#checklist_confirmed_by').val(result); //preselect the newly added nurse
$('#modal_new_nurse').modal('hide'); //manually hide the modal
}
});
}
});
$('#submitDoctor').click(function () {
var lname = $('#doc_lname').val();
var fname = $('#doc_fname').val();
if (lname == '' || fname == '') {
alert("Please fill out the doctor name");
} else {
$.ajax({
type: "post",
url: "/add_new_doctor",
data: {lname: lname, fname: fname},
cache: false,
success: function (result) {
//return the id of the saved doctor in the users table and preselect it
$('#anaesthetist').append($('<option>', {
value: result,
text: fname
}));
$('#anaesthetist').val(result); //preselect the newly added doc
$('#modal_new_doctor').modal('hide'); //manually hide the modal
}
});
}
});
$('#submitAirway').click(function () {
var name = $('#airway_name').val();
if (name == '') {
alert("Please fill out the name");
} else {
$.ajax({
type: "post",
url: "/add_new_airway",
data: {name: name},
cache: false,
success: function (result) {
$('#airway').append($('<option>', {
value: result,
text: name
}));
$('#airway').val(result); //preselect the newly added airway
$('#modal_new_airway').modal('hide'); //manually hide the modal
}
});
}
});
$('#submitAnalgesic').click(function () {
var name = $('#analgesic_name').val();
if (name == '') {
alert("Please fill out the name");
} else {
$.ajax({
type: "post",
url: "/add_new_analgesic",
data: {name: name},
cache: false,
success: function (result) {
$('#analgesic').append($('<option>', {
value: result,
text: name
}));
$('#analgesic').val(result); //preselect the newly added analgesic
$('#modal_new_analgesic').modal('hide'); //manually hide the modal
}
});
}
});
var sundriesArray = {!! json_encode($sundries_array) !!};
var options = '';//initialize the options tag
options += '<option value>--Select --</option>';
for (var sundry in sundriesArray) {
if (sundriesArray.hasOwnProperty(sundry)) {
options += '<option value=' + sundry + '>' + sundriesArray[sundry] + '</option>';
}
}
$("#addOption").click(function(e) {
e.preventDefault();
$("#sundries_used_div").append("<br>");
$("#sundries_used_div").append("<div class='col-sm-8'><label for='sundries_used'>Other Sundries used</label><select class='form-control sundries_sutures select_field' name='sundries_used[]'>"+options+"</select></div><div class='col-sm-4'><label for='quantity_used'>Quantity used</label><input class='form-control' name='sundries_quantity_used[]' type='number'></div>");
generalSelect2Set();
});
$("#addOptionExtras").click(function(e) {
e.preventDefault();
$("#extras_used_div").append("<br>");
$("#extras_used_div").append("<div class='col-sm-8'><label for='extras_used'>Other Extras Used</label><input type='text' class='form-control' name='extras_used[]'></div><div class='col-sm-4'><label for='extras_cost'>Cost</label><input class='form-control' name='extras_cost[]' type='number'></div>");
});
//make the following dropdwowns searchable
$("#procedure_id,#anaesthetist,#checklist_confirmed_by,#anaesthesia_type,#primary_diagnosis").select2({
placeholder: "-- select --"
});
$("#analgesic,#agent_used_1,#agent_used_2,#technique,#induction").select2({
placeholder: "-- select --",
width: "100%"
});
});
function addRow(tableID) {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var colCount = table.rows[0].cells.length;
for (var i = 0; i < colCount; i++) {
var newcell = row.insertCell(i);
newcell.innerHTML = table.rows[1].cells[i].innerHTML;
/* set new id for the symptom select tag which is found in the first cell of every row
* this makes the symptom select tag id dynamic and different for each table row
* the id should be the rowCount +1000 to avoid a similar id with prompt div tag id set below
*/
if (i == 1) {
newcell.childNodes[1].id = 'other_diagnosis_id_'+(rowCount + 1000);
}
/*
* set new value for the prompt div tag
*/
if (i == 2) {
table.rows[rowCount].cells[2].innerHTML = '';
table.rows[rowCount].cells[2].innerHTML = '<div class="well well-sm" id="secondary_diagnosis_prompt' + rowCount + '">&nbsp;</div>';
}
if (i == 3) {
// var myid = (rowCount + 100);
table.rows[rowCount].cells[3].innerHTML = '';
table.rows[rowCount].cells[3].innerHTML = '<div class="well well-sm" id="secondary_diagnosis_reference' + (rowCount + 100) + '">&nbsp;</div>';
// alert(myid);
}
switch (newcell.childNodes[0].type) {
case "text":
// newcell.childNodes[0].value = "";
break;
case "checkbox":
newcell.childNodes[0].checked = false;
break;
case "select":
newcell.childNodes[0].selectedIndex = 0;
break;
}
}
}
function deleteRow(tableID) {
try {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
for (var i = 0; i < rowCount; i++) {
var row = table.rows[i];
var chkbox = row.cells[0].childNodes[0];
if (null != chkbox && true == chkbox.checked) {
if (rowCount <= 2) {
alert("<?php echo __('inpatient.delete_rows_warning');?>.");
break;
}
table.deleteRow(i);
rowCount--;
i--;
}
}
} catch (e) {
alert(e);
}
}
function generalSelect2Set() {
$('.select_field').select2({
width: "100%"
});
}
</script>
@endpush