@extends('layouts.app') @section('content')
Disconnected Clients

Accounts currently cut off {{ $isSuperAdmin && !$selectedCompanyId ? 'across all companies' : 'for ' . ($company->name ?? 'your company') }}

@if(session('success')) @endif @if(session('info')) @endif {{-- Without these, a refused reconnection redirected back silently and the button looked broken. --}} @if(session('error')) @endif @if($errors->any()) @endif
Disconnected {{ $clients->total() }}
@if($isSuperAdmin)
@endif
@if($isSuperAdmin && $selectedCompanyId) @endif @if(request('search')) @endif
@if($clients->count() > 0)
@if($isSuperAdmin) @endif @foreach($clients as $client) @php $outstanding = $client->billings()->outstanding()->sum('balance'); @endphp @if($isSuperAdmin) @endif @endforeach
NameCompanyAccount # Meter # Address Disconnected Outstanding Actions
{{ $client->name }}{{ $client->company->name ?? 'N/A' }}{{ $client->account_number }} {{ $client->meter_number ?? 'N/A' }} {{ $client->address ?? 'N/A' }} @if($client->disconnected_at) {{ $client->disconnected_at->format('M d, Y') }}
{{ $client->disconnected_at->diffForHumans() }} @else Not recorded @endif
@if($outstanding > 0) ₱{{ number_format($outstanding, 2) }} @else Settled @endif @if(Auth::user()->hasCompanyAdminAccess() || Auth::user()->isSuperAdmin()) {{-- Reconnecting is a payment first: the fee is charged and the account settled, and only then is the job raised. The modal collects that payment. --}} @php($info = $reconnectionInfo[$client->id] ?? ['owed' => 0, 'fee' => 0, 'fee_charged' => true, 'total' => 0]) @endif
@else
@if(request('search')) No disconnected client matches "{{ request('search') }}". @else No clients are disconnected right now. @endif
@endif
{{-- Reconnection payment. Charging the fee and taking the money is the office's step; raising the job happens on submit, and the water only goes back on when a field worker completes that job and it is verified. --}} @if(Auth::user()->hasCompanyAdminAccess() || Auth::user()->isSuperAdmin()) @endif @endsection @section('scripts') @endsection