updated client payment, file upload and notes

This commit is contained in:
Kwesi Banson Jnr
2026-08-08 20:47:45 +00:00
parent daf7d9b9dc
commit 6cce100e62
17 changed files with 508 additions and 94 deletions

View File

@@ -89,6 +89,8 @@
<option value="ussd">USSD</option>
<option value="airtime">Airtime</option>
<option value="voice">Voice</option>
<option value="aggregatevoice">Aggregation Voice</option>
<option value="voice">Voice</option>
</select>
</div>
<div class="col-md-2">

View File

@@ -16,6 +16,7 @@
<div class="mb-3">
<label class="form-label text-muted small fw-bold">Code Type</label>
<select name="code_type" class="form-select" required>
<option value="" selected disabled>-- Select --</option>
<option value="sms">SMS</option>
<option value="ussd">USSD</option>
<option value="voice">Voice</option>
@@ -23,16 +24,44 @@
</div>
<div class="mb-3">
<label class="form-label text-muted small fw-bold">Short Code / Number</label>
<input type="text" name="shortcode" class="form-control" placeholder="e.g. 1234 or *123#" required>
<input type="number" name="shortcode" class="form-control" placeholder="e.g. 5678" required>
</div>
<div class="mb-3">
<label class="form-label text-muted small fw-bold">Network</label>
<input type="text" name="network" class="form-control" placeholder="e.g. MTN, Vodafone, AirtelTigo">
</div>
<div class="mb-3">
<label class="form-label text-muted small fw-bold">Monthly Fee</label>
<input type="text" name="monthly_fee" class="form-control" placeholder="">
</div>
<div class="mb-3">
<label class="form-label text-muted small fw-bold">Toll Free</label>
<select name="toll_free" class="form-select" required>
<option value="" selected disabled>-- Select --</option>
<option value="yes">YES</option>
<option value="no">NO</option>
</select>
</div>
<div class="mb-3">
<label class="form-label text-muted small fw-bold">Status</label>
<select name="status" class="form-select" required>
<option value="" selected disabled>-- Select --</option>
<option value="active">Active</option>
<option value="inactive">Inactive</option>
</select>
</div>
<div class="mb-3">
<label class="form-label text-muted small fw-bold">Launch Date</label>
<input type="date" name="launch_date" class="form-control">
</div>
<div class="mb-3">
<label class="form-label text-muted small fw-bold">Expiry Date</label>
<input type="date" name="expiry_date" class="form-control">
</div>
<div class="mb-3">
<label class="form-label text-muted small fw-bold">Remarks</label>
<textarea name="remarks" class="form-control"></textarea>
</div>
</div>
<div class="modal-footer bg-light">
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Cancel</button>
@@ -63,6 +92,13 @@
<label class="form-label text-muted small fw-bold">Invoice / Reference Number</label>
<input type="text" name="invoice_number" class="form-control" placeholder="e.g. INV-2026-001" required>
</div>
<div class="mb-3">
<label class="form-label text-muted small fw-bold">Services</label>
<select name="services[]" id="paymentServicesSelect" class="form-select" multiple="multiple" required>
<!-- Options will be loaded dynamically via AJAX -->
</select>
<div class="form-text text-muted">Select one or more services associated with this payment.</div>
</div>
<div class="mb-3">
<label class="form-label text-muted small fw-bold">Amount</label>
<input type="number" step="0.01" name="invoice_amount" class="form-control" placeholder="0.00" required>
@@ -91,35 +127,78 @@
<!-- ========================================== -->
<!-- 3. UPLOAD DOCUMENT MODAL -->
<!-- 3. UPLOAD DOCUMENT MODAL (MULTI-FILE) -->
<!-- ========================================== -->
<div class="modal fade" id="uploadDocumentModal" tabindex="-1" aria-labelledby="uploadDocumentModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<form id="documentForm" action="{{ route('client-files.store') }}" method="POST" enctype="multipart/form-data">
@csrf
<input type="hidden" name="client_id" value="{{ $showclient->id }}">
<div class="modal-header">
<h5 class="modal-title fw-bold" id="uploadDocumentModalLabel"><i class="bi bi-file-earmark-arrow-up text-primary me-2"></i>Upload Client Document</h5>
<h5 class="modal-title fw-bold" id="uploadDocumentModalLabel"><i class="bi bi-file-earmark-arrow-up text-primary me-2"></i>Upload Client Documents</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label text-muted small fw-bold">Document Name / Title</label>
<input type="text" name="name" class="form-control" placeholder="e.g. Signed Service Agreement" required>
</div>
<div class="mb-3">
<label class="form-label text-muted small fw-bold">Select File</label>
<input type="file" name="file" class="form-control" required>
<div class="form-text text-muted">Accepted formats: PDF, DOC, DOCX, JPG, PNG (Max size depends on server config).</div>
<div id="fileRowsContainer">
<!-- Initial Row -->
<div class="file-row card border bg-light p-3 mb-3 position-relative">
<div class="row g-2 align-items-center">
<div class="col-md-5">
<label class="form-label text-muted small fw-bold">Document Name / Title</label>
<input type="text" name="names[]" class="form-control" placeholder="e.g. Signed Service Agreement" required>
</div>
<div class="col-md-6">
<label class="form-label text-muted small fw-bold">Select File</label>
<input type="file" name="files[]" class="form-control" required>
</div>
<div class="col-md-1 text-end d-flex align-items-end">
<!-- Delete button hidden for the first row -->
<button type="button" class="btn btn-outline-danger btn-sm remove-row-btn mt-4" style="display: none;"><i class="bi bi-trash"></i></button>
</div>
</div>
</div>
</div>
<!-- Add More Button -->
<button type="button" id="addRowBtn" class="btn btn-sm btn-outline-secondary fw-bold mt-1">
<i class="bi bi-plus-circle me-1"></i> Add Another Document
</button>
<div class="form-text text-muted mt-2">Accepted formats: PDF, DOC, DOCX, JPG, PNG. You can upload multiple files at once.</div>
</div>
<div class="modal-footer bg-light">
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary btn-sm px-4">Upload Document</button>
<button type="submit" class="btn btn-primary btn-sm px-4">Upload All Documents</button>
</div>
</form>
</div>
</div>
</div>
<!-- Client Note Modal -->
<div class="modal fade" id="addNoteModal" tabindex="-1" aria-labelledby="addNoteModalLabel" aria-hidden="true">
<div class="modal-dialog">
<form id="noteForm" action="{{ route('client-notes.store') }}" method="POST">
@csrf
<input type="hidden" name="client_id" value="{{ $showclient->id }}">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title fw-bold">Add Note</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<textarea name="note" class="form-control" rows="4" placeholder="Enter notes here..." required></textarea>
</div>
<div class="modal-footer bg-light">
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary btn-sm">Save Note</button>
</div>
</div>
</form>
</div>
</div>

View File

@@ -296,7 +296,12 @@
<!-- Tab Links -->
<ul class="nav nav-tabs card-header-tabs m-0" id="clientRecordTabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active fw-bold text-dark" id="shortcodes-tab" data-bs-toggle="tab" data-bs-target="#shortcodes-pane" type="button" role="tab">
<button class="nav-link active fw-bold" id="notes-tab" data-bs-toggle="tab" data-bs-target="#notes-pane" type="button">
<i class="bi bi-chat-square-text me-1"></i> Notes
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link fw-bold text-dark" id="shortcodes-tab" data-bs-toggle="tab" data-bs-target="#shortcodes-pane" type="button" role="tab">
<i class="bi bi-code-square text-primary me-1"></i> Short Codes
<span class="badge bg-primary bg-opacity-10 text-primary ms-1">{{ count($voice_codes) + count($sms_codes) + count($ussd_codes) }}</span>
</button>
@@ -331,9 +336,38 @@
</div>
<div class="card-body bg-light tab-content" id="clientRecordTabsContent">
<!-- tab 0 Notes -->
<div class="tab-pane fade show active" id="notes-pane" role="tabpanel" tabindex="0">
<div class="d-flex justify-content-end mb-3">
<button class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#addNoteModal">
<i class="bi bi-plus-lg"></i> Add Note
</button>
</div>
<div class="list-group">
@forelse($show_notes as $note)
<div class="list-group-item p-3 mb-2 border rounded shadow-sm">
<p class="mb-2 text-dark">{{ $note->notes_body }}</p>
<div class="d-flex justify-content-between align-items-center text-muted" style="font-size: 0.8rem;">
<span>
<i class="bi bi-person-fill me-1 text-primary"></i>
<strong class="text-secondary">{{ $note->created_by_info->name ?? 'System User' }}</strong>
</span>
<span>
<i class="bi bi-clock me-1"></i>
{{ $note->created_at->format('d M Y, h:i A') }}
</span>
</div>
</div>
@empty
<div class="text-center py-4 text-muted small">
<i class="bi bi-chat-square-text fs-4 d-block mb-1"></i> No notes added for this client yet.
</div>
@endforelse
</div>
</div>
<!-- TAB 1: SHORT CODES -->
<div class="tab-pane fade show active" id="shortcodes-pane" role="tabpanel" tabindex="0">
<div class="tab-pane fade " id="shortcodes-pane" role="tabpanel" tabindex="0">
@php
$allCodes = collect($voice_codes)->concat($sms_codes)->concat($ussd_codes);
@endphp
@@ -343,22 +377,29 @@
<table class="table table-hover align-middle mb-0 bg-white border rounded">
<thead class="table-light">
<tr style="font-size: 0.8rem;" class="text-secondary text-uppercase">
<th>Type</th>
<th>Shortcode</th>
<th>Network</th>
<th>Status</th>
<th>Expiry Date</th>
<th style="width: 10%;">Type</th>
<th style="width: 15%;">Shortcode</th>
<th style="width: 20%;">Network</th>
<th style="width: 10%;">Status</th>
<th style="width: 30%;">Remarks</th>
<th style="width: 15%;">Expiry Date</th>
</tr>
</thead>
<tbody>
@foreach($allCodes as $code)
<tr>
<td><span class="badge bg-secondary text-uppercase" style="font-size: 0.7rem;">{{ $code->code_type ?? 'N/A' }}</span></td>
<td class="fw-bold text-dark font-monospace">{{ $code->shortcode ?? 'N/A' }}</td>
<td>{{ $code->network ?? 'N/A' }}</td>
<td class="fw-bold text-dark font-monospace text-break">{{ $code->shortcode ?? 'N/A' }}</td>
<td class="text-break">{{ $code->network ?? 'N/A' }}</td>
<td>
<span class="badge bg-success bg-opacity-10 text-success">{{ $code->status ?? 'Active' }}</span>
</td>
<!-- Styled Remarks Column with text-wrap and max-width bounds -->
<td>
<div class="text-muted text-break" style="font-size: 0.9rem; max-width: 250px; line-height: 1.3;">
{{ $code->remarks ?? '-' }}
</div>
</td>
<td class="text-muted small">{{ $code->expiry_date ? \Carbon\Carbon::parse($code->expiry_date)->format('d M Y') : 'N/A' }}</td>
</tr>
@endforeach
@@ -380,6 +421,7 @@
<thead class="table-light">
<tr style="font-size: 0.8rem;" class="text-secondary text-uppercase">
<th>Invoice #</th>
<th>Services</th>
<th>Amount</th>
<th>Date</th>
<th>Status</th>
@@ -389,7 +431,23 @@
@foreach($recent_payments as $payment)
<tr>
<td class="fw-bold text-dark">{{ $payment->invoice_number ?? 'N/A' }}</td>
<td class="fw-semibold text-success">{{ number_format($payment->invoice_amount ?? 0, 2) }}</td>
<td>
@php
$serviceNames = $payment->service_names;
@endphp
@if($serviceNames->count() > 0)
<div class="d-flex flex-wrap gap-1">
@foreach($serviceNames as $serviceName)
<span class="badge bg-light text-primary border" style="font-size: 0.75rem;">
{{ $serviceName }}
</span>
@endforeach
</div>
@else
<span class="text-muted small">-</span>
@endif
</td>
<td class="text-muted small">{{ $payment->invoice_date ? \Carbon\Carbon::parse($payment->invoice_date)->format('d M Y') : 'N/A' }}</td>
<td>
<span class="badge bg-info bg-opacity-10 text-info text-uppercase">{{ $payment->invoice_status ?? 'Pending' }}</span>
@@ -421,7 +479,8 @@
</div>
</div>
@if(!empty($file->file_path))
<a href="{{ asset('storage/client_files/' . $file->file_path) }}" target="_blank" class="btn btn-sm btn-light text-primary" title="Download File">
<a href="{{ route('client-files.download', $file->id) }}" class="btn btn-sm btn-light text-primary" target="_blank" title="{{ $file->name }}">
<i class="bi bi-download"></i>
</a>
@endif
@@ -489,6 +548,8 @@
</div>
@include('clients.partials.shortcode-payment-docs-modal')
@endsection
@section('scripts')
<script src="{{ asset('js/client-show-modals.js') }}"></script>
@endsection
@push('scripts')
<script src="{{ asset('public/assets/js/client-show-modal.js') }}"></script>
<script>
</script>
@endpush

View File

@@ -10,7 +10,11 @@
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
<!-- Select2 CSS -->
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/select2-bootstrap-5-theme@1.3.0/dist/select2-bootstrap-5-theme.min.css" rel="stylesheet" />
<style>
body { background-color: #f8f9fc; }
@@ -55,7 +59,10 @@
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<!-- SweetAlert2 CDN -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<!-- Select2 JS (Place right after jQuery) -->
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script>
$(document).ready(function() {
$.ajaxSetup({
@@ -68,6 +75,7 @@
}
updateClock();
setInterval(updateClock, 1000);
});
</script>