resolved conflicts

This commit is contained in:
2025-03-31 03:46:05 +03:00
6454 changed files with 1520539 additions and 9 deletions
@@ -0,0 +1,233 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/icheck/skins/all.css') }}" rel="stylesheet">
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('service_items.add_service') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('service_items.dashboard') }}</a></li>
<li><a href="/service_items/">{{ __('service_items.services') }}</a></li>
<li class="active">{{ __('service_items.add_service') }}</li>
</ol>
</div>
</div>
@include('flash::message')
@include('clinical_data::service_items.menu')
<div class="row">
<div class="col-sm-12">
<div class="white-box">
@if (session()->has('streamline_setup'))
<h3><font color="blue">{{ __('service_items.streamline_setup') }}</font></h3>
{{ Form::open(['route' => 'service_items.store','data-toggle'=>'validator']) }}
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('name', __('service_items.service_name')) }}
{{ Form::text('name', '', ['class' => 'form-control compulsory']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('non_insured_price', __('service_items.non_insured_price')) }}
{{ Form::number('non_insured_price', '', ['class' => 'form-control compulsory']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('account_id', __('service_items.chart_account_name')) }}
{{ Form::select('account_id', $chart_of_accounts, null, ['class'=>'form-control compulsory']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('description', __('service_items.description')) }}
{{ Form::textArea('description', '', ['class'=>'form-control', 'rows' => 4]) }}
</div>
<div class="form-group">
{{ Form::label('type_of_service',__('service_items.type_of_service')) }}
<br>
<div>
{{ Form::radio('type_of_service', 'Consultation', false, []) }} {{ __('service_items.consultation') }}<br>
{{ Form::radio('type_of_service', 'Co_Payment', false, []) }} {{ __('service_items.copayment') }}<br>
{{ Form::radio('type_of_service', 'Service', false, []) }} {{ __('service_items.service') }}<br>
</div>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-6" style="background: #eceeef;">
<h4>{{ __('service_items.select_any_list') }}</h4>
@foreach ($services as $service)
<div class="form-group">
{{ Form::checkbox('selected_services[]', $service['Item_Name'], false) }} {{ $service['Item_Name'] }} &nbsp;&nbsp;
</div>
@endforeach
</div>
</div>
{{ Form::button(__('service_items.next'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
{{ Form::button(__('service_items.skip'),['type'=>'submit','name' => 'skip', 'value' => 'skip','class'=>'btn btn-default waves-effect waves-light m-r-10']) }}
@else
{{ Form::open(['route' => 'service_items.store','data-toggle'=>'validator']) }}
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('name', __('service_items.service_name')) }}
{{ Form::text('name', '', ['class' => 'form-control compulsory']) }}
<div class="help-block with-errors"></div>
</div>
{{--
<div class="form-group">
{{ Form::label('attach_to_staff_name', __('service_items.attach_staff_name')) }}
<br>
<div>
&nbsp;{{ Form::radio('attach_to_staff_name', 1, false, ["id"=> "attach_staff_name", "onclick" => "show('attach_staff_name_div')"]) }} {{ __('service_items.yes') }}
&nbsp;{{ Form::radio('attach_to_staff_name', 0, false, ["id"=> "do_not_attach_staff","onclick" => "hide('attach_staff_name_div')"]) }} {{ __('service_items.no') }}
</div>
<div class="help-block with-errors"></div>
</div>
--}}
<div class="form-group" id="attach_staff_name_div" style="display: none;">
{{ Form::label('staff', 'Staff:') }}
{{ Form::select('user_id', $users_array, '', ['class' => 'form-control', 'id' => 'staff_id']) }}
</div>
<div class="form-group">
{{ Form::label('non_insured_price', 'Cash Price') }}
{{ Form::number('non_insured_price', '', ['class' => 'form-control compulsory', 'id' => 'non_insured_price']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('available', __('service_items.is_service_available')) }}&ensp;
{{ Form::radio('available', 1, false, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }} {{ __('service_items.yes') }} &nbsp;&nbsp;
{{ Form::radio('available', 0, false, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }} {{ __('service_items.no') }}
<div class="help-block with-errors"></div>
</div>
@php
$price_list_categories = \Streamline\Models\PriceListCategories::select('patient_category_id', 'id')->get();
@endphp
@foreach($price_list_categories as $record)
<div class="form-group">
{{ Form::label('non_insured_price', get_name($record->patient_category_id, 'id', 'name', 'patient_categories').' Price') }}
{{ Form::hidden('price_list_category_id[]', $record->id) }}
{{ Form::number('price_list_price[]', '', ['class'=>'form-control price_list_price']) }}
</div>
@endforeach
<div class="form-group">
{{ Form::label('account_id', __('service_items.chart_account_name')) }}
{{ Form::select('account_id', $chart_of_accounts, null, ['class'=>'form-control compulsory']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
{{ Form::label('description', __('service_items.description')) }}
{{ Form::textArea('description', '', ['class'=>'form-control', 'rows' => 4]) }}
</div>
<div class="form-group">
{{ Form::label('type_of_service',__('service_items.type_of_service')) }}
<br>
<div>
{{ Form::radio('type_of_service', 'Consultation', false, []) }} {{ __('service_items.consultation') }}<br>
{{ Form::radio('type_of_service', 'Co_Payment', false, []) }} {{ __('service_items.copayment') }}<br>
{{ Form::radio('type_of_service', 'Service', false, []) }} {{ __('service_items.service') }}<br>
</div>
<div class="help-block with-errors"></div>
</div>
</div>
</div>
{{ Form::button(__('service_items.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
{{ Form::button(__('service_items.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
@endif
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<!-- icheck -->
<script src="{{ asset('elite/bower_components/icheck/icheck.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/icheck/icheck.init.js') }}"></script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
function show(id) {
if (document.getElementById(id).style.display == 'none') {
document.getElementById(id).style.display = '';
}
}
function hide(id) {
document.getElementById(id).style.display = 'none';
}
</script>
<script type="text/javascript">
$(document).ready(function () {
$(".next,.submit-btn").click(function (e) { // make sure that all compulsory fields have been filled out
var empty_compulsory_fields = [];
$(".compulsory").each(function () {
if ($(this).val() == "") {
var textname = $(this).attr('name');
$(this).focus();
empty_compulsory_fields.push(textname);
$(this).css('border','1px solid #F08080');
}
});
/* check if the array containing empty compulsory fields is not empty then return false */
if (empty_compulsory_fields.length != 0) {
alert("Please fill in all compulsory fields");
console.log(empty_compulsory_fields);
e.preventDefault();
return false;
}
});
$('#non_insured_price').change(function(e) {
var non_insured_price = $(this).val();
if (non_insured_price > 0) {
$(".price_list_price").each(function () {
$(this).val(non_insured_price);
});
}
});
});
</script>
@endpush
@@ -0,0 +1,121 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/icheck/skins/all.css') }}" rel="stylesheet">
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('service_items.edit_service') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('service_items.dashboard') }}</a></li>
<li><a href="/service_items">{{ __('service_items.services') }}</a></li>
<li class="active">{{ __('service_items.edit') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('clinical_data::service_items.menu')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
{{ Form::model($service, ['method' => 'PUT', 'route' => ['service_items.update',$service], 'data-toggle' => 'validator']) }}
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('name', __('service_items.service_name')) }}
{{ Form::text('name', $service->name, ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('non_insured_price', __('service_items.non_insured_price')) }}
{{ Form::number('non_insured_price', $service->non_insured_price, ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
@if($service->price_list_category && $service->price_list_category != '')
@php
$price_list_categories = explode(",", $service->price_list_category);
$price_list_prices = explode(",", $service->price_list_price);
@endphp
@for($i = 0; $i < count($price_list_categories); $i++)
<div class="form-group">
{{ Form::label('non_insured_price', get_name($price_list_categories[$i], 'id', 'name', 'patient_categories').' Price') }}
{{ Form::hidden('price_list_category_id[]', $price_list_categories[$i]) }}
{{ Form::number('price_list_price[]', $price_list_prices[$i], ['class'=>'form-control price_list_price']) }}
</div>
@endfor
@endif
<div class="form-group">
{{ Form::label('account_id', __('service_items.chart_account_name')) }}
{{ Form::select('account_id', $chart_of_accounts, $service->account_id, ['class'=>'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
{{ Form::label('available', __('service_items.is_service_available')) }}&ensp;
{{ Form::radio('available', 1, $service->available == 1, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }} {{ __('service_items.yes') }} &nbsp;&nbsp;
{{ Form::radio('available', 0, $service->available == 0, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }} {{ __('service_items.no') }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('description', __('service_items.description')) }}
{{ Form::textArea('description', $service->description, ['class'=>'form-control', 'rows' => 4]) }}
</div>
<div class="form-group">
{{ Form::label('type_of_service',__('service_items.type_of_service')) }}
<br>
<div>
{{ Form::radio('type_of_service', 'Consultation', ($service->item_type == 'Consultation'), ["required"]) }} {{ __('service_items.consultation') }}<br>
{{ Form::radio('type_of_service', 'Co_Payment', ($service->item_type == 'Co_Payment'), ["required"]) }} {{ __('service_items.copayment') }}<br>
{{ Form::radio('type_of_service', 'Service', ($service->item_type == 'Service'), ["required"]) }} {{ __('service_items.service') }}<br>
</div>
<div class="help-block with-errors"></div>
</div>
</div>
</div>
{{ Form::button(__('service_items.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
{{ Form::button(__('service_items.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
<!-- icheck -->
<script src="{{ asset('elite/bower_components/icheck/icheck.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/icheck/icheck.init.js') }}"></script>
<script>
function show(id) {
if (document.getElementById(id).style.display == 'none') {
document.getElementById(id).style.display = '';
}
}
function hide(id) {
document.getElementById(id).style.display = 'none';
}
</script>
@endpush
@@ -0,0 +1,78 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('service_items.activate_services') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('service_items.dashboard') }}</a></li>
<li><a href="/service_items">{{ __('service_items.services') }}</a></li>
<li class="active">{{ __('service_items.activate') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('clinical_data::service_items.menu')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ __('service_items.service_name') }}</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($services as $service)
<tr>
<td>{{ $service->name }}</td>
<td>
{{ Form::model($service->id ,['method' => 'POST', 'route' => ['service_items.activate', $service->id]]) }}
<button type="submit" class="btn btn-warning" onclick="return confirm('<?php echo __('service_items.are_you_sure'); ?>')"><i class="fa fa-check"></i> {{ __('service_items.activate') }}</button>
{{ Form::close() }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
</script>
@endpush
@@ -0,0 +1,89 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('service_items.services') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('service_items.dashboard') }}</a></li>
<li class="active">{{ __('service_items.services') }}</li>
</ol>
</div>
</div>
@include('flash::message')
@include('clinical_data::service_items.menu')
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<div class="table-responsive">
<table class="table table-striped color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('service_items.service_name') }}</th>
<th>{{ __('service_items.chart_of_account') }}</th>
<th>{{ __('service_items.type_of_service') }}</th>
<th>{{ __('service_items.price') }}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($service_items as $item)
<tr>
<td>{{ $item->name }}</td>
<td>{{ (isset($chart_of_accounts[$item->account_id])) ? $chart_of_accounts[$item->account_id] : '' }}</td>
<td>{{ $item->item_type }}</td>
<td>{{ ugandan_shillings($item->non_insured_price) }}</td>
<td>
<a href="/service_items/{{ $item->id }}/edit/" class="btn btn-info"><i class="fa fa-pencil"></i> {{ __('service_items.edit') }}</a>
</td>
<td>
@if (!in_array($item->id, $ordered_service_ids))
{{ Form::model($item->id ,['method' => 'DELETE', 'route' => ['service_items.destroy', $item->id]]) }}
<button type="submit" class="btn btn-danger" onclick="return confirm('<?php echo __('service_items.are_you_sure'); ?>')"><i class="fa fa-trash"></i> {{ __('service_items.delete') }}</button>
{{ Form::close() }}
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script>
$('.table').DataTable({
pageLength: 50,
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
</script>
@endpush
@@ -0,0 +1,7 @@
<div class="panel panel-default">
<div class="panel-body">
<a href="{{ route('service_items.create') }}" class="nav-item btn btn-success ti-plus"> {{ __('service_items.add_service') }}</a>
<a href="{{ route('service_items.index') }}" class="nav-item btn btn-warning ti-eye"> {{ __('service_items.view_services') }}</a>
<a href="{{ route('service_items.inactive') }}" class="nav-item btn btn-danger ti-eye"> {{ __('service_items.activate_services') }}</a>
</div>
</div>
@@ -0,0 +1,648 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/switchery/dist/switchery.min.css') }}" rel="stylesheet"/>
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-6 col-md-7 col-sm-7 col-xs-12">
<h4 class="page-title">{{ __('service_items.order_service') }} {{ $patient->last_name }} {{ __('service_items.for_episode') }}:<a>{{ streamline_date(get_name($episode_id, 'id', 'created_at', 'patient_episodes')) }}</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('service_items.dashboard') }}</a></li>
<li><a href="{{ route('patient_episodes.index') }}">{{ __('service_items.patient_home') }}</a></li>
<li class="active">{{ __('service_items.ordering_services') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patients::allergies.header')
</div>
</div>
<br>
<div class="white-box">
<!--Flash messages at the top -->
@include('flash::message')
@foreach ($errors->all() as $error)
<div>{{ $error }}</div>
@endforeach
{{ Form::open(['route' => 'services.store_ordered']) }}
@php $patient_insurance_status = patient_insurance_status($patient_id); @endphp
{{ Form::hidden('patient_id', $patient_id, ['id' => 'patient_id'])}}
{{ Form::hidden('patient_insurance_status', $patient_insurance_status, ['id' => 'patient_insurance_status'])}}
<div id='payments_items'>
<table class='table color-bordered-table success-bordered-table'>
<thead>
<tr>
<th>
<div class='row'>
<div class='col-3'>Service</div>
<div class='col-2'>Quantity</div>
<div class='col-2' @if(view_service_price_on_order()==0) style='display: none' @endif>Unit Cost</div>
<div class='col-2' @if(view_service_price_on_order()==0) style='display: none' @endif>Total Cost</div>
<div class='col-2'>Performed</div>
<div class='col-1'></div>
</div>
</th>
</tr>
</thead>
@php
$option_services = "<option value=''>-select-</option>";
foreach ($services as $key => $value){
$option_services .= "<option value='$key'>$value</option>";
}
$option_employees = "<option value=''>-select-</option>";
foreach ($employees as $employee){
$option_employees .= "<option value='$employee->id'>$employee->first_name $employee->last_name</option>";
}
$counter = 0;
@endphp
<tbody class='input_fields_wrap'>
@if($ordered_services)
<tr>
<td style='background-color: #FFE6E6; font-weight: bolder;'>
<u>{{ __('service_items.pending_services') }}</u>
@if(Auth::user()->can('cancel-ordered-services') )
<b><a class="pull-right text-blue" onclick="cancelOrderedItems({{ $ordered_services->id }})">Cancel all ordered services</a></b>
@endif
</td>
</tr>
{{ Form::hidden('order_id', $ordered_services->id) }}
@php
$service_ids = explode(",", $ordered_services->service_id);
$service_quantity = explode(",", $ordered_services->quantity);
$service_performed = explode(",", $ordered_services->performed);
$service_performed_id = explode(",", $ordered_services->performed_id);
@endphp
@for($i = 0; $i < count($service_ids); $i++)
<tr>
<td>
<div class='row'>
<div class='col-3'>
<div class='form-group'>
<div class='controls'>
@if($service_performed[$i] == 1)
{{ $services[$service_ids[$i]] }}
{{ Form::hidden('service_id[]', $service_ids[$i]) }}
@else
{{ Form::select('service_id[]', $services, $service_ids[$i], ['class' => 'form-control compulsory required service_id_class', 'id' => 'service_id_' . $counter]) }}
@endif
</div>
<div id='chi_coverage_div_{{ $counter }}'>
@if (is_chi_enabled() && is_patient_item_covered($patient_id, $service_ids[$i], 1))
&nbsp;&nbsp;<br><span style="color: darkgreen"><b>Covered by CHI</b></span>
@endif
</div>
</div>
</div>
<div class='col-2'>
<div class='form-group'>
<div class='controls'>
@if($service_performed[$i] == 1)
{{ $service_quantity[$i] }}
{{ Form::hidden('item_quantity[]', $service_quantity[$i]) }}
@else
<input type='number' value='{{ $service_quantity[$i] }}' name='item_quantity[]' id='item_quantity_{{ $counter }}' class='form-control item_quantity compulsory' required/>
@endif
</div>
</div>
</div>
@php
if ($patient_insurance_status == 1){
$services_cost = get_item_insurance_co_payment($patient_id, $service_ids[$i], 1, false, 0);
} else {
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_id){
$services_cost = get_price_list_category_price($price_list_id, 6, $service_ids[$i]);
} else {
$services_cost = get_name($service_ids[$i], 'id', 'non_insured_price', 'services');
}
}
@endphp
<div class='col-2' @if(view_service_price_on_order()==0) style='display: none' @endif>
<div class='form-group'>
<div class='controls'>
@if($service_performed[$i] == 1)
{{ ugandan_shillings($services_cost) }}
{{ Form::hidden('item_unit_cost[]', $services_cost) }}
@else
<input type='number' value="{{ ($services_cost) }}" name='item_unit_cost[]' id='item_unit_cost_{{ $counter }}' class='form-control item_unit_cost compulsory' readonly/>
@endif
</div>
</div>
</div>
<div class='col-2' @if(view_service_price_on_order()==0) style='display: none' @endif>
<div class='form-group'>
<div class='controls'>
@if($service_performed[$i] == 1)
{{ ugandan_shillings($service_quantity[$i] * $services_cost) }}
{{ Form::hidden('item_total_cost[]', ($service_quantity[$i] * $services_cost)) }}
@else
<input type='number' value="{{ ($service_quantity[$i] * $services_cost) }}" name='item_total_cost[]' id='item_total_cost_{{ $counter }}' class='form-control item_total_cost compulsory' readonly/>
@endif
</div>
</div>
</div>
<div class='col-2'>
@if($service_performed[$i] == 1)
@php
$performed_record = \Streamline\Models\StaffPerformedService::where('id', $service_performed_id[$i])->first();
@endphp
@if($performed_record)
<b>Performed By: </b><div id="performed_by_field_{{ $performed_record->id }}">{{ get_full_name($performed_record->performed_by, "id", "first_name", 'last_name', "users") }}</div>
@if($performed_record && Auth::user()->can('edit-performed-by'))
<br><br>
<a class="pull-right" style="color:#0099CC;" onclick="edit_performed_by({{ $performed_record->id }})">Edit</a>
<a class="pull-left" style="color:red;" onclick="delete_performed_by({{ $ordered_services->id }}, {{ $i }}, {{ $performed_record->id }})">Remove</a>
@endif
{{ Form::hidden('performed_services[]', 1) }}
{{ Form::hidden('service_performed_by[]', $performed_record->performed_by) }}
{{ Form::hidden('service_performed_by_amount[]', $performed_record->performance_fee) }}
{{ Form::hidden('service_performed_date[]', $performed_record->date_performed) }}
@else
{{ Form::hidden('performed_services[]', 0) }}
@endif
@else
<input type='checkbox' id='service_performed_{{ $counter }}' value='0' class='service_performed js-switch' data-color='green' data-size='small'>
<input type='hidden' value='0' name='performed_services[]' id='service_performed_tracker_{{ $counter }}' />
<div id='service_performed_by_div_{{ $counter }}' style='width: 100%; display: none'>
<br><label for='performed_by'>Performed By:</label>
<br><select name='service_performed_by[]' class='form-control service_performed_by' id='service_performed_by_{{ $counter }}'><?php echo $option_employees; ?></select>
<br><label for='service_performed_by_amount'>Staff Fee</label>
<br><input type='number' name='service_performed_by_amount[]' class='form-control' id='service_performed_by_amount{{ $counter }}'>
<br><label for='service_performed_date'>Date Performed</label>
<br><input type='text' name='service_performed_date[]' class='form-control compulsory service_performed_date' readonly/>
</div>
@endif
</div>
<div class='col-1'>
<div class='form-group' style='margin-top: 10px;'>
@if($counter == 0)
<button class='btn btn-sm btn-rounded btn-success add_item' style='color: white; margin-left: 25px;'><i class='fa fa-plus'></i></button>
@else
<button class='remove_field btn btn-sm btn-rounded btn-danger' style='color: white; margin-left: 25px;'><i class='fa fa-trash'></i></button>
@endif
</div>
</div>
</div>
</td>
</tr>
@php $counter++; @endphp
@endfor
@else
<tr>
<td>
<div class='row'>
<div class='col-3'>
<div class='form-group'>
<div class='controls'>
<select name='service_id[]' id='service_id_{{ $counter }}' class='form-control compulsory required service_id_class'>@php echo $option_services; @endphp</select>
</div>
<div id='chi_coverage_div_{{ $counter }}'></div>
</div>
</div>
<div class='col-2'>
<div class='form-group'>
<div class='controls'>
<input type='number' value='1' name='item_quantity[]' id='item_quantity_{{ $counter }}' class='form-control item_quantity compulsory' required/>
</div>
</div>
</div>
<div class='col-2' @if(view_service_price_on_order()==0) style='display: none' @endif>
<div class='form-group'>
<div class='controls'>
<input type='number' name='item_unit_cost[]' id='item_unit_cost_{{ $counter }}' class='form-control item_unit_cost compulsory' readonly/>
</div>
</div>
</div>
<div class='col-2' @if(view_service_price_on_order()==0) style='display: none' @endif>
<div class='form-group'>
<div class='controls'>
<input type='number' name='item_total_cost[]' id='item_total_cost_{{ $counter }}' class='form-control item_total_cost compulsory' readonly/>
</div>
</div>
</div>
<div class='col-2'>
<input type='checkbox' id='service_performed_{{ $counter }}' value='0' class='service_performed js-switch' data-color='green' data-size='small'>
<input type='hidden' value='0' name='performed_services[]' id='service_performed_tracker_{{ $counter }}' />
<div id='service_performed_by_div_{{ $counter }}' style='width: 100%; display: none'>
<br><label for='performed_by'>Performed By:</label>
<br><select name='service_performed_by[]' class='form-control service_performed_by' id='service_performed_by_{{ $counter }}'><?php echo $option_employees; ?></select>
<br><label for='service_performed_by_amount'>Staff Fee</label>
<br><input type='number' name='service_performed_by_amount[]' class='form-control' id='service_performed_by_amount{{ $counter }}'>
<br><label for='service_performed_date'>Date Performed</label>
<br><input type='text' name='service_performed_date[]' class='form-control compulsory service_performed_date' readonly/>
</div>
</div>
<div class='col-1'>
<div class='form-group' style='margin-top: 10px;'>
<button class='btn btn-sm btn-rounded btn-success add_item' style='color: white; margin-left: 25px;'><i class='fa fa-plus'></i></button>
</div>
</div>
</div>
</td>
</tr>
@endif
</tbody>
</table>
</div>
<div class='row' @if(view_service_price_on_order()==0) style='display: none' @endif>
<div style="float: right;">
<h3>Total: <span id="itemGrandTotal"></span></h3>
</div>
</div>
<div class='row'>
<div class='col-md-9'>
</div>
<div class='col-md-3'>
<button class='btn btn-rounded btn-info pull-right' id='submit_button'>Save Services</button>
</div>
</div>
{{ Form::close() }}
</div>
<div class="modal fade" id="edit_performed_modal" tabindex="-1" role="dialog" aria-labelledby="edit_performed_modal_label">
<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="edit_performed_modal_label">Edit Performed By</h4>
</div>
<div class="modal-body">
{{ Form::hidden('edit_performed_by_id', 0, ['id' => 'edit_performed_by_id']) }}
{{ Form::label('edit_perfomed_by', 'Perfomed By:')}}
<br>{{ Form::select('edit_performed_by', $users_array, '', ['class' => 'form-control', 'id' => 'edit_performed_by']) }}
<br>{{ Form::label('edit_performed_by_amount', 'Staff Fee')}}
<br>{{ Form::number('edit_performed_by_amount', '', ['class' => 'form-control', 'id' => 'edit_performed_by_amount']) }}
<br>{{ Form::label('edit_performed_date', 'Date Performed')}}
<br>{{ Form::text('edit_performed_date', '', ['class' => 'form-control compulsory service_performed_date', 'readonly'])}}
</div>
<div class="modal-footer">
<a class="btn btn-success btn-sm" id="edit_performed_by_button">Save Changes</a>
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/switchery/dist/switchery.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.services').select2({
placeholder: "Select service"
});
// Switchery
$('.js-switch').each(function () {
new Switchery($(this)[0], $(this).data());
});
$('#submit_button').click(function () {
$(".service_performed").each(function () {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
if($('#service_performed_'+id).is(':checked') && $('#service_performed_by'+id).val() === "") {
alert('Please make sure you select the staff that has performed the service');
return false;
}
});
return true;
});
$('.service_performed_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd'
});
$(".input_fields_wrap").on('change', ".service_performed_by", function () {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
let performed_by = $('#service_performed_by_'+id).val();
let patient_id = $("#patient_id").val();
let service_id = $('#service_id_'+id).val();
if (service_id == "") {
return false;
}
$.ajax({
type: "POST",
url: "/services/fetch_service_performance_fee",
data: {
patient_id: patient_id,
performed_by: performed_by,
item_id: service_id
},
success: function (response) {
$('#service_performed_by_amount' + id).val(response);
}
});
});
$(".input_fields_wrap").on('change', ".service_performed", function () {
let id = /\d+(?=\D*$)/.exec($(this).attr('id'));
if(!$(this).is(':checked')) {
$("#service_performed_by_div_"+id).hide();
$("#service_performed_tracker_"+id).val(0);
} else {
$("#service_performed_by_div_"+id).show();
$("#service_performed_tracker_"+id).val(1);
}
});
$('#edit_performed_by_button').click(function () {
let id = $('#edit_performed_by_id').val();
let edit_performed_date = $('#edit_performed_date').val();
let edit_performed_by_amount = $('#edit_performed_by_amount').val();
let edit_performed_by = $('#edit_performed_by').val();
$.ajax({
type: "POST",
url: "/staff_payment_configuration/edit_performed_by_info",
data: {
edit_performed_date: edit_performed_date,
edit_performed_by_amount: edit_performed_by_amount,
edit_performed_by: edit_performed_by,
id: id
},
success: function (response) {
alert("Service performed by has been updated...");
$("#edit_performed_modal").modal("hide");
$('#performed_by_field_'+id).text(response);
},
error: function (response) {
alert("Something went wrong!");
return false;
}
});
});
});
var max_rows = 20;
var wrapper = $(".input_fields_wrap"); //Fields wrapper
var add_button = $(".add_item");
var show_price_setting = <?php echo view_service_price_on_order(); ?>;
var x = <?php echo $counter + 1; ?> // initial row count
add_button.click(function (e) { // on add input button click
e.preventDefault();
if (x < max_rows) {
$(wrapper).append("\
<tr>\
<td>\
<div class='row'>\
<div class='col-3'>\
<div class='form-group'>\
<div class='controls'>\
<select name='service_id[]' id='service_id_" + x + "' class='form-control compulsory required service_id_class' required>@php echo $option_services; @endphp</select>\
</div>\
<div id='chi_coverage_div_" + x + "'></div>\
</div>\
</div>\
<div class='col-2'>\
<div class='form-group'>\
<div class='controls'>\
<input type='number' value='1' name='item_quantity[]' id='item_quantity_" + x + "' class='form-control item_quantity compulsory' required/>\
</div>\
</div>\
</div>\
<div class='col-2'"+(show_price_setting==0?'style="display:none"':'')+">\
<div class='form-group'>\
<div class='controls'>\
<input type='number' name='item_unit_cost[]' id='item_unit_cost_" + x + "' class='form-control item_unit_cost compulsory' readonly/>\
</div>\
</div>\
</div>\
<div class='col-2'"+(show_price_setting==0?'style="display:none"':'')+">\
<div class='form-group'>\
<div class='controls'>\
<input type='number' name='item_total_cost[]' id='item_total_cost_" + x + "' class='form-control item_total_cost compulsory' readonly/>\
</div>\
</div>\
</div>\
<div class='col-2'>\
<input type='checkbox' id='service_performed_" + x + "' value='0' class='service_performed js-switch' data-color='green' data-size='small'>\
<input type='hidden' value='0' name='performed_services[]' id='service_performed_tracker_" + x + "' />\
<div id='service_performed_by_div_" + x + "' style='width: 100%; display: none'>\
<br><label for='performed_by'>Performed By:</label>\
<br><select name='service_performed_by[]' class='form-control service_performed_by' id='service_performed_by_" + x + "'><?php echo $option_employees; ?></select>\
<br><label for='service_performed_by_amount'>Staff Fee</label>\
<br><input type='number' name='service_performed_by_amount[]' class='form-control' id='service_performed_by_amount" + x + "'>\
<br><label for='service_performed_date'>Date Performed</label>\
<br><input type='text' name='service_performed_date[]' class='form-control compulsory service_performed_date' readonly/>\
</div>\
</div>\
<div class='col-1'>\
<div class='form-group' style='margin-top: 10px;'>\
<button class='remove_field btn btn-sm btn-rounded btn-danger' style='color: white; margin-left: 25px;'><i class='fa fa-trash'></i></button>\
</div>\
</div>\
</div>\
</td>\
</tr>");
generalSelect2Set('service_performed_by_'+x);
generalSelect2Set('service_id_'+x);
new Switchery($('#service_performed_'+x)[0], $('#service_performed_'+x).data());
$("select.item_select").change(function(){
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var name_selected = $(this).children("option:selected").val();
$("#name_" + id).val(parseInt(name_selected));
});
x++;
$('.service_performed_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd'
});
}
});
$(wrapper).on("click", ".remove_field", function (e) {
e.preventDefault();
$(this).parent('div').parent('div').parent('div').parent('td').parent('tr').remove();
});
$(".input_fields_wrap").on('change', ".service_id_class", function () {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var item = $("#service_id_" + id).val();
let patient_id = $('#patient_id').val();
let patient_insurance_status = $('#patient_insurance_status').val();
$.ajax({
url: '/get_service_details',
data: {'service_id':item, 'patient_id':patient_id, 'patient_insurance_status': patient_insurance_status},
success: function(response){
let arr = JSON.parse(response);
$("#item_unit_cost_"+id).val(arr["selling_price"]);
$("#item_total_cost_"+id).val(arr["selling_price"]);
$("#item_quantity_"+id).val(1);
if (arr["covered_by_chi"] !== "") {
$("#chi_coverage_div_" + id).html(arr["covered_by_chi"]).show();
} else {
$("#chi_coverage_div_" + id).hide();
}
//loop through the prices
let auto_price_grand_total = 0;
$(".item_total_cost").each(function(){
auto_price_grand_total += parseInt($(this).val());
});
// recalculate the grand total
$("#itemGrandTotal").html(numberWithCommas(auto_price_grand_total) + " Ugx");
}
});
});
$(".service_id_class,.service_performed_by").select2({
width: "100%"
});
$(".input_fields_wrap").on('change', ".item_quantity", function () {
// make sure the lowest number is 1
if (+$(this).val() < 1) {
$(this).val(1);
}
// get the quantity and multiply against this for the total
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
let total_cost = +$('#item_unit_cost_' + id).val() * +$(this).val();
$('#item_total_cost_' + id).val(total_cost);
let auto_price_grand_total = 0;
$(".item_total_cost").each(function(){
auto_price_grand_total += +$(this).val();
});
// recalculate the grand total
$("#itemGrandTotal").html(numberWithCommas(auto_price_grand_total) + " Ugx");
});
$(".input_fields_wrap").on('change', ".item_unit_cost", function () {
// get the quantity and multiply against this for the total
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
let total_cost = +$('#item_quantity_' + id).val() * +$(this).val();
$('#item_total_cost_' + id).val(total_cost);
let auto_price_grand_total = 0;
$(".item_total_cost").each(function(){
auto_price_grand_total += +$(this).val();
});
// recalculate the grand total
$("#itemGrandTotal").html(numberWithCommas(auto_price_grand_total) + " Ugx");
});
function generalSelect2Set(id) {
$('#'+id).select2({
width: "100%"
});
}
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
function edit_performed_by(id) {
$.ajax({
type: "GET",
url: "/staff_payment_configuration/fetch_performed_by_info/" + id,
success: function (response) {
let arr = response.split(",");
$('#edit_performed_by_id').val(id);
$('#edit_performed_date').val(arr[2]);
$('#edit_performed_by_amount').val(arr[1]);
$('#edit_performed_by').val(arr[0]);
$("#edit_performed_modal").modal("show");
}
});
}
function delete_performed_by(order_id, position, id) {
if(confirm("Are you sure you want to remove the person who performed this service?")) {
$.ajax({
type: "GET",
url: "/staff_payment_configuration/delete_performed_by/" + id + "/" + position + "/" + order_id + "/2",
success: function (response) {
if (response == 1) {
alert("Success");
window.location.reload();
} else {
alert("An error occured while processing the request");
}
}
});
}
}
function cancelOrderedItems(order_id) {
if (confirm("Are you sure you want to continue? This will cancel all unpaid orders")) {
$.ajax({
url: '/cancel_ordered_services/' + order_id,
success: function(response){
if (response == 1) {
alert("Services have been cancelled");
window.location.reload();
} else {
alert("Cancellation of services failed");
}
}
});
}
}
</script>
@endpush