Files

1219 lines
64 KiB
PHP
Executable File
Raw Permalink 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">Theatre module - surgery</h4>
</div>
<div class="col-lg-8 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">Dashboard</a></li>
<li><a href="{{ route('theatre_surgery.index') }}">Surgeries</a></li>
<li class="active">Edit surgery</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patients::allergies.header')
</div>
</div>
<br/>
@if(isset($surgeries) && count($surgeries) > 0)
<div class="row">
<div class="col-md-12">
<div class="panel">
<div class="panel-body">
<div class="table-responsive">
<b>PREVIOUS SURGERIES FROM EPISODE STARTED ON <font color="blue">{{ streamline_date(get_name($episode_id, 'id', 'created_at', 'patient_episodes')) }}</font></b>
<table class="table color-bordered-table success-bordered-table">
<thead>
<th>Surgery</th>
<th>Surgeon</th>
<th>Anaesthetist</th>
<th>Time Of Commencement</th>
<th>Date</th>
<th></th>
</thead>
<tbody>
@foreach($surgeries as $surgery_record)
<tr>
<td>
@php
$procedures_array = explode(",", $surgery_record->procedure_id);
@endphp
@for ($i = 0; $i < count($procedures_array); $i++)
- {{ get_name($procedures_array[$i],'id','name','procedures') }}<br>
@endfor
</td>
<td>{{ get_full_name($surgery_record->surgeon, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>{{ get_name($surgery_record->anaesthesia_id,'id','id','anaesthesias') }}</td>
<td>{{ $surgery_record->time_surgery_completed }}</td>
<td>{{ streamline_date($surgery_record->created_at) }}</td>
<td><a class="btn btn-sm btn-info" href="{{ route('theatre_surgery.details', $surgery_record->id) }}">View Details</a></td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@endif
<div class="row">
<div class="col-sm-12">
@include('flash::message')
@foreach ($errors->all() as $error)
<div><font color="red">{{ $error }}</font></div>
@endforeach
<div class="white-box">
<h3>{{ __('surgery.edit_surgery') }}</h3><br>
{{ Form::model($surgery_record,['method' => 'PUT','route' => ['theatre_surgery.update',$surgery_record->id],'data-toggle'=>'validator']) }}
@if(!is_null($anaesthesia))
{{Form::hidden('anaesthesia_id', $anaesthesia->id)}}
@endif
{{ Form::hidden('anaesthesia_complete', $anaesthesia_complete) }}
{{ Form::hidden('patient_id', $patient_id) }}
{{ Form::hidden('episode_id', $episode_id) }}
{{ Form::hidden('surgery_id', $surgery_record->id) }}
<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, $surgery_record ? $surgery_record->primary_diagnosis : "", ['class' => 'form-control select 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($surgery_record->primary_diagnosis) && $surgery_record->primary_diagnosis != 0) ? $diagnoses_all->firstWhere('id',$surgery_record->primary_diagnosis)->prompts : "" }}&nbsp;</div></td>
<td style="width: 25%">
<div class="well well-sm" id="primary_diagnosis_reference">
@if(!is_null($surgery_record) && $surgery_record->primary_diagnosis != 0)
@php
$reference_names = explode(",", get_name($surgery_record->primary_diagnosis, 'id', 'reference_names', 'diagnoses'));
$reference_areas = explode(",", get_name($surgery_record->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>
</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($surgery_record){
$other_diagnoses = @unserialize($surgery_record->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>
<div class="col-sm-5">
<br><br>
<div class="form-group">
@php
$procedures_array = explode(",", $surgery_record->procedure_id);
@endphp
{{ Form::label('procedure_id','Surgical procedure') }}
{{ Form::select('procedure_id[]',$procedures, $procedures_array,['class' => 'form-control compulsory', 'required', 'data-error'=>'','id'=>'procedure_id','multiple'=>'true']) }}
<div class="help-block with-errors"></div>
</div>
<div class="row">
<div class="form-group col-sm-6">
{{ Form::label('surgeon','Surgeon') }}
{{ Form::select('surgeon', $doctors, $surgery_record->surgeon, ['class' => 'form-control compulsory', 'required', 'data-error'=>'', 'id'=>'surgeon', 'onchange'=>'get_cadre(this.value)']) }}
<div class="help-block with-errors"></div>
<input type="hidden" id="surgeon_temporary" name="surgeon_temporary">
<a href="#modal_new_surgeon" data-toggle="modal" id="new_surgeon_modal"><small>add new surgeon</small></a>
</div>
<div class="form-group col-sm-6">
{{ Form::label('cadre','Cadre') }}
{{ Form::text('cadre','',['class' => 'form-control', 'data-error'=>'','id'=>'cadre','readonly'=>'true']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="form-group">
{{ Form::label('scrub_nurse','Scrub Nurse') }}
{{ Form::select('scrub_nurse', $all_staff, $surgery_record->scrub_nurse, ['class' => 'form-control compulsory required', 'data-error'=>'','id'=>'scrub_nurse']) }}
<div class="help-block with-errors"></div>
<input type="hidden" id="scrub_nurse_temporary" name="scrub_nurse_temporary">
<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('authorised_swab_check','Scrub check authorised by') }}
{{ Form::select('authorised_swab_check', $all_staff, $surgery_record->authorised_swab_check,['class' => 'form-control compulsory required', 'data-error'=>'','id'=>'authorised_swab_check']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('date_surgery_completed','Date surgery completed') }}
<div class="input-group">
{{ Form::text('date_surgery_completed', '', ['class' => 'form-control','readonly','id'=>'datepicker-autoclose']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('time_surgery_completed','Time surgery completed') }}
{{ Form::time('time_surgery_completed',$surgery_record->time_surgery_completed,['class' => 'form-control', 'data-error'=>'','id'=>'time_surgery_completed']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('estimated_blood_loss','Estimated blood loss (mLs)') }}
{{ Form::number('estimated_blood_loss',$surgery_record->estimated_blood_loss,['class' => 'form-control', 'data-error'=>'','id'=>'estimated_blood_loss']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('comments','Comments') }}
{{ Form::textarea('comments',$surgery_record->comments,['class' => 'form-control', 'data-error'=>'','id'=>'comments']) }}
<div class="help-block with-errors"></div>
</div>
<div>
Completed by <span style="color: green; font-weight: bold;"> {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</span> on <span style="color: green; font-weight: bold;"> {{ streamline_date(date('d-m-Y')) }}</span>
</div>
</div>
<div class="col-sm-1"></div>
<div class="col-sm-5">
<br><br>
<div class="form-group">
{{ Form::label('surgery_type','Surgery Type') }}
<br>
{{ Form::radio('surgery_type', 1, false, ["required"]) }} Elective &nbsp;&nbsp;
{{ Form::radio('surgery_type', 2, false, ["required"]) }} Emergency
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('assistant_surgeon','Assistant surgeon') }}
{{ Form::select('assistant_surgeon', $doctors, $surgery_record->assistant_surgeon, ['class' => 'form-control compulsory', 'data-error'=>'','id'=>'assistant_surgeon','required']) }}
<input type="hidden" id="assistant_surgeon_temporary" name="assistant_surgeon_temporary">
<div class="help-block with-errors"></div>
<a href="#modal_new_assistant_surgeon" data-toggle="modal" id="new_assisant_surgeon_modal"><small>add new assistant surgeon</small></a>
</div>
<div class="form-group">
{{ Form::label('scrub_nurse','Other scrub staff') }}
{{ Form::select('other_scrub_staff', $all_staff, $surgery_record->other_scrub_staff,['class' => 'form-control', 'data-error'=>'','id'=>'other_scrub_staff']) }}
<div class="help-block with-errors"></div>
<input type="hidden" id="other_scrub_staff_temporary">
<a href="#modal_other_scrub_staff" data-toggle="modal" id="other_scrub_stuff_modal"><small> add new scrub staff </small></a>
</div>
<div class="form-group">
{{ Form::label('theatre_location','Theatre location') }}
{{ Form::select('theatre_location',$theatre_locations,$surgery_record->theatre_location,['class' => 'form-control', 'data-error'=>'','id'=>'theatre_location']) }}
<div class="help-block with-errors"></div>
<a href="#modal_new_theatre_location" data-toggle="modal" id="new_theatre_location_modal"><small> add new theatre location </small></a>
</div>
<div class="form-group">
{{ Form::label('theatre_incharge','Designated in charge for this theatre') }}
{{ Form::select('theatre_incharge', $all_staff, $surgery_record->theatre_in_charge,['class' => 'form-control compulsory', 'data-error'=>'','id'=>'theatre_incharge','required']) }}
<div class="help-block with-errors"></div>
<input type="hidden" id="theatre_incharge_temporary" name="theatre_incharge_temporary">
<a href="#modal_new_scrub_staff" data-toggle="modal" id="new_scrub_staff_modal"><small> add new nurse </small></a>
</div>
@php
$surgery_outcome = null;
if (is_null($surgery_record->outcome)) {
$surgery_outcome = is_null($episode_consultation_outcome) ? null : $episode_consultation_outcome;
} else {
$surgery_outcome = $surgery_record->outcome;
}
@endphp
<div class="form-group">
{{ Form::label('outcome',__('surgery.outcome')) }}
{{ Form::select('outcome',$outcomes, $surgery_outcome ,['class' => 'form-control', 'data-error'=>'','id'=>'outcome','required']) }}
</div>
<div id="admitted_div" @if(!is_null($surgery_outcome) && $surgery_outcome != 1) style="display: none" @endif>
<div class="form-group">
{{ Form::label('ward_id',__('consultations.select_ward')) }}
<div class="input-group">
{{ Form::select('ward_id', $wards, $surgery_record->ward_id_admitted, ['class' => 'form-control compulsory']) }}
</div>
</div>
<div class="form-group">
{{ Form::label('admitted_on',__('consultations.admitted_on')) }}
<div class="input-group">
{{ Form::text('admitted_on',Carbon\Carbon::parse($admission_date)->format('Y-m-d'),['class' => 'form-control datepicker-autoclose compulsory', 'readonly']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div id="home_with_followup_div" @if(!is_null($surgery_outcome) && $surgery_outcome != 3) style="display: none"@endif>
{{-- <div class="form-group">
<div class="input-group">
{{ Form::text('followup_where',$episode_consultation_details->followup_where,['class' => 'form-control compulsory', 'placeholder'=>'Where?']) }}
</div>
</div> --}}
<div class="form-group">
{{ Form::label('followup_clinic_allocation', 'Assign Clinic') }}
{{ Form::select('followup_clinic_allocation', $clinics, 0, ['class' => 'form-control col-sm-12 compulsory']) }}
</div>
<div class="form-group">
{{ Form::label('followup_in_charge', __('consultations.assign_incharge')) }}
<select name="followup_in_charge" class="form-control col-sm-12 compulsory">
<option value="0" selected>{{ __('consultations.not_assigned') }}</option>
@foreach($users as $user)
<option value="{{ $user->id }}">{{ $user->first_name }} {{ $user->last_name }}</option>
@endforeach
</select>
</div>
<div class="form-group">
{{ Form::label('followup_when',__('consultations.when')) }}
<div class="input-group">
{{ Form::text('followup_when',$surgery_record->followup_when ? Carbon\Carbon::parse($surgery_record->followup_when)->format('Y-m-d') : '',['class' => 'form-control compulsory datepicker-autoclose','readonly']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
<div class="form-group">
{{ Form::label('followup_in_time', __('consultations.appointment_time')) }}
{{ Form::time('followup_in_time',$episode_consultation_details ?$episode_consultation_details->followup_time : '',['class' => 'form-control']) }}
</div>
</div>
<div id="referred_div" @if(!is_null($surgery_outcome) && $surgery_outcome != 4) style="display: none" @endif>
<div class="form-group">
{{ Form::label('referral_id',__('consultations.referred_to')) }}
<div class="input-group">
{{ Form::select('referral_id', $referrals, $surgery_record->referred_to, ['class' => 'form-control compulsory']) }}
</div>
</div>
</div>
<div class="form-group row" id="sundries_used_div">
@php
$sundries_unserialized_array = @unserialize($surgery_record->sundries_used);
$used_sundries_ids_array = isset($sundries_unserialized_array['sundries']) ? $sundries_unserialized_array['sundries'] : [];
$used_sundries_quantities_array = isset($sundries_unserialized_array['quantity']) ? $sundries_unserialized_array['quantity'] : [];
@endphp
@if(!empty($used_sundries_ids_array))
@for($i=0; $i < count($used_sundries_ids_array) ; $i++)
<div class="col-sm-8">
{{ Form::label('sundries_used','Sundries used') }}
{{ Form::select('sundries_used[]',$sundries_array,$used_sundries_ids_array[$i],['class' => 'form-control sundries_sutures', 'data-error'=>'']) }}
</div>
<div class="col-sm-4">
{{ Form::label('sundries_quantity_used','Quantity used') }}
{{ Form::number('sundries_quantity_used[]',$used_sundries_quantities_array[$i],['class' => 'form-control', 'data-error'=>'']) }}
</div>
@endfor
@else
<div class="col-sm-8">
{{ Form::label('sundries_used','Sundries used') }}
{{ Form::select('sundries_used[]',$sundries_array,'',['class' => 'form-control sundries_sutures', '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>
@endif
</div>
<a href="#" id="addOption">Add other sundries used</a><br><br>
<div class="form-group row" id="extras_used_div">
@php
$theatre_extras_used = @unserialize($surgery_record->extras_used);
$extras_array = isset($theatre_extras_used['extras']) ? $theatre_extras_used['extras'] : [];
$extras_cost_array = isset($theatre_extras_used['cost']) ? $theatre_extras_used['cost'] : [];
@endphp
@if(count($extras_array) > 0)
@for($j = 0; $j < count($extras_array); $j++)
@php
$extra_item = is_null($extras_array[$j]) ? "" : $extras_array[$j];
$extra_cost = is_null($extras_cost_array[$j]) ? "" : $extras_cost_array[$j];
@endphp
<div class="col-sm-8">
{{ Form::label('extras_used','Extras used') }}
{{ Form::text('extras_used[]',$extra_item,['class' => 'form-control', 'data-error'=>'']) }}
</div>
<div class="col-sm-4">
{{ Form::label('extras_cost','Cost') }}
{{ Form::number('extras_cost[]',$extra_cost,['class' => 'form-control', 'data-error'=>'']) }}
</div>
@endfor
@else
<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>
@endif
</div>
<a href="#" id="addOptionExtras">Add other extras used</a><br><br>
<div class="alert-danger" style="padding: 10px">
<button type="button" class="close" data-dismiss="alert">×</button>
If any risks identified for future procedures, please note them in Alerts box on top of Patient Home page.
</div>
<div class="form-group" style="padding-top: 10px; float: right;">
{{ Form::submit('Update',['class' => 'btn btn-success']) }}
</div>
</div>
</div>
{{ Form::close() }}
</div>
</div>
</div>
<!-- start modals -->
<div class="modal fade" id="modal_new_surgeon" 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">Register a new Surgeon</h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
@include('theatre::theatre_surgeries.add.add_surgeon')
</div>
</div>
</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="submitSurgeon" value="Save"/>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_new_assistant_surgeon" 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">Register a new assistant surgeon</h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
@include('theatre::theatre_surgeries.add.add_assistant_surgeon')
</div>
</div>
</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="submitAssistantSurgeon" value="Save"/>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_new_nurse" 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">Register a new nurse</h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
@include('theatre::theatre_surgeries.add.add_nurse')
</div>
</div>
</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_theatre_location" 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">Register a new theatre location</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>Theatre location</label>
<input class="form-control compulsory" id="theatre_location_name" name="theatre_location_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="submitTheatreLocation" value="Save"/>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_other_scrub_staff" 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">Register a new scrub nurse</h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
@include('theatre::theatre_surgeries.add.add_scrub_staff')
</div>
</div>
</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="submitOtherScrubStaff" value="Save"/>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_new_scrub_staff" 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">Register a new scrub nurse</h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
@include('theatre::theatre_surgeries.add.add_scrub_nurse')
</div>
</div>
</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="submitScrubNurse" value="Save"/>
</div>
</div>
</div>
</div>
<!-- end of modals -->
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<!-- pull in select2 for auto searchable drop downs -->
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script>
function get_cadre(id){
var user_id = id;
$.ajax({
type:'get',
url: '/get_cadre',
data: { user_id : user_id},
cache: false,
success: function (response) {
//console.log(response);
$('#cadre').val(response);
}
});
};
</script>
<script type="text/javascript">
$(document).ready(function () {
$('#datepicker-autoclose').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
});
$("#outcome").change(function () {
var id = $(this).val();
switch (id) {
case "1": // Admitted
$('#admitted_div').show();
$('#home_with_followup_div').hide();
$('#referred_div').hide();
break;
case "3": // Home with follow up
$('#home_with_followup_div').show();
$('#admitted_div').hide();
$('#referred_div').hide();
break;
case "4": // Referred
$('#referred_div').show();
$('#home_with_followup_div').hide();
$('#admitted_div').hide();
break;
default:
$('#admitted_div').hide();
$('#home_with_followup_div').hide();
$('#referred_div').hide();
break;
}
});
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' onclick='select2set()' 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>");
});
$('#procedure_id,#surgeon,#scrub_nurse,#authorised_swab_check,#assistant_surgeon,#other_scrub_staff,#theatre_incharge,#vicryl_sutures_used').select2({
placeholder: "-- select --"
});
$('.select2-selection.select2-selection--single').css('height','calc(3.85rem)');
$('.select2-selection.select2-selection--single').css('padding-top','5px');
$('.select2-selection.select2-selection--single').css('border-left', '3px solid #F08080');/*add compulsory class*/
$('.select2-selection.select2-selection--single.sec_d').css('border-left', '3px solid #aaa');
$('.select2-selection__arrow').css('top','3px');
$("#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>");
});
function select2set() {
$(this).select2();
}
function handleAjaxError(jqXHR, textStatus, errorThrown){
console.log(jqXHR, textStatus, errorThrown);
if(jqXHR.status === 500){
alert("User Name or Email Already Exist");
}
}
$('#submitTheatreLocation').click(function () {
var name = $('#theatre_location_name').val();
if (name === '') {
alert("Please fill out the name");
} else {
$.ajax({
type: "post",
url: "/add_new_theatre_location",
data: {name: name},
cache: false,
success: function (result) {
$('#theatre_location').append($('<option>', {
value: result,
text: name
}));
$('#theatre_location').val(result);//preselect the newly added location
$('#modal_new_theatre_location').modal('hide'); //manually hide the modal
},
error: function (error) {
console.log(error);
}
});
}
});
$('#submitNurse').click(function () {
console.log('saving nurses eryday');
var first_name = $('#n_first_name').val();
var last_name = $('#n_last_name').val();
var phone_number = $('#n_phone_number').val();
var email = $('#n_email').val();
var position_id = $('#n_position_id').val();
var user_name = $('#n_user_name').val();
var secret_pin = $('#n_secret_pin').val();
var security_question = $('#n_security_question').val();
var security_answer = $('#n_security_answer').val();
var registration_number = $('#n_registration_number').val();
if (first_name === '') {
alert("Please fill out the first name");
}else if(last_name === ''){
alert("Please fill out the last name");
}else if(phone_number === ''){
alert("Please fill out the phone number");
}else if(email === ''){
alert('Please fill out the email')
}else if(position_id === ''){
alert('Please fill out the position of the staff being created');
}else if(user_name === ''){
alert('Please fill out the user name for the staff');
}else if(secret_pin === ''){
alert('Please fill out the secret pin ');
}else if(security_question === ''){
alert('Please Select a security question');
}else if(security_answer === ''){
alert('Please fill out an answer for the select question');
}else if(registration_number === ''){
alert('Please fill out the registration number');
}else {
let data = {
'first_name' : first_name,
'last_name' : last_name,
'phone_number' : phone_number,
'email': email,
'position_id' : position_id,
'user_name' : user_name,
'secret_pin' : secret_pin,
'security_question' : security_question,
'security_answer' : security_answer,
'registration_number': registration_number,
};
console.log(JSON.stringify(data));
$.ajax({
type: "post",
url: '/quick_add_user',
data: data,
cache: false,
success: function (result) {
console.log(JSON.stringify(result));
$('#scrub_nurse').append($('<option>', {
value: result,
text: (first_name + ' ' +last_name)
}));
$('#scrub_nurse').val(name);
$('#scrub_nurse_temporary').val(name);
$('#modal_new_nurse').modal('hide');
},
error: handleAjaxError
});
}
});
$('#submitOtherScrubStaff').click(function () {
console.log('saving nurses eryday');
var first_name = $('#ss_first_name').val();
var last_name = $('#ss_last_name').val();
var phone_number = $('#ss_phone_number').val();
var email = $('#ss_email').val();
var position_id = $('#ss_position_id').val();
var user_name = $('#ss_user_name').val();
var secret_pin = $('#ss_secret_pin').val();
var security_question = $('#ss_security_question').val();
var security_answer = $('#ss_security_answer').val();
var registration_number = $('#ss_registration_number').val();
if (first_name === '') {
alert("Please fill out the first name");
}else if(last_name === ''){
alert("Please fill out the last name");
}else if(phone_number === ''){
alert("Please fill out the phone number");
}else if(email === ''){
alert('Please fill out the email')
}else if(position_id === ''){
alert('Please fill out the position of the staff being created');
}else if(user_name === ''){
alert('Please fill out the user name for the staff');
}else if(secret_pin === ''){
alert('Please fill out the secret pin ');
}else if(security_question === ''){
alert('Please Select a security question');
}else if(security_answer === ''){
alert('Please fill out an answer for the select question');
}else if(registration_number === ''){
alert('Please fill out the registration number');
}else {
let data = {
'first_name' : first_name,
'last_name' : last_name,
'phone_number' : phone_number,
'email': email,
'position_id' : position_id,
'user_name' : user_name,
'secret_pin' : secret_pin,
'security_question' : security_question,
'security_answer' : security_answer,
'registration_number': registration_number,
};
console.log(JSON.stringify(data));
$.ajax({
type: "post",
url: '/quick_add_user',
data: data,
cache: false,
success: function (result) {
console.log(JSON.stringify(result));
$('#other_scrub_staff').append($('<option>', {
value: result,
text: (first_name + ' ' +last_name)
}));
$('#other_scrub_staff').val(first_name + ' ' +last_name);//preselect the newly added location
$('#other_scrub_staff_temporary').val(first_name + ' ' +last_name);
$('#modal_other_scrub_staff').modal('hide'); //manually hide the modal
},
error: handleAjaxError
});
}
});
$('#submitScrubNurse').click(function () {
var first_name = $('#sn_first_name').val();
var last_name = $('#sn_last_name').val();
var phone_number = $('#sn_phone_number').val();
var email = $('#sn_email').val();
var position_id = $('#sn_position_id').val();
var user_name = $('#sn_user_name').val();
var secret_pin = $('#sn_secret_pin').val();
var security_question = $('#sn_security_question').val();
var security_answer = $('#sn_security_answer').val();
var registration_number = $('#sn_registration_number').val();
if (first_name === '') {
alert("Please fill out the first name");
}else if(last_name === ''){
alert("Please fill out the last name");
}else if(phone_number === ''){
alert("Please fill out the phone number");
}else if(email === ''){
alert('Please fill out the email')
}else if(position_id === ''){
alert('Please fill out the position of the staff being created');
}else if(user_name === ''){
alert('Please fill out the user name for the staff');
}else if(secret_pin === ''){
alert('Please fill out the secret pin ');
}else if(security_question === ''){
alert('Please Select a security question');
}else if(security_answer === ''){
alert('Please fill out an answer for the select question');
}else if(registration_number === ''){
alert('Please fill out the registration number');
}else {
let data = {
'first_name' : first_name,
'last_name' : last_name,
'phone_number' : phone_number,
'email': email,
'position_id' : position_id,
'user_name' : user_name,
'secret_pin' : secret_pin,
'security_question' : security_question,
'security_answer' : security_answer,
'registration_number': registration_number,
};
$.ajax({
type: "post",
url: '/quick_add_user',
data: data,
cache: false,
success: function (result) {
console.log(JSON.stringify(result));
$('#scrub_nurse').append($('<option>', {
value: result,
text: (first_name + ' ' +last_name)
}));
$('#scrub_nurse').val(name);
$('#scrub_nurse_temporary').val(name);
$('#modal_new_nurse').modal('hide');
},
error: handleAjaxError
});
var name = $('#scrub_nurse_name').val();
if (name === '') {
alert("Please fill out the name");
} else {
$('#theatre_incharge').append($('<option>', {
value: first_name + ' ' +last_name,
text: first_name + ' ' +last_name
}));
$('#theatre_incharge').val(first_name + ' ' +last_name);//preselect the newly added location
$('#theatre_incharge_temporary').val(first_name + ' ' +last_name);
$('#modal_new_scrub_staff').modal('hide'); //manually hide the modal
}
}
});
$("#submitSurgeon").click(function () {
console.log('saving nurses eryday');
var first_name = $('#sg_first_name').val();
var last_name = $('#sg_last_name').val();
var phone_number = $('#sg_phone_number').val();
var email = $('#sg_email').val();
var position_id = $('#sg_position_id').val();
var user_name = $('#sg_user_name').val();
var secret_pin = $('#sg_secret_pin').val();
var security_question = $('#sg_security_question').val();
var security_answer = $('#sg_security_answer').val();
var registration_number = $('#sg_registration_number').val();
if (first_name === '') {
alert("Please fill out the first name");
}else if(last_name === ''){
alert("Please fill out the last name");
}else if(phone_number === ''){
alert("Please fill out the phone number");
}else if(email === ''){
alert('Please fill out the email')
}else if(position_id === ''){
alert('Please fill out the position of the staff being created');
}else if(user_name === ''){
alert('Please fill out the user name for the staff');
}else if(secret_pin === ''){
alert('Please fill out the secret pin ');
}else if(security_question === ''){
alert('Please Select a security question');
}else if(security_answer === ''){
alert('Please fill out an answer for the select question');
}else if(registration_number === ''){
alert('Please fill out the registration number');
}else {
let data = {
'first_name' : first_name,
'last_name' : last_name,
'phone_number' : phone_number,
'email': email,
'position_id' : position_id,
'user_name' : user_name,
'secret_pin' : secret_pin,
'security_question' : security_question,
'security_answer' : security_answer,
'registration_number': registration_number,
};
console.log(JSON.stringify(data));
$.ajax({
type: "post",
url: '/quick_add_user',
data: data,
cache: false,
success: function (result) {
console.log(JSON.stringify(result));
$('#surgeon').append($('<option>', {
value: result,
text: first_name +' '+last_name
}));
$('#surgeon').val(name);//preselect the newly added location
$('#surgeon_temporary').val(name);
$('#modal_new_surgeon').modal('hide'); //manually hide the modal
},
error: handleAjaxError
});
}
});
$('#submitAssistantSurgeon').click(function () {
console.log('saving assistant surgeons eryday');
var first_name = $('#asg_first_name').val();
var last_name = $('#asg_last_name').val();
var phone_number = $('#asg_phone_number').val();
var email = $('#asg_email').val();
var position_id = $('#asg_position_id').val();
var user_name = $('#asg_user_name').val();
var secret_pin = $('#asg_secret_pin').val();
var security_question = $('#asg_security_question').val();
var security_answer = $('#asg_security_answer').val();
var registration_number = $('#asg_registration_number').val();
if (first_name === '') {
alert("Please fill out the first name");
}else if(last_name === ''){
alert("Please fill out the last name");
}else if(phone_number === ''){
alert("Please fill out the phone number");
}else if(email === ''){
alert('Please fill out the email')
}else if(position_id === ''){
alert('Please fill out the position of the staff being created');
}else if(user_name === ''){
alert('Please fill out the user name for the staff');
}else if(secret_pin === ''){
alert('Please fill out the secret pin ');
}else if(security_question === ''){
alert('Please Select a security question');
}else if(security_answer === ''){
alert('Please fill out an answer for the select question');
}else if(registration_number === ''){
alert('Please fill out the registration number');
}else {
let data = {
'first_name' : first_name,
'last_name' : last_name,
'phone_number' : phone_number,
'email': email,
'position_id' : position_id,
'user_name' : user_name,
'secret_pin' : secret_pin,
'security_question' : security_question,
'security_answer' : security_answer,
'registration_number': registration_number,
};
console.log(JSON.stringify(data));
$.ajax({
type: "post",
url: '/quick_add_user',
data: data,
cache: false,
success: function (result) {
console.log(JSON.stringify(result));
$('#assistant_surgeon').append($('<option>', {
value: result,
text: (first_name +' '+last_name)
}));
$('#assistant_surgeon').val(name);//preselect the newly added location
$('#assistant_surgeon_temporary_temporary').val(name);
$('#modal_new_assistant_surgeon').modal('hide'); //manually hide the modal
},
error: handleAjaxError
});
}
});
$('#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]);
}
}
});
});
});
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);
}
}
</script>
@endpush