@extends('layouts.main') @push('styles') @endpush @section('content')

{{ __('family_accounts.family_accounts') }}

@include('patient_discounts::family_accounts.menu')
@include('flash::message') {{ Form::open(['url' => 'family_accounts_search', 'method' => 'ANY']) }}
{{ Form::label('family_account_id', __('family_accounts.family_of')) }} {{ Form::select('family_account_id', $family_accounts_array, '', ['class' => 'form-control compulsory', 'id' => 'family_account_id_dropdown']) }}
{{ Form::label('search_by', __('family_accounts.date')) }} {{ Form::select('search_by', ['0'=>'Last 24 hours','1'=>'Custom Date','2'=>'Custom Range'], '', ['class' => 'form-control','id'=>'search_by', 'required']) }}

{{ Form::button('Submit',['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id'=>'select_patient']) }}
{{ Form::close() }} @if(!is_null($reg_date))

{{ __('family_accounts.showing_consumption_of') }}{{ streamline_date($reg_date) }}

@elseif(!is_null($start_date) && !is_null($end_date))

{{ __('family_accounts.showing_consumption_from') }}{{ streamline_date($start_date) }} {{ __('family_accounts.to') }} {{ streamline_date($end_date) }}

@endif
@php $counter = 1; $current_balance_total = 0; @endphp @if(count($family_accounts) > 0) @foreach($family_accounts as $family_account) @php $counter++; @endphp @endforeach @endif
# {{ __('family_accounts.family_head') }} {{ __('family_accounts.family_members') }} {{ __('family_accounts.last_deposit') }} {{ __('family_accounts.current_balance') }} {{ __('family_accounts.opening_amount') }} {{ __('family_accounts.credit_limit') }} {{ __('family_accounts.action') }}
{{ $counter }} {{ get_full_name($family_account->family_head_id, "id", "first_name", "last_name", "patients") }} ({{ get_name($family_account->family_head_id, "id", "number", "patients") }}) @php $members_array = explode(",", $family_account->family_members_ids); @endphp
    @for($i=0; $i < count($members_array); $i++)
  1. {{ get_full_name($members_array[$i], "id", "first_name", "last_name", "patients") }} ({{ get_name($members_array[$i], "id", "number", "patients") }})
  2. @endfor
@php $family_deposit_record = \Streamline\Models\FamilyAccountDeposit::where('family_account_id', $family_account->id)->orderBy('id', 'desc')->get(); $last_deposit_amount = 0; if(count($family_deposit_record) > 0){ $last_deposit_record_amount = $family_deposit_record->first(); $last_deposit_amount = $last_deposit_record_amount->deposit_amount; } @endphp {{ ugandan_shillings($last_deposit_amount) }}
(Date: {{ get_name($family_account->id, "family_account_id", "created_at", "family_account_deposits") != "N/A" ? streamline_date(get_name($family_account->id, "family_account_id", "deposit_date", "family_account_deposits")) : "N/A" }})
{{ is_numeric($family_account->current_balance) ? ugandan_shillings($family_account->current_balance) : "N/A" }} @php $current_balance_total += $family_account->current_balance; @endphp {{ is_numeric($family_account->opening_amount) ? ugandan_shillings($family_account->opening_amount) : "" }} {{ is_numeric($family_account->credit_limit) ? ugandan_shillings($family_account->credit_limit) : "" }} {{ __('family_accounts.edit') }} {{ Form::open(['url' => 'family_accounts/add_deposit']) }} {{ Form::hidden('family_account_id', $family_account->id) }} {{ Form::submit('Add deposit', ['class' => 'btn btn-success btn-sm']) }} {{ Form::close() }} Statement {{ Form::model($family_account->id, ['method' => 'DELETE', 'route' => ['family_accounts.destroy', $family_account->id], 'id' => 'delete_form_'.$family_account->id]) }} {{ Form::close() }}
{{ __('family_accounts.total') }} {{ ugandan_shillings($current_balance_total) }}
@endsection @push('scripts') @endpush